diff --git a/e107_admin/language.php b/e107_admin/language.php index e71093d0a..a41479236 100644 --- a/e107_admin/language.php +++ b/e107_admin/language.php @@ -190,6 +190,7 @@ if (varset($action) == "tools") function findIncludedFiles($script,$reverse=false) { + $mes = e107::getMessage(); $data = file_get_contents($script); @@ -306,9 +307,6 @@ if(varset($_POST['searchDeprecated']) && varset($_POST['deprecatedLans'])) // $lanfile = $_POST['deprecatedLans']; $script = $_POST['deprecatedLans']; - - - if(strpos($script,e_ADMIN)!==false) // CORE { $mes->addDebug("Mode: Core Admin Calculated"); @@ -336,6 +334,11 @@ if(varset($_POST['searchDeprecated']) && varset($_POST['deprecatedLans'])) { $script = e_ADMIN."update_routines.php,".e_ADMIN."e107_update.php"; } + + if(vartrue($_POST['deprecatedLanFile'])) //override. + { + $lanfile = $_POST['deprecatedLanFile']; + } if($res = unused($lanfile, $script, vartrue($_POST['deprecatedLansReverse']))) { @@ -703,8 +706,8 @@ function show_tools() ".LAN_CHECK_1." - - "; $languages = explode(",", e_LANLIST); sort($languages); @@ -738,8 +741,8 @@ function show_tools() ".LANG_LAN_23." - - "; $languages = explode(",", e_LANLIST); sort($languages); @@ -759,17 +762,25 @@ function show_tools() "; + $fl = e107::getFile(); + $fl->mode = 'full'; + + if(!$_SESSION['languageTools_lanFileList']) + { + + $_SESSION['languageTools_lanFileList'] = $fl->get_files(e_BASE,'.*?(English|lan_).*?\.php$','standard',5); + } + $text .= " Search for Deprecated Lans - - + "; - $fl = e107::getFile(); - $fl->mode = 'full'; - $omit = array('languages','\.png','\.gif','templates','handlers'); + + $omit = array('languages','\.png','\.gif','handlers'); $lans = $fl->get_files(e_ADMIN,'.php','standard',0); $fl->setFileFilter(array("^e_")); $plugs = $fl->get_files(e_PLUGIN,'.*?/?.*?\.php',$omit,2); @@ -806,15 +817,52 @@ function show_tools() $depOptions = array( - 0 => "Lan File > Script", - 1 => "Script > Lan File" + 1 => "Script > Lan File", + 0 => "Script < Lan File" + ); $text .= " - ". - $frm->select('deprecatedLansReverse',$depOptions,$_POST['deprecatedLansReverse']). - $frm->admin_button('searchDeprecated',"Check",'other')." - ".(count($lans) + count($plugs))." files found + ". + $frm->select('deprecatedLansReverse',$depOptions,$_POST['deprecatedLansReverse'],'class=select')." "; + + $search = array(e_PLUGIN,e_ADMIN,e_LANGUAGEDIR,e_THEME); + $replace = array("Plugins ","Admin ","Core ","Themes "); + + + $prev = 'Core'; + $text .= ""; + + // $frm->select('deprecatedLanFile',$_SESSION['languageTools_lanFileList'], $_POST['deprecatedLanFile'],'class=select&useValues=1','Select Language File (optional)'). + $text .= $frm->admin_button('searchDeprecated',"Check",'other'); + // $text .= "".(count($lans) + count($plugs))." files found"; + $text .= " "; @@ -1035,9 +1083,7 @@ function unused($lanfile,$script,$reverse=false) $mes = e107::getMessage(); $frm = e107::getForm(); - - unset($_SESSION['language-tools-unused']); // $mes->addInfo("LAN=".$lanfile."
Script = ".$script); @@ -1137,6 +1183,12 @@ function unused($lanfile,$script,$reverse=false) { $text .= "".$k.""; } + + if($reverse == true) + { + $text .= "Definition"; + } + $text .= " @@ -1175,9 +1227,11 @@ function unused($lanfile,$script,$reverse=false) $text .= $frm->close(); + if($reverse != true) + { + $mes->addInfo("Pink items are likely to be unused LANs.
Comment out and test thoroughly.
"); + } - $mes->addInfo("Pink items are likely to be unused LANs.
Comment out and test thoroughly.
"); - $ret['text'] = $mes->render().$text; $ret['caption'] = "Deprecated LAN Check (experimental!)"; @@ -1262,11 +1316,12 @@ function compareit($needle,$haystack,$value='',$disabled=FALSE, $reverse=false){ $lines = explode("\n",$script); $text .= ""; + $text2 .= ($reverse == true) ? "" : ""; $count = 1; foreach($lines as $ln) { - if(preg_match("/\b".$needle."\b/i",$ln)) + if(preg_match("/\b".$needle."\b/i",$ln, $mtch)) { if($disabled) { @@ -1277,7 +1332,11 @@ function compareit($needle,$haystack,$value='',$disabled=FALSE, $reverse=false){ $text .= ADMIN_TRUE_ICON; } $text .= " Line:".$count." "; // "' Found"; - + + if($reverse == true) + { + $text2 .= print_a($ln,true); + } $found = TRUE; } @@ -1315,7 +1374,7 @@ function compareit($needle,$haystack,$value='',$disabled=FALSE, $reverse=false){ } } $text .= ""; - + $text2 .= ($reverse == true) ? "" : ""; } // $color = $found ? "" : "background-color:pink"; @@ -1346,7 +1405,7 @@ function compareit($needle,$haystack,$value='',$disabled=FALSE, $reverse=false){ $needle = "".$needle.""; } - return "".$needle .$disabled. "".$text.""; + return "".$needle .$disabled. "".$text.$text2.""; }