LEPTON CMS 7.2.0
feel free to keep it strictly simple...
Loading...
Searching...
No Matches
constants.php
Go to the documentation of this file.
1<?php
2
18// include secure.php to protect this file and the whole CMS!
19if(!defined("SEC_FILE")){define("SEC_FILE",'/framework/secure.php' );}
20if (defined('LEPTON_PATH')) {
21 include LEPTON_PATH.SEC_FILE;
22} else {
23 $oneback = "../";
24 $root = $oneback;
25 $level = 1;
26 while (($level < 10) && (!file_exists($root.SEC_FILE))) {
27 $root .= $oneback;
28 $level += 1;
29 }
30 if (file_exists($root.SEC_FILE)) {
31 include $root.SEC_FILE;
32 } else {
33 trigger_error(sprintf("[ <b>%s</b> ] Can't include secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR);
34 }
35}
36// end include secure file
37
38
39
43const USERS_DELETED = 1; // User marked as deleted
44const USERS_ACTIVE = 2; // User is activated
45const USERS_CAN_SETTINGS = 4; // User can change own settings
46const USERS_CAN_SELF_DELETE = 8; // User can delete himself
47const USERS_PROFILE_ALLOWED = 16; // User can create a profile page
48const USERS_PROFILE_AVAIL = 32; // User has fulfilled profile and can not be deleted via core
49const USERS_DEFAULT_SETTINGS = USERS_ACTIVE | USERS_CAN_SETTINGS; // provided as status-flags = 6 in users table
50
51// Get an instance from class database
53
54// Get website settings (title, keywords, description, header, and footer) to define constants
56$database->execute_query(
57 "SELECT name, value FROM ". TABLE_PREFIX."settings ORDER BY name ",
58 true,
60);
61
62foreach ( $storage as $row )
63{
64 if ( preg_match( '/^0[0-7]{1,3}$/', $row[ 'value' ] ) === 1 )
65 {
66 $value = $row[ 'value' ];
67 }
68 elseif ( preg_match( '/^[0-9]+$/S', $row[ 'value' ] ) === 1 )
69 {
70 $value = intval( $row[ 'value' ] );
71 }
72 elseif ( $row[ 'value' ] == 'false' )
73 {
74 $value = false;
75 }
76 elseif ( $row[ 'value' ] == 'true' )
77 {
78 $value = true;
79 }
80 else
81 {
82 $value = $row[ 'value' ];
83 }
84
85 // decode html tags
86 if( ($row['name'] == "website_header") || ($row['name'] == "website_footer") )
87 {
89 }
90
91 // create constant from each settings value
92 $temp_name = strtoupper( $row[ 'name' ] );
93 if ( !defined( $temp_name ) )
94 {
95 define( $temp_name, $value );
96 }
97}
98unset( $row );
99
100
101if ( !defined( 'LEPTON_INSTALL_PROCESS' ) )
102{
103 // get CAPTCHA and ASP settings
104 $setting = [];
105 $database->execute_query(
106 "SELECT * FROM ".TABLE_PREFIX."mod_captcha_control ",
107 true,
108 $setting,
109 false
110 );
111
112 if ( empty($setting))
113 {
114 die( "CAPTCHA-Settings not found" );
115 }
116
117 define( 'ENABLED_CAPTCHA', $setting[ 'enabled_captcha' ]);
118 define( 'ENABLED_ASP', $setting[ 'enabled_asp' ]);
119 define( 'CAPTCHA_TYPE', $setting[ 'captcha_type' ] );
120
121 if(ENABLED_ASP == 1)
122 {
123 define( 'ASP_SESSION_MIN_AGE', (int) $setting[ 'asp_session_min_age' ] );
124 define( 'ASP_VIEW_MIN_AGE', (int) $setting[ 'asp_view_min_age' ] );
125 define( 'ASP_INPUT_MIN_AGE', (int) $setting[ 'asp_input_min_age' ] );
126 }
127 unset( $setting );
128
129
130 // Setting the correct default timezone to avoid "date" conflicts and warnings
131 $timezone_string = ($_SESSION['TIMEZONE_STRING'] ?? DEFAULT_TIMEZONE_STRING);
132 date_default_timezone_set($timezone_string);
133
134 // Get users date format
135 define('DATE_FORMAT', ($_SESSION['DATE_FORMAT'] ?? DEFAULT_DATE_FORMAT));
136
137 // Get users time format
138 define('TIME_FORMAT', ($_SESSION['TIME_FORMAT'] ?? DEFAULT_TIME_FORMAT));
139
140 // Set Theme dir
141 define('THEME_URL', LEPTON_URL . '/templates/' . DEFAULT_THEME);
142 define('THEME_PATH', LEPTON_PATH . '/templates/' . DEFAULT_THEME);
143
144 // Set Module dir
145 define('MODULE_URL', LEPTON_URL . '/modules');
146 define('MODULE_PATH', LEPTON_PATH . '/modules');
147
148 // Set Secure dir
149 define('SECURE_URL', LEPTON_URL . '/temp/secure');
150 define('SECURE_PATH', LEPTON_PATH . '/temp/secure');
151
152}
153else
154{
155 // Set Theme dir
156 define('THEME_URL', LEPTON_URL . '/templates/lepsem');
157 define('THEME_PATH', LEPTON_PATH . '/templates/lepsem');
158}
static getInstance(array &$settings=[])
static restoreSpecialChars(string &$sAnyString, array $aAnyAssocArray=self::SPECIAL_CHARS_RESTORE)
const USERS_DELETED
Definition constants.php:43
const USERS_CAN_SETTINGS
Definition constants.php:45
$storage
Definition constants.php:55
const USERS_CAN_SELF_DELETE
Definition constants.php:46
$database
Definition constants.php:52
const USERS_DEFAULT_SETTINGS
Definition constants.php:49
$root
Definition constants.php:24
$level
Definition constants.php:25
const USERS_ACTIVE
Definition constants.php:44
const USERS_PROFILE_AVAIL
Definition constants.php:48
const USERS_PROFILE_ALLOWED
Definition constants.php:47