/** * This function will fix magic quotes. * * @param $value The value to fix. * * @returns The fixed value. */ function YDRemoveMagicQuotes(&$value) { if (get_magic_quotes_gpc() == 1) { if (is_array($value)) { $result = array(); foreach ($value as $key => $val) { $result[$key] = is_array($val) ? YDRemoveMagicQuotes($val) : stripslashes($val); } return $result; } else { return stripslashes($value); } } return $value; }
if (ini_get('include_path') != '') { $includePath .= YD_PATHDELIM . ini_get('include_path'); } $GLOBALS['YD_INCLUDE_PATH'] = explode(YD_PATHDELIM, $includePath); @ini_set('include_path', $includePath); // Include the standard functions include_once YD_DIR_HOME . '/YDF2_core.php'; // Default the locale to English YDConfig::set('YD_LOCALE', 'en', false); // Fix the PHP variables affected by magic_quotes_gpc (which is evil if you ask me ;-) if (!defined('YD_FIXED_MAGIC_QUOTES')) { if (get_magic_quotes_gpc() == 1) { $_GET = @YDRemoveMagicQuotes($_GET); $_POST = @YDRemoveMagicQuotes($_POST); $_COOKIE = @YDRemoveMagicQuotes($_COOKIE); $_REQUEST = @YDRemoveMagicQuotes($_REQUEST); } define('YD_FIXED_MAGIC_QUOTES', true); } // Check if we have the right PHP version if (version_compare(phpversion(), '4.2.0') == -1) { trigger_error('PHP version 4.2.0 or greater is required.', YD_ERROR); } // Set the debugging level switch (@$_GET['YD_DEBUG']) { case 2: YDConfig::set('YD_DEBUG', 2, false); break; case 1: YDConfig::set('YD_DEBUG', 1, false); break;