Project

General

Profile

« Previous | Next » 

Revision 1182

Added by Dietmar almost 15 years ago

add two constants in /framework/initialize.php for later feature in database settings
define('EDIT_ONE_SECTION', true) to edit only one section with editor in manage sections
modify page will be loading all sections with editor
define('EDITOR_WIDTH', 900) set min width for editor
adding more information in editor header 1) block 2) module 3) section_id

View differences:

branches/2.8.x/CHANGELOG
12 12

  
13 13
------------------------------------- 2.8.1 -------------------------------------
14 14
24-Nov-2009 Dietmar Woellbrink (Luisehahne)
15
+ 	add to constants in /framework/initialize.php for later feature in database settings
16
+	define('EDIT_ONE_SECTION', true) to edit only one section with editor in manage sections
17
	modify page will be loading all sections with editor
18
+	define('EDITOR_WIDTH', 900) set min width for editor
19
+	adding more information in editor header 1) block 2) module 3) section_id
20
24-Nov-2009 Dietmar Woellbrink (Luisehahne)
15 21
+	add register_frontend_modfiles('jquery'); adds jquery basis scripts in head
16 22
+	add register_frontend_modfiles_body('jquery'); adds jquery basis scripts before body end
17 23
+	add jquery_theme.js to choose a ui theme, basis is loaded, can be change 
branches/2.8.x/wb/admin/pages/modify.php
31 31
	$page_id = $_GET['page_id'];
32 32
}
33 33

  
34

  
35

  
34 36
// Create new admin object
35 37
require('../../config.php');
36 38
require_once(WB_PATH.'/framework/class.admin.php');
......
41 43
	$admin->print_error($MESSAGE['PAGES']['INSUFFICIENT_PERMISSIONS']);
42 44
}
43 45

  
46
$sectionId = isset($_GET['wysiwyg']) ? htmlspecialchars($admin->get_get('wysiwyg')) : NULL;
47

  
44 48
// Get page details
45 49
$results_array=$admin->get_page_details($page_id);
46 50

  
......
116 120

  
117 121
// Get sections for this page
118 122
$module_permissions = $_SESSION['MODULE_PERMISSIONS'];
123
// workout for edit only one section for faster pageloading
124
// Constant later set in wb_settings, in meantime defined in framework/initialize.php
125
if(defined('EDIT_ONE_SECTION') and EDIT_ONE_SECTION and is_numeric($sectionId))
126
{
119 127
$query_sections = $database->query("SELECT section_id, module, block
128
	FROM ".TABLE_PREFIX."sections WHERE section_id = '$sectionId' ORDER BY position ASC");
129
}
130
else
131
{
132
$query_sections = $database->query("SELECT section_id, module, block
120 133
	FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' ORDER BY position ASC");
134
}
135

  
121 136
if($query_sections->numRows() > 0)
122 137
{
123 138
	while($section = $query_sections->fetchRow())
......
130 145
			// Include the modules editing script if it exists
131 146
			if(file_exists(WB_PATH.'/modules/'.$module.'/modify.php'))
132 147
            {
133
				print '<a name="'.$section_id.'">&nbsp;</a>'."\n";
148
				print /* '<a name="'.$section_id.'"></a>'. */"\n";
134 149
				// output block name if blocks are enabled
135 150
				if (SECTION_BLOCKS) {
136 151
					if (isset($block[$section['block']]) && trim(strip_tags(($block[$section['block']]))) != '')
......
144 159
							$block_name = '#' . (int) $section['block'];
145 160
						}
146 161
					}
147
					print '<b>' . $TEXT['BLOCK'] . ': </b>' . $block_name;
162
					print '<div id="'.$section['section_id'].'"><b>' . $TEXT['BLOCK'] . ': </b>' . $block_name;
148 163
					print '<b>  Modul: </b>' . $section['module']." ";
149
					print '<b>  ID: </b>' . $section_id."\n";
164
					print '<b>  ID: </b>' . $section_id."</div>\n";
150 165
				}
151 166
				require(WB_PATH.'/modules/'.$module.'/modify.php');
152 167
			}
branches/2.8.x/wb/admin/pages/sections.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
// Include config file
27
require('../../config.php');
28

  
29
// Make sure people are allowed to access this page
30
if(MANAGE_SECTIONS != 'enabled') {
31
	header('Location: '.ADMIN_URL.'/pages/index.php');
32
	exit(0);
33
}
34

  
35
// Get page id
36
if(!isset($_GET['page_id']) OR !is_numeric($_GET['page_id'])) {
37
	header("Location: index.php");
38
	exit(0);
39
} else {
40
	$page_id = $_GET['page_id'];
41
}
42

  
43
$debug = false; // to show position and section_id
44

  
45
// Create new admin object
46
require_once(WB_PATH.'/framework/class.admin.php');
47
$admin = new admin('Pages', 'pages_modify');
48

  
49
// Check if we are supposed to add or delete a section
50
if(isset($_GET['section_id']) AND is_numeric($_GET['section_id'])) {
51
	// Get more information about this section
52
	$section_id = $_GET['section_id'];
53
	$query_section = $database->query("SELECT module FROM ".TABLE_PREFIX."sections WHERE section_id = '$section_id'");
54
	if($query_section->numRows() == 0) {
55
		$admin->print_error('Section not found');
56
	}
57
	$section = $query_section->fetchRow();
58
	// Include the modules delete file if it exists
59
	if(file_exists(WB_PATH.'/modules/'.$section['module'].'/delete.php')) {
60
		require(WB_PATH.'/modules/'.$section['module'].'/delete.php');
61
	}
62
	$database->query("DELETE FROM ".TABLE_PREFIX."sections WHERE section_id = '$section_id' LIMIT 1");
63
	if($database->is_error()) {
64
		$admin->print_error($database->get_error());
65
	} else {
66
		require(WB_PATH.'/framework/class.order.php');
67
		$order = new order(TABLE_PREFIX.'sections', 'position', 'section_id', 'page_id');
68
		$order->clean($page_id);
69
		$admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/sections.php?page_id='.$page_id);
70
		$admin->print_footer();
71
		exit();
72
	}
73
} elseif(isset($_POST['module']) AND $_POST['module'] != '') {
74
	// Get section info
75
	$module = $admin->add_slashes($_POST['module']);
76
	// Include the ordering class
77
	require(WB_PATH.'/framework/class.order.php');
78
	// Get new order
79
	$order = new order(TABLE_PREFIX.'sections', 'position', 'section_id', 'page_id');
80
	$position = $order->get_new($page_id);	
81
	// Insert module into DB
82
	$database->query("INSERT INTO ".TABLE_PREFIX."sections (page_id,module,position,block) VALUES ('$page_id','$module','$position','1')");
83
	// Get the section id
84
	$section_id = $database->get_one("SELECT LAST_INSERT_ID()");	
85
	// Include the selected modules add file if it exists
86
	if(file_exists(WB_PATH.'/modules/'.$module.'/add.php')) {
87
		require(WB_PATH.'/modules/'.$module.'/add.php');
88
	}
89
}
90

  
91
// Get perms
92
$database = new database();
93
$results = $database->query("SELECT admin_groups,admin_users FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'");
94
$results_array = $results->fetchRow();
95
$old_admin_groups = explode(',', $results_array['admin_groups']);
96
$old_admin_users = explode(',', $results_array['admin_users']);
97
$in_old_group = FALSE;
98
foreach($admin->get_groups_id() as $cur_gid){
99
	if (in_array($cur_gid, $old_admin_groups)) {
100
		$in_old_group = TRUE;
101
	}
102
}
103
if((!$in_old_group) AND !is_numeric(array_search($admin->get_user_id(), $old_admin_users))) {
104
	$admin->print_error($MESSAGE['PAGES']['INSUFFICIENT_PERMISSIONS']);
105
}
106

  
107
// Get page details
108
$database = new database();
109
$query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'";
110
$results = $database->query($query);
111
if($database->is_error()) {
112
	$admin->print_header();
113
	$admin->print_error($database->get_error());
114
}
115
if($results->numRows() == 0) {
116
	$admin->print_header();
117
	$admin->print_error($MESSAGE['PAGES']['NOT_FOUND']);
118
}
119
$results_array = $results->fetchRow();
120

  
121
// Set module permissions
122
$module_permissions = $_SESSION['MODULE_PERMISSIONS'];
123

  
124
// Unset block var
125
unset($block);
126
// Include template info file (if it exists)
127
if($results_array['template'] != '') {
128
	$template_location = WB_PATH.'/templates/'.$results_array['template'].'/info.php';
129
} else {
130
	$template_location = WB_PATH.'/templates/'.DEFAULT_TEMPLATE.'/info.php';
131
}
132
if(file_exists($template_location)) {
133
	require($template_location);
134
}
135
// Check if $menu is set
136
if(!isset($block[1]) OR $block[1] == '') {
137
	// Make our own menu list
138
	$block[1] = $TEXT['MAIN'];
139
}
140

  
141
/*-- load css files with jquery --*/
142
// include jscalendar-setup
143
$jscal_use_time = true; // whether to use a clock, too
144
require_once(WB_PATH."/include/jscalendar/wb-setup.php");
145

  
146
// Setup template object
147
$template = new Template(THEME_PATH.'/templates');
148
$template->set_file('page', 'pages_sections.htt');
149
$template->set_block('page', 'main_block', 'main');
150
$template->set_block('main_block', 'module_block', 'module_list');
151
$template->set_block('main_block', 'section_block', 'section_list');
152
$template->set_block('section_block', 'block_block', 'block_list');
153
$template->set_block('main_block', 'calendar_block', 'calendar_list');
154

  
155
// set first defaults and messages
156
$template->set_var(array(
157
				'PAGE_ID' => $results_array['page_id'],
158
				'PAGE_TITLE' => ($results_array['page_title']),
159
				'MENU_TITLE' => ($results_array['menu_title']),
160
				'TEXT_CURRENT_PAGE' => $TEXT['CURRENT_PAGE'],
161
				'HEADING_MANAGE_SECTIONS' => $HEADING['MANAGE_SECTIONS'],
162
				'HEADING_MODIFY_PAGE' => $HEADING['MODIFY_PAGE'],
163
				'TEXT_CHANGE_SETTINGS' => $TEXT['CHANGE_SETTINGS'],
164
				'TEXT_ADD_SECTION' => $TEXT['ADD_SECTION'],
165
				'TEXT_ID' => 'ID',
166
				'TEXT_TYPE' => $TEXT['TYPE'],
167
				'TEXT_BLOCK' => $TEXT['BLOCK'],
168
				'TEXT_PUBL_START_DATE' => $TEXT{'PUBL_START_DATE'},
169
				'TEXT_PUBL_END_DATE' => $TEXT['PUBL_END_DATE'],
170
				'TEXT_ACTIONS' => $TEXT['ACTIONS'],
171
				'ADMIN_URL' => ADMIN_URL,
172
				'WB_URL' => WB_URL,
173
				'WB_PATH' => WB_PATH,
174
				'THEME_URL' => THEME_URL
175
				) 
176
			);
177

  
178
// Insert variables
179
$template->set_var(array(
180
				'VAR_PAGE_ID' => $results_array['page_id'],
181
				'VAR_PAGE_TITLE' => $results_array['page_title'],
182
				'SETTINGS_LINK' => ADMIN_URL.'/pages/settings.php?page_id='.$results_array['page_id'],
183
				'MODIFY_LINK' => ADMIN_URL.'/pages/modify.php?page_id='.$results_array['page_id']
184
				) 
185
			);
186

  
187
$query_sections = $database->query("SELECT section_id,module,position,block,publ_start,publ_end FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' ORDER BY position ASC");
188
if($query_sections->numRows() > 0) {
189
	$num_sections = $query_sections->numRows();
190
	while($section = $query_sections->fetchRow()) {
191
		if(!is_numeric(array_search($section['module'], $module_permissions))) {
192
			// Get the modules real name
193
			$module_name=$database->get_one("SELECT name FROM ".TABLE_PREFIX."addons WHERE directory='".$section['module']."'");
194
			$template->set_var(array(
195
			) );
196
			if(SECTION_BLOCKS) {
197
				$edit_page ='<a name="'.$section['section_id'].'" href="'.ADMIN_URL.'/pages/modify.php?page_id='.$page_id.'#'.$section['section_id'].'">'.$module_name.'</a>';
198
				$input_attribute = 'input_normal';
199
				$template->set_var(array(
200
						'STYLE_DISPLAY_SECTION_BLOCK' => ' style="visibility:visible;"',
201
						'NAME_SIZE' => 180,
202
						'INPUT_ATTRIBUTE' => $input_attribute,
203
						'VAR_SECTION_ID' => $section['section_id'],
204
						'VAR_POSITION' => $section['position'],
205
						'LINK_MODIFY_URL_VAR_MODUL_NAME' => $edit_page,
206
						'SELECT' => '',
207
						'SET_NONE_DISPLAY_OPTION' => ''
208
						) 
209
					);
210
				// Add block options to the section_list
211
				$template->clear_var('block_list');
212
				foreach($block AS $number => $name) {
213
					$template->set_var('NAME', htmlentities(strip_tags($name)));
214
					$template->set_var('VALUE', $number);
215
					$template->set_var('SIZE', 1);
216
					if($section['block'] == $number) {
217
						$template->set_var('SELECTED', ' selected="selected"');
218
					} else {
219
						$template->set_var('SELECTED', '');
220
					}
221
					$template->parse('block_list', 'block_block', true);
222
				}
223
			} else {
224
				$edit_page ='<a name="'.$section['section_id'].'" href="'.ADMIN_URL.'/pages/modify.php?page_id='.$page_id.'#'.$section['section_id'].'">'.$module_name.'</a>';
225
				$input_attribute = 'input_small';
226
				$template->set_var(array(
227
						'STYLE_DISPLAY_SECTION_BLOCK' => ' style="display:none;"',
228
						'NAME_SIZE' => 270,
229
						'INPUT_ATTRIBUTE' => $input_attribute,
230
						'VAR_SECTION_ID' => $section['section_id'],
231
						'VAR_POSITION' => $section['position'],
232
						'LINK_MODIFY_URL_VAR_MODUL_NAME' => $edit_page,
233
						'NAME' => htmlentities(strip_tags($block[1])),
234
						'VALUE' => 1,
235
						'SET_NONE_DISPLAY_OPTION' => ''
236
						) 
237
					);
238
			}
239
			// Insert icon and images
240
			$template->set_var(array(
241
						'CLOCK_16_PNG' => 'clock_16.png',
242
						'CLOCK_DEL_16_PNG' => 'clock_del_16.png',
243
						'DELETE_16_PNG' => 'delete_16.png'
244
						) 
245
					);
246
			// set calendar start values
247
			if($section['publ_start']==0) {
248
				$template->set_var('VALUE_PUBL_START', '');
249
			} else {
250
				$template->set_var('VALUE_PUBL_START', date($jscal_format, $section['publ_start']));
251
			}
252
			// set calendar start values
253
			if($section['publ_end']==0) {
254
				$template->set_var('VALUE_PUBL_END', '');
255
			} else {
256
				$template->set_var('VALUE_PUBL_END', date($jscal_format, $section['publ_end']));
257
			}
258
			// Insert icons up and down
259
			if($section['position'] != 1 ) {
260
				$template->set_var(
261
							'VAR_MOVE_UP_URL',
262
							'<a href="'.ADMIN_URL.'/pages/move_up.php?page_id='.$page_id.'&amp;section_id='.$section['section_id'].'">
263
							<img src="'.THEME_URL.'/images/up_16.png" alt="{TEXT_MOVE_UP}" />
264
							</a>' );
265
			} else {
266
				$template->set_var(array(
267
							'VAR_MOVE_UP_URL' => ''
268
							) 
269
						);
270
			}
271
			if($section['position'] != $num_sections ) {
272
				$template->set_var(
273
							'VAR_MOVE_DOWN_URL',
274
							'<a href="'.ADMIN_URL.'/pages/move_down.php?page_id='.$page_id.'&amp;section_id='.$section['section_id'].'">
275
							<img src="'.THEME_URL.'/images/down_16.png" alt="{TEXT_MOVE_DOWN}" />
276
							</a>' );
277
			} else {
278
				$template->set_var(array(
279
							'VAR_MOVE_DOWN_URL' => ''
280
							) 
281
						);
282
			}
283
		} else continue; // user have not the right to edit this section/modul
284
			$template->set_var(array(
285
							'DISPLAY_DEBUG' => ' style="visibility="visible;"',
286
							'TEXT_SID' => 'SID',
287
							'DEBUG_COLSPAN_SIZE' => 9
288
							) 
289
						);
290
		if($debug) {
291
			$template->set_var(array(
292
							'DISPLAY_DEBUG' => ' style="visibility="visible;"',
293
							'TEXT_PID' => 'PID',
294
							'TEXT_SID' => 'SID',
295
							'POSITION' => $section['position']
296
							) 
297
						);
298
		} else {
299
			$template->set_var(array(
300
							'DISPLAY_DEBUG' => ' style="display:none;"',
301
							'TEXT_PID' => '',
302
							'POSITION' => ''
303
							) 
304
						);
305
		}
306
		$template->parse('section_list', 'section_block', true);
307
	}
308
}
309

  
310
// now add the calendars -- remember to to set the range to [1970, 2037] if the date is used as timestamp!
311
// the loop is simply a copy from above.
312
$query_sections = $database->query("SELECT section_id,module FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' ORDER BY position ASC");
313
if($query_sections->numRows() > 0) {
314
	$num_sections = $query_sections->numRows();
315
	while($section = $query_sections->fetchRow()) {
316
		// Get the modules real name
317
		$module_name=$database->get_one("SELECT name FROM ".TABLE_PREFIX."addons WHERE directory='".$section['module']."'");
318
		if(!is_numeric(array_search($section['module'], $module_permissions))) {
319
			$template->set_var(array(
320
						'jscal_ifformat' => $jscal_ifformat,
321
						'jscal_firstday' => $jscal_firstday,
322
						'jscal_today' => $jscal_today,
323
						'start_date' => 'start_date'.$section['section_id'],
324
						'end_date' => 'end_date'.$section['section_id'],
325
						'trigger_start' => 'trigger_start'.$section['section_id'],
326
						'trigger_end' => 'trigger_stop'.$section['section_id']
327
						) 
328
					);
329
			if(isset($jscal_use_time) && $jscal_use_time==TRUE) {
330
				$template->set_var(array(
331
						'showsTime' => "true",
332
						'timeFormat' => "24"
333
						) 
334
					);
335
			}  else {
336
				$template->set_var(array(
337
						'showsTime' => "false",
338
						'timeFormat' => "24"
339
						) 
340
					);
341
			}
342
		}
343
		$template->parse('calendar_list', 'calendar_block', true);
344
	}
345
}
346

  
347
// Work-out if we should show the "Add Section" form
348
$query_sections = $database->query("SELECT section_id FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' AND module = 'menu_link'");
349
if($query_sections->numRows() == 0) {
350
	// Modules list
351
	$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'page' AND directory != 'menu_link' order by name");
352
	if($result->numRows() > 0) {
353
		while ($module = $result->fetchRow()) {
354
			// Check if user is allowed to use this module   echo  $module['directory'],'<br />';
355
			if(!is_numeric(array_search($module['directory'], $module_permissions))) {
356
				$template->set_var('VALUE', $module['directory']);
357
				$template->set_var('NAME', $module['name']);
358
				if($module['directory'] == 'wysiwyg') {
359
					$template->set_var('SELECTED', ' selected="selected"');
360
				} else {
361
					$template->set_var('SELECTED', '');
362
				}
363
				$template->parse('module_list', 'module_block', true);
364
			}
365
		}
366
	}
367
}
368
// Insert language text and messages
369
$template->set_var(array(
370
					'TEXT_MANAGE_SECTIONS' => $HEADING['MANAGE_SECTIONS'],
371
					'TEXT_ARE_YOU_SURE' => $TEXT['ARE_YOU_SURE'],
372
					'TEXT_TYPE' => $TEXT['TYPE'],
373
					'TEXT_ADD' => $TEXT['ADD'],
374
					'TEXT_SAVE' =>  $TEXT['SAVE'],
375
					'TEXTLINK_MODIFY_PAGE' => $HEADING['MODIFY_PAGE'],
376
					'TEXT_CALENDAR' => $TEXT['CALENDAR'],
377
					'TEXT_DELETE_DATE' => $TEXT['DELETE_DATE'],
378
					'TEXT_ADD_SECTION' => $TEXT['ADD_SECTION'],
379
					'TEXT_MOVE_UP' => $TEXT['MOVE_UP'],
380
					'TEXT_MOVE_DOWN' => $TEXT['MOVE_DOWN']
381
					) 
382
				);
383
$template->parse('main', 'main_block', false);
384
$template->pparse('output', 'page');
385

  
386
// Print admin footer
387
$admin->print_footer();
388

  
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
// Include config file
27
require('../../config.php');
28

  
29
// Make sure people are allowed to access this page
30
if(MANAGE_SECTIONS != 'enabled') {
31
	header('Location: '.ADMIN_URL.'/pages/index.php');
32
	exit(0);
33
}
34

  
35
// Get page id
36
if(!isset($_GET['page_id']) OR !is_numeric($_GET['page_id'])) {
37
	header("Location: index.php");
38
	exit(0);
39
} else {
40
	$page_id = $_GET['page_id'];
41
}
42

  
43
$debug = false; // to show position and section_id
44

  
45
// Create new admin object
46
require_once(WB_PATH.'/framework/class.admin.php');
47
$admin = new admin('Pages', 'pages_modify');
48

  
49
// Check if we are supposed to add or delete a section
50
if(isset($_GET['section_id']) AND is_numeric($_GET['section_id'])) {
51
	// Get more information about this section
52
	$section_id = $_GET['section_id'];
53
	$query_section = $database->query("SELECT module FROM ".TABLE_PREFIX."sections WHERE section_id = '$section_id'");
54
	if($query_section->numRows() == 0) {
55
		$admin->print_error('Section not found');
56
	}
57
	$section = $query_section->fetchRow();
58
	// Include the modules delete file if it exists
59
	if(file_exists(WB_PATH.'/modules/'.$section['module'].'/delete.php')) {
60
		require(WB_PATH.'/modules/'.$section['module'].'/delete.php');
61
	}
62
	$database->query("DELETE FROM ".TABLE_PREFIX."sections WHERE section_id = '$section_id' LIMIT 1");
63
	if($database->is_error()) {
64
		$admin->print_error($database->get_error());
65
	} else {
66
		require(WB_PATH.'/framework/class.order.php');
67
		$order = new order(TABLE_PREFIX.'sections', 'position', 'section_id', 'page_id');
68
		$order->clean($page_id);
69
		$admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/sections.php?page_id='.$page_id);
70
		$admin->print_footer();
71
		exit();
72
	}
73
} elseif(isset($_POST['module']) AND $_POST['module'] != '') {
74
	// Get section info
75
	$module = $admin->add_slashes($_POST['module']);
76
	// Include the ordering class
77
	require(WB_PATH.'/framework/class.order.php');
78
	// Get new order
79
	$order = new order(TABLE_PREFIX.'sections', 'position', 'section_id', 'page_id');
80
	$position = $order->get_new($page_id);	
81
	// Insert module into DB
82
	$database->query("INSERT INTO ".TABLE_PREFIX."sections (page_id,module,position,block) VALUES ('$page_id','$module','$position','1')");
83
	// Get the section id
84
	$section_id = $database->get_one("SELECT LAST_INSERT_ID()");	
85
	// Include the selected modules add file if it exists
86
	if(file_exists(WB_PATH.'/modules/'.$module.'/add.php')) {
87
		require(WB_PATH.'/modules/'.$module.'/add.php');
88
	}
89
}
90

  
91
// Get perms
92
$database = new database();
93
$results = $database->query("SELECT admin_groups,admin_users FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'");
94
$results_array = $results->fetchRow();
95
$old_admin_groups = explode(',', $results_array['admin_groups']);
96
$old_admin_users = explode(',', $results_array['admin_users']);
97
$in_old_group = FALSE;
98
foreach($admin->get_groups_id() as $cur_gid){
99
	if (in_array($cur_gid, $old_admin_groups)) {
100
		$in_old_group = TRUE;
101
	}
102
}
103
if((!$in_old_group) AND !is_numeric(array_search($admin->get_user_id(), $old_admin_users))) {
104
	$admin->print_error($MESSAGE['PAGES']['INSUFFICIENT_PERMISSIONS']);
105
}
106

  
107
// Get page details
108
$database = new database();
109
$query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'";
110
$results = $database->query($query);
111
if($database->is_error()) {
112
	$admin->print_header();
113
	$admin->print_error($database->get_error());
114
}
115
if($results->numRows() == 0) {
116
	$admin->print_header();
117
	$admin->print_error($MESSAGE['PAGES']['NOT_FOUND']);
118
}
119
$results_array = $results->fetchRow();
120

  
121
// Set module permissions
122
$module_permissions = $_SESSION['MODULE_PERMISSIONS'];
123

  
124
// Unset block var
125
unset($block);
126
// Include template info file (if it exists)
127
if($results_array['template'] != '') {
128
	$template_location = WB_PATH.'/templates/'.$results_array['template'].'/info.php';
129
} else {
130
	$template_location = WB_PATH.'/templates/'.DEFAULT_TEMPLATE.'/info.php';
131
}
132
if(file_exists($template_location)) {
133
	require($template_location);
134
}
135
// Check if $menu is set
136
if(!isset($block[1]) OR $block[1] == '') {
137
	// Make our own menu list
138
	$block[1] = $TEXT['MAIN'];
139
}
140

  
141
/*-- load css files with jquery --*/
142
// include jscalendar-setup
143
$jscal_use_time = true; // whether to use a clock, too
144
require_once(WB_PATH."/include/jscalendar/wb-setup.php");
145

  
146
// Setup template object
147
$template = new Template(THEME_PATH.'/templates');
148
$template->set_file('page', 'pages_sections.htt');
149
$template->set_block('page', 'main_block', 'main');
150
$template->set_block('main_block', 'module_block', 'module_list');
151
$template->set_block('main_block', 'section_block', 'section_list');
152
$template->set_block('section_block', 'block_block', 'block_list');
153
$template->set_block('main_block', 'calendar_block', 'calendar_list');
154

  
155
// set first defaults and messages
156
$template->set_var(array(
157
				'PAGE_ID' => $results_array['page_id'],
158
				'PAGE_TITLE' => ($results_array['page_title']),
159
				'MENU_TITLE' => ($results_array['menu_title']),
160
				'TEXT_CURRENT_PAGE' => $TEXT['CURRENT_PAGE'],
161
				'HEADING_MANAGE_SECTIONS' => $HEADING['MANAGE_SECTIONS'],
162
				'HEADING_MODIFY_PAGE' => $HEADING['MODIFY_PAGE'],
163
				'TEXT_CHANGE_SETTINGS' => $TEXT['CHANGE_SETTINGS'],
164
				'TEXT_ADD_SECTION' => $TEXT['ADD_SECTION'],
165
				'TEXT_ID' => 'ID',
166
				'TEXT_TYPE' => $TEXT['TYPE'],
167
				'TEXT_BLOCK' => $TEXT['BLOCK'],
168
				'TEXT_PUBL_START_DATE' => $TEXT{'PUBL_START_DATE'},
169
				'TEXT_PUBL_END_DATE' => $TEXT['PUBL_END_DATE'],
170
				'TEXT_ACTIONS' => $TEXT['ACTIONS'],
171
				'ADMIN_URL' => ADMIN_URL,
172
				'WB_URL' => WB_URL,
173
				'WB_PATH' => WB_PATH,
174
				'THEME_URL' => THEME_URL
175
				) 
176
			);
177

  
178
// Insert variables
179
$template->set_var(array(
180
				'VAR_PAGE_ID' => $results_array['page_id'],
181
				'VAR_PAGE_TITLE' => $results_array['page_title'],
182
				'SETTINGS_LINK' => ADMIN_URL.'/pages/settings.php?page_id='.$results_array['page_id'],
183
				'MODIFY_LINK' => ADMIN_URL.'/pages/modify.php?page_id='.$results_array['page_id']
184
				) 
185
			);
186

  
187
$query_sections = $database->query("SELECT section_id,module,position,block,publ_start,publ_end FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' ORDER BY position ASC");
188
if($query_sections->numRows() > 0) {
189
	$num_sections = $query_sections->numRows();
190
	while($section = $query_sections->fetchRow()) {
191
		if(!is_numeric(array_search($section['module'], $module_permissions))) {
192
			// Get the modules real name
193
			$module_name=$database->get_one("SELECT name FROM ".TABLE_PREFIX."addons WHERE directory='".$section['module']."'");
194
			$template->set_var(array(
195
			) );
196
			if(SECTION_BLOCKS) {
197
                if(defined('EDIT_ONE_SECTION') and EDIT_ONE_SECTION)
198
                {
199
				    $edit_page ='<a name="'.$section['section_id'].'" href="'.ADMIN_URL.'/pages/modify.php?page_id='.$page_id.'&amp;wysiwyg='.$section['section_id'] .'">'.$module_name.'</a>';
200
                }
201
                else
202
                {
203
				    $edit_page ='<a name="'.$section['section_id'].'" href="'.ADMIN_URL.'/pages/modify.php?page_id='.$page_id.'#'.$section['section_id'].'">'.$module_name.'</a>';
204
                }
205

  
206
				$input_attribute = 'input_normal';
207
				$template->set_var(array(
208
						'STYLE_DISPLAY_SECTION_BLOCK' => ' style="visibility:visible;"',
209
						'NAME_SIZE' => 180,
210
						'INPUT_ATTRIBUTE' => $input_attribute,
211
						'VAR_SECTION_ID' => $section['section_id'],
212
						'VAR_POSITION' => $section['position'],
213
						'LINK_MODIFY_URL_VAR_MODUL_NAME' => $edit_page,
214
						'SELECT' => '',
215
						'SET_NONE_DISPLAY_OPTION' => ''
216
						) 
217
					);
218
				// Add block options to the section_list
219
				$template->clear_var('block_list');
220
				foreach($block AS $number => $name) {
221
					$template->set_var('NAME', htmlentities(strip_tags($name)));
222
					$template->set_var('VALUE', $number);
223
					$template->set_var('SIZE', 1);
224
					if($section['block'] == $number) {
225
						$template->set_var('SELECTED', ' selected="selected"');
226
					} else {
227
						$template->set_var('SELECTED', '');
228
					}
229
					$template->parse('block_list', 'block_block', true);
230
				}
231
			} else {
232
				$edit_page ='<a name="'.$section['section_id'].'" href="'.ADMIN_URL.'/pages/modify.php?page_id='.$page_id.'#'.$section['section_id'].'">'.$module_name.'</a>';
233
				$input_attribute = 'input_small';
234
				$template->set_var(array(
235
						'STYLE_DISPLAY_SECTION_BLOCK' => ' style="display:none;"',
236
						'NAME_SIZE' => 270,
237
						'INPUT_ATTRIBUTE' => $input_attribute,
238
						'VAR_SECTION_ID' => $section['section_id'],
239
						'VAR_POSITION' => $section['position'],
240
						'LINK_MODIFY_URL_VAR_MODUL_NAME' => $edit_page,
241
						'NAME' => htmlentities(strip_tags($block[1])),
242
						'VALUE' => 1,
243
						'SET_NONE_DISPLAY_OPTION' => ''
244
						) 
245
					);
246
			}
247
			// Insert icon and images
248
			$template->set_var(array(
249
						'CLOCK_16_PNG' => 'clock_16.png',
250
						'CLOCK_DEL_16_PNG' => 'clock_del_16.png',
251
						'DELETE_16_PNG' => 'delete_16.png'
252
						) 
253
					);
254
			// set calendar start values
255
			if($section['publ_start']==0) {
256
				$template->set_var('VALUE_PUBL_START', '');
257
			} else {
258
				$template->set_var('VALUE_PUBL_START', date($jscal_format, $section['publ_start']));
259
			}
260
			// set calendar start values
261
			if($section['publ_end']==0) {
262
				$template->set_var('VALUE_PUBL_END', '');
263
			} else {
264
				$template->set_var('VALUE_PUBL_END', date($jscal_format, $section['publ_end']));
265
			}
266
			// Insert icons up and down
267
			if($section['position'] != 1 ) {
268
				$template->set_var(
269
							'VAR_MOVE_UP_URL',
270
							'<a href="'.ADMIN_URL.'/pages/move_up.php?page_id='.$page_id.'&amp;section_id='.$section['section_id'].'">
271
							<img src="'.THEME_URL.'/images/up_16.png" alt="{TEXT_MOVE_UP}" />
272
							</a>' );
273
			} else {
274
				$template->set_var(array(
275
							'VAR_MOVE_UP_URL' => ''
276
							) 
277
						);
278
			}
279
			if($section['position'] != $num_sections ) {
280
				$template->set_var(
281
							'VAR_MOVE_DOWN_URL',
282
							'<a href="'.ADMIN_URL.'/pages/move_down.php?page_id='.$page_id.'&amp;section_id='.$section['section_id'].'">
283
							<img src="'.THEME_URL.'/images/down_16.png" alt="{TEXT_MOVE_DOWN}" />
284
							</a>' );
285
			} else {
286
				$template->set_var(array(
287
							'VAR_MOVE_DOWN_URL' => ''
288
							) 
289
						);
290
			}
291
		}
292
			$template->set_var(array(
293
							'DISPLAY_DEBUG' => ' style="visibility="visible;"',
294
							'TEXT_SID' => 'SID',
295
							'DEBUG_COLSPAN_SIZE' => 9
296
							) 
297
						);
298
		if($debug) {
299
			$template->set_var(array(
300
							'DISPLAY_DEBUG' => ' style="visibility="visible;"',
301
							'TEXT_PID' => 'PID',
302
							'TEXT_SID' => 'SID',
303
							'POSITION' => $section['position']
304
							) 
305
						);
306
		} else {
307
			$template->set_var(array(
308
							'DISPLAY_DEBUG' => ' style="display:none;"',
309
							'TEXT_PID' => '',
310
							'POSITION' => ''
311
							) 
312
						);
313
		}
314
		$template->parse('section_list', 'section_block', true);
315
	}
316
}
317

  
318
// now add the calendars -- remember to to set the range to [1970, 2037] if the date is used as timestamp!
319
// the loop is simply a copy from above.
320
$query_sections = $database->query("SELECT section_id,module FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' ORDER BY position ASC");
321
if($query_sections->numRows() > 0) {
322
	$num_sections = $query_sections->numRows();
323
	while($section = $query_sections->fetchRow()) {
324
		// Get the modules real name
325
		$module_name=$database->get_one("SELECT name FROM ".TABLE_PREFIX."addons WHERE directory='".$section['module']."'");
326
		if(!is_numeric(array_search($section['module'], $module_permissions))) {
327
			$template->set_var(array(
328
						'jscal_ifformat' => $jscal_ifformat,
329
						'jscal_firstday' => $jscal_firstday,
330
						'jscal_today' => $jscal_today,
331
						'start_date' => 'start_date'.$section['section_id'],
332
						'end_date' => 'end_date'.$section['section_id'],
333
						'trigger_start' => 'trigger_start'.$section['section_id'],
334
						'trigger_end' => 'trigger_stop'.$section['section_id']
335
						) 
336
					);
337
			if(isset($jscal_use_time) && $jscal_use_time==TRUE) {
338
				$template->set_var(array(
339
						'showsTime' => "true",
340
						'timeFormat' => "24"
341
						) 
342
					);
343
			}  else {
344
				$template->set_var(array(
345
						'showsTime' => "false",
346
						'timeFormat' => "24"
347
						) 
348
					);
349
			}
350
		}
351
		$template->parse('calendar_list', 'calendar_block', true);
352
	}
353
}
354

  
355
// Work-out if we should show the "Add Section" form
356
$query_sections = $database->query("SELECT section_id FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' AND module = 'menu_link'");
357
if($query_sections->numRows() == 0) {
358
	// Modules list
359
	$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'page' AND directory != 'menu_link' order by name");
360
	if($result->numRows() > 0) {
361
		while ($module = $result->fetchRow()) {
362
			// Check if user is allowed to use this module   echo  $module['directory'],'<br />';
363
			if(!is_numeric(array_search($module['directory'], $module_permissions))) {
364
				$template->set_var('VALUE', $module['directory']);
365
				$template->set_var('NAME', $module['name']);
366
				if($module['directory'] == 'wysiwyg') {
367
					$template->set_var('SELECTED', ' selected="selected"');
368
				} else {
369
					$template->set_var('SELECTED', '');
370
				}
371
				$template->parse('module_list', 'module_block', true);
372
			}
373
		}
374
	}
375
}
376
// Insert language text and messages
377
$template->set_var(array(
378
					'TEXT_MANAGE_SECTIONS' => $HEADING['MANAGE_SECTIONS'],
379
					'TEXT_ARE_YOU_SURE' => $TEXT['ARE_YOU_SURE'],
380
					'TEXT_TYPE' => $TEXT['TYPE'],
381
					'TEXT_ADD' => $TEXT['ADD'],
382
					'TEXT_SAVE' =>  $TEXT['SAVE'],
383
					'TEXTLINK_MODIFY_PAGE' => $HEADING['MODIFY_PAGE'],
384
					'TEXT_CALENDAR' => $TEXT['CALENDAR'],
385
					'TEXT_DELETE_DATE' => $TEXT['DELETE_DATE'],
386
					'TEXT_ADD_SECTION' => $TEXT['ADD_SECTION'],
387
					'TEXT_MOVE_UP' => $TEXT['MOVE_UP'],
388
					'TEXT_MOVE_DOWN' => $TEXT['MOVE_DOWN']
389
					) 
390
				);
391
$template->parse('main', 'main_block', false);
392
$template->pparse('output', 'page');
393

  
394
// Print admin footer
395
$admin->print_footer();
396

  
389 397
?>
branches/2.8.x/wb/framework/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
// $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
//set_include_path(get_include_path() . PATH_SEPARATOR . WB_PATH);
27

  
28

  
29
if (file_exists(WB_PATH.'/framework/class.database.php')) {
30
	
31
	require_once(WB_PATH.'/framework/class.database.php');
32
		
33
	// Create database class
34
	$database = new database();
35

  
36
    if   (function_exists("set_magic_quotes_runtime"))
37
    {
38
        set_magic_quotes_runtime(0);
39
	}
40
	// Get website settings (title, keywords, description, header, and footer)
41
	$query_settings = "SELECT name,value FROM ".TABLE_PREFIX."settings";
42
	$get_settings = $database->query($query_settings);
43
	if($database->is_error()) { die($database->get_error()); }
44
	if($get_settings->numRows() == 0) { die("Settings not found"); }
45
	while($setting = $get_settings->fetchRow()) {
46
		$setting_name=strtoupper($setting['name']);
47
		$setting_value=$setting['value'];
48
		if ($setting_value=='false')
49
			$setting_value=false;
50
		if ($setting_value=='true')
51
			$setting_value=true;
52
		@define($setting_name,$setting_value);
53
	}
54
	$string_file_mode = STRING_FILE_MODE;
55
	define('OCTAL_FILE_MODE',(int) octdec($string_file_mode));
56
	$string_dir_mode = STRING_DIR_MODE;
57
	define('OCTAL_DIR_MODE',(int) octdec($string_dir_mode));
58
	
59
	if (!defined("WB_INSTALL_PROCESS")) {
60
		// get CAPTCHA and ASP settings
61
		$table = TABLE_PREFIX.'mod_captcha_control';
62
		if($get_settings = $database->query("SELECT * FROM $table LIMIT 1")) {
63
			if($get_settings->numRows() == 0) { die("CAPTCHA-Settings not found"); }
64
			$setting = $get_settings->fetchRow();
65
			if($setting['enabled_captcha'] == '1') define('ENABLED_CAPTCHA', true);
66
			else define('ENABLED_CAPTCHA', false);
67
			if($setting['enabled_asp'] == '1') define('ENABLED_ASP', true);
68
			else define('ENABLED_ASP', false);
69
			define('CAPTCHA_TYPE', $setting['captcha_type']);
70
			define('ASP_SESSION_MIN_AGE', (int)$setting['asp_session_min_age']);
71
			define('ASP_VIEW_MIN_AGE', (int)$setting['asp_view_min_age']);
72
			define('ASP_INPUT_MIN_AGE', (int)$setting['asp_input_min_age']);
73
		}
74
	}
75
	// set error-reporting
76
	if(is_numeric(ER_LEVEL)) {
77
		error_reporting(ER_LEVEL);
78
	}
79

  
80
	// Start a session
81
	if(!defined('SESSION_STARTED')) {
82
		session_name(APP_NAME.'_session_id');
83
		@session_start();
84
		define('SESSION_STARTED', true);
85
	}
86
	if(defined('ENABLED_ASP') && ENABLED_ASP && !isset($_SESSION['session_started']))
87
		$_SESSION['session_started'] = time();
88

  
89
	// Get users language
90
	if(isset($_GET['lang']) AND $_GET['lang'] != '' AND !is_numeric($_GET['lang']) AND strlen($_GET['lang']) == 2) {
91
	  	define('LANGUAGE', strtoupper($_GET['lang']));
92
		$_SESSION['LANGUAGE']=LANGUAGE;
93
	} else {
94
		if(isset($_SESSION['LANGUAGE']) AND $_SESSION['LANGUAGE'] != '') {
95
			define('LANGUAGE', $_SESSION['LANGUAGE']);
96
		} else {
97
			define('LANGUAGE', DEFAULT_LANGUAGE);
98
		}
99
	}
100
	
101
	// Load Language file
102
	if(!defined('LANGUAGE_LOADED')) {
103
		if(!file_exists(WB_PATH.'/languages/'.LANGUAGE.'.php')) {
104
			exit('Error loading language file '.LANGUAGE.', please check configuration');
105
		} else {
106
			require_once(WB_PATH.'/languages/'.LANGUAGE.'.php');
107
		}
108
	}
109
	
110
	// Get users timezone
111
	if(isset($_SESSION['TIMEZONE'])) {
112
		define('TIMEZONE', $_SESSION['TIMEZONE']);
113
	} else {
114
		define('TIMEZONE', DEFAULT_TIMEZONE);
115
	}
116
	// Get users date format
117
	if(isset($_SESSION['DATE_FORMAT'])) {
118
		define('DATE_FORMAT', $_SESSION['DATE_FORMAT']);
119
	} else {
120
		define('DATE_FORMAT', DEFAULT_DATE_FORMAT);
121
	}
122
	// Get users time format
123
	if(isset($_SESSION['TIME_FORMAT'])) {
124
		define('TIME_FORMAT', $_SESSION['TIME_FORMAT']);
125
	} else {
126
		define('TIME_FORMAT', DEFAULT_TIME_FORMAT);
127
	}
128
	
129
	// Set Theme dir
130
	define('THEME_URL', WB_URL.'/templates/'.DEFAULT_THEME);
131
	define('THEME_PATH', WB_PATH.'/templates/'.DEFAULT_THEME);
132

  
133
    // extended wb_settings
134
	define('EDIT_ONE_SECTION', true);
135

  
136
	define('EDITOR_WIDTH', 900);
137

  
138
}
139

  
140
?>
branches/2.8.x/wb/modules/fckeditor/include.php
111 111
  $oFCKeditor->Config['FlashBrowserURL'] = $oFCKeditor->BasePath.'editor/filemanager/browser/default/browser.html?Connector='
112 112
		.$connectorPath;
113 113

  
114
  if(defined('EDITOR_WIDTH'))
115
  {
116
    $width = ($width < EDITOR_WIDTH) ? EDITOR_WIDTH : $width;
117
  }
118

  
114 119
	$oFCKeditor->Value = reverse_htmlentities($content);
115 120
    $oFCKeditor->Width  = $width;
116 121
	$oFCKeditor->Height = $height;

Also available in: Unified diff