Beispiel #1
0
function performPreinstallChecks($qubitWebRoot, $qubitDataRoot, $qubitDbType, $qubitDbName, $qubitDbUser, $qubitDbPassword, $qubitDbHost, $qubitDbPort)
{
    global $fileSystemPathToTarball;
    printStatusReportTop();
    /*
     * Set the $error variable to FALSE to keep track of whether any errors are reported by
     * the various check_x functions. If $error is false at the end of performPreinstallChecks,
     * we can procede to the installQubit().
     */
    $error = false;
    $error = checkPHPversion($error);
    $error = checkAllowUrlFopen($error);
    $error = checkXMLEnabled($error);
    $error = checkXSLEnabled($error);
    $error = checkOS($error);
    $error = checkExists($error, $qubitWebRoot, 'web root');
    $error = checkExists($error, $qubitDataRoot, 'data directory');
    $error = checkDbType($error, $qubitDbType);
    // This parameter list should work for mysql and pgsql, but not for sqlite
    $error = checkDbConnection($error, $qubitDbType, $qubitDbName, $qubitDbUser, $qubitDbPassword, $qubitDbHost, $qubitDbPort);
    /*
     * If everything is OK (i.e., no $error = true returned from the check_x functions),
     * actually install the distribution.
     */
    if ($error) {
        // Exit and report that errors reported above need to be fixed.
        print '<p>Sorry, the installer can\'t procede until all the <span class="problem">problems</span> identified below have been fixed.</p>';
        printStatusReportBottom();
    } else {
        global $distro;
        // Get the web path of this script by removing the server's web root path from $qubitWebRoot.
        $documentRootPattern = '#' . $_SERVER['DOCUMENT_ROOT'] . '#';
        $pathToWebsite = preg_replace($documentRootPattern, '', $qubitWebRoot);
        $pathToWebsite .= 'index.php';
        $urlToWebsite = '<a target="_blank" title="Opens your new ' . $distro . ' site in new browser/tab" href="http://' . $_SERVER['SERVER_NAME'] . $pathToWebsite . '/search/buildIndex">' . $distro . '</a>';
        installQubit($qubitWebRoot, $qubitDataRoot);
        printStatusReportBottom();
        print "<p>Congratulations, the installation is complete. Before you leave this page, please perform the following\n          post-installation security tasks:</p>";
        print "<ul>";
        print "<li>Remove the installation files at {$fileSystemPathToTarball}</li>";
        print "<li>Change permissions on {$qubitWebRoot} so that directory is not writable by your web server</li>";
        print "</ul>";
        print "<p>Test your new instance of the {$urlToWebsite} (with email admin@qubit-toolkit.org and password admin), and\n          if everything looks good, complete the above security tasks. <strong>It is very important that you do not forget\n          to do these things!</strong> Not doing them puts your\n          website at a high security risk.</p>";
    }
}
Beispiel #2
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.');
    }