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');
70 $cookie_settings = session_get_cookie_params();
73 if ($cookie_settings[
"lifetime"] <= 0)
75 $cookie_settings[
"lifetime" ] = 3 * 3600;
77 $cookie_settings[
"expires" ] = time() + (int) $cookie_settings[
"lifetime" ];
78 unset($cookie_settings[
"lifetime"]);
83 unset($cookie_settings);
89 define(
'SESSION_STARTED',
true );
92 $_SESSION[
'LSH'] = password_hash( LEPTON_GUID, PASSWORD_DEFAULT);
97if(
true === isset($_COOKIE[ APP_NAME .
'sessionid' ]))
102if (defined(
'ENABLED_ASP') && !isset($_SESSION[
'session_started']))
104 $_SESSION[
'session_started' ] = time();
108if (!defined(
"LEPTON_INSTALL_PROCESS"))
110 if ((!isset($_SESSION[
'LSH'])) || (!password_verify(LEPTON_GUID, $_SESSION[
'LSH'])))
115 header(
'Location: ' . ADMIN_URL .
'/login/index.php');
121if (isset($_SESSION[
'LANGUAGE']) && ($_SESSION[
'LANGUAGE'] !=
''))
123 $iTempPageId = $page_id ?? ((defined(
"PAGE_ID") ? PAGE_ID : 0));
125 if (0 != $iTempPageId)
127 $sTempLang =
$database->get_one(
"SELECT `language` FROM `" . TABLE_PREFIX .
"pages` WHERE `page_id`=" . $iTempPageId);
128 if (NULL != $sTempLang)
130 define(
'LANGUAGE', $sTempLang);
135 define(
'LANGUAGE', $_SESSION[
'LANGUAGE']);
140 if (isset($_SESSION[
'USER_ID']))
142 $sTempLang =
$database->get_one(
"SELECT `language` FROM `" . TABLE_PREFIX .
"users` WHERE `user_id`='" . $_SESSION[
'USER_ID'] .
"'");
143 if (NULL != $sTempLang)
145 define(
'LANGUAGE', $sTempLang);
147 define(
'LANGUAGE', $_SESSION[
'LANGUAGE']);
152 define(
'LANGUAGE', $_SESSION[
'LANGUAGE']);
158 define(
'LANGUAGE', DEFAULT_LANGUAGE);
163if (!file_exists(LEPTON_PATH .
'/languages/' . LANGUAGE .
'.php'))
165 exit(
'Error loading language file ' . LANGUAGE .
', please check configuration');
169 require_once (file_exists(LEPTON_PATH .
'/languages/' . LANGUAGE .
'_custom.php'))
170 ? LEPTON_PATH .
'/languages/' . LANGUAGE .
'_custom.php'
171 : LEPTON_PATH .
'/languages/' . LANGUAGE .
'.php'
static getInstance(array &$settings=[])
static include_files(array|string $file_names=[], bool $interrupt=true)
static set_cookie( $name, $value, $options=array(), $mustExists=false, $mergeDefault=true)