function Connect () { if (DATABASE_TYPE == "PGSQL") { PGSQL::Connect (); } elseif (DATABASE_TYPE == "MYSQL") { MySQL::Connect (); } }
<?php include "../global.php"; $DB = new MySQL(); $DB->Connect(); $Data = array($_POST['size'] / 10, $_POST['closed'] * 10, $_POST['diagonal'], $_POST['truediagonal'], $_POST['heuristic'], $_POST['break'], $_POST['steps'], $_POST['searched']); if ($Data[2] == 'false') { $Data[2] = 0; } else { $Data[2] = 1; } if ($Data[3] == 'false') { $Data[3] = 0; } else { $Data[3] = 1; } foreach ($Data as $Number) { if (!is_numeric($Number)) { exit; } } $SQL = "INSERT INTO AStarPaths (MapDimensions, ClosedPercent, MoveDiagonally, TrueDiagonalDistance, HeuristicMethod, BreakTies, PathSteps, ExtraSearched) VALUES ({$Data['0']}, {$Data['1']}, {$Data['2']}, {$Data['3']}, {$Data['4']}, {$Data['5']}, {$Data['6']}, {$Data['7']});"; $DB->Execute($SQL);
build_page($method); break; case "delete": $log_info = $setting['language']['admin_art_tag_delete']; $tag = $db->result($setting['db']['pre_sub'] . "news_tag", "tag", array("id", "n=", $id)); $db->update($setting['db']['pre_sub'] . "news_show", array("tag" => ''), array("id", "n=", $id)); $db->update($setting['db']['pre_sub'] . "news_show", array("tag" => "REPLACE(tag, '" . $tag . ",', '')"), array("tag", "like", $tag)); $db->update($setting['db']['pre_sub'] . "news_show", array("tag" => "REPLACE(tag, '," . $tag . "', '')"), array("tag", "like", $tag)); $db->delete($setting['db']['pre_sub'] . "news_tag", array("id", "n=", $id)); break; case "rebuild": set_time_limit(0); $log_info = $setting['language']['admin_art_tag_rebuild']; $db_tmp = new MySQL(); $db_tmp->init($setting['db']['host'], $setting['db']['user'], $setting['db']['pass'], $setting['db']['charset']); $db_tmp->Connect(false); $db_tmp->SelectDB($setting['db']['name']); $db_tmp->update($setting['db']['pre_sub'] . "news_tag", array("count" => 0)); $db->ReConnect(true, $setting['db']['name']); $n = 1; $db->select($setting['db']['pre_sub'] . "news_show", "news_id, tag", array(), array("order" => "news_id")); while ($record = $db->GetRS()) { $the_tag = $record['tag']; $the_tag = str_replace("¡¢", ",", $the_tag); $the_tag = str_replace("£¬", ",", $the_tag); $the_tag = str_replace("¡¡", " ", $the_tag); $the_tag = str_replace(" ", "_", $the_tag); $the_tag = explode(",", $the_tag); $max_count = count($the_tag); for ($n = 0; $n < $max_count; $n++) { $the_tag[$n] = trim($the_tag[$n], "_");
} include_once "gzip_header.php"; echo "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">\n<head>\n\t<title>SGCP Install System</title>\n\t<meta name=\"Author\" content=\"" . $CP[author] . "\">\n\t<meta name=\"Keywords\" content=\"" . $CP[name] . "\">\n\t<meta name=\"Description\" content=\"" . $CP[credit] . "\">\n\t<meta name=\"Copyright\" content=\"" . $CP[name] . " (c) " . $CP[corp] . "\">\n\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-874\">\n\t<link rel=\"stylesheet\" type=\"text/css\" href=\"theme/{$STORED['THEME']}/style.css\">\n\t<style type=\"text/css\">\n\t\t.title_bar {\n\t\t\tBACKGROUND-IMAGE: url(theme/{$STORED['THEME']}/{$THEME['title_bar_img_url']})\n\t\t}\n\t\t.title_bar2 {\n\t\t\tBACKGROUND-IMAGE: url(theme/{$STORED['THEME']}/{$THEME['title_bar2_img_url']})\n\t\t}\n\t</style>\n</head>\n<body " . $THEME[background] . ">\n<form action=\"install.php?code=01\" method=\"post\" enctype=\"multipart/form-data\" name=\"Create_DB\" OnSubmit=\"document.Create_DB.Submit.disabled=true;\")>\n\t<input type=\"hidden\" name=\"system_safe\" value=\"1\">\n\t\t<TABLE width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\" class=\"topic_title\">\n\t\t\t<TBODY>\n\t\t\t\t<TR class=\"title_bar\" height=29>\n\t\t\t\t\t<TD>\n\t\t\t\t\t\t<div class=\"m_title\">\n\t\t\t\t\t\t\t<B> Creating Database: {$CONFIG_sql_cpdbname}</B>\n\t\t\t\t\t\t</font>\n\t\t\t\t\t</TD>\n\t\t\t\t</TR>\n\t\t\t\t<TR>\n\t\t\t\t\t<TD>\n\t\t\t\t\t\t<TABLE width=\"100%\" cellspacing=\"1\" cellpadding=\"5\" align=\"center\">\n\t\t\t\t\t\t\t<TBODY>\n\t\t\t\t\t\t\t\t<TR class=\"topic_title5\">\n\t\t\t\t\t\t\t\t\t<TD height=\"27\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"title_face\">\n\t\t\t\t\t\t\t\t\t\t\t<B>CP can't working now it must to create a {$CONFIG_sql_cpdbname} database. You want to create it at this time.</B>\n\t\t\t\t\t\t\t\t\t\t</font>\n\t\t\t\t\t\t\t\t\t</TD>\n\t\t\t\t\t\t\t\t</TR>\n\t\t\t\t\t\t\t\t<TR class=\"topic_title5\">\n\t\t\t\t\t\t\t\t\t<TD width=\"100%\" align=\"center\">\n\t\t\t\t\t\t\t\t\t\t<input type=\"submit\" name=\"Submit\" value=\"Create a database\" class=\"textinput\">\n\t\t\t\t\t\t\t\t\t</TD>\n\t\t\t\t\t\t\t\t</TR>\n\t\t\t\t\t\t\t</TBODY>\n\t\t\t\t\t\t</TABLE>\n\t\t\t\t\t</TD>\n\t\t\t\t</TR>\n\t\t\t</TBODY>\n\t\t</TABLE>\n</form>\n</body>\n</html>"; mysql_close(); include_once "gzip_footer.php"; } else { if ($_GET[code] == '01') { if ($_POST['system_safe'] != '1') { header("location:index.php?act=idx"); } require "memory.php"; require "function/lib_install.php"; include_once "gzip_header.php"; echo "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">\n<head>\n\t<meta name=\"Author\" content=\"" . $CP[author] . "\">\n\t<meta name=\"Keywords\" content=\"" . $CP[name] . "\">\n\t<meta name=\"Description\" content=\"" . $CP[credit] . "\">\n\t<meta name=\"Copyright\" content=\"" . $CP[name] . " (c) " . $CP[corp] . "\">\n\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-874\">\n\t<link rel=\"stylesheet\" type=\"text/css\" href=\"theme/{$STORED['THEME']}/style.css\">\n\t<style type=\"text/css\">\n\t\t.title_bar {\n\t\t\tBACKGROUND-IMAGE: url(theme/{$STORED['THEME']}/{$THEME['title_bar_img_url']})\n\t\t}\n\t\t.title_bar2 {\n\t\t\tBACKGROUND-IMAGE: url(theme/{$STORED['THEME']}/{$THEME['title_bar2_img_url']})\n\t\t}\n\t</style>\n</head>\n<body " . $background . ">\n"; $sql = new MySQL(); $sql->Connect($CONFIG_sql_host, $CONFIG_sql_username, $CONFIG_sql_password); $query = "SELECT COUNT(*) FROM {$CONFIG_sql_cpdbname}.memory WHERE memory_object =\"sgcp_install\" AND memory_value1=\"1\""; $sql->result = mysql_query($query); if (!$sql->result()) { if (mysql_select_db($CONFIG_sql_cpdbname)) { $dropdb = "DROP DATABASE `{$CONFIG_sql_cpdbname}`;"; mysql_query($dropdb); } $createdb = "CREATE DATABASE `{$CONFIG_sql_cpdbname}`;"; if (mysql_query($createdb)) { if ($contents = file_get_contents("install/sql-files/sgcp_database.sql")) { $cpi = new CP_Install(); $execute_query = $cpi->promt_query($contents); for ($i = 0; $i < count($execute_query); $i++) { mysql_db_query($CONFIG_sql_cpdbname, $execute_query[$i]); }
var tinyMCEImageList = new Array( <?php include '../system/classes/imageserver.php'; include '../system/classes/database.php'; include '../system/classes/language.php'; include '../system/classes/settings.php'; include '../system/classes/cache.php'; include '../system/classes/filecache.php'; include '../system/classes/mysql.php'; include '../system/classes/user.php'; include '../system/classes/role.php'; include '../system/classes/page.php'; include '../system/classes/sys.php'; include '../const.php'; $db = new MySQL('../system/dbsettings.php'); $db->Connect(); DataBase::SetCurrent($db); $language = new Language(); Settings::$allowFileCache = false; $images = ImageServer::getImages(); if ($images) { $i = 1; foreach ($images as $image) { ?> ["<?php echo $image->name; ?> ", "<?php echo $image->path; ?> "]
function Init () { MySQL::Connect (); MySQL::SelectDB (); }
$code = $_SERVER["HTTP_MS_SIGN"]; $code = preg_replace("/\\W/", "", $code); if (strlen($code) != 32 && false) { header("HTTP/1.0 404 Not Found"); exit; } define('ROOT_PATH', str_replace("\\", "/", realpath(dirname(__FILE__) . "/../"))); include ROOT_PATH . "/include/config.php"; include ROOT_PATH . "/include/parameter.php"; require ROOT_PATH . "/source/function/global.php"; require ROOT_PATH . "/source/class/abstract.class.php"; require ROOT_PATH . "/source/class/mysql.class.php"; require ROOT_PATH . "/source/class/mydb.class.php"; require "version.php"; $db = new MySQL($setting['db']['host'], $setting['db']['user'], $setting['db']['pass'], $setting['db']['charset']); $db->Connect($setting['db']['pconnect'], $setting['db']['name']); function client_info($mode = "") { global $db, $setting, $code; if (empty($code)) { $code = $_SERVER["HTTP_MS_SIGN"]; } $code = preg_replace("/\\W/", "", $code); if (strlen($code) != 32) { return; } if ($db->getRecord("show tables like 'ms_client_info'") == false) { $sql = "\r\n\t\t\tCREATE TABLE `{pre}client_info` (\r\n\t\t\t\t`idx` Char(40) NOT NULL UNIQUE,\r\n\t\t\t\t`title` Char(60) Default '' NOT NULL,\r\n\t\t\t\t`domain` Char(50) Default '' NOT NULL,\r\n\t\t\t\t`ip` Char(20) Default '' NOT NULL,\r\n\t\t\t\t`email` Char(40) Default '' NOT NULL,\r\n\t\t\t\t`date_install` datetime NULL,\r\n\t\t\t\t`date_check` datetime NULL,\r\n\t\t\t\t`date_update` datetime NULL,\r\n\t\t\t\t`version` Char(20) Default '' NOT NULL,\r\n\t\t\t\t`info` Char(255) Default '',\r\n\t\t\t\tPRIMARY KEY (`idx`)\r\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET={charset};\r\n\t\t"; $sql = str_replace("{pre}", $setting['db']['pre'], $sql); $sql = str_replace("{charset}", $setting['db']['charset'], $sql); $db->Query($sql);
switch ($method) { case "trans": $cat_id = $req->getReq("cat_id"); $org_id = $_POST['web_id_org']; $dst_id = $_POST['web_id_dst']; $log_info = $setting['language']['plugin_data_trans_title']; $setting_org = getSubSetting($org_id); $setting_dst = getSubSetting($dst_id); $pre_org = "{$setting_org['db']['name']}.{$setting_org['db']['pre']}"; $pre_dst = "{$setting_dst['db']['name']}.{$setting_dst['db']['pre']}"; if ($pre_org == $pre_dst) { showInfo($setting['language']['plugin_data_trans_error']); } $db2 = new MySQL(); $db2->init($setting['db']['host'], $setting['db']['user'], $setting['db']['pass'], $setting['db']['charset']); $db2->Connect(false, $setting['db']['name']); $db->ReConnect(true); if ($cat_id == 0) { foreach ($GLOBALS['news_cat'] as $cur_cat) { if ($cur_cat['web_id'] != $org_id) { continue; } if ($org_id != $dst_id) { $db->update($setting['db']['pre'] . "news_cat", array("web_id" => $dst_id), array("cat_id", "n=", $cur_cat['cat_id'])); } $db->select($pre_org . "news_show", "*", array("cat_id", "n=", $cur_cat['cat_id']), array("order" => "news_id asc")); $id_list = array(); while ($record = $db->GetRS()) { $the_id = array(); $the_id['old'] = $record['news_id']; $record['news_id'] = 0;