mirror of
https://github.com/e107inc/e107.git
synced 2025-04-21 21:21:54 +02:00
Issue #6 Core Language-File checking fixes and LAN optimization.
This commit is contained in:
parent
ae9585f0da
commit
9a9c4096ef
@ -304,15 +304,17 @@ class lancheck
|
||||
|
||||
var $core_themes = array("bootstrap3");
|
||||
|
||||
var $errorsOnly = false;
|
||||
private $errorsOnly = false;
|
||||
|
||||
var $coreImage = array();
|
||||
private $coreImage = array();
|
||||
|
||||
private $transLanguage = '';
|
||||
|
||||
private $thirdPartyPlugins = true;
|
||||
|
||||
|
||||
|
||||
|
||||
function __construct()
|
||||
{
|
||||
$this->core_plugins = e107::getPlugin()->getCorePlugins();
|
||||
@ -322,6 +324,12 @@ class lancheck
|
||||
{
|
||||
$this->thirdPartyPlugins = $val;
|
||||
}
|
||||
|
||||
public function errorsOnly($val)
|
||||
{
|
||||
$this->errorsOnly = $val;
|
||||
|
||||
}
|
||||
|
||||
public function init()
|
||||
{
|
||||
@ -373,8 +381,8 @@ class lancheck
|
||||
// Verify
|
||||
if($mode == 'verify' && !empty($lan))
|
||||
{
|
||||
$_SESSION['lancheck-errors-only'] = ($_POST['errorsonly']==1 ) ? 1 : 0;
|
||||
$this->errorsOnly = ($_POST['errorsonly']==1) ? TRUE : FALSE;
|
||||
// $_SESSION['lancheck-errors-only'] = ($_POST['errorsonly']==1 ) ? 1 : 0;
|
||||
// $this->errorsOnly = ($_POST['errorsonly']==1) ? TRUE : FALSE;
|
||||
return $this->check_all('render', $lan);
|
||||
|
||||
}
|
||||
@ -542,7 +550,7 @@ class lancheck
|
||||
{
|
||||
$ret = array();
|
||||
$ret['error'] = TRUE;
|
||||
$message = (defined('LANG_LAN_34')) ? LANG_LAN_34 : LANG_LAN_115;
|
||||
$message = LANG_LAN_115;
|
||||
$ret['message'] = str_replace("[x]",$_SESSION['lancheck'][$language]['total'],$message);
|
||||
return $ret;
|
||||
}
|
||||
@ -551,26 +559,26 @@ class lancheck
|
||||
{
|
||||
$ret = array();
|
||||
$ret['error'] = TRUE;
|
||||
$ret['message'] = (defined('LANG_LAN_27')) ? LANG_LAN_27 : LANG_LAN_116;
|
||||
$ret['message'] = LANG_LAN_116;
|
||||
return $ret;
|
||||
}
|
||||
|
||||
if(varset($_POST['contribute_pack']) && varset($_SESSION['lancheck'][$language]['total']) !='0')
|
||||
{
|
||||
$ret['error'] = TRUE;
|
||||
$ret['message'] = (defined("LANG_LAN_29")) ? LANG_LAN_29 : LANG_LAN_117;
|
||||
$ret['message'] = LANG_LAN_117;
|
||||
$ret['message'] .= "<br />";
|
||||
$ret['message'] .= (defined('LANG_LAN_27')) ? LANG_LAN_27 : LANG_LAN_116;
|
||||
$ret['message'] .= LANG_LAN_116;
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
if(!is_writable(e_FILE."public"))
|
||||
{
|
||||
$ret['error'] = TRUE;
|
||||
$ret['message'] = LAN_UPLOAD_777 . " ".e_FILE."public";
|
||||
return $ret;
|
||||
}
|
||||
// if(!is_writable(e_FILE."public"))
|
||||
// {
|
||||
// $ret['error'] = TRUE;
|
||||
// $ret['message'] = LAN_UPLOAD_777 . " ".e_FILE."public";
|
||||
// return $ret;
|
||||
// }
|
||||
|
||||
if(is_readable(e_ADMIN."ver.php"))
|
||||
{
|
||||
@ -709,7 +717,7 @@ class lancheck
|
||||
$release_diz = defined("LANG_LAN_30") ? LANG_LAN_30 : "Release Date";
|
||||
$compat_diz = defined("LANG_LAN_31") ? LANG_LAN_31 : "Compatibility";
|
||||
$lan_pleasewait = (deftrue('LAN_PLEASEWAIT')) ? $tp->toJS(LAN_PLEASEWAIT) : "Please Wait";
|
||||
$lan_displayerrors = (deftrue('LANG_LAN_33')) ? LANG_LAN_33 : "Display only errors during verification";
|
||||
|
||||
|
||||
|
||||
$text = "<form id='lancheck' method='post' action='".e_REQUEST_URI."'>
|
||||
@ -802,8 +810,8 @@ class lancheck
|
||||
<tr>
|
||||
<td>";
|
||||
|
||||
$echecked = varset($_SESSION['lancheck-errors-only']) == 1 ? true : false;
|
||||
$text .= $frm->checkbox('errorsonly',1,$echecked,array('label'=>$lan_displayerrors));
|
||||
// $echecked = varset($_SESSION['lancheck-errors-only']) == 1 ? true : false;
|
||||
// $text .= $frm->checkbox('errorsonly',1,$echecked,array('label'=>$lan_displayerrors));
|
||||
$text .= " </td>
|
||||
|
||||
</tr>";
|
||||
@ -867,12 +875,12 @@ class lancheck
|
||||
|
||||
$text .= "<thead>
|
||||
<tr>
|
||||
<th>".LANG_LAN_108."</th>
|
||||
<th>".LANG_LAN_109."</th>
|
||||
<th>".LANG_LAN_110."</th>
|
||||
<th>".LAN_NAME."</th>
|
||||
<th>".LAN_VERSION."</th>
|
||||
<th>".LAN_AUTHOR."</th>
|
||||
<th>".LANG_LAN_111."</th>
|
||||
<th>".LANG_LAN_112."</th>
|
||||
<th>".LANG_LAN_113."</th>
|
||||
<th>".LAN_DOWNLOAD."</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>";
|
||||
@ -1177,7 +1185,7 @@ class lancheck
|
||||
|
||||
function check_core_lanfiles($checklan,$subdir='')
|
||||
{
|
||||
|
||||
$tp = e107::getParser();
|
||||
// $sql->db_Mark_Time('Start Get Core Lan Phrases English');
|
||||
$English = $this->get_comp_lan_phrases(e_LANGUAGEDIR."English/".$subdir,$checklan);
|
||||
|
||||
@ -1191,7 +1199,7 @@ class lancheck
|
||||
$header = "<table class='table table-striped'>
|
||||
<tr>
|
||||
<th>".LAN_CHECK_16."</th>
|
||||
<th>".$this->transLanguage." ".LAN_CHECK_26."</th>
|
||||
<th>".$this->transLanguage." ".LAN_FILE."</th>
|
||||
<th>".LAN_OPTIONS."</th></tr>";
|
||||
|
||||
$keys = array_keys($English);
|
||||
@ -1219,11 +1227,11 @@ class lancheck
|
||||
$utf_error = "";
|
||||
|
||||
$bomkey = str_replace(".php","",$k_check);
|
||||
// $bom_error = ($check['bom'][$bomkey]) ? "<i>".LAN_CHECK_15."</i><br />" : ""; // illegal chars
|
||||
|
||||
|
||||
if(!empty($check['bom'][$bomkey]))
|
||||
{
|
||||
$bom_error = "<i>".LAN_CHECK_15."</i><br />";
|
||||
$bom_error = "<i>".$tp->lanVars(LAN_CHECK_15,array("'<?php'","'?>'"))."</i><br />"; // illegal chars
|
||||
$this->checkLog('bom',1);;
|
||||
}
|
||||
else
|
||||
@ -1518,9 +1526,12 @@ class lancheck
|
||||
|
||||
|
||||
// for plugins and themes - checkes what kind of language files directory structure we have
|
||||
function check_lanfiles($mode,$comp_name,$base_lan="English",$target_lan){
|
||||
global $ns,$sql;
|
||||
|
||||
function check_lanfiles($mode,$comp_name,$base_lan="English",$target_lan)
|
||||
{
|
||||
|
||||
|
||||
$tp = e107::getParser();
|
||||
|
||||
$folder['P'] = e_PLUGIN.$comp_name;
|
||||
$folder['T'] = e_THEME.$comp_name;
|
||||
$comp_dir = $folder[$mode];
|
||||
@ -1554,7 +1565,7 @@ class lancheck
|
||||
$bomkey = str_replace(".php","",$k_check);
|
||||
if($check['bom'][$bomkey])
|
||||
{
|
||||
$bom_error = "<i>".LAN_CHECK_15."</i><br />";
|
||||
$bom_error = "<i>".$tp->lanVars(LAN_CHECK_15,array("'<?php'","'?>'"))."</i><br />";
|
||||
$this->checkLog('bom',1);
|
||||
}
|
||||
else
|
||||
@ -1843,567 +1854,3 @@ class lancheck
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
class lancheck_old
|
||||
{
|
||||
var $error_count=0;
|
||||
|
||||
function check_core_lanfiles($checklan,$subdir=''){
|
||||
$frm = e107::getForm();
|
||||
|
||||
$English = $this->get_comp_lan_phrases(e_LANGUAGEDIR."English/".$subdir,$checklan);
|
||||
$check = $this->get_comp_lan_phrases(e_LANGUAGEDIR.$checklan."/".$subdir,$checklan);
|
||||
$legend_txt = LAN_CHECK_3.": ".$_POST['language']."/".$subdir;
|
||||
$fieldset_id = $subdir ? str_replace('/', '', $_POST['language'])."-".str_replace('/', '', $subdir) : str_replace('/', '', $_POST['language']);
|
||||
$text .= "
|
||||
<fieldset id='core-lancheck-{$fieldset_id}'>
|
||||
<legend>{$legend_txt}</legend>
|
||||
<table class='table adminlist'>
|
||||
<colgroup>
|
||||
<col style='width: 50%' />
|
||||
<col style='width: 40%' />
|
||||
<col style='width: 10%' />
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>".LAN_CHECK_16."</th>
|
||||
<th>".$_POST['language'].' '.LAN_CHECK_20."</th>
|
||||
<th class='center last'>".LAN_OPTIONS."</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
";
|
||||
|
||||
$keys = array_keys($English);
|
||||
|
||||
sort($keys);
|
||||
|
||||
$i = 0;
|
||||
foreach($keys as $k)
|
||||
{
|
||||
if($k != "bom")
|
||||
{
|
||||
$lnk = $k;
|
||||
$k_check = str_replace("English",$checklan,$k);
|
||||
$text .= "
|
||||
<tr>
|
||||
";
|
||||
|
||||
if(array_key_exists($k,$check))
|
||||
{
|
||||
$text .= "
|
||||
<td>{$lnk}</td>
|
||||
";
|
||||
$subkeys = array_keys($English[$k]);
|
||||
|
||||
$er="";
|
||||
$utf_error = "";
|
||||
|
||||
$bomkey = str_replace(".php","",$k_check);
|
||||
$bom_error = ($check['bom'][$bomkey]) ? "<span class='error'><em>".str_replace("[php]", "<?php", LAN_CHECK_15)."</em></span><br />" : ""; // illegal chars
|
||||
|
||||
foreach($subkeys as $sk)
|
||||
{
|
||||
if($utf_error == "" && !$this->is_utf8($check[$k][$sk]))
|
||||
{
|
||||
$utf_error = "<span class='error'><em>".LAN_CHECK_19."</em></span><br />";
|
||||
}
|
||||
|
||||
if($sk == "LC_ALL"){
|
||||
$check[$k][$sk] = str_replace(chr(34).chr(34),"",$check[$k][$sk]);
|
||||
}
|
||||
|
||||
if((!array_key_exists($sk,$check[$k]) && $English[$k][$sk] != "") || (trim($check[$k][$sk]) == "" && $English[$k][$sk] != ""))
|
||||
{
|
||||
|
||||
$er .= ($er) ? "<br />" : "";
|
||||
$er .= $sk." ".LAN_CHECK_5;
|
||||
$this->error_count++;
|
||||
}
|
||||
}
|
||||
|
||||
$style = ($er) ? "warning" : "success";
|
||||
$text .= "
|
||||
<td class='{$style}' style='width:50%'>
|
||||
<div class='smalltext'>
|
||||
";
|
||||
$text .= $bom_error . $utf_error;
|
||||
if(!$er && !$bom_error && !$utf_error)
|
||||
{
|
||||
$text .= LAN_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
$text .= $er."<br />";
|
||||
$this->error_count++;
|
||||
}
|
||||
$text .= "
|
||||
</div>
|
||||
</td>
|
||||
";
|
||||
}
|
||||
else
|
||||
{
|
||||
// file missing
|
||||
$text .= "
|
||||
<td>{$lnk}</td>
|
||||
<td><span class='error'>".LAN_CHECK_4."</span></td>
|
||||
";
|
||||
$this->error_count++;
|
||||
}
|
||||
|
||||
// Leave in EDIT button for all entries - to allow re-translation of bad entries.
|
||||
$subpath = ($subdir!='') ? $subdir.$k : $k;
|
||||
$text .= "
|
||||
<td class='center'>
|
||||
".$frm->admin_button('but-corelan-'.str_replace(array('/', '\\'), '-', $subdir).$i, LAN_EDIT, 'edit', '', array('other' => "onclick=\"window.location='".e_SELF."?".$subpath."|".$_POST['language']."'\""))."
|
||||
";
|
||||
$text .= "
|
||||
</td>
|
||||
</tr>
|
||||
";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$text .= "
|
||||
</tbody>
|
||||
</table>
|
||||
</fieldset>
|
||||
";
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
||||
function get_lan_file_phrases($dir1,$dir2,$file1,$file2){
|
||||
|
||||
$ret = array();
|
||||
$fname = $dir1.$file1;
|
||||
$type='orig';
|
||||
|
||||
if(is_file($fname))
|
||||
{
|
||||
$data = file($fname);
|
||||
$ret=$ret + $this->fill_phrases_array($data,$type);
|
||||
if(substr($data[0],0,5) != "<?php")
|
||||
{
|
||||
$key = str_replace(".php","",$fname);
|
||||
$ret['bom'][$key] = $fname;
|
||||
}
|
||||
}
|
||||
|
||||
$fname = $dir2.$file2;
|
||||
$type='tran';
|
||||
|
||||
if(is_file($fname))
|
||||
{
|
||||
$data = file($fname);
|
||||
$ret=$ret + $this->fill_phrases_array($data,$type);
|
||||
if(substr($data[0],0,5) != "<?php")
|
||||
{
|
||||
$key = str_replace(".php","",$fname);
|
||||
$ret['bom'][$key] = $fname;
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
function get_comp_lan_phrases($comp_dir,$lang,$depth=0)
|
||||
{
|
||||
$fl = e107::getFile();
|
||||
|
||||
$ret = array();
|
||||
|
||||
if($lang_array = $fl->get_files($comp_dir, '\.php','standard',$depth)){
|
||||
sort($lang_array);
|
||||
}
|
||||
|
||||
$regexp = (strpos($comp_dir,e_LANGUAGEDIR) !== FALSE) ? "#.php#" : "#".$lang."#";
|
||||
|
||||
foreach($lang_array as $f)
|
||||
{
|
||||
if(preg_match($regexp,$f['path'].$f['fname']))
|
||||
{
|
||||
|
||||
$data = file($f['path'].$f['fname']);
|
||||
$relpath = str_replace($comp_dir,"",$f['path']);
|
||||
if(substr($data[0],0,5) != "<?php")
|
||||
{
|
||||
$key = str_replace(".php","",$relpath.$f['fname']);
|
||||
$ret['bom'][$key] = $f['fname'];
|
||||
}
|
||||
if($f['path'].$f['fname'] == e_LANGUAGEDIR.$lang."/".$lang.".php")
|
||||
{
|
||||
$f['fname'] = "English.php"; // change the key for the main language file.
|
||||
}
|
||||
|
||||
if($f['path'].$f['fname'] == e_LANGUAGEDIR.$lang."/".$lang."_custom.php")
|
||||
{
|
||||
$f['fname'] = "English_custom.php"; // change the key for the main language file.
|
||||
}
|
||||
|
||||
$ret=$ret + $this->fill_phrases_array($data,$relpath.$f['fname']);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return $ret;
|
||||
|
||||
}
|
||||
|
||||
// for plugins and themes - checks what kind of language files directory structure we have
|
||||
function check_lanfiles($mode, $comp_name, $base_lan="English", $target_lan)
|
||||
{
|
||||
$frm = e107::getForm();
|
||||
|
||||
$folder['P'] = e_PLUGIN.$comp_name;
|
||||
$folder['T'] = e_THEME.$comp_name;
|
||||
$comp_dir = $folder[$mode];
|
||||
|
||||
$baselang = $this->get_comp_lan_phrases($comp_dir."/languages/","English",1);
|
||||
$check = $this->get_comp_lan_phrases($comp_dir."/languages/",$target_lan,1);
|
||||
|
||||
$text = "";
|
||||
$keys = array_keys($baselang);
|
||||
sort($keys);
|
||||
|
||||
$i = 0;
|
||||
foreach($keys as $k)
|
||||
{
|
||||
$lnk = $k;
|
||||
//echo "klucz ".$k."<br />";
|
||||
$k_check = str_replace("English",$target_lan,$k);
|
||||
$text .= "
|
||||
<tr>
|
||||
";
|
||||
if(array_key_exists($k_check,$check))
|
||||
{
|
||||
$text .= "
|
||||
<td>".$comp_name."</td>
|
||||
<td>".str_replace("English/","",$lnk)."</td>
|
||||
";
|
||||
|
||||
$subkeys = array_keys($baselang[$k]);
|
||||
$er = "";
|
||||
$utf_error = "";
|
||||
|
||||
$bomkey = str_replace(".php","",$k_check);
|
||||
$bom_error = ($check['bom'][$bomkey]) ? "<span class='error'><em>".LAN_CHECK_15."</em></span><br />" : ""; // illegal chars
|
||||
|
||||
foreach($subkeys as $sk)
|
||||
{
|
||||
if($utf_error == "" && !$this->is_utf8($check[$k_check][$sk]))
|
||||
{
|
||||
$utf_error = "<span class='error'><em>".LAN_CHECK_19."</em></span><br />";
|
||||
}
|
||||
|
||||
if(!array_key_exists($sk,$check[$k_check]) || (trim($check[$k_check][$sk]) == "" && $baselang[$k][$sk] != ""))
|
||||
{
|
||||
$er .= ($er) ? "<br />" : "";
|
||||
$er .= $sk." ".LAN_CHECK_5;
|
||||
$this->error_count++;
|
||||
}
|
||||
}
|
||||
|
||||
$style = ($er) ? "warning" : "success";
|
||||
$text .= "
|
||||
<td class='{$style}' style='width:50%'>
|
||||
<div class='smalltext'>
|
||||
";
|
||||
$text .= $bom_error . $utf_error;
|
||||
$text .= (!$er && !$bom_error && !$utf_error) ? LAN_OK : $er."<br />";
|
||||
$text .= "
|
||||
</div>
|
||||
</td>
|
||||
";
|
||||
}
|
||||
else
|
||||
{
|
||||
$text .= "
|
||||
<td>".$comp_name."</td>
|
||||
<td>".str_replace("English/","",$lnk)."</td>
|
||||
<td><span class='error' style='cursor:pointer' title='".str_replace("English",$target_lan,$lnk)."'>".LAN_CHECK_4."</span></td>
|
||||
";
|
||||
$this->error_count++;
|
||||
}
|
||||
|
||||
$text .="
|
||||
<td class='center'>
|
||||
".$frm->admin_button('but-corelan-'.str_replace(array('/', '\\'), '-', $comp_dir).$i, LAN_EDIT, 'edit', '', array('other'=> "onclick=\"window.location='".e_SELF."?".$comp_dir."/languages/".$lnk."|".$target_lan."|file'\""))."
|
||||
";
|
||||
$text .="
|
||||
</td>
|
||||
</tr>
|
||||
";
|
||||
$i++;
|
||||
}
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
function edit_lanfiles($dir1,$dir2,$f1,$f2){
|
||||
global $e107, $lan;
|
||||
$mes = e107::getMessage();
|
||||
$ns = e107::getRender();
|
||||
|
||||
// echo "<br />dir1 = $dir1";
|
||||
//echo "<br />file1 = $f1";
|
||||
|
||||
//echo "<br />dir2 = $dir2";
|
||||
//echo "<br />file2 = $f2";
|
||||
|
||||
if($dir2.$f2 == e_LANGUAGEDIR.$lan."/English.php") // it's a language config file.
|
||||
{
|
||||
$f2 = $lan.".php";
|
||||
$root_file = e_LANGUAGEDIR.$lan."/".$lan.".php";
|
||||
}
|
||||
else
|
||||
{
|
||||
$root_file = $dir2.$f2;
|
||||
}
|
||||
|
||||
if($dir2.$f2 == e_LANGUAGEDIR.$lan."/English_custom.php") // it's a language config file.
|
||||
{
|
||||
$f2 = $lan."_custom.php";
|
||||
$root_file = e_LANGUAGEDIR.$lan."/".$lan."_custom.php";
|
||||
}
|
||||
|
||||
|
||||
$writable = (is_writable($dir2)) ? TRUE : FALSE;
|
||||
$trans = $this->get_lan_file_phrases($dir1,$dir2,$f1,$f2);
|
||||
$keys = array_keys($trans);
|
||||
sort($keys);
|
||||
|
||||
$text = "
|
||||
<form method='post' action='".e_SELF."?".e_QUERY."' id='transform'>
|
||||
<fieldset id='core-lancheck-edit'>
|
||||
<legend>".LAN_CHECK_3." ".str_replace(array(e_PLUGIN, e_LANGUAGEDIR), array(e_PLUGIN_ABS, e_LANGUAGEDIR_ABS), $dir2)."{$f2} -> {$lan}</legend>
|
||||
<table class='table table-striped'>
|
||||
<colgroup>
|
||||
<col style='width: 20%' />
|
||||
<col style='width: 40%' />
|
||||
<col style='width: 40%' />
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th>".LAN_CHECK_16."</th>
|
||||
<th class='last'>Translate to ".$lan."</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
";
|
||||
|
||||
$subkeys = array_keys($trans['orig']);
|
||||
foreach($subkeys as $sk)
|
||||
{
|
||||
$rowamount = round(strlen($trans['orig'][$sk])/34)+1;
|
||||
$hglt1=""; $hglt2="";
|
||||
if ($trans['tran'][$sk] == "" && $trans['orig'][$sk]!="") {
|
||||
$hglt1="<span class='error'>";
|
||||
$hglt2="</span>";
|
||||
}
|
||||
$text .= "
|
||||
<tr>
|
||||
<td>".$hglt1.htmlentities($sk).$hglt2."</td>
|
||||
<td>".htmlentities(str_replace("ndef++", "", $trans['orig'][$sk])) ."</td>
|
||||
<td>
|
||||
".(($writable) ? "<textarea class='input-xxlarge' name='newlang[]' rows='{$rowamount}' cols='45'>" : "")
|
||||
.str_replace("ndef++","",$trans['tran'][$sk])
|
||||
.(($writable) ? "</textarea>" : "")."
|
||||
";
|
||||
//echo "orig --> ".$trans['orig'][$sk]."<br />";
|
||||
if (strpos($trans['orig'][$sk],"ndef++") !== False)
|
||||
{
|
||||
//echo "+orig --> ".$trans['orig'][$sk]." <> ".strpos($trans['orig'][$sk],"ndef++")."<br />";
|
||||
$text .= "
|
||||
<input type='hidden' name='newdef[]' value='ndef++".$sk."' />
|
||||
";
|
||||
}
|
||||
else
|
||||
{
|
||||
$text .= "
|
||||
<input type='hidden' name='newdef[]' value='".$sk."' />
|
||||
";
|
||||
}
|
||||
$text .="
|
||||
</td>
|
||||
</tr>
|
||||
";
|
||||
}
|
||||
$text .= "
|
||||
</tbody>
|
||||
</table>
|
||||
";
|
||||
//Check if directory is writable
|
||||
if($writable)
|
||||
{
|
||||
//FIXME place of LAN_SAVE
|
||||
$text .="
|
||||
<div class='buttons-bar center'>
|
||||
<button class='update btn btn-success' type='submit' name='submit' value='sprintXXf'><span>".LAN_SAVE." ".str_replace($dir2, "", $root_file)."</span></button>
|
||||
".(($root_file) ? "<input type='hidden' name='root' value='".$root_file."' />" : "")."
|
||||
</div>
|
||||
";
|
||||
}
|
||||
|
||||
$text .= "
|
||||
</fieldset>
|
||||
</form>
|
||||
";
|
||||
|
||||
$text .= "
|
||||
<form method='post' action='".e_SELF."' id='select_lang'>
|
||||
<div style='text-align:center'>
|
||||
".((!$writable) ? $dir2.$f2.LAN_NOTWRITABLE : "")."
|
||||
<br />
|
||||
<button class='submit btn' type='submit' name='language_sel' value='no-value'><span>".LAN_BACK."</span></button>
|
||||
<input type='hidden' name='language' value='$lan' />
|
||||
</div>
|
||||
</form>
|
||||
";
|
||||
|
||||
$ns->tablerender(LAN_CHECK_PAGE_TITLE.' - '.LAN_CHECK_24, $text);
|
||||
require_once(e_ADMIN."footer.php");
|
||||
exit;
|
||||
|
||||
}
|
||||
|
||||
function fill_phrases_array($data,$type) {
|
||||
|
||||
$retloc = array();
|
||||
|
||||
foreach($data as $line){
|
||||
//echo "line--> ".$line."<br />";
|
||||
if (strpos($line,"define(") !== FALSE && strpos($line,");") === FALSE)
|
||||
{
|
||||
$indef=1;
|
||||
$bigline="";
|
||||
// echo "big1 -->".$line."<br />";
|
||||
}
|
||||
if ($indef)
|
||||
{
|
||||
$bigline.=str_replace("\n","",$line);
|
||||
// echo "big2 -->".$line."<br />";
|
||||
}
|
||||
if (strpos($line,"define(") === FALSE && strpos($line,");") !== FALSE)
|
||||
{
|
||||
$indef=0;
|
||||
$we_have_bigline=1;
|
||||
// echo "big3 -->".$line."<br />";
|
||||
}
|
||||
|
||||
if(strpos($line,"setlocale(") !== FALSE)
|
||||
{
|
||||
$indef=1;
|
||||
$we_have_bigline=0;
|
||||
}
|
||||
|
||||
if ((strpos($line,"define(") !== FALSE && strpos($line,");") !== FALSE && substr(ltrim($line),0,2) != "//") || $we_have_bigline || strpos($line,"setlocale(") !== FALSE)
|
||||
{
|
||||
|
||||
if ($we_have_bigline)
|
||||
{
|
||||
$we_have_bigline=0;
|
||||
$line=$bigline;
|
||||
// echo "big -->".$line."<br />";
|
||||
}
|
||||
$ndef = "";
|
||||
//echo "_ndefline -->".$line."<br />";
|
||||
if (strpos($line,"defined(") !== FALSE )
|
||||
{
|
||||
$ndef = "ndef++";
|
||||
$line = substr($line,strpos($line,"define("));
|
||||
}
|
||||
|
||||
if(strpos($line,"setlocale(") !== FALSE)
|
||||
{
|
||||
$pos = substr(strstr($line,","),1);
|
||||
$rep = array(");","\n",'""');
|
||||
$val = str_replace($rep,"",$pos);
|
||||
$retloc[$type]['LC_ALL']= $val;
|
||||
// $retloc['orig']['LC_ALL']= "'en'";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
//echo "ndefline: ".$line."<br />";
|
||||
if(preg_match("#\"(.*?)\".*?\"(.*)\"#",$line,$matches) ||
|
||||
preg_match("#\'(.*?)\'.*?\"(.*)\"#",$line,$matches) ||
|
||||
preg_match("#\"(.*?)\".*?\'(.*)\'#",$line,$matches) ||
|
||||
preg_match("#\'(.*?)\'.*?\'(.*)\'#",$line,$matches) ||
|
||||
preg_match("#\((.*?)\,.*?\"(.*)\"#",$line,$matches) ||
|
||||
preg_match("#\((.*?)\,.*?\'(.*)\'#",$line,$matches))
|
||||
{
|
||||
//echo "get_lan -->".$matches[1]." :: ".$ndef.$matches[2]."<br />";
|
||||
if(!isset($retloc[$type][$matches[1]]))
|
||||
{
|
||||
$retloc[$type][$matches[1]]= $ndef.$matches[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $retloc;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
|
||||
function is_utf8($str) {
|
||||
// @see http://hsivonen.iki.fi/php-utf8/ validation.php
|
||||
|
||||
//@TODO: always TRUE
|
||||
// if(strtolower(CHARSET) != "utf-8" || $str == "")
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return (preg_match('/^.{1}/us',$str,$ar) == 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
/*
|
||||
function lancheck_adminmenu()
|
||||
{
|
||||
|
||||
include_lan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_language.php");
|
||||
|
||||
global $action;
|
||||
$pref = e107::getPref();
|
||||
|
||||
if ($action == "") {
|
||||
$action = "tools";
|
||||
}
|
||||
|
||||
if($action == "modify")
|
||||
{
|
||||
$action = "db";
|
||||
}
|
||||
$var['main']['text'] = LAN_PREFS;
|
||||
$var['main']['link'] = e_ADMIN_ABS."language.php";
|
||||
|
||||
if(isset($pref['multilanguage']) && $pref['multilanguage']){
|
||||
$var['db']['text'] = LANG_LAN_03;
|
||||
$var['db']['link'] = e_ADMIN_ABS."language.php?db";
|
||||
}
|
||||
|
||||
$var['tools']['text'] = ADLAN_CL_6;
|
||||
$var['tools']['link'] = e_ADMIN_ABS."language.php?tools";
|
||||
|
||||
|
||||
e107::getNav()->admin(ADLAN_132, $action, $var);
|
||||
}
|
||||
|
||||
$ns->tablerender(LAN_CHECK_PAGE_TITLE.' - '.LAN_CHECK_1, LAN_CHECK_26);
|
||||
require_once(e_ADMIN."footer.php");
|
||||
*/
|
||||
|
||||
|
||||
|
@ -121,6 +121,7 @@ $e_sub_cat = 'language';
|
||||
'noLanguageSubs' => array('title'=> LANG_LAN_26, 'type'=>'boolean', 'data'=>'int', 'help'=> LANG_LAN_27),
|
||||
'multilanguage_subdomain' => array('title'=> LANG_LAN_18, 'type'=>'textarea', 'data'=>'str', 'help'=> LANG_LAN_19, 'writeParms'=>array('rows'=>3)),
|
||||
'multilanguage_domain' => array('title'=> LANG_LAN_106, 'type'=>'method', 'data'=>'str', 'help'=> LANG_LAN_19),
|
||||
'multilanguage_verify_errorsonly' => array('title'=> LANG_LAN_33, 'type'=>'boolean', 'data' => 'int','help'=>''),
|
||||
|
||||
);
|
||||
|
||||
@ -157,9 +158,10 @@ $e_sub_cat = 'language';
|
||||
|
||||
function toolsPage()
|
||||
{
|
||||
|
||||
$pref = e107::getPref();
|
||||
$lck = e107::getSingleton('lancheck', e_ADMIN."lancheck.php");
|
||||
|
||||
$lck->errorsOnly($pref['multilanguage_verify_errorsonly']);
|
||||
// show_packs();
|
||||
|
||||
if($return = $lck->init())
|
||||
@ -786,27 +788,6 @@ if (isset($_POST['create_tables']) && $_POST['language'])
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
if (varset($_POST['ziplang']) && varset($_POST['language']))
|
||||
{
|
||||
if(varset($pref['lancheck'][$_POST['language']]) == 1)
|
||||
{
|
||||
$text = zip_up_lang($_POST['language']);
|
||||
e107::getLog()->add('LANG_04', $_POST['language'], E_LOG_INFORMATIVE, '');
|
||||
$mes->addInfo(LANG_LAN_25.': '.$text);
|
||||
}
|
||||
else
|
||||
{
|
||||
$mes->addWarning(LANG_LAN_36);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// imported from e107 v1
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1042,173 +1023,9 @@ function multilang_prefs()
|
||||
e107::getRender()->tablerender(ADLAN_132.SEP.LAN_PREFS, $mes->render().$text); // "Language Preferences";
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// ------------- render form ---------------------------------------------------
|
||||
|
||||
|
||||
function multilang_db()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function show_tools()
|
||||
{
|
||||
|
||||
// include_lan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_lancheck.php");
|
||||
|
||||
|
||||
/*
|
||||
$text = "
|
||||
<form id='core-language-lancheck-form' method='post' action='".e_SELF."?tools'>
|
||||
<fieldset id='core-language-lancheck'>
|
||||
<legend class='e-hideme'>".LAN_CHECK_1."</legend>
|
||||
<table class='table adminform'>
|
||||
<colgroup>
|
||||
<col class='col-label' />
|
||||
<col class='col-control' />
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>".LAN_CHECK_1."</td>
|
||||
<td class='form-inline'>
|
||||
<select name='language'>
|
||||
<option value=''>".LAN_SELECT."</option>";
|
||||
$languages = explode(",", e_LANLIST);
|
||||
sort($languages);
|
||||
foreach ($languages as $lang)
|
||||
{
|
||||
if ($lang != "English")
|
||||
{
|
||||
$text .= "
|
||||
<option value='{$lang}' >{$lang}</option>
|
||||
";
|
||||
}
|
||||
}
|
||||
$text .= "</select>".
|
||||
$frm->admin_button('language_sel','no-value','other',LAN_CHECK_2)."
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</fieldset>
|
||||
</form>";
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
function language_adminmenu()
|
||||
{
|
||||
$pref = e107::getPref();
|
||||
|
||||
$action = e_QUERY;
|
||||
|
||||
if ($action == "")
|
||||
{
|
||||
$action = getperms('0') ? "main" : "tools";
|
||||
}
|
||||
if ($_GET['mode'] == 'db')
|
||||
{
|
||||
$action = "db";
|
||||
}
|
||||
|
||||
if($_GET['mode'] == 'tools')
|
||||
{
|
||||
$action = 'tools';
|
||||
}
|
||||
|
||||
if(getperms('0'))
|
||||
{
|
||||
$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."?mode=db";
|
||||
}
|
||||
}
|
||||
|
||||
// $lcnt = explode(",", e_LANLIST);
|
||||
// if (count($lcnt) > 1)
|
||||
// {
|
||||
$var['tools']['text'] = LANG_LAN_21;
|
||||
$var['tools']['link'] = e_SELF."?mode=tools";
|
||||
// }
|
||||
e107::getNav()->admin(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();
|
||||
|
||||
|
||||
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)."<a href='".$newfile."' >".basename($newfile)."</a>).";
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
// -----------------------
|
||||
|
||||
|
||||
|
||||
|
||||
class lanDeveloper
|
||||
@ -1285,15 +1102,21 @@ class lanDeveloper
|
||||
|
||||
//$lanfile = $this->findIncludedFiles($script,vartrue($_POST['deprecatedLansReverse']));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(!is_readable($script))
|
||||
foreach($script as $scr)
|
||||
{
|
||||
// $mes->addError("Not Readable: ".$script);
|
||||
// $script = $scriptname; // matching files. lan_xxxx.php and xxxx.php
|
||||
if(!is_readable($scr))
|
||||
{
|
||||
$mes->addError("Not Readable: ".$scr);
|
||||
// $script = $scriptname; // matching files. lan_xxxx.php and xxxx.php
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// $found = $this->findIncludedFiles($script,vartrue($_POST['deprecatedLansReverse']));
|
||||
|
||||
// print_a($found);
|
||||
@ -1357,7 +1180,7 @@ class lanDeveloper
|
||||
|
||||
if($script == true)
|
||||
{
|
||||
return array('define'=>$line,'value'=>'unknown');
|
||||
return array('define'=>$line,'value'=>'-');
|
||||
}
|
||||
|
||||
if(preg_match("#\"(.*?)\".*?\"(.*)\"#",$line,$match) ||
|
||||
@ -1411,7 +1234,7 @@ class lanDeveloper
|
||||
<tr>
|
||||
<td>Search for Deprecated Lans</td>
|
||||
<td class='form-inline'>
|
||||
<select name='deprecatedLans[]' multiple>
|
||||
<select name='deprecatedLans[]' multiple style='height:200px'>
|
||||
<option value=''>Select Script...</option>";
|
||||
|
||||
|
||||
@ -1425,20 +1248,6 @@ class lanDeveloper
|
||||
$srch = array(e_ADMIN,e_PLUGIN, e_BASE);
|
||||
|
||||
|
||||
$text .= "<optgroup label='Root'>";
|
||||
foreach($root as $script=>$lan)
|
||||
{
|
||||
if(in_array(basename($lan),$exclude))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$selected = (in_array($lan, $_POST['deprecatedLans'])) ? "selected='selected'" : "";
|
||||
$text .= "<option value='".$lan."' {$selected}>".str_replace($srch,"",$lan)."</option>\n";
|
||||
}
|
||||
|
||||
$text .= "</optgroup>";
|
||||
|
||||
|
||||
$text .= "<optgroup label='Admin Area'>";
|
||||
foreach($lans as $script=>$lan)
|
||||
{
|
||||
@ -1446,13 +1255,29 @@ class lanDeveloper
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$selected = (in_array($lan, $_POST['deprecatedLans'])) ? "selected='selected'" : "";
|
||||
$selected = (!empty($_POST['deprecatedLans']) && in_array($lan, $_POST['deprecatedLans'])) ? "selected='selected'" : "";
|
||||
$text .= "<option value='".$lan."' {$selected}>".str_replace('../e107_',"",$lan)."</option>\n";
|
||||
}
|
||||
|
||||
$text .= "</optgroup>";
|
||||
|
||||
$text .= "<optgroup label='Root'>";
|
||||
foreach($root as $script=>$lan)
|
||||
{
|
||||
if(in_array(basename($lan),$exclude))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$selected = (!empty($_POST['deprecatedLans']) && in_array($lan, $_POST['deprecatedLans'])) ? "selected='selected'" : "";
|
||||
$text .= "<option value='".$lan."' {$selected}>".str_replace($srch,"",$lan)."</option>\n";
|
||||
}
|
||||
|
||||
$text .= "</optgroup>";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$depOptions = array(
|
||||
1 => "Script > Lan File",
|
||||
0 => "Script < Lan File"
|
||||
@ -1468,7 +1293,7 @@ class lanDeveloper
|
||||
|
||||
|
||||
$prev = 'Core';
|
||||
$text .= "<select name='deprecatedLanFile[]' multiple>
|
||||
$text .= "<select name='deprecatedLanFile[]' multiple style='height:200px'>
|
||||
|
||||
";
|
||||
|
||||
@ -1482,7 +1307,7 @@ class lanDeveloper
|
||||
}
|
||||
|
||||
|
||||
$selected = (in_array($val, $_POST['deprecatedLanFile'])) ? "selected='selected'" : "";
|
||||
$selected = (!empty($_POST['deprecatedLanFile']) && in_array($val, $_POST['deprecatedLanFile'])) ? "selected='selected'" : "";
|
||||
$diz = str_replace($search,$replace,$val);
|
||||
list($type,$label) = explode(" ",$diz);
|
||||
|
||||
@ -1547,9 +1372,42 @@ class lanDeveloper
|
||||
|
||||
|
||||
|
||||
function isFound($needle, $haystack)
|
||||
{
|
||||
$found = array();
|
||||
|
||||
foreach($haystack as $file => $content)
|
||||
{
|
||||
$count = 1;
|
||||
$lines = explode("\n",$content);
|
||||
foreach($lines as $ln)
|
||||
{
|
||||
if(preg_match("/\b".$needle."\b/i",$ln, $mtch))
|
||||
{
|
||||
$found[$file]['count'][] = $count;
|
||||
$found[$file]['line'][] = $ln;
|
||||
}
|
||||
$count++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!empty($found))
|
||||
{
|
||||
return $found;
|
||||
}
|
||||
|
||||
return false;
|
||||
// print_a($haystack);
|
||||
|
||||
}
|
||||
|
||||
|
||||
function compareit($needle,$haystack, $value='',$disabled=false, $reverse=false)
|
||||
{
|
||||
|
||||
$found = $this->isFound($needle, $haystack);
|
||||
|
||||
// return "Need=".$needle."<br />hack=".$haystack."<br />val=".$val;
|
||||
$foundSimilar = FALSE;
|
||||
$foundCommon = FALSE;
|
||||
@ -1583,48 +1441,45 @@ class lanDeveloper
|
||||
$text2 = '';
|
||||
|
||||
|
||||
foreach($haystack as $script)
|
||||
foreach($haystack as $file=>$script)
|
||||
{
|
||||
$lines = explode("\n",$script);
|
||||
// $lines = explode("\n",$script);
|
||||
|
||||
$text .= "<td>";
|
||||
$text2 .= ($reverse == true) ? "<td>" : "";
|
||||
// $text2 .= ($reverse == true) ? "<td>" : "";
|
||||
|
||||
$count = 1;
|
||||
foreach($lines as $ln)
|
||||
if(!empty($found[$file]['count']))
|
||||
{
|
||||
if(preg_match("/\b".$needle."\b/i",$ln, $mtch))
|
||||
if($disabled)
|
||||
{
|
||||
if($disabled)
|
||||
{
|
||||
$text .= ADMIN_WARNING_ICON;
|
||||
$label = " <span class='label label-important'>Must be re-enabled</span>";
|
||||
$this->errors++;
|
||||
// $text .= "blabla";
|
||||
$text .= ADMIN_WARNING_ICON;
|
||||
$label = " <span class='label label-important'>Must be re-enabled</span>";
|
||||
$this->errors++;
|
||||
// $text .= "blabla";
|
||||
// $class = 'alert alert-warning';
|
||||
}
|
||||
elseif($reverse == true)
|
||||
}
|
||||
elseif($reverse == true)
|
||||
{
|
||||
$value = ADMIN_TRUE_ICON;
|
||||
$value .= " Line:<b>".implode(", ",$found[$file]['count']) ."</b> "; // "' Found";
|
||||
foreach($found[$file]['line'] as $defLine)
|
||||
{
|
||||
$text .= ADMIN_TRUE_ICON;
|
||||
$text .= print_a($defLine, true);
|
||||
}
|
||||
|
||||
$text .= " Line:<b>".$count."</b> "; // "' Found";
|
||||
|
||||
if($reverse == true)
|
||||
{
|
||||
$text2 .= print_a($ln,true);
|
||||
}
|
||||
$found = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$text .= " Line:<b>".implode(", ",$found[$file]['count']) ."</b> "; // "' Found";
|
||||
}
|
||||
|
||||
$count++;
|
||||
}
|
||||
|
||||
|
||||
if($reverse == true && in_array($needle,$commonArray))
|
||||
{
|
||||
$found = false;
|
||||
$text = "<td>";
|
||||
$text2 = "<td>";
|
||||
|
||||
}
|
||||
|
||||
if(empty($found))
|
||||
@ -1637,16 +1492,16 @@ class lanDeveloper
|
||||
// print_a($needle);
|
||||
//$color = "background-color:#E9EAF2";
|
||||
$class = '';
|
||||
$text .= ADMIN_TRUE_ICON;
|
||||
$value = "<span class='label label-success'>".LANG_LAN_130."</span>"; // Common Term.
|
||||
$value = ADMIN_TRUE_ICON;
|
||||
$label = "<span class='label label-success'>".LANG_LAN_130."</span>"; // Common Term.
|
||||
}
|
||||
else
|
||||
{
|
||||
// $color = "background-color:yellow";
|
||||
$text .= "<a href='#' title=\"Missing\">".ADMIN_WARNING_ICON."</a>";
|
||||
$value = "<a href='#' title=\"Missing\">".ADMIN_WARNING_ICON."</a>";
|
||||
$this->errors++;
|
||||
$value = LANG_LAN_131;
|
||||
$class = "alert alert-warning";
|
||||
$label = "<span class='label label-important label-error'>".LANG_LAN_131."</span>";
|
||||
// $class = "alert alert-warning";
|
||||
}
|
||||
|
||||
}
|
||||
@ -1665,7 +1520,7 @@ class lanDeveloper
|
||||
}
|
||||
}
|
||||
$text .= "</td>";
|
||||
$text2 .= ($reverse == true) ? "</td>" : "";
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1697,7 +1552,7 @@ class lanDeveloper
|
||||
// $needle = "<span class='e-tip' style='cursor:help' title=\"".$value."\">".$needle."</span>";
|
||||
}
|
||||
|
||||
return "<tr><td class='".$class."' style='width:15%;$color'>".$needle .$label. "</td>
|
||||
return "<tr><td class='".$class."' style='width:15%;$color'>".$needle ."</td><td>".$label. "</td>
|
||||
<td class='".$class."'>".print_r($value,true)."</td>
|
||||
".$text.$text2."</tr>";
|
||||
}
|
||||
@ -1724,10 +1579,13 @@ class lanDeveloper
|
||||
|
||||
if($reverse == true)
|
||||
{
|
||||
|
||||
$exclude = array("e_LANGUAGE","e_LANGUAGEDIR","e_LAN","e_LANLIST","e_LANCODE", "LANGUAGES_DIRECTORY");
|
||||
|
||||
$data = file_get_contents($script);
|
||||
$mes->addDebug("REVERSE MODE ");
|
||||
$exclude = array("e_LANGUAGE","e_LANGUAGEDIR","e_LAN","e_LANLIST","e_LANCODE", "LANGUAGES_DIRECTORY", "e_LANGUAGEDIR_ABS", "LAN");
|
||||
$data = '';
|
||||
foreach($script as $d)
|
||||
{
|
||||
$data .= file_get_contents($d)."\n";
|
||||
}
|
||||
|
||||
if(preg_match_all("/([\w_]*LAN[\w_]*)/", $data, $match))
|
||||
{
|
||||
@ -1755,7 +1613,7 @@ class lanDeveloper
|
||||
|
||||
if(!file_exists($scr))
|
||||
{
|
||||
$mes->addError(LANG_LAN_121." ".$scr);
|
||||
$mes->addError("reverse Mode: ".LANG_LAN_121." ".$scr);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1768,6 +1626,7 @@ class lanDeveloper
|
||||
}
|
||||
else
|
||||
{
|
||||
$mes->addDebug("NORMAL MODE ");
|
||||
$lanDefines = '';
|
||||
foreach($lanfile as $arr)
|
||||
{
|
||||
@ -1781,7 +1640,7 @@ class lanDeveloper
|
||||
{
|
||||
if(!file_exists($scr))
|
||||
{
|
||||
$mes->addError(LANG_LAN_121." ".$scr);
|
||||
$mes->addError("Normal mode: ".LANG_LAN_121." ".$scr);
|
||||
continue;
|
||||
}
|
||||
$compare[$scr] = file_get_contents($scr);
|
||||
@ -1796,12 +1655,12 @@ class lanDeveloper
|
||||
|
||||
if(!$compare)
|
||||
{
|
||||
$mes->addError(LANG_LAN_121." ".$script);
|
||||
$mes->addError("Line ".__LINE__.": ".LANG_LAN_121." ".$script);
|
||||
}
|
||||
|
||||
if(!$lanDefines)
|
||||
{
|
||||
$mes->addError(LANG_LAN_121." ".$lanfile);
|
||||
$mes->addError("Line ".__LINE__.": ".LANG_LAN_121." ".$lanfile);
|
||||
}
|
||||
|
||||
$srch = array("<?php","<?","?>");
|
||||
@ -1813,19 +1672,34 @@ class lanDeveloper
|
||||
$text = $frm->open('language-unused');
|
||||
$text .= "<table class='table adminlist table-striped table-bordered'>
|
||||
<colgroup>
|
||||
<col style='width:20%' />
|
||||
<col style='auto' />
|
||||
<col style='auto' />
|
||||
<col style='width:10%' />
|
||||
<col style='width:5%' />
|
||||
<col style='width:auto' />";
|
||||
|
||||
foreach($lanfile as $l)
|
||||
{
|
||||
$text .= "<col style='width:auto' />\n";
|
||||
}
|
||||
|
||||
$text .= "
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>".str_replace(e_LANGUAGEDIR,"",$lanfile)."</th><th>Value</th>";
|
||||
<th>".str_replace(e_LANGUAGEDIR,"",implode("<br />", $lanfile))."</th>
|
||||
<th>".LAN_STATUS."</th>";
|
||||
|
||||
if($reverse == false)
|
||||
{
|
||||
$text .= "<th>Value</th>";
|
||||
}
|
||||
|
||||
foreach($compare as $k=>$val)
|
||||
{
|
||||
$text .= "<th>".str_replace("../","",$k)."</th>";
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($reverse == true)
|
||||
{
|
||||
$text .= "<th>".LANG_LAN_124."</th>";
|
||||
@ -1843,10 +1717,11 @@ class lanDeveloper
|
||||
{
|
||||
if(trim($line) !="")
|
||||
{
|
||||
$disabled = (preg_match("#^//#i",$line)) ? " ".LANG_LAN_125 : false;
|
||||
$disabled = (preg_match("#^//#i",$line)) ? " (".LAN_DISABLED.")" : false;
|
||||
if($match = $this->getDefined($line,$reverse))
|
||||
{
|
||||
$text .= $this->compareit($match['define'], $compare, $match['value'], $disabled, $reverse);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1968,28 +1843,3 @@ class lanDeveloper
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Handle page DOM within the page header
|
||||
*
|
||||
* @return string JS source
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -6,26 +6,11 @@
|
||||
*
|
||||
*/
|
||||
|
||||
define("LAN_CHECK_1", "Verify/Edit Language-Pack Files"); // modified in 0.7.6
|
||||
define("LAN_CHECK_2", "Verify");
|
||||
define("LAN_CHECK_3", "Verification of");
|
||||
define("LAN_CHECK_4", "File missing!");
|
||||
define("LAN_CHECK_5", "Phrase missing!");
|
||||
|
||||
// define("LAN_CHECK_7", "phrase");
|
||||
|
||||
// define("LAN_CHECK_8", "A file is missing...");
|
||||
// define("LAN_CHECK_9", " files are missing...");
|
||||
// define("LAN_CHECK_10", "Critical error: ");
|
||||
// define("LAN_CHECK_11", "No files missing !");
|
||||
// define("LAN_CHECK_12", "A file is wrong...");
|
||||
// define("LAN_CHECK_13", " files are wrong...");
|
||||
// define("LAN_CHECK_14", "All existing files are valid !");
|
||||
|
||||
|
||||
// v1.0
|
||||
|
||||
// define("LAN_CHECK_15", "Illegal characters or spaces found before '<?php' or after '?>'");
|
||||
define("LAN_CHECK_15", "Illegal characters or spaces found before [x] or after [y]");
|
||||
define("LAN_CHECK_16", "Original File");
|
||||
define("LAN_CHECK_17", "A write problem occured while trying to save the file.");
|
||||
define("LAN_CHECK_18", "Language files in the standard format are NOT available for this plugin/theme.");
|
||||
@ -36,24 +21,21 @@ define("LAN_CHECK_22", "Theme");
|
||||
define("LAN_CHECK_23", "Errors Found");
|
||||
define("LAN_CHECK_24", "Summary");
|
||||
define("LAN_CHECK_25", "Themes");
|
||||
define("LAN_CHECK_26", "File");
|
||||
|
||||
// v2.0
|
||||
|
||||
define("LAN_CHECK_15", "Illegal characters found before [php]"); // [php] is automatically replaced, do not edit!
|
||||
|
||||
|
||||
//define("LAN_CHECK_20", "File");
|
||||
//define("LAN_CHECK_21", "Theme");
|
||||
//define("LAN_CHECK_22", "Themes");
|
||||
|
||||
//define("LAN_CHECK_23", "[x] saved"); // [x] is automatically replaced, do not edit!
|
||||
|
||||
define("LAN_CHECK_PAGE_TITLE", "Languages");
|
||||
//define("LAN_CHECK_24", "Edit/Create file");
|
||||
//define("LAN_CHECK_25", "Language verification");
|
||||
//define("LAN_CHECK_26", "No data");
|
||||
define("LAN_CHECK_27", "Number of language-pack errors found");
|
||||
define("LANG_LAN_30", "Release Date");
|
||||
define("LANG_LAN_31", "Compatibility");
|
||||
define("LANG_LAN_35", "The following language packs are available for this version of e107.");
|
||||
define("LANG_LAN_111", "Release-date");
|
||||
define("LANG_LAN_112", "Compatible");
|
||||
define("LANG_LAN_114", "Download Pack");
|
||||
define("LANG_LAN_115", "Please verify and correct the remaining [x] error(s) before attempting to create a language-pack.");
|
||||
define("LANG_LAN_116", "Please verify your language files ('Verify') then try again.");
|
||||
define("LANG_LAN_117", "You should correct the remaining errors before contributing your language pack.");
|
||||
define("LANG_LAN_119", "Please check that CORE_LC and CORE_LC2 have values in [x] and try again.");
|
||||
define("LANG_LAN_120", "Please make sure you are using default folder names in e107_config.php (eg. e107_languages/, e107_plugins/ etc.) and try again.");
|
||||
|
||||
define("LANG_LAN_AGR", "Note: By using these tools you agree to share your language pack(s) with the e107 community.");
|
||||
|
||||
|
||||
?>
|
@ -15,7 +15,6 @@ define("LANG_LAN_05", "Not Installed");
|
||||
define("LANG_LAN_06", "Create tables");
|
||||
define("LANG_LAN_07", "Drop existing tables?");
|
||||
define("LANG_LAN_08", "Replace existing tables (data will be lost).");
|
||||
// define("LANG_LAN_10", "Confirm delete");
|
||||
define("LANG_LAN_11", "Delete unchecked tables above (if they exist).");
|
||||
define("LANG_LAN_12", "Multi-Language Database Tables");
|
||||
define("LANG_LAN_13", "Language Preferences");
|
||||
@ -28,65 +27,26 @@ define("LANG_LAN_19", "e.g. The domain fr.mydomain.com would set the language to
|
||||
define("LANG_LAN_20", "Enter one domain per line. eg. mydomain.com etc. or leave blank to disable.");
|
||||
|
||||
define("LANG_LAN_21", "Language-Packs");
|
||||
define("LANG_LAN_22", "Language Pack created successfully.");
|
||||
define("LANG_LAN_23", "Create Language-Pack (zip)");
|
||||
define("LANG_LAN_24", "Generate");
|
||||
define("LANG_LAN_25", "Language-Pack Creation Status");
|
||||
define("LANG_LAN_26", "Load language files only for current language");
|
||||
define("LANG_LAN_27", "If checked, and a required language cannot be found, there will be an error");
|
||||
|
||||
define("LANG_LAN_PAGE_TITLE", "Languages");
|
||||
|
||||
define("LANG_LAN_AGR", "Note: By using these tools you agree to share your language pack(s) with the e107 community.");
|
||||
define("LANG_LAN_EML", "Please email your language pack to:");
|
||||
|
||||
|
||||
define("LANG_LAN_29", "You should correct the remaining errors before contributing your language pack.");
|
||||
define("LANG_LAN_30", "Release Date");
|
||||
define("LANG_LAN_31", "Compatibility");
|
||||
define("LANG_LAN_32", "Installed Languages");
|
||||
define("LANG_LAN_33", "Display only errors during verification");
|
||||
define("LANG_LAN_34", "Please verify and correct the remaining [x] error(s) before attempting to create a language-pack.");
|
||||
|
||||
|
||||
// define("LANG_LAN_09", "Are you sure?");
|
||||
//define("LANG_LAN_34", "Available Language Packs");
|
||||
//define("LANG_LAN_35", "The following language packs are available for this version of e107.");
|
||||
//define("LANG_LAN_36", "Language-Pack errors found! Please first verify your language files are without errors, before creating a language-pack.");
|
||||
|
||||
define("LANG_LAN_50", "Admin-Area Interface Language");
|
||||
|
||||
// e107 v2
|
||||
|
||||
define("LANG_LAN_100", "[x] deleted.");
|
||||
define("LANG_LAN_101", "[x] could not be deleted.");
|
||||
define("LANG_LAN_103", "[x] created.");
|
||||
// define("LANG_LAN_31", "%s couldn\"t be deleted.");
|
||||
define("LANG_LAN_104", "[x] was disabled but left intact.");
|
||||
define("LANG_LAN_105", "Delete all tables in [x]?");
|
||||
|
||||
define("LANG_LAN_106", "Language by Domain Name");
|
||||
define("LANG_LAN_107", "Domain determines the site's language. Enter domain without the 'www.'");
|
||||
define("LANG_LAN_108", "Name");
|
||||
define("LANG_LAN_109", "Version");
|
||||
//define("LANG_LAN_110", "Author");//LAN_AUTHOR
|
||||
define("LANG_LAN_111", "Release-date");
|
||||
define("LANG_LAN_112", "Compatible");
|
||||
define("LANG_LAN_113", "Download");
|
||||
define("LANG_LAN_114", "Download Pack");
|
||||
define("LANG_LAN_115", "Please verify and correct the remaining [x] error(s) before attempting to create a language-pack.");
|
||||
define("LANG_LAN_116", "Please verify your language files ('Verify') then try again.");
|
||||
define("LANG_LAN_117", "You should correct the remaining errors before contributing your language pack.");
|
||||
define("LANG_LAN_118", ""); // Unused
|
||||
define("LANG_LAN_119", "Please check that CORE_LC and CORE_LC2 have values in [x] and try again.");
|
||||
define("LANG_LAN_120", "Please make sure you are using default folder names in e107_config.php (eg. e107_languages/, e107_plugins/ etc.) and try again.");
|
||||
|
||||
define("LANG_LAN_121", "Couldn't Load:");
|
||||
define("LANG_LAN_124", "Definition");
|
||||
define("LANG_LAN_125", "(disabled)");
|
||||
define("LANG_LAN_126", "Disable All Unused");
|
||||
define("LANG_LAN_127", "Pink items are likely to be unused LANs.");
|
||||
define("LANG_LAN_128", "Comment out and test thoroughly.");
|
||||
define("LANG_LAN_129", "Deprecated LAN Check (experimental!)");
|
||||
define("LANG_LAN_130", "Common Term");
|
||||
define("LANG_LAN_131", "Missing from language file");
|
||||
define("LANG_LAN_132", "is a common phrase.");
|
||||
|
Loading…
x
Reference in New Issue
Block a user