[ Index ]
 

Code source de e107 0.7.8

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/e107_admin/ -> lancheck.php (source)

   1  <?php
   2  /*
   3  + ----------------------------------------------------------------------------+
   4  |     e107 website system
   5  |
   6  |     ©Steve Dunstan 2001-2002
   7  |     http://e107.org
   8  |     jalist@e107.org
   9  |
  10  |     Released under the terms and conditions of the
  11  |     GNU General Public License (http://gnu.org).
  12  |
  13  |     $Source: /cvsroot/e107/e107_0.7/e107_admin/lancheck.php,v $
  14  |     $Revision: 1.25 $
  15  |     $Date: 2006/12/22 00:44:11 $
  16  |     $Author: e107coders $
  17  |      With code from Izydor and Lolo.
  18  +----------------------------------------------------------------------------+
  19  */
  20  require_once ("../class2.php");
  21  if (!getperms("0")) {
  22      header("location:".e_BASE."index.php");
  23       exit;
  24  }
  25      $e_sub_cat = 'language';
  26      require_once ("auth.php");
  27  
  28      $qry = explode("|",e_QUERY);
  29      $f = $qry[0];
  30      $lan = $qry[1];
  31      $mode = $qry[2];
  32  
  33  // Write the language file.
  34  if(isset($_POST['submit']))
  35  {
  36  
  37      unset($input);
  38      $kom_start = chr(47)."*";
  39      $kom_end = "*".chr(47);
  40  
  41      if($_POST['root'])
  42      {
  43          $writeit = $_POST['root'];
  44      }
  45  
  46      $old_kom = "";
  47      $in_kom=0;
  48      $data = file($writeit);
  49      foreach($data as $line)
  50      {
  51  
  52          if (strpos($line,$kom_start) !== False && $old_kom == "")
  53          {
  54                $in_kom=1;
  55          }
  56          if ($in_kom) { $old_kom.=$line; }
  57          if (strpos($line,$kom_end) !== False && $in_kom) {$in_kom = 0;}
  58      }
  59  
  60  
  61      $message = "<div style='text-align:left'><br />";
  62      $input .= chr(60)."?php\n";
  63      if ($old_kom == "")
  64      {
  65          // create CVS compatible description.
  66          $diz = chr(47)."*\n";
  67          $diz .= "+---------------------------------------------------------------+\n";
  68          $diz .= "|        e107 website system ".$lan." Language File\n";
  69          $diz .= "|        Released under the terms and conditions of the\n";
  70          $diz .= "|        GNU General Public License (http://gnu.org).\n";
  71          $diz .= "|\n";
  72          $diz .= "|        ".chr(36)."Source: $writeit ".chr(36)."\n";
  73          $diz .= "|        ".chr(36)."Revision: 1.0 ".chr(36)."\n";
  74          $diz .= "|        ".chr(36)."Date: ".date("Y/m/d H:i:s")." ".chr(36)."\n";
  75          $diz .= "|        ".chr(36)."Author: ".USERNAME." ".chr(36)."\n";
  76          $diz .= "+---------------------------------------------------------------+\n";
  77          $diz .= "*".chr(47)."\n\n";
  78      }
  79      else
  80      {
  81          $diz = $old_kom;
  82      }
  83  
  84      $input .= $diz;
  85      $message .= str_replace("\n","<br />",$diz);
  86  
  87      for ($i=0; $i<count($_POST['newlang']); $i++)
  88      {
  89          $notdef_start = "";
  90          $notdef_end = "\n";
  91          $deflang = (MAGIC_QUOTES_GPC === TRUE) ? stripslashes($_POST['newlang'][$i]) : $_POST['newlang'][$i];
  92          $func = "define";
  93          $quote = chr(34);
  94  
  95          if (strpos($_POST['newdef'][$i],"ndef++") !== FALSE )
  96          {
  97                $defvar = str_replace("ndef++","",$_POST['newdef'][$i]);
  98                $notdef_start = "if (!defined(".chr(34).$defvar.chr(34).")) {";
  99                $notdef_end = "}\n";
 100          }
 101          else
 102          {
 103                $defvar = $_POST['newdef'][$i];
 104          }
 105  
 106          if($_POST['newdef'][$i] == "LC_ALL" && isset($_POST['root']))
 107          {
 108              $message .= $notdef_start.'setlocale('.htmlentities($defvar).','.$deflang.');<br />'.$notdef_end;
 109              $input .= $notdef_start."setlocale(".$defvar.",".$deflang.");".$notdef_end;
 110          }
 111          else
 112          {
 113              $message .= $notdef_start.$func.'('.$quote.htmlentities($defvar).$quote.',"'.$deflang.'");<br />'.$notdef_end;
 114              $input .= $notdef_start.$func."(".$quote.$defvar.$quote.", ".chr(34).$deflang.chr(34).");".$notdef_end;
 115          }
 116      }
 117  
 118      $message .="<br />";
 119      $message .="</div>";
 120      $input .= "\n\n?>";
 121  
 122      // Write to file.
 123      $fp = @fopen($writeit,"w");
 124      if(!@fwrite($fp, $input))
 125      {
 126          $caption = LAN_ERROR;
 127          $message = LAN_CHECK_17;
 128        }
 129      else
 130      {
 131          $caption = LAN_SAVED." <b>$lan/".$writeit."</b>";
 132        }
 133      fclose($writeit);
 134  
 135      $message .= "<form method='post' action='".e_SELF."' id='select_lang'>
 136              <div style='text-align:center'><br />";
 137      $message .= "<br /><br /><input class='button' type='submit' name='language_sel' value=\"".LAN_BACK."\" />
 138              <input type='hidden' name='language' value='$lan' /></div></form>";
 139  
 140  
 141      $ns -> tablerender($caption, $message);
 142      require_once(e_ADMIN."footer.php");
 143      exit;
 144  }
 145  
 146  // ============================================================================
 147  
 148  // Edit the Language File.
 149  
 150  if($f != ""){
 151  
 152      if (!$mode)
 153      {
 154          $dir1 =  e_BASE.$LANGUAGES_DIRECTORY."English/";
 155          $f1=$f;
 156          $dir2 =  e_BASE.$LANGUAGES_DIRECTORY.$lan."/";
 157          $f2=$f;
 158      }
 159      else
 160      {
 161           $fullpath_orig = $f;
 162          $fullpath_trans = str_replace("English",$lan,$f);
 163  
 164          $f1 = basename($fullpath_orig);
 165            $f2 = basename($fullpath_trans);
 166            $dir1 = dirname($fullpath_orig)."/";
 167          $dir2 = dirname($fullpath_trans)."/";
 168        }
 169  
 170       edit_lanfiles($dir1,$dir2,$f1,$f2);
 171  
 172  }
 173  
 174  // ===========================================================================
 175  
 176  $core_plugins = array(
 177      "alt_auth","banner_menu","blogcalendar_menu","calendar_menu","chatbox_menu",
 178      "clock_menu","comment_menu","compliance_menu","content","counter_menu",
 179      "featurebox","forum","gsitemap","integrity_check","lastseen","links_page",
 180      "linkwords","list_new","log","login_menu","newforumposts_main","newsfeed",
 181      "newsletter","online_extended_menu","online_menu","other_news_menu","pdf",
 182      "pm","poll","powered_by_menu","rss_menu","search_menu","sitebutton_menu",
 183      "trackback","tree_menu","userlanguage_menu","usertheme_menu"
 184      );
 185  
 186  $core_themes = array("crahan","e107v4a","human_condition","interfectus","jayya",
 187      "khatru","kubrick","lamb","leaf","reline","sebes","vekna_blue");
 188  
 189  
 190  if(isset($_POST['language_sel']) && isset($_POST['language'])){
 191  
 192        $ns -> tablerender(LAN_CHECK_3.": ".$_POST['language'],check_core_lanfiles($_POST['language']));
 193        $ns -> tablerender(LAN_CHECK_3.": ".$_POST['language']."/admin",check_core_lanfiles($_POST['language'],"admin/"));
 194  
 195      $plug_text = "<table class='fborder' style='".ADMIN_WIDTH."'>
 196      <tr>
 197      <td class='fcaption'>".LAN_PLUGIN."</td>
 198      <td class='fcaption'>".LAN_CHECK_16."</td>
 199      <td class='fcaption'>".$_POST['language']."</td>
 200      <td class='fcaption'>".LAN_OPTIONS."</tr>";
 201  
 202      foreach($core_plugins as $plugs)
 203      {
 204          if(is_readable(e_PLUGIN.$plugs))
 205          {
 206              $plug_text .= check_lanfiles('P',$plugs,"English",$_POST['language']);
 207          }
 208      }
 209      $plug_text .= "</table>";
 210      $ns -> tablerender(ADLAN_CL_7,$plug_text);
 211  
 212      $theme_text = "<table class='fborder' style='".ADMIN_WIDTH."'>
 213      <tr>
 214      <td class='fcaption'>Theme</td>
 215      <td class='fcaption'>".LAN_CHECK_16."</td>
 216      <td class='fcaption'>".$_POST['language']."</td>
 217      <td class='fcaption'>".LAN_OPTIONS."</tr>";
 218      foreach($core_themes as $them)
 219      {
 220          if(is_readable(e_THEME.$them))
 221          {
 222              $theme_text .= check_lanfiles('T',$them,"English",$_POST['language']);
 223          }
 224      }
 225      $theme_text .= "</table>";
 226  
 227      $ns -> tablerender("Themes",$theme_text);
 228      require_once(e_ADMIN."footer.php");
 229      exit;
 230  }
 231  
 232  
 233  function check_core_lanfiles($checklan,$subdir=''){
 234      global $lanfiles,$_POST;
 235  
 236      $English = get_comp_lan_phrases(e_LANGUAGEDIR."English/".$subdir,$checklan);
 237      $check = get_comp_lan_phrases(e_LANGUAGEDIR.$checklan."/".$subdir,$checklan);
 238  
 239      $text .= "<table class='fborder' style='".ADMIN_WIDTH."'>
 240      <tr>
 241      <td class='fcaption'>".LAN_CHECK_16."</td>
 242      <td class='fcaption'>".$_POST['language']." File</td>
 243      <td class='fcaption'>".LAN_OPTIONS."</tr>";
 244  
 245      $keys = array_keys($English);
 246  
 247       sort($keys);
 248  
 249      foreach($keys as $k)
 250      {
 251          if($k != "bom")
 252          {
 253              $lnk = $k;
 254              $k_check = str_replace("English",$checklan,$k);
 255              if(array_key_exists($k,$check))
 256              {
 257                   $text .= "<tr><td class='forumheader3' style='width:45%'>{$lnk}</td>";
 258                    $subkeys = array_keys($English[$k]);
 259  
 260                       $er="";
 261                  $utf_error = "";
 262  
 263                  $bomkey = str_replace(".php","",$k_check);
 264                     $bom_error = ($check['bom'][$bomkey]) ? "<i>".LAN_CHECK_15."</i><br />" : ""; // illegal chars
 265  
 266                    foreach($subkeys as $sk)
 267                  {
 268                         if($utf_error == "" && !is_utf8($check[$k][$sk]))
 269                      {
 270                          $utf_error = "<i>".LAN_CHECK_19."</i><br />";
 271                      }
 272  
 273                      if($sk == "LC_ALL"){
 274                          $check[$k][$sk] = str_replace(chr(34).chr(34),"",$check[$k][$sk]);
 275                      }
 276  
 277                      if((!array_key_exists($sk,$check[$k]) && $English[$k][$sk] != "") || (trim($check[$k][$sk]) == "" && $English[$k][$sk] != ""))
 278                      {
 279  
 280                               $er .= ($er) ? "<br />" : "";
 281                            $er .= $sk." ".LAN_CHECK_5;
 282                      }
 283                    }
 284  
 285                  $style = ($er) ? "forumheader2" : "forumheader3";
 286                     $text .= "<td class='{$style}' style='width:50%'><div class='smalltext'>";
 287                  $text .= $bom_error . $utf_error;
 288                  $text .= (!$er && !$bom_error && !$utf_error) ? LAN_OK : $er."<br />";
 289                  $text .= "</div></td>";
 290              }
 291              else
 292              {
 293                    $text .= "<tr>
 294                  <td class='forumheader3' style='width:45%'>{$lnk}</td>
 295                  <td class='forumheader' style='width:50%'>".LAN_CHECK_4."</td>"; // file missing.
 296              }
 297              // Leave in EDIT button for all entries - to allow re-translation of bad entries.
 298              $subpath = ($subdir!='') ? $subdir.$k : $k;
 299              $text .="<td class='forumheader3' style='width:5%;text-align:center'>
 300              <input class='tbox' type='button' style='width:60px' name='but_$i' value=\"".LAN_EDIT."\" onclick=\"window.location='".e_SELF."?".$subpath."|".$_POST['language']."'\" /> ";
 301              $text .="</td></tr>";
 302          }
 303        }
 304      $text .= "</table>";
 305  
 306       return $text;
 307  }
 308  
 309  
 310  function get_lan_file_phrases($dir1,$dir2,$file1,$file2){
 311  
 312      $ret = array();
 313      $fname = $dir1.$file1;
 314      $type='orig';
 315  
 316      if(is_file($fname))
 317      {
 318          $data = file($fname);
 319          $ret=$ret + fill_phrases_array($data,$type);
 320          if(substr($data[0],0,5) != "<?php")
 321          {
 322              $key = str_replace(".php","",$fname);
 323              $ret['bom'][$key] = $fname;
 324          }
 325      }
 326  
 327      $fname = $dir2.$file2;
 328      $type='tran';
 329  
 330      if(is_file($fname))
 331      {
 332          $data = file($fname);
 333          $ret=$ret + fill_phrases_array($data,$type);
 334          if(substr($data[0],0,5) != "<?php")
 335          {
 336              $key = str_replace(".php","",$fname);
 337              $ret['bom'][$key] = $fname;
 338          }
 339      }
 340      return $ret;
 341  }
 342  
 343  
 344  function get_comp_lan_phrases($comp_dir,$lang,$depth=0)
 345  {
 346      require_once(e_HANDLER."file_class.php");
 347      $fl = new e_file;
 348      $ret = array();
 349  
 350      if($lang_array = $fl->get_files($comp_dir, ".php","standard",$depth)){
 351          sort($lang_array);
 352      }
 353  
 354         $regexp = (strpos($comp_dir,e_LANGUAGEDIR) !== FALSE) ? "#.php#" : "#".$lang."#";
 355  
 356      foreach($lang_array as $f)
 357      {
 358              if(preg_match($regexp,$f['path'].$f['fname']) && is_file($f['path'].$f['fname']))
 359              {
 360                  $data = file($f['path'].$f['fname']);
 361                  $relpath = str_replace($comp_dir,"",$f['path']);
 362                   if(substr($data[0],0,5) != "<?php")
 363                  {
 364                      $key = str_replace(".php","",$relpath.$f['fname']);
 365                      $ret['bom'][$key] = $f['fname'];
 366                  }
 367                  if($f['path'].$f['fname'] == e_LANGUAGEDIR.$lang."/".$lang.".php")
 368                  {
 369                      $f['fname'] = "English.php";  // change the key for the main language file.
 370                  }
 371  
 372                  if($f['path'].$f['fname'] == e_LANGUAGEDIR.$lang."/".$lang."_custom.php")
 373                  {
 374                      $f['fname'] = "English_custom.php";  // change the key for the main language file.
 375                  }
 376  
 377                  $ret=$ret + fill_phrases_array($data,$relpath.$f['fname']);
 378  
 379              }
 380      }
 381  
 382      return $ret;
 383  
 384  }
 385  
 386  // for plugins and themes - checkes what kind of language files directory structure we have
 387  function check_lanfiles($mode,$comp_name,$base_lan="English",$target_lan){
 388      global $ns,$sql;
 389  
 390      $folder['P'] = e_PLUGIN.$comp_name;
 391      $folder['T'] = e_THEME.$comp_name;
 392      $comp_dir = $folder[$mode];
 393  
 394         $baselang = get_comp_lan_phrases($comp_dir."/languages/","English",1);
 395         $check = get_comp_lan_phrases($comp_dir."/languages/",$target_lan,1);
 396  
 397      $text = "";
 398      $keys = array_keys($baselang);
 399      sort($keys);
 400  
 401      foreach($keys as $k)
 402          {
 403                $lnk = $k;
 404                //echo "klucz ".$k."<br />";
 405                $k_check = str_replace("English",$target_lan,$k);
 406                if(array_key_exists($k_check,$check))
 407              {
 408                  $text .= "<tr>
 409                  <td class='forumheader3' style='width:20%'>".$comp_name."</td>
 410                  <td class='forumheader3' style='width:25%'>".str_replace("English/","",$lnk)."</td>";
 411  
 412                  $subkeys = array_keys($baselang[$k]);
 413                  $er="";
 414                  $utf_error = "";
 415  
 416                  $bomkey = str_replace(".php","",$k_check);
 417                     $bom_error = ($check['bom'][$bomkey]) ? "<i>".LAN_CHECK_15."</i><br />" : ""; // illegal chars
 418  
 419                  foreach($subkeys as $sk)
 420                  {
 421                         if($utf_error == "" && !is_utf8($check[$k_check][$sk]))
 422                      {
 423                          $utf_error = "<i>".LAN_CHECK_19."</i><br />";
 424                      }
 425  
 426                        if(!array_key_exists($sk,$check[$k_check]) || (trim($check[$k_check][$sk]) == "" && $baselang[$k][$sk] != ""))
 427                      {
 428                          $er .= ($er) ? "<br />" : "";
 429                          $er .= $sk." ".LAN_CHECK_5;
 430                        }
 431                  }
 432  
 433                  $style = ($er) ? "forumheader2" : "forumheader3";
 434                     $text .= "<td class='{$style}' style='width:50%'><div class='smalltext'>";
 435                  $text .= $bom_error . $utf_error;
 436                   $text .= (!$er && !$bom_error && !$utf_error) ? LAN_OK : $er."<br />";
 437                  $text .= "</div></td>";
 438                }
 439              else
 440              {
 441                  $text .= "<tr>
 442                  <td class='forumheader3' style='width:20%'>".$comp_name."</td>
 443                  <td class='forumheader3' style='width:25%'>".str_replace("English/","",$lnk)."</td>
 444                  <td class='forumheader' style='width:50%'><span style='cursor:pointer' title=\"".str_replace("English",$target_lan,$lnk)."\">".LAN_CHECK_4."</span></td>";
 445                }
 446  
 447                $text .="<td class='forumheader3' style='width:5%;text-align:center'>
 448                <input class='tbox' type='button' style='width:60px' name='but_$i' value=\"".LAN_EDIT."\" onclick=\"window.location='".e_SELF."?".$comp_dir."/languages/".$lnk."|".$target_lan."|file'\" /> ";
 449                $text .="</td></tr>";
 450          }
 451  
 452  
 453  
 454    // if (!$known) {$text = LAN_CHECK_18." : --> ".$fname." :: ".$dname;}
 455    return $text;
 456  }
 457  
 458  function edit_lanfiles($dir1,$dir2,$f1,$f2){
 459    global $ns,$sql,$lan;
 460  
 461  /*    echo "<br />dir1 = $dir1";
 462      echo "<br />file1 = $f1";
 463  
 464      echo "<br />dir2 = $dir2";
 465      echo "<br />file2 = $f2";*/
 466  
 467      if($dir2.$f2 == e_LANGUAGEDIR.$lan."/English.php") // it's a language config file.
 468      {
 469          $f2 = $lan.".php";
 470          $root_file = e_LANGUAGEDIR.$lan."/".$lan.".php";
 471      }
 472      else
 473      {
 474          $root_file = $dir2.$f2;
 475      }
 476  
 477      if($dir2.$f2 == e_LANGUAGEDIR.$lan."/English_custom.php") // it's a language config file.
 478      {
 479          $f2 = $lan."_custom.php";
 480          $root_file = e_LANGUAGEDIR.$lan."/".$lan."_custom.php";
 481      }
 482  
 483  
 484      $writable = (is_writable($dir2)) ? TRUE : FALSE;
 485      $trans = get_lan_file_phrases($dir1,$dir2,$f1,$f2);
 486      $keys = array_keys($trans);
 487      sort($keys);
 488  
 489      $text = "<div style='text-align:center'>
 490      <form method='post' action='".e_SELF."?".e_QUERY."' id='transform'>
 491      <table style='".ADMIN_WIDTH."' class='fborder'>";
 492  
 493      $subkeys = array_keys($trans['orig']);
 494      foreach($subkeys as $sk)
 495      {
 496          $rowamount = round(strlen($trans['orig'][$sk])/34)+1;
 497          $hglt1=""; $hglt2="";
 498          if ($trans['tran'][$sk] == "" && $trans['orig'][$sk]!="") {
 499              $hglt1="<span style='font-style:italic;font-weight:bold;color:red'>";
 500              $hglt2="</span>";
 501          }
 502          $text .="<tr>
 503          <td class='forumheader3' style='width:10%;vertical-align:top'>".$hglt1.htmlentities($sk).$hglt2."</td>
 504          <td class='forumheader3' style='width:40%;vertical-align:top'>".htmlentities(str_replace("ndef++","",$trans['orig'][$sk])) ."</td>";
 505          $text .= "<td class='forumheader3' style='width:50%;vertical-align:top'>";
 506          $text .= ($writable) ? "<textarea  class='tbox' name='newlang[]' rows='$rowamount' cols='45' style='height:100%'>" : "";
 507          $text .= str_replace("ndef++","",$trans['tran'][$sk]);
 508          $text .= ($writable) ? "</textarea>" : "";
 509          //echo "orig --> ".$trans['orig'][$sk]."<br />";
 510          if (strpos($trans['orig'][$sk],"ndef++") !== False)
 511          {
 512                //echo "+orig --> ".$trans['orig'][$sk]." <> ".strpos($trans['orig'][$sk],"ndef++")."<br />";
 513                $text .= "<input type='hidden' name='newdef[]' value='ndef++".$sk."' />";
 514          }
 515          else
 516          {
 517              $text .= "<input type='hidden' name='newdef[]' value='".$sk."' />";
 518          }
 519          $text .="</td></tr>";
 520        }
 521  
 522      //Check if directory is writable
 523      if($writable)
 524      {
 525          $text .="<tr style='vertical-align:top'>
 526          <td colspan='3' style='text-align:center' class='forumheader'>
 527          <input class='button' type='submit' name='submit' value=\"".LAN_SAVE." ".str_replace($dir2,"",$root_file)." \" />";
 528  
 529          if($root_file)
 530          {
 531              $text .= "<input type='hidden' name='root' value='".$root_file."' />";
 532          }
 533  
 534          $text .= "</td></tr>";
 535      }
 536  
 537      $text .= "
 538      </table>
 539      </form>
 540      </div>";
 541  
 542      $text .= "<form method='post' action='".e_SELF."' id='select_lang'>
 543              <div style='text-align:center'><br />";
 544      $text .= (!$writable) ? "<br />".$dir2.$f2.LAN_NOTWRITABLE : "";
 545      $text .= "<br /><br /><input class='button' type='submit' name='language_sel' value=\"".LAN_BACK."\" />
 546              <input type='hidden' name='language' value='$lan' /></div></form>";
 547  
 548  
 549      $caption = LAN_CHECK_3." <b>".$dir2.$f2."</b> -> <b>".$lan."</b>";
 550      $ns -> tablerender($caption, $text);
 551      require_once(e_ADMIN."footer.php");
 552      exit;
 553  
 554  }
 555  
 556  function fill_phrases_array($data,$type) {
 557  
 558      $retloc = array();
 559  
 560      foreach($data as $line){
 561          //echo "line--> ".$line."<br />";
 562          if (strpos($line,"define(") !== FALSE && strpos($line,");") === FALSE)
 563          {
 564              $indef=1;
 565              $bigline="";
 566              // echo "big1 -->".$line."<br />";
 567          }
 568          if ($indef)
 569          {
 570              $bigline.=str_replace("\n","",$line);
 571              // echo "big2 -->".$line."<br />";
 572          }
 573          if (strpos($line,"define(") === FALSE && strpos($line,");") !== FALSE)
 574          {
 575              $indef=0;
 576              $we_have_bigline=1;
 577              // echo "big3 -->".$line."<br />";
 578          }
 579  
 580          if(strpos($line,"setlocale(") !== FALSE)
 581          {
 582              $indef=1;
 583              $we_have_bigline=0;
 584          }
 585  
 586          if ((strpos($line,"define(") !== FALSE && strpos($line,");") !== FALSE && substr(ltrim($line),0,2) != "//") || $we_have_bigline || strpos($line,"setlocale(") !== FALSE)
 587          {
 588  
 589              if ($we_have_bigline)
 590              {
 591                  $we_have_bigline=0;
 592                  $line=$bigline;
 593                  // echo "big -->".$line."<br />";
 594              }
 595              $ndef = "";
 596              //echo "_ndefline -->".$line."<br />";
 597              if (strpos($line,"defined(") !== FALSE )
 598              {
 599                  $ndef = "ndef++";
 600                  $line = substr($line,strpos($line,"define("));
 601              }
 602  
 603              if(strpos($line,"setlocale(") !== FALSE)
 604              {
 605                  $pos = substr(strstr($line,","),1);
 606                  $rep = array(");","\n",'""');
 607                  $val = str_replace($rep,"",$pos);
 608                  $retloc[$type]['LC_ALL']= $val;
 609                  $retloc['orig']['LC_ALL']= "'en'";
 610              }
 611              else
 612              {
 613  
 614              //echo "ndefline: ".$line."<br />";
 615                    if(preg_match("#\"(.*?)\".*?\"(.*)\"#",$line,$matches) ||
 616                   preg_match("#\'(.*?)\'.*?\"(.*)\"#",$line,$matches) ||
 617                   preg_match("#\"(.*?)\".*?\'(.*)\'#",$line,$matches) ||
 618                   preg_match("#\'(.*?)\'.*?\'(.*)\'#",$line,$matches) ||
 619                   preg_match("#\((.*?)\,.*?\"(.*)\"#",$line,$matches) ||
 620                   preg_match("#\((.*?)\,.*?\'(.*)\'#",$line,$matches)){
 621                  //echo "get_lan -->".$matches[1]." :: ".$ndef.$matches[2]."<br />";
 622                  $retloc[$type][$matches[1]]= $ndef.$matches[2];
 623                  }
 624              }
 625           }
 626        }
 627  
 628        return $retloc;
 629      }
 630  
 631  //--------------------------------------------------------------------
 632  
 633  
 634  function is_utf8($str) {
 635      /*
 636      * @see http://hsivonen.iki.fi/php-utf8/   validation.php
 637      */
 638      if(strtolower(CHARSET) != "utf-8" || $str == "")
 639      {
 640          return TRUE;
 641      }
 642  
 643      return (preg_match('/^.{1}/us',$str,$ar) == 1);
 644  }
 645  
 646  
 647  function lancheck_adminmenu() {
 648  
 649      include_lan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_language.php");
 650  
 651      global $action,$pref;
 652      if ($action == "") {
 653          $action = "tools";
 654      }
 655  
 656      if($action == "modify"){
 657          $action = "db";
 658      }
 659      $var['main']['text'] = LAN_PREFS;
 660      $var['main']['link'] = e_ADMIN."language.php";
 661  
 662      if(isset($pref['multilanguage']) && $pref['multilanguage']){
 663          $var['db']['text'] = LANG_LAN_03;
 664          $var['db']['link'] = e_ADMIN."language.php?db";
 665      }
 666  
 667      $var['tools']['text'] = ADLAN_CL_6;
 668      $var['tools']['link'] = e_ADMIN."language.php?tools";
 669  
 670  
 671      show_admin_menu(ADLAN_132, $action, $var);
 672  }
 673  
 674  ?>


Généré le : Sun Apr 1 01:23:32 2007 par Balluche grâce à PHPXref 0.7