Ver Mensaje Individual
  #4 (permalink)  
Antiguo 02/07/2014, 19:00
Avatar de arcanisgk122
arcanisgk122
 
Fecha de Ingreso: junio-2010
Mensajes: 755
Antigüedad: 13 años, 11 meses
Puntos: 28
Respuesta: Eror con $_SESSION

ya detecte el primer warning y lo he limpiado al parecer era un problema de orden ya que quería poner todos los require primero y en algunos se ejecutan las cosas automáticamente y no cumplía con la lógica y el orden pero ahora tengo otros inconvenientes:

Cita:
Notice: Undefined variable: langfile in C:\xampp\htdocs\phpcore\class.language.php on line 62

Notice: Undefined variable: langfile in C:\xampp\htdocs\phpcore\class.language.php on line 64

Warning: include_once(/lang/.conf): failed to open stream: No such file or directory in C:\xampp\htdocs\phpcore\class.language.php on line 38

Warning: include_once(): Failed opening '/lang/.conf' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\phpcore\class.language.php on line 38

Código PHP:
Ver original
  1. <?php
  2. class Language{
  3.     function detectLanguage() {
  4.         /*if(empty($_SESSION['deteclang'])){
  5.             $lang=substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2);
  6.             $_SESSION['deteclang']=$lang;
  7.             return $_SESSION['deteclang'];*/
  8.  
  9.             global $DEFAULT_LANGUAGE;
  10.             if ($_SERVER['HTTP_ACCEPT_LANGUAGE']) {
  11.                 $this->languages = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
  12.                 $this->language = substr($this->languages,0,2);
  13.                 return $this->language;
  14.             }
  15.             else if ($_SERVER['HTTP_USER_AGENT']) {
  16.                 $this->user_agent = explode(";" , $_SERVER['HTTP_USER_AGENT']);
  17.  
  18.                 for ($i=0; $i < sizeof($this->user_agent); $i++) {
  19.                     $this->languages = explode("-",$this->user_agent[$i]);
  20.                     if (sizeof($this->languages) == 2) {
  21.                         if (strlen(trim($this->languages[0])) == 2) {
  22.                             $size = sizeof($this->language);
  23.                             $this->language[$size]=trim($this->languages[0]);
  24.                         }
  25.                     }
  26.                 }
  27.                 return $this->language[0];
  28.             }
  29.             else {
  30.                 $this->language = $DEFAULT_LANGUAGE;
  31.                 return $this->language;
  32.             }
  33.    
  34.         }
  35.     function getLanguage($language = null) {
  36.             global $LANGUAGE_DIR;
  37.             $lang = $this->setLanguage($language);
  38.             include_once $LANGUAGE_DIR."/".$lang.".conf"; //linea 38
  39.             return $language = $lang;
  40.         }
  41.     function setLanguage($userLang){
  42.         echo"$userLang";
  43.         if(isset($_SESSION['lang'])){
  44.         }else{
  45.             $deteclang = $_SESSION['deteclang'];
  46.             if(isset($userLang)){
  47.                 if($userLang=='es'){ $langfile = 'es.inc.php'; }
  48.                 if($userLang=='en'){ $langfile = 'en.inc.php'; }
  49.                 if($userLang=='pt'){ $langfile = 'pt.inc.php'; }
  50.                 if($userLang=='fr'){ $langfile = 'fr.inc.php'; }
  51.                 echo $lang;
  52.                 echo $langfile;
  53.                 $_SESSION['deteclang']  =$deteclang;
  54.                 $_SESSION["lang"]       =$langfile;
  55.             }else{
  56.                 $lang=$deteclang;
  57.                 if($lang=='es'){ $langfile = 'es.inc.php'; }
  58.                 if($lang=='en'){ $langfile = 'en.inc.php'; }
  59.                 if($lang=='pt'){ $langfile = 'pt.inc.php'; }
  60.                 if($lang=='fr'){ $langfile = 'fr.inc.php'; }
  61.                 echo $lang;
  62.                 echo $langfile;   // linea 62
  63.                 $_SESSION['deteclang']  =$deteclang;
  64.                 $_SESSION["lang"]       =$langfile;   //linea 64
  65.             }
  66.         }
  67.     }
  68.     function cargaLanguage(){
  69.         $lang = $_SESSION["lang"];
  70.         $directorio = './lang/';
  71.         $pathfile = $directorio.$lang;
  72.         include_once ($pathfile);
  73.         return $langArray;
  74.     }
  75. }
  76. ?>


no se por donde devorar esto, lo que mas me molesta es el Notice
__________________
Cooler Master Gladiator 600 - AMD PHENOM II X4 955 @ 3.5GHZ
GA-MA78GM-US2H - Super Talent 800 2GB x 2 Dual, (Unganged)
PSU Cooler Master eXtreme Power Plus 500W - Saphire R7-260OC-2GB