From a0fd5ab7b5412985324e970573ca22a27b3a94d3 Mon Sep 17 00:00:00 2001 From: tbrehm <t.brehm@ispconfig.org> Date: Tue, 16 Apr 2013 05:56:06 -0400 Subject: [PATCH] - Merged revisions 3922-3958 from svn stable branch - Added backup size to web backups --- interface/web/admin/language_complete.php | 34 ++++++++++++++++++++++++++++------ 1 files changed, 28 insertions(+), 6 deletions(-) diff --git a/interface/web/admin/language_complete.php b/interface/web/admin/language_complete.php index 4f45724..75343bd 100644 --- a/interface/web/admin/language_complete.php +++ b/interface/web/admin/language_complete.php @@ -32,6 +32,7 @@ //* Check permissions for module $app->auth->check_module_permissions('admin'); +if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.'); //* This is only allowed for administrators if(!$app->auth->is_admin()) die('only allowed for administrators.'); @@ -82,9 +83,22 @@ merge_langfile(ISPC_WEB_PATH.'/'.$file.'/lib/lang/'.$target_lang_file,ISPC_WEB_PATH.'/'.$file.'/lib/lang/'.$lang_file); } } + $handle2 = opendir(ISPC_WEB_PATH.'/'.$file.'/lib/lang'); + while ($lang_file = @readdir ($handle2)) { + if ($lang_file != '.' && $lang_file != '..' && substr($lang_file,0,2) == $selected_language) { + $master_lang_file=ISPC_WEB_PATH.'/'.$file.'/lib/lang/en'.substr($lang_file,2); + $target_lang_file=ISPC_WEB_PATH.'/'.$file.'/lib/lang/'.$lang_file; + if(!file_exists($master_lang_file)){ + unlink($target_lang_file); + $msg.="File $target_lang_file removed because does not exist in master language<br />"; + } + } + }//Finish of remove the files how not exists in master language } } } +if($msg=='') +$msg="No files created, removed or modified<br />"; } function merge_langfile($langfile,$masterfile) { @@ -112,25 +126,33 @@ $n++; } } + + $r = 0; + foreach($wb as $key => $val) { + if(!isset($wb_master[$key])) { + unset($wb[$key]); + $r++; + } + } $file_content = "<?php\n"; foreach($wb as $key => $val) { - $val = str_replace("'",'',$val); - $val = str_replace('"','',$val); + $val = str_replace("'","\\'",$val); + $val = str_replace('"','\"',$val); $file_content .= '$wb['."'$key'".'] = '."'$val';\n"; } $file_content .= "?>\n"; - + + if($n!=0) $msg .= "Added $n lines to the file $langfile<br />"; + if($r!=0) + $msg .= "Removed $r lines to the file $langfile<br />"; file_put_contents($langfile ,$file_content); } else { $msg .= "File does not exist yet. Copied file $masterfile to $langfile<br />"; copy($masterfile,$langfile); } } - - - $app->tpl->setVar('msg',$msg); -- Gitblit v1.9.1