示例#1
0
/**
 * get_php_setting
 *
 * @param string php configuration option or function name
 * returns bool if param $get_value = true
 * else the image defined by SETTING_TRUE/False
 */
function get_php_setting($phpvar, $expected_value, $return_type = 'img')
{
    // get boolean value of setting as 1 or 0
    $value = (int) iniFlag($phpvar);
    #echo $phpvar .' - '.$value .' - ist:'. ini_get($phpvar) .'- soll: '. $expected_value .'<br />';
    if ($return_type === 'int') {
        return $value;
    }
    if ($return_type === 'string') {
        return $value ? SETTING_EXPECTED_ON : SETTING_EXPECTED_OFF;
    }
    if ($return_type === 'img') {
        if ($expected_value === true) {
            return $value ? SETTING_TRUE : SETTING_FALSE;
        } else {
            return $value ? SETTING_FALSE : SETTING_TRUE;
        }
    }
}
示例#2
0
文件: index.php 项目: f3l1x/xhosting
define('TEMPLATE_FILE', dirname(__FILE__) . '/assets/checker.phtml');
if (!is_readable(TEMPLATE_FILE)) {
    die('Error: template file is not readable. Check assets folder (part of distribution), it should be present, readable and contain readable template file.');
}
/**
 * Check Nette Framework requirements.
 */
$tests[] = array('title' => 'Web server', 'message' => isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : 'unknown');
$tests[] = array('title' => 'PHP version', 'required' => TRUE, 'passed' => version_compare(PHP_VERSION, '5.3.1', '>='), 'message' => PHP_VERSION, 'description' => 'Your PHP version is too old. Nette Framework requires at least PHP 5.3.1 or higher.');
$tests[] = array('title' => 'Memory limit', 'message' => ini_get('memory_limit'));
$tests['hf'] = array('title' => '.htaccess file protection', 'required' => FALSE, 'description' => 'File protection by <code>.htaccess</code> is not present. You must be careful to put files into document_root folder.', 'script' => '<script src="assets/denied/checker.js"></script> <script>displayResult("hf", typeof fileProtectionChecker == "undefined")</script>');
$tests['hr'] = array('title' => '.htaccess mod_rewrite', 'required' => FALSE, 'description' => 'Mod_rewrite is probably not present. You will not be able to use Cool URL.', 'script' => '<script src="assets/rewrite/checker"></script> <script>displayResult("hr", typeof modRewriteChecker == "boolean")</script>');
$tests[] = array('title' => 'Function ini_set()', 'required' => FALSE, 'passed' => function_exists('ini_set'), 'description' => 'Function <code>ini_set()</code> is disabled. Some parts of Nette Framework may not work properly.');
$tests[] = array('title' => 'Function error_reporting()', 'required' => TRUE, 'passed' => function_exists('error_reporting'), 'description' => 'Function <code>error_reporting()</code> is disabled. Nette Framework requires this to be enabled.');
$tests[] = array('title' => 'Function flock()', 'required' => TRUE, 'passed' => flock(fopen(__FILE__, 'r'), LOCK_SH), 'description' => 'Function <code>flock()</code> is not supported on this filesystem. Nette Framework requires this to process atomic file operations.');
$tests[] = array('title' => 'Register_globals', 'required' => TRUE, 'passed' => !iniFlag('register_globals'), 'message' => 'Disabled', 'errorMessage' => 'Enabled', 'description' => 'Configuration directive <code>register_globals</code> is enabled. Nette Framework requires this to be disabled.');
$tests[] = array('title' => 'Variables_order', 'required' => TRUE, 'passed' => strpos(ini_get('variables_order'), 'G') !== FALSE && strpos(ini_get('variables_order'), 'P') !== FALSE && strpos(ini_get('variables_order'), 'C') !== FALSE, 'description' => 'Configuration directive <code>variables_order</code> is missing. Nette Framework requires this to be set.');
$tests[] = array('title' => 'Session auto-start', 'required' => FALSE, 'passed' => session_id() === '' && !defined('SID'), 'description' => 'Session auto-start is enabled. Nette Framework recommends not to use this directive for security reasons.');
$tests[] = array('title' => 'PCRE with UTF-8 support', 'required' => TRUE, 'passed' => @preg_match('/pcre/u', 'pcre'), 'description' => 'PCRE extension must support UTF-8.');
$reflection = new ReflectionFunction('paint');
$tests[] = array('title' => 'Reflection phpDoc', 'required' => TRUE, 'passed' => strpos($reflection->getDocComment(), 'Paints') !== FALSE, 'description' => 'Reflection phpDoc are not available (probably due to an eAccelerator bug). You cannot use @annotations.');
$tests[] = array('title' => 'ICONV extension', 'required' => TRUE, 'passed' => extension_loaded('iconv') && ICONV_IMPL !== 'unknown' && @iconv('UTF-16', 'UTF-8//IGNORE', iconv('UTF-8', 'UTF-16//IGNORE', 'test')) === 'test', 'message' => 'Enabled and works properly', 'errorMessage' => 'Disabled or does not work properly', 'description' => 'ICONV extension is required and must work properly.');
$tests[] = array('title' => 'JSON extension', 'required' => TRUE, 'passed' => extension_loaded('json'));
$tests[] = array('title' => 'Fileinfo extension', 'required' => FALSE, 'passed' => extension_loaded('fileinfo'), 'description' => 'Fileinfo extension is absent. You will not be able to detect content-type of uploaded files.');
$tests[] = array('title' => 'PHP tokenizer', 'required' => TRUE, 'passed' => extension_loaded('tokenizer'), 'description' => 'PHP tokenizer is required.');
$tests[] = array('title' => 'PDO extension', 'required' => FALSE, 'passed' => $pdo = extension_loaded('pdo') && PDO::getAvailableDrivers(), 'message' => $pdo ? 'Available drivers: ' . implode(' ', PDO::getAvailableDrivers()) : NULL, 'description' => 'PDO extension or PDO drivers are absent. You will not be able to use <code>Nette\\Database</code>.');
$tests[] = array('title' => 'Multibyte String extension', 'required' => FALSE, 'passed' => extension_loaded('mbstring'), 'description' => 'Multibyte String extension is absent. Some internationalization components may not work properly.');
$tests[] = array('title' => 'Multibyte String function overloading', 'required' => TRUE, 'passed' => !extension_loaded('mbstring') || !(mb_get_info('func_overload') & 2), 'message' => 'Disabled', 'errorMessage' => 'Enabled', 'description' => 'Multibyte String function overloading is enabled. Nette Framework requires this to be disabled. If it is enabled, some string function may not work properly.');
$tests[] = array('title' => 'Memcache extension', 'required' => FALSE, 'passed' => extension_loaded('memcache'), 'description' => 'Memcache extension is absent. You will not be able to use <code>Nette\\Caching\\Storages\\MemcachedStorage</code>.');
$tests[] = array('title' => 'GD extension', 'required' => FALSE, 'passed' => extension_loaded('gd'), 'description' => 'GD extension is absent. You will not be able to use <code>Nette\\Image</code>.');
$tests[] = array('title' => 'Bundled GD extension', 'required' => FALSE, 'passed' => extension_loaded('gd') && GD_BUNDLED, 'description' => 'Bundled GD extension is absent. You will not be able to use some functions such as <code>Nette\\Image::filter()</code> or <code>Nette\\Image::rotate()</code>.');
示例#3
0
    die("Error: template file is not readable. Check assets folder (part of distribution), it should be present, readable and contain readable template file.");
}
/**
 * Check Nette Framework requirements.
 */
define('CHECKER_VERSION', '1.5');
$tests[] = array('title' => 'Web server', 'message' => $_SERVER['SERVER_SOFTWARE']);
$tests[] = array('title' => 'PHP version', 'required' => TRUE, 'passed' => version_compare(PHP_VERSION, '5.3.0', '>='), 'message' => PHP_VERSION, 'description' => 'Your PHP version is too old. Nette Framework requires at least PHP 5.3.0 or higher.');
$tests[] = array('title' => 'Memory limit', 'message' => ini_get('memory_limit'));
$tests['hf'] = array('title' => '.htaccess file protection', 'required' => FALSE, 'description' => 'File protection by <code>.htaccess</code> is not present. You must be careful to put files into document_root folder.', 'script' => '<script src="assets/denied/checker.js"></script> <script>displayResult("hf", typeof fileProtectionChecker == "undefined")</script>');
$tests['hr'] = array('title' => '.htaccess mod_rewrite', 'required' => FALSE, 'description' => 'Mod_rewrite is probably not present. You will not be able to use Cool URL.', 'script' => '<script src="assets/rewrite/checker"></script> <script>displayResult("hr", typeof modRewriteChecker == "boolean")</script>');
$tests[] = array('title' => 'Function ini_set()', 'required' => FALSE, 'passed' => function_exists('ini_set'), 'description' => 'Function <code>ini_set()</code> is disabled. Some parts of Nette Framework may not work properly.');
$tests[] = array('title' => 'Function error_reporting()', 'required' => TRUE, 'passed' => function_exists('error_reporting'), 'description' => 'Function <code>error_reporting()</code> is disabled. Nette Framework requires this to be enabled.');
$tests[] = array('title' => 'Function flock()', 'required' => TRUE, 'passed' => flock(fopen(__FILE__, 'r'), LOCK_SH), 'description' => 'Function <code>flock()</code> is not supported on this filesystem. Nette Framework requires this to process atomic file operations.');
$tests[] = array('title' => 'Register_globals', 'required' => TRUE, 'passed' => !iniFlag('register_globals'), 'message' => 'Disabled', 'errorMessage' => 'Enabled', 'description' => 'Configuration directive <code>register_globals</code> is enabled. Nette Framework requires this to be disabled.');
$tests[] = array('title' => 'Zend.ze1_compatibility_mode', 'required' => TRUE, 'passed' => !iniFlag('zend.ze1_compatibility_mode'), 'message' => 'Disabled', 'errorMessage' => 'Enabled', 'description' => 'Configuration directive <code>zend.ze1_compatibility_mode</code> is enabled. Nette Framework requires this to be disabled.');
$tests[] = array('title' => 'Variables_order', 'required' => TRUE, 'passed' => strpos(ini_get('variables_order'), 'G') !== FALSE && strpos(ini_get('variables_order'), 'P') !== FALSE && strpos(ini_get('variables_order'), 'C') !== FALSE, 'description' => 'Configuration directive <code>variables_order</code> is missing. Nette Framework requires this to be set.');
$tests[] = array('title' => 'Session auto-start', 'required' => FALSE, 'passed' => session_id() === '' && !defined('SID'), 'description' => 'Session auto-start is enabled. Nette Framework recommends not to use this directive for security reasons.');
$tests[] = array('title' => 'Reflection extension', 'required' => TRUE, 'passed' => class_exists('ReflectionFunction'), 'description' => 'Reflection extension is required.');
$tests[] = array('title' => 'SPL extension', 'required' => TRUE, 'passed' => extension_loaded('SPL'), 'description' => 'SPL extension is required.');
$tests[] = array('title' => 'PCRE extension', 'required' => TRUE, 'passed' => extension_loaded('pcre') && @preg_match('/pcre/u', 'pcre'), 'message' => 'Enabled and works properly', 'errorMessage' => 'Disabled or without UTF-8 support', 'description' => 'PCRE extension is required and must support UTF-8.');
$tests[] = array('title' => 'ICONV extension', 'required' => TRUE, 'passed' => extension_loaded('iconv') && ICONV_IMPL !== 'unknown' && @iconv('UTF-16', 'UTF-8//IGNORE', iconv('UTF-8', 'UTF-16//IGNORE', 'test')) === 'test', 'message' => 'Enabled and works properly', 'errorMessage' => 'Disabled or does not work properly', 'description' => 'ICONV extension is required and must work properly.');
$tests[] = array('title' => 'PHP tokenizer', 'required' => TRUE, 'passed' => extension_loaded('tokenizer'), 'description' => 'PHP tokenizer is required.');
$tests[] = array('title' => 'PDO extension', 'required' => FALSE, 'passed' => $pdo = extension_loaded('pdo') && PDO::getAvailableDrivers(), 'message' => $pdo ? 'Available drivers: ' . implode(' ', PDO::getAvailableDrivers()) : NULL, 'description' => 'PDO extension or PDO drivers are absent. You will not be able to use <code>Nette\\Database</code>.');
$tests[] = array('title' => 'Multibyte String extension', 'required' => FALSE, 'passed' => extension_loaded('mbstring'), 'description' => 'Multibyte String extension is absent. Some internationalization components may not work properly.');
$tests[] = array('title' => 'Multibyte String function overloading', 'required' => TRUE, 'passed' => !extension_loaded('mbstring') || !(mb_get_info('func_overload') & 2), 'message' => 'Disabled', 'errorMessage' => 'Enabled', 'description' => 'Multibyte String function overloading is enabled. Nette Framework requires this to be disabled. If it is enabled, some string function may not work properly.');
$tests[] = array('title' => 'Memcache extension', 'required' => FALSE, 'passed' => extension_loaded('memcache'), 'description' => 'Memcache extension is absent. You will not be able to use <code>Nette\\Caching\\Storages\\MemcachedStorage</code>.');
$tests[] = array('title' => 'GD extension', 'required' => FALSE, 'passed' => extension_loaded('gd'), 'description' => 'GD extension is absent. You will not be able to use <code>Nette\\Image</code>.');
$tests[] = array('title' => 'Bundled GD extension', 'required' => FALSE, 'passed' => extension_loaded('gd') && GD_BUNDLED, 'description' => 'Bundled GD extension is absent. You will not be able to use some functions such as <code>Nette\\Image::filter()</code> or <code>Nette\\Image::rotate()</code>.');
$tests[] = array('title' => 'Fileinfo extension or mime_content_type()', 'required' => FALSE, 'passed' => extension_loaded('fileinfo') || function_exists('mime_content_type'), 'description' => 'Fileinfo extension or function <code>mime_content_type()</code> are absent. You will not be able to determine mime type of uploaded files.');
$tests[] = array('title' => 'HTTP_HOST or SERVER_NAME', 'required' => TRUE, 'passed' => isset($_SERVER["HTTP_HOST"]) || isset($_SERVER["SERVER_NAME"]), 'message' => 'Present', 'errorMessage' => 'Absent', 'description' => 'Either <code>$_SERVER["HTTP_HOST"]</code> or <code>$_SERVER["SERVER_NAME"]</code> must be available for resolving host name.');
示例#4
0
文件: checker.php 项目: xibaachao/1bz
 */
define('CHECKER_VERSION', '1.0');
$tests[] = array('title' => 'Web服务器', 'message' => $_SERVER['SERVER_SOFTWARE']);
$tests[] = array('title' => 'PHP版本', 'required' => TRUE, 'passed' => version_compare(PHP_VERSION, '5.2.0', '>='), 'message' => PHP_VERSION, 'description' => '你的PHP太低了.ThinkPHP框架需要至少PHP 5.2.0或更高.');
$tests[] = array('title' => 'Memory限制', 'message' => ini_get('memory_limit'));
$tests['hf'] = array('title' => '.htaccess文件保护', 'required' => FALSE, 'description' => '通过<code>.htaccess</code>的File保护不支持.你必须小心的放入文件到document_root目录.', 'script' => '<script src="assets/denied/checker.js"></script><script>displayResult("hf", typeof fileProtectionChecker == "undefined")</script>');
$tests['hr'] = array('title' => '.htaccess mod_rewrite', 'required' => FALSE, 'description' => 'Mod_rewrite可能不支持.你将无法使用Cool URL(URL_MODEL=2不启作用,入口文件无法隐藏).', 'script' => '<script src="assets/rewrite/checker"></script><script>displayResult("hr", typeof modRewriteChecker == "boolean")</script>');
$tests[] = array('title' => '函数ini_set()', 'required' => FALSE, 'passed' => function_exists('ini_set'), 'description' => '函数<code>ini_set()</code>不支持.部分ThinkPHP框架功能可能工作不正常.');
$tests[] = array('title' => '函数error_reporting()', 'required' => TRUE, 'passed' => function_exists('error_reporting'), 'description' => '函数<code>error_reporting()</code>不支持. ThinkPHP框架需要这个被启用');
// $tests[] = array(
// 	'title' => 'Function flock()',
// 	'required' => TRUE,
// 	'passed' => flock(fopen(__FILE__, 'r'), LOCK_SH),
// 	'description' => 'Function <code>flock()</code> is not supported on this filesystem. ThinkPHP Framework requires this to process atomic file operations.',
// );
$tests[] = array('title' => 'Register_globals', 'required' => TRUE, 'passed' => iniFlag('register_globals'), 'message' => '启用', 'errorMessage' => '不支持', 'description' => '配置Configuration显示<code>register_globals</code>禁用了. ThinkPHP框架要求此项开启.');
// $tests[] = array(
// 	'title' => 'Variables_order',
// 	'required' => TRUE,
// 	'passed' => strpos(ini_get('variables_order'), 'G') !== FALSE && strpos(ini_get('variables_order'), 'P') !== FALSE && strpos(ini_get('variables_order'), 'C') !== FALSE,
// 	'description' => 'Configuration directive <code>variables_order</code> is missing. ThinkPHP Framework requires this to be set.',
// );
$tests[] = array('title' => 'Session auto-start', 'required' => FALSE, 'passed' => session_id() === '' && !defined('SID'), 'description' => 'Session auto-start启用了. ThinkPHP框架默认情况下,初始化之后系统会自动启动session.');
$tests[] = array('title' => 'Reflection扩展', 'required' => TRUE, 'passed' => class_exists('ReflectionFunction'), 'description' => 'ThinkPHP必须开启Reflection扩展.');
// $tests[] = array(
// 	'title' => 'SPL extension',
// 	'required' => TRUE,
// 	'passed' => extension_loaded('SPL'),
// 	'description' => 'SPL extension is required.',
// );
$tests[] = array('title' => 'PCRE扩展', 'required' => TRUE, 'passed' => extension_loaded('pcre') && @preg_match('/pcre/u', 'pcre'), 'message' => '支持并且工作正常', 'errorMessage' => '禁用或者不支持UTF-8', 'description' => 'PCRE扩展推荐开启并支持UTF-8.');
示例#5
0
文件: checker.php 项目: vlki/nette
 * @copyright  Copyright (c) 2004, 2009 David Grudl
 */
/**
 * Check PHP configuration.
 */
foreach (array('function_exists', 'version_compare', 'extension_loaded', 'ini_get') as $function) {
    if (!function_exists($function)) {
        die("Error: function '{$function}' is required by Nette Framework and this Requirements Checker.");
    }
}
/**
 * Check Nette Framework requirements.
 */
define('CHECKER_VERSION', '1.2');
$reflection = class_exists('ReflectionFunction') && !iniFlag('zend.ze1_compatibility_mode') ? new ReflectionFunction('paint') : NULL;
paint(array(array('title' => 'Web server', 'message' => $_SERVER['SERVER_SOFTWARE']), array('title' => 'PHP version', 'required' => TRUE, 'passed' => version_compare(PHP_VERSION, '5.2.0', '>='), 'message' => PHP_VERSION, 'description' => 'Your PHP version is too old. Nette Framework requires at least PHP 5.2.0 or higher.'), array('title' => 'Memory limit', 'message' => ini_get('memory_limit')), 'ha' => array('title' => '.htaccess file protection', 'required' => FALSE, 'description' => 'File protection by <code>.htaccess</code> is optional. If it is absent, you must be careful to put files into document_root folder.', 'script' => "var el = document.getElementById('resha');\nel.className = typeof checkerScript == 'undefined' ? 'passed' : 'warning';\nel.parentNode.removeChild(el.nextSibling.nodeType === 1 ? el.nextSibling : el.nextSibling.nextSibling);"), array('title' => 'Function ini_set', 'required' => FALSE, 'passed' => function_exists('ini_set'), 'description' => 'Function <code>ini_set()</code> is disabled. Some parts of Nette Framework may not work properly.'), array('title' => 'Magic quotes', 'required' => FALSE, 'passed' => !iniFlag('magic_quotes_gpc') && !iniFlag('magic_quotes_runtime'), 'message' => 'Disabled', 'errorMessage' => 'Enabled', 'description' => 'Magic quotes <code>magic_quotes_gpc</code> and <code>magic_quotes_runtime</code> are enabled and should be turned off. Nette Framework disables <code>magic_quotes_runtime</code> automatically.'), array('title' => 'Register_globals', 'required' => TRUE, 'passed' => !iniFlag('register_globals'), 'message' => 'Disabled', 'errorMessage' => 'Enabled', 'description' => 'Configuration directive <code>register_globals</code> is enabled. Nette Framework requires this to be disabled.'), array('title' => 'Zend.ze1_compatibility_mode', 'required' => TRUE, 'passed' => !iniFlag('zend.ze1_compatibility_mode'), 'message' => 'Disabled', 'errorMessage' => 'Enabled', 'description' => 'Configuration directive <code>zend.ze1_compatibility_mode</code> is enabled. Nette Framework requires this to be disabled.'), array('title' => 'Variables_order', 'required' => TRUE, 'passed' => strpos(ini_get('variables_order'), 'G') !== FALSE && strpos(ini_get('variables_order'), 'P') !== FALSE && strpos(ini_get('variables_order'), 'C') !== FALSE, 'description' => 'Configuration directive <code>variables_order</code> is missing. Nette Framework requires this to be set.'), array('title' => 'Reflection extension', 'required' => TRUE, 'passed' => (bool) $reflection, 'description' => 'Reflection extension is required.'), array('title' => 'Reflection phpDoc', 'required' => FALSE, 'passed' => $reflection ? strpos($reflection->getDocComment(), 'Paints') !== FALSE : FALSE, 'description' => 'Reflection phpDoc are not available (probably due to an eAccelerator bug). Persistent parameters must be declared using static function.'), array('title' => 'SPL extension', 'required' => TRUE, 'passed' => extension_loaded('SPL'), 'description' => 'SPL extension is required.'), array('title' => 'PCRE extension', 'required' => TRUE, 'passed' => extension_loaded('pcre'), 'description' => 'PCRE extension is required.'), array('title' => 'ICONV extension', 'required' => TRUE, 'passed' => extension_loaded('iconv') && ICONV_IMPL !== 'unknown' && @iconv('UTF-16', 'UTF-8//IGNORE', iconv('UTF-8', 'UTF-16//IGNORE', 'test')) === 'test', 'message' => 'Enabled and works properly', 'errorMessage' => 'Disabled or works not properly', 'description' => 'ICONV extension is required and must work properly.'), array('title' => 'Multibyte String extension', 'required' => FALSE, 'passed' => extension_loaded('mbstring'), 'description' => 'Multibyte String extension is absent. Some internationalization components may not work properly.'), array('title' => 'Multibyte String function overloading', 'required' => TRUE, 'passed' => !extension_loaded('mbstring') || !(mb_get_info('func_overload') & 2), 'message' => 'Disabled', 'errorMessage' => 'Enabled', 'description' => 'Multibyte String function overloading is enabled. Nette Framework requires this to be disabled. If it is enabled, some string function may not work properly.'), array('title' => 'Memcache extension', 'required' => FALSE, 'passed' => extension_loaded('memcache'), 'description' => 'Memcache extension is absent. You will not be able to use <code>Nette\\Caching\\MemcachedStorage</code>.'), array('title' => 'GD extension', 'required' => FALSE, 'passed' => extension_loaded('gd'), 'description' => 'GD extension is absent. You will not be able to use <code>Nette\\Image</code>.'), array('title' => 'Bundled GD extension', 'required' => FALSE, 'passed' => extension_loaded('gd') && GD_BUNDLED, 'description' => 'Bundled GD extension is absent. You will not be able to use some function as <code>Nette\\Image::filter()</code> or <code>Nette\\Image::rotate()</code>.'), array('title' => 'ImageMagick library', 'required' => FALSE, 'passed' => @exec('identify -format "%w,%h,%m" ' . addcslashes(dirname(__FILE__) . '/assets/logo.gif', ' ')) === '176,104,GIF', 'description' => 'ImageMagick server library is absent. You will not be able to use <code>Nette\\ImageMagick</code>.'), array('title' => 'Fileinfo extension or mime_content_type()', 'required' => FALSE, 'passed' => extension_loaded('fileinfo') || function_exists('mime_content_type'), 'description' => 'Fileinfo extension or function <code>mime_content_type()</code> are absent. You will not be able to determine mime type of uploaded files.'), array('title' => 'HTTP extension', 'required' => FALSE, 'passed' => !extension_loaded('http'), 'message' => 'Disabled', 'errorMessage' => 'Enabled', 'description' => 'HTTP extension has naming conflict with Nette Framework. You have to disable this extension or use „prefixed“ version.'), array('title' => 'HTTP_HOST or SERVER_NAME', 'required' => TRUE, 'passed' => isset($_SERVER["HTTP_HOST"]) || isset($_SERVER["SERVER_NAME"]), 'message' => 'Present', 'errorMessage' => 'Absent', 'description' => 'Either <code>$_SERVER["HTTP_HOST"]</code> or <code>$_SERVER["SERVER_NAME"]</code> must be available for resolving host name.'), array('title' => 'REQUEST_URI or ORIG_PATH_INFO', 'required' => TRUE, 'passed' => isset($_SERVER["REQUEST_URI"]) || isset($_SERVER["ORIG_PATH_INFO"]), 'message' => 'Present', 'errorMessage' => 'Absent', 'description' => 'Either <code>$_SERVER["REQUEST_URI"]</code> or <code>$_SERVER["ORIG_PATH_INFO"]</code> must be available for resolving request URL.'), array('title' => 'SCRIPT_FILENAME, SCRIPT_NAME, PHP_SELF', 'required' => TRUE, 'passed' => isset($_SERVER["SCRIPT_FILENAME"], $_SERVER["SCRIPT_NAME"], $_SERVER["PHP_SELF"]), 'message' => 'Present', 'errorMessage' => 'Absent', 'description' => '<code>$_SERVER["SCRIPT_FILENAME"]</code> and <code>$_SERVER["SCRIPT_NAME"]</code> and <code>$_SERVER["PHP_SELF"]</code> must be available for resolving script file path.'), array('title' => 'SERVER_ADDR or LOCAL_ADDR', 'required' => TRUE, 'passed' => isset($_SERVER["SERVER_ADDR"]) || isset($_SERVER["LOCAL_ADDR"]), 'message' => 'Present', 'errorMessage' => 'Absent', 'description' => '<code>$_SERVER["SERVER_ADDR"]</code> or <code>$_SERVER["LOCAL_ADDR"]</code> must be available for detecting development / production mode.')));
/**
 * Paints checker.
 * @param  array
 * @return void
 */
function paint($requirements)
{
    $redirect = round(time(), -1);
    if (!isset($_GET) || isset($_GET['r']) && $_GET['r'] == $redirect) {
        $redirect = NULL;
    }
    $errors = $warnings = FALSE;
    foreach ($requirements as $id => $requirement) {
        $requirements[$id] = $requirement = (object) $requirement;
        if (isset($requirement->passed) && !$requirement->passed) {
示例#6
0
文件: checker.php 项目: vrana/nette
/**
 * Check PHP configuration.
 */
foreach (array('function_exists', 'version_compare', 'extension_loaded', 'ini_get') as $function) {
    if (!function_exists($function)) {
        die("Error: function '{$function}' is required by Nette Framework and this Requirements Checker.");
    }
}
/**
 * Check Nette Framework requirements.
 */
define('CHECKER_VERSION', '1.1');
define('REQUIRED', TRUE);
define('OPTIONAL', FALSE);
$reflection = class_exists('ReflectionFunction') && !iniFlag('zend.ze1_compatibility_mode') ? new ReflectionFunction('paint') : NULL;
paint(array(array('PHP version', REQUIRED, version_compare(PHP_VERSION, '5.2.0', '>='), 'PHP version 5.2.0 or higher is required by Nette Framework.'), array('Function ini_set', OPTIONAL, function_exists('ini_set'), 'Function ini_set() is optional. If it is absent, some parts of framework may not work properly.'), array('Reflection extension', REQUIRED, (bool) $reflection, 'Reflection extension is required.'), array('Reflection phpDoc', OPTIONAL, $reflection ? strpos($reflection->getDocComment(), 'Paints') !== FALSE : FALSE, 'Reflection phpDoc is optional. If it is absent, persistent parameters must be declared using static function.'), array('SPL extension', REQUIRED, extension_loaded('SPL'), 'SPL extension is required.'), array('PCRE extension', REQUIRED, extension_loaded('pcre'), 'PCRE extension is required.'), array('ICONV extension', REQUIRED, extension_loaded('iconv') && ICONV_IMPL !== 'unknown' && @iconv('UTF-16', 'UTF-8//IGNORE', iconv('UTF-8', 'UTF-16//IGNORE', 'test')) === 'test', 'ICONV extension is required and must work properly.'), array('$_SERVER["HTTP_HOST"] or "SERVER_NAME"', REQUIRED, isset($_SERVER["HTTP_HOST"]) || isset($_SERVER["SERVER_NAME"]), 'Either $_SERVER["HTTP_HOST"] or $_SERVER["SERVER_NAME"] must be available for resolving host name.'), array('$_SERVER["REQUEST_URI"] or "ORIG_PATH_INFO"', REQUIRED, isset($_SERVER["REQUEST_URI"]) || isset($_SERVER["ORIG_PATH_INFO"]), 'Either $_SERVER["REQUEST_URI"] or $_SERVER["ORIG_PATH_INFO"] must be available for resolving request URL.'), array('$_SERVER["SCRIPT_FILENAME"] and "SCRIPT_NAME" and "PHP_SELF"', REQUIRED, isset($_SERVER["SCRIPT_FILENAME"], $_SERVER["SCRIPT_NAME"], $_SERVER["PHP_SELF"]), '$_SERVER["SCRIPT_FILENAME"] and $_SERVER["SCRIPT_NAME"] and $_SERVER["PHP_SELF"] must be available for resolving script file path.'), array('$_SERVER["SERVER_ADDR"] or "LOCAL_ADDR"', REQUIRED, isset($_SERVER["SERVER_ADDR"]) || isset($_SERVER["LOCAL_ADDR"]), '$_SERVER["SERVER_ADDR"] or $_SERVER["LOCAL_ADDR"] must be available for detecting development/production mode.'), 'ha' => array('.htaccess file protection', OPTIONAL, NULL, 'File protection by .htaccess is optional. If it is absent, you must be careful to put files into document_root folder.', '<script>var el = document.getElementById("resha").getElementsByTagName("td").item(0); el.className = el.innerHTML = typeof checkerScript == "undefined" ? "passed" : "warning";</script>'), array('Multibyte String extension', OPTIONAL, extension_loaded('mbstring'), 'Multibyte String extension is optional. If it is absent, some internationalization components may not work properly.'), array('Multibyte String function overloading off', REQUIRED, !extension_loaded('mbstring') || !(mb_get_info('func_overload') & 2), 'Multibyte String function overloading must be turned off. If it is enabled, some string function may not work properly.'), array('Magic quotes off', OPTIONAL, !iniFlag('magic_quotes_gpc') && !iniFlag('magic_quotes_runtime'), 'Magic quotes "magic_quotes_gpc" & "magic_quotes_runtime" should be turned off. Framework disables magic_quotes_runtime automatically.'), array('Register_globals off', OPTIONAL, !iniFlag('register_globals'), 'Register_globals should be turned off.'), array('Zend.ze1_compatibility_mode off', REQUIRED, !iniFlag('zend.ze1_compatibility_mode'), 'zend.ze1_compatibility_mode must be turned off.'), array('Variables_order', REQUIRED, strpos(ini_get('variables_order'), 'G') !== FALSE && strpos(ini_get('variables_order'), 'P') !== FALSE && strpos(ini_get('variables_order'), 'C') !== FALSE, 'Variables_order is required.'), array('Memcache extension', OPTIONAL, extension_loaded('memcache'), 'Memcache extension is optional. If it is absent, you will not be able to use Nette\\Caching\\MemcachedStorage.'), array('GD extension', OPTIONAL, extension_loaded('gd'), 'GD extension is optional. If it is absent, you will not be able to use Nette\\Image.'), array('Bundled GD extension', OPTIONAL, extension_loaded('gd') && GD_BUNDLED, 'Bundled GD extension is optional. If it is absent, you will not be able to use some function as Nette\\Image::filter() or Nette\\Image::rotate().'), array('ImageMagick library', OPTIONAL, @exec('identify -format "%w,%h,%m" ' . addcslashes(dirname(__FILE__) . '/assets/checker.gif', ' ')) === '176,104,GIF', 'ImageMagick server library is optional. If it is absent, you will not be able to use Nette\\ImageMagick.'), array('Fileinfo extension or function mime_content_type', OPTIONAL, extension_loaded('fileinfo') || function_exists('mime_content_type'), 'Fileinfo extension or function mime_content_type are optional. If they are absent, you will not be able to determine mime type of uploaded files.'), array('Disabled HTTP extension', OPTIONAL, !extension_loaded('http'), 'HTTP extension has naming conflict with Nette Framework. If it is present, you will have to use Prefixed version.')));
/**
 * Paints checker.
 * @param  array
 * @return void
 */
function paint($requirements)
{
    $redirect = round(time(), -1);
    if (!isset($_GET) || isset($_GET['r']) && $_GET['r'] == $redirect) {
        $redirect = NULL;
    }
    $errors = array(REQUIRED => 0, OPTIONAL => 0);
    foreach ($requirements as $requirement) {
        list(, $required, $result) = $requirement;
        if (isset($result) && !$result) {
示例#7
0
$tests[] = array('title' => __('Режим совместимости Zend.ze1_compatibility_mode'), 'required' => TRUE, 'passed' => !iniFlag('zend.ze1_compatibility_mode'), 'message' => __('Отключено'), 'errorMessage' => __('Включено'), 'description' => 'Configuration directive <code>zend.ze1_compatibility_mode</code> is enabled. Nette Framework requires this to be disabled.');
$tests[] = array('title' => __('Порядок обработки переменных'), 'required' => TRUE, 'passed' => strpos(ini_get('variables_order'), 'G') !== FALSE && strpos(ini_get('variables_order'), 'P') !== FALSE && strpos(ini_get('variables_order'), 'C') !== FALSE, 'description' => __('Конфигурация <code>variables_order</code> не подходит.'));
$tests[] = array('title' => __('Автостарт сессий'), 'required' => TRUE, 'passed' => session_id() === '' && !defined('SID'), 'message' => __('Отключено'), 'errorMessage' => __('Включено'), 'description' => 'Включен автостарт сессий. Joostina CMS умеет сама более оптимально работать с сессиями.');
$tests[] = array('title' => __('Расширение PCRE'), 'required' => TRUE, 'passed' => extension_loaded('pcre') && @preg_match('/pcre/u', 'pcre'), 'message' => 'Доступно и проверено', 'errorMessage' => __('Отключено, либо не поддерживает UTF-8'), 'description' => __('Расширение PCRE должно быть доступно и поддерживать UTF-8.'));
/*
 $tests[] = array(
 'title' => 'PDO extension',
 'required' => FALSE,
 'passed' => $pdo = extension_loaded('pdo') && PDO::getAvailableDrivers(),
 'message' => $pdo ? 'Available drivers: ' . implode(' ', PDO::getAvailableDrivers()) : NULL,
 'description' => 'PDO extension or PDO drivers are absent. You will not be able to use <code>Nette\Database</code>.',
 );
*/
$tests[] = array('title' => __('Поддержка mbstring'), 'required' => FALSE, 'passed' => extension_loaded('mbstring'), 'description' => __('Поддержка mbstring является ключевым местом работы системы.'));
$tests[] = array('title' => __('Переопределение системных функций через mbstring'), 'required' => TRUE, 'passed' => !extension_loaded('mbstring') || !(mb_get_info('func_overload') & 2), 'message' => __('Выключено'), 'errorMessage' => __('Включено'), 'description' => __('Активно переопределение системных функций. Для нормальной работы переопределение должно быть выключенно.'));
$tests[] = array('title' => __('Магические кавычки (Magic Quotes)'), 'required' => FALSE, 'passed' => !iniFlag('magic_quotes_gpc') && !iniFlag('magic_quotes_runtime'), 'message' => __('Отключено'), 'errorMessage' => __('Включено'), 'description' => __('Магический ковычки <code>magic_quotes_gpc</code> и <code>magic_quotes_runtime</code> активны. Это функции не рекомендуются, Joostina CMS будет их отключать.'));
$tests[] = array('title' => __('Расширение для кеширования Memcache'), 'required' => FALSE, 'passed' => extension_loaded('memcache'), 'description' => __('Максимально быстро система работает используя кеширование Memcache.'));
$tests[] = array('title' => __('Работа с графикой GD '), 'required' => TRUE, 'passed' => extension_loaded('gd'), 'description' => __('Системе необходима поддержка работы с изображениями.'));
$tests[] = array('title' => __('Дополнительные фильтры графики GD'), 'required' => FALSE, 'passed' => extension_loaded('gd') && GD_BUNDLED, 'description' => __('Часть функций работы с изображениями будет недоступна.'));
$tests[] = array('title' => __('Расширение Fileinfo или mime_content_type()'), 'required' => FALSE, 'passed' => extension_loaded('fileinfo') || function_exists('mime_content_type'), 'description' => __('Эти расширения необходимы для оптимлаьной работы с типами файлов и данными о них.'));
$tests[] = array('title' => __('Параметры HTTP_HOST или SERVER_NAME'), 'required' => TRUE, 'passed' => isset($_SERVER["HTTP_HOST"]) || isset($_SERVER["SERVER_NAME"]), 'message' => __('Present'), 'errorMessage' => __('Absent'), 'description' => __('Either <code>$_SERVER["HTTP_HOST"]</code> or <code>$_SERVER["SERVER_NAME"]</code> must be available for resolving host name.'));
$tests[] = array('title' => __('Параметры REQUEST_URI или ORIG_PATH_INFO'), 'required' => TRUE, 'passed' => isset($_SERVER["REQUEST_URI"]) || isset($_SERVER["ORIG_PATH_INFO"]), 'message' => __('Present'), 'errorMessage' => __('Absent'), 'description' => __('Either <code>$_SERVER["REQUEST_URI"]</code> or <code>$_SERVER["ORIG_PATH_INFO"]</code> must be available for resolving request URL.'));
$tests[] = array('title' => __('Параметры SCRIPT_FILENAME, SCRIPT_NAME, PHP_SELF'), 'required' => TRUE, 'passed' => isset($_SERVER["SCRIPT_FILENAME"], $_SERVER["SCRIPT_NAME"], $_SERVER["PHP_SELF"]), 'message' => __('Present'), 'errorMessage' => __('Absent'), 'description' => __('<code>$_SERVER["SCRIPT_FILENAME"]</code> and <code>$_SERVER["SCRIPT_NAME"]</code> and <code>$_SERVER["PHP_SELF"]</code> must be available for resolving script file path.'));
$tests[] = array('title' => __('Параметры SERVER_ADDR или LOCAL_ADDR'), 'required' => TRUE, 'passed' => isset($_SERVER["SERVER_ADDR"]) || isset($_SERVER["LOCAL_ADDR"]), 'message' => __('Present'), 'errorMessage' => __('Absent'), 'description' => __('<code>$_SERVER["SERVER_ADDR"]</code> or <code>$_SERVER["LOCAL_ADDR"]</code> must be available for detecting development / production mode.'));
paint($tests);
/**
 * Paints checker.
 *
 * @param  array
 *
 * @return void