tablerender(LAN_SAVED, "
".LAN_SETSAVED."
"); } // ----------------- delete tables --------------------------------------------- if (isset($_POST['del_existing']) && $_POST['lang_choices']) { $lang = strtolower($_POST['lang_choices']); foreach ($tabs as $del_table) { if (db_Table_exists($lang."_".$del_table)) { $qry = "DROP TABLE ".$mySQLprefix."lan_".$lang."_".$del_table; echo $qry; $message .= (mysql_query($qry)) ? $_POST['lang_choices']." ".$del_table." deleted
" : $_POST['lang_choices']." $del_table couldn't be deleted
"; } } global $cachevar; unset($cachevar['table_list']); } // ----------create tables ----------------------------------------------------- if (isset($_POST['create_tables']) && $_POST['language']) { $table_to_copy = array(); $lang_to_create = array(); foreach ($tabs as $value) { $lang = strtolower($_POST['language']); if (isset($_POST[$value])) { $copdata = ($_POST['copydata_'.$value]) ? 1 : 0; if (copy_table($value, "lan_".$lang."_".$value, $_POST['drop'],$copdata)) { $message .= " ".$_POST['language']." ".$value." created
"; } else { $message .= (!$_POST['drop'])? " ".$_POST['language']." ".$value." ".LANG_LAN_00."
" : $_POST['language']." ".$value." ".LANG_LAN_01."
"; } } elseif(db_Table_exists($lang."_".$value)) { if ($_POST['remove']) { // Remove table. $message .= (mysql_query("DROP TABLE ".$mySQLprefix."lan_".$lang."_".$value)) ? $_POST['language']." ".$value." ".LAN_DELETED."
" : $_POST['language']." $value ".LANG_LAN_02."
"; } else { // leave table. $message = $_POST['language']." ".$value." was disabled but left intact."; } } } global $cachevar; unset($cachevar['table_list']); } if(isset($message) && $message){ $ns->tablerender(LAN_OK, $message); } // ------------- render form --------------------------------------------------- if(isset($pref['multilanguage']) && $pref['multilanguage']){ $caption = LANG_LAN_16; // language $text = MLAD_LAN_4."

"; // Choose Language to Edit: $text = "
\n\n"; sort($lanlist); for($i = 0; $i < count($lanlist); $i++) { $installed = 0; $text .= ""; } $text .= "
".ADLAN_132." ".LANG_LAN_03." ".LAN_OPTIONS."
".$lanlist[$i]."\n"; foreach ($tabs as $tab_name) { if (db_Table_exists(strtolower($lanlist[$i])."_".$tab_name)) { $text .= $tab_name.", "; $installed++; } } $text .= (!$installed)? "
".LANG_LAN_05."
" : ""; $text .= "
\n"; $text .= $rs->form_open("post", e_SELF."?modify", "lang_form_".str_replace(" ", "_", $lanlist[$i])); $text .= "
\n"; if ($installed) { $text .= " \n"; $text .= " \n"; } else { $text .= "\n"; } $text .= ""; $text .= "
"; $text .= $rs->form_close(); $text .= "
"; $ns->tablerender($caption, $text); } if (!$_POST['language'] && !$_POST['edit_existing']) { multilang_prefs(); } unset($text); // Grab Language configuration. --- if ($_POST['edit_existing']) { $text = $rs->form_open("post", e_SELF); $text .= "
"; $text .= "\n"; foreach ($tabs as $table_name) { $installed = strtolower($_POST['lang_choices'])."_".$table_name; if (stristr($_POST['lang_choices'], $installed) === FALSE) { $text .= "\n \n"; } } $text .= ""; // =========================================================================== // Drop tables ? $text .= "\n
".ucfirst(str_replace("_", " ", $table_name))."\n"; $selected = (db_Table_exists($installed)) ? "checked='checked'" : ""; $text .= ""; $text .= ""; $text .= "
 "; $text .= ""; $text .= "
".LANG_LAN_07." ".$rs->form_checkbox("drop", 1)."\n ".LANG_LAN_08."
".LANG_LAN_10." ".$rs->form_checkbox("remove", 1)."\n ".LANG_LAN_11."
"; $button_capt = LANG_LAN_06. " / ". LAN_UPDATE; $text .=""; $text .="
\n"; $text .= $rs->form_close(); $ns->tablerender($_POST['lang_choices'], $text); } require_once(e_ADMIN."footer.php"); // --------------------------------------------------------------------------- function multilang_prefs() { global $ns, $pref,$lanlist; $text = "
"; $text .= ""; $text .= " "; $text .= "
".LANG_LAN_14.": "; $text .= "
".LANG_LAN_12.": "; $checked = ($pref['multilanguage'] == 1) ? "checked='checked'" : ""; $text .= "
"; $text .= ""; $text .= "
"; $caption = LANG_LAN_13; // "Language Preferences"; $ns->tablerender($caption, $text); } // ---------------------------------------------------------------------------- function db_Table_exists($table) { global $mySQLdefaultdb; $tables = getcachedvars("table_list"); if(!$tables) { $tablist = mysql_list_tables($mySQLdefaultdb); while($tmp = mysql_fetch_array($tablist)) { $tables[] = $tmp[0]; } cachevars("table_list", $tables); } return in_array(strtolower(MPREFIX."lan_".$table), $tables); } // ---------------------------------------------------------------------------- function copy_table($oldtable, $newtable, $drop = FALSE, $data = FALSE) { global $sql; $old = MPREFIX.strtolower($oldtable); $new = MPREFIX.strtolower($newtable); if($drop) { $sql->db_Select_gen("DROP TABLE IF EXISTS {$new}"); } //Get $old table structure $sql->db_Select_gen('SET SQL_QUOTE_SHOW_CREATE = 1'); $qry = "SHOW CREATE TABLE {$old}"; if($sql->db_Select_gen($qry)) { $row = $sql->db_Fetch(); $qry = $row[1]; $qry = str_replace($old, $new, $qry); } $result = mysql_query($qry); if(!$result) { return FALSE; } if ($data) //We need to copy the data too { $qry = "INSERT INTO {$new} SELECT * FROM {$old}"; $sql->db_Select_gen($qry); } return TRUE; } // ---------------------------------------------------------------------------- function table_list() { // grab default language lists. global $mySQLdefaultdb; $exclude[] = "banlist"; $exclude[] = "banner"; $exclude[] = "cache"; $exclude[] = "core"; $exclude[] = "online"; $exclude[] = "parser"; $exclude[] = "plugin"; $exclude[] = "user"; $exclude[] = "upload"; $exclude[] = "userclass_classes"; $exclude[] = "rbinary"; $exclude[] = "session"; $exclude[] = "tmp"; $exclude[] = "flood"; $exclude[] = "stat_info"; $exclude[] = "stat_last"; $exclude[] = "submit_news"; $exclude[] = "rate"; $exclude[] = "stat_counter";$exclude[] = "user_extended"; $exclude[] = "user_extended_struc"; $exclude[] = "pm_messages"; $exclude[] = "pm_blocks"; $tables = mysql_list_tables($mySQLdefaultdb); while (list($temp) = mysql_fetch_array($tables)) { if(strpos($temp, MPREFIX) === 0) { $e107tab = str_replace(MPREFIX, "", $temp); if (!in_array($e107tab, $exclude) && stristr($e107tab, "lan_") === FALSE) { $tabs[] = $e107tab; } } } return $tabs; } // ---------------------------------------------------------------------------- ?>