⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 precheckup.php.svn-base

📁 PHP 知识管理系统(基于树结构的知识管理系统), 英文原版的PHP源码。
💻 SVN-BASE
📖 第 1 页 / 共 2 页
字号:
<?php/** * $Id$ * * KnowledgeTree Community Edition * Document Management Made Simple * Copyright (C) 2008 KnowledgeTree Inc. * Portions copyright The Jam Warehouse Software (Pty) Limited *  * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License version 3 as published by the * Free Software Foundation. *  * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more * details. *  * You should have received a copy of the GNU General Public License * along with this program.  If not, see <http://www.gnu.org/licenses/>. *  * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,  * California 94120-7775, or email info@knowledgetree.com. *  * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU General Public License version 3. *  * In accordance with Section 7(b) of the GNU General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by * KnowledgeTree" logo and retain the original copyright notice. If the display of the  * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices * must display the words "Powered by KnowledgeTree" and retain the original  * copyright notice. * Contributor( s): ______________________________________ * */error_reporting(E_ALL);require_once('../config/dmsDefaults.php');function get_php_setting($val) {    $r =  (ini_get($val) == '1' ? 1 : 0);    return $r ? 'ON' : 'OFF';}function boolSetting($name, $setting, $preferred, $red = true, $message = "") {    $current = get_php_setting($setting);    $ret = sprintf('<tr><td>%s (%s)</td><td>%s</td><td>', $name, $setting, $preferred);    if ($current == $preferred) {        $ret .= sprintf('<font color="green"><b>%s</b></font>', $current);    } else {        if ($red === true) {            $ret .= sprintf('<font color="red"><b>%s</b></font>', $current);        } else {            $ret .= sprintf('<font color="orange"><b>%s</b></font>', $current);        }        if ($message) {            $ret .= ' (' . $message . ')';        }    }    $ret .= "</td></tr>\n";    return $ret;}function stringSetting($name, $setting, $preferred, $red = true, $message = "") {    $current = ini_get($setting);    $ret = sprintf('<tr><td>%s (%s)</td><td>%s</td><td>', $name, $setting, $preferred);    if ($current == $preferred) {        $ret .= sprintf('<font color="green"><b>%s</b></font>', $current);    } else {        if ($red === true) {            $ret .= sprintf('<font color="red"><b>%s</b></font>', $current);        } else {            $ret .= sprintf('<font color="orange"><b>%s</b></font>', $current);        }        if ($message) {            $ret .= ' (' . $message . ')';        }    }    $ret .= "</td></tr>\n";    return $ret;}function emptySetting($name, $setting) {    $current = ini_get($setting);    $ret = sprintf('<tr><td>%s (%s)</td><td>unset</td><td>', $name, $setting);    if (($current === false) or ($current === "")) {        $ret .= sprintf('<font color="green"><b>unset</b></font>');    } else {        $ret .= sprintf('<font color="red"><b>Set: %s</b></font>', $current);    }    $ret .= "</td></tr>\n";    return $ret;}function writablePath($name, $path) {    $ret = sprintf('<tr><td>%s (%s)</td><td>', $name, $path);    if (is_writable('../' . $path)) {        $ret .= sprintf('<font color="green"><b>Writeable</b></font>');    } else {        $ret .= sprintf('<font color="red"><b>Unwriteable</b></font>');    }    return $ret;}function prettySizeToActualSize($pretty) {    if (strtoupper(substr($pretty, strlen($pretty) - 1)) == 'G') {        return (int)substr($pretty, 0, strlen($pretty)) * 1024 * 1024 * 1024;    }    if (strtoupper(substr($pretty, strlen($pretty) - 1)) == 'M') {        return (int)substr($pretty, 0, strlen($pretty)) * 1024 * 1024;    }    if (strtoupper(substr($pretty, strlen($pretty) - 1)) == 'K') {        return (int)substr($pretty, 0, strlen($pretty)) * 1024 * 1024;    }    return (int)$pretty;}function prettySize($v) {    $v = (float)$v;    foreach (array('B', 'K', 'M', 'G') as $unit) {        if ($v < 1024) {            return $v . $unit;        }        $v = $v / 1024;    }}function get_php_int_setting($val) {    $r = ini_get($val);    if ($r === false) {        return $r;    }    return prettySizeToActualSize($r);}function bigEnough($name, $setting, $preferred, $bytes = false, $red = true, $zero_ok = false, $minusone_ok = false) {    $current = get_php_int_setting($setting);    if ($bytes === true) {        $ret = sprintf('<tr><td>%s (%s)</td><td>%s</td><td>', $name, $setting, prettySize($preferred));    } else {        $ret = sprintf('<tr><td>%s (%s)</td><td>%s</td><td>', $name, $setting, $preferred);    }    if ($current === false) {        $ret .= '<font color="green"><b>unset</b></font>';    } else if ($current >= $preferred) {        if ($bytes === true) {            $ret .= sprintf('<font color="green"><b>%s</b></font>', prettySize($current));        } else {            $ret .= sprintf('<font color="green"><b>%s</b></font>', $current);        }    } else if (($current == 0) && ($zero_ok)) {        $ret .= sprintf('<font color="green"><b>unlimited (%s)</b></font>', $current);    } else if (($current == -1) && ($minusone_ok)) {        $ret .= sprintf('<font color="green"><b>unlimited (%s)</b></font>', $current);    } else {        if ($bytes === true) {            $ret .= sprintf('<font color="red"><b>%s</b></font>', prettySize($current));        } else {            $ret .= sprintf('<font color="red"><b>%s</b></font>', $current);        }    }    $ret .= "</td></tr>\n";    return $ret;}function haveExtension($ext) {    if (extension_loaded($ext)) {        return true;    }    // According to PEAR.php:    // if either returns true dl() will produce a FATAL error, stop that    if ((ini_get('enable_dl') != 1) || (ini_get('safe_mode') == 1)) {        return false;    }    $libfileext = '.so';    $libraryprefix = '';    if (substr(PHP_OS, 0, 3) == "WIN") {        $libfileext = '.dll';        $libraryprefix = 'php_';    }    @dl(sprintf("%s%s%s", $libraryprefix, $ext, $libfileext));    return extension_loaded($ext);}function must_extension_loaded($ext, $message = "") {    if (haveExtension($ext)) {        return '<b><font color="green">Available</font></b>';    }    if ($message) {        return '<b><font color="red">Unavailable</font></b> (' .  $message . ')';    }    return '<b><font color="red">Unavailable</font></b>';}function can_extension_loaded($ext, $message = "") {    if (haveExtension($ext)) {        return '<b><font color="green">Available</font></b>';    }    if ($message) {    return '<b><font color="orange">Unavailable</font></b> (' . $message . ')';    }    return '<b><font color="orange">Unavailable</font></b>';}$phpversion = phpversion();//$phpversion = '5.1'; // for debug$phpversion5 = version_compare($phpversion, '5.0.0', '>=');$phpversion522 = version_compare($phpversion, '5.2.2', '>=');$phpversion6 = version_compare($phpversion, '6.0.0', '<');if($phpversion5 == 1){    $phpversion5text = '<b><font color="green">Yes</font></b>';} else {    $phpversion5text = '<b><font color="red">No</font></b> <small>(You have PHP version '. $phpversion .' - '.APP_NAME.' does not work with versions less than PHP5 anymore)</small>';}if($phpversion522 == 1){    $phpversion522text = '<b><font color="green">Yes</font></b>';} else {    $phpversion522text = '<b><font color="red">No</font></b> <small>(You have PHP version '. $phpversion .' - PHP 5.2.2 or above is recommended)</small>';}if($phpversion6 == 1){    $phpversion6text = '<b><font color="green">Yes</font></b>';} else {    $phpversion6text = '<b><font color="red">No</font></b> <small>(You have PHP version '. $phpversion .' - '.APP_NAME.' does not work with versions greater than PHP5 yet)</small>';}function running_user() {    if (substr(PHP_OS, 0, 3) == "WIN") {        return null;    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -