|
From: Jon O. <jon...@us...> - 2008-07-11 21:52:41
|
Update of /cvsroot/mxbb/core/includes In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv16006 Modified Files: template.php Log Message: Cleaned up template.php Index: template.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/template.php,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** template.php 21 Jun 2008 22:20:59 -0000 1.28 --- template.php 11 Jul 2008 21:52:38 -0000 1.29 *************** *** 164,181 **** $this->vars = &$this->_tpldata['.'][0]; // load configuration ! switch(PORTAL_BACKEND) ! { ! case 'internal': ! $edit_db = false; ! break; ! case 'phpbb2': ! case 'phpbb3': ! $edit_db = true; ! break; ! default: ! $edit_db = true; ! break; ! } ! $this->load_config($root, $edit_db); } --- 164,168 ---- $this->vars = &$this->_tpldata['.'][0]; // load configuration ! $this->load_config($root); } *************** *** 183,189 **** * Load mod configuration */ ! function load_config($root, $edit_db) { ! global $mx_cache, $board_config, $portal_config, $phpbb_root_path, $mx_root_path, $phpEx; // getting mod version from config and comparing with real data $ver = isset($board_config['xs_version']) ? $board_config['xs_version'] : ( isset($portal_config['xs_version']) ? $portal_config['xs_version'] : 0 ); --- 170,179 ---- * Load mod configuration */ ! function load_config($root) { ! global $mx_cache, $board_config, $portal_config, $phpbb_root_path, $mx_root_path, $phpEx, $mx_backend; ! ! $edit_db = $mx_backend->edit_db; ! // getting mod version from config and comparing with real data $ver = isset($board_config['xs_version']) ? $board_config['xs_version'] : ( isset($portal_config['xs_version']) ? $portal_config['xs_version'] : 0 ); *************** *** 272,290 **** for($i=0; $i<count($add); $i++) { ! switch (PORTAL_BACKEND) ! { ! case 'internal': ! $sql = "ALTER TABLE " . PORTAL_TABLE . " ADD " . $add[$i] . " varchar(255) NOT NULL default ''"; ! $sql = "UPDATE " . PORTAL_TABLE . " SET " . $add[$i] . " = '" . str_replace('\\\'', '\'\'', addslashes($board_config[$add[$i]])) . "' WHERE portal_id = 1"; ! ! $portal_config[$add[$i]] = $board_config[$add[$i]]; ! $mx_cache->put( 'mxbb_config', $portal_config ); ! break; ! ! case 'phpbb2': ! case 'phpbb3': ! $sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('" . $add[$i] . "', '" . str_replace('\\\'', '\'\'', addslashes($board_config[$add[$i]])) . "')"; ! break; ! } $db->sql_query($sql); } --- 262,266 ---- for($i=0; $i<count($add); $i++) { ! $sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('" . $add[$i] . "', '" . str_replace('\\\'', '\'\'', addslashes($board_config[$add[$i]])) . "')"; $db->sql_query($sql); } *************** *** 292,306 **** for($i=0; $i<count($del); $i++) { ! switch (PORTAL_BACKEND) ! { ! case 'internal': ! $sql = "DELETE FROM " . PORTAL_TABLE . " WHERE config_name='" . $db->sql_escape($del[$i]) . "'"; ! break; ! ! case 'phpbb2': ! case 'phpbb3': ! $sql = "DELETE FROM " . CONFIG_TABLE . " WHERE config_name='" . $del[$i] . "'"; ! break; ! } $db->sql_query($sql); } --- 268,272 ---- for($i=0; $i<count($del); $i++) { ! $sql = "DELETE FROM " . CONFIG_TABLE . " WHERE config_name='" . $del[$i] . "'"; $db->sql_query($sql); } *************** *** 308,326 **** for($i=0; $i<count($up); $i++) { ! switch (PORTAL_BACKEND) ! { ! case 'internal': ! $sql = "UPDATE " . PORTAL_TABLE . " SET '" . $up[$i] . "' = '" . str_replace('\\\'', '\'\'', addslashes($board_config[$up[$i]])) . "' WHERE portal_id = 1"; ! ! $portal_config[$up[$i]] = $board_config[$up[$i]]; ! $mx_cache->put( 'mxbb_config', $portal_config ); ! break; ! ! case 'phpbb2': ! case 'phpbb3': ! $sql = "UPDATE " . CONFIG_TABLE . " SET config_value='" . str_replace('\\\'', '\'\'', addslashes($board_config[$up[$i]])) . "' WHERE config_name='" . $up[$i] . "'"; ! $mx_cache->put( 'phpbb_config', $board_config ); ! break; ! } $db->sql_query($sql); } --- 274,279 ---- for($i=0; $i<count($up); $i++) { ! $sql = "UPDATE " . CONFIG_TABLE . " SET config_value='" . str_replace('\\\'', '\'\'', addslashes($board_config[$up[$i]])) . "' WHERE config_name='" . $up[$i] . "'"; ! $mx_cache->put( 'phpbb_config', $board_config ); $db->sql_query($sql); } *************** *** 973,987 **** global $admin_script; $admin_script = ($admin_script) ? $admin_script : $filename; - } ! if ( !(PORTAL_BACKEND == 'phpbb3') ) ! { ! $template = $theme['template_name']; ! } ! else ! { ! $template = $theme['style_name']; ! } global $$template; --- 926,932 ---- global $admin_script; $admin_script = ($admin_script) ? $admin_script : $filename; } ! $template = $mx_user->template_name; global $$template; |