Index: branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/array_search.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/array_search.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/array_search.php (revision 6981) @@ -0,0 +1,54 @@ + | +// +----------------------------------------------------------------------+ +// +// $Id: array_search.php,v 1.1.2.1 2006-12-12 08:16:41 alex Exp $ +// + + +/** + * Replace array_search() + * + * @category PHP + * @package PHP_Compat + * @link http://php.net/array_search + * @author Aidan Lister + * @author Thiemo M�ttig (http://maettig.com/) + * @version $Revision: 1.1.2.1 $ + * @since PHP 4.0.5 + * @require PHP 4.0.1 (trigger_error) + */ +if (!function_exists('array_search')) +{ + function array_search ($needle, $haystack, $strict = false) + { + if (!is_array($haystack)) { + trigger_error("array_search() Wrong datatype for second argument", E_USER_WARNING); + return false; + } + + foreach ($haystack as $key => $value) { + if ($strict ? $value === $needle : $value == $needle) { + return $key; + } + } + + return false; + } +} + +?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/image_type_to_mime_type.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/image_type_to_mime_type.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/image_type_to_mime_type.php (revision 6981) @@ -0,0 +1,128 @@ + | +// +----------------------------------------------------------------------+ +// +// $Id: image_type_to_mime_type.php,v 1.1.2.1 2006-12-12 08:16:41 alex Exp $ +// + + +if (!defined('IMAGETYPE_GIF')) { + define('IMAGETYPE_GIF', 0); +} + +if (!defined('IMAGETYPE_JPEG')) { + define('IMAGETYPE_JPEG', 1); +} + +if (!defined('IMAGETYPE_PNG')) { + define('IMAGETYPE_PNG', 2); +} + +if (!defined('IMAGETYPE_SWF')) { + define('IMAGETYPE_SWF', 3); +} + +if (!defined('IMAGETYPE_PSD')) { + define('IMAGETYPE_PSD', 4); +} + +if (!defined('IMAGETYPE_BMP')) { + define('IMAGETYPE_BMP', 5); +} + +if (!defined('IMAGETYPE_TIFF_II')) { + define('IMAGETYPE_TIFF_II', 6); +} + +if (!defined('IMAGETYPE_TIFF_MM')) { + define('IMAGETYPE_TIFF_MM', 7); +} + +if (!defined('IMAGETYPE_JPC')) { + define('IMAGETYPE_JPC', 8); +} + +if (!defined('IMAGETYPE_JP2')) { + define('IMAGETYPE_JP2', 9); +} + +if (!defined('IMAGETYPE_JPX')) { + define('IMAGETYPE_JPX', 10); +} + +if (!defined('IMAGETYPE_JB2')) { + define('IMAGETYPE_JB2', 11); +} + +if (!defined('IMAGETYPE_SWC')) { + define('IMAGETYPE_SWC', 12); +} + +if (!defined('IMAGETYPE_IFF')) { + define('IMAGETYPE_IFF', 13); +} + +if (!defined('IMAGETYPE_WBMP')) { + define('IMAGETYPE_WBMP', 14); +} + +if (!defined('IMAGETYPE_XBM')) { + define('IMAGETYPE_XBM', 15); +} + + +/** + * Replace image_type_to_mime_type() + * + * @category PHP + * @package PHP_Compat + * @link http://php.net/function.image_type_to_mime_type + * @author Aidan Lister + * @version $Revision: 1.1.2.1 $ + * @since PHP 4.3.0 + * @require PHP 3 + */ +if (!function_exists('image_type_to_mime_type')) +{ + function image_type_to_mime_type ($imagetype) + { + static $image_type_to_mime_type = array ( + IMAGETYPE_GIF => 'image/gif', + IMAGETYPE_JPEG => 'image/jpeg', + IMAGETYPE_PNG => 'image/png', + IMAGETYPE_SWF => 'application/x-shockwave-flash', + IMAGETYPE_PSD => 'image/psd', + IMAGETYPE_BMP => 'image/bmp', + IMAGETYPE_TIFF_II => 'image/tiff', + IMAGETYPE_TIFF_MM => 'image/tiff', + IMAGETYPE_JPC => 'application/octet-stream', + IMAGETYPE_JP2 => 'image/jp2', + IMAGETYPE_JPX => 'application/octet-stream', + IMAGETYPE_JB2 => 'application/octet-stream', + IMAGETYPE_SWC => 'application/x-shockwave-flash', + IMAGETYPE_IFF => 'image/iff', + IMAGETYPE_WBMP => 'image/vnd.wap.wbmp', + IMAGETYPE_XBM => 'image/xbm', + ); + + return (isset($image_type_to_mime_type[$imagetype]) ? + $image_type_to_mime_type[$imagetype] : + $image_type_to_mime_type[IMAGETYPE_JPC]); + } +} + +?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.44.2/kernel/startup.php =================================================================== diff -u -N -r6801 -r6981 --- branches/unlabeled/unlabeled-1.44.2/kernel/startup.php (.../startup.php) (revision 6801) +++ branches/unlabeled/unlabeled-1.44.2/kernel/startup.php (.../startup.php) (revision 6981) @@ -63,8 +63,9 @@ $kernel_version = "1.0.0"; $FormError = array(); $FormValues = array(); + /* include PHP version compatibility functions */ -require_once(FULL_PATH.'/compat.php'); +require_once(FULL_PATH.'/kernel/include/compat.php'); /* set global variables and module lists */ if( constOn('DEBUG_MODE') ) include_once(FULL_PATH.'/kernel/include/debugger.php'); Index: branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/vsprintf.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/vsprintf.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/vsprintf.php (revision 6981) @@ -0,0 +1,47 @@ + | +// +----------------------------------------------------------------------+ +// +// $Id: vsprintf.php,v 1.1.2.1 2006-12-12 08:16:42 alex Exp $ +// + + +/** + * Replace vsprintf() + * + * @category PHP + * @package PHP_Compat + * @link http://php.net/function.vsprintf + * @author Aidan Lister + * @version $Revision: 1.1.2.1 $ + * @since PHP 4.1.0 + * @require PHP 4.0.4 (call_user_func_array) + */ +if (!function_exists('vsprintf')) +{ + function vsprintf ($format, $args) + { + if (count($args) < 2) { + trigger_error('vsprintf() Too few arguments', E_USER_WARNING); + return null; + } + + array_unshift($args, $format); + return call_user_func_array('sprintf', $args); + } +} +?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/ob_flush.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/ob_flush.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/ob_flush.php (revision 6981) @@ -0,0 +1,49 @@ + | +// +----------------------------------------------------------------------+ +// +// $Id: ob_flush.php,v 1.1.2.1 2006-12-12 08:16:41 alex Exp $ +// + + +/** + * Replace ob_flush() + * + * @category PHP + * @package PHP_Compat + * @link http://php.net/ob_flush + * @author Aidan Lister + * @author Thiemo M�ttig (http://maettig.com/) + * @version $Revision: 1.1.2.1 $ + * @since PHP 4.2.0 + * @require PHP 4.0.1 (trigger_error) + */ +if (!function_exists('ob_flush')) +{ + function ob_flush () + { + if (@ob_end_flush()) { + return ob_start(); + } + + trigger_error("ob_flush() Failed to flush buffer. No buffer to flush.", E_USER_NOTICE); + + return false; + } +} + +?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/array_udiff_assoc.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/array_udiff_assoc.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/array_udiff_assoc.php (revision 6981) @@ -0,0 +1,90 @@ + | +// | Aidan Lister | +// +----------------------------------------------------------------------+ +// +// $Id: array_udiff_assoc.php,v 1.1.2.1 2006-12-12 08:16:41 alex Exp $ +// + + +/** + * Replace array_udiff_assoc() + * + * @category PHP + * @package PHP_Compat + * @author Stephan Schmidt + * @author Aidan Lister + * @version $Revision: 1.1.2.1 $ + * @link http://php.net/function.array-udiff-assoc + * @since PHP 5 + * @require PHP 4.0.1 (trigger_error) + */ +if (!function_exists('array_udiff_assoc')) +{ + function array_udiff_assoc () + { + $args = func_get_args(); + if (count($args) < 3) { + trigger_error('Wrong parameter count for array_udiff()', E_USER_WARNING); + return null; + } + + // Get compare function + $compare_func = array_pop($args); + if (!is_callable($compare_func)) + { + if (is_array($compare_func)) { + $compare_func = $compare_func[0].'::'.$compare_func[1]; + } + trigger_error('array_udiff() Not a valid callback ' . $compare_func, E_USER_WARNING); + return null; + } + + // Check arrays + $count = count($args); + for ($i = 0; $i < $count; $i++) + { + if (!is_array($args[$i])) { + trigger_error('array_udiff() Argument #' . ($i + 1) . ' is not an array', E_USER_WARNING); + return null; + } + } + + $diff = array (); + // Traverse values of the first array + foreach ($args[0] as $key => $value) + { + // Check all arrays + for ($i = 1; $i < $count; $i++) + { + if (!isset($args[$i][$key])) { + continue; + } + $result = call_user_func($compare_func, $value, $args[$i][$key]); + if ($result === 0) { + continue 2; + } + } + + $diff[$key] = $value; + } + + return $diff; + } +} + +?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/ob_clean.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/ob_clean.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/ob_clean.php (revision 6981) @@ -0,0 +1,49 @@ + | +// +----------------------------------------------------------------------+ +// +// $Id: ob_clean.php,v 1.1.2.1 2006-12-12 08:16:41 alex Exp $ +// + + +/** + * Replace ob_clean() + * + * @category PHP + * @package PHP_Compat + * @link http://php.net/ob_clean + * @author Aidan Lister + * @author Thiemo M�ttig (http://maettig.com/) + * @version $Revision: 1.1.2.1 $ + * @since PHP 4.2.0 + * @require PHP 4.0.1 (trigger_error) + */ +if (!function_exists('ob_clean')) +{ + function ob_clean () + { + if (@ob_end_clean()) { + return ob_start(); + } + + trigger_error("ob_clean() failed to delete buffer. No buffer to delete.", E_USER_NOTICE); + + return false; + } +} + +?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/file_put_contents.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/file_put_contents.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/file_put_contents.php (revision 6981) @@ -0,0 +1,105 @@ + | +// +----------------------------------------------------------------------+ +// +// $Id: file_put_contents.php,v 1.1.2.1 2006-12-12 08:16:41 alex Exp $ +// + + +if (!defined('FILE_USE_INCLUDE_PATH')) { + define('FILE_USE_INCLUDE_PATH', 1); +} + +if (!defined('FILE_APPEND')) { + define('FILE_APPEND', 8); +} + + +/** + * Replace file_put_contents() + * + * @category PHP + * @package PHP_Compat + * @link http://php.net/function.file_put_contents + * @author Aidan Lister + * @version $Revision: 1.1.2.1 $ + * @internal $resource_context is not supported + * @since PHP 5 + * @require PHP 4.0.1 (trigger_error) + */ +if (!function_exists('file_put_contents')) +{ + function file_put_contents ($filename, $content, $flags = null, $resource_context = null) + { + // If $content is an array, convert it to a string + if (is_array($content)) { + $content = implode('', $content); + } + + // If we don't have a string, throw an error + if (!is_string($content)) { + trigger_error('file_put_contents() The 2nd parameter should be either a string or an array', E_USER_WARNING); + return false; + } + + // Get the length of date to write + $length = strlen($content); + + // Check what mode we are using + $mode = ($flags & FILE_APPEND) ? + $mode = 'a' : + $mode = 'w'; + + // Check if we're using the include path + $use_inc_path = ($flags & FILE_USE_INCLUDE_PATH) ? + true : + false; + + // Open the file for writing + if (($fh = @fopen($filename, $mode, $use_inc_path)) === false) { + trigger_error('file_put_contents() failed to open stream: Permission denied', E_USER_WARNING); + return false; + } + + // Write to the file + $bytes = 0; + if (($bytes = @fwrite($fh, $content)) === false) { + $errormsg = sprintf('file_put_contents() Failed to write %d bytes to %s', + $length, + $filename); + trigger_error($errormsg, E_USER_WARNING); + return false; + } + + // Close the handle + @fclose($fh); + + // Check all the data was written + if ($bytes != $length) { + $errormsg = sprintf('file_put_contents() Only %d of %d bytes written, possibly out of free disk space.', + $bytes, + $length); + trigger_error($errormsg, E_USER_WARNING); + return false; + } + + // Return length + return $bytes; + } +} + +?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/scandir.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/scandir.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/scandir.php (revision 6981) @@ -0,0 +1,70 @@ + | +// +----------------------------------------------------------------------+ +// +// $Id: scandir.php,v 1.1.2.1 2006-12-12 08:16:41 alex Exp $ +// + + +/** + * Replace scandir() + * + * @category PHP + * @package PHP_Compat + * @link http://php.net/function.scandir + * @author Aidan Lister + * @version $Revision: 1.1.2.1 $ + * @since PHP 5 + * @require PHP 4.0.1 (trigger_error) + */ +if (!function_exists('scandir')) +{ + function scandir ($directory, $sorting_order = 0) + { + if (!is_string($directory)) { + trigger_error('scandir() expects parameter 1 to be string, ' . gettype($directory) . ' given', E_USER_WARNING); + return null; + } + + if (!is_int($sorting_order)) { + trigger_error('scandir() expects parameter 2 to be long, ' . gettype($sorting_order) . ' given', E_USER_WARNING); + return null; + } + + if (!is_dir($directory) || (false === $fh = @opendir($directory))) { + trigger_error('scandir() failed to open dir: Invalid argument', E_USER_WARNING); + return false; + } + + $files = array (); + while (false !== ($filename = readdir($fh))) { + $files[] = $filename; + } + + closedir($fh); + + if ($sorting_order == 1) { + rsort($files); + } else { + sort($files); + } + + return $files; + } +} + +?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/array_key_exists.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/array_key_exists.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/array_key_exists.php (revision 6981) @@ -0,0 +1,56 @@ + | +// +----------------------------------------------------------------------+ +// +// $Id: array_key_exists.php,v 1.1.2.1 2006-12-12 08:16:41 alex Exp $ +// + + +/** + * Replace array_key_exists() + * + * @category PHP + * @package PHP_Compat + * @link http://php.net/array_key_exists + * @author Aidan Lister + * @version $Revision: 1.1.2.1 $ + * @since PHP 4.1.0 + * @require PHP 4.0.1 (trigger_error) + */ +if (!function_exists('array_key_exists')) +{ + function array_key_exists ($key, $search) + { + if (!is_scalar($key)) { + trigger_error('array_key_exists() The first argument should be either a string or an integer', E_USER_WARNING); + return false; + } + + if (is_object($search)) { + $search = get_object_vars($search); + } + + if (!is_array($search)) { + trigger_error('array_key_exists() The second argument should be either an array or an object', E_USER_WARNING); + return false; + } + + return in_array($key, array_keys($search)); + } +} + +?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/constant.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/constant.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/constant.php (revision 6981) @@ -0,0 +1,50 @@ + | +// +----------------------------------------------------------------------+ +// +// $Id: constant.php,v 1.1.2.1 2006-12-12 08:16:41 alex Exp $ +// + + +/** + * Replace constant() + * + * @category PHP + * @package PHP_Compat + * @link http://php.net/constant + * @author Aidan Lister + * @version $Revision: 1.1.2.1 $ + * @since PHP 4.0.4 + * @require PHP 4.0.1 (trigger_error) + */ +if (!function_exists('constant')) +{ + function constant ($constant) + { + if (!defined($constant)) { + $error = sprintf('constant() Couldn\'t find constant %s', $constant); + trigger_error($error, E_USER_WARNING); + return false; + } + + eval("\$value=$constant;"); + + return $value; + } +} + +?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.96/compat/array_change_key_case.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.96/compat/array_change_key_case.php (revision 14) +++ branches/unlabeled/unlabeled-1.1.96/compat/array_change_key_case.php (revision 0) @@ -1,65 +0,0 @@ - | -// | Aidan Lister | -// +----------------------------------------------------------------------+ -// -// $Id: array_change_key_case.php,v 1.1 2004-10-26 18:22:16 kostja Exp $ -// - - -if (!defined('CASE_LOWER')) { - define('CASE_LOWER', 0); -} - -if (!defined('CASE_UPPER')) { - define('CASE_UPPER', 1); -} - - -/** - * Replace array_change_key_case() - * - * @category PHP - * @package PHP_Compat - * @link http://php.net/function.array_change_key_case - * @author Stephan Schmidt - * @author Aidan Lister - * @version $Revision: 1.1 $ - * @since PHP 4.2.0 - * @require PHP 4.0.1 (trigger_error) - */ -if (!function_exists('array_change_key_case')) -{ - function array_change_key_case ($input, $case = CASE_LOWER) - { - if (!is_array($input)) { - trigger_error('array_change_key_case(): The argument should be an array', E_USER_WARNING); - return false; - } - - $output = array (); - $keys = array_keys($input); - $casefunc = ($case == CASE_LOWER) ? 'strtolower' : 'strtoupper'; - - foreach ($keys as $key) { - $output[$casefunc($key)] = $input[$key]; - } - - return $output; - } -} -?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.96/compat/var_export.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.96/compat/var_export.php (revision 14) +++ branches/unlabeled/unlabeled-1.1.96/compat/var_export.php (revision 0) @@ -1,103 +0,0 @@ - | -// +----------------------------------------------------------------------+ -// -// $Id: var_export.php,v 1.1 2004-10-26 18:22:16 kostja Exp $ -// - - -/** - * Replace var_export() - * - * @category PHP - * @package PHP_Compat - * @link http://php.net/function.var_export - * @author Aidan Lister - * @version $Revision: 1.1 $ - * @since PHP 4.2.0 - * @require PHP 4.0.1 (trigger_error) - */ -if (!function_exists('var_export')) -{ - function var_export ($array, $return = false) - { - // Common output variables - $indent = ' '; - $doublearrow = ' => '; - $lineend = ",\n"; - $stringdelim = '\''; - $newline = "\n"; - - // Check the export isn't a simple string / int - if (is_string($array)) { - $out = $stringdelim . $array . $stringdelim; - } - elseif (is_int($array)) { - $out = (string)$array; - } - - // Begin the array export - else - { - // Start the string - $out = "array (\n"; - - // Loop through each value in array - foreach ($array as $key => $value) - { - // If the key is a string, delimit it - if (is_string($key)) { - $key = $stringdelim . addslashes($key) . $stringdelim; - } - - // If the value is a string, delimit it - if (is_string($value)) { - $value = $stringdelim . addslashes($value) . $stringdelim; - } - - // We have an array, so do some recursion - elseif (is_array($value)) - { - // Do some basic recursion while increasing the indent - $recur_array = explode($newline, var_export($value, true)); - $recur_newarr = array (); - foreach ($recur_array as $recur_line) { - $recur_newarr[] = $indent . $recur_line; - } - $recur_array = implode($newline, $recur_newarr); - $value = $newline . $recur_array; - } - - // Piece together the line - $out .= $indent . $key . $doublearrow . $value . $lineend; - } - - // End our string - $out .= ")"; - } - - - // Decide method of output - if ($return === true) { - return $out; - } else { - echo $out; - return null; - } - } -} -?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.96/compat/stripos.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.96/compat/stripos.php (revision 14) +++ branches/unlabeled/unlabeled-1.1.96/compat/stripos.php (revision 0) @@ -1,71 +0,0 @@ - | -// +----------------------------------------------------------------------+ -// -// $Id: stripos.php,v 1.1 2004-10-26 18:22:16 kostja Exp $ -// - - -/** - * Replace stripos() - * - * @category PHP - * @package PHP_Compat - * @link http://php.net/function.stripos - * @author Aidan Lister - * @version $Revision: 1.1 $ - * @since PHP 5 - * @require PHP 4.0.1 (trigger_error) - */ -if (!function_exists('stripos')) -{ - function stripos ($haystack, $needle, $offset = null) - { - if (!is_scalar($haystack)) { - trigger_error('stripos() expects parameter 1 to be string, ' . gettype($haystack) . ' given', E_USER_WARNING); - return false; - } - - if (!is_scalar($needle)) { - trigger_error('stripos() needle is not a string or an integer.', E_USER_WARNING); - return false; - } - - if (!is_null($offset) && !is_numeric($offset)) { - trigger_error('stripos() expects parameter 3 to be long, ' . gettype($offset) . ' given', E_USER_WARNING); - return false; - } - - // Manipulate the string if there is an offset - $fix = 0; - if (!is_null($offset)) - { - if ($offset > 0) - { - $haystack = substr($haystack, $offset, strlen($haystack) - $offset); - $fix = $offset; - } - } - - $segments = explode (strtolower($needle), strtolower($haystack), 2); - $position = strlen($segments[0]) + $fix; - - return $position; - } -} - -?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.96/compat/array_udiff_assoc.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.96/compat/array_udiff_assoc.php (revision 14) +++ branches/unlabeled/unlabeled-1.1.96/compat/array_udiff_assoc.php (revision 0) @@ -1,90 +0,0 @@ - | -// | Aidan Lister | -// +----------------------------------------------------------------------+ -// -// $Id: array_udiff_assoc.php,v 1.1 2004-10-26 18:22:16 kostja Exp $ -// - - -/** - * Replace array_udiff_assoc() - * - * @category PHP - * @package PHP_Compat - * @author Stephan Schmidt - * @author Aidan Lister - * @version $Revision: 1.1 $ - * @link http://php.net/function.array-udiff-assoc - * @since PHP 5 - * @require PHP 4.0.1 (trigger_error) - */ -if (!function_exists('array_udiff_assoc')) -{ - function array_udiff_assoc () - { - $args = func_get_args(); - if (count($args) < 3) { - trigger_error('Wrong parameter count for array_udiff()', E_USER_WARNING); - return null; - } - - // Get compare function - $compare_func = array_pop($args); - if (!is_callable($compare_func)) - { - if (is_array($compare_func)) { - $compare_func = $compare_func[0].'::'.$compare_func[1]; - } - trigger_error('array_udiff() Not a valid callback ' . $compare_func, E_USER_WARNING); - return null; - } - - // Check arrays - $count = count($args); - for ($i = 0; $i < $count; $i++) - { - if (!is_array($args[$i])) { - trigger_error('array_udiff() Argument #' . ($i + 1) . ' is not an array', E_USER_WARNING); - return null; - } - } - - $diff = array (); - // Traverse values of the first array - foreach ($args[0] as $key => $value) - { - // Check all arrays - for ($i = 1; $i < $count; $i++) - { - if (!isset($args[$i][$key])) { - continue; - } - $result = call_user_func($compare_func, $value, $args[$i][$key]); - if ($result === 0) { - continue 2; - } - } - - $diff[$key] = $value; - } - - return $diff; - } -} - -?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.96/compat/constant.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.96/compat/constant.php (revision 14) +++ branches/unlabeled/unlabeled-1.1.96/compat/constant.php (revision 0) @@ -1,50 +0,0 @@ - | -// +----------------------------------------------------------------------+ -// -// $Id: constant.php,v 1.1 2004-10-26 18:22:16 kostja Exp $ -// - - -/** - * Replace constant() - * - * @category PHP - * @package PHP_Compat - * @link http://php.net/constant - * @author Aidan Lister - * @version $Revision: 1.1 $ - * @since PHP 4.0.4 - * @require PHP 4.0.1 (trigger_error) - */ -if (!function_exists('constant')) -{ - function constant ($constant) - { - if (!defined($constant)) { - $error = sprintf('constant() Couldn\'t find constant %s', $constant); - trigger_error($error, E_USER_WARNING); - return false; - } - - eval("\$value=$constant;"); - - return $value; - } -} - -?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.96/compat/call_user_func_array.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.96/compat/call_user_func_array.php (revision 14) +++ branches/unlabeled/unlabeled-1.1.96/compat/call_user_func_array.php (revision 0) @@ -1,80 +0,0 @@ - | -// +----------------------------------------------------------------------+ -// -// $Id: call_user_func_array.php,v 1.1 2004-10-26 18:22:16 kostja Exp $ -// - - -/** - * Replace call_user_func_array() - * - * @category PHP - * @package PHP_Compat - * @link http://php.net/call_user_func_array - * @author Aidan Lister - * @version $Revision: 1.1 $ - * @since PHP 4.0.4 - * @require PHP 4.0.1 (trigger_error) - */ -if (!function_exists('call_user_func_array')) -{ - function call_user_func_array ($function, $param_arr) - { - $param_arr = (array) $param_arr; - - // Sanity check - if (!is_callable($function)) - { - if (is_array($function) && count($function) > 2) { - $function = $function[0] . '::' . $function[1]; - } - $error = sprintf('call_user_func_array() First argument is expected to be a valid callback, \'%s\' was given', $function); - trigger_error($error, E_USER_WARNING); - return null; - } - - // Build argument string - $arg_string = ''; - $comma = ''; - for ($i = 0, $x = count($param_arr); $i < $x; $i++) { - $arg_string .= $comma . "\$param_arr[$i]"; - $comma = ', '; - } - - // Determine method of calling function - if (is_array($function)) - { - $object =& $function[0]; - $method = $function[1]; - - // Static vs method call - if (is_string($function[0])) { - eval("\$retval = $object::\$method($arg_string);"); - } else { - eval("\$retval = \$object->\$method($arg_string);"); - } - } - else { - eval("\$retval = \$function($arg_string);"); - } - - return $retval; - } -} - -?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.96/compat/array_combine.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.96/compat/array_combine.php (revision 14) +++ branches/unlabeled/unlabeled-1.1.96/compat/array_combine.php (revision 0) @@ -1,71 +0,0 @@ - | -// +----------------------------------------------------------------------+ -// -// $Id: array_combine.php,v 1.1 2004-10-26 18:22:16 kostja Exp $ -// - - -/** - * Replace array_combine() - * - * @category PHP - * @package PHP_Compat - * @link http://php.net/function.array_combine - * @author Aidan Lister - * @version $Revision: 1.1 $ - * @since PHP 5 - * @require PHP 4.0.1 (trigger_error) - */ -if (!function_exists('array_combine')) -{ - function array_combine ($keys, $values) - { - if (!is_array($keys)) { - trigger_error('array_combine() expects parameter 1 to be array, ' . gettype($keys) . ' given', E_USER_WARNING); - return null; - } - - if (!is_array($values)) { - trigger_error('array_combine() expects parameter 2 to be array, ' . gettype($values) . ' given', E_USER_WARNING); - return null; - } - - if (count($keys) !== count($values)) { - trigger_error('array_combine() Both parameters should have equal number of elements', E_USER_WARNING); - return false; - } - - if (count($keys) === 0 || count($values) === 0) { - trigger_error('array_combine() Both parameters should have number of elements at least 0', E_USER_WARNING); - return false; - } - - $keys = array_values($keys); - $values = array_values($values); - - $combined = array (); - - for ($i = 0, $cnt = count($values); $i < $cnt; $i++) { - $combined[$keys[$i]] = $values[$i]; - } - - return $combined; - } -} - -?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.96/compat/http_build_query.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.96/compat/http_build_query.php (revision 14) +++ branches/unlabeled/unlabeled-1.1.96/compat/http_build_query.php (revision 0) @@ -1,101 +0,0 @@ - | -// | Aidan Lister -// +----------------------------------------------------------------------+ -// -// $Id: http_build_query.php,v 1.1 2004-10-26 18:22:16 kostja Exp $ -// - - -/** - * Replace function http_build_query() - * - * @category PHP - * @package PHP_Compat - * @link http://php.net/function.http-build-query - * @author Stephan Schmidt - * @author Aidan Lister - * @version $Revision: 1.1 $ - * @since PHP 5 - * @require PHP 4.0.1 (trigger_error) - */ -if (!function_exists('http_build_query')) -{ - function http_build_query ($formdata, $numeric_prefix = null) - { - // If $formdata is an object, convert it to an array - if (is_object($formdata)) { - $formdata = get_object_vars($formdata); - } - - // Check we have an array to work with - if (!is_array($formdata)) { - trigger_error('http_build_query() Parameter 1 expected to be Array or Object. Incorrect value given.', E_USER_WARNING); - return false; - } - - // If the array is empty, return null - if (empty($formdata)) { - return null; - } - - // Start building the query - $tmp = array (); - foreach ($formdata as $key => $val) - { - if (is_integer($key) && $numeric_prefix != null) { - $key = $numeric_prefix . $key; - } - - if (is_scalar($val)) { - array_push($tmp, urlencode($key).'='.urlencode($val)); - continue; - } - - // If the value is an array, recursively parse it - if (is_array($val)) { - array_push($tmp, __http_build_query($val, urlencode($key))); - continue; - } - } - - return implode('&', $tmp); - } - - // Helper function - function __http_build_query ($array, $name) - { - $tmp = array (); - foreach ($array as $key => $value) - { - if (is_array($value)) { - array_push($tmp, __http_build_query($value, sprintf('%s[%s]', $name, $key))); - } - - elseif (is_scalar($value)) { - array_push($tmp, sprintf('%s[%s]=%s', $name, urlencode($key), urlencode($value))); - } - - elseif (is_object($value)) { - array_push($tmp, __http_build_query(get_object_vars($value), sprintf('%s[%s]', $name, $key))); - } - } - - return implode('&', $tmp); - } -} -?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.96/compat/array_key_exists.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.96/compat/array_key_exists.php (revision 14) +++ branches/unlabeled/unlabeled-1.1.96/compat/array_key_exists.php (revision 0) @@ -1,56 +0,0 @@ - | -// +----------------------------------------------------------------------+ -// -// $Id: array_key_exists.php,v 1.1 2004-10-26 18:22:16 kostja Exp $ -// - - -/** - * Replace array_key_exists() - * - * @category PHP - * @package PHP_Compat - * @link http://php.net/array_key_exists - * @author Aidan Lister - * @version $Revision: 1.1 $ - * @since PHP 4.1.0 - * @require PHP 4.0.1 (trigger_error) - */ -if (!function_exists('array_key_exists')) -{ - function array_key_exists ($key, $search) - { - if (!is_scalar($key)) { - trigger_error('array_key_exists() The first argument should be either a string or an integer', E_USER_WARNING); - return false; - } - - if (is_object($search)) { - $search = get_object_vars($search); - } - - if (!is_array($search)) { - trigger_error('array_key_exists() The second argument should be either an array or an object', E_USER_WARNING); - return false; - } - - return in_array($key, array_keys($search)); - } -} - -?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.96/compat/str_split.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.96/compat/str_split.php (revision 14) +++ branches/unlabeled/unlabeled-1.1.96/compat/str_split.php (revision 0) @@ -1,53 +0,0 @@ - | -// +----------------------------------------------------------------------+ -// -// $Id: str_split.php,v 1.1 2004-10-26 18:22:16 kostja Exp $ -// - - -/** - * Replace str_split() - * - * @category PHP - * @package PHP_Compat - * @link http://php.net/function.str_split - * @author Aidan Lister - * @version $Revision: 1.1 $ - * @since PHP 5 - * @require PHP 4.0.1 (trigger_error) - */ -if (!function_exists('str_split')) -{ - function str_split ($string, $split_length = 1) - { - if (!is_numeric($split_length)) { - trigger_error('str_split() expects parameter 2 to be long, ' . gettype($split_length) . ' given', E_USER_WARNING); - return false; - } - - if ($split_length < 1) { - trigger_error('str_split() The the length of each segment must be greater then zero', E_USER_WARNING); - return false; - } - - preg_match_all('/.{1,' . $split_length . '}/s', $string, $matches); - return $matches[0]; - } -} - -?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.96/compat/fprintf.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.96/compat/fprintf.php (revision 14) +++ branches/unlabeled/unlabeled-1.1.96/compat/fprintf.php (revision 0) @@ -1,56 +0,0 @@ - | -// +----------------------------------------------------------------------+ -// -// $Id: fprintf.php,v 1.1 2004-10-26 18:22:16 kostja Exp $ -// - - -/** - * Replace fprintf() - * - * @category PHP - * @package PHP_Compat - * @link http://php.net/function.fprintf - * @author Aidan Lister - * @version $Revision: 1.1 $ - * @since PHP 5 - * @require PHP 4.0.1 (trigger_error) - */ -if (!function_exists('fprintf')) -{ - function fprintf () { - $args = func_get_args(); - - if (count($args) < 2) { - trigger_error ('Wrong parameter count for fprintf()', E_USER_WARNING); - return null; - } - - $resource_handle = array_shift($args); - $format = array_shift($args); - - if (!is_resource($resource_handle)) { - trigger_error ('fprintf(): supplied argument is not a valid stream resource', E_USER_WARNING); - return false; - } - - return fwrite($resource_handle, vsprintf($format, $args)); - } -} - -?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.96/compat/html_entity_decode.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.96/compat/html_entity_decode.php (revision 14) +++ branches/unlabeled/unlabeled-1.1.96/compat/html_entity_decode.php (revision 0) @@ -1,74 +0,0 @@ - | -// | Aidan Lister | -// +----------------------------------------------------------------------+ -// -// $Id: html_entity_decode.php,v 1.1 2004-10-26 18:22:16 kostja Exp $ -// - - -if (!defined('ENT_NOQUOTES')) { - define('ENT_NOQUOTES', 0); -} - -if (!defined('ENT_COMPAT')) { - define('ENT_COMPAT', 2); -} - -if (!defined('ENT_QUOTES')) { - define('ENT_QUOTES', 3); -} - - -/** - * Replace html_entity_decode() - * - * @category PHP - * @package PHP_Compat - * @link http://php.net/function.html_entity_decode - * @author David Irvine - * @author Aidan Lister - * @version $Revision: 1.1 $ - * @since PHP 4.3.0 - * @internal Setting the charset will not do anything - * @require PHP 4.0.1 (trigger_error) - */ -if (!function_exists('html_entity_decode')) -{ - function html_entity_decode ($string, $quote_style = ENT_COMPAT, $charset = null) - { - if (!is_int($quote_style)) { - trigger_error('html_entity_decode() expects parameter 2 to be long, ' . gettype($quote_style) . ' given', E_USER_WARNING); - return null; - } - - $trans_tbl = get_html_translation_table(HTML_ENTITIES); - $trans_tbl = array_flip($trans_tbl); - - // Add single quote to translation table; - $trans_tbl['''] = '\''; - - // Not translating double quotes - if ($quote_style & ENT_NOQUOTES) { - // Remove double quote from translation table - unset($trans_tbl['"']); - } - - return strtr($string, $trans_tbl); - } -} -?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.96/compat/str_ireplace.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.96/compat/str_ireplace.php (revision 14) +++ branches/unlabeled/unlabeled-1.1.96/compat/str_ireplace.php (revision 0) @@ -1,119 +0,0 @@ - | -// +----------------------------------------------------------------------+ -// -// $Id: str_ireplace.php,v 1.1 2004-10-26 18:22:16 kostja Exp $ -// - - -/** - * Replace str_ireplace() - * - * @category PHP - * @package PHP_Compat - * @link http://php.net/function.str_ireplace - * @author Aidan Lister - * @version $Revision: 1.1 $ - * @since PHP 5 - * @internal count not by returned by reference - not possible in php4 - * @require PHP 4.0.1 (trigger_error) - */ -if (!function_exists('str_ireplace')) -{ - function str_ireplace ($search, $replace, $subject, $count = null) - { - if (is_string($search) && is_array($replace)) { - trigger_error('Array to string conversion', E_USER_NOTICE); - $replace = (string) $replace; - } - - // If search isn't an array, make it one - if (!is_array($search)) { - $search = array ($search); - } - - // If replace isn't an array, make it one, and pad it to the length of search - if (!is_array($replace)) - { - $replace_string = $replace; - - $replace = array (); - for ($i = 0, $c = count($search); $i < $c; $i++) - { - $replace[$i] = $replace_string; - } - } - - // Check the replace array is padded to the correct length - $length_replace = count($replace); - $length_search = count($search); - if ($length_replace < $length_search) - { - for ($i = $length_replace; $i < $length_search; $i++) - { - $replace[$i] = ''; - } - } - - // If subject is not an array, make it one - $was_array = false; - if (!is_array($subject)) { - $was_array = true; - $subject = array ($subject); - } - - // Loop through each subject - $count = 0; - foreach ($subject as $subject_key => $subject_value) - { - // Loop through each search - foreach ($search as $search_key => $search_value) - { - // Split the array into segments, in between each part is our search - $segments = explode(strtolower($search_value), strtolower($subject_value)); - - // The number of replacements done is the number of segments minus the first - $count += count($segments) - 1; - $pos = 0; - - // Loop through each segment - foreach ($segments as $segment_key => $segment_value) - { - // Replace the lowercase segments with the upper case versions - $segments[$segment_key] = substr($subject_value, $pos, strlen($segment_value)); - // Increase the position relative to the initial string - $pos += strlen($segment_value) + strlen($search_value); - } - - // Put our original string back together - $subject_value = implode($replace[$search_key], $segments); - } - - $result[$subject_key] = $subject_value; - } - - // Check if subject was initially a string and return it as a string - if ($was_array === true) { - return $result[0]; - } - - // Otherwise, just return the array - return $result; - } -} - -?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.96/compat/scandir.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.96/compat/scandir.php (revision 14) +++ branches/unlabeled/unlabeled-1.1.96/compat/scandir.php (revision 0) @@ -1,70 +0,0 @@ - | -// +----------------------------------------------------------------------+ -// -// $Id: scandir.php,v 1.1 2004-10-26 18:22:16 kostja Exp $ -// - - -/** - * Replace scandir() - * - * @category PHP - * @package PHP_Compat - * @link http://php.net/function.scandir - * @author Aidan Lister - * @version $Revision: 1.1 $ - * @since PHP 5 - * @require PHP 4.0.1 (trigger_error) - */ -if (!function_exists('scandir')) -{ - function scandir ($directory, $sorting_order = 0) - { - if (!is_string($directory)) { - trigger_error('scandir() expects parameter 1 to be string, ' . gettype($directory) . ' given', E_USER_WARNING); - return null; - } - - if (!is_int($sorting_order)) { - trigger_error('scandir() expects parameter 2 to be long, ' . gettype($sorting_order) . ' given', E_USER_WARNING); - return null; - } - - if (!is_dir($directory) || (false === $fh = @opendir($directory))) { - trigger_error('scandir() failed to open dir: Invalid argument', E_USER_WARNING); - return false; - } - - $files = array (); - while (false !== ($filename = readdir($fh))) { - $files[] = $filename; - } - - closedir($fh); - - if ($sorting_order == 1) { - rsort($files); - } else { - sort($files); - } - - return $files; - } -} - -?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.96/compat/array_diff_assoc.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.96/compat/array_diff_assoc.php (revision 14) +++ branches/unlabeled/unlabeled-1.1.96/compat/array_diff_assoc.php (revision 0) @@ -1,80 +0,0 @@ - | -// +----------------------------------------------------------------------+ -// -// $Id: array_diff_assoc.php,v 1.1 2004-10-26 18:22:16 kostja Exp $ -// - - -/** - * Replace array_diff_assoc() - * - * @category PHP - * @package PHP_Compat - * @link http://php.net/function.array_diff_assoc - * @author Aidan Lister - * @version $Revision: 1.1 $ - * @since PHP 4.3.0 - * @require PHP 4.0.1 (trigger_error) - */ -if (!function_exists('array_diff_assoc')) -{ - function array_diff_assoc () - { - // Check we have enough arguments - $args = func_get_args(); - $count = count($args); - if (count($args) < 2) { - trigger_error('Wrong parameter count for array_diff_assoc()', E_USER_WARNING); - return null; - } - - // Check arrays - for ($i = 0; $i < $count; $i++) - { - if (!is_array($args[$i])) { - trigger_error('array_diff_assoc() Argument #' . ($i + 1) . ' is not an array', E_USER_WARNING); - return null; - } - } - - // Get the comparison array - $array_comp = array_shift($args); - --$count; - - // Traverse values of the first array - foreach ($array_comp as $key => $value) - { - // Loop through the other arrays - for ($i = 0; $i < $count; $i++) - { - // Loop through this arrays key/value pairs and compare - foreach ($args[$i] as $comp_key => $comp_value) - { - if ((string)$key === (string)$comp_key && - (string)$value === (string)$comp_value) { - - unset($array_comp[$key]); - } - } - } - } - - return $array_comp; - } -} -?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.96/compat/is_a.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.96/compat/is_a.php (revision 14) +++ branches/unlabeled/unlabeled-1.1.96/compat/is_a.php (revision 0) @@ -1,48 +0,0 @@ - | -// +----------------------------------------------------------------------+ -// -// $Id: is_a.php,v 1.1 2004-10-26 18:22:16 kostja Exp $ -// - - -/** - * Replace function is_a() - * - * @category PHP - * @package PHP_Compat - * @link http://php.net/function.is_a - * @author Aidan Lister - * @version $Revision: 1.1 $ - * @since PHP 4.2.0 - * @require PHP 4.0.0 (is_subclass_of) - */ -if (!function_exists('is_a')) -{ - function is_a ($object, $class) - { - if (get_class($object) == strtolower($class)) { - return true; - } - - else { - return is_subclass_of($object, $class); - } - } -} - -?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.96/compat/version_compare.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.96/compat/version_compare.php (revision 14) +++ branches/unlabeled/unlabeled-1.1.96/compat/version_compare.php (revision 0) @@ -1,170 +0,0 @@ - | -// | Aidan Lister | -// +----------------------------------------------------------------------+ -// -// $Id: version_compare.php,v 1.1 2004-10-26 18:22:16 kostja Exp $ -// - - -/** - * Replace version_compare() - * - * @category PHP - * @package PHP_Compat - * @link http://php.net/version_compare - * @author Philippe Jausions - * @author Aidan Lister - * @version $Revision: 1.1 $ - * @since PHP 4.1.0 - * @require PHP 4.0.1 (trigger_error) - */ -if (!function_exists('version_compare')) { - - function version_compare ($version1, $version2, $operator = '<') - { - // Check input - if (!is_scalar($version1)) { - trigger_error('version_compare() expects parameter 1 to be string, ' . gettype($version1) . ' given', E_USER_WARNING); - return null; - } - - if (!is_scalar($version2)) { - trigger_error('version_compare() expects parameter 2 to be string, ' . gettype($version2) . ' given', E_USER_WARNING); - return null; - } - - if (!is_scalar($operator)) { - trigger_error('version_compare() expects parameter 3 to be string, ' . gettype($operator) . ' given', E_USER_WARNING); - return null; - } - - // Standardise versions - $v1 = explode('.', - str_replace('..', '.', - preg_replace('/([^0-9\.]+)/', '.$1.', - str_replace(array('-', '_', '+'), '.', - trim($version1))))); - - $v2 = explode('.', - str_replace('..', '.', - preg_replace('/([^0-9\.]+)/', '.$1.', - str_replace(array('-', '_', '+'), '.', - trim($version2))))); - - // Replace empty entries at the start of the array - while (empty($v1[0]) && array_shift($v1)) {} - while (empty($v2[0]) && array_shift($v2)) {} - - // Describe our release states - $versions = array( - 'dev' => 0, - 'alpha' => 1, - 'a' => 1, - 'beta' => 2, - 'b' => 2, - 'RC' => 3, - 'pl' => 4); - - // Loop through each segment in the version string - $compare = 0; - for ($i = 0, $x = min(count($v1), count($v2)); $i < $x; $i++) - { - if ($v1[$i] == $v2[$i]) { - continue; - } - if (is_numeric($v1[$i]) && is_numeric($v2[$i])) { - $compare = ($v1[$i] < $v2[$i]) ? -1 : 1; - } - elseif (is_numeric($v1[$i])) { - $compare = 1; - } - elseif (is_numeric($v2[$i])) { - $compare = -1; - } - elseif (isset($versions[$v1[$i]]) && isset($versions[$v2[$i]])) { - $compare = ($versions[$v1[$i]] < $versions[$v2[$i]]) ? -1 : 1; - } - else { - $compare = strcmp($v2[$i], $v1[$i]); - } - - break; - } - - // If previous loop didn't find anything, compare the "extra" segments - if ($compare == 0) { - if (count($v2) > count($v1)) - { - if (isset($versions[$v2[$i]])) { - $compare = ($versions[$v2[$i]] < 4) ? 1 : -1; - } else { - $compare = -1; - } - } - elseif (count($v2) < count($v1)) - { - if (isset($versions[$v1[$i]])) { - $compare = ($versions[$v1[$i]] < 4) ? -1 : 1; - } else { - $compare = 1; - } - } - } - - // Compare the versions - if (func_num_args() > 2) - { - switch ($operator) - { - case '>': - case 'gt': - return (bool) ($compare > 0); - break; - case '>=': - case 'ge': - return (bool) ($compare >= 0); - break; - case '<=': - case 'le': - return (bool) ($compare <= 0); - break; - case '==': - case '=': - case 'eq': - return (bool) ($compare == 0); - break; - case '<>': - case '!=': - case 'ne': - return (bool) ($compare != 0); - break; - case '': - case '<': - case 'lt': - return (bool) ($compare < 0); - break; - default: - return null; - } - } - - return $compare; - } -} - -?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.96/compat/array_chunk.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.96/compat/array_chunk.php (revision 14) +++ branches/unlabeled/unlabeled-1.1.96/compat/array_chunk.php (revision 0) @@ -1,76 +0,0 @@ - | -// +----------------------------------------------------------------------+ -// -// $Id: array_chunk.php,v 1.1 2004-10-26 18:22:16 kostja Exp $ -// - - -/** - * Replace array_combine() - * - * @category PHP - * @package PHP_Compat - * @link http://php.net/function.array_chunk - * @author Aidan Lister - * @author Thiemo M�ttig (http://maettig.com) - * @version $Revision: 1.1 $ - * @since PHP 4.2.0 - * @require PHP 4.0.1 (trigger_error) - */ -if (!function_exists('array_chunk')) -{ - function array_chunk ($input, $size, $preserve_keys = false) - { - if (!is_array($input)) { - trigger_error('array_chunk() expects parameter 1 to be array, ' . gettype($input) . ' given', E_USER_WARNING); - return null; - } - - if (!is_numeric($size)) { - trigger_error('array_chunk() expects parameter 2 to be long, ' . gettype($size) . ' given', E_USER_WARNING); - return null; - } - - $size = (int)$size; - if ($size <= 0) - { - trigger_error('array_chunk() Size parameter expected to be greater than 0', E_USER_WARNING); - return null; - } - - $chunks = array(); - $i = 0; - - if ($preserve_keys !== false) - { - foreach ($input as $key => $value) { - $chunks[(int)($i++ / $size)][$key] = $value; - } - } - else - { - foreach ($input as $value) { - $chunks[(int)($i++ / $size)][] = $value; - } - } - - return $chunks; - } -} - -?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.96/compat/image_type_to_mime_type.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.96/compat/image_type_to_mime_type.php (revision 14) +++ branches/unlabeled/unlabeled-1.1.96/compat/image_type_to_mime_type.php (revision 0) @@ -1,128 +0,0 @@ - | -// +----------------------------------------------------------------------+ -// -// $Id: image_type_to_mime_type.php,v 1.1 2004-10-26 18:22:16 kostja Exp $ -// - - -if (!defined('IMAGETYPE_GIF')) { - define('IMAGETYPE_GIF', 0); -} - -if (!defined('IMAGETYPE_JPEG')) { - define('IMAGETYPE_JPEG', 1); -} - -if (!defined('IMAGETYPE_PNG')) { - define('IMAGETYPE_PNG', 2); -} - -if (!defined('IMAGETYPE_SWF')) { - define('IMAGETYPE_SWF', 3); -} - -if (!defined('IMAGETYPE_PSD')) { - define('IMAGETYPE_PSD', 4); -} - -if (!defined('IMAGETYPE_BMP')) { - define('IMAGETYPE_BMP', 5); -} - -if (!defined('IMAGETYPE_TIFF_II')) { - define('IMAGETYPE_TIFF_II', 6); -} - -if (!defined('IMAGETYPE_TIFF_MM')) { - define('IMAGETYPE_TIFF_MM', 7); -} - -if (!defined('IMAGETYPE_JPC')) { - define('IMAGETYPE_JPC', 8); -} - -if (!defined('IMAGETYPE_JP2')) { - define('IMAGETYPE_JP2', 9); -} - -if (!defined('IMAGETYPE_JPX')) { - define('IMAGETYPE_JPX', 10); -} - -if (!defined('IMAGETYPE_JB2')) { - define('IMAGETYPE_JB2', 11); -} - -if (!defined('IMAGETYPE_SWC')) { - define('IMAGETYPE_SWC', 12); -} - -if (!defined('IMAGETYPE_IFF')) { - define('IMAGETYPE_IFF', 13); -} - -if (!defined('IMAGETYPE_WBMP')) { - define('IMAGETYPE_WBMP', 14); -} - -if (!defined('IMAGETYPE_XBM')) { - define('IMAGETYPE_XBM', 15); -} - - -/** - * Replace image_type_to_mime_type() - * - * @category PHP - * @package PHP_Compat - * @link http://php.net/function.image_type_to_mime_type - * @author Aidan Lister - * @version $Revision: 1.1 $ - * @since PHP 4.3.0 - * @require PHP 3 - */ -if (!function_exists('image_type_to_mime_type')) -{ - function image_type_to_mime_type ($imagetype) - { - static $image_type_to_mime_type = array ( - IMAGETYPE_GIF => 'image/gif', - IMAGETYPE_JPEG => 'image/jpeg', - IMAGETYPE_PNG => 'image/png', - IMAGETYPE_SWF => 'application/x-shockwave-flash', - IMAGETYPE_PSD => 'image/psd', - IMAGETYPE_BMP => 'image/bmp', - IMAGETYPE_TIFF_II => 'image/tiff', - IMAGETYPE_TIFF_MM => 'image/tiff', - IMAGETYPE_JPC => 'application/octet-stream', - IMAGETYPE_JP2 => 'image/jp2', - IMAGETYPE_JPX => 'application/octet-stream', - IMAGETYPE_JB2 => 'application/octet-stream', - IMAGETYPE_SWC => 'application/x-shockwave-flash', - IMAGETYPE_IFF => 'image/iff', - IMAGETYPE_WBMP => 'image/vnd.wap.wbmp', - IMAGETYPE_XBM => 'image/xbm', - ); - - return (isset($image_type_to_mime_type[$imagetype]) ? - $image_type_to_mime_type[$imagetype] : - $image_type_to_mime_type[IMAGETYPE_JPC]); - } -} - -?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.96/compat/vsprintf.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.96/compat/vsprintf.php (revision 14) +++ branches/unlabeled/unlabeled-1.1.96/compat/vsprintf.php (revision 0) @@ -1,47 +0,0 @@ - | -// +----------------------------------------------------------------------+ -// -// $Id: vsprintf.php,v 1.1 2004-10-26 18:22:16 kostja Exp $ -// - - -/** - * Replace vsprintf() - * - * @category PHP - * @package PHP_Compat - * @link http://php.net/function.vsprintf - * @author Aidan Lister - * @version $Revision: 1.1 $ - * @since PHP 4.1.0 - * @require PHP 4.0.4 (call_user_func_array) - */ -if (!function_exists('vsprintf')) -{ - function vsprintf ($format, $args) - { - if (count($args) < 2) { - trigger_error('vsprintf() Too few arguments', E_USER_WARNING); - return null; - } - - array_unshift($args, $format); - return call_user_func_array('sprintf', $args); - } -} -?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.96/compat/ob_flush.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.96/compat/ob_flush.php (revision 14) +++ branches/unlabeled/unlabeled-1.1.96/compat/ob_flush.php (revision 0) @@ -1,49 +0,0 @@ - | -// +----------------------------------------------------------------------+ -// -// $Id: ob_flush.php,v 1.1 2004-10-26 18:22:16 kostja Exp $ -// - - -/** - * Replace ob_flush() - * - * @category PHP - * @package PHP_Compat - * @link http://php.net/ob_flush - * @author Aidan Lister - * @author Thiemo M�ttig (http://maettig.com/) - * @version $Revision: 1.1 $ - * @since PHP 4.2.0 - * @require PHP 4.0.1 (trigger_error) - */ -if (!function_exists('ob_flush')) -{ - function ob_flush () - { - if (@ob_end_flush()) { - return ob_start(); - } - - trigger_error("ob_flush() Failed to flush buffer. No buffer to flush.", E_USER_NOTICE); - - return false; - } -} - -?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.96/compat/ob_get_flush.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.96/compat/ob_get_flush.php (revision 14) +++ branches/unlabeled/unlabeled-1.1.96/compat/ob_get_flush.php (revision 0) @@ -1,49 +0,0 @@ - | -// +----------------------------------------------------------------------+ -// -// $Id: ob_get_flush.php,v 1.1 2004-10-26 18:22:16 kostja Exp $ -// - - -/** - * Replace ob_get_flush() - * - * @category PHP - * @package PHP_Compat - * @link http://php.net/ob_get_flush - * @author Aidan Lister - * @author Thiemo M�ttig (http://maettig.com/) - * @version $Revision: 1.1 $ - * @since PHP 4.3.0 - * @require PHP 4.0.1 (trigger_error) - */ -if (!function_exists('ob_get_flush')) -{ - function ob_get_flush () - { - $contents = ob_get_contents(); - - if ($contents !== false) { - ob_end_flush(); - } - - return $contents; - } -} - -?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.96/compat/array_udiff.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.96/compat/array_udiff.php (revision 14) +++ branches/unlabeled/unlabeled-1.1.96/compat/array_udiff.php (revision 0) @@ -1,84 +0,0 @@ - | -// | Aidan Lister | -// +----------------------------------------------------------------------+ -// -// $Id: array_udiff.php,v 1.1 2004-10-26 18:22:16 kostja Exp $ -// - - -/** - * Replace array_udiff() - * - * @category PHP - * @package PHP_Compat - * @link http://php.net/function.array_udiff - * @author Stephan Schmidt - * @author Aidan Lister - * @version $Revision: 1.1 $ - * @since PHP 5 - * @require PHP 4.0.1 (trigger_error) - */ -if (!function_exists('array_udiff')) -{ - function array_udiff () - { - $args = func_get_args(); - - if (count($args) < 3) { - trigger_error('Wrong parameter count for array_udiff()', E_USER_WARNING); - return null; - } - - // Get compare function - $compare_func = array_pop($args); - if (!is_callable($compare_func)) { - if (is_array($compare_func)) { - $compare_func = $compare_func[0] . '::' . $compare_func[1]; - } - trigger_error('array_udiff() Not a valid callback ' . $compare_func, E_USER_WARNING); - return null; - } - - // Check arrays - $cnt = count($args); - for ($i = 0; $i < $cnt; $i++) { - if (!is_array($args[$i])) { - trigger_error('array_udiff() Argument #' . ($i + 1). ' is not an array', E_USER_WARNING); - return null; - } - } - - $diff = array (); - // Traverse values of the first array - foreach ($args[0] as $key => $value) { - // Check all arrays - for ($i = 1; $i < $cnt; $i++) { - foreach ($args[$i] as $cmp_value) { - $result = call_user_func($compare_func, $value, $cmp_value); - if ($result === 0) { - continue 3; - } - } - } - $diff[$key] = $value; - } - return $diff; - } -} - -?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.96/compat/file_get_contents.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.96/compat/file_get_contents.php (revision 14) +++ branches/unlabeled/unlabeled-1.1.96/compat/file_get_contents.php (revision 0) @@ -1,61 +0,0 @@ - | -// +----------------------------------------------------------------------+ -// -// $Id: file_get_contents.php,v 1.1 2004-10-26 18:22:16 kostja Exp $ -// - - -/** - * Replace file_get_contents() - * - * @category PHP - * @package PHP_Compat - * @link http://php.net/function.file_get_contents - * @author Aidan Lister - * @version $Revision: 1.1 $ - * @internal resource_context is not supported - * @since PHP 5 - * @require PHP 4.0.1 (trigger_error) - */ -if (!function_exists('file_get_contents')) -{ - function file_get_contents ($filename, $incpath = false, $resource_context = null) - { - if (false === $fh = fopen($filename, 'rb', $incpath)) { - trigger_error('file_get_contents() failed to open stream: No such file or directory', E_USER_WARNING); - return false; - } - - clearstatcache(); - if ($fsize = filesize($filename)) { - $data = fread($fh, $fsize); - } - - else { - while (!feof($fh)) { - $data .= fread($fh, 8192); - } - } - - fclose($fh); - - return $data; - } -} - -?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.96/compat/ob_clean.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.96/compat/ob_clean.php (revision 14) +++ branches/unlabeled/unlabeled-1.1.96/compat/ob_clean.php (revision 0) @@ -1,49 +0,0 @@ - | -// +----------------------------------------------------------------------+ -// -// $Id: ob_clean.php,v 1.1 2004-10-26 18:22:16 kostja Exp $ -// - - -/** - * Replace ob_clean() - * - * @category PHP - * @package PHP_Compat - * @link http://php.net/ob_clean - * @author Aidan Lister - * @author Thiemo M�ttig (http://maettig.com/) - * @version $Revision: 1.1 $ - * @since PHP 4.2.0 - * @require PHP 4.0.1 (trigger_error) - */ -if (!function_exists('ob_clean')) -{ - function ob_clean () - { - if (@ob_end_clean()) { - return ob_start(); - } - - trigger_error("ob_clean() failed to delete buffer. No buffer to delete.", E_USER_NOTICE); - - return false; - } -} - -?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.96/compat/ob_get_clean.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.96/compat/ob_get_clean.php (revision 14) +++ branches/unlabeled/unlabeled-1.1.96/compat/ob_get_clean.php (revision 0) @@ -1,49 +0,0 @@ - | -// +----------------------------------------------------------------------+ -// -// $Id: ob_get_clean.php,v 1.1 2004-10-26 18:22:16 kostja Exp $ -// - - -/** - * Replace ob_get_clean() - * - * @category PHP - * @package PHP_Compat - * @link http://php.net/ob_get_clean - * @author Aidan Lister - * @author Thiemo M�ttig (http://maettig.com/) - * @version $Revision: 1.1 $ - * @since PHP 4.3.0 - * @require PHP 4.0.1 (trigger_error) - */ -if (!function_exists('ob_get_clean')) -{ - function ob_get_clean () - { - $contents = ob_get_contents(); - - if ($contents !== false) { - ob_end_clean(); - } - - return $contents; - } -} - -?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.96/compat/file_put_contents.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.96/compat/file_put_contents.php (revision 14) +++ branches/unlabeled/unlabeled-1.1.96/compat/file_put_contents.php (revision 0) @@ -1,105 +0,0 @@ - | -// +----------------------------------------------------------------------+ -// -// $Id: file_put_contents.php,v 1.1 2004-10-26 18:22:16 kostja Exp $ -// - - -if (!defined('FILE_USE_INCLUDE_PATH')) { - define('FILE_USE_INCLUDE_PATH', 1); -} - -if (!defined('FILE_APPEND')) { - define('FILE_APPEND', 8); -} - - -/** - * Replace file_put_contents() - * - * @category PHP - * @package PHP_Compat - * @link http://php.net/function.file_put_contents - * @author Aidan Lister - * @version $Revision: 1.1 $ - * @internal $resource_context is not supported - * @since PHP 5 - * @require PHP 4.0.1 (trigger_error) - */ -if (!function_exists('file_put_contents')) -{ - function file_put_contents ($filename, $content, $flags = null, $resource_context = null) - { - // If $content is an array, convert it to a string - if (is_array($content)) { - $content = implode('', $content); - } - - // If we don't have a string, throw an error - if (!is_string($content)) { - trigger_error('file_put_contents() The 2nd parameter should be either a string or an array', E_USER_WARNING); - return false; - } - - // Get the length of date to write - $length = strlen($content); - - // Check what mode we are using - $mode = ($flags & FILE_APPEND) ? - $mode = 'a' : - $mode = 'w'; - - // Check if we're using the include path - $use_inc_path = ($flags & FILE_USE_INCLUDE_PATH) ? - true : - false; - - // Open the file for writing - if (($fh = @fopen($filename, $mode, $use_inc_path)) === false) { - trigger_error('file_put_contents() failed to open stream: Permission denied', E_USER_WARNING); - return false; - } - - // Write to the file - $bytes = 0; - if (($bytes = @fwrite($fh, $content)) === false) { - $errormsg = sprintf('file_put_contents() Failed to write %d bytes to %s', - $length, - $filename); - trigger_error($errormsg, E_USER_WARNING); - return false; - } - - // Close the handle - @fclose($fh); - - // Check all the data was written - if ($bytes != $length) { - $errormsg = sprintf('file_put_contents() Only %d of %d bytes written, possibly out of free disk space.', - $bytes, - $length); - trigger_error($errormsg, E_USER_WARNING); - return false; - } - - // Return length - return $bytes; - } -} - -?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.96/compat/strripos.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.96/compat/strripos.php (revision 14) +++ branches/unlabeled/unlabeled-1.1.96/compat/strripos.php (revision 0) @@ -1,83 +0,0 @@ - | -// | Stephan Schmidt | -// +----------------------------------------------------------------------+ -// -// $Id: strripos.php,v 1.1 2004-10-26 18:22:16 kostja Exp $ -// - - -/** - * Replace strripos() - * - * @category PHP - * @package PHP_Compat - * @link http://php.net/function.strripos - * @author Aidan Lister - * @author Stephan Schmidt - * @version $Revision: 1.1 $ - * @since PHP 5 - * @require PHP 4.0.1 (trigger_error) - */ -if (!function_exists('strripos')) -{ - function strripos ($haystack, $needle, $offset = null) - { - if (!is_scalar($haystack)) { - trigger_error('strripos() expects parameter 1 to be scalar, ' . gettype($haystack) . ' given', E_USER_WARNING); - return false; - } - - if (!is_scalar($needle)) { - trigger_error('strripos() expects parameter 2 to be scalar, ' . gettype($needle) . ' given', E_USER_WARNING); - return false; - } - - if (!is_null($offset) && !is_numeric($offset)) { - trigger_error('strripos() expects parameter 3 to be long, ' . gettype($offset) . ' given', E_USER_WARNING); - return false; - } - - // Manipulate the string if there is an offset - $fix = 0; - if (!is_null($offset)) - { - // If the offset is larger than the haystack, return - if (abs($offset) >= strlen($haystack)) { - return false; - } - - // Check whether offset is negative or positive - if ($offset > 0) { - $haystack = substr($haystack, $offset, strlen($haystack) - $offset); - // We need to add this to the position of the needle - $fix = $offset; - } - else { - $haystack = substr($haystack, 0, strlen($haystack) + $offset); - } - } - - $segments = explode(strtolower($needle), strtolower($haystack)); - - $last_seg = count($segments) - 1; - $position = strlen($haystack) + $fix - strlen($segments[$last_seg]) - strlen($needle); - - return $position; - } -} -?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.96/compat/vprintf.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.96/compat/vprintf.php (revision 14) +++ branches/unlabeled/unlabeled-1.1.96/compat/vprintf.php (revision 0) @@ -1,47 +0,0 @@ - | -// +----------------------------------------------------------------------+ -// -// $Id: vprintf.php,v 1.1 2004-10-26 18:22:16 kostja Exp $ -// - - -/** - * Replace vprintf() - * - * @category PHP - * @package PHP_Compat - * @link http://php.net/function.vprintf - * @author Aidan Lister - * @version $Revision: 1.1 $ - * @since PHP 4.1.0 - * @require PHP 4.0.4 (call_user_func_array) - */ -if (!function_exists('vprintf')) -{ - function vprintf ($format, $args) - { - if (count($args) < 2) { - trigger_error('vprintf() Too few arguments', E_USER_WARNING); - return null; - } - - array_unshift($args, $format); - return call_user_func_array('printf', $args); - } -} -?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.96/compat/array_search.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.96/compat/array_search.php (revision 14) +++ branches/unlabeled/unlabeled-1.1.96/compat/array_search.php (revision 0) @@ -1,54 +0,0 @@ - | -// +----------------------------------------------------------------------+ -// -// $Id: array_search.php,v 1.1 2004-10-26 18:22:16 kostja Exp $ -// - - -/** - * Replace array_search() - * - * @category PHP - * @package PHP_Compat - * @link http://php.net/array_search - * @author Aidan Lister - * @author Thiemo M�ttig (http://maettig.com/) - * @version $Revision: 1.1 $ - * @since PHP 4.0.5 - * @require PHP 4.0.1 (trigger_error) - */ -if (!function_exists('array_search')) -{ - function array_search ($needle, $haystack, $strict = false) - { - if (!is_array($haystack)) { - trigger_error("array_search() Wrong datatype for second argument", E_USER_WARNING); - return false; - } - - foreach ($haystack as $key => $value) { - if ($strict ? $value === $needle : $value == $needle) { - return $key; - } - } - - return false; - } -} - -?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/stripos.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/stripos.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/stripos.php (revision 6981) @@ -0,0 +1,71 @@ + | +// +----------------------------------------------------------------------+ +// +// $Id: stripos.php,v 1.1.2.1 2006-12-12 08:16:42 alex Exp $ +// + + +/** + * Replace stripos() + * + * @category PHP + * @package PHP_Compat + * @link http://php.net/function.stripos + * @author Aidan Lister + * @version $Revision: 1.1.2.1 $ + * @since PHP 5 + * @require PHP 4.0.1 (trigger_error) + */ +if (!function_exists('stripos')) +{ + function stripos ($haystack, $needle, $offset = null) + { + if (!is_scalar($haystack)) { + trigger_error('stripos() expects parameter 1 to be string, ' . gettype($haystack) . ' given', E_USER_WARNING); + return false; + } + + if (!is_scalar($needle)) { + trigger_error('stripos() needle is not a string or an integer.', E_USER_WARNING); + return false; + } + + if (!is_null($offset) && !is_numeric($offset)) { + trigger_error('stripos() expects parameter 3 to be long, ' . gettype($offset) . ' given', E_USER_WARNING); + return false; + } + + // Manipulate the string if there is an offset + $fix = 0; + if (!is_null($offset)) + { + if ($offset > 0) + { + $haystack = substr($haystack, $offset, strlen($haystack) - $offset); + $fix = $offset; + } + } + + $segments = explode (strtolower($needle), strtolower($haystack), 2); + $position = strlen($segments[0]) + $fix; + + return $position; + } +} + +?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/strripos.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/strripos.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/strripos.php (revision 6981) @@ -0,0 +1,83 @@ + | +// | Stephan Schmidt | +// +----------------------------------------------------------------------+ +// +// $Id: strripos.php,v 1.1.2.1 2006-12-12 08:16:42 alex Exp $ +// + + +/** + * Replace strripos() + * + * @category PHP + * @package PHP_Compat + * @link http://php.net/function.strripos + * @author Aidan Lister + * @author Stephan Schmidt + * @version $Revision: 1.1.2.1 $ + * @since PHP 5 + * @require PHP 4.0.1 (trigger_error) + */ +if (!function_exists('strripos')) +{ + function strripos ($haystack, $needle, $offset = null) + { + if (!is_scalar($haystack)) { + trigger_error('strripos() expects parameter 1 to be scalar, ' . gettype($haystack) . ' given', E_USER_WARNING); + return false; + } + + if (!is_scalar($needle)) { + trigger_error('strripos() expects parameter 2 to be scalar, ' . gettype($needle) . ' given', E_USER_WARNING); + return false; + } + + if (!is_null($offset) && !is_numeric($offset)) { + trigger_error('strripos() expects parameter 3 to be long, ' . gettype($offset) . ' given', E_USER_WARNING); + return false; + } + + // Manipulate the string if there is an offset + $fix = 0; + if (!is_null($offset)) + { + // If the offset is larger than the haystack, return + if (abs($offset) >= strlen($haystack)) { + return false; + } + + // Check whether offset is negative or positive + if ($offset > 0) { + $haystack = substr($haystack, $offset, strlen($haystack) - $offset); + // We need to add this to the position of the needle + $fix = $offset; + } + else { + $haystack = substr($haystack, 0, strlen($haystack) + $offset); + } + } + + $segments = explode(strtolower($needle), strtolower($haystack)); + + $last_seg = count($segments) - 1; + $position = strlen($haystack) + $fix - strlen($segments[$last_seg]) - strlen($needle); + + return $position; + } +} +?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/version_compare.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/version_compare.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/version_compare.php (revision 6981) @@ -0,0 +1,170 @@ + | +// | Aidan Lister | +// +----------------------------------------------------------------------+ +// +// $Id: version_compare.php,v 1.1.2.1 2006-12-12 08:16:42 alex Exp $ +// + + +/** + * Replace version_compare() + * + * @category PHP + * @package PHP_Compat + * @link http://php.net/version_compare + * @author Philippe Jausions + * @author Aidan Lister + * @version $Revision: 1.1.2.1 $ + * @since PHP 4.1.0 + * @require PHP 4.0.1 (trigger_error) + */ +if (!function_exists('version_compare')) { + + function version_compare ($version1, $version2, $operator = '<') + { + // Check input + if (!is_scalar($version1)) { + trigger_error('version_compare() expects parameter 1 to be string, ' . gettype($version1) . ' given', E_USER_WARNING); + return null; + } + + if (!is_scalar($version2)) { + trigger_error('version_compare() expects parameter 2 to be string, ' . gettype($version2) . ' given', E_USER_WARNING); + return null; + } + + if (!is_scalar($operator)) { + trigger_error('version_compare() expects parameter 3 to be string, ' . gettype($operator) . ' given', E_USER_WARNING); + return null; + } + + // Standardise versions + $v1 = explode('.', + str_replace('..', '.', + preg_replace('/([^0-9\.]+)/', '.$1.', + str_replace(array('-', '_', '+'), '.', + trim($version1))))); + + $v2 = explode('.', + str_replace('..', '.', + preg_replace('/([^0-9\.]+)/', '.$1.', + str_replace(array('-', '_', '+'), '.', + trim($version2))))); + + // Replace empty entries at the start of the array + while (empty($v1[0]) && array_shift($v1)) {} + while (empty($v2[0]) && array_shift($v2)) {} + + // Describe our release states + $versions = array( + 'dev' => 0, + 'alpha' => 1, + 'a' => 1, + 'beta' => 2, + 'b' => 2, + 'RC' => 3, + 'pl' => 4); + + // Loop through each segment in the version string + $compare = 0; + for ($i = 0, $x = min(count($v1), count($v2)); $i < $x; $i++) + { + if ($v1[$i] == $v2[$i]) { + continue; + } + if (is_numeric($v1[$i]) && is_numeric($v2[$i])) { + $compare = ($v1[$i] < $v2[$i]) ? -1 : 1; + } + elseif (is_numeric($v1[$i])) { + $compare = 1; + } + elseif (is_numeric($v2[$i])) { + $compare = -1; + } + elseif (isset($versions[$v1[$i]]) && isset($versions[$v2[$i]])) { + $compare = ($versions[$v1[$i]] < $versions[$v2[$i]]) ? -1 : 1; + } + else { + $compare = strcmp($v2[$i], $v1[$i]); + } + + break; + } + + // If previous loop didn't find anything, compare the "extra" segments + if ($compare == 0) { + if (count($v2) > count($v1)) + { + if (isset($versions[$v2[$i]])) { + $compare = ($versions[$v2[$i]] < 4) ? 1 : -1; + } else { + $compare = -1; + } + } + elseif (count($v2) < count($v1)) + { + if (isset($versions[$v1[$i]])) { + $compare = ($versions[$v1[$i]] < 4) ? -1 : 1; + } else { + $compare = 1; + } + } + } + + // Compare the versions + if (func_num_args() > 2) + { + switch ($operator) + { + case '>': + case 'gt': + return (bool) ($compare > 0); + break; + case '>=': + case 'ge': + return (bool) ($compare >= 0); + break; + case '<=': + case 'le': + return (bool) ($compare <= 0); + break; + case '==': + case '=': + case 'eq': + return (bool) ($compare == 0); + break; + case '<>': + case '!=': + case 'ne': + return (bool) ($compare != 0); + break; + case '': + case '<': + case 'lt': + return (bool) ($compare < 0); + break; + default: + return null; + } + } + + return $compare; + } +} + +?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/ob_get_flush.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/ob_get_flush.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/ob_get_flush.php (revision 6981) @@ -0,0 +1,49 @@ + | +// +----------------------------------------------------------------------+ +// +// $Id: ob_get_flush.php,v 1.1.2.1 2006-12-12 08:16:41 alex Exp $ +// + + +/** + * Replace ob_get_flush() + * + * @category PHP + * @package PHP_Compat + * @link http://php.net/ob_get_flush + * @author Aidan Lister + * @author Thiemo M�ttig (http://maettig.com/) + * @version $Revision: 1.1.2.1 $ + * @since PHP 4.3.0 + * @require PHP 4.0.1 (trigger_error) + */ +if (!function_exists('ob_get_flush')) +{ + function ob_get_flush () + { + $contents = ob_get_contents(); + + if ($contents !== false) { + ob_end_flush(); + } + + return $contents; + } +} + +?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/fprintf.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/fprintf.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/fprintf.php (revision 6981) @@ -0,0 +1,56 @@ + | +// +----------------------------------------------------------------------+ +// +// $Id: fprintf.php,v 1.1.2.1 2006-12-12 08:16:41 alex Exp $ +// + + +/** + * Replace fprintf() + * + * @category PHP + * @package PHP_Compat + * @link http://php.net/function.fprintf + * @author Aidan Lister + * @version $Revision: 1.1.2.1 $ + * @since PHP 5 + * @require PHP 4.0.1 (trigger_error) + */ +if (!function_exists('fprintf')) +{ + function fprintf () { + $args = func_get_args(); + + if (count($args) < 2) { + trigger_error ('Wrong parameter count for fprintf()', E_USER_WARNING); + return null; + } + + $resource_handle = array_shift($args); + $format = array_shift($args); + + if (!is_resource($resource_handle)) { + trigger_error ('fprintf(): supplied argument is not a valid stream resource', E_USER_WARNING); + return false; + } + + return fwrite($resource_handle, vsprintf($format, $args)); + } +} + +?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/call_user_func_array.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/call_user_func_array.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/call_user_func_array.php (revision 6981) @@ -0,0 +1,80 @@ + | +// +----------------------------------------------------------------------+ +// +// $Id: call_user_func_array.php,v 1.1.2.1 2006-12-12 08:16:41 alex Exp $ +// + + +/** + * Replace call_user_func_array() + * + * @category PHP + * @package PHP_Compat + * @link http://php.net/call_user_func_array + * @author Aidan Lister + * @version $Revision: 1.1.2.1 $ + * @since PHP 4.0.4 + * @require PHP 4.0.1 (trigger_error) + */ +if (!function_exists('call_user_func_array')) +{ + function call_user_func_array ($function, $param_arr) + { + $param_arr = (array) $param_arr; + + // Sanity check + if (!is_callable($function)) + { + if (is_array($function) && count($function) > 2) { + $function = $function[0] . '::' . $function[1]; + } + $error = sprintf('call_user_func_array() First argument is expected to be a valid callback, \'%s\' was given', $function); + trigger_error($error, E_USER_WARNING); + return null; + } + + // Build argument string + $arg_string = ''; + $comma = ''; + for ($i = 0, $x = count($param_arr); $i < $x; $i++) { + $arg_string .= $comma . "\$param_arr[$i]"; + $comma = ', '; + } + + // Determine method of calling function + if (is_array($function)) + { + $object =& $function[0]; + $method = $function[1]; + + // Static vs method call + if (is_string($function[0])) { + eval("\$retval = $object::\$method($arg_string);"); + } else { + eval("\$retval = \$object->\$method($arg_string);"); + } + } + else { + eval("\$retval = \$function($arg_string);"); + } + + return $retval; + } +} + +?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/ob_get_clean.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/ob_get_clean.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/ob_get_clean.php (revision 6981) @@ -0,0 +1,49 @@ + | +// +----------------------------------------------------------------------+ +// +// $Id: ob_get_clean.php,v 1.1.2.1 2006-12-12 08:16:41 alex Exp $ +// + + +/** + * Replace ob_get_clean() + * + * @category PHP + * @package PHP_Compat + * @link http://php.net/ob_get_clean + * @author Aidan Lister + * @author Thiemo M�ttig (http://maettig.com/) + * @version $Revision: 1.1.2.1 $ + * @since PHP 4.3.0 + * @require PHP 4.0.1 (trigger_error) + */ +if (!function_exists('ob_get_clean')) +{ + function ob_get_clean () + { + $contents = ob_get_contents(); + + if ($contents !== false) { + ob_end_clean(); + } + + return $contents; + } +} + +?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/html_entity_decode.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/html_entity_decode.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/html_entity_decode.php (revision 6981) @@ -0,0 +1,74 @@ + | +// | Aidan Lister | +// +----------------------------------------------------------------------+ +// +// $Id: html_entity_decode.php,v 1.1.2.1 2006-12-12 08:16:41 alex Exp $ +// + + +if (!defined('ENT_NOQUOTES')) { + define('ENT_NOQUOTES', 0); +} + +if (!defined('ENT_COMPAT')) { + define('ENT_COMPAT', 2); +} + +if (!defined('ENT_QUOTES')) { + define('ENT_QUOTES', 3); +} + + +/** + * Replace html_entity_decode() + * + * @category PHP + * @package PHP_Compat + * @link http://php.net/function.html_entity_decode + * @author David Irvine + * @author Aidan Lister + * @version $Revision: 1.1.2.1 $ + * @since PHP 4.3.0 + * @internal Setting the charset will not do anything + * @require PHP 4.0.1 (trigger_error) + */ +if (!function_exists('html_entity_decode')) +{ + function html_entity_decode ($string, $quote_style = ENT_COMPAT, $charset = null) + { + if (!is_int($quote_style)) { + trigger_error('html_entity_decode() expects parameter 2 to be long, ' . gettype($quote_style) . ' given', E_USER_WARNING); + return null; + } + + $trans_tbl = get_html_translation_table(HTML_ENTITIES); + $trans_tbl = array_flip($trans_tbl); + + // Add single quote to translation table; + $trans_tbl['''] = '\''; + + // Not translating double quotes + if ($quote_style & ENT_NOQUOTES) { + // Remove double quote from translation table + unset($trans_tbl['"']); + } + + return strtr($string, $trans_tbl); + } +} +?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/file_get_contents.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/file_get_contents.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/file_get_contents.php (revision 6981) @@ -0,0 +1,61 @@ + | +// +----------------------------------------------------------------------+ +// +// $Id: file_get_contents.php,v 1.1.2.1 2006-12-12 08:16:41 alex Exp $ +// + + +/** + * Replace file_get_contents() + * + * @category PHP + * @package PHP_Compat + * @link http://php.net/function.file_get_contents + * @author Aidan Lister + * @version $Revision: 1.1.2.1 $ + * @internal resource_context is not supported + * @since PHP 5 + * @require PHP 4.0.1 (trigger_error) + */ +if (!function_exists('file_get_contents')) +{ + function file_get_contents ($filename, $incpath = false, $resource_context = null) + { + if (false === $fh = fopen($filename, 'rb', $incpath)) { + trigger_error('file_get_contents() failed to open stream: No such file or directory', E_USER_WARNING); + return false; + } + + clearstatcache(); + if ($fsize = filesize($filename)) { + $data = fread($fh, $fsize); + } + + else { + while (!feof($fh)) { + $data .= fread($fh, 8192); + } + } + + fclose($fh); + + return $data; + } +} + +?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/array_chunk.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/array_chunk.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/array_chunk.php (revision 6981) @@ -0,0 +1,76 @@ + | +// +----------------------------------------------------------------------+ +// +// $Id: array_chunk.php,v 1.1.2.1 2006-12-12 08:16:41 alex Exp $ +// + + +/** + * Replace array_combine() + * + * @category PHP + * @package PHP_Compat + * @link http://php.net/function.array_chunk + * @author Aidan Lister + * @author Thiemo M�ttig (http://maettig.com) + * @version $Revision: 1.1.2.1 $ + * @since PHP 4.2.0 + * @require PHP 4.0.1 (trigger_error) + */ +if (!function_exists('array_chunk')) +{ + function array_chunk ($input, $size, $preserve_keys = false) + { + if (!is_array($input)) { + trigger_error('array_chunk() expects parameter 1 to be array, ' . gettype($input) . ' given', E_USER_WARNING); + return null; + } + + if (!is_numeric($size)) { + trigger_error('array_chunk() expects parameter 2 to be long, ' . gettype($size) . ' given', E_USER_WARNING); + return null; + } + + $size = (int)$size; + if ($size <= 0) + { + trigger_error('array_chunk() Size parameter expected to be greater than 0', E_USER_WARNING); + return null; + } + + $chunks = array(); + $i = 0; + + if ($preserve_keys !== false) + { + foreach ($input as $key => $value) { + $chunks[(int)($i++ / $size)][$key] = $value; + } + } + else + { + foreach ($input as $value) { + $chunks[(int)($i++ / $size)][] = $value; + } + } + + return $chunks; + } +} + +?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.2/kernel/include/obscure.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.2/kernel/include/obscure.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.2/kernel/include/obscure.php (revision 6981) @@ -0,0 +1,274 @@ +#!/usr/local/bin/php + +$start,"end"=>$end,"attribs"=>$attribs,"newname"=>$newname); + } + } + } +// print_r($functions); + //echo "
"; print_r($functions); echo "
"; + + function GetVarName($s) + { + $alphabet = "abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + + $name = ""; + $var_end = 0; + $char = substr($s,$var_end,1); + if(substr($s,0,1)=="$") + { + $var_end++; + $char = substr($s,$var_end,1); + } + while(is_numeric(strpos($alphabet,$char)) && strlen($char)) + { + $name .= $char; + $var_end++; + $char = substr($s,$var_end,1); + } + return $name; + } + + function obscure_func($NewName,$Attribs,$code) + { + global $functions; + + $globals = array(); + + $globals[] = '$this'; + $globals[] = '$_GET'; + $globals[] = '$_FILES'; + $globals[] = '$_POST'; + $globals[] = '$_COOKIE'; + $globals[] = '$_SERVER'; + + $variables = array(); + + $new_code = array(); + for($x=0;$x<=count($code);$x++) + { + $line = $code[$x]; + $line = ltrim($line); + $line = str_replace("\t","",$line); + $g = strpos($line,"global"); + if(is_numeric($g)) + { + $vars = trim(substr($line,$g+7)); + $vars = substr($vars,0,-1); + $v = explode(",",$vars); + for($z=0;$z$attr) + { + $line = $code[$x]; + $code[$x] = str_replace($name,$attr["newname"],$line); + } + } + + $VarCount =0; + if(strlen($Attribs)>3) + { + $Attribs = trim($Attribs); + $Attribs = str_replace("\t","",$Attribs); + //echo "getting attribs from $Attribs\n"; + $a = explode(",",substr($Attribs,1,-1)); +// echo "got attribs for func [$Attribs]:\n"; +// var_dump($a); + if (is_array($a) && $a[0] != '') { + foreach($a as $attr) + { + list($attr,$default) = explode('=', $attr); + //echo "attr: $attr / def = $default\n"; + if ($default != '') { + $defaults[$attr] = $default; + //echo "stored defaults for $attr\n"; + } + $variables[$attr] = '$_'.gen_name($VarCount++); + } + } + } + + for($x=0;$x0) + { + if(substr($line,$p,2)!="$$") + { + $name=GetVarName(substr($line,$p)); + if(strlen($name)) + { + $name = "$".trim($name); + if(!in_array($name,$globals) && !array_key_exists($name,$variables)) + $variables[$name] = '$_'.gen_name($VarCount++); + } + } + $p = strpos($line,"$",$p+1); + } + } + + for($x=0;$x$varname) + { + //echo "strpos ".$code[$x].', '.$v."\n"; + $p = strpos($code[$x],$v); + while(is_numeric($p)) + { + $t = GetVarName(substr($code[$x],$p)); + if('$'.$t == $v) + { + $code[$x] = substr_replace($code[$x],$varname,$p,strlen($t)+1); + } + $p = strpos($code[$x],$v,$p+1); + } + } + } + + $o = "function $NewName"."("; + if (is_array($a)) { + foreach($a as $attr) + { + list($attr,$default) = explode('=', $attr); + $av[] = ($variables[$attr].(isset($defaults[$attr]) ? '='.$defaults[$attr] : '')); + } + } + if(count($av)>0) + $o .= implode(",",$av); + $o .= ")"; + //echo "reversed: $o\n"; + $o .= implode(" ",$code); + //$o = str_replace("\n","",$o); + return $o; + } + + $out = ""; + $outline = 0; + + $shuffled = array_rand($functions, count($functions)); +// print_r($shuffled); + + foreach ($shuffled as $name) { + $pos = $functions[$name]; + + //foreach($functions as $name =>$pos) + //{ + $dest = $pos["start"]; + $newname = $pos["newname"]; + if(!$outline) + $outline = $dest; + + + unset($code); + for($x=$dest+1;$x<=$pos["end"];$x++) + { + $code[] = $php[$x]; + } + $newcode = obscure_func($newname,$pos["attribs"],$code); + $out .= $newcode; + } + foreach($functions as $name=>$pos) + { + for($x=$pos["start"];$x<=$pos["end"];$x++) + { + $php[$x] = ""; + } + } + + $code =array(); + for($x=0;$x$attr) + { + $line = str_replace($name,$attr["newname"],$line); + } + $code[$x] = $line; + } + $php = $code; + + $line=1; + + $tmp_file = fopen($argv[1].'_', 'w'); + + for($x=0;$x Index: branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/str_ireplace.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/str_ireplace.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/str_ireplace.php (revision 6981) @@ -0,0 +1,119 @@ + | +// +----------------------------------------------------------------------+ +// +// $Id: str_ireplace.php,v 1.1.2.1 2006-12-12 08:16:42 alex Exp $ +// + + +/** + * Replace str_ireplace() + * + * @category PHP + * @package PHP_Compat + * @link http://php.net/function.str_ireplace + * @author Aidan Lister + * @version $Revision: 1.1.2.1 $ + * @since PHP 5 + * @internal count not by returned by reference - not possible in php4 + * @require PHP 4.0.1 (trigger_error) + */ +if (!function_exists('str_ireplace')) +{ + function str_ireplace ($search, $replace, $subject, $count = null) + { + if (is_string($search) && is_array($replace)) { + trigger_error('Array to string conversion', E_USER_NOTICE); + $replace = (string) $replace; + } + + // If search isn't an array, make it one + if (!is_array($search)) { + $search = array ($search); + } + + // If replace isn't an array, make it one, and pad it to the length of search + if (!is_array($replace)) + { + $replace_string = $replace; + + $replace = array (); + for ($i = 0, $c = count($search); $i < $c; $i++) + { + $replace[$i] = $replace_string; + } + } + + // Check the replace array is padded to the correct length + $length_replace = count($replace); + $length_search = count($search); + if ($length_replace < $length_search) + { + for ($i = $length_replace; $i < $length_search; $i++) + { + $replace[$i] = ''; + } + } + + // If subject is not an array, make it one + $was_array = false; + if (!is_array($subject)) { + $was_array = true; + $subject = array ($subject); + } + + // Loop through each subject + $count = 0; + foreach ($subject as $subject_key => $subject_value) + { + // Loop through each search + foreach ($search as $search_key => $search_value) + { + // Split the array into segments, in between each part is our search + $segments = explode(strtolower($search_value), strtolower($subject_value)); + + // The number of replacements done is the number of segments minus the first + $count += count($segments) - 1; + $pos = 0; + + // Loop through each segment + foreach ($segments as $segment_key => $segment_value) + { + // Replace the lowercase segments with the upper case versions + $segments[$segment_key] = substr($subject_value, $pos, strlen($segment_value)); + // Increase the position relative to the initial string + $pos += strlen($segment_value) + strlen($search_value); + } + + // Put our original string back together + $subject_value = implode($replace[$search_key], $segments); + } + + $result[$subject_key] = $subject_value; + } + + // Check if subject was initially a string and return it as a string + if ($was_array === true) { + return $result[0]; + } + + // Otherwise, just return the array + return $result; + } +} + +?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.96/png_replace.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.96/png_replace.php (revision 14) +++ branches/unlabeled/unlabeled-1.1.96/png_replace.php (revision 0) @@ -1,93 +0,0 @@ -|)/Uis',$x,$images); - while(list($imgnum,$v)=@each($images[0])){ - $original=$v; - $atts=''; $width=0; $height=0; - // If the size is defined by styles, find - preg_match_all('/style=".*(width: ([0-9]+))px.*'. - '(height: ([0-9]+))px.*"/Ui',$v,$arr2); - if(is_array($arr2) && count($arr2[0])){ - // size was defined by styles, get values - $width=$arr2[2][0]; - $height=$arr2[4][0]; - } - // size was not defined by styles, get values - preg_match_all('/width=\"?([0-9]+)\"?/i',$v,$arr2); - if(is_array($arr2) && count($arr2[0])){ - $width=$arr2[1][0]; - } - preg_match_all('/height=\"?([0-9]+)\"?/i',$v,$arr2); - if(is_array($arr2) && count($arr2[0])){ - $height=$arr2[1][0]; - } - preg_match_all('/src=\"([^\"]+\.png)\"/i',$v,$arr2); - if(isset($arr2[1][0]) && !empty($arr2[1][0])) - $image=$arr2[1][0]; - else - $image=NULL; - - // We do this so that we can put our spacer.gif image in the same - // directory as the image - $tmp=split('[\\/]',$image); - array_pop($tmp); - $image_path=join('/',$tmp); - if(strlen($image_path)) $image_path.='/'; - - // end quote is already supplied by originial src attribute - $replace_src_with=$spacer.'" style="width: '.$width. - 'px; height: '.$height.'px; filter: progid:DXImageTransform.'. - 'Microsoft.AlphaImageLoader(src=\''.$image.'\', sizingMethod='. - '\'scale\')'; - - // now create the new tag from the old - $new_tag=str_replace($image,$replace_src_with,$original); - - // now place the new tag into the content - $x=str_replace($original,$new_tag,$x); - } - return $x; -} -?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/str_split.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/str_split.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/str_split.php (revision 6981) @@ -0,0 +1,53 @@ + | +// +----------------------------------------------------------------------+ +// +// $Id: str_split.php,v 1.1.2.1 2006-12-12 08:16:42 alex Exp $ +// + + +/** + * Replace str_split() + * + * @category PHP + * @package PHP_Compat + * @link http://php.net/function.str_split + * @author Aidan Lister + * @version $Revision: 1.1.2.1 $ + * @since PHP 5 + * @require PHP 4.0.1 (trigger_error) + */ +if (!function_exists('str_split')) +{ + function str_split ($string, $split_length = 1) + { + if (!is_numeric($split_length)) { + trigger_error('str_split() expects parameter 2 to be long, ' . gettype($split_length) . ' given', E_USER_WARNING); + return false; + } + + if ($split_length < 1) { + trigger_error('str_split() The the length of each segment must be greater then zero', E_USER_WARNING); + return false; + } + + preg_match_all('/.{1,' . $split_length . '}/s', $string, $matches); + return $matches[0]; + } +} + +?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/vprintf.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/vprintf.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/vprintf.php (revision 6981) @@ -0,0 +1,47 @@ + | +// +----------------------------------------------------------------------+ +// +// $Id: vprintf.php,v 1.1.2.1 2006-12-12 08:16:42 alex Exp $ +// + + +/** + * Replace vprintf() + * + * @category PHP + * @package PHP_Compat + * @link http://php.net/function.vprintf + * @author Aidan Lister + * @version $Revision: 1.1.2.1 $ + * @since PHP 4.1.0 + * @require PHP 4.0.4 (call_user_func_array) + */ +if (!function_exists('vprintf')) +{ + function vprintf ($format, $args) + { + if (count($args) < 2) { + trigger_error('vprintf() Too few arguments', E_USER_WARNING); + return null; + } + + array_unshift($args, $format); + return call_user_func_array('printf', $args); + } +} +?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.2/kernel/include/compat.php =================================================================== diff -u -N -r6950 -r6981 --- branches/unlabeled/unlabeled-1.1.2/kernel/include/compat.php (.../compat.php) (revision 6950) +++ branches/unlabeled/unlabeled-1.1.2/kernel/include/compat.php (.../compat.php) (revision 6981) @@ -1,18 +1,14 @@ \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/http_build_query.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/http_build_query.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/http_build_query.php (revision 6981) @@ -0,0 +1,101 @@ + | +// | Aidan Lister +// +----------------------------------------------------------------------+ +// +// $Id: http_build_query.php,v 1.1.2.1 2006-12-12 08:16:41 alex Exp $ +// + + +/** + * Replace function http_build_query() + * + * @category PHP + * @package PHP_Compat + * @link http://php.net/function.http-build-query + * @author Stephan Schmidt + * @author Aidan Lister + * @version $Revision: 1.1.2.1 $ + * @since PHP 5 + * @require PHP 4.0.1 (trigger_error) + */ +if (!function_exists('http_build_query')) +{ + function http_build_query ($formdata, $numeric_prefix = null) + { + // If $formdata is an object, convert it to an array + if (is_object($formdata)) { + $formdata = get_object_vars($formdata); + } + + // Check we have an array to work with + if (!is_array($formdata)) { + trigger_error('http_build_query() Parameter 1 expected to be Array or Object. Incorrect value given.', E_USER_WARNING); + return false; + } + + // If the array is empty, return null + if (empty($formdata)) { + return null; + } + + // Start building the query + $tmp = array (); + foreach ($formdata as $key => $val) + { + if (is_integer($key) && $numeric_prefix != null) { + $key = $numeric_prefix . $key; + } + + if (is_scalar($val)) { + array_push($tmp, urlencode($key).'='.urlencode($val)); + continue; + } + + // If the value is an array, recursively parse it + if (is_array($val)) { + array_push($tmp, __http_build_query($val, urlencode($key))); + continue; + } + } + + return implode('&', $tmp); + } + + // Helper function + function __http_build_query ($array, $name) + { + $tmp = array (); + foreach ($array as $key => $value) + { + if (is_array($value)) { + array_push($tmp, __http_build_query($value, sprintf('%s[%s]', $name, $key))); + } + + elseif (is_scalar($value)) { + array_push($tmp, sprintf('%s[%s]=%s', $name, urlencode($key), urlencode($value))); + } + + elseif (is_object($value)) { + array_push($tmp, __http_build_query(get_object_vars($value), sprintf('%s[%s]', $name, $key))); + } + } + + return implode('&', $tmp); + } +} +?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.8.58/obscure.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.8.58/obscure.php (revision 1254) +++ branches/unlabeled/unlabeled-1.8.58/obscure.php (revision 0) @@ -1,274 +0,0 @@ -#!/usr/local/bin/php - -$start,"end"=>$end,"attribs"=>$attribs,"newname"=>$newname); - } - } - } -// print_r($functions); - //echo "
"; print_r($functions); echo "
"; - - function GetVarName($s) - { - $alphabet = "abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - - $name = ""; - $var_end = 0; - $char = substr($s,$var_end,1); - if(substr($s,0,1)=="$") - { - $var_end++; - $char = substr($s,$var_end,1); - } - while(is_numeric(strpos($alphabet,$char)) && strlen($char)) - { - $name .= $char; - $var_end++; - $char = substr($s,$var_end,1); - } - return $name; - } - - function obscure_func($NewName,$Attribs,$code) - { - global $functions; - - $globals = array(); - - $globals[] = '$this'; - $globals[] = '$_GET'; - $globals[] = '$_FILES'; - $globals[] = '$_POST'; - $globals[] = '$_COOKIE'; - $globals[] = '$_SERVER'; - - $variables = array(); - - $new_code = array(); - for($x=0;$x<=count($code);$x++) - { - $line = $code[$x]; - $line = ltrim($line); - $line = str_replace("\t","",$line); - $g = strpos($line,"global"); - if(is_numeric($g)) - { - $vars = trim(substr($line,$g+7)); - $vars = substr($vars,0,-1); - $v = explode(",",$vars); - for($z=0;$z$attr) - { - $line = $code[$x]; - $code[$x] = str_replace($name,$attr["newname"],$line); - } - } - - $VarCount =0; - if(strlen($Attribs)>3) - { - $Attribs = trim($Attribs); - $Attribs = str_replace("\t","",$Attribs); - //echo "getting attribs from $Attribs\n"; - $a = explode(",",substr($Attribs,1,-1)); -// echo "got attribs for func [$Attribs]:\n"; -// var_dump($a); - if (is_array($a) && $a[0] != '') { - foreach($a as $attr) - { - list($attr,$default) = explode('=', $attr); - //echo "attr: $attr / def = $default\n"; - if ($default != '') { - $defaults[$attr] = $default; - //echo "stored defaults for $attr\n"; - } - $variables[$attr] = '$_'.gen_name($VarCount++); - } - } - } - - for($x=0;$x0) - { - if(substr($line,$p,2)!="$$") - { - $name=GetVarName(substr($line,$p)); - if(strlen($name)) - { - $name = "$".trim($name); - if(!in_array($name,$globals) && !array_key_exists($name,$variables)) - $variables[$name] = '$_'.gen_name($VarCount++); - } - } - $p = strpos($line,"$",$p+1); - } - } - - for($x=0;$x$varname) - { - //echo "strpos ".$code[$x].', '.$v."\n"; - $p = strpos($code[$x],$v); - while(is_numeric($p)) - { - $t = GetVarName(substr($code[$x],$p)); - if('$'.$t == $v) - { - $code[$x] = substr_replace($code[$x],$varname,$p,strlen($t)+1); - } - $p = strpos($code[$x],$v,$p+1); - } - } - } - - $o = "function $NewName"."("; - if (is_array($a)) { - foreach($a as $attr) - { - list($attr,$default) = explode('=', $attr); - $av[] = ($variables[$attr].(isset($defaults[$attr]) ? '='.$defaults[$attr] : '')); - } - } - if(count($av)>0) - $o .= implode(",",$av); - $o .= ")"; - //echo "reversed: $o\n"; - $o .= implode(" ",$code); - //$o = str_replace("\n","",$o); - return $o; - } - - $out = ""; - $outline = 0; - - $shuffled = array_rand($functions, count($functions)); -// print_r($shuffled); - - foreach ($shuffled as $name) { - $pos = $functions[$name]; - - //foreach($functions as $name =>$pos) - //{ - $dest = $pos["start"]; - $newname = $pos["newname"]; - if(!$outline) - $outline = $dest; - - - unset($code); - for($x=$dest+1;$x<=$pos["end"];$x++) - { - $code[] = $php[$x]; - } - $newcode = obscure_func($newname,$pos["attribs"],$code); - $out .= $newcode; - } - foreach($functions as $name=>$pos) - { - for($x=$pos["start"];$x<=$pos["end"];$x++) - { - $php[$x] = ""; - } - } - - $code =array(); - for($x=0;$x$attr) - { - $line = str_replace($name,$attr["newname"],$line); - } - $code[$x] = $line; - } - $php = $code; - - $line=1; - - $tmp_file = fopen($argv[1].'_', 'w'); - - for($x=0;$x Index: branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/array_diff_assoc.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/array_diff_assoc.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/array_diff_assoc.php (revision 6981) @@ -0,0 +1,80 @@ + | +// +----------------------------------------------------------------------+ +// +// $Id: array_diff_assoc.php,v 1.1.2.1 2006-12-12 08:16:41 alex Exp $ +// + + +/** + * Replace array_diff_assoc() + * + * @category PHP + * @package PHP_Compat + * @link http://php.net/function.array_diff_assoc + * @author Aidan Lister + * @version $Revision: 1.1.2.1 $ + * @since PHP 4.3.0 + * @require PHP 4.0.1 (trigger_error) + */ +if (!function_exists('array_diff_assoc')) +{ + function array_diff_assoc () + { + // Check we have enough arguments + $args = func_get_args(); + $count = count($args); + if (count($args) < 2) { + trigger_error('Wrong parameter count for array_diff_assoc()', E_USER_WARNING); + return null; + } + + // Check arrays + for ($i = 0; $i < $count; $i++) + { + if (!is_array($args[$i])) { + trigger_error('array_diff_assoc() Argument #' . ($i + 1) . ' is not an array', E_USER_WARNING); + return null; + } + } + + // Get the comparison array + $array_comp = array_shift($args); + --$count; + + // Traverse values of the first array + foreach ($array_comp as $key => $value) + { + // Loop through the other arrays + for ($i = 0; $i < $count; $i++) + { + // Loop through this arrays key/value pairs and compare + foreach ($args[$i] as $comp_key => $comp_value) + { + if ((string)$key === (string)$comp_key && + (string)$value === (string)$comp_value) { + + unset($array_comp[$key]); + } + } + } + } + + return $array_comp; + } +} +?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/array_udiff.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/array_udiff.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/array_udiff.php (revision 6981) @@ -0,0 +1,84 @@ + | +// | Aidan Lister | +// +----------------------------------------------------------------------+ +// +// $Id: array_udiff.php,v 1.1.2.1 2006-12-12 08:16:41 alex Exp $ +// + + +/** + * Replace array_udiff() + * + * @category PHP + * @package PHP_Compat + * @link http://php.net/function.array_udiff + * @author Stephan Schmidt + * @author Aidan Lister + * @version $Revision: 1.1.2.1 $ + * @since PHP 5 + * @require PHP 4.0.1 (trigger_error) + */ +if (!function_exists('array_udiff')) +{ + function array_udiff () + { + $args = func_get_args(); + + if (count($args) < 3) { + trigger_error('Wrong parameter count for array_udiff()', E_USER_WARNING); + return null; + } + + // Get compare function + $compare_func = array_pop($args); + if (!is_callable($compare_func)) { + if (is_array($compare_func)) { + $compare_func = $compare_func[0] . '::' . $compare_func[1]; + } + trigger_error('array_udiff() Not a valid callback ' . $compare_func, E_USER_WARNING); + return null; + } + + // Check arrays + $cnt = count($args); + for ($i = 0; $i < $cnt; $i++) { + if (!is_array($args[$i])) { + trigger_error('array_udiff() Argument #' . ($i + 1). ' is not an array', E_USER_WARNING); + return null; + } + } + + $diff = array (); + // Traverse values of the first array + foreach ($args[0] as $key => $value) { + // Check all arrays + for ($i = 1; $i < $cnt; $i++) { + foreach ($args[$i] as $cmp_value) { + $result = call_user_func($compare_func, $value, $cmp_value); + if ($result === 0) { + continue 3; + } + } + } + $diff[$key] = $value; + } + return $diff; + } +} + +?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.11.48/new_phrases.txt =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.11.48/new_phrases.txt (revision 1853) +++ branches/unlabeled/unlabeled-1.11.48/new_phrases.txt (revision 0) @@ -1,75 +0,0 @@ -la_permtype_$permmodule -la_text_datatype_ -la_text_ -la_description_ -lu_ferror_email_duplicate -la_review_pending -lu_already_suggested -lu_hello_world -lu_searchtitle_ -lu_ -la_admin -la_title_edit_ban -la_tooltip_prev -lu_prompt_email -lu_getting_rated -lu_shoppingcart,lu_comm_shippinginfo,lu_comm_billinginfo,lu_comm_orderpreview,lu_comm_confirmation -lu_shoppingcart,lu_comm_billinginfo,lu_comm_orderpreview,lu_comm_confirmation -la_empty_file -la_emptyfile -la_done -la_exportfoldernotwritable -la_text_translation -la_baseselectors -la_blockselectors -lu_no_permissions -la_title_generalfields -la_col_tablename -la_col_simplesearch -la_invalid_state -la_desc_emailevent_ -la_updating_manufacturers -la_updating_email_config -la_updating_contacts_config -la_tab_tagtest -la_invalid -la_verified -la_penging -la_fields -la_value -la_tooltip_resettoshipping -la_tooltip_goto -lu_getting_rated_text -lu_comm_returningcustomers -lu_comm_pleaselogin -lu_comm_indicatedrequired -lu_comm_forgotpassword -lu_comm_password -lu_comm_register -lu_comm_home -lu_comm_youraccount -lu_comm_shoppingcart -lu_comm_help -lu_comm_poweredby -lu_comm_lu_allrightsreserved -lu_comm_yourlanguage -lu_comm_yourcurrency -lu_comm_mailinglist -lu_comm_registration -lu_select_username -lu_comm_shippingemail -lu_comm_other -lu_create_password -lu_address_line_1 -lu_comm_newcustomers -lu_your_email -lu_comm_rateexcellent,lu_comm_rateverygood,lu_comm_rategood,lu_comm_rateaverage,lu_comm_ratefair,lu_comm_ratepoor -lu_comm_removfromfav -lu_comm_verifypassword -lu_comm_phone -lu_comm_email -lu_register_autopasswd -lu_comm_pleaseregister -lu_comm_pleaseenterfollowing -lu_comm_addtofav -lu_ferror_ Index: branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/array_combine.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/array_combine.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/array_combine.php (revision 6981) @@ -0,0 +1,71 @@ + | +// +----------------------------------------------------------------------+ +// +// $Id: array_combine.php,v 1.1.2.1 2006-12-12 08:16:41 alex Exp $ +// + + +/** + * Replace array_combine() + * + * @category PHP + * @package PHP_Compat + * @link http://php.net/function.array_combine + * @author Aidan Lister + * @version $Revision: 1.1.2.1 $ + * @since PHP 5 + * @require PHP 4.0.1 (trigger_error) + */ +if (!function_exists('array_combine')) +{ + function array_combine ($keys, $values) + { + if (!is_array($keys)) { + trigger_error('array_combine() expects parameter 1 to be array, ' . gettype($keys) . ' given', E_USER_WARNING); + return null; + } + + if (!is_array($values)) { + trigger_error('array_combine() expects parameter 2 to be array, ' . gettype($values) . ' given', E_USER_WARNING); + return null; + } + + if (count($keys) !== count($values)) { + trigger_error('array_combine() Both parameters should have equal number of elements', E_USER_WARNING); + return false; + } + + if (count($keys) === 0 || count($values) === 0) { + trigger_error('array_combine() Both parameters should have number of elements at least 0', E_USER_WARNING); + return false; + } + + $keys = array_values($keys); + $values = array_values($values); + + $combined = array (); + + for ($i = 0, $cnt = count($values); $i < $cnt; $i++) { + $combined[$keys[$i]] = $values[$i]; + } + + return $combined; + } +} + +?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/array_change_key_case.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/array_change_key_case.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/array_change_key_case.php (revision 6981) @@ -0,0 +1,65 @@ + | +// | Aidan Lister | +// +----------------------------------------------------------------------+ +// +// $Id: array_change_key_case.php,v 1.1.2.1 2006-12-12 08:16:41 alex Exp $ +// + + +if (!defined('CASE_LOWER')) { + define('CASE_LOWER', 0); +} + +if (!defined('CASE_UPPER')) { + define('CASE_UPPER', 1); +} + + +/** + * Replace array_change_key_case() + * + * @category PHP + * @package PHP_Compat + * @link http://php.net/function.array_change_key_case + * @author Stephan Schmidt + * @author Aidan Lister + * @version $Revision: 1.1.2.1 $ + * @since PHP 4.2.0 + * @require PHP 4.0.1 (trigger_error) + */ +if (!function_exists('array_change_key_case')) +{ + function array_change_key_case ($input, $case = CASE_LOWER) + { + if (!is_array($input)) { + trigger_error('array_change_key_case(): The argument should be an array', E_USER_WARNING); + return false; + } + + $output = array (); + $keys = array_keys($input); + $casefunc = ($case == CASE_LOWER) ? 'strtolower' : 'strtoupper'; + + foreach ($keys as $key) { + $output[$casefunc($key)] = $input[$key]; + } + + return $output; + } +} +?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/is_a.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/is_a.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/is_a.php (revision 6981) @@ -0,0 +1,48 @@ + | +// +----------------------------------------------------------------------+ +// +// $Id: is_a.php,v 1.1.2.1 2006-12-12 08:16:41 alex Exp $ +// + + +/** + * Replace function is_a() + * + * @category PHP + * @package PHP_Compat + * @link http://php.net/function.is_a + * @author Aidan Lister + * @version $Revision: 1.1.2.1 $ + * @since PHP 4.2.0 + * @require PHP 4.0.0 (is_subclass_of) + */ +if (!function_exists('is_a')) +{ + function is_a ($object, $class) + { + if (get_class($object) == strtolower($class)) { + return true; + } + + else { + return is_subclass_of($object, $class); + } + } +} + +?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/var_export.php =================================================================== diff -u -N --- branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/var_export.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.2/kernel/include/compat/var_export.php (revision 6981) @@ -0,0 +1,103 @@ + | +// +----------------------------------------------------------------------+ +// +// $Id: var_export.php,v 1.1.2.1 2006-12-12 08:16:42 alex Exp $ +// + + +/** + * Replace var_export() + * + * @category PHP + * @package PHP_Compat + * @link http://php.net/function.var_export + * @author Aidan Lister + * @version $Revision: 1.1.2.1 $ + * @since PHP 4.2.0 + * @require PHP 4.0.1 (trigger_error) + */ +if (!function_exists('var_export')) +{ + function var_export ($array, $return = false) + { + // Common output variables + $indent = ' '; + $doublearrow = ' => '; + $lineend = ",\n"; + $stringdelim = '\''; + $newline = "\n"; + + // Check the export isn't a simple string / int + if (is_string($array)) { + $out = $stringdelim . $array . $stringdelim; + } + elseif (is_int($array)) { + $out = (string)$array; + } + + // Begin the array export + else + { + // Start the string + $out = "array (\n"; + + // Loop through each value in array + foreach ($array as $key => $value) + { + // If the key is a string, delimit it + if (is_string($key)) { + $key = $stringdelim . addslashes($key) . $stringdelim; + } + + // If the value is a string, delimit it + if (is_string($value)) { + $value = $stringdelim . addslashes($value) . $stringdelim; + } + + // We have an array, so do some recursion + elseif (is_array($value)) + { + // Do some basic recursion while increasing the indent + $recur_array = explode($newline, var_export($value, true)); + $recur_newarr = array (); + foreach ($recur_array as $recur_line) { + $recur_newarr[] = $indent . $recur_line; + } + $recur_array = implode($newline, $recur_newarr); + $value = $newline . $recur_array; + } + + // Piece together the line + $out .= $indent . $key . $doublearrow . $value . $lineend; + } + + // End our string + $out .= ")"; + } + + + // Decide method of output + if ($return === true) { + return $out; + } else { + echo $out; + return null; + } + } +} +?> \ No newline at end of file