function test_body() { echo "<div id=\"container\">\n"; // phpInfo(); echo "<pre>\n"; print_r(mb_get_info()); //print_r( get_defined_functions() ); //$a = hash_algos(); //print_r( $a ); //global $nav_msg; //global $nav_pages; //global $nav_modules; //global $nav_menu; //echo "\nSERVER: ";print_r($_SERVER); //echo "ENV: ";print_r($_ENV); //echo "FILES: ";print_r ( $_FILES ); //echo "REQUEST: ";print_r ( $_REQUEST ); //echo "GET: ";print_r ( $_GET ); //echo "nav_msg: ";print_r ( $nav_msg ); //echo "nav_pages: ";print_r ( $nav_pages ); //echo "nav_modules: ";print_r ( $nav_modules ); //echo "nav_menu: ";print_r ( $nav_menu ); echo "</pre>\n"; echo "</div>\n"; }
function testMbStringSetup() { $setup = mb_get_info(); $this->assertSame($setup['http_output'], 'pass'); if (isset($setup['encoding_translation'])) { $this->assertSame($setup['encoding_translation'], 'Off'); } }
/** * @return Mail **/ public function send() { if ($this->to == null) { throw new WrongArgumentException("mail to: is not specified"); } $siteEncoding = mb_get_info('internal_encoding'); if (!$this->encoding || $this->encoding == $siteEncoding) { $encoding = $siteEncoding; $to = $this->to; $from = $this->from; $subject = "=?" . $encoding . "?B?" . base64_encode($this->subject) . "?="; $body = $this->text; $returnPath = $this->returnPath; } else { $encoding = $this->encoding; $to = mb_convert_encoding($this->to, $encoding); if ($this->from) { $from = mb_convert_encoding($this->from, $encoding); } else { $from = null; } if ($this->returnPath) { $returnPath = mb_convert_encoding($this->returnPath, $encoding); } else { $returnPath = null; } $subject = "=?" . $encoding . "?B?" . base64_encode(iconv($siteEncoding, $encoding . '//TRANSLIT', $this->subject)) . "?="; $body = iconv($siteEncoding, $encoding . '//TRANSLIT', $this->text); } $headers = null; $returnPathAtom = $returnPath !== null ? $returnPath : $from; if ($from != null) { $headers .= "From: " . $from . "\n"; $headers .= "Return-Path: " . $returnPathAtom . "\n"; } if ($this->cc != null) { $headers .= "Cc: " . $this->cc . "\n"; } if (!$this->getHeaders()) { if ($this->contentType === null) { $this->contentType = 'text/plain'; } $headers .= "Content-type: " . $this->contentType . "; charset=" . $encoding . "\n"; $headers .= "Content-Transfer-Encoding: 8bit\n"; $headers .= "Date: " . date('r') . "\n"; } else { $headers .= $this->getHeaders(); } if (!mail($to, $subject, $body, $headers, $this->getSendmailAdditionalArgs())) { throw new MailNotSentException(); } return $this; }
<?php header('Content-type:text/html;charset=utf-8'); $str = '@#$!jiang123江河'; echo '测试"' . $str . '"的长度'; echo '<br>PHP strlen长度函数:' . strlen($str); echo '<br>PHP mb_strlen长度函数:' . mb_strlen($str, 'utf-8'); echo '<pre>'; print_r(mb_get_info());
$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>.'); $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.'); $tests[] = 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.'); $tests[] = array('title' => 'SCRIPT_NAME or DOCUMENT_ROOT & SCRIPT_FILENAME', 'required' => TRUE, 'passed' => isset($_SERVER['SCRIPT_NAME']) || isset($_SERVER['DOCUMENT_ROOT'], $_SERVER['SCRIPT_FILENAME']), 'message' => 'Present', 'errorMessage' => 'Absent', 'description' => '<code>$_SERVER["SCRIPT_NAME"]</code> or <code>$_SERVER["DOCUMENT_ROOT"]</code> with <code>$_SERVER["SCRIPT_FILENAME"]</code> must be available for resolving script file path.'); $tests[] = array('title' => 'REMOTE_ADDR or php_uname("n")', 'required' => TRUE, 'passed' => isset($_SERVER['REMOTE_ADDR']) || function_exists('php_uname'), 'message' => 'Present', 'errorMessage' => 'Absent', 'description' => '<code>$_SERVER["REMOTE_ADDR"]</code> or <code>php_uname("n")</code> must be available for detecting development / production mode.'); paint($tests); /** * Paints checker. * @param array * @return void */ function paint($requirements)
// '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.'); $tests[] = array('title' => 'ICONV扩展', 'required' => TRUE, 'passed' => extension_loaded('iconv') && ICONV_IMPL !== 'unknown' && @iconv('UTF-16', 'UTF-8//IGNORE', iconv('UTF-8', 'UTF-16//IGNORE', 'test')) === 'test', 'message' => '支持并且工作正常', 'errorMessage' => '禁用或者工作不正常', 'description' => 'ICONV扩展必须且工作正常.'); // $tests[] = array( // 'title' => 'PHP tokenizer', // 'required' => TRUE, // 'passed' => extension_loaded('tokenizer'), // 'description' => 'PHP tokenizer is required.', // ); $tests[] = array('title' => 'PDO扩展', 'required' => FALSE, 'passed' => $pdo = extension_loaded('pdo') && PDO::getAvailableDrivers(), 'message' => $pdo ? '可用驱动有drivers: ' . implode(' ', PDO::getAvailableDrivers()) : NULL, 'description' => 'PDO扩展或者PDO驱动不支持.你将不能使用<code>ThinkPHP\\DbPdo</code>.'); $tests[] = array('title' => '多字节字符串扩展', 'required' => FALSE, 'passed' => extension_loaded('mbstring'), 'description' => 'Multibyte String扩展不支持.一些国际化组件可能无法正常工作.'); $tests[] = array('title' => '多字节字符串overloading函数', 'required' => TRUE, 'passed' => !extension_loaded('mbstring') || !(mb_get_info('func_overload') & 2), 'message' => '禁用', 'errorMessage' => '启用', 'description' => '启用了多字节字符串重载函数. ThinkPHP框架要求这项被禁用.如果它开启着,一些字符串函数将可能工作不正常.'); $tests[] = array('title' => 'Memcache扩展', 'required' => FALSE, 'passed' => extension_loaded('memcache'), 'description' => 'Memcache扩展不支持.你将不能使用<code>Memcache作为ThinkPHP的缓存方式</code>.'); $tests[] = array('title' => 'GD扩展', 'required' => TRUE, 'passed' => extension_loaded('gd'), 'description' => 'GD扩展不支持. 你将不能使用<code>ThinkPHP\\Image</code>类.'); $tests[] = array('title' => 'Imagick扩展', 'required' => FALSE, 'passed' => extension_loaded('imagick'), 'description' => 'Imagick扩展不支持. 你将不能使用Imagick进行高效图像处理.'); // $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>ThinkPHP\Image::filter()</code> or <code>ThinkPHP\Image::rotate()</code>.', // ); $tests[] = array('title' => 'Fileinfo扩展 或 mime_content_type()', 'required' => FALSE, 'passed' => extension_loaded('fileinfo') || function_exists('mime_content_type'), 'description' => 'Fileinfo 扩展或者 函数<code>mime_content_type()</code> 不支持.你将不能检测上传文件的mime类型.'); // $tests[] = array( // 'title' => 'HTTP_HOST or SERVER_NAME', // 'required' => TRUE, // 'passed' => isset($_SERVER["HTTP_HOST"]) || isset($_SERVER["SERVER_NAME"]), // 'message' => 'Present',
public function info($string = 'all') { if (!is_string($string)) { return Error::set('Error', 'stringParameter', '1.(string)'); } return mb_get_info($string); }
public function info(string $string = 'all') { return mb_get_info($string); }
* @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) {
$tests[] = array('title' => __('Регистрация глобальных переменных'), 'required' => TRUE, 'passed' => !iniFlag('register_globals'), 'message' => __('Отключено'), 'errorMessage' => __('Включено'), 'description' => __('Параметр <code>register_globals</code> в положении включено. Для нормальной и бозопасной работы регистрацию глоабльных переменных необходимо отключить')); $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 *
<?php $str = "PrÜÝ" . "fung"; /* Set detection order by enumerated list */ mb_detect_order("eucjp-win,sjis-win,UTF-8"); var_dump(mb_detect_encoding($str)); mb_detect_order("eucjp-win,UTF-8,sjis-win"); var_dump(mb_detect_encoding($str)); /* Set detection order by array */ mb_detect_order(array("eucjp-win", "sjis-win", "UTF-8")); var_dump(mb_detect_encoding($str)); mb_detect_order(array("eucjp-win", "UTF-8", "sjis-win")); var_dump(mb_detect_encoding($str)); /* Display current detection order */ var_dump(implode(", ", mb_detect_order())); var_dump(!empty(mb_get_info()['detect_order'])); var_dump(!empty(mb_get_info('all')['detect_order']));
/** * Funkce pro kontrolu splnění konfiguračních požadavků Nette * @return array */ private static function getNetteRequirementsResultsArr() { $phpMinVersion = self::getPhpMinVersion(); $tests = []; $tests[] = ['title' => 'PHP version', 'type' => self::TEST_TYPE_ENVIRONMENT, 'required' => true, 'passed' => self::checkPhpMinVersion($phpMinVersion), 'message' => $phpMinVersion, 'description' => 'Your PHP version is too old. Nette Framework requires at least PHP ' . $phpMinVersion . ' or higher.']; #region functions $tests[] = ['title' => 'Function ini_set()', 'type' => self::TEST_TYPE_FUNCTIONS, 'required' => false, 'passed' => function_exists('ini_set'), 'message' => 'Allowed', 'errorMessage' => 'Disabled', 'description' => 'Function <code>ini_set()</code> is disabled. Some parts of this application may not work properly!']; $tests[] = ['title' => 'Function error_reporting()', 'type' => self::TEST_TYPE_FUNCTIONS, 'required' => true, 'passed' => function_exists('error_reporting'), 'description' => 'Function <code>error_reporting()</code> is disabled. This function has to be enabled.']; $tests[] = ['title' => 'Function flock()', 'type' => self::TEST_TYPE_FUNCTIONS, 'required' => true, 'passed' => flock(fopen(__FILE__, 'r'), LOCK_SH), 'description' => 'Function <code>flock()</code> is not supported on this filesystem. This function is required for processing of atomic file operations.']; $tests[] = ['title' => 'Function fsockopen()', 'type' => self::TEST_TYPE_FUNCTIONS, 'required' => true, 'passed' => function_exists('fsockopen'), 'description' => 'Function <code>fsockopen()</code> is not supported on this filesystem. This function is required for data-mining process.']; #endregion functions #region environment $tests[] = ['title' => 'Register_globals', 'type' => self::TEST_TYPE_ENVIRONMENT, 'required' => true, 'passed' => !self::getIniFlag('register_globals'), 'message' => 'Disabled', 'errorMessage' => 'Enabled', 'description' => 'Configuration directive <code>register_globals</code> is enabled. EasyMinerCenter requires this to be disabled.']; $tests[] = ['title' => 'Variables_order', 'type' => self::TEST_TYPE_ENVIRONMENT, '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. It has to be set.']; $reflection = new \ReflectionClass(__CLASS__); $tests[] = ['title' => 'Reflection phpDoc', 'type' => self::TEST_TYPE_ENVIRONMENT, 'required' => true, 'passed' => strpos($reflection->getDocComment(), 'PhpConfigManager') !== FALSE, 'description' => 'Reflection phpDoc are not available (probably due to an eAccelerator bug). This function is required!']; #endregion environment #region extensions $tests[] = ['title' => 'PCRE with UTF-8 support', 'type' => self::TEST_TYPE_EXTENSIONS, 'required' => true, 'passed' => @preg_match('/pcre/u', 'pcre'), 'description' => 'PCRE extension must support UTF-8.']; $tests[] = ['title' => 'ICONV extension', 'type' => self::TEST_TYPE_EXTENSIONS, '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[] = ['title' => 'JSON extension', 'type' => self::TEST_TYPE_EXTENSIONS, 'required' => true, 'passed' => extension_loaded('json'), 'description' => 'JSON extension is required.']; $tests[] = ['title' => 'PHP tokenizer', 'type' => self::TEST_TYPE_EXTENSIONS, 'required' => true, 'passed' => extension_loaded('tokenizer'), 'description' => 'PHP tokenizer is required.']; $pdo = extension_loaded('pdo') && \PDO::getAvailableDrivers(); $mysqlPdoAllowed = false; if ($pdo) { $driversArr = \PDO::getAvailableDrivers(); if (!empty($driversArr)) { foreach ($driversArr as $driver) { $driver = strtolower($driver); if ($driver == "mysql" || $driver == "mysqli") { $mysqlPdoAllowed = true; break; } } } } $tests[] = ['title' => 'PDO extension', 'type' => self::TEST_TYPE_EXTENSIONS, 'required' => true, 'passed' => $pdo && $mysqlPdoAllowed, 'message' => $pdo ? 'Available drivers: ' . implode(' ', \PDO::getAvailableDrivers()) : null, 'description' => 'PDO extension or PDO drivers are absent or MySQL driver is not configured.']; $tests[] = ['title' => 'Multibyte String extension', 'type' => self::TEST_TYPE_EXTENSIONS, 'required' => true, 'passed' => extension_loaded('mbstring'), 'description' => 'Multibyte String extension is required.']; $tests[] = ['title' => 'MCrypt extension', 'type' => self::TEST_TYPE_EXTENSIONS, 'required' => true, 'passed' => extension_loaded('mcrypt') && function_exists('mcrypt_get_iv_size'), 'description' => 'MCrypt extension is required.']; /* $tests[] = [ 'title' => 'Internalization (INTL) extension', 'type' => self::TEST_TYPE_EXTENSIONS, 'required' => true, 'passed' => extension_loaded('intl'), 'description' => 'INTL extension is required.', ];*/ $tests[] = ['title' => 'Multibyte String function overloading', 'type' => self::TEST_TYPE_EXTENSIONS, 'required' => true, 'passed' => !extension_loaded('mbstring') || !(mb_get_info('func_overload') & 2), 'message' => 'Disabled', 'errorMessage' => 'Enabled', 'description' => 'Multibyte String function overloading is enabled. If it is enabled, some string function may not work properly.']; #endregion extensions /* AKTUÁLNĚ NEPOUŽÍVANÉ KONTROLY (funkce, které aplikace aktuálně nepoužívá) $tests[] = [ 'title' => 'Memcache extension', 'type'=>self::TEST_TYPE_EXTENSIONS, '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[] = [ 'title' => 'GD extension', 'type'=>self::TEST_TYPE_EXTENSIONS, 'required' => FALSE, 'passed' => extension_loaded('gd'), 'description' => 'GD extension is absent. You will not be able to use <code>Nette\Image</code>.', ]; $tests[] = [ 'title' => 'Bundled GD extension', 'type'=>self::TEST_TYPE_EXTENSIONS, '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', 'type'=>self::TEST_TYPE_EXTENSIONS, 'required' => FALSE, 'passed' => extension_loaded('fileinfo'), 'description' => 'Fileinfo extension is absent.', ); $tests[] = array( 'title' => 'Fileinfo extension or mime_content_type()', 'type'=>self::TEST_TYPE_EXTENSIONS, '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.', );*/ #region variables $tests[] = ['title' => 'HTTP_HOST or SERVER_NAME', 'type' => self::TEST_TYPE_VARIABLES, '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[] = ['title' => 'REQUEST_URI or ORIG_PATH_INFO', 'type' => self::TEST_TYPE_VARIABLES, '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[] = ['title' => 'SCRIPT_NAME or DOCUMENT_ROOT & SCRIPT_FILENAME', 'type' => self::TEST_TYPE_VARIABLES, 'required' => true, 'passed' => isset($_SERVER['SCRIPT_NAME']) || isset($_SERVER['DOCUMENT_ROOT'], $_SERVER['SCRIPT_FILENAME']), 'message' => 'Present', 'errorMessage' => 'Absent', 'description' => '<code>$_SERVER["SCRIPT_NAME"]</code> or <code>$_SERVER["DOCUMENT_ROOT"]</code> with <code>$_SERVER["SCRIPT_FILENAME"]</code> must be available for resolving script file path.']; $tests[] = ['title' => 'REMOTE_ADDR or php_uname("n")', 'type' => self::TEST_TYPE_VARIABLES, 'required' => true, 'passed' => isset($_SERVER['REMOTE_ADDR']) || function_exists('php_uname'), 'message' => 'Present', 'errorMessage' => 'Absent', 'description' => '<code>$_SERVER["REMOTE_ADDR"]</code> or <code>php_uname("n")</code> must be available for detecting development / production mode.']; #endregion variables return $tests; }
</div> <?php } else { ?> <div class="alert alert-warning" role="alert"> Mcrypt PHP extension not available. </div> <?php } ?> </div> <div class="row"> <h3>Mbstring PHP Extension</h3> <?php if ($mbstring = mb_get_info('internal_encoding')) { ?> <div class="alert alert-success" role="alert"> Mbstring PHP extension available with internal encoding set to <?php echo $mbstring; ?> </div> <?php } else { ?> <div class="alert alert-warning" role="alert"> Mbstring PHP extension not available. </div> <?php } ?>
public function __construct() { if (defined('PCRE_VERSION') && PCRE_VERSION == 8.34 && PHP_VERSION_ID < 50513) { trigger_error('Texy: PCRE 8.34 is not supported due to bug #1451', E_USER_WARNING); } if (extension_loaded('mbstring') && mb_get_info('func_overload') & 2 && substr(mb_get_info('internal_encoding'), 0, 1) === 'U') { mb_internal_encoding('pass'); trigger_error("Texy: mb_internal_encoding changed to 'pass'", E_USER_WARNING); } // load all modules $this->loadModules(); // DEPRECATED if (self::$strictDTD !== NULL) { $this->setOutputMode(self::$strictDTD ? self::XHTML1_STRICT : self::XHTML1_TRANSITIONAL); } else { $this->setOutputMode(self::XHTML1_TRANSITIONAL); } // DEPRECATED $this->cleaner =& $this->htmlOutputModule; // examples of link references ;-) $link = new Link('http://texy.info/'); $link->modifier->title = 'The best text -> HTML converter and formatter'; $link->label = 'Texy!'; $this->linkModule->addReference('texy', $link); $link = new Link('https://www.google.com/search?q=%s'); $this->linkModule->addReference('google', $link); $link = new Link('https://en.wikipedia.org/wiki/Special:Search?search=%s'); $this->linkModule->addReference('wikipedia', $link); }
function admin_dispatchAction($action) { if ($action == 'general') { showInterface('admin/general.php'); } elseif ($action == 'adminSave') { admin_saveSettings('admin/general.php'); } elseif ($action == 'vendor') { showInterface('admin/vendor.php'); } elseif ($action == 'vendorSave') { admin_saveSettings('admin/vendor.php'); } elseif ($action == 'phpinfo') { disableInDemoMode('', 'admin/general.php'); phpinfo(); print "<h2>get_loaded_extensions()</h2>\n" . implode("<br/>\n", get_loaded_extensions()) . "\n"; if (function_exists('apache_get_modules')) { print "<h2>apache_get_modules()</h2>\n" . implode("<br/>\n", apache_get_modules()) . "\n"; } print "<h2>get_defined_constants()</h2>\n<xmp>" . print_r(get_defined_constants(), true) . "</xmp>\n"; // $mbInfo = mb_get_info(); ksort($mbInfo); print "<h2>mb_get_info()</h2>\n<xmp>" . print_r($mbInfo, true) . "</xmp>\n"; exit; } elseif ($action == 'ulimit') { disableInDemoMode('', 'admin/general.php'); print "<h2>Soft Resource Limits (ulimit -a -S)</h2>\n"; list($maxCpuSeconds, $memoryLimitKbytes, $maxProcessLimit, $ulimitOutput) = getUlimitValues('soft'); showme($ulimitOutput); print "<h2>Hard Resource Limits (ulimit -a -H)</h2>\n"; list($maxCpuSeconds, $memoryLimitKbytes, $maxProcessLimit, $ulimitOutput) = getUlimitValues('soft'); showme($ulimitOutput); exit; } elseif ($action == 'updateDate') { getAjaxDate(); } elseif ($action == 'getUploadPathPreview') { getUploadPathPreview(@$_REQUEST['dirOrUrl'], @$_REQUEST['inputValue'], @$_REQUEST['isCustomField'], true); } elseif ($action == 'plugins') { // allow disabling plugins if (file_exists("{$GLOBALS['PROGRAM_DIR']}/plugins/_disable_all_plugins.txt")) { alert('Development Mode: Plugins are disabled. Remove or rename /plugins/_disable_all_plugins.txt to enable.<br/>'); } else { } showInterface('admin/plugins.php'); } elseif ($action == 'pluginHooks') { showInterface('admin/pluginHooks.php'); } elseif ($action == 'deactivatePlugin') { security_dieUnlessPostForm(); security_dieUnlessInternalReferer(); security_dieOnInvalidCsrfToken(); disableInDemoMode('plugins', 'admin/plugins.php'); deactivatePlugin(@$_REQUEST['file']); redirectBrowserToURL('?menu=admin&action=plugins', true); exit; } elseif ($action == 'activatePlugin') { security_dieUnlessPostForm(); security_dieUnlessInternalReferer(); security_dieOnInvalidCsrfToken(); disableInDemoMode('plugins', 'admin/plugins.php'); activatePlugin(@$_REQUEST['file']); redirectBrowserToURL('?menu=admin&action=plugins', true); exit; } elseif ($action == 'backup') { security_dieUnlessPostForm(); security_dieUnlessInternalReferer(); security_dieOnInvalidCsrfToken(); disableInDemoMode('', 'admin/general.php'); $filename = backupDatabase(null, @$_REQUEST['backupTable']); notice(sprintf(t('Created backup file %1$s (%2$s seconds)'), $filename, showExecuteSeconds(true))); showInterface('admin/general.php'); exit; } elseif ($action == 'restore') { security_dieUnlessPostForm(); security_dieUnlessInternalReferer(); security_dieOnInvalidCsrfToken(); disableInDemoMode('', 'admin/general.php'); $filename = @$_REQUEST['file']; restoreDatabase(DATA_DIR . '/backups/' . $filename); notice("Restored backup file /data/backups/{$filename}"); makeAllUploadRecordsRelative(); showInterface('admin/general.php'); exit; } elseif ($action == 'bgtasksLogsClear') { security_dieUnlessPostForm(); security_dieUnlessInternalReferer(); security_dieOnInvalidCsrfToken(); disableInDemoMode('', 'admin/general.php'); mysql_delete('_cron_log', null, 'true'); notice(t("Background Task logs have been cleared.")); showInterface('admin/general.php'); exit; } else { showInterface('admin/general.php'); } }
/** * Format debugging information */ public static function debug(&$sp) { $info = 'SimplePie ' . SIMPLEPIE_VERSION . ' Build ' . SIMPLEPIE_BUILD . "\n"; $info .= 'PHP ' . PHP_VERSION . "\n"; if ($sp->error() !== null) { $info .= 'Error occurred: ' . $sp->error() . "\n"; } else { $info .= "No error found.\n"; } $info .= "Extensions:\n"; $extensions = array('pcre', 'curl', 'zlib', 'mbstring', 'iconv', 'xmlreader', 'xml'); foreach ($extensions as $ext) { if (extension_loaded($ext)) { $info .= " {$ext} loaded\n"; switch ($ext) { case 'pcre': $info .= ' Version ' . PCRE_VERSION . "\n"; break; case 'curl': $version = curl_version(); $info .= ' Version ' . $version['version'] . "\n"; break; case 'mbstring': $info .= ' Overloading: ' . mb_get_info('func_overload') . "\n"; break; case 'iconv': $info .= ' Version ' . ICONV_VERSION . "\n"; break; case 'xml': $info .= ' Version ' . LIBXML_DOTTED_VERSION . "\n"; break; } } else { $info .= " {$ext} not loaded\n"; } } return $info; }
* Copyright (c) 2004, 2009 David Grudl (http://davidgrudl.com) * * This source file is subject to the GNU GPL license that is bundled * with this package in the file license.txt. * * For more information please see http://texy.info * * @copyright Copyright (c) 2004, 2009 David Grudl * @license GNU GENERAL PUBLIC LICENSE version 2 or 3 * @link http://texy.info * @package Texy * @version 2.0-beta (revision 227 released on 2009/04/20 15:55:36) */ define('TEXY_VERSION', '2.0-beta'); if (extension_loaded('mbstring')) { if (mb_get_info('func_overload') & 2 && substr(mb_get_info('internal_encoding'), 0, 1) === 'U') { mb_internal_encoding('pass'); trigger_error("Texy: mb_internal_encoding changed to 'pass'", E_USER_WARNING); } } if (ini_get('zend.ze1_compatibility_mode') % 256 || preg_match('#on$|true$|yes$#iA', ini_get('zend.ze1_compatibility_mode'))) { throw new RuntimeException("Texy cannot run with zend.ze1_compatibility_mode enabled."); } define('TEXY_CHAR', 'A-Za-z\\x{C0}-\\x{2FF}\\x{370}-\\x{1EFF}'); define('TEXY_MARK', "-"); define('TEXY_MODIFIER', '(?: *(?<= |^)\\.((?:\\([^)\\n]+\\)|\\[[^\\]\\n]+\\]|\\{[^}\\n]+\\}){1,3}?))'); define('TEXY_MODIFIER_H', '(?: *(?<= |^)\\.((?:\\([^)\\n]+\\)|\\[[^\\]\\n]+\\]|\\{[^}\\n]+\\}|<>|>|=|<){1,4}?))'); define('TEXY_MODIFIER_HV', '(?: *(?<= |^)\\.((?:\\([^)\\n]+\\)|\\[[^\\]\\n]+\\]|\\{[^}\\n]+\\}|<>|>|=|<|\\^|\\-|\\_){1,5}?))'); define('TEXY_IMAGE', '\\[\\*([^\\n' . TEXY_MARK . ']+)' . TEXY_MODIFIER . '? *(\\*|>|<)\\]'); define('TEXY_LINK_URL', '(?:\\[[^\\]\\n]+\\]|(?!\\[)[^\\s' . TEXY_MARK . ']*?[^:);,.!?\\s' . TEXY_MARK . '])'); define('TEXY_LINK', '(?::(' . TEXY_LINK_URL . '))');
/** * 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) {