1
|
<?php
|
2
|
/**
|
3
|
*
|
4
|
* @category admin
|
5
|
* @package pages
|
6
|
* @author Ryan Djurovich, WebsiteBaker Project
|
7
|
* @copyright 2009-2011, Website Baker Org. e.V.
|
8
|
* @link http://www.websitebaker2.org/
|
9
|
* @license http://www.gnu.org/licenses/gpl.html
|
10
|
* @platform WebsiteBaker 2.8.x
|
11
|
* @requirements PHP 5.2.2 and higher and higher
|
12
|
* @version $Id: index.php 1625 2012-02-29 00:50:57Z Luisehahne $
|
13
|
* @filesource $HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/admin/pages/index.php $
|
14
|
* @lastmodified $Date: 2012-02-29 01:50:57 +0100 (Wed, 29 Feb 2012) $
|
15
|
*
|
16
|
*/
|
17
|
|
18
|
require('../../config.php');
|
19
|
require_once(WB_PATH.'/framework/class.admin.php');
|
20
|
$admin = new admin('Pages', 'pages');
|
21
|
|
22
|
$admin->clearIDKEY();
|
23
|
|
24
|
// Include the WB functions file
|
25
|
require_once(WB_PATH.'/framework/functions.php');
|
26
|
// eggsurplus: add child pages for a specific page
|
27
|
?>
|
28
|
<script type="text/javascript" src="<?php print ADMIN_URL; ?>/pages/eggsurplus.js"></script>
|
29
|
<?php
|
30
|
|
31
|
// fixes A URI contains impermissible characters or quotes around the URI are not closed.
|
32
|
$MESSAGE['PAGES_DELETE_CONFIRM'] = url_encode( $MESSAGE['PAGES_DELETE_CONFIRM'] );
|
33
|
|
34
|
function set_node ($parent,& $par)
|
35
|
{
|
36
|
$retval = '';
|
37
|
|
38
|
if($par['num_subs'] )
|
39
|
{
|
40
|
$retval .= "\n".'<ul id="p'.$parent.'"';
|
41
|
if ($parent != 0)
|
42
|
{
|
43
|
$retval .= ' class="page_list"';
|
44
|
if (isset ($_COOKIE['p'.$parent]) && $_COOKIE['p'.$parent] == '1')
|
45
|
{
|
46
|
$retval .= ' style="display:block"';
|
47
|
}
|
48
|
}
|
49
|
$retval .= ">\n";
|
50
|
}
|
51
|
|
52
|
return $retval;
|
53
|
}
|
54
|
|
55
|
function make_list($parent = 0, $editable_pages = 0) {
|
56
|
// Get objects and vars from outside this function
|
57
|
global $admin, $template, $database, $TEXT, $MESSAGE, $HEADING, $par;
|
58
|
|
59
|
print set_node ($parent,$par);
|
60
|
|
61
|
// Get page list from database
|
62
|
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'pages` WHERE `parent` = '.$parent.' ';
|
63
|
$sql .= (PAGE_TRASH != 'inline') ? 'AND `visibility` != \'deleted\' ' : ' ';
|
64
|
$sql .= 'ORDER BY `position` ASC';
|
65
|
$get_pages = $database->query($sql);
|
66
|
|
67
|
// Insert values into main page list
|
68
|
if($get_pages->numRows() > 0)
|
69
|
{
|
70
|
while($page = $get_pages->fetchRow())
|
71
|
{
|
72
|
// Get user perms
|
73
|
$admin_groups = explode(',', str_replace('_', '', $page['admin_groups']));
|
74
|
$admin_users = explode(',', str_replace('_', '', $page['admin_users']));
|
75
|
$in_group = FALSE;
|
76
|
foreach($admin->get_groups_id() as $cur_gid)
|
77
|
{
|
78
|
if (in_array($cur_gid, $admin_groups))
|
79
|
{
|
80
|
$in_group = TRUE;
|
81
|
}
|
82
|
}
|
83
|
if(($in_group) || is_numeric(array_search($admin->get_user_id(), $admin_users)))
|
84
|
{
|
85
|
if($page['visibility'] == 'deleted')
|
86
|
{
|
87
|
if(PAGE_TRASH == 'inline')
|
88
|
{
|
89
|
$can_modify = true;
|
90
|
$editable_pages = $editable_pages+1;
|
91
|
} else {
|
92
|
$can_modify = false;
|
93
|
}
|
94
|
} elseif($page['visibility'] != 'deleted')
|
95
|
{
|
96
|
$can_modify = true;
|
97
|
$editable_pages = $editable_pages+1;
|
98
|
}
|
99
|
} else {
|
100
|
if($page['visibility'] == 'private')
|
101
|
{
|
102
|
continue;
|
103
|
}
|
104
|
else {
|
105
|
$can_modify = false;
|
106
|
}
|
107
|
}
|
108
|
|
109
|
// Work out if we should show a plus or not
|
110
|
$sql = 'SELECT `page_id`,`admin_groups`,`admin_users` FROM `'.TABLE_PREFIX.'pages` WHERE `parent` = '.$page['page_id'].' ';
|
111
|
$sql .= (PAGE_TRASH != 'inline') ? 'AND `visibility` != \'deleted\' ' : ' ';
|
112
|
// $sql .= ' ORDER BY `position` ASC';
|
113
|
$get_page_subs = $database->query($sql);
|
114
|
$num_subs = $get_page_subs->numRows();
|
115
|
$par['num_subs'] = $num_subs;
|
116
|
/*
|
117
|
if(PAGE_TRASH != 'inline')
|
118
|
{
|
119
|
$get_page_subs = $database->query("SELECT page_id,admin_groups,admin_users FROM ".TABLE_PREFIX."pages WHERE parent = '".$page['page_id']."' AND visibility!='deleted'");
|
120
|
} else {
|
121
|
$get_page_subs = $database->query("SELECT page_id,admin_groups,admin_users FROM ".TABLE_PREFIX."pages WHERE parent = '".$page['page_id']."'");
|
122
|
}
|
123
|
*/
|
124
|
if($get_page_subs->numRows() > 0)
|
125
|
{
|
126
|
$display_plus = true;
|
127
|
} else {
|
128
|
$display_plus = false;
|
129
|
}
|
130
|
// Work out how many pages there are for this parent
|
131
|
$num_pages = $get_pages->numRows();
|
132
|
?>
|
133
|
<li class="p<?php echo $page['parent']; ?>">
|
134
|
<table summary="<?php echo $TEXT['EXPAND'].'/'.$TEXT['COLLAPSE']; ?>" class="pages_view" cellpadding="0" cellspacing="0">
|
135
|
<tr>
|
136
|
<td valign="middle" width="20" style="padding-left: <?php if($page['level'] > 0){ echo $page['level']*20; } else { echo '7'; } ?>px;">
|
137
|
<?php
|
138
|
if($display_plus == true) {
|
139
|
?>
|
140
|
<a href="javascript:toggle_visibility('p<?php echo $page['page_id']; ?>');" title="<?php echo $TEXT['EXPAND'].'/'.$TEXT['COLLAPSE']; ?>">
|
141
|
<img src="<?php echo THEME_URL; ?>/images/<?php if(isset($_COOKIE['p'.$page['page_id']]) && $_COOKIE['p'.$page['page_id']] == '1'){ echo 'minus'; } else { echo 'plus'; } ?>_16.png" onclick="toggle_plus_minus('<?php echo $page['page_id']; ?>');" name="plus_minus_<?php echo $page['page_id']; ?>" alt="+" />
|
142
|
</a>
|
143
|
<?php
|
144
|
}
|
145
|
?>
|
146
|
</td>
|
147
|
<?php if($admin->get_permission('pages_modify') == true && $can_modify == true) { ?>
|
148
|
<td class="list_menu_title">
|
149
|
<a href="<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MODIFY']; ?>">
|
150
|
<?php if($page['visibility'] == 'public') { ?>
|
151
|
<img src="<?php echo THEME_URL; ?>/images/visible_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['PUBLIC']; ?>" class="page_list_rights" />
|
152
|
<?php } elseif($page['visibility'] == 'private') { ?>
|
153
|
<img src="<?php echo THEME_URL; ?>/images/private_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['PRIVATE']; ?>" class="page_list_rights" />
|
154
|
<?php } elseif($page['visibility'] == 'registered') { ?>
|
155
|
<img src="<?php echo THEME_URL; ?>/images/keys_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['REGISTERED']; ?>" class="page_list_rights" />
|
156
|
<?php } elseif($page['visibility'] == 'hidden') { ?>
|
157
|
<img src="<?php echo THEME_URL; ?>/images/hidden_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['HIDDEN']; ?>" class="page_list_rights" />
|
158
|
<?php } elseif($page['visibility'] == 'none') { ?>
|
159
|
<img src="<?php echo THEME_URL; ?>/images/none_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['NONE']; ?>" class="page_list_rights" />
|
160
|
<?php } elseif($page['visibility'] == 'deleted') { ?>
|
161
|
<img src="<?php echo THEME_URL; ?>/images/deleted_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['DELETED']; ?>" class="page_list_rights" />
|
162
|
<?php }
|
163
|
echo '<span class="modify_link">'.($page['menu_title']).'</span>'; ?>
|
164
|
</a>
|
165
|
</td>
|
166
|
<?php } else { ?>
|
167
|
<td class="list_menu_title">
|
168
|
<?php if($page['visibility'] == 'public') { ?>
|
169
|
<img src="<?php echo THEME_URL; ?>/images/visible_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['PUBLIC']; ?>" class="page_list_rights" />
|
170
|
<?php } elseif($page['visibility'] == 'private') { ?>
|
171
|
<img src="<?php echo THEME_URL; ?>/images/private_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['PRIVATE']; ?>" class="page_list_rights" />
|
172
|
<?php } elseif($page['visibility'] == 'registered') { ?>
|
173
|
<img src="<?php echo THEME_URL; ?>/images/keys_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['REGISTERED']; ?>" class="page_list_rights" />
|
174
|
<?php } elseif($page['visibility'] == 'hidden') { ?>
|
175
|
<img src="<?php echo THEME_URL; ?>/images/hidden_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['HIDDEN']; ?>" class="page_list_rights" />
|
176
|
<?php } elseif($page['visibility'] == 'none') { ?>
|
177
|
<img src="<?php echo THEME_URL; ?>/images/none_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['NONE']; ?>" class="page_list_rights" />
|
178
|
<?php } elseif($page['visibility'] == 'deleted') { ?>
|
179
|
<img src="<?php echo THEME_URL; ?>/images/deleted_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['DELETED']; ?>" class="page_list_rights" />
|
180
|
<?php }
|
181
|
echo ($page['menu_title']); ?>
|
182
|
</td>
|
183
|
<?php } ?>
|
184
|
<td class="list_page_title">
|
185
|
<?php echo ($page['page_title']); ?>
|
186
|
</td>
|
187
|
<td class="list_page_id">
|
188
|
<?php echo $page['page_id']; ?>
|
189
|
</td>
|
190
|
|
191
|
<td class="list_actions">
|
192
|
<?php if($page['visibility'] != 'deleted' && $page['visibility'] != 'none') { ?>
|
193
|
<a href="<?php echo $admin->page_link($page['link']); ?>" target="_blank" title="<?php echo $TEXT['VIEW']; ?>">
|
194
|
<img src="<?php echo THEME_URL; ?>/images/view_16.png" alt="<?php echo $TEXT['VIEW']; ?>" />
|
195
|
</a>
|
196
|
<?php } ?>
|
197
|
</td>
|
198
|
<td class="list_actions">
|
199
|
<?php if($page['visibility'] != 'deleted') { ?>
|
200
|
<?php if($admin->get_permission('pages_settings') == true && $can_modify == true) { ?>
|
201
|
<a href="<?php echo ADMIN_URL; ?>/pages/settings.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['SETTINGS']; ?>">
|
202
|
<img src="<?php echo THEME_URL; ?>/images/modify_16.png" alt="<?php echo $TEXT['SETTINGS']; ?>" />
|
203
|
</a>
|
204
|
<?php } ?>
|
205
|
<?php } else { ?>
|
206
|
<a href="<?php echo ADMIN_URL; ?>/pages/restore.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['RESTORE']; ?>">
|
207
|
<img src="<?php echo THEME_URL; ?>/images/restore_16.png" alt="<?php echo $TEXT['RESTORE']; ?>" />
|
208
|
</a>
|
209
|
<?php } ?>
|
210
|
</td>
|
211
|
<!-- MANAGE SECTIONS AND DATES BUTTONS -->
|
212
|
<td class="list_actions">
|
213
|
<?php
|
214
|
// Work-out if we should show the "manage dates" link
|
215
|
if(MANAGE_SECTIONS == 'enabled' && $admin->get_permission('pages_modify')==true && $can_modify==true)
|
216
|
{
|
217
|
$sql = 'SELECT `publ_start`, `publ_end` FROM `'.TABLE_PREFIX.'sections` ';
|
218
|
$sql .= 'WHERE `page_id` = '.$page['page_id'].' AND `module` != \'menu_link\' ';
|
219
|
// $query_sections = $database->query("SELECT publ_start, publ_end FROM ".TABLE_PREFIX."sections WHERE page_id = '{$page['page_id']}' AND module != 'menu_link'");
|
220
|
if( ($query_sections = $database->query($sql)) )
|
221
|
{
|
222
|
$mdate_display=false;
|
223
|
while($mdate_res = $query_sections->fetchRow())
|
224
|
{
|
225
|
if($mdate_res['publ_start']!='0' || $mdate_res['publ_end']!='0')
|
226
|
{
|
227
|
$mdate_display=true;
|
228
|
break;
|
229
|
}
|
230
|
}
|
231
|
if($mdate_display==1)
|
232
|
{
|
233
|
$file=$admin->page_is_active($page)?"clock_16.png":"clock_red_16.png";
|
234
|
?>
|
235
|
<a href="<?php echo ADMIN_URL; ?>/pages/sections.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $HEADING['MANAGE_SECTIONS']; ?>">
|
236
|
<img src="<?php echo THEME_URL."/images/$file"; ?>" alt="<?php echo $HEADING['MANAGE_SECTIONS']; ?>" />
|
237
|
</a>
|
238
|
<?php } else { ?>
|
239
|
<a href="<?php echo ADMIN_URL; ?>/pages/sections.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $HEADING['MANAGE_SECTIONS']; ?>">
|
240
|
<img src="<?php echo THEME_URL; ?>/images/noclock_16.png" alt="<?php echo $HEADING['MANAGE_SECTIONS']; ?>" /></a>
|
241
|
<?php } ?>
|
242
|
<?php } ?>
|
243
|
<?php } ?>
|
244
|
</td>
|
245
|
<td class="list_actions">
|
246
|
<?php if($page['position'] != 1) { ?>
|
247
|
<?php if($page['visibility'] != 'deleted') { ?>
|
248
|
<?php if($admin->get_permission('pages_settings') == true && $can_modify == true) { ?>
|
249
|
<a href="<?php echo ADMIN_URL; ?>/pages/move_up.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MOVE_UP']; ?>">
|
250
|
<img src="<?php echo THEME_URL; ?>/images/up_16.png" alt="<?php echo $TEXT['MOVE_UP']; ?>" />
|
251
|
</a>
|
252
|
<?php } ?>
|
253
|
<?php } ?>
|
254
|
<?php } ?>
|
255
|
</td>
|
256
|
<td class="list_actions">
|
257
|
<?php if($page['position'] != $num_pages) { ?>
|
258
|
<?php if($page['visibility'] != 'deleted') { ?>
|
259
|
<?php if($admin->get_permission('pages_settings') == true && $can_modify == true) { ?>
|
260
|
<a href="<?php echo ADMIN_URL; ?>/pages/move_down.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MOVE_DOWN']; ?>">
|
261
|
<img src="<?php echo THEME_URL; ?>/images/down_16.png" alt="<?php echo $TEXT['MOVE_DOWN']; ?>" />
|
262
|
</a>
|
263
|
<?php } ?>
|
264
|
<?php } ?>
|
265
|
<?php } ?>
|
266
|
</td>
|
267
|
<td class="list_actions">
|
268
|
<?php if($admin->get_permission('pages_delete') == true && $can_modify == true) { // add IdKey ?>
|
269
|
<a href="javascript:confirm_link('<?php echo $MESSAGE['PAGES_DELETE_CONFIRM']; ?>?','<?php echo ADMIN_URL; ?>/pages/delete.php?page_id=<?php echo $admin->getIDKEY($page['page_id']); ?>');" title="<?php echo $TEXT['DELETE']; ?>">
|
270
|
<img src="<?php echo THEME_URL; ?>/images/delete_16.png" alt="<?php echo $TEXT['DELETE']; ?>" />
|
271
|
</a>
|
272
|
<?php } ?>
|
273
|
</td>
|
274
|
<?php
|
275
|
// eggsurplus: Add action to add a page as a child
|
276
|
?>
|
277
|
<td class="list_actions">
|
278
|
<?php if(($admin->get_permission('pages_add')) == (true && $can_modify == true) && ($page['visibility'] != 'deleted')) { ?>
|
279
|
<a href="javascript:add_child_page('<?php echo $page['page_id']; ?>');" title="<?php echo $HEADING['ADD_CHILD_PAGE']; ?>">
|
280
|
<img src="<?php echo THEME_URL; ?>/images/siteadd.png" name="addpage_<?php echo $page['page_id']; ?>" alt="Add Child Page" />
|
281
|
</a>
|
282
|
<?php } ?>
|
283
|
</td>
|
284
|
<?php
|
285
|
// end [IC] jeggers 2009/10/14: Add action to add a page as a child
|
286
|
?>
|
287
|
|
288
|
</tr>
|
289
|
</table>
|
290
|
<?php
|
291
|
if ( $page['parent'] == 0)
|
292
|
{
|
293
|
$page_tmp_id = $page['page_id'];
|
294
|
}
|
295
|
// Get subs
|
296
|
$editable_pages=make_list($page['page_id'], $editable_pages);
|
297
|
print '</li>'."\n";
|
298
|
}
|
299
|
}
|
300
|
$output = ($par['num_subs'] )? '</ul>'."\n" : '';
|
301
|
$par['num_subs'] = (empty($output) ) ? 1 : $par['num_subs'];
|
302
|
print $output;
|
303
|
return $editable_pages;
|
304
|
}
|
305
|
|
306
|
// Generate pages list
|
307
|
if($admin->get_permission('pages_view') == true) {
|
308
|
?>
|
309
|
<div class="jsadmin hide"></div>
|
310
|
<table summary="<?php echo $HEADING['MODIFY_DELETE_PAGE']; ?>" cellpadding="0" cellspacing="0" width="100%">
|
311
|
<tr>
|
312
|
<td>
|
313
|
<h2><?php echo $HEADING['MODIFY_DELETE_PAGE']; ?></h2>
|
314
|
</td>
|
315
|
<td align="right"></td>
|
316
|
</tr>
|
317
|
</table>
|
318
|
<div class="pages_list">
|
319
|
<table summary="<?php echo $HEADING['MODIFY_DELETE_PAGE']; ?>" cellpadding="0" cellspacing="0">
|
320
|
<tr class="pages_list_header">
|
321
|
<td class="header_list_menu_title">
|
322
|
<?php echo $TEXT['VISIBILITY'] .' / ' .$TEXT['MENU_TITLE']; ?>:
|
323
|
</td>
|
324
|
<td class="header_list_page_title">
|
325
|
<?php echo $TEXT['PAGE_TITLE']; ?>:
|
326
|
</td>
|
327
|
<td class="header_list_page_id">
|
328
|
ID:
|
329
|
</td>
|
330
|
<td class="header_list_actions">
|
331
|
<?php echo $TEXT['ACTIONS']; ?>:
|
332
|
</td>
|
333
|
</tr>
|
334
|
</table>
|
335
|
<?php
|
336
|
// Work-out if we should check for existing page_code
|
337
|
$field_set = $database->field_exists(TABLE_PREFIX.'pages', 'page_code');
|
338
|
|
339
|
$par = array();
|
340
|
$par['num_subs'] = 1;
|
341
|
$editable_pages = make_list(0, 0);
|
342
|
} else {
|
343
|
$editable_pages = 0;
|
344
|
}
|
345
|
?></div><?php
|
346
|
|
347
|
if(intval($editable_pages) == 0 ) {
|
348
|
?>
|
349
|
<div class="empty_list">
|
350
|
<?php echo $TEXT['NONE_FOUND']; ?>
|
351
|
</div>
|
352
|
<?php
|
353
|
}
|
354
|
// Setup template object, parse vars to it, then parse it
|
355
|
// Create new template object
|
356
|
$template = new Template(dirname($admin->correct_theme_source('pages.htt')));
|
357
|
// $template->debug = true;
|
358
|
$template->set_file('page', 'pages.htt');
|
359
|
$template->set_block('page', 'main_block', 'main');
|
360
|
// Insert values into the add page form
|
361
|
$template->set_var('FTAN', $admin->getFTAN());
|
362
|
|
363
|
// Group list 1
|
364
|
|
365
|
$query = "SELECT * FROM ".TABLE_PREFIX."groups";
|
366
|
$get_groups = $database->query($query);
|
367
|
$template->set_block('main_block', 'group_list_block', 'group_list');
|
368
|
// Insert admin group and current group first
|
369
|
$admin_group_name = $get_groups->fetchRow();
|
370
|
$template->set_var(array(
|
371
|
'ID' => 1,
|
372
|
'TOGGLE' => '1',
|
373
|
'DISABLED' => ' disabled="disabled"',
|
374
|
'LINK_COLOR' => '000000',
|
375
|
'CURSOR' => 'default',
|
376
|
'NAME' => $admin_group_name['name'],
|
377
|
'CHECKED' => ' checked="checked"'
|
378
|
)
|
379
|
);
|
380
|
$template->parse('group_list', 'group_list_block', true);
|
381
|
|
382
|
while($group = $get_groups->fetchRow()) {
|
383
|
// check if the user is a member of this group
|
384
|
$flag_disabled = '';
|
385
|
$flag_checked = '';
|
386
|
$flag_cursor = 'pointer';
|
387
|
$flag_color = '';
|
388
|
if (in_array($group["group_id"], $admin->get_groups_id())) {
|
389
|
$flag_disabled = ''; //' disabled';
|
390
|
$flag_checked = ' checked="checked"';
|
391
|
$flag_cursor = 'default';
|
392
|
$flag_color = '000000';
|
393
|
}
|
394
|
|
395
|
// Check if the group is allowed to edit pages
|
396
|
$system_permissions = explode(',', $group['system_permissions']);
|
397
|
if(is_numeric(array_search('pages_modify', $system_permissions))) {
|
398
|
$template->set_var(array(
|
399
|
'ID' => $group['group_id'],
|
400
|
'TOGGLE' => $group['group_id'],
|
401
|
'CHECKED' => $flag_checked,
|
402
|
'DISABLED' => $flag_disabled,
|
403
|
'LINK_COLOR' => $flag_color,
|
404
|
'CURSOR' => $flag_checked,
|
405
|
'NAME' => $group['name'],
|
406
|
)
|
407
|
);
|
408
|
$template->parse('group_list', 'group_list_block', true);
|
409
|
}
|
410
|
}
|
411
|
// Group list 2
|
412
|
|
413
|
$query = "SELECT * FROM ".TABLE_PREFIX."groups";
|
414
|
|
415
|
$get_groups = $database->query($query);
|
416
|
$template->set_block('main_block', 'group_list_block2', 'group_list2');
|
417
|
// Insert admin group and current group first
|
418
|
$admin_group_name = $get_groups->fetchRow();
|
419
|
$template->set_var(array(
|
420
|
'ID' => 1,
|
421
|
'TOGGLE' => '1',
|
422
|
'DISABLED' => ' disabled="disabled"',
|
423
|
'LINK_COLOR' => '000000',
|
424
|
'CURSOR' => 'default',
|
425
|
'NAME' => $admin_group_name['name'],
|
426
|
'CHECKED' => ' checked="checked"'
|
427
|
)
|
428
|
);
|
429
|
$template->parse('group_list2', 'group_list_block2', true);
|
430
|
|
431
|
while($group = $get_groups->fetchRow()) {
|
432
|
// check if the user is a member of this group
|
433
|
$flag_disabled = '';
|
434
|
$flag_checked = '';
|
435
|
$flag_cursor = 'pointer';
|
436
|
$flag_color = '';
|
437
|
if (in_array($group["group_id"], $admin->get_groups_id())) {
|
438
|
$flag_disabled = ''; //' disabled';
|
439
|
$flag_checked = ' checked="checked"';
|
440
|
$flag_cursor = 'default';
|
441
|
$flag_color = '000000';
|
442
|
}
|
443
|
|
444
|
$template->set_var(array(
|
445
|
'ID' => $group['group_id'],
|
446
|
'TOGGLE' => $group['group_id'],
|
447
|
'CHECKED' => $flag_checked,
|
448
|
'DISABLED' => $flag_disabled,
|
449
|
'LINK_COLOR' => $flag_color,
|
450
|
'CURSOR' => $flag_cursor,
|
451
|
'NAME' => $group['name'],
|
452
|
)
|
453
|
);
|
454
|
$template->parse('group_list2', 'group_list_block2', true);
|
455
|
}
|
456
|
|
457
|
|
458
|
// Parent page list
|
459
|
// $database = new database();
|
460
|
function parent_list($parent)
|
461
|
{
|
462
|
global $admin, $database, $template, $field_set;
|
463
|
$query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE parent = '$parent' AND visibility!='deleted' ORDER BY position ASC";
|
464
|
$get_pages = $database->query($query);
|
465
|
while($page = $get_pages->fetchRow()) {
|
466
|
if($admin->page_is_visible($page)==false)
|
467
|
continue;
|
468
|
// if parent = 0 set flag_icon
|
469
|
$template->set_var('FLAG_ROOT_ICON',' none ');
|
470
|
if( $page['parent'] == 0 && $field_set) {
|
471
|
$template->set_var('FLAG_ROOT_ICON','url('.THEME_URL.'/images/flags/'.strtolower($page['language']).'.png)');
|
472
|
}
|
473
|
// Stop users from adding pages with a level of more than the set page level limit
|
474
|
if($page['level']+1 < PAGE_LEVEL_LIMIT) {
|
475
|
// Get user perms
|
476
|
$admin_groups = explode(',', str_replace('_', '', $page['admin_groups']));
|
477
|
$admin_users = explode(',', str_replace('_', '', $page['admin_users']));
|
478
|
|
479
|
$in_group = FALSE;
|
480
|
foreach($admin->get_groups_id() as $cur_gid) {
|
481
|
if (in_array($cur_gid, $admin_groups)) {
|
482
|
$in_group = TRUE;
|
483
|
}
|
484
|
}
|
485
|
if(($in_group) || is_numeric(array_search($admin->get_user_id(), $admin_users))) {
|
486
|
$can_modify = true;
|
487
|
} else {
|
488
|
$can_modify = false;
|
489
|
}
|
490
|
// Title -'s prefix
|
491
|
$title_prefix = '';
|
492
|
for($i = 1; $i <= $page['level']; $i++) { $title_prefix .= ' - - '; }
|
493
|
$template->set_var(array(
|
494
|
'ID' => $page['page_id'],
|
495
|
'TITLE' => ($title_prefix.$page['menu_title']),
|
496
|
'MENU-TITLE' => ($title_prefix.$page['menu_title']),
|
497
|
'PAGE-TITLE' => ($title_prefix.$page['page_title'])
|
498
|
));
|
499
|
if($can_modify == true) {
|
500
|
$template->set_var('DISABLED', '');
|
501
|
} else {
|
502
|
$template->set_var('DISABLED', ' disabled="disabled" class="disabled"');
|
503
|
}
|
504
|
$template->parse('page_list2', 'page_list_block2', true);
|
505
|
}
|
506
|
parent_list($page['page_id']);
|
507
|
}
|
508
|
}
|
509
|
$template->set_block('main_block', 'page_list_block2', 'page_list2');
|
510
|
if($admin->get_permission('pages_add_l0') == true) {
|
511
|
$template->set_var(array(
|
512
|
'ID' => '0',
|
513
|
'TITLE' => $TEXT['NONE'],
|
514
|
'SELECTED' => ' selected="selected"',
|
515
|
'DISABLED' => ''
|
516
|
)
|
517
|
);
|
518
|
$template->parse('page_list2', 'page_list_block2', true);
|
519
|
}
|
520
|
parent_list(0);
|
521
|
|
522
|
// Explode module permissions
|
523
|
$module_permissions = $_SESSION['MODULE_PERMISSIONS'];
|
524
|
// Modules list
|
525
|
$template->set_block('main_block', 'module_list_block', 'module_list');
|
526
|
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'page' order by name");
|
527
|
if($result->numRows() > 0) {
|
528
|
while ($module = $result->fetchRow()) {
|
529
|
// Check if user is allowed to use this module
|
530
|
if(!is_numeric(array_search($module['directory'], $module_permissions))) {
|
531
|
$template->set_var('VALUE', $module['directory']);
|
532
|
$template->set_var('NAME', $module['name']);
|
533
|
if($module['directory'] == 'wysiwyg') {
|
534
|
$template->set_var('SELECTED', ' selected="selected"');
|
535
|
} else {
|
536
|
$template->set_var('SELECTED', '');
|
537
|
}
|
538
|
$template->parse('module_list', 'module_list_block', true);
|
539
|
}
|
540
|
}
|
541
|
}
|
542
|
|
543
|
// Insert urls
|
544
|
$template->set_var(array(
|
545
|
'THEME_URL' => THEME_URL,
|
546
|
'WB_URL' => WB_URL,
|
547
|
'ADMIN_URL' => ADMIN_URL,
|
548
|
)
|
549
|
);
|
550
|
|
551
|
// Insert language headings
|
552
|
$template->set_var(array(
|
553
|
'HEADING_ADD_PAGE' => $HEADING['ADD_PAGE'],
|
554
|
'HEADING_MODIFY_INTRO_PAGE' => $HEADING['MODIFY_INTRO_PAGE']
|
555
|
)
|
556
|
);
|
557
|
// Insert language text and messages
|
558
|
$template->set_var(array(
|
559
|
'TEXT_TITLE' => $TEXT['TITLE'],
|
560
|
'TEXT_TYPE' => $TEXT['TYPE'],
|
561
|
'TEXT_PARENT' => $TEXT['PARENT'],
|
562
|
'TEXT_VISIBILITY' => $TEXT['VISIBILITY'],
|
563
|
'TEXT_PUBLIC' => $TEXT['PUBLIC'],
|
564
|
'TEXT_PRIVATE' => $TEXT['PRIVATE'],
|
565
|
'TEXT_REGISTERED' => $TEXT['REGISTERED'],
|
566
|
'TEXT_HIDDEN' => $TEXT['HIDDEN'],
|
567
|
'TEXT_NONE' => $TEXT['NONE'],
|
568
|
'TEXT_NONE_FOUND' => $TEXT['NONE_FOUND'],
|
569
|
'TEXT_ADD' => $TEXT['ADD'],
|
570
|
'TEXT_RESET' => $TEXT['RESET'],
|
571
|
'TEXT_ADMINISTRATORS' => $TEXT['ADMINISTRATORS'],
|
572
|
'TEXT_PRIVATE_VIEWERS' => $TEXT['PRIVATE_VIEWERS'],
|
573
|
'TEXT_REGISTERED_VIEWERS' => $TEXT['REGISTERED_VIEWERS'],
|
574
|
'INTRO_LINK' => $MESSAGE['PAGES']['INTRO_LINK'],
|
575
|
)
|
576
|
);
|
577
|
|
578
|
// Insert permissions values
|
579
|
if($admin->get_permission('pages_add') != true) {
|
580
|
$template->set_var('DISPLAY_ADD', 'hide');
|
581
|
} elseif($admin->get_permission('pages_add_l0') != true && $editable_pages == 0) {
|
582
|
$template->set_var('DISPLAY_ADD', 'hide');
|
583
|
}
|
584
|
if($admin->get_permission('pages_intro') != true || INTRO_PAGE != 'enabled') {
|
585
|
$template->set_var('DISPLAY_INTRO', 'hide');
|
586
|
}
|
587
|
|
588
|
|
589
|
// Parse template object
|
590
|
$template->parse('main', 'main_block', false);
|
591
|
$template->pparse('output', 'page');
|
592
|
|
593
|
// include the required file for Javascript admin
|
594
|
if(file_exists(WB_PATH.'/modules/jsadmin/jsadmin_backend_include.php'))
|
595
|
{
|
596
|
include(WB_PATH.'/modules/jsadmin/jsadmin_backend_include.php');
|
597
|
}
|
598
|
|
599
|
// Print admin
|
600
|
$admin->print_footer();
|