diff --git a/e107_admin/lancheck.php b/e107_admin/lancheck.php index 78a94fdc9..4f1e2d628 100644 --- a/e107_admin/lancheck.php +++ b/e107_admin/lancheck.php @@ -10,8 +10,8 @@ * With code from Izydor and Lolo. * * $Source: /cvs_backup/e107_0.8/e107_admin/lancheck.php,v $ - * $Revision: 1.18 $ - * $Date: 2009-10-24 07:52:32 $ + * $Revision: 1.19 $ + * $Date: 2009-11-05 08:07:48 $ * $Author: e107coders $ * */ @@ -30,6 +30,8 @@ require_once(e_HANDLER."form_handler.php"); $frm = new e_form(); $emessage = &eMessage::getInstance(); +$lck = new lancheck; + $qry = explode("|",e_QUERY); $f = $qry[0]; @@ -150,6 +152,8 @@ if(isset($_POST['submit'])) ".$frm->hidden('language', $lan)." "; + + $e107->ns->tablerender($caption, $emessage->render().$message); require_once(e_ADMIN."footer.php"); @@ -180,7 +184,7 @@ if($f != ""){ $dir2 = dirname($fullpath_trans)."/"; } - edit_lanfiles($dir1,$dir2,$f1,$f2); + $lck->edit_lanfiles($dir1,$dir2,$f1,$f2); } @@ -201,7 +205,7 @@ $core_themes = array("_blank", "e107v4a", "jayya", "khatru", "leaf", "vekna_blue if(isset($_POST['language_sel']) && isset($_POST['language'])) { - $text = check_core_lanfiles($_POST['language']).check_core_lanfiles($_POST['language'],"admin/"); + $text = $lck->check_core_lanfiles($_POST['language']).$lck->check_core_lanfiles($_POST['language'],"admin/"); $text .= "
@@ -228,7 +232,7 @@ if(isset($_POST['language_sel']) && isset($_POST['language'])) { if(is_readable(e_PLUGIN.$plugs)) { - $text .= check_lanfiles('P',$plugs,"English",$_POST['language']); + $text .= $lck->check_lanfiles('P',$plugs,"English",$_POST['language']); } } $text .= " @@ -261,7 +265,7 @@ if(isset($_POST['language_sel']) && isset($_POST['language'])) { if(is_readable(e_THEME.$them)) { - $text .= check_lanfiles('T',$them,"English",$_POST['language']); + $text .= $lck->check_lanfiles('T',$them,"English",$_POST['language']); } } $text .= " @@ -269,516 +273,548 @@ if(isset($_POST['language_sel']) && isset($_POST['language']))
"; + + $mes = e107::getMessage(); + if($lck->error_count == 0) + { + e107::getConfig()->setPref('lancheck/'.$_POST['language'],1); + e107::getConfig()->save(FALSE); + $mes->add(LAN_CHECK_27.''.$lck->error_count.'', E_MESSAGE_SUCCESS); + } + else + { + $mes->add(LAN_CHECK_27.''.$lck->error_count.'', E_MESSAGE_WARNING); + } + - $ns->tablerender(LAN_CHECK_25, $text); + $ns->tablerender(LAN_CHECK_25, $mes->render(). $text); + + + require_once(e_ADMIN."footer.php"); exit; } - -function check_core_lanfiles($checklan,$subdir=''){ - global $frm; +class lancheck +{ + var $error_count=0; - $English = get_comp_lan_phrases(e_LANGUAGEDIR."English/".$subdir,$checklan); - $check = 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 .= " -
- {$legend_txt} - - - - - - - - - - - - - - - "; - - $keys = array_keys($English); - - sort($keys); - - $i = 0; - foreach($keys as $k) + function check_core_lanfiles($checklan,$subdir=''){ + global $frm; + + $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 .= " +
+ {$legend_txt} +
".LAN_CHECK_16."".$_POST['language'].' '.LAN_CHECK_20."".LAN_OPTIONS."
+ + + + + + + + + + + + + + "; + + $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 .= " + + "; + + if(array_key_exists($k,$check)) + { + $text .= " + + "; + $subkeys = array_keys($English[$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 == "" && !$this->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]); + } + + if((!array_key_exists($sk,$check[$k]) && $English[$k][$sk] != "") || (trim($check[$k][$sk]) == "" && $English[$k][$sk] != "")) + { + + $er .= ($er) ? "
" : ""; + $er .= $sk." ".LAN_CHECK_5; + $this->error_count++; + } + } + + $style = ($er) ? "warning" : "success"; + $text .= " + + "; + } + else + { + // file missing + $text .= " + + + "; + $this->error_count++; + } + + // Leave in EDIT button for all entries - to allow re-translation of bad entries. + $subpath = ($subdir!='') ? $subdir.$k : $k; + $text .= " + + + "; + } + $i++; + } + $text .= " + +
".LAN_CHECK_16."".$_POST['language'].' '.LAN_CHECK_20."".LAN_OPTIONS."
{$lnk} +
+ "; + $text .= $bom_error . $utf_error; + if(!$er && !$bom_error && !$utf_error) + { + $text .= LAN_OK; + } + else + { + $text .= $er."
"; + $this->error_count++; + } + $text .= " +
+
{$lnk}".LAN_CHECK_4." + ".$frm->admin_button('but-corelan-'.str_replace(array('/', '\\'), '-', $subdir).$i, LAN_EDIT, 'edit', '', array('other' => "onclick=\"window.location='".e_SELF."?".$subpath."|".$_POST['language']."'\""))." + "; + $text .= " +
+
+ "; + + 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) != "fill_phrases_array($data,$type); + if(substr($data[0],0,5) != "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']) && 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) != "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) + { + global $frm; + + $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; - $k_check = str_replace("English",$checklan,$k); + //echo "klucz ".$k."
"; + $k_check = str_replace("English",$target_lan,$k); $text .= " - + "; - - if(array_key_exists($k,$check)) + if(array_key_exists($k_check,$check)) { $text .= " - {$lnk} + ".$comp_name." + ".str_replace("English/","",$lnk)." "; - $subkeys = array_keys($English[$k]); - - $er=""; + + $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][$sk])) + if($utf_error == "" && !is_utf8($check[$k_check][$sk])) { $utf_error = "".LAN_CHECK_19."
"; } - - 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] != "")) + + if(!array_key_exists($sk,$check[$k_check]) || (trim($check[$k_check][$sk]) == "" && $baselang[$k][$sk] != "")) { - $er .= ($er) ? "
" : ""; $er .= $sk." ".LAN_CHECK_5; + $this->error_count++; } } - + $style = ($er) ? "warning" : "success"; $text .= " - -
+ +
"; $text .= $bom_error . $utf_error; $text .= (!$er && !$bom_error && !$utf_error) ? LAN_OK : $er."
"; $text .= " -
- +
+ "; } else { - // file missing $text .= " - {$lnk} - ".LAN_CHECK_4." - "; - } - - // Leave in EDIT button for all entries - to allow re-translation of bad entries. - $subpath = ($subdir!='') ? $subdir.$k : $k; - $text .= " - - ".$frm->admin_button('but-corelan-'.str_replace(array('/', '\\'), '-', $subdir).$i, LAN_EDIT, 'edit', '', array('other' => "onclick=\"window.location='".e_SELF."?".$subpath."|".$_POST['language']."'\""))." - "; - $text .= " - - - "; - } - $i++; - } - $text .= " - - - - "; - - 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 + fill_phrases_array($data,$type); - if(substr($data[0],0,5) != "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']) && 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); - $text .= " - - "; - 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) - { - if($utf_error == "" && !is_utf8($check[$k_check][$sk])) - { - $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; - } + ".LAN_CHECK_4." + "; + $this->error_count++; } - - $style = ($er) ? "warning" : "success"; - $text .= " - -
+ + $text .=" + + ".$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 .= $bom_error . $utf_error; - $text .= (!$er && !$bom_error && !$utf_error) ? LAN_OK : $er."
"; - $text .= " -
- + $text .=" + + "; + $i++; + } + + return $text; + } + + function edit_lanfiles($dir1,$dir2,$f1,$f2){ + global $e107, $emessage, $lan; + + /* echo "
dir1 = $dir1"; + echo "
file1 = $f1"; + + echo "
dir2 = $dir2"; + echo "
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 { - $text .= " - ".$comp_name." - ".str_replace("English/","",$lnk)." - ".LAN_CHECK_4." - "; + $root_file = $dir2.$f2; } - - $text .=" - - ".$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'\""))." + + 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 = " +
+
+ ".LAN_CHECK_3." ".str_replace(array(e_PLUGIN, e_LANGUAGEDIR), array(e_PLUGIN_ABS, e_LANGUAGEDIR_ABS), $dir2)."{$f2} -> {$lan} + + + + + + + + + + + + + + "; - $text .=" - - - "; - $i++; - } - - return $text; -} - -function edit_lanfiles($dir1,$dir2,$f1,$f2){ - global $e107, $emessage, $lan; - - /* echo "
dir1 = $dir1"; - echo "
file1 = $f1"; - - echo "
dir2 = $dir2"; - echo "
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 = get_lan_file_phrases($dir1,$dir2,$f1,$f2); - $keys = array_keys($trans); - sort($keys); - - $text = " - -
- ".LAN_CHECK_3." ".str_replace(array(e_PLUGIN, e_LANGUAGEDIR), array(e_PLUGIN_ABS, e_LANGUAGEDIR_ABS), $dir2)."{$f2} -> {$lan} -
 ".LAN_CHECK_16."Translate to ".$lan."
- - - - - - - - - - - - - - "; - - $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=""; - $hglt2=""; - } - $text .= " - - - - - - "; - } - $text .= " - -
 ".LAN_CHECK_16."Translate to ".$lan."
".$hglt1.htmlentities($sk).$hglt2."".htmlentities(str_replace("ndef++", "", $trans['orig'][$sk])) ." - ".(($writable) ? "" : "")." - "; - //echo "orig --> ".$trans['orig'][$sk]."
"; - if (strpos($trans['orig'][$sk],"ndef++") !== False) + + $subkeys = array_keys($trans['orig']); + foreach($subkeys as $sk) { - //echo "+orig --> ".$trans['orig'][$sk]." <> ".strpos($trans['orig'][$sk],"ndef++")."
"; - $text .= " - - "; - } - else - { - $text .= " - - "; - } - $text .=" -
- "; - //Check if directory is writable - if($writable) - { - //FIXME place of LAN_SAVE - $text .=" -
- - ".(($root_file) ? "" : "")." -
- "; - } - - $text .= " -
-
- "; - - $text .= " -
-
- ".((!$writable) ? $dir2.$f2.LAN_NOTWRITABLE : "")." -
- - -
-
- "; - - $e107->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."
"; - if (strpos($line,"define(") !== FALSE && strpos($line,");") === FALSE) - { - $indef=1; - $bigline=""; - // echo "big1 -->".$line."
"; - } - if ($indef) - { - $bigline.=str_replace("\n","",$line); - // echo "big2 -->".$line."
"; - } - if (strpos($line,"define(") === FALSE && strpos($line,");") !== FALSE) - { - $indef=0; - $we_have_bigline=1; - // echo "big3 -->".$line."
"; - } - - 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."
"; + $rowamount = round(strlen($trans['orig'][$sk])/34)+1; + $hglt1=""; $hglt2=""; + if ($trans['tran'][$sk] == "" && $trans['orig'][$sk]!="") { + $hglt1=""; + $hglt2=""; } - $ndef = ""; - //echo "_ndefline -->".$line."
"; - if (strpos($line,"defined(") !== FALSE ) + $text .= " + + ".$hglt1.htmlentities($sk).$hglt2." + ".htmlentities(str_replace("ndef++", "", $trans['orig'][$sk])) ." + + ".(($writable) ? "" : "")." + "; + //echo "orig --> ".$trans['orig'][$sk]."
"; + if (strpos($trans['orig'][$sk],"ndef++") !== 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'"; + //echo "+orig --> ".$trans['orig'][$sk]." <> ".strpos($trans['orig'][$sk],"ndef++")."
"; + $text .= " + + "; } 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)) + $text .= " + + "; + } + $text .=" + + + "; + } + $text .= " + + + "; + //Check if directory is writable + if($writable) + { + //FIXME place of LAN_SAVE + $text .=" +
+ + ".(($root_file) ? "" : "")." +
+ "; + } + + $text .= " + + + "; + + $text .= " +
+
+ ".((!$writable) ? $dir2.$f2.LAN_NOTWRITABLE : "")." +
+ + +
+
+ "; + + $e107->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."
"; + if (strpos($line,"define(") !== FALSE && strpos($line,");") === FALSE) + { + $indef=1; + $bigline=""; + // echo "big1 -->".$line."
"; + } + if ($indef) + { + $bigline.=str_replace("\n","",$line); + // echo "big2 -->".$line."
"; + } + if (strpos($line,"define(") === FALSE && strpos($line,");") !== FALSE) + { + $indef=0; + $we_have_bigline=1; + // echo "big3 -->".$line."
"; + } + + 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) { - //echo "get_lan -->".$matches[1]." :: ".$ndef.$matches[2]."
"; - if(!isset($retloc[$type][$matches[1]])) + $we_have_bigline=0; + $line=$bigline; + // echo "big -->".$line."
"; + } + $ndef = ""; + //echo "_ndefline -->".$line."
"; + 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."
"; + 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)) { - $retloc[$type][$matches[1]]= $ndef.$matches[2]; + //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; -} - -//-------------------------------------------------------------------- - - -function is_utf8($str) { - /* - * @see http://hsivonen.iki.fi/php-utf8/ validation.php - */ -//@TODO: always TRUE -// if(strtolower(CHARSET) != "utf-8" || $str == "") - { - return TRUE; + + //-------------------------------------------------------------------- + + + 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); } - - return (preg_match('/^.{1}/us',$str,$ar) == 1); + } - function lancheck_adminmenu() { include_lan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_language.php"); diff --git a/e107_admin/language.php b/e107_admin/language.php index 19631f9cf..7005aea52 100644 --- a/e107_admin/language.php +++ b/e107_admin/language.php @@ -9,8 +9,8 @@ * Administration Area - Languages * * $Source: /cvs_backup/e107_0.8/e107_admin/language.php,v $ - * $Revision: 1.22 $ - * $Date: 2009-10-24 07:52:32 $ + * $Revision: 1.23 $ + * $Date: 2009-11-05 08:07:48 $ * $Author: e107coders $ * */ @@ -161,10 +161,16 @@ if (varset($action) == 'db') } if (varset($_POST['ziplang']) && varset($_POST['language'])) { - $text = zip_up_lang($_POST['language']); - $admin_log->log_event('LANG_04', $_POST['language'], E_LOG_INFORMATIVE, ''); - //$ns -> tablerender(LANG_LAN_25, $text); - $emessage->add(LANG_LAN_25.': '.$text); + if(varset($pref['lancheck'][$_POST['language']]) == 1) + { + $text = zip_up_lang($_POST['language']); + $admin_log->log_event('LANG_04', $_POST['language'], E_LOG_INFORMATIVE, ''); + $emessage->add(LANG_LAN_25.': '.$text); + } + else + { + $emessage->add(LANG_LAN_36,E_MESSAGE_WARNING); + } } if (varset($action) == "tools") { @@ -575,8 +581,8 @@ function show_tools() function available_langpacks() { - require_once(e_HANDLER.'xml_class.php'); - $xml = new xmlClass; + + $xml = e107::getXml(); $feed = e107::getPref('xmlfeed_languagepacks'); diff --git a/e107_handlers/file_class.php b/e107_handlers/file_class.php index fb14330d6..060ed6eef 100644 --- a/e107_handlers/file_class.php +++ b/e107_handlers/file_class.php @@ -3,7 +3,7 @@ + ----------------------------------------------------------------------------+ | e107 website system | -| ©Steve Dunstan 2001-2002 +| �Steve Dunstan 2001-2002 | http://e107.org | jalist@e107.org | @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_handlers/file_class.php,v $ -| $Revision: 1.2 $ -| $Date: 2008-11-20 20:34:44 $ -| $Author: e107steved $ +| $Revision: 1.3 $ +| $Date: 2009-11-05 08:07:48 $ +| $Author: e107coders $ +----------------------------------------------------------------------------+ */ @@ -68,11 +68,17 @@ class e_file function setDefaults() { $this->dirFilter = array('/', 'CVS', '.svn'); // Default directory filter (exact matches only) - $this->fileFilter = array('^thumbs\.db$','^Thumbs\.db$','.*\._$','^\.htaccess$','^index\.html$','^null\.txt$','\.bak$'); // Default file filter (regex format) + $this->fileFilter = array('^thumbs\.db$','^Thumbs\.db$','.*\._$','^\.htaccess$','^index\.html$','^null\.txt$','\.bak$','^.tmp'); // Default file filter (regex format) } - - + /** + * + * @param object $path + * @param object $fmask [optional] + * @param object $omit [optional] + * @param object $recurse_level [optional] + * @return + */ function get_files($path, $fmask = '', $omit='standard', $recurse_level = 0) { $ret = array(); diff --git a/e107_handlers/login.php b/e107_handlers/login.php index e04ec85bd..66e1c8a45 100644 --- a/e107_handlers/login.php +++ b/e107_handlers/login.php @@ -12,8 +12,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_handlers/login.php,v $ -| $Revision: 1.26 $ -| $Date: 2009-10-22 13:00:11 $ +| $Revision: 1.27 $ +| $Date: 2009-11-05 08:07:48 $ | $Author: e107coders $ +----------------------------------------------------------------------------+ */ @@ -345,7 +345,9 @@ class userlogin $this->logNote('LAN_ROLL_LOG_02', $username); break; case LOGIN_NOT_ACTIVATED : - define("LOGINMESSAGE", LAN_LOGIN_22."

"); + $srch = array("[","]"); + $repl = array("",""); + define("LOGINMESSAGE", str_replace($srch,$repl,LAN_LOGIN_22)."

"); $this->logNote('LAN_ROLL_LOG_05', $username); $this->genNote($fip, $username, LAN_LOGIN_27); $doCheck = TRUE; diff --git a/e107_languages/English/admin/lan_admin.php b/e107_languages/English/admin/lan_admin.php index 7c42a3f9f..e270a56be 100644 --- a/e107_languages/English/admin/lan_admin.php +++ b/e107_languages/English/admin/lan_admin.php @@ -1,7 +1,7 @@ \ No newline at end of file diff --git a/e107_languages/English/admin/lan_language.php b/e107_languages/English/admin/lan_language.php index 8797d7ea7..0cbe0b386 100644 --- a/e107_languages/English/admin/lan_language.php +++ b/e107_languages/English/admin/lan_language.php @@ -1,7 +1,7 @@ \ No newline at end of file diff --git a/e107_languages/English/lan_login.php b/e107_languages/English/lan_login.php index b734174cb..b4ae0eddf 100644 --- a/e107_languages/English/lan_login.php +++ b/e107_languages/English/lan_login.php @@ -4,9 +4,9 @@ | e107 website system - Language File. | | $Source: /cvs_backup/e107_0.8/e107_languages/English/lan_login.php,v $ -| $Revision: 1.5 $ -| $Date: 2009-07-05 18:47:52 $ -| $Author: e107steved $ +| $Revision: 1.6 $ +| $Date: 2009-11-05 08:07:53 $ +| $Author: e107coders $ +----------------------------------------------------------------------------+ */ define('LAN_LOGIN_1', 'User name'); @@ -30,7 +30,7 @@ define('LAN_LOGIN_18', 'Auto-ban: More than 10 failed login attempts'); define('LAN_LOGIN_19', '> 10 failed login attempts'); define('LAN_LOGIN_20', 'You left required field(s) blank'); define('LAN_LOGIN_21', "Incorrect login. The entered data doesn't match to a registered user. Check if you have the CAPS-LOCK key activated as logins on this site are case sensitive"); -define('LAN_LOGIN_22', "You have not activated your account. You should have received an email with instructions on how to confirm your account. If not, please click here."); +define('LAN_LOGIN_22', "You have not activated your account. You should have received an email with instructions on how to confirm your account. If not, please click [here]."); define('LAN_LOGIN_23', 'Incorrect code entered.'); define('LAN_LOGIN_24', 'That username/password combination is already in use.'); define('LAN_LOGIN_25', 'Banned user attempted to login');