Revision 1289
Added by kweitzel almost 15 years ago
settings.php | ||
---|---|---|
1 | 1 |
<?php |
2 |
/** |
|
3 |
* |
|
4 |
* @category admin |
|
5 |
* @package pages |
|
6 |
* @author WebsiteBaker Project |
|
7 |
* @copyright 2004-2009, Ryan Djurovich |
|
8 |
* @copyright 2009-2010, Website Baker Org. e.V. |
|
9 |
* @link http://www.websitebaker2.org/ |
|
10 |
* @license http://www.gnu.org/licenses/gpl.html |
|
11 |
* @platform WebsiteBaker 2.8.x |
|
12 |
* @requirements PHP 4.3.4 and higher |
|
13 |
* @version $Id$ |
|
14 |
* @filesource $HeadURL$ |
|
15 |
* @lastmodified $Date$ |
|
16 |
* |
|
17 |
*/ |
|
2 | 18 |
|
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 | 19 |
// Get page id |
27 |
if(!isset($_GET['page_id']) OR !is_numeric($_GET['page_id'])) { |
|
20 |
if(!isset($_GET['page_id']) OR !is_numeric($_GET['page_id'])) |
|
21 |
{ |
|
28 | 22 |
header("Location: index.php"); |
29 | 23 |
exit(0); |
30 | 24 |
} else { |
... | ... | |
40 | 34 |
require_once(WB_PATH.'/framework/functions-utf8.php'); |
41 | 35 |
|
42 | 36 |
// Get perms |
43 |
$database = new database(); |
|
44 |
$results = $database->query("SELECT * FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'"); |
|
37 |
/*$database = new database(); */ |
|
38 |
|
|
39 |
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'pages` WHERE `page_id` = '.$page_id; |
|
40 |
$results = $database->query($sql); |
|
45 | 41 |
$results_array = $results->fetchRow(); |
42 |
|
|
46 | 43 |
$old_admin_groups = explode(',', $results_array['admin_groups']); |
47 | 44 |
$old_admin_users = explode(',', $results_array['admin_users']); |
48 | 45 |
|
46 |
// Work-out if we should check for existing page_code |
|
47 |
$sql = 'DESCRIBE `'.TABLE_PREFIX.'pages` `page_code`'; |
|
48 |
$field_sql = $database->query($sql); |
|
49 |
$field_set = $field_sql->numRows(); |
|
50 |
|
|
49 | 51 |
$in_old_group = FALSE; |
50 |
foreach($admin->get_groups_id() as $cur_gid){ |
|
51 |
if (in_array($cur_gid, $old_admin_groups)) { |
|
52 |
foreach($admin->get_groups_id() as $cur_gid) |
|
53 |
{ |
|
54 |
if (in_array($cur_gid, $old_admin_groups)) |
|
55 |
{ |
|
52 | 56 |
$in_old_group = TRUE; |
53 | 57 |
} |
54 | 58 |
} |
55 |
if((!$in_old_group) AND !is_numeric(array_search($admin->get_user_id(), $old_admin_users))) { |
|
59 |
if((!$in_old_group) AND !is_numeric(array_search($admin->get_user_id(), $old_admin_users))) |
|
60 |
{ |
|
56 | 61 |
$admin->print_error($MESSAGE['PAGES']['INSUFFICIENT_PERMISSIONS']); |
57 | 62 |
} |
58 | 63 |
|
59 | 64 |
// Get page details |
60 |
$database = new database();
|
|
61 |
$query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'";
|
|
62 |
$results = $database->query($query);
|
|
65 |
/* $database = new database(); */
|
|
66 |
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'pages` WHERE `page_id`='.$page_id;
|
|
67 |
$results = $database->query($sql);
|
|
63 | 68 |
if($database->is_error()) { |
64 | 69 |
$admin->print_header(); |
65 | 70 |
$admin->print_error($database->get_error()); |
... | ... | |
74 | 79 |
$user=$admin->get_user_details($results_array['modified_by']); |
75 | 80 |
|
76 | 81 |
// Convert the unix ts for modified_when to human a readable form |
77 |
if($results_array['modified_when'] != 0) { |
|
82 |
if($results_array['modified_when'] != 0) |
|
83 |
{ |
|
78 | 84 |
$modified_ts = gmdate(TIME_FORMAT.', '.DATE_FORMAT, $results_array['modified_when']+TIMEZONE); |
79 | 85 |
} else { |
80 | 86 |
$modified_ts = 'Unknown'; |
... | ... | |
102 | 108 |
); |
103 | 109 |
|
104 | 110 |
// Work-out if we should show the "manage sections" link |
105 |
$query_sections = $database->query("SELECT section_id FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' AND module = 'menu_link'"); |
|
106 |
if($query_sections->numRows() > 0) { |
|
107 |
$template->set_var('DISPLAY_MANAGE_SECTIONS', 'none'); |
|
108 |
} elseif(MANAGE_SECTIONS == 'enabled') { |
|
111 |
$sql = 'SELECT `section_id` FROM `'.TABLE_PREFIX.'sections` WHERE `page_id`='.$page_id.' AND `module`="menu_link"'; |
|
112 |
$query_sections = $database->query($sql); |
|
113 |
if($query_sections->numRows() > 0) |
|
114 |
{ |
|
115 |
$template->set_var('DISPLAY_MANAGE_SECTIONS', 'display:none;'); |
|
116 |
} elseif(MANAGE_SECTIONS == 'enabled') |
|
117 |
{ |
|
109 | 118 |
$template->set_var('TEXT_MANAGE_SECTIONS', $HEADING['MANAGE_SECTIONS']); |
110 | 119 |
} else { |
111 |
$template->set_var('DISPLAY_MANAGE_SECTIONS', 'none');
|
|
120 |
$template->set_var('DISPLAY_MANAGE_SECTIONS', 'display:none;');
|
|
112 | 121 |
} |
113 | 122 |
|
114 | 123 |
// Visibility |
... | ... | |
120 | 129 |
$template->set_var('REGISTERED_SELECTED', ' selected="selected"'); |
121 | 130 |
} elseif($results_array['visibility'] == 'hidden') { |
122 | 131 |
$template->set_var('HIDDEN_SELECTED', ' selected="selected"'); |
123 |
} elseif($results_array['visibility'] == 'none') {
|
|
132 |
} elseif($results_array['visibility'] == 'display:none;') {
|
|
124 | 133 |
$template->set_var('NO_VIS_SELECTED', ' selected="selected"'); |
125 | 134 |
} |
126 | 135 |
// Group list 1 (admin_groups) |
127 | 136 |
$admin_groups = explode(',', str_replace('_', '', $results_array['admin_groups'])); |
128 | 137 |
|
129 |
$query = "SELECT * FROM ".TABLE_PREFIX."groups";
|
|
130 |
|
|
131 |
$get_groups = $database->query($query); |
|
138 |
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'groups`';
|
|
139 |
$get_groups = $database->query($sql); |
|
140 |
|
|
132 | 141 |
$template->set_block('main_block', 'group_list_block', 'group_list'); |
133 | 142 |
// Insert admin group and current group first |
134 | 143 |
$admin_group_name = $get_groups->fetchRow(); |
... | ... | |
143 | 152 |
) |
144 | 153 |
); |
145 | 154 |
$template->parse('group_list', 'group_list_block', true); |
146 |
/* |
|
147 |
if(!in_array(1, $admin->get_groups_id())) { |
|
148 |
$users_groups = $admin->get_groups_name(); |
|
149 |
foreach ($admin->get_groups_id() as $users_group_id) { |
|
150 |
$template->set_var(array( |
|
151 |
'ID' => $users_group_id, |
|
152 |
'TOGGLE' => '', |
|
153 |
'DISABLED' => ' disabled', |
|
154 |
'LINK_COLOR' => '000000', |
|
155 |
'CURSOR' => 'default', |
|
156 |
'NAME' => $users_groups[$users_group_id], |
|
157 |
'CHECKED' => ' checked' |
|
158 |
) |
|
159 |
); |
|
160 |
$template->parse('group_list', 'group_list_block', true); |
|
161 |
} |
|
162 |
} |
|
163 |
*/ |
|
164 | 155 |
while($group = $get_groups->fetchRow()) { |
165 | 156 |
// check if the user is a member of this group |
166 | 157 |
$flag_disabled = ''; |
... | ... | |
198 | 189 |
// Group list 2 (viewing_groups) |
199 | 190 |
$viewing_groups = explode(',', str_replace('_', '', $results_array['viewing_groups'])); |
200 | 191 |
|
201 |
$query = "SELECT * FROM ".TABLE_PREFIX."groups"; |
|
192 |
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'groups`'; |
|
193 |
$get_groups = $database->query($sql); |
|
202 | 194 |
|
203 |
$get_groups = $database->query($query); |
|
204 | 195 |
$template->set_block('main_block', 'group_list_block2', 'group_list2'); |
205 | 196 |
// Insert admin group and current group first |
206 | 197 |
$admin_group_name = $get_groups->fetchRow(); |
... | ... | |
216 | 207 |
); |
217 | 208 |
$template->parse('group_list2', 'group_list_block2', true); |
218 | 209 |
|
219 |
|
|
220 |
while($group = $get_groups->fetchRow()) {
|
|
210 |
while($group = $get_groups->fetchRow()) |
|
211 |
{
|
|
221 | 212 |
// check if the user is a member of this group |
222 | 213 |
$flag_disabled = ''; |
223 | 214 |
$flag_checked = ''; |
224 | 215 |
$flag_cursor = 'pointer'; |
225 | 216 |
$flag_color = ''; |
226 |
if (in_array($group["group_id"], $admin->get_groups_id())) { |
|
217 |
if (in_array($group["group_id"], $admin->get_groups_id())) |
|
218 |
{ |
|
227 | 219 |
$flag_disabled = ''; //' disabled'; |
228 | 220 |
$flag_checked = ''; //' checked'; |
229 | 221 |
$flag_cursor = 'default'; |
... | ... | |
240 | 232 |
'CHECKED' => $flag_checked |
241 | 233 |
) |
242 | 234 |
); |
243 |
if(is_numeric(array_search($group['group_id'], $viewing_groups))) { |
|
235 |
if(is_numeric(array_search($group['group_id'], $viewing_groups))) |
|
236 |
{ |
|
244 | 237 |
$template->set_var('CHECKED', 'checked="checked"'); |
245 | 238 |
} else { |
246 |
if (!$flag_checked) $template->set_var('CHECKED', '');
|
|
239 |
if (!$flag_checked) {$template->set_var('CHECKED', '');}
|
|
247 | 240 |
} |
241 |
|
|
248 | 242 |
$template->parse('group_list2', 'group_list_block2', true); |
243 |
|
|
249 | 244 |
} |
245 |
|
|
250 | 246 |
// Show private viewers |
251 |
if($results_array['visibility'] == 'private' OR $results_array['visibility'] == 'registered') { |
|
247 |
if($results_array['visibility'] == 'private' OR $results_array['visibility'] == 'registered') |
|
248 |
{ |
|
252 | 249 |
$template->set_var('DISPLAY_VIEWERS', ''); |
253 | 250 |
} else { |
254 |
$template->set_var('DISPLAY_VIEWERS', 'none');
|
|
251 |
$template->set_var('DISPLAY_VIEWERS', 'display:none;');
|
|
255 | 252 |
} |
256 | 253 |
|
254 |
//-- insert page_code 20090904--> |
|
255 |
$template->set_var('DISPLAY_CODE_PAGE_LIST', ' id="multi_lingual" style="display:none;"'); |
|
256 |
|
|
257 |
// Work-out if page languages feature is enabled |
|
258 |
if((defined('PAGE_LANGUAGES') && PAGE_LANGUAGES) && $field_set && file_exists(WB_PATH.'/modules/mod_multilingual/update_keys.php') ) |
|
259 |
{ |
|
260 |
// workout field is set but module missing |
|
261 |
$TEXT['PAGE_CODE'] = empty($TEXT['PAGE_CODE']) ? 'Pagecode' : $TEXT['PAGE_CODE']; |
|
262 |
$template->set_var( array( |
|
263 |
'DISPLAY_CODE_PAGE_LIST' => ' id="multi_lingual"', |
|
264 |
'TEXT_PAGE_CODE' => '<a href="'.WB_URL.'/modules/mod_multilingual/update_keys.php?page_id='.$page_id.'">'.$TEXT['PAGE_CODE'].'</a>' |
|
265 |
) |
|
266 |
); |
|
267 |
|
|
268 |
// Page_code list |
|
269 |
/* $database = new database(); */ |
|
270 |
function page_code_list($parent) |
|
271 |
{ |
|
272 |
global $admin, $database, $template, $results_array, $pageCode; |
|
273 |
$default_language = DEFAULT_LANGUAGE; |
|
274 |
|
|
275 |
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'pages` WHERE `parent` = '.$parent.' AND `language` = "'.$default_language.'" ORDER BY `position` ASC'; |
|
276 |
$get_pages = $database->query($sql); |
|
277 |
|
|
278 |
while($page = $get_pages->fetchRow()) |
|
279 |
{ |
|
280 |
if($admin->page_is_visible($page)==false) |
|
281 |
continue; |
|
282 |
$template->set_var('FLAG_CODE_ICON',' none '); |
|
283 |
if( $page['parent'] == 0 ) |
|
284 |
{ |
|
285 |
$template->set_var('FLAG_CODE_ICON','url('.THEME_URL.'/images/flags/'.strtolower($page['language']).'.png)'); |
|
286 |
} |
|
287 |
// If the current page cannot be parent, then its children neither |
|
288 |
$list_next_level = true; |
|
289 |
// Stop users from adding pages with a level of more than the set page level limit |
|
290 |
if($page['level']+1 < PAGE_LEVEL_LIMIT) |
|
291 |
{ |
|
292 |
// Get user perms |
|
293 |
$admin_groups = explode(',', str_replace('_', '', $page['admin_groups'])); |
|
294 |
$admin_users = explode(',', str_replace('_', '', $page['admin_users'])); |
|
295 |
|
|
296 |
$in_group = FALSE; |
|
297 |
foreach($admin->get_groups_id() as $cur_gid) |
|
298 |
{ |
|
299 |
if (in_array($cur_gid, $admin_groups)) |
|
300 |
{ |
|
301 |
$in_group = TRUE; |
|
302 |
} |
|
303 |
} |
|
304 |
|
|
305 |
if(($in_group) OR is_numeric(array_search($admin->get_user_id(), $admin_users))) |
|
306 |
{ |
|
307 |
$can_modify = true; |
|
308 |
} else { |
|
309 |
$can_modify = false; |
|
310 |
} |
|
311 |
|
|
312 |
$title_prefix = ''; |
|
313 |
for($i = 1; $i <= $page['level']; $i++) { $title_prefix .= ' - - '; } |
|
314 |
// $space = str_repeat(' ', 3); $space.'<'..'>' |
|
315 |
$template->set_var(array( |
|
316 |
'VALUE' => $page['page_code'], |
|
317 |
'PAGE_VALUE' => $title_prefix.$page['page_code'], |
|
318 |
'PAGE_CODE' => $title_prefix.$page['menu_title'] |
|
319 |
) |
|
320 |
); |
|
321 |
if($results_array['page_code'] == $page['page_code']) { |
|
322 |
$template->set_var('SELECTED', ' selected="selected"'); |
|
323 |
} elseif($results_array['page_code'] == $page['page_code']) { |
|
324 |
$template->set_var('SELECTED', ' disabled="disabled" class="disabled"'); |
|
325 |
$list_next_level=false; |
|
326 |
} elseif($can_modify != true) { |
|
327 |
$template->set_var('SELECTED', ' disabled="disabled" class="disabled"'); |
|
328 |
} else { |
|
329 |
$template->set_var('SELECTED', ''); |
|
330 |
} |
|
331 |
$template->parse('page_code_list', 'page_code_list_block', true); |
|
332 |
} |
|
333 |
if ($list_next_level) |
|
334 |
page_code_list($page['page_id']); |
|
335 |
} |
|
336 |
} |
|
337 |
|
|
338 |
// Insert code_page values from page to modify |
|
339 |
$template->set_block('main_block', 'page_code_list_block', 'page_code_list'); |
|
340 |
if($admin->get_permission('pages_add_l0') == true OR $results_array['level'] == 0) { |
|
341 |
if($results_array['parent'] == 0) { $selected = ' selected'; } else { $selected = ''; } |
|
342 |
$template->set_var(array( |
|
343 |
'VALUE' => '', |
|
344 |
'PAGE_CODE' => $TEXT['NONE'], |
|
345 |
'PAGE_VALUE' => '', |
|
346 |
'SELECTED' => $selected |
|
347 |
) |
|
348 |
); |
|
349 |
$template->parse('page_code_list', 'page_code_list_block', true); |
|
350 |
} |
|
351 |
// get pagecode form this page_id |
|
352 |
page_code_list(0); |
|
353 |
} |
|
354 |
//-- page code --> |
|
355 |
|
|
257 | 356 |
// Parent page list |
258 |
$database = new database(); |
|
259 |
function parent_list($parent) { |
|
260 |
global $admin, $database, $template, $results_array; |
|
261 |
$query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE parent = '$parent' ORDER BY position ASC"; |
|
262 |
$get_pages = $database->query($query); |
|
263 |
while($page = $get_pages->fetchRow()) { |
|
357 |
/* $database = new database(); */ |
|
358 |
function parent_list($parent) |
|
359 |
{ |
|
360 |
global $admin, $database, $template, $results_array,$field_set; |
|
361 |
|
|
362 |
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'pages` WHERE `parent` = '.$parent.' ORDER BY `position` ASC'; |
|
363 |
$get_pages = $database->query($sql); |
|
364 |
|
|
365 |
while($page = $get_pages->fetchRow()) |
|
366 |
{ |
|
264 | 367 |
if($admin->page_is_visible($page)==false) |
265 |
continue; |
|
266 |
// if psrent = 0 set flag_icon |
|
368 |
{ |
|
369 |
continue; |
|
370 |
} |
|
371 |
|
|
372 |
// if parent = 0 set flag_icon |
|
267 | 373 |
$template->set_var('FLAG_ROOT_ICON',' none '); |
268 |
if( $page['parent'] == 0 ) { |
|
374 |
if( $page['parent'] == 0 && $field_set) |
|
375 |
{ |
|
269 | 376 |
$template->set_var('FLAG_ROOT_ICON','url('.THEME_URL.'/images/flags/'.strtolower($page['language']).'.png)'); |
270 | 377 |
} |
271 | 378 |
// If the current page cannot be parent, then its children neither |
272 | 379 |
$list_next_level = true; |
273 | 380 |
// Stop users from adding pages with a level of more than the set page level limit |
274 |
if($page['level']+1 < PAGE_LEVEL_LIMIT) { |
|
381 |
if($page['level']+1 < PAGE_LEVEL_LIMIT) |
|
382 |
{ |
|
275 | 383 |
// Get user perms |
276 | 384 |
$admin_groups = explode(',', str_replace('_', '', $page['admin_groups'])); |
277 | 385 |
$admin_users = explode(',', str_replace('_', '', $page['admin_users'])); |
278 | 386 |
$in_group = FALSE; |
279 |
foreach($admin->get_groups_id() as $cur_gid){ |
|
280 |
if (in_array($cur_gid, $admin_groups)) { |
|
387 |
foreach($admin->get_groups_id() as $cur_gid) |
|
388 |
{ |
|
389 |
if (in_array($cur_gid, $admin_groups)) |
|
390 |
{ |
|
281 | 391 |
$in_group = TRUE; |
282 | 392 |
} |
283 | 393 |
} |
284 |
if(($in_group) OR is_numeric(array_search($admin->get_user_id(), $admin_users))) { |
|
394 |
if(($in_group) OR is_numeric(array_search($admin->get_user_id(), $admin_users))) |
|
395 |
{ |
|
285 | 396 |
$can_modify = true; |
286 | 397 |
} else { |
287 | 398 |
$can_modify = false; |
... | ... | |
291 | 402 |
for($i = 1; $i <= $page['level']; $i++) { $title_prefix .= ' - '; } |
292 | 403 |
$template->set_var(array( |
293 | 404 |
'ID' => $page['page_id'], |
294 |
'TITLE' => ($title_prefix.$page['page_title']), |
|
295 |
'FLAG_ICON' => 'none', |
|
405 |
'TITLE' => ($title_prefix.$page['menu_title']), |
|
406 |
'MENU-TITLE' => ($title_prefix.$page['menu_title']), |
|
407 |
'PAGE-TITLE' => ($title_prefix.$page['page_title']), |
|
408 |
'FLAG_ICON' => ' none ', |
|
296 | 409 |
)); |
297 | 410 |
|
298 |
if($results_array['parent'] == $page['page_id']) { |
|
411 |
if($results_array['parent'] == $page['page_id']) |
|
412 |
{ |
|
299 | 413 |
$template->set_var('SELECTED', ' selected="selected"'); |
300 |
} elseif($results_array['page_id'] == $page['page_id']) { |
|
414 |
} elseif($results_array['page_id'] == $page['page_id']) |
|
415 |
{ |
|
301 | 416 |
$template->set_var('SELECTED', ' disabled="disabled" class="disabled"'); |
302 | 417 |
$list_next_level=false; |
303 |
} elseif($can_modify != true) { |
|
418 |
} elseif($can_modify != true) |
|
419 |
{ |
|
304 | 420 |
$template->set_var('SELECTED', ' disabled="disabled" class="disabled"'); |
305 | 421 |
} else { |
306 | 422 |
$template->set_var('SELECTED', ''); |
... | ... | |
308 | 424 |
$template->parse('page_list2', 'page_list_block2', true); |
309 | 425 |
} |
310 | 426 |
if ($list_next_level) |
311 |
parent_list($page['page_id']); |
|
427 |
{ |
|
428 |
parent_list($page['page_id']); |
|
429 |
} |
|
430 |
|
|
312 | 431 |
} |
313 | 432 |
} |
314 | 433 |
|
315 | 434 |
$template->set_block('main_block', 'page_list_block2', 'page_list2'); |
316 | 435 |
if($admin->get_permission('pages_add_l0') == true OR $results_array['level'] == 0) { |
317 |
if($results_array['parent'] == 0) { |
|
436 |
if($results_array['parent'] == 0) |
|
437 |
{ |
|
318 | 438 |
$selected = ' selected="selected"'; |
319 | 439 |
} else { |
320 | 440 |
$selected = ''; |
... | ... | |
329 | 449 |
} |
330 | 450 |
parent_list(0); |
331 | 451 |
|
332 |
if($modified_ts == 'Unknown') { |
|
452 |
if($modified_ts == 'Unknown') |
|
453 |
{ |
|
333 | 454 |
$template->set_var('DISPLAY_MODIFIED', 'hide'); |
334 | 455 |
} else { |
335 | 456 |
$template->set_var('DISPLAY_MODIFIED', ''); |
336 | 457 |
} |
458 |
|
|
337 | 459 |
// Templates list |
338 | 460 |
$template->set_block('main_block', 'template_list_block', 'template_list'); |
339 |
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template' and function = 'template' order by name"); |
|
340 |
if($result->numRows() > 0) { |
|
341 |
while($addon = $result->fetchRow()) { |
|
461 |
|
|
462 |
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'addons` WHERE `type` = "template" AND `function` = "template" order by `name`'; |
|
463 |
$result = $database->query($sql); |
|
464 |
|
|
465 |
if($result->numRows() > 0) |
|
466 |
{ |
|
467 |
while($addon = $result->fetchRow()) |
|
468 |
{ |
|
342 | 469 |
// Check if the user has perms to use this template |
343 |
if($addon['directory'] == $results_array['template'] OR $admin->get_permission($addon['directory'], 'template') == true) { |
|
470 |
if($addon['directory'] == $results_array['template'] OR $admin->get_permission($addon['directory'], 'template') == true) |
|
471 |
{ |
|
344 | 472 |
$template->set_var('VALUE', $addon['directory']); |
345 | 473 |
$template->set_var('NAME', $addon['name']); |
346 |
if($addon['directory'] == $results_array['template']) { |
|
474 |
if($addon['directory'] == $results_array['template']) |
|
475 |
{ |
|
347 | 476 |
$template->set_var('SELECTED', ' selected="selected"'); |
348 | 477 |
} else { |
349 | 478 |
$template->set_var('SELECTED', ''); |
... | ... | |
354 | 483 |
} |
355 | 484 |
|
356 | 485 |
// Menu list |
357 |
if(MULTIPLE_MENUS == false) { |
|
358 |
$template->set_var('DISPLAY_MENU_LIST', 'none'); |
|
486 |
if(MULTIPLE_MENUS == false) |
|
487 |
{ |
|
488 |
$template->set_var('DISPLAY_MENU_LIST', 'display:none;'); |
|
359 | 489 |
} |
360 | 490 |
// Include template info file (if it exists) |
361 |
if($results_array['template'] != '') { |
|
491 |
if($results_array['template'] != '') |
|
492 |
{ |
|
362 | 493 |
$template_location = WB_PATH.'/templates/'.$results_array['template'].'/info.php'; |
363 | 494 |
} else { |
364 | 495 |
$template_location = WB_PATH.'/templates/'.DEFAULT_TEMPLATE.'/info.php'; |
365 | 496 |
} |
366 |
if(file_exists($template_location)) { |
|
497 |
if(file_exists($template_location)) |
|
498 |
{ |
|
367 | 499 |
require($template_location); |
368 | 500 |
} |
369 | 501 |
// Check if $menu is set |
370 |
if(!isset($menu[1]) OR $menu[1] == '') { |
|
502 |
if(!isset($menu[1]) OR $menu[1] == '') |
|
503 |
{ |
|
371 | 504 |
// Make our own menu list |
372 | 505 |
$menu[1] = $TEXT['MAIN']; |
373 | 506 |
} |
374 | 507 |
// Add menu options to the list |
375 | 508 |
$template->set_block('main_block', 'menu_list_block', 'menu_list'); |
376 |
foreach($menu AS $number => $name) { |
|
509 |
foreach($menu AS $number => $name) |
|
510 |
{ |
|
377 | 511 |
$template->set_var('NAME', $name); |
378 | 512 |
$template->set_var('VALUE', $number); |
379 |
if($results_array['menu'] == $number) { |
|
513 |
if($results_array['menu'] == $number) |
|
514 |
{ |
|
380 | 515 |
$template->set_var('SELECTED', ' selected="selected"'); |
381 | 516 |
} else { |
382 | 517 |
$template->set_var('SELECTED', ''); |
... | ... | |
386 | 521 |
|
387 | 522 |
// Insert language values |
388 | 523 |
$template->set_block('main_block', 'language_list_block', 'language_list'); |
389 |
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'language' order by name"); |
|
390 |
if($result->numRows() > 0) { |
|
391 |
while($addon = $result->fetchRow()) { |
|
524 |
|
|
525 |
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'addons` WHERE `type` = "language" ORDER BY `name`'; |
|
526 |
$result = $database->query($sql); |
|
527 |
|
|
528 |
if($result->numRows() > 0) |
|
529 |
{ |
|
530 |
while($addon = $result->fetchRow()) |
|
531 |
{ |
|
392 | 532 |
$l_codes[$addon['name']] = $addon['directory']; |
393 | 533 |
$l_names[$addon['name']] = entities_to_7bit($addon['name']); // sorting-problem workaround |
394 | 534 |
} |
395 | 535 |
asort($l_names); |
396 |
foreach($l_names as $l_name=>$v) { |
|
536 |
foreach($l_names as $l_name=>$v) |
|
537 |
{ |
|
397 | 538 |
// Insert code and name |
398 | 539 |
$template->set_var(array( |
399 | 540 |
'VALUE' => $l_codes[$l_name], |
... | ... | |
401 | 542 |
'FLAG_LANG_ICONS' => 'url('.THEME_URL.'/images/flags/'.strtolower($l_codes[$l_name]).'.png)', |
402 | 543 |
)); |
403 | 544 |
// Check if it is selected |
404 |
if($results_array['language'] == $l_codes[$l_name]) { |
|
545 |
if($results_array['language'] == $l_codes[$l_name]) |
|
546 |
{ |
|
405 | 547 |
$template->set_var('SELECTED', ' selected="selected"'); |
406 | 548 |
} else { |
407 | 549 |
$template->set_var('SELECTED', ''); |
... | ... | |
411 | 553 |
} |
412 | 554 |
|
413 | 555 |
// Select disabled if searching is disabled |
414 |
if($results_array['searching'] == 0) { |
|
556 |
if($results_array['searching'] == 0) |
|
557 |
{ |
|
415 | 558 |
$template->set_var('SEARCHING_DISABLED', ' selected="selected"'); |
416 | 559 |
} |
417 | 560 |
// Select what the page target is |
418 |
switch ($results_array['target']) { |
|
561 |
switch ($results_array['target']) |
|
562 |
{ |
|
419 | 563 |
case '_top': |
420 | 564 |
$template->set_var('TOP_SELECTED', ' selected="selected"'); |
421 | 565 |
break; |
... | ... | |
426 | 570 |
$template->set_var('BLANK_SELECTED', ' selected="selected"'); |
427 | 571 |
break; |
428 | 572 |
} |
429 |
|
|
430 | 573 |
|
431 | 574 |
// Insert language text |
432 | 575 |
$template->set_var(array( |
433 | 576 |
Also available in: Unified diff
Branch 2.8.1 merged back into Trunk