diff --git a/e107_admin/lancheck.php b/e107_admin/lancheck.php index a67645bf9..06e094af0 100644 --- a/e107_admin/lancheck.php +++ b/e107_admin/lancheck.php @@ -1,4 +1,4 @@ -
"; @@ -94,14 +94,14 @@ if(isset($_POST['submit'])) if (strpos($_POST['newdef'][$i],"ndef++") !== FALSE ) { - $defvar = str_replace("ndef++","",$_POST['newdef'][$i]); - $notdef_start = "if (!defined(".chr(34).$defvar.chr(34).")) {"; - $notdef_end = "}\n"; + $defvar = str_replace("ndef++","",$_POST['newdef'][$i]); + $notdef_start = "if (!defined(".chr(34).$defvar.chr(34).")) {"; + $notdef_end = "}\n"; } - else + else { - $defvar = $_POST['newdef'][$i]; - } + $defvar = $_POST['newdef'][$i]; + } if($_POST['newdef'][$i] == "LC_ALL" && isset($_POST['root'])) { @@ -112,7 +112,7 @@ if(isset($_POST['submit'])) { $message .= $notdef_start.$func.'('.$quote.htmlentities($defvar).$quote.',"'.$deflang.'");
'.$notdef_end; $input .= $notdef_start.$func."(".$quote.$defvar.$quote.", ".chr(34).$deflang.chr(34).");".$notdef_end; - } + } } $message .="
"; @@ -123,19 +123,19 @@ if(isset($_POST['submit'])) $fp = @fopen($writeit,"w"); if(!@fwrite($fp, $input)) { - $caption = LAN_ERROR; - $message = LAN_CHECK_17; - } + $caption = LAN_ERROR; + $message = LAN_CHECK_17; + } else { - $caption = LAN_SAVED." $lan/".$writeit.""; - } + $caption = LAN_SAVED." $lan/".$writeit.""; + } fclose($writeit); $message .= "
-

"; +

"; $message .= "

-
"; +
"; $ns -> tablerender($caption, $message); @@ -151,44 +151,44 @@ if($f != ""){ if (!$mode) { - $dir1 = e_BASE.$LANGUAGES_DIRECTORY."English/"; - $f1=$f; - $dir2 = e_BASE.$LANGUAGES_DIRECTORY.$lan."/"; - $f2=$f; + $dir1 = e_BASE.$LANGUAGES_DIRECTORY."English/"; + $f1=$f; + $dir2 = e_BASE.$LANGUAGES_DIRECTORY.$lan."/"; + $f2=$f; } else { - $fullpath_orig = $f; + $fullpath_orig = $f; $fullpath_trans = str_replace("English",$lan,$f); - $f1 = basename($fullpath_orig); - $f2 = basename($fullpath_trans); - $dir1 = dirname($fullpath_orig)."/"; - $dir2 = dirname($fullpath_trans)."/"; - } + $f1 = basename($fullpath_orig); + $f2 = basename($fullpath_trans); + $dir1 = dirname($fullpath_orig)."/"; + $dir2 = dirname($fullpath_trans)."/"; + } - edit_lanfiles($dir1,$dir2,$f1,$f2); + edit_lanfiles($dir1,$dir2,$f1,$f2); } // =========================================================================== $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_menu","trackback","tree_menu","user_menu" - ); +"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_menu","trackback","tree_menu","user_menu" +); $core_themes = array("crahan","e107v4a","human_condition","interfectus","jayya", - "khatru","kubrick","lamb","leaf","reline","sebes","vekna_blue"); +"khatru","kubrick","lamb","leaf","reline","sebes","vekna_blue"); if(isset($_POST['language_sel']) && isset($_POST['language'])){ - $ns -> tablerender(LAN_CHECK_3.": ".$_POST['language'],check_core_lanfiles($_POST['language'])); - $ns -> tablerender(LAN_CHECK_3.": ".$_POST['language']."/admin",check_core_lanfiles($_POST['language'],"admin/")); + $ns -> tablerender(LAN_CHECK_3.": ".$_POST['language'],check_core_lanfiles($_POST['language'])); + $ns -> tablerender(LAN_CHECK_3.": ".$_POST['language']."/admin",check_core_lanfiles($_POST['language'],"admin/")); $plug_text = " @@ -207,7 +207,7 @@ if(isset($_POST['language_sel']) && isset($_POST['language'])){ $plug_text .= "
"; $ns -> tablerender(ADLAN_CL_7,$plug_text); - $theme_text = " + $theme_text = "
@@ -242,66 +242,66 @@ function check_core_lanfiles($checklan,$subdir=''){ $keys = array_keys($English); - sort($keys); + sort($keys); foreach($keys as $k) { if($k != "bom") { - $lnk = $k; + $lnk = $k; $k_check = str_replace("English",$checklan,$k); - if(array_key_exists($k,$check)) + if(array_key_exists($k,$check)) { - $text .= ""; - $subkeys = array_keys($English[$k]); + $text .= ""; + $subkeys = array_keys($English[$k]); - $er=""; - $utf_error = ""; + $er=""; + $utf_error = ""; $bomkey = str_replace(".php","",$k_check); - $bom_error = ($check['bom'][$bomkey]) ? "".LAN_CHECK_15."
" : ""; // illegal chars + $bom_error = ($check['bom'][$bomkey]) ? "".LAN_CHECK_15."
" : ""; // illegal chars - foreach($subkeys as $sk) + foreach($subkeys as $sk) { - if($utf_error == "" && !is_utf8($check[$k][$sk])) + if($utf_error == "" && !is_utf8($check[$k][$sk])) { $utf_error = "".LAN_CHECK_19."
"; } if($sk == "LC_ALL"){ - $check[$k][$sk] = str_replace(chr(34).chr(34),"",$check[$k][$sk]); + $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) ? "
" : ""; - $er .= $sk." ".LAN_CHECK_5; - } - } + $er .= ($er) ? "
" : ""; + $er .= $sk." ".LAN_CHECK_5; + } + } $style = ($er) ? "forumheader2" : "forumheader3"; - $text .= ""; - } + } else { - $text .= " + $text .= ""; // file missing. - } - // Leave in EDIT button for all entries - to allow re-translation of bad entries. - $subpath = ($subdir!='') ? $subdir.$k : $k; - $text .=""; + } + // Leave in EDIT button for all entries - to allow re-translation of bad entries. + $subpath = ($subdir!='') ? $subdir.$k : $k; + $text .=""; } - } + } $text .= "
Theme ".LAN_CHECK_16."
{$lnk}
{$lnk}
"; + $text .= "
"; $text .= $bom_error . $utf_error; $text .= (!$er && !$bom_error && !$utf_error) ? LAN_OK : $er."
"; $text .= "
{$lnk} ".LAN_CHECK_4." - "; - $text .="
+ "; + $text .="
"; - return $text; + return $text; } @@ -313,8 +313,8 @@ function get_lan_file_phrases($dir1,$dir2,$file1,$file2){ if(is_file($fname)) { - $data = file($fname); - $ret=$ret + fill_phrases_array($data,$type); + $data = file($fname); + $ret=$ret + fill_phrases_array($data,$type); if(substr($data[0],0,5) != "get_files($comp_dir, ".php","standard",$depth)){ - sort($lang_array); - } + if($lang_array = $fl->get_files($comp_dir, ".php","standard",$depth)){ + sort($lang_array); + } - $regexp = (strpos($comp_dir,e_LANGUAGEDIR) !== FALSE) ? "#.php#" : "#".$lang."#"; + $regexp = (strpos($comp_dir,e_LANGUAGEDIR) !== FALSE) ? "#.php#" : "#".$lang."#"; - foreach($lang_array as $f) - { - if(preg_match($regexp,$f['path'].$f['fname']) && is_file($f['path'].$f['fname'])) + foreach($lang_array as $f) + { + if(preg_match($regexp,$f['path'].$f['fname']) && is_file($f['path'].$f['fname'])) + { + $data = file($f['path'].$f['fname']); + $relpath = str_replace($comp_dir,"",$f['path']); + if(substr($data[0],0,5) != ""; + $k_check = str_replace("English",$target_lan,$k); + if(array_key_exists($k_check,$check)) { - $lnk = $k; - //echo "klucz ".$k."
"; - $k_check = str_replace("English",$target_lan,$k); - if(array_key_exists($k_check,$check)) + $text .= " + ".$comp_name." + ".str_replace("English/","",$lnk).""; + + $subkeys = array_keys($baselang[$k]); + $er=""; + $utf_error = ""; + + $bomkey = str_replace(".php","",$k_check); + $bom_error = ($check['bom'][$bomkey]) ? "".LAN_CHECK_15."
" : ""; // illegal chars + + foreach($subkeys as $sk) { - $text .= " - ".$comp_name." - ".str_replace("English/","",$lnk).""; - - $subkeys = array_keys($baselang[$k]); - $er=""; - $utf_error = ""; - - $bomkey = str_replace(".php","",$k_check); - $bom_error = ($check['bom'][$bomkey]) ? "".LAN_CHECK_15."
" : ""; // illegal chars - - foreach($subkeys as $sk) + if($utf_error == "" && !is_utf8($check[$k_check][$sk])) { - if($utf_error == "" && !is_utf8($check[$k_check][$sk])) - { - $utf_error = "".LAN_CHECK_19."
"; - } + $utf_error = "".LAN_CHECK_19."
"; + } - if(!array_key_exists($sk,$check[$k_check]) || (trim($check[$k_check][$sk]) == "" && $baselang[$k][$sk] != "")) - { - $er .= ($er) ? "
" : ""; - $er .= $sk." ".LAN_CHECK_5; - } - } + if(!array_key_exists($sk,$check[$k_check]) || (trim($check[$k_check][$sk]) == "" && $baselang[$k][$sk] != "")) + { + $er .= ($er) ? "
" : ""; + $er .= $sk." ".LAN_CHECK_5; + } + } - $style = ($er) ? "forumheader2" : "forumheader3"; - $text .= "
"; - $text .= $bom_error . $utf_error; - $text .= (!$er && !$bom_error && !$utf_error) ? LAN_OK : $er."
"; - $text .= "
"; - } - else - { - $text .= " - ".$comp_name." - ".str_replace("English/","",$lnk)." - ".LAN_CHECK_4.""; - } - - $text .=" - "; - $text .=""; + $style = ($er) ? "forumheader2" : "forumheader3"; + $text .= "
"; + $text .= $bom_error . $utf_error; + $text .= (!$er && !$bom_error && !$utf_error) ? LAN_OK : $er."
"; + $text .= "
"; + } + else + { + $text .= " + ".$comp_name." + ".str_replace("English/","",$lnk)." + ".LAN_CHECK_4.""; } + $text .=" + "; + $text .=""; + } - // if (!$known) {$text = LAN_CHECK_18." : --> ".$fname." :: ".$dname;} - return $text; + + // if (!$known) {$text = LAN_CHECK_18." : --> ".$fname." :: ".$dname;} + return $text; } function edit_lanfiles($dir1,$dir2,$f1,$f2){ - global $ns,$sql,$lan; + global $ns,$sql,$lan; -/* echo "
dir1 = $dir1"; - echo "
file1 = $f1"; + /* echo "
dir1 = $dir1"; + echo "
file1 = $f1"; - echo "
dir2 = $dir2"; - echo "
file2 = $f2";*/ + echo "
dir2 = $dir2"; + echo "
file2 = $f2";*/ - if($dir2.$f2 == e_LANGUAGEDIR.$lan."/English.php") // it's a language config file. + if($dir2.$f2 == e_LANGUAGEDIR.$lan."/English.php") // it's a language config file. { - $f2 = $lan.".php"; - $root_file = e_LANGUAGEDIR.$lan."/".$lan.".php"; - } + $f2 = $lan.".php"; + $root_file = e_LANGUAGEDIR.$lan."/".$lan.".php"; + } else { - $root_file = $dir2.$f2; + $root_file = $dir2.$f2; } - if($dir2.$f2 == e_LANGUAGEDIR.$lan."/English_custom.php") // it's a language config file. + 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"; - } + $f2 = $lan."_custom.php"; + $root_file = e_LANGUAGEDIR.$lan."/".$lan."_custom.php"; + } $writable = (is_writable($dir2)) ? TRUE : FALSE; @@ -491,31 +491,31 @@ function edit_lanfiles($dir1,$dir2,$f1,$f2){ $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]!="") { + $rowamount = round(strlen($trans['orig'][$sk])/34)+1; + $hglt1=""; $hglt2=""; + if ($trans['tran'][$sk] == "" && $trans['orig'][$sk]!="") { $hglt1=""; $hglt2=""; } - $text .=" - ".$hglt1.htmlentities($sk).$hglt2." - ".htmlentities(str_replace("ndef++","",$trans['orig'][$sk])) .""; - $text .= ""; - $text .= ($writable) ? "" : ""; - //echo "orig --> ".$trans['orig'][$sk]."
"; - if (strpos($trans['orig'][$sk],"ndef++") !== False) + //echo "orig --> ".$trans['orig'][$sk]."
"; + if (strpos($trans['orig'][$sk],"ndef++") !== False) { - //echo "+orig --> ".$trans['orig'][$sk]." <> ".strpos($trans['orig'][$sk],"ndef++")."
"; - $text .= ""; - } - else + //echo "+orig --> ".$trans['orig'][$sk]." <> ".strpos($trans['orig'][$sk],"ndef++")."
"; + $text .= ""; + } + else { $text .= ""; } $text .=""; - } + } //Check if directory is writable if($writable) @@ -526,11 +526,11 @@ function edit_lanfiles($dir1,$dir2,$f1,$f2){ if($root_file) { - $text .= ""; + $text .= ""; } $text .= ""; - } + } $text .= " @@ -538,10 +538,10 @@ function edit_lanfiles($dir1,$dir2,$f1,$f2){ "; $text .= "
-

"; +

"; $text .= (!$writable) ? "
".$dir2.$f2.LAN_NOTWRITABLE : ""; $text .= "

-
"; +
"; $caption = LAN_CHECK_3." ".$dir2.$f2." -> ".$lan.""; @@ -556,19 +556,19 @@ function fill_phrases_array($data,$type) { $retloc = array(); foreach($data as $line){ - //echo "line--> ".$line."
"; + //echo "line--> ".$line."
"; if (strpos($line,"define(") !== FALSE && strpos($line,");") === FALSE) { $indef=1; $bigline=""; // echo "big1 -->".$line."
"; } - if ($indef) + if ($indef) { $bigline.=str_replace("\n","",$line); // echo "big2 -->".$line."
"; } - if (strpos($line,"define(") === FALSE && strpos($line,");") !== FALSE) + if (strpos($line,"define(") === FALSE && strpos($line,");") !== FALSE) { $indef=0; $we_have_bigline=1; @@ -581,7 +581,7 @@ function fill_phrases_array($data,$type) { $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 ((strpos($line,"define(") !== FALSE && strpos($line,");") !== FALSE && substr(ltrim($line),0,2) != "//") || $we_have_bigline || strpos($line,"setlocale(") !== FALSE) { if ($we_have_bigline) @@ -594,8 +594,8 @@ function fill_phrases_array($data,$type) { //echo "_ndefline -->".$line."
"; if (strpos($line,"defined(") !== FALSE ) { - $ndef = "ndef++"; - $line = substr($line,strpos($line,"define(")); + $ndef = "ndef++"; + $line = substr($line,strpos($line,"define(")); } if(strpos($line,"setlocale(") !== FALSE) @@ -609,22 +609,26 @@ function fill_phrases_array($data,$type) { else { - //echo "ndefline: ".$line."
"; - 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]."
"; - $retloc[$type][$matches[1]]= $ndef.$matches[2]; - } + //echo "ndefline: ".$line."
"; + 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]."
"; + if(!isset($retloc[$type][$matches[1]])) + { + $retloc[$type][$matches[1]]= $ndef.$matches[2]; + } + } } - } - } + } + } - return $retloc; - } + return $retloc; +} //-------------------------------------------------------------------- @@ -638,7 +642,7 @@ function is_utf8($str) { return TRUE; } - return (preg_match('/^.{1}/us',$str,$ar) == 1); + return (preg_match('/^.{1}/us',$str,$ar) == 1); } @@ -652,7 +656,7 @@ function lancheck_adminmenu() { } if($action == "modify"){ - $action = "db"; + $action = "db"; } $var['main']['text'] = LAN_PREFS; $var['main']['link'] = e_ADMIN."language.php"; @@ -668,5 +672,3 @@ function lancheck_adminmenu() { show_admin_menu(ADLAN_132, $action, $var); } - -?>