PHP - AYUDA ERROR PHP

 
Vista:
sin imagen de perfil
Val: 18
Ha aumentado su posición en 6 puestos en PHP (en relación al último mes)
Gráfica de PHP

AYUDA ERROR PHP

Publicado por RED HORMIGAS (10 intervenciones) el 12/07/2019 21:51:23
Hola amigos tengo un error pero no se como corregirlo y necesito sus ayuda.

Warning: Use of undefined constant DefaultLang - assumed 'DefaultLang' (this will throw an Error in a future version of PHP) in C:\wamp64\www\xNova\includes\classes\class.Lang.php on line 22

Warning: Use of undefined constant DefaultLang - assumed 'DefaultLang' (this will throw an Error in a future version of PHP) in C:\wamp64\www\xNova\includes\classes\class.Lang.php on line 23

function __construct()
21 {
22 $this->Default = DefaultLang;
23 $this->User = DefaultLang;
24 }

ESTAS SON DICHAS LINEAS

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in C:\wamp64\www\xNova\includes\classes\class.Lang.php on line 103

101 {
102 global $LNG;
103 while (list(,$File) = each($Files)){
104 require(ROOT_PATH . "language/es/".$File.'.php');
105 require(ROOT_PATH . "language/".$this->User."/".$File.'.php');
106 }
107 }

Estos son los mensajes que salen al ejecutar el proyecto desde el servidor local.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<?php
 
class Language
{
   public static $langs   = array(
      'de' => 'Deutsch',
      'en' => 'English',
      'es' => 'Español',
      'fr' => 'Français',
      'pt' => 'Português',
      'ru' => 'Русский',
	  'it' => 'Italian',
	  'ro' => 'Romanian',
	  'si' => 'Slovenščina',
   );
 
   public $Default   = '';
   public $User   = '';
 
   function __construct()
   {
      $this->Default   = DefaultLang;
      $this->User      = DefaultLang;
   }
 
   static function getAllowedLangs($OnlyKey = true)
   {
      return $OnlyKey ? array_keys(self::$langs) : self::$langs;
   }
 
   function setDefault($LANG)
   {
      if(!empty($LANG) && in_array($LANG, self::getAllowedLangs())) {
         $this->Default   = $LANG;
         $this->User      = $LANG;
      }
   }
 
   function setUser($LANG)
   {
      if(!empty($LANG) && in_array($LANG, self::getAllowedLangs()))
         $this->User   = $LANG;
   }
 
   function getUser()
   {
      return $this->User;
   }
 
   function GetLangFromBrowser($strict_mode = true)
   {
 
        if(defined('LOGIN') && isset($_COOKIE['lang']) && in_array($_COOKIE['lang'], self::getAllowedLangs())) {
         $this->setUser($_COOKIE['lang']);
         return $this->User;
      }
 
      if(isset($_REQUEST['lang']) && in_array($_REQUEST['lang'], self::getAllowedLangs())) {
       $this->setUser($_REQUEST['lang']);
      return $this->User;
      }
 
       if (empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
            return $this->Default;
        }
 
        $accepted_languages = preg_split('/,\s*/', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
 
        $current_lang = $this->Default;
        $current_q = 0;
 
        foreach ($accepted_languages as $accepted_language) {
            $res = preg_match ('/^([a-z]{1,8}(?:-[a-z]{1,8})*)'.'(?:;\s*q=(0(?:\.[0-9]{1,3})?|1(?:\.0{1,3})?))?$/i', $accepted_language, $matches);
 
            if (!$res) {
                continue;
            }
 
            $LANG_code = explode ('-', $matches[1]);
         $LANG_quality = isset($matches[2]) ? (float)$matches[2] : 1.0;
 
            while (count ($LANG_code)) {
                if (in_array (strtolower (join ('-', $LANG_code)),  self::getAllowedLangs())) {
                    if ($LANG_quality > $current_q) {
                        $current_lang = strtolower (join ('-', $LANG_code));
                        $current_q = $LANG_quality;
                        break;
                    }
                }
                if ($strict_mode) {
                    break;
                }
                array_pop ($LANG_code);
            }
        }
        $this->setUser($current_lang);
      return $this->User;
   }
 
   function includeLang($Files)
   {
      global $LNG;
      while (list(,$File) = each($Files)){
         require(ROOT_PATH . "language/es/".$File.'.php');
         require(ROOT_PATH . "language/".$this->User."/".$File.'.php');
      }
   }
 
   function getExtra($File)
   {
		if(file_exists(ROOT_PATH."language/".$this->User."/extra/".$File.".txt"))
			return file_get_contents(ROOT_PATH."language/".$this->User."/extra/".$File.".txt");
 
		return "";
	}
 
	function getMail($File)
	{
		if(file_exists(ROOT_PATH."language/".$this->User."/email/".$File.".txt"))
			return file_get_contents(ROOT_PATH."language/".$this->User."/email/".$File.".txt");
 
		return "";
	}
 
   function GetUserLang($ID, $Files = array())
   {
      global $db, $CONF;
      $LANGUAGE = is_numeric($ID) && !in_array($ID, self::getAllowedLangs()) ? $db->countquery("SELECT `lang` FROM ".USERS." WHERE `id` = '".$ID."';") : $ID;
 
      if(!in_array($LANGUAGE, self::getAllowedLangs()))
         $LANGUAGE   = $this->Default;
 
      if(empty($Files))
         $Files   = array('FLEET');
 
      while (list(,$File) = each($Files)){
         require(ROOT_PATH . "language/".$LANGUAGE."/".$File.'.php');
      }
 
      return $LNG;
   }
}
 
?>

Este es el código que se supone que tiene el error.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de Alejandro
Val: 1.634
Plata
Ha mantenido su posición en PHP (en relación al último mes)
Gráfica de PHP

AYUDA ERROR PHP

Publicado por Alejandro (832 intervenciones) el 12/07/2019 22:05:57
  • Alejandro se encuentra ahora conectado en el
  • chat de PHP
Esta claro no tienes definida la constante DefaulLang
1
define("DefaulLang", "es");
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
Imágen de perfil de Alejandro
Val: 1.634
Plata
Ha mantenido su posición en PHP (en relación al último mes)
Gráfica de PHP

AYUDA ERROR PHP

Publicado por Alejandro (832 intervenciones) el 12/07/2019 22:44:50
  • Alejandro se encuentra ahora conectado en el
  • chat de PHP
DefaultLang no es nada, no esta definida.

$DefaultLang="es" una variable definida con valor "es".

define("DefaultLang","es"); DefaultLang ahora esta definida como una constante con el valor de "es".
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil
Val: 18
Ha aumentado su posición en 6 puestos en PHP (en relación al último mes)
Gráfica de PHP

AYUDA ERROR PHP

Publicado por RED HORMIGAS (10 intervenciones) el 12/07/2019 22:49:53
Amigo y con este que debo hacer?

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in C:\wamp64\www\xNova\includes\classes\class.Lang.php on line 109

101 {
102 global $LNG;
103 while (list(,$File) = each($Files)){
104 require(ROOT_PATH . "language/es/".$File.'.php');
105 require(ROOT_PATH . "language/".$this->User."/".$File.'.php');
106 }
107 }
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
Imágen de perfil de Alejandro
Val: 1.634
Plata
Ha mantenido su posición en PHP (en relación al último mes)
Gráfica de PHP

AYUDA ERROR PHP

Publicado por Alejandro (832 intervenciones) el 12/07/2019 23:07:45
  • Alejandro se encuentra ahora conectado en el
  • chat de PHP
No lo se, dice que el error esta en la linea 9 pero no se que tienes en esa linea.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil
Val: 18
Ha aumentado su posición en 6 puestos en PHP (en relación al último mes)
Gráfica de PHP

AYUDA ERROR PHP

Publicado por RED HORMIGAS (10 intervenciones) el 12/07/2019 23:08:47
Deprecated: The each() function is deprecated. This message will be suppressed on further calls in C:\wamp64\www\xNova\includes\classes\class.Lang.php on line 103

101 {
102 global $LNG;
103 while (list(,$File) = each($Files)){
104 require(ROOT_PATH . "language/es/".$File.'.php');
105 require(ROOT_PATH . "language/".$this->User."/".$File.'.php');
106 }
107 }
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
Imágen de perfil de Alejandro
Val: 1.634
Plata
Ha mantenido su posición en PHP (en relación al último mes)
Gráfica de PHP

AYUDA ERROR PHP

Publicado por Alejandro (832 intervenciones) el 12/07/2019 23:26:56
  • Alejandro se encuentra ahora conectado en el
  • chat de PHP
1
while (list($key,$File) = each($Files)){

igual si no te funciona pudieras reemplazarlo con foreach
1
foreach($Files as $File){
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil
Val: 18
Ha aumentado su posición en 6 puestos en PHP (en relación al último mes)
Gráfica de PHP

AYUDA ERROR PHP

Publicado por RED HORMIGAS (10 intervenciones) el 12/07/2019 23:34:52
Me sirvio muy bien amigo, estoy actualizando un proyecto de hace varios años y tengo varias lineas de error, hay alguna forma para contactarnos mar rapido y fluido? claro si puedes amigo. No son muchas las lineas, solo algunos pequeños errores. o desactualizaciones.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
Imágen de perfil de Alejandro
Val: 1.634
Plata
Ha mantenido su posición en PHP (en relación al último mes)
Gráfica de PHP

AYUDA ERROR PHP

Publicado por Alejandro (832 intervenciones) el 13/07/2019 00:54:20
  • Alejandro se encuentra ahora conectado en el
  • chat de PHP
A veces estoy en el chat de PHP y seguro los demás colegas que ahí se conectan también podrían ayudarte, siempre y cuando no pidas que lo resuelvan por ti (¬_¬ ¡)
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil
Val: 18
Ha aumentado su posición en 6 puestos en PHP (en relación al último mes)
Gráfica de PHP

AYUDA ERROR PHP

Publicado por RED HORMIGAS (10 intervenciones) el 13/07/2019 00:56:04
Jajajajaja bueno estoy aprendiendo poco a poco hay voy poniendo los codigo a ver que tal si me pueden ayudar, ya no manejo mucho php.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar