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.
Este es el código que se supone que tiene el error.
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


0