📄 index.php
字号:
INSERT INTO template_words SET
wordref = '" . addslashes($var[wordref]) . "',
text = '" . addslashes($var[text]) . "',
category = '" . addslashes($var[category]) . "',
language = '" . $language_convert[$var[language]] . "'
");
}
}
function check_php_ver() {
global $askhostto;
$fail = 0;
$phpversion = phpversion();
$minver = intval(str_replace('.', '', '4.1.0'));
$maxver = intval(str_replace('.', '', '4.3.0'));
$curver = intval(str_replace('.', '', $phpversion));
echo "<li>PHP version ($phpversion): ";
if ($curver >= $maxver ) {
echo '<span class="cp_temp_orig">PASS</span></li>';
} elseif ($curver >= $minver) {
echo '<span class="cp_temp_warning">WARNING</span></li>';
$askhostto .= "<li>Recompile PHP to at least 4.3.0<li>\n";
$warning ++;
} else {
echo '<span class="cp_temp_edit">FAIL</span></li>';
$askhostto .= "<li>Upgrade PHP to at least 4.1.0.</li>\n";
$fail++;
}
return $fail;
}
function check_mysql() {
global $askhostto;
$fail = 0;
echo "<li>MySQL support: ";
if (function_exists('mysql_connect')) {
echo '<span class="cp_temp_orig">PASS</span></li>';
} else {
echo '<span class="cp_temp_edit">FAIL</span></li>';
$askhostto .= "<li>Recompile PHP with MySQL support.</li>\n";
$fail++;
}
return $fail;
}
function check_pcre() {
global $askhostto;
$fail = 0;
echo "<li>PCRE support: ";
if (function_exists('preg_replace')) {
echo '<span class="cp_temp_orig">PASS</span></li>';
} else {
echo '<span class="cp_temp_edit">FAIL</span></li>';
$askhostto .= "<li>Recompile PHP with PCRE support.</li>\n";
$fail++;
}
return $fail;
}
function check_gd() {
global $askhostto;
$warning = 0;
echo "<li>GD support: ";
if (function_exists('gd_info')) {
echo '<span class="cp_temp_orig">PASS</span></li>';
} else {
echo '<span class="cp_temp_warning">WARNING</span></li>';
$askhostto .= "<li>Recompile PHP with GD support.<li>\n";
$warning ++;
}
return $warning;
}
function check_encoding() {
global $askhostto;
$fail = 0;
echo "<li>Check encoding: ";
if (!defined('IS_ENCODED')) {
echo "<span class=\"cp_temp_orig\">PASS</span> (Encoding not required)";
} else {
if (extension_loaded('ionCube Loader')) {
echo "<span class=\"cp_temp_orig\">PASS</span> (Ioncube extension found)";
} else {
echo '<span class="cp_temp_edit">FAIL</span></li>';
$askhostto .= "<li>You must install the ioncube decoder. Instructions can be found <a href=\"loader_help.php\">here</a>.</li>";
$fail++;
}
}
return $fail;
}
function check_config() {
global $askhostto;
$fail = 0;
echo "<li>Config.php file: ";
if (!@include_once('./../includes/config.php')) {
echo '<span class="cp_temp_edit">FAIL</span></li>';
$askhostto .= "<li><b>Config.php has not been created</b> : Before you can install DeskPRO you must create a config.php file. This file contains your mySQL information (mysql location, database name, username and password). The file config_new.php is contained inside the /includes/ folder. You should edit that file and rename it to config.php.</li>";
$fail++;
} else {
echo "<span class=\"cp_temp_orig\">PASS</span>";
}
return $fail;
}
function check_thelicense() {
}
function check_sessions() {
global $askhostto;
$warning = 0;
echo "<li>SESSIONS support: ";
if (function_exists('session_id')) {
echo '<span class="cp_temp_orig">PASS</span></li>';
} else {
echo '<span class="cp_temp_warning">WARNING</span></li>';
$askhostto .= "<li>Recompile PHP with SESSIONS support.<li>\n";
$warning ++;
}
return $warning;
}
function check_graphs_perms() {
global $askhostto;
$fail = 0;
echo "<li>GRAPH directory: ";
if (function_exists('posix_getpwuid')) {
if (!$userinfo = @posix_getpwuid(@posix_getuid())) {
$userinfo = '(cannot determine current running username)';
} else {
$userinfo = "(which is running as user '$userinfo[name]')";
}
} else {
$userinfo = '(cannot determine current running username)';
}
if (!file_exists('./../admin/graphs') OR !is_dir('./../admin/graphs') OR !is_writable('./../admin/graphs')) {
echo "<span class=\"cp_temp_edit\">FAIL</span>";
$askhostto .= "<LI>Create the directory admin/graphs/, and make it writable by the server process $userinfo.</LI>";
$fail++;
} else {
echo "<span class=\"cp_temp_orig\">PASS</span>";
}
return $fail;
}
function check_schema_files() {
global $warnhost, $schemafiles;
echo "<LI>DeskPro v2.0 schema files: ";
foreach ($schemafiles AS $file => $descr) {
if (is_file($file)) {
if (is_readable($file)) {
$schemafiles[$file]['status'] = "Present and readable.";
} else {
$warn++;
$schemafiles[$file]['status'] = "<B>Present, but not readable.</B>";
}
} else {
$warn++;
$schemafiles[$file]['status'] = "<B>Not present or not a regular file.</B>";
}
}
if ($warn) {
$warnhost .= "<LI>One or more schema files is missing. Without access to all the schema
files, the installer cannot automatically load the database for you.
<TABLE CELLPADDING=\"2\"><TR><TD><B><U>File</U></B></TD><TD><B><U>Status</U></B></TD><TD><B><U>Description</U></B></TD></TR>";
foreach($schemafiles AS $file => $descr) {
$warnhost .= "<TR><TD><I>$file</I></TD><TD>{$schemafiles[$file]['status']}</TD><TD>{$schemafiles[$file]['descr']}</TD></TR>";
}
$warnhost .= "</LI>";
} else {
echo "Pass</LI>";
}
return $warn;
}
function do_message($text) {
echo "$text ... ";
}
function do_message_yes() {
echo "<span class=\"cp_temp_orig\">Completed</span><br /><br />";
}
/*
returns:
true/false (if conection worked)
value (the error)
true (if the problem was lack of a database)
*/
function check_mysql_connection() {
$db = new DB_Sql;
$db->User=constant('DATABASE_USER');
$db->Password=constant('DATABASE_PASSWORD');
$db->Host=constant('DATABASE_HOST');
$db->Database=constant('DATABASE_NAME');
$db->Halt_On_Error = 'no';
$db->connect();
$dbname = constant('DATABASE_NAME');
$errno = mysql_errno();
if ($errno == 2005) {
return array(false, 'Could not connect to MySQL server at '.constant('DATABASE_HOST'));
} elseif ($errno == 1045) {
return array(false, 'Could not log on to server using the username and password you specified.');
} elseif ($errno == 1049) {
return array(false, true, true);
} elseif ($errno == 0) {
return array(true);
} else {
return array(false, mysql_error());
}
}
/*
returns:
true/false (if database creation worked)
value (the error))
*/
function create_database($dbname) {
mysql_query("CREATE DATABASE $dbname");
if (mysql_errno()) {
return array(false, "The following error occured when attempting to create database '$dbname': " . mysql_errno() . ': ' . mysql_error() . "</LI>");
} else {
return true;
}
}
function select_database() {
global $db, $askhostto, $dbname;
$fail = 0;
echo "<LI>Can access database '$dbname': ";
$db->select_db($dbname);
if (mysql_errno()) {
echo "<span class=\"cp_temp_edit\">FAIL</span></li>";
$askhostto .= "<LI>The following error occured when attempting to select database '$dbname': " . mysql_errno() . ': ' . mysql_error() . "</LI>";
$fail++;
} else {
echo "<span class=\"cp_temp_orig\">PASS</span></li>";
}
return $fail;
}
function load_data($name) {
global $db, $schemafiles, $warnhost;
if (!$data = file("./../install/v2data/" . $name)) {
echo "Error";
return 0;
} else {
foreach($data AS $query) {
$db->query(trim($query));
}
return 1;
}
}
function error($name) {
global $schemafiles;
echo "<P>An error has occured loading data from $name ({$schemafiles[$name]['descr']}).
Until this problem has been resolved, DeskPRO cannot be used; the database is NOT
ready for use. If this file exists but can't be read, check its permissions.
If this file was not included with your distribution, please contact
our support staff for assistance.</P>";
exit;
}
function install_check() {
if (!defined('INSTALLER')) {
print "Security Alert : Script not called by installation system.";
exit;
}
}
function execute($queries) {
global $db;
if (is_array($queries)) {
foreach ($queries AS $query) {
$db->query($query);
}
}
}
function install_header($title) {
if (defined('INSTALL_HEADER_YES')) {
return;
}
define('INSTALL_HEADER_YES', 1);
?>
<html><head>
<link rel="stylesheet" href="./../includes/css/admin-tech.css" type="text/css">
<link rel="stylesheet" href="./install.css" type="text/css">
<script language="javascript" src="./../includes/javascript/general.js"></script>
</head><body bgcolor="#7BA2D6" title="DeskPRO Installation - <?php echo $title;?>">
<table width="720" style="border: #000000 1px solid;" cellpadding="0" cellspacing="0" align="center" bgcolor="#FFFFFF">
<tr><td>
<table width="733" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="right" valign="bottom"><!--WTN-WDYL--><IMG height=66
src="./images/intpic010.gif" width=165 border=0></td>
<td valign="bottom">
<table width="608" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="#CC3333">
<td height="45" colspan="2" valign="bottom">
<p><IMG
src="./images/intpic030.gif"></p>
</td>
</tr>
<tr>
<td width="471" height="24" background="./images/intpic040.gif"> </td>
<td width="137"> </td>
</tr>
</table>
</td>
</tr>
</table>
<br /><br />
<table width="98%" align="center"><tr><td>
<?php
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -