📄 inst.php
字号:
<?php
// +-------------------------------------------------------------+
// | DeskPRO v [2.0.1 Production]
// | Copyright (C) 2001 - 2004 Headstart Solutions Limited
// | Supplied by WTN-WDYL
// | Nullified by WTN-WDYL
// | Distribution via WebForum, ForumRU and associated file dumps
// +-------------------------------------------------------------+
// | DESKPRO IS NOT FREE SOFTWARE
// +-------------------------------------------------------------+
// | License ID : Full Enterprise License =) ...
// | License Owner : WTN-WDYL Team
// +-------------------------------------------------------------+
// | $RCSfile: inst.php,v $
// | $Date: 2004/02/13 00:04:40 $
// | $Revision: 1.25 $
// +-------------------------------------------------------------+
// | File Details:
// | - Prepare the database for a release, and generate
// | installation files
// +-------------------------------------------------------------+
error_reporting(E_ALL & ~E_NOTICE);
include("./global.php");
include "./../includes/functions/conditional_functions.php";
include "./../includes/functions/devmode_functions.php";
developer_check();
###################################### settings ######################################
// creates settings.sql file
echo "Lets create the settings.sql file ... ";
$exec = "C:/apache/mysql/bin/mysqldump " . constant("DATABASE_NAME") . " settings settings_cat";
exec($exec, $output, $return);
if (!$return) {
foreach ($output AS $line) {
if (preg_match('/^INSERT INTO/', $line)) {
$sql[] = $line;
}
}
} else {
echo "couldn't execute command, errors (if any) follow:<BR>";
print_rr($output);
exit;
}
$sql = join("\n", $sql);
$handle = fopen('./../install/v2data/settings.sql','wb');
if (!$handle) {
echo "Couldn't open install/settings.sql for writing!";
exit;
}
fwrite($handle, $sql);
fclose($handle);
echo "<b>done</b><br>\n";
###################################### BASIC DATA ######################################
// this is data that the user should not be changing so we just drop it and overwrite it
echo "Lets create the data.sql file ... ";
$sql = array(); unset($output); unset($return);
$exec = "C:/apache/mysql/bin/mysqldump " . constant("DATABASE_NAME") . " template_cat template_words_cat admin_help_cat admin_help_entry tech_internal_help_cat tech_internal_help_entry user_help user_help_cats user_help_entries user_help_entries_cats user_helps_cats_entries";
exec($exec, $output, $return);
$sql = array(
"DELETE FROM admin_help_cat;",
"DELETE FROM admin_help_entry;",
"DELETE FROM tech_internal_help_cat;",
"DELETE FROM tech_internal_help_entry;",
"DELETE FROM user_help;",
"DELETE FROM user_help_cats;",
"DELETE FROM user_help_entries;",
"DELETE FROM user_help_cats_entries;",
"DELETE FROM template_words_cat;",
"DELETE FROM template_cat;"
);
foreach ($output AS $line) {
if (preg_match('/^INSERT INTO/', $line)) {
$sql[] = $line;
}
}
if (!count($sql)) {
echo "couldn't execute command, errors (if any) follow:<BR>";
print_rr($output);
exit;
}
$sql = join("\n", $sql);
$handle = fopen('./../install/v2data/data.sql','wb');
if (!$handle) {
echo "Couldn't open install/data.sql for writing!";
exit;
}
fwrite($handle, $sql);
fclose($handle);
echo "<b>done</b><BR>\n";
###################################### INSTALLATION DATA ######################################
// this is data just used by the installer
echo "Lets create the install.sql file ... ";
$sql = array(); unset($output); unset($return);
$exec = "C:/apache/mysql/bin/mysqldump " . constant("DATABASE_NAME") . " languages report report_relations report_stat report_style cron_options data template_replace user_groups ticket_pri ticket_cat";
exec($exec, $output, $return);
foreach ($output AS $line) {
if (preg_match('/^INSERT INTO/', $line)) {
$sql[] = $line;
}
}
if (!count($sql)) {
echo "couldn't execute command, errors (if any) follow:<BR>";
print_rr($output);
exit;
}
$sql = join("\n", $sql);
$handle = fopen('./../install/v2data/install.sql','wb');
if (!$handle) {
echo "Couldn't open install/install.sql for writing!";
exit;
}
fwrite($handle, $sql);
fclose($handle);
echo "<b>done</b><BR>\n";
###################################### lets import the templates ######################################
// lets import the templates
echo "Lets import the templates ... ";
// Import templates
$location = dirname(__FILE__) . '/templates/';
$return = dev_import_templates($location);
echo "<b>done</b><BR>\n";
echo "<textarea cols=\"70\" rows=\"5\">$return</textarea><br />";
echo "Lets create the backup templates ... ";
dev_reset_backup_templates();
echo "<b>done</b><BR>\n";
###################################### lets import the email templates ######################################
// lets import the templates
echo "Lets import the email templates ... ";
$location = dirname(__FILE__) . '/templates/email';
$return = dev_install_mail_templates($location);
echo "<b>done</b><BR>\n";
echo "<textarea cols=\"70\" rows=\"5\">$return</textarea><br />";
###################################### lets import the words ######################################
echo "Lets import the words ... ";
$location = dirname(__FILE__) . './../admin/templates/words';
$return = dev_install_words_import($location);
echo "<b>done</b><BR>\n";
echo "<textarea cols=\"70\" rows=\"5\">$return</textarea><br />";
echo "Lets create the default words ... ";
dev_install_words_default($location);
echo "<b>done</b><BR>\n";
###################################### Lets write the words ######################################
echo "Lets write the words ... ";
$sql = array(); unset($output); unset($return); unset($string); unset($strings);
$string = "<?php error_reporting(E_ALL & ~E_NOTICE);
";
$words = $db->query_return_array("SELECT * FROM template_words ORDER BY wordref, language");
foreach ($words AS $word) {
$strings[] = '$template_data[] = array(\'wordref\' => \'' . mysql_escape_string($word['wordref']) . '\', \'text\' => \'' . mysql_escape_string($word['text']) . '\', \'category\' => \'' . mysql_escape_string($word[category]) . '\', \'language\' => \'' . mysql_escape_string($word[language]) . '\'); ';
}
$string .= join("\n", $strings);
$handle = fopen('./../install/v2data/words.php','wb');
fwrite($handle, $string);
fclose($handle);
echo "<b>done</b><BR>\n";
###################################### Lets write the templates ######################################
echo "Lets write the templates ... ";
$sql = array(); unset($output); unset($return); unset($string); unset($strings);
$string = "<?php error_reporting(E_ALL & ~E_NOTICE);
";
$templates = $db->query_return_array("SELECT * FROM template WHERE !backup");
foreach ($templates AS $template) {
$strings[] = '$template_data[] = array(\'category\' => \'' . $template[category] . '\', \'name\' => \'' . mysql_escape_string($template['name']) . '\', \'description\' => \'' . mysql_escape_string($template['description']) . '\', \'template_unparsed\' => \'' . str_replace("'", "\\'", $template['template_unparsed']) . '\'); ';
}
$string .= join("\n", $strings);
$handle = fopen('./../install/v2data/templates.php','wb');
fwrite($handle, $string);
fclose($handle);
echo "<b>done</b><BR>\n";
###################################### Lets write the email templates ######################################
echo "Lets write the email templates ... ";
$sql = array(); unset($output); unset($return); unset($string); unset($strings);
$string = "<?php error_reporting(E_ALL & ~E_NOTICE);
";
$templates = $db->query_return_array("
SELECT * FROM template_email WHERE !backup
ORDER BY name, language
");
foreach ($templates AS $template) {
$strings[] = '$template_data[] = array(\'category\' => \'' . mysql_escape_string($template['category']) . '\',\'subject\' => \'' . mysql_escape_string($template['subject']) . '\',\'language\' => \'' . mysql_escape_string($template['language']) . '\',\'name\' => \'' . mysql_escape_string($template['name']) . '\', \'description\' => \'' . mysql_escape_string($template['description']) . '\', \'template_unparsed\' => \'' . str_replace("'", "\\'", $template['template_unparsed']) . '\'); ';
}
$string .= join("\n", $strings);
$handle = fopen('./../install/v2data/email_templates.php','wb');
fwrite($handle, $string);
fclose($handle);
echo "<b>done</b><BR>\n";
###################################### finished! ready for install ######################################
admin_footer();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -