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);
}
unset($text);
if (!e_QUERY || $action == 'main' && !$_POST['language'] && !$_POST['edit_existing']) {
multilang_prefs();
}
if ($action == 'db') {
multilang_db();
}
if($_POST['ziplang'] && $_POST['language'])
{
$text = zip_up_lang($_POST['language']);
$ns -> tablerender(LANG_LAN_25, $text);
}
if($action == "tools"){
show_tools();
}
// Grab Language configuration. ---
if ($_POST['edit_existing']) {
$text .= "
";
$text .= "
";
$ns->tablerender(LANG_LAN_21, $text);
}
// ----------------------------------------------------------------------------
function language_adminmenu() {
global $action,$pref;
if ($action == "") {
$action = "main";
}
if($action == "modify"){
$action = "db";
}
$var['main']['text'] = LAN_PREFS;
$var['main']['link'] = e_SELF;
if(isset($pref['multilanguage']) && $pref['multilanguage']){
$var['db']['text'] = LANG_LAN_03;
$var['db']['link'] = e_SELF."?db";
}
$lcnt = explode(",",e_LANLIST);
if(count($lcnt) > 1)
{
$var['tools']['text'] = ADLAN_CL_6;
$var['tools']['link'] = e_SELF."?tools";
}
show_admin_menu(ADLAN_132, $action, $var);
}
// Zip up the language pack.
// ===================================================
function zip_up_lang($language)
{
if (is_readable(e_ADMIN."ver.php"))
{
include(e_ADMIN."ver.php");
}
/*
$core_plugins = array(
"alt_auth","banner_menu","blogcalendar_menu","calendar_menu","chatbox_menu",
"clock_menu","comment_menu","content","featurebox","forum","gsitemap",
"lastseen","links_page","linkwords","list_new","log","login_menu",
"newforumposts_main","newsfeed","newsletter","online_extended_menu",
"online_menu","other_news_menu","pdf","pm","poll","rss_menu",
"search_menu","siteinfo_menu","trackback","tree_menu","user_menu","userlanguage_menu",
"usertheme_menu"
);
$core_themes = array("crahan","e107v4a","human_condition","interfectus","jayya",
"khatru","kubrick","lamb","leaf","newsroom","reline","sebes","vekna_blue");
*/
require_once(e_HANDLER.'pclzip.lib.php');
list($ver,$tmp) = explode(" ",$e107info['e107_version']);
$newfile = e_UPLOAD."e107_".$ver."_".$language."_utf8.zip";
$archive = new PclZip($newfile);
$core = grab_lans(e_LANGUAGEDIR.$language."/",$language);
$plugs = grab_lans(e_PLUGIN,$language);
$theme = grab_lans(e_THEME,$language);
$file = array_merge($core,$plugs,$theme);
$data = implode(",",$file);
if ($archive->create($data) == 0)
{
return $archive->errorInfo(true);
}
else
{
return LANG_LAN_22." (".str_replace("../","",e_UPLOAD)."".basename($newfile).").";
}
}
function grab_lans($path,$language,$filter = "")
{
require_once(e_HANDLER."file_class.php");
$fl = new e_file;
if($lanlist = $fl->get_files($path,"", "standard",4)){
sort($lanlist);
}else{
return;
}
$pzip = array();
foreach($lanlist as $p)
{
$fullpath = $p['path'].$p['fname'];
if(strpos($fullpath,$language)!== FALSE)
{
$pzip[] = $fullpath;
}
}
return $pzip;
}
?>