Beispiel #1
0
 /**
  * 环境检测
  */
 public function actionEnv()
 {
     self::_checkInstall();
     $isWritable = array(array('私有临时文件(protected/runtime)', true, Helper::is_writeable(Yii::app()->runtimePath), '系统核心', '必须可读写'), array('非模块化的静态文件(public)', false, is_readable(WWWPATH . DS . 'public'), '公共静态文件', '必须可读'), array('附件上传目录(uploads)', false, Helper::is_writeable(WWWPATH . DS . 'uploads'), '附件上传', '若无附件上传可不用写权限'), array('数据目录(data)', false, Helper::is_writeable(WWWPATH . DS . 'protected' . DS . 'data'), '数据库备份', '若不备份数据库可不用写权限'), array('配置文件目录(protected/config)', false, Helper::is_writeable(WWWPATH . DS . 'protected' . DS . 'config'), '安装程序', '若手动安装系统写可不用写权限'), array('公共资源文件(assets)', true, Helper::is_writeable(WWWPATH . DS . 'assets'), '系统核心', '必须可读写'));
     $requirements = array(array('PHP版本', true, version_compare(PHP_VERSION, "5.2.0", ">="), '系统核心', 'PHP 5.2.0 或更高版本是必须的.'), array('$_SERVER 服务器变量', true, '' === ($message = checkServerVar()), '系统核心', $message), array('Reflection 扩展模块', true, class_exists('Reflection', false), '系统核心', ''), array('PCRE 扩展模块', true, extension_loaded("pcre"), '系统核心', ''), array('SPL 扩展模块', true, extension_loaded("SPL"), '系统核心', ''), array('DOM 扩展模块', false, class_exists("DOMDocument", false), 'CHtmlPurifier, CWsdlGenerator', ''), array('PDO 扩展模块', true, extension_loaded('pdo'), '所有和使用PDO数据库连接相关的类', ''), array('PDO MySQL 扩展模块', true, extension_loaded('pdo_mysql'), 'MYSQL数据库', '使用MYSQL必须支持'), array('Mcrypt 扩展模块', false, extension_loaded("mcrypt"), 'CSecurityManager', '加密和解密方法'), array('SOAP 扩展模块', false, extension_loaded("soap"), 'CWebService, CWebServiceAction', ''), array('GD 扩展模块', false, '' === ($message = checkCaptchaSupport()), 'CCaptchaAction', $message), array('Ctype 扩展模块', false, extension_loaded("ctype"), 'CDateFormatter, CDateFormatter, CTextHighlighter, CHtmlPurifier', ''));
     $requireResult = 1;
     foreach ($requirements as $i => $requirement) {
         if ($requirement[1] && !$requirement[2]) {
             $requireResult = 0;
         } else {
             if ($requireResult > 0 && !$requirement[1] && !$requirement[2]) {
                 $requireResult = -1;
             }
         }
         if ($requirement[4] === '') {
             $requirements[$i][4] = ' ';
         }
     }
     $writeableResult = 1;
     foreach ($isWritable as $k => $val) {
         if ($val[1] && !$val[2]) {
             $writeableResult = 0;
         } else {
             if ($requireResult > 0 && !$val[1] && !$val[2]) {
                 $writeableResult = -1;
             }
         }
         if ($val[4] === '') {
             $isWritable[$i][4] = ' ';
         }
     }
     $data = array('isWritable' => $isWritable, 'writeableResult' => $writeableResult, 'requireResult' => $requireResult, 'requirements' => $requirements);
     $this->titler = '检测运行环境';
     $this->render('env', $data);
 }
Beispiel #2
0
 * Yii Requirement Checker script
 *
 * This script will check if your system meets the requirements for running
 * Yii-powered Web applications.
 *
 * @author Qiang Xue <*****@*****.**>
 * @link http://www.yiiframework.com/
 * @copyright 2008-2013 Yii Software LLC
 * @license http://www.yiiframework.com/license/
 * @package system
 * @since 1.0
 */
/**
 * @var array List of requirements (name, required or not, result, used by, memo)
 */
$requirements = array(array(t('yii', 'PHP version'), true, version_compare(PHP_VERSION, "5.1.0", ">="), '<a href="http://www.yiiframework.com">Yii Framework</a>', t('yii', 'PHP 5.1.0 or higher is required.')), array(t('yii', '$_SERVER variable'), true, '' === ($message = checkServerVar()), '<a href="http://www.yiiframework.com">Yii Framework</a>', $message), array(t('yii', 'Reflection extension'), true, class_exists('Reflection', false), '<a href="http://www.yiiframework.com">Yii Framework</a>', ''), array(t('yii', 'PCRE extension'), true, extension_loaded("pcre"), '<a href="http://www.yiiframework.com">Yii Framework</a>', ''), array(t('yii', 'SPL extension'), true, extension_loaded("SPL"), '<a href="http://www.yiiframework.com">Yii Framework</a>', ''), array(t('yii', 'DOM extension'), false, class_exists("DOMDocument", false), '<a href="http://www.yiiframework.com/doc/api/CHtmlPurifier">CHtmlPurifier</a>, <a href="http://www.yiiframework.com/doc/api/CWsdlGenerator">CWsdlGenerator</a>', ''), array(t('yii', 'PDO extension'), false, extension_loaded('pdo'), t('yii', 'All <a href="http://www.yiiframework.com/doc/api/#system.db">DB-related classes</a>'), ''), array(t('yii', 'PDO SQLite extension'), false, extension_loaded('pdo_sqlite'), t('yii', 'All <a href="http://www.yiiframework.com/doc/api/#system.db">DB-related classes</a>'), t('yii', 'Required for SQLite database.')), array(t('yii', 'PDO MySQL extension'), false, extension_loaded('pdo_mysql'), t('yii', 'All <a href="http://www.yiiframework.com/doc/api/#system.db">DB-related classes</a>'), t('yii', 'Required for MySQL database.')), array(t('yii', 'PDO PostgreSQL extension'), false, extension_loaded('pdo_pgsql'), t('yii', 'All <a href="http://www.yiiframework.com/doc/api/#system.db">DB-related classes</a>'), t('yii', 'Required for PostgreSQL database.')), array(t('yii', 'PDO Oracle extension'), false, extension_loaded('pdo_oci'), t('yii', 'All <a href="http://www.yiiframework.com/doc/api/#system.db">DB-related classes</a>'), t('yii', 'Required for Oracle database.')), array(t('yii', 'PDO MSSQL extension (pdo_mssql)'), false, extension_loaded('pdo_mssql'), t('yii', 'All <a href="http://www.yiiframework.com/doc/api/#system.db">DB-related classes</a>'), t('yii', 'Required for MSSQL database from MS Windows')), array(t('yii', 'PDO MSSQL extension (pdo_dblib)'), false, extension_loaded('pdo_dblib'), t('yii', 'All <a href="http://www.yiiframework.com/doc/api/#system.db">DB-related classes</a>'), t('yii', 'Required for MSSQL database from GNU/Linux or other UNIX.')), array(t('yii', 'PDO MSSQL extension (<a href="http://sqlsrvphp.codeplex.com/">pdo_sqlsrv</a>)'), false, extension_loaded('pdo_sqlsrv'), t('yii', 'All <a href="http://www.yiiframework.com/doc/api/#system.db">DB-related classes</a>'), t('yii', 'Required for MSSQL database with the driver provided by Microsoft.')), array(t('yii', 'PDO ODBC extension'), false, extension_loaded('pdo_odbc'), t('yii', 'All <a href="http://www.yiiframework.com/doc/api/#system.db">DB-related classes</a>'), t('yii', 'Required in case database interaction will be through ODBC layer.')), array(t('yii', 'Memcache extension'), false, extension_loaded("memcache") || extension_loaded("memcached"), '<a href="http://www.yiiframework.com/doc/api/CMemCache">CMemCache</a>', extension_loaded("memcached") ? t('yii', 'To use memcached set <a href="http://www.yiiframework.com/doc/api/CMemCache#useMemcached-detail">CMemCache::useMemcached</a> to <code>true</code>.') : ''), array(t('yii', 'APC extension'), false, extension_loaded("apc"), '<a href="http://www.yiiframework.com/doc/api/CApcCache">CApcCache</a>', ''), array(t('yii', 'Mcrypt extension'), false, extension_loaded("mcrypt"), '<a href="http://www.yiiframework.com/doc/api/CSecurityManager">CSecurityManager</a>', t('yii', 'Required by encrypt and decrypt methods.')), array(t('yii', 'crypt() CRYPT_BLOWFISH option'), false, function_exists('crypt') && defined('CRYPT_BLOWFISH') && CRYPT_BLOWFISH, '<a href="http://www.yiiframework.com/doc/api/1.1/CPasswordHelper">CPasswordHelper</a>', t('yii', 'Required for secure password storage.')), array(t('yii', 'SOAP extension'), false, extension_loaded("soap"), '<a href="http://www.yiiframework.com/doc/api/CWebService">CWebService</a>, <a href="http://www.yiiframework.com/doc/api/CWebServiceAction">CWebServiceAction</a>', ''), array(t('yii', 'GD extension with<br />FreeType support<br />or ImageMagick<br />extension with<br />PNG support'), false, '' === ($message = checkCaptchaSupport()), '<a href="http://www.yiiframework.com/doc/api/CCaptchaAction">CCaptchaAction</a>', $message), array(t('yii', 'Ctype extension'), false, extension_loaded("ctype"), '<a href="http://www.yiiframework.com/doc/api/CDateFormatter">CDateFormatter</a>, <a href="http://www.yiiframework.com/doc/api/CDateFormatter">CDateTimeParser</a>, <a href="http://www.yiiframework.com/doc/api/CTextHighlighter">CTextHighlighter</a>, <a href="http://www.yiiframework.com/doc/api/CHtmlPurifier">CHtmlPurifier</a>', ''), array(t('yii', 'Fileinfo extension'), false, extension_loaded("fileinfo"), '<a href="http://www.yiiframework.com/doc/api/CFileValidator">CFileValidator</a>', t('yii', 'Required for MIME-type validation')));
function checkServerVar()
{
    $vars = array('HTTP_HOST', 'SERVER_NAME', 'SERVER_PORT', 'SCRIPT_NAME', 'SCRIPT_FILENAME', 'PHP_SELF', 'HTTP_ACCEPT', 'HTTP_USER_AGENT');
    $missing = array();
    foreach ($vars as $var) {
        if (!isset($_SERVER[$var])) {
            $missing[] = $var;
        }
    }
    if (!empty($missing)) {
        return t('yii', '$_SERVER does not have {vars}.', array('{vars}' => implode(', ', $missing)));
    }
    if (realpath($_SERVER["SCRIPT_FILENAME"]) !== realpath(__FILE__)) {
        return t('yii', '$_SERVER["SCRIPT_FILENAME"] must be the same as the entry script file path.');
    }
Beispiel #3
0
 public function actionInstall()
 {
     //        ppr($_REQUEST);
     $opt = null;
     //        $show = new show();
     $step = reqReq('step', 0);
     if (empty($step)) {
         $this->render('step0');
         //            $show->showLowVersion();
     } elseif ($step == 1) {
         $this->render('step1');
         //            $show->showStep1();
     } elseif ($step == 2) {
         $w_check = array(YLMF_ROOT . 'ajax/', YLMF_ROOT . 'html/', YLMF_BACKEND . 'assets/', YLMF_BACKEND . 'uploads/', YLMF_APP . 'runtime/', YLMF_APP . 'data/crond/', YLMF_APP . 'data/cachefile/', APP_DB);
         $check = 1;
         foreach ($w_check as $key => $value) {
             if (!file_exists($value) && !@touch($value)) {
                 $w_check[$key] .= $this->_getLang('no_file');
                 $check = 0;
             } elseif (!is_writable($value)) {
                 $w_check[$key] .= $this->_getLang('777_test');
                 $check = 0;
             } else {
                 $w_check[$key] .= $this->_getLang('test_ok');
             }
         }
         //YII环境配置
         $requirements = array(array(t('yii', 'PHP版本'), true, version_compare(PHP_VERSION, "5.1.0", ">="), '<a href="http://www.yiiframework.com">Yii Framework</a>', t('yii', 'PHP 5.1.0或更高版本是必须的。')), array(t('yii', '$_SERVER变量'), true, '' === ($message = checkServerVar()), '<a href="http://www.yiiframework.com">Yii Framework</a>', $message), array(t('yii', 'Reflection扩展模块'), true, class_exists('Reflection', false), '<a href="http://www.yiiframework.com">Yii Framework</a>', ''), array(t('yii', 'PCRE扩展模块'), true, extension_loaded("pcre"), '<a href="http://www.yiiframework.com">Yii Framework</a>', ''), array(t('yii', 'SPL扩展模块'), false, extension_loaded("SPL"), '<a href="http://www.yiiframework.com">Yii Framework</a>', ''), array(t('yii', 'DOM扩展模块'), false, class_exists("DOMDocument", false), '<a href="http://www.yiiframework.com/doc/api/CHtmlPurifier">CHtmlPurifier</a>, <a href="http://www.yiiframework.com/doc/api/CWsdlGenerator">CWsdlGenerator</a>', ''), array(t('yii', 'PDO扩展模块'), true, extension_loaded('pdo'), t('yii', '所有和<a href="http://www.yiiframework.com/doc/api/#system.db">数据库相关的类</a>'), ''), array(t('yii', 'PDO MySQL扩展模块'), true, extension_loaded('pdo_mysql'), t('yii', 'All <a href="http://www.yiiframework.com/doc/api/#system.db">DB-related classes</a>'), t('yii', '如果使用MySQL数据库,这是必须的。')), array(t('yii', 'GD extension with<br />FreeType support<br />or ImageMagick<br />extension with<br />PNG support'), false, '' === ($message = checkCaptchaSupport()), '<a href="http://www.yiiframework.com/doc/api/CCaptchaAction">CCaptchaAction</a>', $message));
         $result = 1;
         // 1: all pass, 0: fail, -1: pass with warnings
         foreach ($requirements as $i => $requirement) {
             if ($requirement[1] && !$requirement[2]) {
                 $result = 0;
             } else {
                 if ($result > 0 && !$requirement[1] && !$requirement[2]) {
                     $result = -1;
                 }
             }
             if ($requirement[4] === '') {
                 $requirements[$i][4] = '&nbsp;';
             }
         }
         $viewFile = array('requirements' => $requirements, 'result' => $result);
         //            ppr($viewFile,1);
         if ($result == 0 || !$check) {
             $btn_disabled = 'disabled="disabled"';
         } else {
             $btn_disabled = '';
         }
         $this->render('step2', array('view_file' => $viewFile, 'w_check' => $w_check, 'btn_disabled' => $btn_disabled));
     } elseif ($step == 3) {
         $this->render('step3', array('opt' => $opt, 'error_password' => 0));
     } elseif ($step == 4) {
         $type = reqGet('t');
         $GLOBALS['database']['db_host'] = reqReq('dbhost');
         $GLOBALS['database']['db_name'] = reqReq('dbname');
         $GLOBALS['database']['db_user'] = reqReq('dbuser');
         $GLOBALS['database']['db_pass'] = reqReq('dbpw');
         $GLOBALS['database']['db_charset'] = reqReq('charset');
         $GLOBALS['database']['theme'] = 'default';
         $GLOBALS['database']['table_prefix'] = reqReq('dbpre');
         if (!empty($GLOBALS['database']['table_prefix'])) {
             if (substr($GLOBALS['database']['table_prefix'], -1) != '_') {
                 $GLOBALS['database']['table_prefix'] .= '_';
             }
         }
         $GLOBALS['database']['manager'] = reqReq('manager');
         $GLOBALS['database']['password'] = reqReq('password');
         $password_check = reqReq('password_check');
         if ($GLOBALS['database']['password'] !== $password_check) {
             $error = 1;
             $error_txt = $this->_getLang('no_same_adminpw');
         } else {
             $dbname = $GLOBALS['database']['db_name'];
             $yl_manager = $GLOBALS['database']['manager'];
             $yl_managerpw = md5($GLOBALS['database']['password']);
             $tblpre = $GLOBALS['database']['table_prefix'];
             if (!empty($type) && $type == 'rpw') {
                 $adir = reqReq('admindir');
                 app_db::select_db($dbname);
                 $sql = "UPDATE `{$tblpre}admin` SET `username`='{$yl_manager}',`password`='{$yl_managerpw}' WHERE `id` ='1'";
                 if (app_db::query($sql)) {
                     //跳转到成功页面
                     $this->render('step7', array('t' => 1, 'adir' => $adir));
                     exit;
                 } else {
                     $error = 1;
                     $error_txt = $this->_getLang('no_do_database');
                 }
             } else {
                 app_db::query("SET character_set_connection=utf8, character_set_results=utf8");
                 app_db::query("SET NAMES utf8");
                 /*
                 ppr($GLOBALS,1);
                 $opt['dbhost'] = reqReq('dbhost');
                 $opt['dbname'] = reqReq('dbname');
                 $opt['dbuser'] = reqReq('dbuser');
                 $opt['dbpw'] = reqReq('dbpw');
                 $opt['dbpre'] = reqReq('dbpre');
                 $opt['manager'] = reqReq('manager');
                 $opt['password'] = reqReq('password');
                 $opt['password_check'] = reqReq('password_check');
                 */
                 $error = 0;
                 $error_txt = '';
                 if ($GLOBALS['database']['password'] != $password_check) {
                     //管理员密码错误,显示
                     $this->render('step3', array('opt' => $GLOBALS['database'], 'error_password' => 1));
                 }
                 if (!app_db::select_db($dbname)) {
                     $error = 1;
                     $error_txt = $this->_getLang('no_database');
                 } else {
                     $tb1 = $GLOBALS['database']['table_prefix'] . 'admin';
                     $tb2 = $GLOBALS['database']['table_prefix'] . 'admin_group';
                     $tb3 = $GLOBALS['database']['table_prefix'] . 'admin_logger';
                     $tb4 = $GLOBALS['database']['table_prefix'] . 'catalog';
                     $tb5 = $GLOBALS['database']['table_prefix'] . 'config';
                     $tb6 = $GLOBALS['database']['table_prefix'] . 'links';
                     $sql = "SELECT count( TABLE_NAME ) c FROM `INFORMATION_SCHEMA`.`TABLES` where `TABLE_SCHEMA`='{$dbname}' AND (\n                            `TABLE_NAME`='{$tb1}' OR \n                            `TABLE_NAME`='{$tb2}' OR \n                            `TABLE_NAME`='{$tb3}' OR \n                            `TABLE_NAME`='{$tb4}' OR \n                            `TABLE_NAME`='{$tb5}' OR \n                            `TABLE_NAME`='{$tb6}'\n                            )";
                     //                        $sql = "SELECT count( TABLE_NAME ) c FROM information_schema.TABLES WHERE TABLE_SCHEMA = '$dbname'";
                     app_db::query($sql);
                     $ar = app_db::fetch_one();
                     if (!empty($ar) && $ar['c'] > 0) {
                         $error = 1;
                         $error_txt = $this->_getLang('no_empty_database');
                     }
                 }
                 $result = $check = $this->_showCopy($GLOBALS['database']);
                 if ($result && is_array($result)) {
                     $check = 1;
                 } else {
                     $check = 0;
                 }
                 $installinfo = FALSE;
                 if (!$error) {
                     $installsqlfile = YLMF_INSTALL . 'data/install.sql';
                     $sql = file_get_contents($installsqlfile);
                     $installinfo = $this->_creatTable($sql, $dbname, $yl_manager, $yl_managerpw, $tblpre);
                     if ($installinfo) {
                         //写入超级管理员信息
                         $sql = "INSERT INTO `{$tblpre}admin` SET `id`='1',`username`='{$yl_manager}',`password`='{$yl_managerpw}',`realname`='administrator',`group_id`='1',`last_login_ip`='127.0.0.1'";
                         app_db::query($sql);
                     } else {
                         $error = 1;
                         $error_txt = $this->_getLang('donot_insert');
                     }
                 }
             }
         }
         $this->render('step5', array('error' => $error, 'error_txt' => $error_txt, 'installinfo' => $installinfo, 'check' => $check));
     } elseif ($step == 6) {
         $this->render('step6');
     } elseif ($step == 7) {
         @$this->_delDir(YLMF_INSTALL);
         //若成功删除,则跳转
         if (!file_exists(__FILE__)) {
             header('Location: ../admin/index.php');
             echo "<script type='text/javascript'>window.location.href='../admin/index.php';</script>";
             exit;
         }
         //若未,则显示手动删除页面
         $this->render('step7');
     }
 }
Beispiel #4
0
?>
            </li> 
            
            <li><?php 
// check extension mcrypt
if (extension_loaded("mcrypt")) {
    echo '<span style="color:green"> extension Mcrypt is installed. Used by CSecurityManager. (encryption and decryptions methods)</span>';
} else {
    echo '<span style="color:red"> extension Mcrypt is not installed. Please install it on your PHP server. It is required by CSecurityManager (encryption and decryptions methods)</span>';
}
?>
            </li> 
                                    
            <li><?php 
// check extension GD
$res = checkCaptchaSupport();
if (empty($res)) {
    echo '<span style="color:green"> extension GD with FreeType support or ImageMagick extension with PNG supported is installed.</span>';
} else {
    echo '<span style="color:red"> extension GD with FreeType support or ImageMagick extension with PNG supported is not installed. Please install it on your PHP server. It is required by CCaptachaAction and image manipulation classes</span>';
}
?>
            </li> 
            
            <li><?php 
// check extension Ctype
if (extension_loaded("ctype")) {
    echo '<span style="color:green"> extension Ctype is installed. Used by CDateFormatter, CDateTimeParser, CTextHighlighter, CHtmlPurifier</span>';
} else {
    echo '<span style="color:red"> extension Ctype is not installed. Please install it on your PHP server. It is required by CDateFormatter, CDateTimeParser, CTextHighlighter, CHtmlPurifier</span>';
}
Beispiel #5
0
 *
 * This script will check if your system meets the requirements for running
 * Yii-powered Web applications.
 *
 * @author Qiang Xue <*****@*****.**>
 * @link http://www.yiiframework.com/
 * @copyright 2008-2013 Yii Software LLC
 * @license http://www.yiiframework.com/license/
 * @package system
 * @since 1.0
 */
define('MOBCENT_FRAMEWORK', '<a href="http://www.appbyme.com/">安米网</a>');
/**
 * @var array List of requirements (name, required or not, result, used by, memo)
 */
$requirements = array(array(t('yii', 'PHP version'), true, version_compare(PHP_VERSION, "5.1.0", ">="), '<a href="http://www.yiiframework.com">Yii Framework</a>', t('yii', 'PHP 5.1.0 or higher is required.')), array(t('yii', '$_SERVER variable'), false, '' === ($message = checkServerVar()), '<a href="http://www.yiiframework.com">Yii Framework</a>', $message), array(t('yii', 'Reflection extension'), true, class_exists('Reflection', false), '<a href="http://www.yiiframework.com">Yii Framework</a>', ''), array(t('yii', 'PCRE extension'), true, extension_loaded("pcre"), '<a href="http://www.yiiframework.com">Yii Framework</a>', ''), array(t('yii', 'SPL extension'), true, extension_loaded("SPL"), '<a href="http://www.yiiframework.com">Yii Framework</a>', ''), array(t('yii', 'Mbstring extension'), true, extension_loaded("mbstring"), '<a href="http://www.yiiframework.com">Yii Framework</a>', ''), array(t('yii', 'JSON 扩展模块'), true, function_exists('json_encode'), '<a href="http://www.yiiframework.com">Yii Framework</a>', t('yii', '')), array(t('yii', 'iconv 扩展模块'), true, function_exists('iconv'), '<a href="http://www.yiiframework.com">Yii Framework</a>', t('yii', '')), array(t('yii', 'cURL 扩展模块'), false, function_exists('curl_init'), '<a href="http://www.yiiframework.com">Yii Framework</a>', t('yii', '会影响客户端性能速度, 如未通过,<a href="http://addon.discuz.com/?@appbyme_app.plugin.doc/FAQ">请点击查看说明</a>')), array(t('yii', 'openssl 扩展模块'), false, function_exists('openssl_open'), '<a href="http://www.yiiframework.com">Yii Framework</a>', t('yii', '会影响客户端ios的推送功能')), array(t('yii', '图像处理库 扩展模块(有FreeType支持的 GD 库 或 <br /> 有PNG支持 ImageMagick 库)'), false, '' === ($message = checkCaptchaSupport()), '<a href="http://www.yiiframework.com/doc/api/CCaptchaAction">CCaptchaAction</a>', $message), array(t('yii', '需要可写目录'), true, checkDirectoryWritable(), '', t('yii', '请保证 discuz 根目录下的 data 目录可写')), array(t('yii', 'PHP 设置 allow_url_fopen'), true, checkAllowUrlFopen(), '', t('yii', '请保证 php.ini 中的 allow_url_fopen 为 On 或者为 1')));
function checkServerVar()
{
    $vars = array('HTTP_HOST', 'SERVER_NAME', 'SERVER_PORT', 'SCRIPT_NAME', 'SCRIPT_FILENAME', 'PHP_SELF', 'HTTP_ACCEPT', 'HTTP_USER_AGENT');
    $missing = array();
    foreach ($vars as $var) {
        if (!isset($_SERVER[$var])) {
            $missing[] = $var;
        }
    }
    if (!empty($missing)) {
        return t('yii', '$_SERVER does not have {vars}.', array('{vars}' => implode(', ', $missing)));
    }
    if (realpath($_SERVER["SCRIPT_FILENAME"]) !== realpath(__FILE__)) {
        return t('yii', '$_SERVER["SCRIPT_FILENAME"] must be the same as the entry script file path.');
    }
Beispiel #6
0
 * This script will check if your system meets the requirements for running
 * Yii-powered Web applications.
 *
 * @author Matthieu PENICAUD <*****@*****.**>
 * @link http://www.yiiframework.com/
 * @copyright 2008-2013 Yii Software LLC
 * @license http://www.yiiframework.com/license/
 * @package system
 * @since 1.0
 */
require dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'protected/extensions/phpmailer/JPhpMailer.php';
require dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'CommonProperties.php';
/**
 * @var array List of requirements (name, required or not, result, used by, memo)
 */
$requirements = array(array(t('yii', 'PHP version'), true, version_compare(PHP_VERSION, "5.3.0", ">="), '<a href="http://www.yiiframework.com">Yii Framework</a>', t('yii', 'PHP 5.1.0 or higher is required.')), array(t('yii', 'PDO extension'), false, extension_loaded('pdo'), t('yii', 'All <a href="http://www.yiiframework.com/doc/api/#system.db">DB-related classes</a>'), ''), array(t('yii', 'Mongo'), false, extension_loaded('mongo'), t('yii', 'All <a href="http://www.yiiframework.com/doc/api/#system.db">DB-related classes</a>'), ''), array(t('yii', 'Reflection extension'), true, class_exists('Reflection', false), '<a href="http://www.yiiframework.com">Yii Framework</a>', ''), array(t('yii', 'PCRE extension'), true, extension_loaded("pcre"), '<a href="http://www.yiiframework.com">Yii Framework</a>', ''), array(t('yii', 'SPL extension'), true, extension_loaded("SPL"), '<a href="http://www.yiiframework.com">Yii Framework</a>', ''), array(t('yii', 'bddConnectionProperties'), true, checkDbConnectionProperties(), 'Application', t('yii', 'dbConnectionProperties')), array(t('yii', 'db version'), true, version_compare(checkDbVersion(), "db.version.v.2.4.0", ">="), '<a href="http://www.yiiframework.com">Application</a>', t('yii', 'Mongodb 2.4.0 or higher is required.found:' . checkDbVersion())), array(t('yii', 'mail'), true, sendCheckMail(), 'Application', t('yii', "checkMail {email}", array('email' => CommonProperties::$ADMIN_EMAIL))), array(t('yii', 'assets'), true, is_writable(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'assets'), '<a href="http://www.yiiframework.com">Yii Framework</a>', t('yii', 'folder_assets required')), array(t('yii', 'runtime'), true, is_writable(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'protected' . DIRECTORY_SEPARATOR . 'runtime'), '<a href="http://www.yiiframework.com">Yii Framework</a>', t('yii', 'folder_runtime required')), array(t('yii', 'GD extension with<br />FreeType support<br />or ImageMagick<br />extension with<br />PNG support'), false, '' === ($message = checkCaptchaSupport()), '<a href="http://www.yiiframework.com/doc/api/CCaptchaAction">CCaptchaAction</a>', $message), array(t('yii', '$_SERVER variable'), true, '' === ($message = checkServerVar()), '<a href="http://www.yiiframework.com">Yii Framework</a>', $message), array(t('yii', 'Ctype extension'), false, extension_loaded("ctype"), '<a href="http://www.yiiframework.com/doc/api/CDateFormatter">CDateFormatter</a>, <a href="http://www.yiiframework.com/doc/api/CDateFormatter">CDateTimeParser</a>, <a href="http://www.yiiframework.com/doc/api/CTextHighlighter">CTextHighlighter</a>, <a href="http://www.yiiframework.com/doc/api/CHtmlPurifier">CHtmlPurifier</a>', ''), array(t('yii', 'Fileinfo extension'), false, extension_loaded("fileinfo"), '<a href="http://www.yiiframework.com/doc/api/CFileValidator">CFileValidator</a>', t('yii', 'Required for MIME-type validation')));
$result = 1;
// 1: all pass, 0: fail, -1: pass with warnings
foreach ($requirements as $i => $requirement) {
    if ($requirement[1] && !$requirement[2]) {
        $result = 0;
    } else {
        if ($result > 0 && !$requirement[1] && !$requirement[2]) {
            $result = -1;
        }
    }
    if ($requirement[4] === '') {
        $requirements[$i][4] = '&nbsp;';
    }
}
$lang = getPreferredLanguage();