function privSwapBackMagicQuotes() { //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privSwapBackMagicQuotes', ""); $v_result = 1; // ----- Look if function exists if (!function_exists("get_magic_quotes_runtime") || !function_exists("set_magic_quotes_runtime")) { //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Functions *et_magic_quotes_runtime are not supported"); //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result); return $v_result; } // ----- Look if something to do if ($this->magic_quotes_status != -1) { //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "magic_quote not modified"); //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result); return $v_result; } // ----- Swap back magic_quotes if ($this->magic_quotes_status == 1) { //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Enable back magic_quotes"); @magic_quotes_runtime($this->magic_quotes_status); } // ----- Return //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result); return $v_result; }
$value = $GLOBALS['phpgw']->translation->translate("{$key}", $vars); return $value; } /* Make sure the header.inc.php is current. */ if ($GLOBALS['phpgw_info']['server']['versions']['header'] < $GLOBALS['phpgw_info']['server']['versions']['current_header']) { echo '<center><b>You need to port your settings to the new header.inc.php version by running <a href="setup/manageheader.php">setup/headeradmin</a>.</b></center>'; exit; } /* Make sure the developer is following the rules. */ if (!isset($GLOBALS['phpgw_info']['flags']['currentapp'])) { /* This object does not exist yet. */ /* $GLOBALS['phpgw']->log->write(array('text'=>'W-MissingFlags, currentapp flag not set'));*/ echo '<b>!!! YOU DO NOT HAVE YOUR $GLOBALS[\'phpgw_info\'][\'flags\'][\'currentapp\'] SET !!!'; echo '<br>!!! PLEASE CORRECT THIS SITUATION !!!</b>'; } magic_quotes_runtime(false); print_debug('sane environment', 'messageonly', 'api'); /****************************************************************************\ * Multi-Domain support * \****************************************************************************/ /* make them fix their header */ if (!isset($GLOBALS['phpgw_domain'])) { echo '<center><b>The administrator must upgrade the header.inc.php file before you can continue.</b></center>'; exit; } if (!isset($GLOBALS['phpgw_info']['server']['default_domain']) || !isset($GLOBALS['phpgw_domain'][$GLOBALS['phpgw_info']['server']['default_domain']])) { reset($GLOBALS['phpgw_domain']); list($GLOBALS['phpgw_info']['server']['default_domain']) = each($GLOBALS['phpgw_domain']); } if (isset($_POST['login'])) { $GLOBALS['login'] = $_POST['login'];
ereg_replace(); eregi(); eregi_replace(); import_request_variables(); mcrypt_generic_end(); mysql_db_query(); mysql_escape_string(); mysql_list_dbs(); mysqli_bind_param(); mysqli_bind_result(); mysqli_client_encoding(); mysqli_fetch(); mysqli_param_count(); mysqli_get_metadata(); mysqli_send_long_data(); magic_quotes_runtime(); session_register(); session_unregister(); session_is_registered(); set_magic_quotes_runtime(); set_socket_blocking(); split(); spliti(); sql_regcase(); php_logo_guid(); php_egg_logo_guid(); php_real_logo_guid(); zend_logo_guid(); datefmt_set_timezone_id(); mcrypt_ecb(); mcrypt_cbc();
/** * Check the version of PHP, the needed PHP extension and a number * of configuration parameters (memory_limit, max_upload_file_size, etc...) * @param SetupPage $oP The page used only for its 'log' method * @return array An array of CheckResults objects */ static function CheckPHPVersion() { $aResult = array(); // For log file(s) if (!is_dir(APPROOT . 'log')) { @mkdir(APPROOT . 'log'); } SetupPage::log('Info - CheckPHPVersion'); if (version_compare(phpversion(), self::PHP_MIN_VERSION, '>=')) { $aResult[] = new CheckResult(CheckResult::INFO, "The current PHP Version (" . phpversion() . ") is greater than the minimum version required to run " . ITOP_APPLICATION . ", which is (" . self::PHP_MIN_VERSION . ")"); } else { $aResult[] = new CheckResult(CheckResult::ERROR, "Error: The current PHP Version (" . phpversion() . ") is lower than the minimum version required to run " . ITOP_APPLICATION . ", which is (" . self::PHP_MIN_VERSION . ")"); } // Check the common directories $aWritableDirsErrors = self::CheckWritableDirs(array('log', 'env-production', 'conf', 'data')); $aResult = array_merge($aResult, $aWritableDirsErrors); $aMandatoryExtensions = array('mysqli', 'iconv', 'simplexml', 'soap', 'hash', 'json', 'session', 'pcre', 'dom'); $aOptionalExtensions = array('mcrypt' => 'Strong encryption will not be used.', 'ldap' => 'LDAP authentication will be disabled.'); asort($aMandatoryExtensions); // Sort the list to look clean ! ksort($aOptionalExtensions); // Sort the list to look clean ! $aExtensionsOk = array(); $aMissingExtensions = array(); $aMissingExtensionsLinks = array(); // First check the mandatory extensions foreach ($aMandatoryExtensions as $sExtension) { if (extension_loaded($sExtension)) { $aExtensionsOk[] = $sExtension; } else { $aMissingExtensions[] = $sExtension; $aMissingExtensionsLinks[] = "<a href=\"http://www.php.net/manual/en/book.{$sExtension}.php\" target=\"_blank\">{$sExtension}</a>"; } } if (count($aExtensionsOk) > 0) { $aResult[] = new CheckResult(CheckResult::INFO, "Required PHP extension(s): " . implode(', ', $aExtensionsOk) . "."); } if (count($aMissingExtensions) > 0) { $aResult[] = new CheckResult(CheckResult::ERROR, "Missing PHP extension(s): " . implode(', ', $aMissingExtensionsLinks) . "."); } // Next check the optional extensions $aExtensionsOk = array(); $aMissingExtensions = array(); foreach ($aOptionalExtensions as $sExtension => $sMessage) { if (extension_loaded($sExtension)) { $aExtensionsOk[] = $sExtension; } else { $aMissingExtensions[$sExtension] = $sMessage; } } if (count($aExtensionsOk) > 0) { $aResult[] = new CheckResult(CheckResult::INFO, "Optional PHP extension(s): " . implode(', ', $aExtensionsOk) . "."); } if (count($aMissingExtensions) > 0) { foreach ($aMissingExtensions as $sExtension => $sMessage) { $aResult[] = new CheckResult(CheckResult::WARNING, "Missing optional PHP extension: {$sExtension}. " . $sMessage); } } // Check some ini settings here if (function_exists('php_ini_loaded_file')) { $sPhpIniFile = php_ini_loaded_file(); // Other included/scanned files if ($sFileList = php_ini_scanned_files()) { if (strlen($sFileList) > 0) { $aFiles = explode(',', $sFileList); foreach ($aFiles as $sFile) { $sPhpIniFile .= ', ' . trim($sFile); } } } SetupPage::log("Info - php.ini file(s): '{$sPhpIniFile}'"); } else { $sPhpIniFile = 'php.ini'; } if (!ini_get('file_uploads')) { $aResult[] = new CheckResult(CheckResult::ERROR, "Files upload is not allowed on this server (file_uploads = " . ini_get('file_uploads') . ")."); } $sUploadTmpDir = self::GetUploadTmpDir(); if (empty($sUploadTmpDir)) { $sUploadTmpDir = '/tmp'; $aResult[] = new CheckResult(CheckResult::WARNING, "Temporary directory for files upload is not defined (upload_tmp_dir), assuming that {$sUploadTmpDir} is used."); } // check that the upload directory is indeed writable from PHP if (!empty($sUploadTmpDir)) { if (!file_exists($sUploadTmpDir)) { $aResult[] = new CheckResult(CheckResult::ERROR, "Temporary directory for files upload ({$sUploadTmpDir}) does not exist or cannot be read by PHP."); } else { if (!is_writable($sUploadTmpDir)) { $aResult[] = new CheckResult(CheckResult::ERROR, "Temporary directory for files upload ({$sUploadTmpDir}) is not writable."); } else { SetupPage::log("Info - Temporary directory for files upload ({$sUploadTmpDir}) is writable."); } } } if (!ini_get('upload_max_filesize')) { $aResult[] = new CheckResult(CheckResult::ERROR, "File upload is not allowed on this server (upload_max_filesize = " . ini_get('upload_max_filesize') . ")."); } $iMaxFileUploads = ini_get('max_file_uploads'); if (!empty($iMaxFileUploads) && $iMaxFileUploads < 1) { $aResult[] = new CheckResult(CheckResult::ERROR, "File upload is not allowed on this server (max_file_uploads = " . ini_get('max_file_uploads') . ")."); } $iMaxUploadSize = utils::ConvertToBytes(ini_get('upload_max_filesize')); $iMaxPostSize = utils::ConvertToBytes(ini_get('post_max_size')); if ($iMaxPostSize <= $iMaxUploadSize) { $aResult[] = new CheckResult(CheckResult::WARNING, "post_max_size (" . ini_get('post_max_size') . ") in php.ini should be strictly greater than upload_max_filesize (" . ini_get('upload_max_filesize') . ") otherwise you cannot upload files of the maximum size."); } SetupPage::log("Info - upload_max_filesize: " . ini_get('upload_max_filesize')); SetupPage::log("Info - post_max_size: " . ini_get('post_max_size')); SetupPage::log("Info - max_file_uploads: " . ini_get('max_file_uploads')); // Check some more ini settings here, needed for file upload if (function_exists('get_magic_quotes_gpc')) { if (@get_magic_quotes_gpc()) { $aResult[] = new CheckResult(CheckResult::ERROR, "'magic_quotes_gpc' is set to On. Please turn it Off in php.ini before continuing."); } } if (function_exists('magic_quotes_runtime')) { if (@magic_quotes_runtime()) { $aResult[] = new CheckResult(CheckResult::ERROR, "'magic_quotes_runtime' is set to On. Please turn it Off in php.ini before continuing."); } } $sMemoryLimit = trim(ini_get('memory_limit')); if (empty($sMemoryLimit)) { // On some PHP installations, memory_limit does not exist as a PHP setting! // (encountered on a 5.2.0 under Windows) // In that case, ini_set will not work, let's keep track of this and proceed anyway $aResult[] = new CheckResult(CheckResult::WARNING, "No memory limit has been defined in this instance of PHP"); } else { // Check that the limit will allow us to load the data // $iMemoryLimit = utils::ConvertToBytes($sMemoryLimit); if ($iMemoryLimit < self::MIN_MEMORY_LIMIT) { $aResult[] = new CheckResult(CheckResult::ERROR, "memory_limit ({$iMemoryLimit}) is too small, the minimum value to run the application is " . self::MIN_MEMORY_LIMIT . "."); } else { SetupPage::log("Info - memory_limit is {$iMemoryLimit}, ok."); } } // Special case for APC if (extension_loaded('apc')) { $sAPCVersion = phpversion('apc'); $aResult[] = new CheckResult(CheckResult::INFO, "APC detected (version {$sAPCVersion}). The APC cache will be used to speed-up " . ITOP_APPLICATION . "."); } // Special case Suhosin extension if (extension_loaded('suhosin')) { $sSuhosinVersion = phpversion('suhosin'); $aOk[] = "Suhosin extension detected (version {$sSuhosinVersion})."; $iGetMaxValueLength = ini_get('suhosin.get.max_value_length'); if ($iGetMaxValueLength < self::SUHOSIN_GET_MAX_VALUE_LENGTH) { $aResult[] = new CheckResult(CheckResult::WARNING, "suhosin.get.max_value_length ({$iGetMaxValueLength}) is too small, the minimum value recommended to run the application is " . self::SUHOSIN_GET_MAX_VALUE_LENGTH . "."); } else { SetupPage::log("Info - suhosin.get.max_value_length = {$iGetMaxValueLength}, ok."); } } if (function_exists('php_ini_loaded_file')) { $sPhpIniFile = php_ini_loaded_file(); // Other included/scanned files if ($sFileList = php_ini_scanned_files()) { if (strlen($sFileList) > 0) { $aFiles = explode(',', $sFileList); foreach ($aFiles as $sFile) { $sPhpIniFile .= ', ' . trim($sFile); } } } $aResult[] = new CheckResult(CheckResult::INFO, "Loaded php.ini files: {$sPhpIniFile}"); } // Check the configuration of the sessions persistence, since this is critical for the authentication if (ini_get('session.save_handler') == 'files') { $sSavePath = ini_get('session.save_path'); SetupPage::log("Info - session.save_path is: '{$sSavePath}'."); // According to the PHP documentation, the format can be /path/where/to_save_sessions or "N;/path/where/to_save_sessions" or "N;MODE;/path/where/to_save_sessions" $sSavePath = ltrim(rtrim($sSavePath, '"'), '"'); // remove surrounding quotes (if any) if (!empty($sSavePath)) { if (($iPos = strrpos($sSavePath, ';', 0)) !== false) { // The actual path is after the last semicolon $sSavePath = substr($sSavePath, $iPos + 1); } if (!is_writable($sSavePath)) { $aResult[] = new CheckResult(CheckResult::ERROR, "The value for session.save_path ({$sSavePath}) is not writable for the web server. Make sure that PHP can actually save session variables. (Refer to the PHP documentation: http://php.net/manual/en/session.configuration.php#ini.session.save-path)"); } else { $aResult[] = new CheckResult(CheckResult::INFO, "The value for session.save_path ({$sSavePath}) is writable for the web server."); } } else { $aResult[] = new CheckResult(CheckResult::WARNING, "Empty path for session.save_path. Make sure that PHP can actually save session variables. (Refer to the PHP documentation: http://php.net/manual/en/session.configuration.php#ini.session.save-path)"); } } else { $aResult[] = new CheckResult(CheckResult::INFO, "session.save_handler is: '" . ini_get('session.save_handler') . "' (different from 'files')."); } return $aResult; }
} } } } if (function_exists('get_magic_quotes_runtime')) { if (get_magic_quotes_runtime() === 1) { if (function_exists('magic_quotes_runtime')) { magic_quotes_runtime(FALSE); } if (function_exists('set_magic_quotes_runtime')) { set_magic_quotes_runtime(FALSE); } } } else { if (function_exists('magic_quotes_runtime')) { magic_quotes_runtime(FALSE); } if (function_exists('set_magic_quotes_runtime')) { set_magic_quotes_runtime(FALSE); } } if (function_exists('ignore_user_abort')) { ignore_user_abort(FALSE); } if (!isset($_SERVER)) { $_SERVER = $HTTP_SERVER_VARS; } header('Content-Type: text/html; charset=utf-8'); if ($_GET['action'] === 'cURLframe') { session_start(); if (!empty($_REQUEST['c37url'])) {