Revision 1289
Added by kweitzel almost 15 years ago
initialize.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
// $Id$ |
|
4 |
|
|
5 |
/* |
|
6 |
|
|
7 |
Website Baker Project <http://www.websitebaker.org/> |
|
8 |
Copyright (C) 2004-2009, Ryan Djurovich |
|
9 |
|
|
10 |
Website Baker is free software; you can redistribute it and/or modify |
|
11 |
it under the terms of the GNU General Public License as published by |
|
12 |
the Free Software Foundation; either version 2 of the License, or |
|
13 |
(at your option) any later version. |
|
14 |
|
|
15 |
Website Baker is distributed in the hope that it will be useful, |
|
16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
18 |
GNU General Public License for more details. |
|
19 |
|
|
20 |
You should have received a copy of the GNU General Public License |
|
21 |
along with Website Baker; if not, write to the Free Software |
|
22 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
23 |
|
|
24 |
*/ |
|
25 |
|
|
26 |
if (file_exists(WB_PATH.'/framework/class.database.php')) { |
|
27 |
|
|
28 |
require_once(WB_PATH.'/framework/class.database.php'); |
|
29 |
|
|
30 |
// Create database class |
|
31 |
$database = new database(); |
|
32 |
|
|
33 |
set_magic_quotes_runtime(0); |
|
34 |
|
|
35 |
// Get website settings (title, keywords, description, header, and footer) |
|
36 |
$query_settings = "SELECT name,value FROM ".TABLE_PREFIX."settings"; |
|
37 |
$get_settings = $database->query($query_settings); |
|
38 |
if($database->is_error()) { die($database->get_error()); } |
|
39 |
if($get_settings->numRows() == 0) { die("Settings not found"); } |
|
40 |
while($setting = $get_settings->fetchRow()) { |
|
41 |
$setting_name=strtoupper($setting['name']); |
|
42 |
$setting_value=$setting['value']; |
|
43 |
if ($setting_value=='false') |
|
44 |
$setting_value=false; |
|
45 |
if ($setting_value=='true') |
|
46 |
$setting_value=true; |
|
47 |
@define($setting_name,$setting_value); |
|
48 |
} |
|
49 |
$string_file_mode = STRING_FILE_MODE; |
|
50 |
define('OCTAL_FILE_MODE',(int) octdec($string_file_mode)); |
|
51 |
$string_dir_mode = STRING_DIR_MODE; |
|
52 |
define('OCTAL_DIR_MODE',(int) octdec($string_dir_mode)); |
|
53 |
|
|
54 |
if (!defined("WB_INSTALL_PROCESS")) { |
|
55 |
// get CAPTCHA and ASP settings |
|
56 |
$table = TABLE_PREFIX.'mod_captcha_control'; |
|
57 |
if($get_settings = $database->query("SELECT * FROM $table LIMIT 1")) { |
|
58 |
if($get_settings->numRows() == 0) { die("CAPTCHA-Settings not found"); } |
|
59 |
$setting = $get_settings->fetchRow(); |
|
60 |
if($setting['enabled_captcha'] == '1') define('ENABLED_CAPTCHA', true); |
|
61 |
else define('ENABLED_CAPTCHA', false); |
|
62 |
if($setting['enabled_asp'] == '1') define('ENABLED_ASP', true); |
|
63 |
else define('ENABLED_ASP', false); |
|
64 |
define('CAPTCHA_TYPE', $setting['captcha_type']); |
|
65 |
define('ASP_SESSION_MIN_AGE', (int)$setting['asp_session_min_age']); |
|
66 |
define('ASP_VIEW_MIN_AGE', (int)$setting['asp_view_min_age']); |
|
67 |
define('ASP_INPUT_MIN_AGE', (int)$setting['asp_input_min_age']); |
|
68 |
} |
|
69 |
} |
|
70 |
// set error-reporting |
|
71 |
if(is_numeric(ER_LEVEL)) { |
|
72 |
error_reporting(ER_LEVEL); |
|
73 |
} |
|
74 |
|
|
75 |
// Start a session |
|
76 |
if(!defined('SESSION_STARTED')) { |
|
77 |
session_name(APP_NAME.'_session_id'); |
|
78 |
@session_start(); |
|
79 |
define('SESSION_STARTED', true); |
|
80 |
} |
|
81 |
if(defined('ENABLED_ASP') && ENABLED_ASP && !isset($_SESSION['session_started'])) |
|
82 |
$_SESSION['session_started'] = time(); |
|
83 |
|
|
84 |
// Get users language |
|
85 |
if(isset($_GET['lang']) AND $_GET['lang'] != '' AND !is_numeric($_GET['lang']) AND strlen($_GET['lang']) == 2) { |
|
86 |
define('LANGUAGE', strtoupper($_GET['lang'])); |
|
87 |
$_SESSION['LANGUAGE']=LANGUAGE; |
|
88 |
} else { |
|
89 |
if(isset($_SESSION['LANGUAGE']) AND $_SESSION['LANGUAGE'] != '') { |
|
90 |
define('LANGUAGE', $_SESSION['LANGUAGE']); |
|
91 |
} else { |
|
92 |
define('LANGUAGE', DEFAULT_LANGUAGE); |
|
93 |
} |
|
94 |
} |
|
95 |
|
|
96 |
// Load Language file |
|
97 |
if(!defined('LANGUAGE_LOADED')) { |
|
98 |
if(!file_exists(WB_PATH.'/languages/'.LANGUAGE.'.php')) { |
|
99 |
exit('Error loading language file '.LANGUAGE.', please check configuration'); |
|
100 |
} else { |
|
101 |
require_once(WB_PATH.'/languages/'.LANGUAGE.'.php'); |
|
102 |
} |
|
103 |
} |
|
104 |
|
|
105 |
// Get users timezone |
|
106 |
if(isset($_SESSION['TIMEZONE'])) { |
|
107 |
define('TIMEZONE', $_SESSION['TIMEZONE']); |
|
108 |
} else { |
|
109 |
define('TIMEZONE', DEFAULT_TIMEZONE); |
|
110 |
} |
|
111 |
// Get users date format |
|
112 |
if(isset($_SESSION['DATE_FORMAT'])) { |
|
113 |
define('DATE_FORMAT', $_SESSION['DATE_FORMAT']); |
|
114 |
} else { |
|
115 |
define('DATE_FORMAT', DEFAULT_DATE_FORMAT); |
|
116 |
} |
|
117 |
// Get users time format |
|
118 |
if(isset($_SESSION['TIME_FORMAT'])) { |
|
119 |
define('TIME_FORMAT', $_SESSION['TIME_FORMAT']); |
|
120 |
} else { |
|
121 |
define('TIME_FORMAT', DEFAULT_TIME_FORMAT); |
|
122 |
} |
|
123 |
|
|
124 |
// Set Theme dir |
|
125 |
define('THEME_URL', WB_URL.'/templates/'.DEFAULT_THEME); |
|
126 |
define('THEME_PATH', WB_PATH.'/templates/'.DEFAULT_THEME); |
|
127 |
|
|
128 |
} |
|
129 |
|
|
130 |
?> |
|
1 |
<?php |
|
2 |
/** |
|
3 |
* |
|
4 |
* @category framework |
|
5 |
* @package initialize |
|
6 |
* @author Ryan Djurovich |
|
7 |
* @copyright 2004-2009, Ryan Djurovich |
|
8 |
* @copyright 2009-2010, Website Baker Org. e.V. |
|
9 |
* @filesource $HeadURL$ |
|
10 |
* @author Ryan Djurovich |
|
11 |
* @copyright 2004-2009, Ryan Djurovich |
|
12 |
* |
|
13 |
* @author WebsiteBaker Project |
|
14 |
* @link http://www.websitebaker2.org/ |
|
15 |
* @copyright 2009-2010, Website Baker Org. e.V. |
|
16 |
* @link http://start.websitebaker2.org/impressum-datenschutz.php |
|
17 |
* @license http://www.gnu.org/licenses/gpl.html |
|
18 |
* @version $Id$ |
|
19 |
* @platform WebsiteBaker 2.8.x |
|
20 |
* @requirements PHP 4.3.4 and higher |
|
21 |
* @lastmodified $Date$ |
|
22 |
* |
|
23 |
*/ |
|
24 |
|
|
25 |
//set_include_path(get_include_path() . PATH_SEPARATOR . WB_PATH); |
|
26 |
|
|
27 |
if (file_exists(WB_PATH.'/framework/class.database.php')) { |
|
28 |
|
|
29 |
require_once(WB_PATH.'/framework/class.database.php'); |
|
30 |
|
|
31 |
// Create database class |
|
32 |
$database = new database(); |
|
33 |
|
|
34 |
if(version_compare(PHP_VERSION, '5.3.0', '<')) |
|
35 |
{ |
|
36 |
set_magic_quotes_runtime(0); // Disable magic_quotes_runtime |
|
37 |
} |
|
38 |
// Get website settings (title, keywords, description, header, and footer) |
|
39 |
$query_settings = "SELECT name,value FROM ".TABLE_PREFIX."settings"; |
|
40 |
$get_settings = $database->query($query_settings); |
|
41 |
if($database->is_error()) { die($database->get_error()); } |
|
42 |
if($get_settings->numRows() == 0) { die("Settings not found"); } |
|
43 |
while($setting = $get_settings->fetchRow()) { |
|
44 |
$setting_name=strtoupper($setting['name']); |
|
45 |
$setting_value=$setting['value']; |
|
46 |
if ($setting_value=='false') |
|
47 |
$setting_value=false; |
|
48 |
if ($setting_value=='true') |
|
49 |
$setting_value=true; |
|
50 |
@define($setting_name,$setting_value); |
|
51 |
} |
|
52 |
$string_file_mode = STRING_FILE_MODE; |
|
53 |
define('OCTAL_FILE_MODE',(int) octdec($string_file_mode)); |
|
54 |
$string_dir_mode = STRING_DIR_MODE; |
|
55 |
define('OCTAL_DIR_MODE',(int) octdec($string_dir_mode)); |
|
56 |
|
|
57 |
if (!defined("WB_INSTALL_PROCESS")) { |
|
58 |
// get CAPTCHA and ASP settings |
|
59 |
$table = TABLE_PREFIX.'mod_captcha_control'; |
|
60 |
if($get_settings = $database->query("SELECT * FROM $table LIMIT 1")) { |
|
61 |
if($get_settings->numRows() == 0) { die("CAPTCHA-Settings not found"); } |
|
62 |
$setting = $get_settings->fetchRow(); |
|
63 |
if($setting['enabled_captcha'] == '1') define('ENABLED_CAPTCHA', true); |
|
64 |
else define('ENABLED_CAPTCHA', false); |
|
65 |
if($setting['enabled_asp'] == '1') define('ENABLED_ASP', true); |
|
66 |
else define('ENABLED_ASP', false); |
|
67 |
define('CAPTCHA_TYPE', $setting['captcha_type']); |
|
68 |
define('ASP_SESSION_MIN_AGE', (int)$setting['asp_session_min_age']); |
|
69 |
define('ASP_VIEW_MIN_AGE', (int)$setting['asp_view_min_age']); |
|
70 |
define('ASP_INPUT_MIN_AGE', (int)$setting['asp_input_min_age']); |
|
71 |
} |
|
72 |
} |
|
73 |
// set error-reporting |
|
74 |
if(is_numeric(ER_LEVEL)) { |
|
75 |
error_reporting(ER_LEVEL); |
|
76 |
} |
|
77 |
|
|
78 |
// Start a session |
|
79 |
if(!defined('SESSION_STARTED')) { |
|
80 |
session_name(APP_NAME.'_session_id'); |
|
81 |
@session_start(); |
|
82 |
define('SESSION_STARTED', true); |
|
83 |
} |
|
84 |
if(defined('ENABLED_ASP') && ENABLED_ASP && !isset($_SESSION['session_started'])) |
|
85 |
$_SESSION['session_started'] = time(); |
|
86 |
|
|
87 |
// Get users language |
|
88 |
if(isset($_GET['lang']) AND $_GET['lang'] != '' AND !is_numeric($_GET['lang']) AND strlen($_GET['lang']) == 2) { |
|
89 |
define('LANGUAGE', strtoupper($_GET['lang'])); |
|
90 |
$_SESSION['LANGUAGE']=LANGUAGE; |
|
91 |
} else { |
|
92 |
if(isset($_SESSION['LANGUAGE']) AND $_SESSION['LANGUAGE'] != '') { |
|
93 |
define('LANGUAGE', $_SESSION['LANGUAGE']); |
|
94 |
} else { |
|
95 |
define('LANGUAGE', DEFAULT_LANGUAGE); |
|
96 |
} |
|
97 |
} |
|
98 |
|
|
99 |
// Load Language file |
|
100 |
if(!defined('LANGUAGE_LOADED')) { |
|
101 |
if(!file_exists(WB_PATH.'/languages/'.LANGUAGE.'.php')) { |
|
102 |
exit('Error loading language file '.LANGUAGE.', please check configuration'); |
|
103 |
} else { |
|
104 |
require_once(WB_PATH.'/languages/'.LANGUAGE.'.php'); |
|
105 |
} |
|
106 |
} |
|
107 |
|
|
108 |
// Get users timezone |
|
109 |
if(isset($_SESSION['TIMEZONE'])) { |
|
110 |
define('TIMEZONE', $_SESSION['TIMEZONE']); |
|
111 |
} else { |
|
112 |
define('TIMEZONE', DEFAULT_TIMEZONE); |
|
113 |
} |
|
114 |
// Get users date format |
|
115 |
if(isset($_SESSION['DATE_FORMAT'])) { |
|
116 |
define('DATE_FORMAT', $_SESSION['DATE_FORMAT']); |
|
117 |
} else { |
|
118 |
define('DATE_FORMAT', DEFAULT_DATE_FORMAT); |
|
119 |
} |
|
120 |
// Get users time format |
|
121 |
if(isset($_SESSION['TIME_FORMAT'])) { |
|
122 |
define('TIME_FORMAT', $_SESSION['TIME_FORMAT']); |
|
123 |
} else { |
|
124 |
define('TIME_FORMAT', DEFAULT_TIME_FORMAT); |
|
125 |
} |
|
126 |
|
|
127 |
// Set Theme dir |
|
128 |
define('THEME_URL', WB_URL.'/templates/'.DEFAULT_THEME); |
|
129 |
define('THEME_PATH', WB_PATH.'/templates/'.DEFAULT_THEME); |
|
130 |
|
|
131 |
// extended wb_settings |
|
132 |
define('EDIT_ONE_SECTION', true); |
|
133 |
|
|
134 |
define('EDITOR_WIDTH', 0); |
|
135 |
|
|
136 |
} |
|
137 |
|
|
138 |
?> |
|
131 | 139 |
Also available in: Unified diff
Branch 2.8.1 merged back into Trunk