20if(!defined(
"SEC_FILE")){define(
"SEC_FILE",
'/framework/secure.php' );}
21if (defined(
'LEPTON_PATH')) {
22 include LEPTON_PATH.SEC_FILE;
27 while ((
$level < 10) && (!file_exists(
$root.SEC_FILE))) {
31 if (file_exists(
$root.SEC_FILE)) {
32 include
$root.SEC_FILE;
34 trigger_error(sprintf(
"[ <b>%s</b> ] Can't include secure.php!", $_SERVER[
'SCRIPT_NAME']), E_USER_ERROR);
39if (!function_exists(
"lepton_autoloader"))
41 require_once __DIR__.
"/functions/function.lepton_autoloader.php";
42 spl_autoload_register(
"lepton_autoloader",
true);
55if (is_numeric(ER_LEVEL))
57 error_reporting( ER_LEVEL );
60 ini_set(
'display_errors', 1);
65if (!defined(
'SESSION_STARTED'))
68 session_name(APP_NAME .
'sessionid');
79 unset($cookie_settings);
82 define(
'SESSION_STARTED',
true );
85 $_SESSION[
'LSH'] = password_hash( LEPTON_GUID, PASSWORD_DEFAULT);
90if (
true === isset($_COOKIE[APP_NAME.
'sessionid']))
95if (defined(
'ENABLED_ASP') && !isset($_SESSION[
'SESSION_STARTED']))
97 $_SESSION[
'SESSION_STARTED' ] = time();
101if (!defined(
"LEPTON_INSTALL_PROCESS"))
104 if ((!isset($_SESSION[
'LSH'])) || (!password_verify(LEPTON_GUID, $_SESSION[
'LSH'])))
109 header(
'Location: '.ADMIN_URL.
'/login/index.php');
115if (isset($_GET[
'lang']) && ($_GET[
'lang'] !=
'') && (!is_numeric($_GET[
'lang'])) && (strlen($_GET[
'lang']) == 2))
118 $iTempPageId = $page_id ?? ((defined(
"PAGE_ID") ? PAGE_ID : 0));
120 if (0 != $iTempPageId)
122 $sTempLang =
$database->get_one(
"SELECT `language` FROM `".TABLE_PREFIX.
"pages` WHERE `page_id` = ".$iTempPageId);
123 if (NULL != $sTempLang)
125 define(
'LANGUAGE', $sTempLang );
130 define(
'LANGUAGE', DEFAULT_LANGUAGE);
135 if (isset($_SESSION[
'USER_ID']))
137 $sTempLang =
$database->get_one(
"SELECT `language` FROM `".TABLE_PREFIX.
"users` WHERE `user_id`=" . $_SESSION[
'USER_ID']);
138 if (NULL != $sTempLang)
140 define(
'LANGUAGE', $sTempLang);
144 define(
'LANGUAGE', strtoupper($_GET[
'lang']));
149 define(
'LANGUAGE', strtoupper($_GET[
'lang']));
153 $_SESSION[
'LANGUAGE'] = LANGUAGE;
157 if (isset($_SESSION[
'LANGUAGE']) && ($_SESSION[
'LANGUAGE'] !=
''))
159 $iTempPageId = $page_id ?? ((defined(
"PAGE_ID") ? PAGE_ID : 0));
161 if (0 != $iTempPageId)
163 $sTempLang =
$database->get_one(
"SELECT `language` FROM `" . TABLE_PREFIX .
"pages` WHERE `page_id`=" . $iTempPageId);
164 if (NULL != $sTempLang)
166 define(
'LANGUAGE', $sTempLang);
171 define(
'LANGUAGE', $_SESSION[
'LANGUAGE']);
176 if (isset($_SESSION[
'USER_ID']))
178 $sTempLang =
$database->get_one(
"SELECT `language` FROM `" . TABLE_PREFIX .
"users` WHERE `user_id`='" . $_SESSION[
'USER_ID'] .
"'");
179 if (NULL != $sTempLang)
181 define(
'LANGUAGE', $sTempLang);
183 define(
'LANGUAGE', $_SESSION[
'LANGUAGE']);
188 define(
'LANGUAGE', $_SESSION[
'LANGUAGE']);
194 define(
'LANGUAGE', DEFAULT_LANGUAGE);
200if (!file_exists(LEPTON_PATH.
'/languages/'.LANGUAGE.
'.php'))
202 exit(
'Error loading language file '.LANGUAGE.
', please check configuration');
208 LANGUAGE.
'_custom.php',
212 foreach ($aLanguageFile as $sFile)
214 $sLanguagePath = LEPTON_PATH.
'/languages/';
215 if (file_exists($sLanguagePath.$sFile))
217 require_once $sLanguagePath.$sFile;
static getInstance(array &$settings=[])
static include_files(array|string $file_names=[], bool $interrupt=true)
static get_cookie_defaults()
static set_cookie(string $name, string|int $value, array $options=[], bool $mustExists=false, bool $mergeDefault=true)