";
return $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'] = LANG_LAN_21;
$var['tools']['link'] = e_SELF."?tools";
// }
e_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");
}
$tp = e107::getParser();
/*
$core_plugins = array(
"alt_auth","banner_menu","blogcalendar_menu","calendar_menu","chatbox_menu",
"clock_menu","comment_menu","content","featurebox","forum","gsitemap",
"links_page","linkwords","list_new","log","login_menu",
"newforumposts_main","newsfeed","newsletter","online",
"other_news_menu","pdf","pm","poll","rss_menu",
"search_menu","siteinfo","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
{
if($_POST['contribute_pack'])
{
$full_link = $tp->createConstants($newfile);
$email_message = "Site: ".SITENAME."
User: ".USERNAME."\n
IP:".USERIP."
...would like to contribute the following language pack for e107 v".$e107info['e107_version'].".
Please see attachment.";
$subject = basename($newfile);
//TODO - send email to languagepack@e107.org with attachment.
}
return LANG_LAN_22." (".str_replace("../", "", e_UPLOAD)."".basename($newfile).").";
}
}
function grab_lans($path, $language, $filter = "")
{
$fl = e107::getFile();
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;
}
// -----------------------
/**
* Compare Language File against script and find unused LANs
* @param object $lanfile
* @param object $script
* @return string|boolean FALSE on error
*/
function unused($lanfile,$script)
{
$lanDefines = file_get_contents($lanfile);
$tmp = explode(",",$script);
foreach($tmp as $scr)
{
$compare[$scr] = file_get_contents($scr);
}
$mes = e107::getMessage();
if(!$compare)
{
$mes = e107::getMessage();
$mes->add("Couldn't read ".$script, E_MESSAGE_ERROR);
}
if(!$lanDefines)
{
$mes = e107::getMessage();
$mes->add("Couldn't read ".$lanfile, E_MESSAGE_ERROR);
}
$srch = array("");
$lanDefines = str_replace($srch,"",$lanDefines);
$lanDefines = explode("\n", $lanDefines);
if($lanDefines && $compare)
{
$text = "
".$lanfile."
";
foreach($compare as $k=>$val)
{
$text .= "
".$k."
";
}
$text .= "
";
// for ($i=0; $i$match[1],'value'=>$match[2]);
}
}
function compareit($needle,$haystack,$value='',$disabled=FALSE){
// return "Need=".$needle." hack=".$haystack." val=".$val;
//TODO Move this into a separate function (use a class for this whole script)
$commonPhrases = file_get_contents(e_LANGUAGEDIR."English/admin/lan_admin.php");
$commonLines = explode("\n",$commonPhrases);
foreach($commonLines as $line)
{
if($match = getDefined($line))
{
$id = $match['define'];
$ar[$id] = $match['value'];
}
}
// Check if a common phrases was used.
foreach($ar as $def=>$common)
{
if(strtoupper(trim($value)) == strtoupper($common))
{
//$text .= "