$GB_SELF = basename($_SERVER['PHP_SELF']); $GB_PG["index"] = "{$GB_SELF}?op=modload&name={$ModName}&file=index"; $GB_PG["admin"] = "{$GB_SELF}?op=modload&name={$ModName}&file=index&agbook=admin"; $GB_PG["comment"] = "{$GB_SELF}?op=modload&name={$ModName}&file=index&agbook=comment"; $GB_PG["addentry"] = "{$GB_SELF}?op=modload&name={$ModName}&file=index&agbook=addentry"; if (!isset($agbook)) { $agbook = ''; } switch ($agbook) { case "admin": require_once $include_path . "/lib/session.class.php"; $gb_auth = new gb_session($include_path); $AUTH = $gb_auth->checkSessionID(); $VARS = $gb_auth->fetch_array($gb_auth->query("SELECT * FROM " . $gb_auth->table['cfg'])); $gb_auth->free_result($gb_auth->result); $template = new gb_template($include_path); if (isset($_COOKIE['lang']) && !empty($_COOKIE['lang'])) { $template->set_lang($_COOKIE['lang']); } else { $template->set_lang($VARS['lang']); } $LANG = $template->get_content(); $gb_auth->close_db(); $enter_html = ""; if (!$AUTH) { $message = isset($username) || isset($password) ? $LANG["PassMess2"] : $LANG["PassMess1"]; eval("\$enter_html = \"" . $template->get_template($GB_TPL['header']) . "\";"); eval("\$enter_html .= \"" . $template->get_template($GB_TPL['adm_enter']) . "\";"); eval("\$enter_html .= \"" . $template->get_template($GB_TPL['footer']) . "\";"); echo $enter_html; } else {
function insert_config_values() { global $_SERVER; //make pathvariables for the configfile $cms_path = $this->globals['root_path']; $client_path = $this->globals['root_path']; if (!$_SERVER['HTTP_HOST']) { $_SERVER['HTTP_HOST'] = $this->globals['HTTP_HOST']; } $_domain_arr = explode('.', $_SERVER['HTTP_HOST']); if (is_array($_domain_arr)) { $_domain_arr = array_slice($_domain_arr, -2); $root_cookie_domain = implode('.', $_domain_arr); } else { $root_cookie_domain = ''; } //insert data $tpl = new gb_template(); $tpl->insert('', 'host', $this->globals['host']); $tpl->insert('', 'db', $this->globals[db]); $tpl->insert('', 'prefix', $this->globals['prefix']); $tpl->insert('', 'user', $this->globals['user']); $tpl->insert('', 'pass', $this->globals['pass']); $tpl->insert('', 'cms_path', $cms_path); //$tpl -> insert('', 'cms_http_path', $cms_http_path); $tpl->insert('', 'cms_full_http_path', $this->globals['root_full_http_path']); $tpl->insert('', 'cms_cookie_domain', $root_cookie_domain); $tpl->insert('', 'client_path', $client_path); //$tpl -> insert('', 'client_http_path', $client_http_path); $tpl->insert('', 'sql_target', $this->globals['sql_target']); $tpl->insert('', 'lang', $this->globals['lang']); $tpl->insert('', 'email', $this->globals['email']); $sql_data = $tpl->make('sql/config.sql'); // replace prefix in sql statement $in = array("!ALTER TABLE cms_!", "!ALTER TABLE `cms_!", "!DELETE FROM cms_!", "!DELETE FROM `cms_!", "!UPDATE cms_!", "!UPDATE `cms_!", "!REPAIR TABLE `cms_!", "!OPTIMIZE TABLE `cms_!", "!DROP TABLE IF EXISTS cms_!", "!CREATE TABLE cms_!", "!CREATE TABLE `cms_!", "!INSERT INTO `cms_!", "!INSERT INTO cms_!"); $out = array('ALTER TABLE ' . $this->globals['prefix'], 'ALTER TABLE `' . $this->globals['prefix'], 'DELETE FROM ' . $this->globals['prefix'], 'DELETE FROM `' . $this->globals['prefix'], 'UPDATE ' . $this->globals['prefix'], 'UPDATE `' . $this->globals['prefix'], 'REPAIR TABLE `' . $this->globals['prefix'], 'OPTIMIZE TABLE `' . $this->globals['prefix'], 'DROP TABLE IF EXISTS ' . $this->globals['prefix'], 'CREATE TABLE ' . $this->globals['prefix'], 'CREATE TABLE `' . $this->globals['prefix'], 'INSERT INTO `' . $this->globals['prefix'], 'INSERT INTO ' . $this->globals['prefix']); $sql_data = preg_replace($in, $out, $sql_data); $sql_data = utf8_encode($sql_data); $sql_data = $this->remove_remarks($sql_data); $sql_pieces = $this->split_sql_file($sql_data, ';'); $sql_count = count($sql_pieces); $con_handle = mysql_connect($this->globals['host'], $this->globals['user'], $this->globals['pass']); mysql_select_db($this->globals[db], $con_handle); //DEBUGGING if ($this->debug) { echo "Auszuführende Config Values querys: {$sql_count} <br><br>"; } for ($i = 0; $i < $sql_count; $i++) { $sql = trim($sql_pieces[$i]); if (!empty($sql)) { mysql_query($sql, $con_handle); //DEBUGGING if ($this->debug) { if (mysql_error() != '') { echo $i + 1 . ": <font color='darkred'><b>FEHLER</b></font> --> " . mysql_error() . "<br>" . $sql . '<br><br>'; } else { echo $i + 1 . ": <font color= 'darkgreen'><b>AUSGEFÜHRT</b></font><br>" . $sql . '<br><br>'; } } } } }