diff --git a/e107_admin/language.php b/e107_admin/language.php
index 6f52088c0..185268daf 100644
--- a/e107_admin/language.php
+++ b/e107_admin/language.php
@@ -188,28 +188,73 @@ if (varset($action) == "tools")
}
}
+
+ function findIncludedFiles($script)
+ {
+
+ $data = file_get_contents($script);
+
+ preg_match_all("/.*(include_lan|require_once|include|include_once) ?\((.*e_LANGUAGE.*?\.php)/i",$data,$match);
+
+
+ $srch = array(" ",'e_PLUGIN.', 'e_LANGUAGEDIR', '.e_LANGUAGE.', "'", '"', "'.");
+ $repl = array("", e_PLUGIN, e_LANGUAGEDIR, "English", "", "", "");
+
+ foreach($match[2] as $lanFile)
+ {
+ $arrt = str_replace($srch,$repl,$lanFile);
+ if(strpos($arrt,'admin'))
+ {
+ return $arrt;
+ }
+ }
+
+ return $arr[0];
+ }
+
+
if(varset($_POST['searchDeprecated']) && varset($_POST['deprecatedLans']))
{
$mes = e107::getMessage();
- $lanfile = $_POST['deprecatedLans'];
+ // $lanfile = $_POST['deprecatedLans'];
+ $script = $_POST['deprecatedLans'];
- $scriptname = str_replace("lan_","",basename($lanfile));
+// $scriptname = str_replace("lan_","",basename($lanfile));
- if(is_readable(e_ADMIN.$script))
+ if(strpos($script,'admin')!=true) // Plugin
{
- $script = e_ADMIN.$scriptname; // matching files. lan_xxxx.php and xxxx.php
+ $lanfile = e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_".basename($script);
}
+ else // admin area.
+ {
+ $lanfile = findIncludedFiles($script);
+ }
+
+ if(!is_readable($script))
+ {
+ $mes->addError("Not Readable: ".$script);
+ // $script = $scriptname; // matching files. lan_xxxx.php and xxxx.php
+ }
+
+ $found = findIncludedFiles($script);
+
+// print_a($found);
// Exceptions - same language loaded by several scripts.
if($lanfile == e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_e107_update.php")
{
$script = e_ADMIN."update_routines.php,".e_ADMIN."e107_update.php";
}
+
+ $mes->addDebug("LanFile: ".$lanfile);
+ $mes->addDebug("Script: ".$script);
+
if(is_readable($lanfile))
{
+ $mes->addDebug("Reading LanFile... ");
if($res = unused($lanfile,$script))
{
$ns -> tablerender($res['caption'],$mes->render(). $res['text']);
@@ -217,7 +262,8 @@ if(varset($_POST['searchDeprecated']) && varset($_POST['deprecatedLans']))
}
else
{
- // echo 'PROBLEM';
+ $mes->addDebug("Couldn't Read LanFile... ");
+ $ns -> tablerender($res['caption'],$mes->render(). $res['text']);
}
@@ -587,7 +633,7 @@ function show_tools()
}
}
$text .= "".
- $frm->admin_button('language_sel','no-value','update',LAN_CHECK_2)."
+ $frm->admin_button('language_sel','no-value','other',LAN_CHECK_2)."
@@ -623,7 +669,7 @@ function show_tools()
}
$text .= "
- ".$frm->admin_button('ziplang','no-value','update',LANG_LAN_24)."
+ ".$frm->admin_button('ziplang','no-value','other',LANG_LAN_24)."
Check to share your language-pack with the e107 community.
";
@@ -638,11 +684,15 @@ function show_tools()
$fl = e107::getFile();
$fl->mode = 'full';
- $lans = $fl->get_files(e_LANGUAGEDIR."English/admin");
-
- $exclude = array('lan_admin.php');
+ $omit = array('languages','\.png','\.gif');
+ $lans = $fl->get_files(e_ADMIN,'.php','standard',0);
+ $plugs = $fl->get_files(e_PLUGIN,'.*?/?admin.*?\.php',$omit,2);
+ $exclude = array('lan_admin.php');
+
+ $srch = array(e_ADMIN,e_PLUGIN);
+ $text .= "";
+
+ $text .= "";
+
+
$text .= "
- ".$frm->admin_button('searchDeprecated',"Check")."
+ ".$frm->admin_button('searchDeprecated',"Check",'other')."
+ ".(count($lans) + count($plugs))." files found
";
@@ -872,6 +939,11 @@ function grab_lans($path, $language, $filter = "")
*/
function unused($lanfile,$script)
{
+ $mes = e107::getMessage();
+
+// $mes->addInfo("LAN=".$lanfile."
Script = ".$script);
+
+
$lanDefines = file_get_contents($lanfile);
$tmp = explode(",",$script);
@@ -903,7 +975,11 @@ function unused($lanfile,$script)
if($lanDefines && $compare)
{
- $text = "
".$lanfile." | "; @@ -935,7 +1011,7 @@ function unused($lanfile,$script) $text .= "
---|