Ejemplo n.º 1
0
function show_env_result(&$env_items, &$dirfile_items, &$func_items)
{
    $env_str = $file_str = $dir_str = $func_str = '';
    $error_code = 0;
    foreach ($env_items as $key => $item) {
        if ($key == 'php' && strcmp($item['current'], $item['r']) < 0) {
            show_msg('php_version_too_low', $item['current'], 0);
        }
        $status = 1;
        if ($item['r'] != 'notset') {
            if (intval($item['current']) && intval($item['r'])) {
                if (intval($item['current']) < intval($item['r'])) {
                    $status = 0;
                    $error_code = ENV_CHECK_ERROR;
                }
            } else {
                if (strcmp($item['current'], $item['r']) < 0) {
                    $status = 0;
                    $error_code = ENV_CHECK_ERROR;
                }
            }
        }
        if (VIEW_OFF) {
            $env_str .= "\t\t<runCondition name=\"{$key}\" status=\"{$status}\" Require=\"{$item['r']}\" Best=\"{$item['b']}\" Current=\"{$item['current']}\"/>\n";
        } else {
            $env_str .= "<tr>\n";
            $env_str .= "<td>" . lang($key) . "</td>\n";
            $env_str .= "<td class=\"padleft\">" . lang($item['r']) . "</td>\n";
            $env_str .= "<td class=\"padleft\">" . lang($item['b']) . "</td>\n";
            $env_str .= ($status ? "<td class=\"w pdleft1\">" : "<td class=\"nw pdleft1\">") . $item['current'] . "</td>\n";
            $env_str .= "</tr>\n";
        }
    }
    foreach ($dirfile_items as $key => $item) {
        $tagname = $item['type'] == 'file' ? 'File' : 'Dir';
        $variable = $item['type'] . '_str';
        if (VIEW_OFF) {
            if ($item['status'] == 0) {
                $error_code = ENV_CHECK_ERROR;
            }
            ${$variable} .= "\t\t\t<File name=\"{$item['path']}\" status=\"{$item['status']}\" requirePermisson=\"+r+w\" currentPermisson=\"{$item['current']}\" />\n";
        } else {
            ${$variable} .= "<tr>\n";
            ${$variable} .= "<td>{$item['path']}</td><td class=\"w pdleft1\">" . lang('writeable') . "</td>\n";
            if ($item['status'] == 1) {
                ${$variable} .= "<td class=\"w pdleft1\">" . lang('writeable') . "</td>\n";
            } elseif ($item['status'] == -1) {
                $error_code = ENV_CHECK_ERROR;
                ${$variable} .= "<td class=\"nw pdleft1\">" . lang('nodir') . "</td>\n";
            } else {
                $error_code = ENV_CHECK_ERROR;
                ${$variable} .= "<td class=\"nw pdleft1\">" . lang('unwriteable') . "</td>\n";
            }
            ${$variable} .= "</tr>\n";
        }
    }
    if (VIEW_OFF) {
        $str = "<root>\n";
        $str .= "\t<runConditions>\n";
        $str .= $env_str;
        $str .= "\t</runConditions>\n";
        $str .= "\t<FileDirs>\n";
        $str .= "\t\t<Dirs>\n";
        $str .= $dir_str;
        $str .= "\t\t</Dirs>\n";
        $str .= "\t\t<Files>\n";
        $str .= $file_str;
        $str .= "\t\t</Files>\n";
        $str .= "\t</FileDirs>\n";
        $str .= "\t<error errorCode=\"{$error_code}\" errorMessage=\"\" />\n";
        $str .= "</root>";
        echo $str;
        exit;
    } else {
        show_header();
        echo "<h2 class=\"title\">" . lang('env_check') . "</h2>\n";
        echo "<table class=\"tb\" style=\"margin:20px 0 20px 55px;\">\n";
        echo "<tr>\n";
        echo "\t<th>" . lang('project') . "</th>\n";
        echo "\t<th class=\"padleft\">" . lang('ucenter_required') . "</th>\n";
        echo "\t<th class=\"padleft\">" . lang('ucenter_best') . "</th>\n";
        echo "\t<th class=\"padleft\">" . lang('curr_server') . "</th>\n";
        echo "</tr>\n";
        echo $env_str;
        echo "</table>\n";
        echo "<h2 class=\"title\">" . lang('priv_check') . "</h2>\n";
        echo "<table class=\"tb\" style=\"margin:20px 0 20px 55px;width:90%;\">\n";
        echo "\t<tr>\n";
        echo "\t<th>" . lang('step1_file') . "</th>\n";
        echo "\t<th class=\"padleft\">" . lang('step1_need_status') . "</th>\n";
        echo "\t<th class=\"padleft\">" . lang('step1_status') . "</th>\n";
        echo "</tr>\n";
        echo $file_str;
        echo $dir_str;
        echo "</table>\n";
        foreach ($func_items as $item) {
            $status = function_exists($item);
            $func_str .= "<tr>\n";
            $func_str .= "<td>{$item}()</td>\n";
            if ($status) {
                $func_str .= "<td class=\"w pdleft1\">" . lang('supportted') . "</td>\n";
                $func_str .= "<td class=\"padleft\">" . lang('none') . "</td>\n";
            } else {
                $error_code = ENV_CHECK_ERROR;
                $func_str .= "<td class=\"nw pdleft1\">" . lang('unsupportted') . "</td>\n";
                $func_str .= "<td><font color=\"red\">" . lang('advice_' . $item) . "</font></td>\n";
            }
        }
        echo "<h2 class=\"title\">" . lang('func_depend') . "</h2>\n";
        echo "<table class=\"tb\" style=\"margin:20px 0 20px 55px;width:90%;\">\n";
        echo "<tr>\n";
        echo "\t<th>" . lang('func_name') . "</th>\n";
        echo "\t<th class=\"padleft\">" . lang('check_result') . "</th>\n";
        echo "\t<th class=\"padleft\">" . lang('suggestion') . "</th>\n";
        echo "</tr>\n";
        echo $func_str;
        echo "</table>\n";
        show_next_step(2, $error_code);
        show_footer();
    }
}
Ejemplo n.º 2
0
function show_env_result(&$env_items, &$dirfile_items, &$func_items)
{
    $env_str = $file_str = $dir_str = $func_str = '';
    $error_code = 0;
    foreach ($env_items as $key => $item) {
        if ($key == 'php' && strcmp($item['current'], $item['r']) < 0) {
            show_msg('php_version_too_low', $item['current'], 0);
        }
        $status = 1;
        if ($item['r'] != 'notset') {
            if ($item['status'] != 1) {
                $status = 0;
                $error_code = ENV_CHECK_ERROR;
            }
        }
        $env_str .= "<tr>\n";
        $env_str .= "<td>" . lang($key) . "</td>\n";
        $env_str .= "<td class=\"padleft\">" . lang($item['r'], true) . "</td>\n";
        $env_str .= "<td class=\"padleft\">" . lang($item['b'], true) . "</td>\n";
        $env_str .= ($status ? "<td class=\"w pdleft1\">" : "<td class=\"nw pdleft1\">") . lang($item['current'], true) . "</td>\n";
        $env_str .= "</tr>\n";
    }
    foreach ($dirfile_items as $key => $item) {
        $tagname = $item['type'] == 'file' ? 'File' : 'Dir';
        $variable = $item['type'] . '_str';
        ${$variable} .= "<tr>\n";
        ${$variable} .= "<td>{$item['path']}</td><td class=\"w pdleft1\">" . lang('writeable') . "</td>\n";
        if ($item['status'] == 1) {
            ${$variable} .= "<td class=\"w pdleft1\">" . lang('writeable') . "</td>\n";
        } elseif ($item['type'] == 'dir' && $item['status'] == -1) {
            $error_code = ENV_CHECK_ERROR;
            ${$variable} .= "<td class=\"nw pdleft1\">" . lang('nodir') . "</td>\n";
        } elseif ($item['type'] == 'file' && $item['status'] == -1) {
            $error_code = ENV_CHECK_ERROR;
            ${$variable} .= "<td class=\"nw pdleft1\">" . lang('unwriteable') . "</td>\n";
        } else {
            $error_code = ENV_CHECK_ERROR;
            ${$variable} .= "<td class=\"nw pdleft1\">" . lang('unwriteable') . "</td>\n";
        }
        ${$variable} .= "</tr>\n";
    }
    show_header();
    echo "<h2 class=\"title\">" . lang('env_check') . "</h2>\n";
    echo "<table class=\"tb\" style=\"margin:20px 0 20px 55px;\">\n";
    echo "<tr>\n";
    echo "\t<th>" . lang('project') . "</th>\n";
    echo "\t<th class=\"padleft\">" . lang('center_required') . "</th>\n";
    echo "\t<th class=\"padleft\">" . lang('center_best') . "</th>\n";
    echo "\t<th class=\"padleft\">" . lang('curr_server') . "</th>\n";
    echo "</tr>\n";
    echo $env_str;
    echo "</table>\n";
    echo "<h2 class=\"title\">" . lang('priv_check') . "</h2>\n";
    echo "<table class=\"tb\" style=\"margin:20px 0 20px 55px;width:90%;\">\n";
    echo "\t<tr>\n";
    echo "\t<th>" . lang('step1_file') . "</th>\n";
    echo "\t<th class=\"padleft\">" . lang('step1_need_status') . "</th>\n";
    echo "\t<th class=\"padleft\">" . lang('step1_status') . "</th>\n";
    echo "</tr>\n";
    echo $file_str;
    echo $dir_str;
    echo "</table>\n";
    foreach ($func_items as $item) {
        $status = function_exists($item);
        $func_str .= "<tr>\n";
        $func_str .= "<td>{$item}()</td>\n";
        if ($status) {
            $func_str .= "<td class=\"w pdleft1\">" . lang('supportted') . "</td>\n";
            $func_str .= "<td class=\"padleft\">" . lang('none') . "</td>\n";
        } else {
            $error_code = ENV_CHECK_ERROR;
            $func_str .= "<td class=\"nw pdleft1\">" . lang('unsupportted') . "</td>\n";
            $func_str .= "<td><font color=\"red\">" . lang('advice_' . $item) . "</font></td>\n";
        }
    }
    echo "<h2 class=\"title\">" . lang('func_depend') . "</h2>\n";
    echo "<table class=\"tb\" style=\"margin:20px 0 20px 55px;width:90%;\">\n";
    echo "<tr>\n";
    echo "\t<th>" . lang('func_name') . "</th>\n";
    echo "\t<th class=\"padleft\">" . lang('check_result') . "</th>\n";
    echo "\t<th class=\"padleft\">" . lang('suggestion') . "</th>\n";
    echo "</tr>\n";
    echo $func_str;
    echo "</table>\n";
    show_next_step(2, $error_code);
    show_footer();
}
Ejemplo n.º 3
0
function show_env_result(&$env_items, &$dirfile_items)
{
    $env_str = $file_str = $dir_str = '';
    foreach ($env_items as $key => $item) {
        if ($key == 'php' && strcmp($item['current'], $item['r']) < 0) {
            show_msg('php_version_too_low', $item['current'], 0);
        }
        $status = 1;
        if ($item['r'] != 'notset') {
            if (intval($item['current']) && intval($item['r'])) {
                if (intval($item['current']) < intval($item['r'])) {
                    $status = 0;
                    $env_wrong_sign = true;
                    //是否进行下一步,这里为报错
                }
            } else {
                if (strcmp($item['current'], $item['r']) < 0) {
                    $status = 0;
                    $env_wrong_sign = true;
                    //是否进行下一步,这里为报错
                }
            }
        }
        $env_str .= "<tr>\n";
        $env_str .= "<td>" . lang($key) . "</td>\n";
        $env_str .= "<td class=\"padleft\">" . lang($item['r']) . "</td>\n";
        $env_str .= "<td class=\"padleft\">" . lang($item['b']) . "</td>\n";
        $env_str .= ($status ? "<td class=\"pdleft1\">" : "<td class=\"red pdleft1\">") . $item['current'] . "</td>\n";
        $env_str .= "</tr>\n";
    }
    foreach ($dirfile_items as $key => $item) {
        $tagname = $item['type'] == 'file' ? 'File' : 'Dir';
        if ($item['status'] !== 1) {
            $variable = $item['type'] . '_str';
            ${$variable} .= "<tr>\n";
            ${$variable} .= "<td>{$item['path']}</td><td class=\"pdleft1\">" . lang('writeable') . "</td>\n";
            if ($item['status'] == 1) {
                ${$variable} .= "<td class=\"pdleft1\">" . lang('writeable') . "</td>\n";
            } elseif ($item['status'] == -1) {
                $dir_wrong_sign = true;
                //是否进行下一步,这里为报错
                ${$variable} .= "<td class=\"red pdleft1\">" . lang('nodir') . "</td>\n";
            } elseif ($item['status'] == -2) {
                $dir_wrong_sign = true;
                //是否进行下一步,这里为报错
                ${$variable} .= "<td class=\"red pdleft1\">" . lang('nofile') . "</td>\n";
            } else {
                $dir_wrong_sign = true;
                //是否进行下一步,这里为报错
                ${$variable} .= "<td class=\"red pdleft1\">" . lang('unwriteable') . "</td>\n";
            }
            ${$variable} .= "</tr>\n";
        }
    }
    //通过检测
    if (empty(${$variable})) {
        $file_str .= "<tr>\n";
        $file_str .= "<td colspan='3' align='center'>" . lang('file_all_pass') . "</td>\n";
        $file_str .= "</tr>\n";
    }
    show_header();
    echo "<h2 class=\"title\">" . lang('env_check') . "</h2>\n";
    echo "<table class=\"tb\" style=\"margin:20px 0 20px 55px;\">\n";
    echo "<tr>\n";
    echo "\t<th>" . lang('project') . "</th>\n";
    echo "\t<th class=\"padleft\">" . lang('install_required') . "</th>\n";
    echo "\t<th class=\"padleft\">" . lang('install_best') . "</th>\n";
    echo "\t<th class=\"padleft\">" . lang('curr_server') . "</th>\n";
    echo "</tr>\n";
    echo $env_str;
    echo "</table>\n";
    echo "<h2 class=\"title\">" . lang('priv_check') . "</h2>\n";
    echo "<table class=\"tb\" style=\"margin:20px 0 20px 55px;width:90%;\">\n";
    echo "\t<tr>\n";
    echo "\t<th>" . lang('step1_file') . "</th>\n";
    echo "\t<th class=\"padleft\">" . lang('step1_need_status') . "</th>\n";
    echo "\t<th class=\"padleft\">" . lang('step1_status') . "</th>\n";
    echo "</tr>\n";
    echo $file_str;
    echo $dir_str;
    echo "</table>\n";
    if ($env_wrong_sign == true || $dir_wrong_sign == true || $fun_wrong_sign == true) {
        show_next_step(1);
    } else {
        show_next_step(2);
    }
    show_footer();
}
Ejemplo n.º 4
0
function show_env_result(&$env_items, &$dirfile_items)
{
    $env_str = $file_str = $dir_str = '';
    $error_code = 0;
    foreach ($env_items as $key => $item) {
        if ($key == 'php' && strcmp($item['current'], $item['r']) < 0) {
            show_msg('php_version_too_low', $item['current']);
        }
        $status = 1;
        if ($item['r'] != '不限制') {
            if (intval($item['current']) && intval($item['r'])) {
                if (intval($item['current']) < intval($item['r'])) {
                    $status = 0;
                    $error_code = 31;
                }
            } else {
                if (strcmp($item['current'], $item['r']) < 0) {
                    $status = 0;
                    $error_code = 31;
                }
            }
        }
        $env_str .= "<tr>\n";
        $env_str .= "<td>" . $key . "</td>\n";
        $env_str .= "<td class=\"padleft\">" . $item['r'] . "</td>\n";
        $env_str .= "<td class=\"padleft\">" . $item['b'] . "</td>\n";
        $env_str .= ($status ? "<td class=\"w pdleft1\">" : "<td class=\"nw pdleft1\">") . $item['current'] . "</td>\n";
        $env_str .= "</tr>\n";
    }
    foreach ($dirfile_items as $key => $item) {
        $tagname = $item['type'] == 'file' ? 'File' : 'Dir';
        $variable = $item['type'] . '_str';
        ${$variable} .= "<tr>\n";
        ${$variable} .= "<td>{$item['path']}</td><td class=\"w pdleft1\">可写</td>\n";
        if ($item['status'] == 1) {
            ${$variable} .= "<td class=\"w pdleft1\">可写</td>\n";
        } elseif ($item['status'] == -1) {
            $error_code = 31;
            ${$variable} .= "<td class=\"nw pdleft1\">目录不存在</td>\n";
        } else {
            $error_code = 31;
            ${$variable} .= "<td class=\"nw pdleft1\">不可写</td>\n";
        }
        ${$variable} .= "</tr>\n";
    }
    show_header();
    echo "<h2 class=\"title\">开始安装</h2>\n";
    echo "<table class=\"tb\" style=\"margin:20px 0 20px 55px;\">\n";
    echo "<tr>\n";
    echo "\t<th>项目</th>\n";
    echo "\t<th class=\"padleft\">QuoraCms配置</th>\n";
    echo "\t<th class=\"padleft\">QuoraCms最佳</th>\n";
    echo "\t<th class=\"padleft\">当前服务器</th>\n";
    echo "</tr>\n";
    echo $env_str;
    echo "</table>\n";
    echo "<h2 class=\"title\">目录、文件权限检查</h2>\n";
    echo "<table class=\"tb\" style=\"margin:20px 0 20px 55px;width:90%;\">\n";
    echo "\t<tr>\n";
    echo "\t<th>目录文件</th>\n";
    echo "\t<th class=\"padleft\">所需状态</th>\n";
    echo "\t<th class=\"padleft\">当前状态</th>\n";
    echo "</tr>\n";
    echo $file_str;
    echo $dir_str;
    echo "</table>\n";
    echo "<h2 class=\"title\">所需PHP函数检查</h2>\n";
    echo "<table class=\"tb\" style=\"margin:20px 0 20px 55px;width:90%;\">\n";
    echo "\t<tr>\n";
    echo "\t<th>函数名称</th>\n";
    echo "\t<th class=\"padleft\">检查结果</th>\n";
    echo "</tr>\n";
    if (function_exists('mb_convert_encoding')) {
        echo '<tr><td>mb_convert_encoding()</td><td class="w pdleft1">可用</td></tr>';
    } else {
        $error_code = 31;
        echo '<tr><td>mb_convert_encoding()</td><td class="nw pdleft1">不可用</td></tr>';
    }
    if (function_exists('file_put_contents')) {
        echo '<tr><td>file_put_contents()</td><td class="w pdleft1">可用</td></tr>';
    } else {
        $error_code = 31;
        echo '<tr><td>file_put_contents()</td><td class="nw pdleft1">不可用</td></tr>';
    }
    if (function_exists('imagecreatetruecolor')) {
        echo '<tr><td>imagecreatetruecolor()</td><td class="w pdleft1">可用</td></tr>';
    } else {
        $error_code = 31;
        echo '<tr><td>imagecreatetruecolor()</td><td class="nw pdleft1">不可用</td></tr>';
    }
    if (function_exists('curl_init')) {
        echo '<tr><td>curl_init()</td><td class="w pdleft1">可用</td></tr>';
    } else {
        $error_code = 31;
        echo '<tr><td>curl_init()</td><td class="nw pdleft1">不可用</td></tr>';
    }
    echo "</table>\n";
    show_next_step(2, $error_code);
    show_footer();
}