1 |
238
|
stefan
|
<?php
|
2 |
|
|
|
3 |
398
|
Ruebenwurz
|
// $Id$
|
4 |
|
|
|
5 |
238
|
stefan
|
/*
|
6 |
|
|
|
7 |
|
|
Website Baker Project <http://www.websitebaker.org/>
|
8 |
519
|
Ruebenwurz
|
Copyright (C) 2004-2008, Ryan Djurovich
|
9 |
238
|
stefan
|
|
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 |
|
|
require('../../config.php');
|
27 |
|
|
require_once(WB_PATH.'/framework/class.admin.php');
|
28 |
|
|
$admin = new admin('Pages', 'pages');
|
29 |
|
|
// Include the WB functions file
|
30 |
|
|
require_once(WB_PATH.'/framework/functions.php');
|
31 |
|
|
|
32 |
|
|
?>
|
33 |
385
|
Ruebenwurz
|
<!-- Addition for remembering expanded state of pages -->
|
34 |
|
|
<script language="JavaScript">
|
35 |
|
|
function writeSessionCookie (cookieName, cookieValue) {
|
36 |
|
|
document.cookie = escape(cookieName) + "=" + escape(cookieValue) + ";";
|
37 |
|
|
}
|
38 |
|
|
</script>
|
39 |
|
|
<!-- End addition -->
|
40 |
|
|
|
41 |
238
|
stefan
|
<script type="text/javascript" language="javascript">
|
42 |
|
|
function toggle_viewers() {
|
43 |
|
|
if(document.add.visibility.value == 'private') {
|
44 |
|
|
document.getElementById('private_viewers').style.display = 'block';
|
45 |
|
|
document.getElementById('registered_viewers').style.display = 'none';
|
46 |
|
|
} else if(document.add.visibility.value == 'registered') {
|
47 |
|
|
document.getElementById('private_viewers').style.display = 'none';
|
48 |
|
|
document.getElementById('registered_viewers').style.display = 'block';
|
49 |
|
|
} else {
|
50 |
|
|
document.getElementById('private_viewers').style.display = 'none';
|
51 |
|
|
document.getElementById('registered_viewers').style.display = 'none';
|
52 |
|
|
}
|
53 |
|
|
}
|
54 |
|
|
function toggle_visibility(id){
|
55 |
|
|
if(document.getElementById(id).style.display == "block") {
|
56 |
|
|
document.getElementById(id).style.display = "none";
|
57 |
385
|
Ruebenwurz
|
writeSessionCookie (id, "0");//Addition for remembering expanded state of pages
|
58 |
238
|
stefan
|
} else {
|
59 |
|
|
document.getElementById(id).style.display = "block";
|
60 |
385
|
Ruebenwurz
|
writeSessionCookie (id, "1");//Addition for remembering expanded state of pages
|
61 |
238
|
stefan
|
}
|
62 |
|
|
}
|
63 |
|
|
var plus = new Image;
|
64 |
|
|
plus.src = "<?php echo ADMIN_URL; ?>/images/plus_16.png";
|
65 |
|
|
var minus = new Image;
|
66 |
|
|
minus.src = "<?php echo ADMIN_URL; ?>/images/minus_16.png";
|
67 |
|
|
function toggle_plus_minus(id) {
|
68 |
|
|
var img_src = document.images['plus_minus_' + id].src;
|
69 |
|
|
if(img_src == plus.src) {
|
70 |
|
|
document.images['plus_minus_' + id].src = minus.src;
|
71 |
|
|
} else {
|
72 |
|
|
document.images['plus_minus_' + id].src = plus.src;
|
73 |
|
|
}
|
74 |
|
|
}
|
75 |
|
|
</script>
|
76 |
|
|
|
77 |
|
|
<style type="text/css">
|
78 |
|
|
.pages_list img {
|
79 |
|
|
display: block;
|
80 |
|
|
}
|
81 |
|
|
ul, li {
|
82 |
|
|
list-style: none;
|
83 |
|
|
margin: 0;
|
84 |
|
|
padding: 0;
|
85 |
|
|
}
|
86 |
|
|
.page_list {
|
87 |
|
|
display: none;
|
88 |
|
|
}
|
89 |
|
|
</style>
|
90 |
|
|
|
91 |
|
|
<noscript>
|
92 |
|
|
<style type="text/css">
|
93 |
|
|
.page_list {
|
94 |
|
|
display: block;
|
95 |
|
|
}
|
96 |
|
|
</style>
|
97 |
|
|
</noscript>
|
98 |
|
|
<?php
|
99 |
|
|
|
100 |
|
|
function make_list($parent, $editable_pages) {
|
101 |
|
|
// Get objects and vars from outside this function
|
102 |
529
|
doc
|
global $admin, $template, $database, $TEXT, $MESSAGE, $HEADING;
|
103 |
238
|
stefan
|
?>
|
104 |
385
|
Ruebenwurz
|
<ul id="p<?php echo $parent; ?>" <?php if($parent != 0) { echo 'class="page_list" '; if($_COOKIE["p".$parent] =="1"){echo'style="display:block;"'; }} ?>>
|
105 |
238
|
stefan
|
<?php
|
106 |
|
|
// Get page list from database
|
107 |
|
|
$database = new database();
|
108 |
|
|
if(PAGE_TRASH != 'inline') {
|
109 |
|
|
$query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE parent = '$parent' AND visibility != 'deleted' ORDER BY position ASC";
|
110 |
|
|
} else {
|
111 |
|
|
$query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE parent = '$parent' ORDER BY position ASC";
|
112 |
|
|
}
|
113 |
|
|
$get_pages = $database->query($query);
|
114 |
|
|
|
115 |
|
|
// Insert values into main page list
|
116 |
|
|
if($get_pages->numRows() > 0) {
|
117 |
|
|
while($page = $get_pages->fetchRow()) {
|
118 |
|
|
// Get user perms
|
119 |
|
|
$admin_groups = explode(',', str_replace('_', '', $page['admin_groups']));
|
120 |
|
|
$admin_users = explode(',', str_replace('_', '', $page['admin_users']));
|
121 |
546
|
doc
|
|
122 |
|
|
$in_group = FALSE;
|
123 |
|
|
foreach($admin->get_groups_id() as $cur_gid){
|
124 |
|
|
if (in_array($cur_gid, $admin_groups)) {
|
125 |
|
|
$in_group = TRUE;
|
126 |
|
|
}
|
127 |
|
|
}
|
128 |
|
|
if(($in_group) OR is_numeric(array_search($admin->get_user_id(), $admin_users))) {
|
129 |
238
|
stefan
|
if($page['visibility'] == 'deleted') {
|
130 |
|
|
if(PAGE_TRASH == 'inline') {
|
131 |
|
|
$can_modify = true;
|
132 |
|
|
$editable_pages = $editable_pages+1;
|
133 |
|
|
} else {
|
134 |
|
|
$can_modify = false;
|
135 |
|
|
}
|
136 |
|
|
} elseif($page['visibility'] != 'deleted') {
|
137 |
|
|
$can_modify = true;
|
138 |
|
|
$editable_pages = $editable_pages+1;
|
139 |
|
|
}
|
140 |
|
|
} else {
|
141 |
537
|
doc
|
if($page['visibility'] == 'private') {
|
142 |
|
|
continue;
|
143 |
|
|
}
|
144 |
|
|
else {
|
145 |
|
|
$can_modify = false;
|
146 |
|
|
}
|
147 |
238
|
stefan
|
}
|
148 |
|
|
|
149 |
|
|
// Work out if we should show a plus or not
|
150 |
|
|
if(PAGE_TRASH != 'inline') {
|
151 |
|
|
$get_page_subs = $database->query("SELECT page_id,admin_groups,admin_users FROM ".TABLE_PREFIX."pages WHERE parent = '".$page['page_id']."' AND visibility!='deleted'");
|
152 |
|
|
} else {
|
153 |
|
|
$get_page_subs = $database->query("SELECT page_id,admin_groups,admin_users FROM ".TABLE_PREFIX."pages WHERE parent = '".$page['page_id']."'");
|
154 |
|
|
}
|
155 |
|
|
if($get_page_subs->numRows() > 0) {
|
156 |
|
|
$display_plus = true;
|
157 |
|
|
} else {
|
158 |
|
|
$display_plus = false;
|
159 |
|
|
}
|
160 |
|
|
|
161 |
|
|
// Work out how many pages there are for this parent
|
162 |
|
|
$num_pages = $get_pages->numRows();
|
163 |
|
|
?>
|
164 |
|
|
|
165 |
|
|
<li id="p<?php echo $page['parent']; ?>" style="padding: 2px 0px 2px 0px;">
|
166 |
|
|
<table width="720" cellpadding="1" cellspacing="0" border="0" style="background-color: #F0F0F0;">
|
167 |
|
|
<tr>
|
168 |
|
|
<td width="20" style="padding-left: <?php echo $page['level']*20; ?>px;">
|
169 |
|
|
<?php
|
170 |
|
|
if($display_plus == true) {
|
171 |
|
|
?>
|
172 |
|
|
<a href="javascript: toggle_visibility('p<?php echo $page['page_id']; ?>');" title="<?php echo $TEXT['EXPAND'].'/'.$TEXT['COLLAPSE']; ?>">
|
173 |
385
|
Ruebenwurz
|
<img src="<?php echo ADMIN_URL; ?>/images/<?php if($_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']; ?>" border="0" alt="+" />
|
174 |
238
|
stefan
|
</a>
|
175 |
|
|
<?php
|
176 |
|
|
}
|
177 |
|
|
?>
|
178 |
|
|
</td>
|
179 |
|
|
<?php if($admin->get_permission('pages_modify') == true AND $can_modify == true) { ?>
|
180 |
|
|
<td>
|
181 |
529
|
doc
|
<a href="<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MODIFY']; ?>">
|
182 |
|
|
<?php if($page['visibility'] == 'public') { ?>
|
183 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/visible_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['PUBLIC']; ?>" border="0" align="left" style="margin-right: 5px" />
|
184 |
|
|
<?php } elseif($page['visibility'] == 'private') { ?>
|
185 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/private_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['PRIVATE']; ?>" border="0" align="left" style="margin-right: 5px" />
|
186 |
|
|
<?php } elseif($page['visibility'] == 'registered') { ?>
|
187 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/keys_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['REGISTERED']; ?>" border="0" align="left" style="margin-right: 5px" />
|
188 |
|
|
<?php } elseif($page['visibility'] == 'hidden') { ?>
|
189 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/hidden_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['HIDDEN']; ?>" border="0" align="left" style="margin-right: 5px" />
|
190 |
|
|
<?php } elseif($page['visibility'] == 'none') { ?>
|
191 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/none_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['NONE']; ?>" border="0" align="left" style="margin-right: 5px" />
|
192 |
|
|
<?php } elseif($page['visibility'] == 'deleted') { ?>
|
193 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/deleted_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['DELETED']; ?>" border="0" align="left" style="margin-right: 5px" />
|
194 |
|
|
<?php }
|
195 |
|
|
echo ($page['page_title']); ?>
|
196 |
|
|
</a>
|
197 |
238
|
stefan
|
</td>
|
198 |
|
|
<?php } else { ?>
|
199 |
|
|
<td>
|
200 |
529
|
doc
|
<?php if($page['visibility'] == 'public') { ?>
|
201 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/visible_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['PUBLIC']; ?>" border="0" align="left" style="margin-right: 5px" />
|
202 |
|
|
<?php } elseif($page['visibility'] == 'private') { ?>
|
203 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/private_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['PRIVATE']; ?>" border="0" align="left" style="margin-right: 5px" />
|
204 |
|
|
<?php } elseif($page['visibility'] == 'registered') { ?>
|
205 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/keys_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['REGISTERED']; ?>" border="0" align="left" style="margin-right: 5px" />
|
206 |
|
|
<?php } elseif($page['visibility'] == 'hidden') { ?>
|
207 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/hidden_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['HIDDEN']; ?>" border="0" align="left" style="margin-right: 5px" />
|
208 |
|
|
<?php } elseif($page['visibility'] == 'none') { ?>
|
209 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/none_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['NONE']; ?>" border="0" align="left" style="margin-right: 5px" />
|
210 |
|
|
<?php } elseif($page['visibility'] == 'deleted') { ?>
|
211 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/deleted_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['DELETED']; ?>" border="0" align="left" style="margin-right: 5px" />
|
212 |
|
|
<?php }
|
213 |
|
|
echo ($page['page_title']); ?>
|
214 |
238
|
stefan
|
</td>
|
215 |
|
|
<?php } ?>
|
216 |
|
|
<td align="left" width="232">
|
217 |
442
|
Ruebenwurz
|
<font color="#999999"><?php echo ($page['menu_title']); ?></font>
|
218 |
238
|
stefan
|
</td>
|
219 |
529
|
doc
|
<td width="20">
|
220 |
|
|
<?php if($page['visibility'] != 'deleted' AND $page['visibility'] != 'none') { ?>
|
221 |
|
|
<a href="<?php echo $admin->page_link($page['link']); ?>" target="_blank" title="<?php echo $TEXT['VIEW']; ?>">
|
222 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/view_16.png" border="0" alt="<?php echo $TEXT['VIEW']; ?>" />
|
223 |
|
|
</a>
|
224 |
|
|
<?php } ?>
|
225 |
238
|
stefan
|
</td>
|
226 |
|
|
<td width="20">
|
227 |
|
|
<?php if($page['visibility'] != 'deleted') { ?>
|
228 |
|
|
<?php if($admin->get_permission('pages_settings') == true AND $can_modify == true) { ?>
|
229 |
|
|
<a href="<?php echo ADMIN_URL; ?>/pages/settings.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['SETTINGS']; ?>">
|
230 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/modify_16.png" border="0" alt="<?php echo $TEXT['SETTINGS']; ?>" />
|
231 |
|
|
</a>
|
232 |
|
|
<?php } ?>
|
233 |
|
|
<?php } else { ?>
|
234 |
|
|
<a href="<?php echo ADMIN_URL; ?>/pages/restore.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['RESTORE']; ?>">
|
235 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/restore_16.png" border="0" alt="<?php echo $TEXT['RESTORE']; ?>" />
|
236 |
|
|
</a>
|
237 |
|
|
<?php } ?>
|
238 |
|
|
</td>
|
239 |
529
|
doc
|
|
240 |
|
|
<!-- 'MANAGE SECTIONS' BUTTON -->
|
241 |
238
|
stefan
|
<td width="20">
|
242 |
529
|
doc
|
<?php
|
243 |
|
|
// Work-out if we should show the "manage sections" link
|
244 |
|
|
$query_sections = $database->query("SELECT section_id FROM ".TABLE_PREFIX."sections WHERE page_id = '" . $page['page_id'] . "' AND module = 'menu_link'");
|
245 |
|
|
if(($query_sections->numRows() == 0) && (MANAGE_SECTIONS == 'enabled')) {
|
246 |
|
|
?>
|
247 |
|
|
<a href="<?php echo ADMIN_URL; ?>/pages/sections.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $HEADING['MANAGE_SECTIONS']; ?>">
|
248 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/sections_16.png" border="0" alt="<?php echo $HEADING['MANAGE_SECTIONS']; ?>" />
|
249 |
|
|
</a>
|
250 |
|
|
<?php } ?>
|
251 |
|
|
</td>
|
252 |
|
|
|
253 |
|
|
|
254 |
|
|
<td width="20">
|
255 |
238
|
stefan
|
<?php if($page['position'] != 1) { ?>
|
256 |
|
|
<?php if($page['visibility'] != 'deleted') { ?>
|
257 |
|
|
<?php if($admin->get_permission('pages_settings') == true AND $can_modify == true) { ?>
|
258 |
|
|
<a href="<?php echo ADMIN_URL; ?>/pages/move_up.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MOVE_UP']; ?>">
|
259 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/up_16.png" border="0" alt="^" />
|
260 |
|
|
</a>
|
261 |
|
|
<?php } ?>
|
262 |
|
|
<?php } ?>
|
263 |
|
|
<?php } ?>
|
264 |
|
|
</td>
|
265 |
|
|
<td width="20">
|
266 |
|
|
<?php if($page['position'] != $num_pages) { ?>
|
267 |
|
|
<?php if($page['visibility'] != 'deleted') { ?>
|
268 |
|
|
<?php if($admin->get_permission('pages_settings') == true AND $can_modify == true) { ?>
|
269 |
|
|
<a href="<?php echo ADMIN_URL; ?>/pages/move_down.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MOVE_DOWN']; ?>">
|
270 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/down_16.png" border="0" alt="v" />
|
271 |
|
|
</a>
|
272 |
|
|
<?php } ?>
|
273 |
|
|
<?php } ?>
|
274 |
|
|
<?php } ?>
|
275 |
|
|
</td>
|
276 |
|
|
<td width="20">
|
277 |
|
|
<?php if($admin->get_permission('pages_delete') == true AND $can_modify == true) { ?>
|
278 |
|
|
<a href="javascript: confirm_link('<?php echo $MESSAGE['PAGES']['DELETE_CONFIRM']; ?>?', '<?php echo ADMIN_URL; ?>/pages/delete.php?page_id=<?php echo $page['page_id']; ?>');" title="<?php echo $TEXT['DELETE']; ?>">
|
279 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/delete_16.png" border="0" alt="X" />
|
280 |
|
|
</a>
|
281 |
|
|
<?php } ?>
|
282 |
|
|
</td>
|
283 |
|
|
</tr>
|
284 |
|
|
</table>
|
285 |
|
|
</li>
|
286 |
|
|
|
287 |
|
|
<?php
|
288 |
|
|
// Get subs
|
289 |
|
|
$editable_pages=make_list($page['page_id'], $editable_pages);
|
290 |
|
|
}
|
291 |
|
|
|
292 |
|
|
}
|
293 |
|
|
?>
|
294 |
|
|
</ul>
|
295 |
|
|
<?php
|
296 |
|
|
return $editable_pages;
|
297 |
|
|
}
|
298 |
|
|
|
299 |
|
|
// Generate pages list
|
300 |
|
|
if($admin->get_permission('pages_view') == true) {
|
301 |
|
|
?>
|
302 |
|
|
<table cellpadding="0" cellspacing="0" width="100%" border="0">
|
303 |
|
|
<tr>
|
304 |
|
|
<td>
|
305 |
|
|
<h2><?php echo $HEADING['MODIFY_DELETE_PAGE']; ?></h2>
|
306 |
|
|
</td>
|
307 |
|
|
<td align="right">
|
308 |
|
|
<?php
|
309 |
|
|
// Check if there are any pages that are in trash, and if we should show a link to the trash page
|
310 |
|
|
if(PAGE_TRASH == 'separate') {
|
311 |
|
|
$query_trash = $database->query("SELECT page_id FROM ".TABLE_PREFIX."pages WHERE visibility = 'deleted'");
|
312 |
|
|
if($query_trash->numRows() > 0) {
|
313 |
|
|
?>
|
314 |
|
|
<a href="<?php echo ADMIN_URL; ?>/pages/trash.php">
|
315 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/delete_16.png" alt="<?php echo $TEXT['PAGE_TRASH']; ?>" border="0" />
|
316 |
|
|
<?php echo $TEXT['VIEW_DELETED_PAGES']; ?></a>
|
317 |
|
|
<?php
|
318 |
|
|
}
|
319 |
|
|
}
|
320 |
|
|
?>
|
321 |
|
|
</td>
|
322 |
|
|
</tr>
|
323 |
|
|
</table>
|
324 |
|
|
<div class="pages_list">
|
325 |
|
|
<table cellpadding="1" cellspacing="0" width="720" border="0">
|
326 |
|
|
<tr>
|
327 |
|
|
<td width="20">
|
328 |
|
|
|
329 |
|
|
</td>
|
330 |
|
|
<td>
|
331 |
529
|
doc
|
<?php echo $TEXT['VISIBILITY'] .' / ' .$TEXT['PAGE_TITLE']; ?>:
|
332 |
238
|
stefan
|
</td>
|
333 |
529
|
doc
|
<td width="235" align="left">
|
334 |
238
|
stefan
|
<?php echo $TEXT['MENU_TITLE']; ?>:
|
335 |
|
|
</td>
|
336 |
|
|
<td width="125" align="center">
|
337 |
|
|
<?php echo $TEXT['ACTIONS']; ?>:
|
338 |
|
|
</td>
|
339 |
|
|
</tr>
|
340 |
|
|
</table>
|
341 |
|
|
<?php
|
342 |
|
|
$editable_pages = make_list(0, 0);
|
343 |
|
|
?>
|
344 |
|
|
</div>
|
345 |
|
|
<div class="empty_list">
|
346 |
|
|
<?php echo $TEXT['NONE_FOUND']; ?>
|
347 |
|
|
</div>
|
348 |
|
|
<?php
|
349 |
|
|
} else {
|
350 |
|
|
$editable_pages = 0;
|
351 |
|
|
}
|
352 |
|
|
|
353 |
|
|
// Setup template object
|
354 |
|
|
$template = new Template(ADMIN_PATH.'/pages');
|
355 |
|
|
$template->set_file('page', 'template.html');
|
356 |
|
|
$template->set_block('page', 'main_block', 'main');
|
357 |
|
|
|
358 |
|
|
// Figure out if the no pages found message should be shown or not
|
359 |
|
|
if($editable_pages == 0) {
|
360 |
|
|
?>
|
361 |
|
|
<style type="text/css">
|
362 |
|
|
.pages_list {
|
363 |
|
|
display: none;
|
364 |
|
|
}
|
365 |
|
|
</style>
|
366 |
|
|
<?php
|
367 |
|
|
} else {
|
368 |
|
|
?>
|
369 |
|
|
<style type="text/css">
|
370 |
|
|
.empty_list {
|
371 |
|
|
display: none;
|
372 |
|
|
}
|
373 |
|
|
</style>
|
374 |
|
|
<?php
|
375 |
|
|
}
|
376 |
|
|
|
377 |
|
|
// Insert values into the add page form
|
378 |
|
|
|
379 |
|
|
// Group list 1
|
380 |
546
|
doc
|
|
381 |
|
|
$query = "SELECT * FROM ".TABLE_PREFIX."groups";
|
382 |
|
|
|
383 |
238
|
stefan
|
$get_groups = $database->query($query);
|
384 |
|
|
$template->set_block('main_block', 'group_list_block', 'group_list');
|
385 |
|
|
// Insert admin group and current group first
|
386 |
|
|
$admin_group_name = $get_groups->fetchRow();
|
387 |
|
|
$template->set_var(array(
|
388 |
|
|
'ID' => 1,
|
389 |
|
|
'TOGGLE' => '',
|
390 |
|
|
'DISABLED' => ' disabled',
|
391 |
|
|
'LINK_COLOR' => '000000',
|
392 |
|
|
'CURSOR' => 'default',
|
393 |
|
|
'NAME' => $admin_group_name['name'],
|
394 |
|
|
'CHECKED' => ' checked'
|
395 |
|
|
)
|
396 |
|
|
);
|
397 |
|
|
$template->parse('group_list', 'group_list_block', true);
|
398 |
546
|
doc
|
|
399 |
238
|
stefan
|
while($group = $get_groups->fetchRow()) {
|
400 |
546
|
doc
|
// check if the user is a member of this group
|
401 |
|
|
$flag_disabled = '';
|
402 |
|
|
$flag_checked = '';
|
403 |
|
|
$flag_cursor = 'pointer';
|
404 |
|
|
$flag_color = '';
|
405 |
|
|
if (in_array($group["group_id"], $admin->get_groups_id())) {
|
406 |
|
|
$flag_disabled = ' disabled';
|
407 |
|
|
$flag_checked = ' checked';
|
408 |
|
|
$flag_cursor = 'default';
|
409 |
|
|
$flag_color = '000000';
|
410 |
|
|
}
|
411 |
|
|
|
412 |
238
|
stefan
|
// Check if the group is allowed to edit pages
|
413 |
|
|
$system_permissions = explode(',', $group['system_permissions']);
|
414 |
|
|
if(is_numeric(array_search('pages_modify', $system_permissions))) {
|
415 |
|
|
$template->set_var(array(
|
416 |
|
|
'ID' => $group['group_id'],
|
417 |
|
|
'TOGGLE' => $group['group_id'],
|
418 |
546
|
doc
|
'CHECKED' => $flag_checked,
|
419 |
|
|
'DISABLED' => $flag_disabled,
|
420 |
|
|
'LINK_COLOR' => $flag_color,
|
421 |
|
|
'CURSOR' => $flag_checked,
|
422 |
238
|
stefan
|
'NAME' => $group['name'],
|
423 |
|
|
)
|
424 |
|
|
);
|
425 |
|
|
$template->parse('group_list', 'group_list_block', true);
|
426 |
|
|
}
|
427 |
|
|
}
|
428 |
|
|
// Group list 2
|
429 |
546
|
doc
|
|
430 |
|
|
$query = "SELECT * FROM ".TABLE_PREFIX."groups";
|
431 |
|
|
|
432 |
238
|
stefan
|
$get_groups = $database->query($query);
|
433 |
|
|
$template->set_block('main_block', 'group_list_block2', 'group_list2');
|
434 |
|
|
// Insert admin group and current group first
|
435 |
|
|
$admin_group_name = $get_groups->fetchRow();
|
436 |
|
|
$template->set_var(array(
|
437 |
|
|
'ID' => 1,
|
438 |
|
|
'TOGGLE' => '',
|
439 |
|
|
'DISABLED' => ' disabled',
|
440 |
|
|
'LINK_COLOR' => '000000',
|
441 |
|
|
'CURSOR' => 'default',
|
442 |
|
|
'NAME' => $admin_group_name['name'],
|
443 |
|
|
'CHECKED' => ' checked'
|
444 |
|
|
)
|
445 |
|
|
);
|
446 |
|
|
$template->parse('group_list2', 'group_list_block2', true);
|
447 |
546
|
doc
|
|
448 |
238
|
stefan
|
while($group = $get_groups->fetchRow()) {
|
449 |
546
|
doc
|
// check if the user is a member of this group
|
450 |
|
|
$flag_disabled = '';
|
451 |
|
|
$flag_checked = '';
|
452 |
|
|
$flag_cursor = 'pointer';
|
453 |
|
|
$flag_color = '';
|
454 |
|
|
if (in_array($group["group_id"], $admin->get_groups_id())) {
|
455 |
|
|
$flag_disabled = ' disabled';
|
456 |
|
|
$flag_checked = ' checked';
|
457 |
|
|
$flag_cursor = 'default';
|
458 |
|
|
$flag_color = '000000';
|
459 |
|
|
}
|
460 |
|
|
|
461 |
238
|
stefan
|
$template->set_var(array(
|
462 |
|
|
'ID' => $group['group_id'],
|
463 |
|
|
'TOGGLE' => $group['group_id'],
|
464 |
546
|
doc
|
'CHECKED' => $flag_checked,
|
465 |
|
|
'DISABLED' => $flag_disabled,
|
466 |
|
|
'LINK_COLOR' => $flag_color,
|
467 |
|
|
'CURSOR' => $flag_cursor,
|
468 |
238
|
stefan
|
'NAME' => $group['name'],
|
469 |
|
|
)
|
470 |
|
|
);
|
471 |
|
|
$template->parse('group_list2', 'group_list_block2', true);
|
472 |
|
|
}
|
473 |
|
|
|
474 |
|
|
// Parent page list
|
475 |
|
|
$database = new database();
|
476 |
|
|
function parent_list($parent) {
|
477 |
|
|
global $admin, $database, $template;
|
478 |
|
|
$query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE parent = '$parent' AND visibility!='deleted' ORDER BY position ASC";
|
479 |
|
|
$get_pages = $database->query($query);
|
480 |
|
|
while($page = $get_pages->fetchRow()) {
|
481 |
|
|
// Stop users from adding pages with a level of more than the set page level limit
|
482 |
|
|
if($page['level']+1 < PAGE_LEVEL_LIMIT) {
|
483 |
|
|
// Get user perms
|
484 |
|
|
$admin_groups = explode(',', str_replace('_', '', $page['admin_groups']));
|
485 |
|
|
$admin_users = explode(',', str_replace('_', '', $page['admin_users']));
|
486 |
546
|
doc
|
|
487 |
|
|
$in_group = FALSE;
|
488 |
|
|
foreach($admin->get_groups_id() as $cur_gid){
|
489 |
|
|
if (in_array($cur_gid, $admin_groups)) {
|
490 |
|
|
$in_group = TRUE;
|
491 |
|
|
}
|
492 |
|
|
}
|
493 |
|
|
if(($in_group) OR is_numeric(array_search($admin->get_user_id(), $admin_users))) {
|
494 |
238
|
stefan
|
$can_modify = true;
|
495 |
|
|
} else {
|
496 |
|
|
$can_modify = false;
|
497 |
|
|
}
|
498 |
|
|
// Title -'s prefix
|
499 |
|
|
$title_prefix = '';
|
500 |
|
|
for($i = 1; $i <= $page['level']; $i++) { $title_prefix .= ' - '; }
|
501 |
|
|
$template->set_var(array(
|
502 |
|
|
'ID' => $page['page_id'],
|
503 |
442
|
Ruebenwurz
|
'TITLE' => ($title_prefix.$page['page_title'])
|
504 |
238
|
stefan
|
)
|
505 |
|
|
);
|
506 |
|
|
if($can_modify == true) {
|
507 |
|
|
$template->set_var('DISABLED', '');
|
508 |
|
|
} else {
|
509 |
398
|
Ruebenwurz
|
$template->set_var('DISABLED', ' disabled="disabled" style="color: #aaa;"');
|
510 |
238
|
stefan
|
}
|
511 |
|
|
$template->parse('page_list2', 'page_list_block2', true);
|
512 |
|
|
}
|
513 |
|
|
parent_list($page['page_id']);
|
514 |
|
|
}
|
515 |
|
|
}
|
516 |
|
|
$template->set_block('main_block', 'page_list_block2', 'page_list2');
|
517 |
|
|
if($admin->get_permission('pages_add_l0') == true) {
|
518 |
|
|
$template->set_var(array(
|
519 |
|
|
'ID' => '0',
|
520 |
|
|
'TITLE' => $TEXT['NONE'],
|
521 |
|
|
'SELECTED' => ' selected',
|
522 |
|
|
'DISABLED' => ''
|
523 |
|
|
)
|
524 |
|
|
);
|
525 |
|
|
$template->parse('page_list2', 'page_list_block2', true);
|
526 |
|
|
}
|
527 |
|
|
parent_list(0);
|
528 |
|
|
|
529 |
|
|
// Explode module permissions
|
530 |
|
|
$module_permissions = $_SESSION['MODULE_PERMISSIONS'];
|
531 |
|
|
// Modules list
|
532 |
|
|
$template->set_block('main_block', 'module_list_block', 'module_list');
|
533 |
384
|
Ruebenwurz
|
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'page' order by name");
|
534 |
238
|
stefan
|
if($result->numRows() > 0) {
|
535 |
|
|
while ($module = $result->fetchRow()) {
|
536 |
|
|
// Check if user is allowed to use this module
|
537 |
|
|
if(!is_numeric(array_search($module['directory'], $module_permissions))) {
|
538 |
|
|
$template->set_var('VALUE', $module['directory']);
|
539 |
|
|
$template->set_var('NAME', $module['name']);
|
540 |
|
|
if($module['directory'] == 'wysiwyg') {
|
541 |
|
|
$template->set_var('SELECTED', ' selected');
|
542 |
|
|
} else {
|
543 |
|
|
$template->set_var('SELECTED', '');
|
544 |
|
|
}
|
545 |
|
|
$template->parse('module_list', 'module_list_block', true);
|
546 |
|
|
}
|
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 AND $editable_pages == 0) {
|
581 |
|
|
$template->set_var('DISPLAY_ADD', 'hide');
|
582 |
|
|
}
|
583 |
|
|
if($admin->get_permission('pages_intro') != true OR 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 |
|
|
// Print admin
|
593 |
|
|
$admin->print_footer();
|
594 |
|
|
|
595 |
399
|
Ruebenwurz
|
?>
|