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