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 |
557
|
thorn
|
<ul id="p<?php echo $parent; ?>" <?php if($parent != 0) { echo 'class="page_list" '; if(isset($_COOKIE["p".$parent]) && $_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 |
686
|
doc
|
<table width="720" cellpadding="1" cellspacing="0" border="0" style="background-color: #ECF3F7;">
|
167 |
693
|
doc
|
<tr onmouseover="this.style.backgroundColor = '#F1F8DD'" onmouseout="this.style.backgroundColor = '#ECF3F7'">
|
168 |
238
|
stefan
|
<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 |
557
|
thorn
|
<img src="<?php echo ADMIN_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']; ?>" 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 |
584
|
doc
|
<td align="left" width="252">
|
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 |
584
|
doc
|
<!-- MANAGE SECTIONS AND DATES BUTTONS -->
|
240 |
238
|
stefan
|
<td width="20">
|
241 |
552
|
thorn
|
<?php
|
242 |
|
|
// Work-out if we should show the "manage dates" link
|
243 |
|
|
if(MANAGE_SECTIONS == 'enabled' && $admin->get_permission('pages_modify')==true && $can_modify==true) {
|
244 |
|
|
$query_sections = $database->query("SELECT publ_start, publ_end FROM ".TABLE_PREFIX."sections WHERE page_id = '{$page['page_id']}' AND module != 'menu_link'");
|
245 |
|
|
if($query_sections->numRows() > 0) {
|
246 |
|
|
$mdate_display=false;
|
247 |
|
|
while($mdate_res = $query_sections->fetchRow()) {
|
248 |
|
|
if($mdate_res['publ_start']!='0' || $mdate_res['publ_end']!='0') {
|
249 |
|
|
$mdate_display=true;
|
250 |
|
|
break;
|
251 |
|
|
}
|
252 |
|
|
}
|
253 |
|
|
if($mdate_display==1) {
|
254 |
|
|
$file=$admin->page_is_active($page)?"clock_16.png":"clock_red_16.png";
|
255 |
|
|
?>
|
256 |
|
|
<a href="<?php echo ADMIN_URL; ?>/pages/sections.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $HEADING['MANAGE_SECTIONS']; ?>">
|
257 |
|
|
<img src="<?php echo ADMIN_URL."/images/$file"; ?>" border="0" alt="<?php echo $HEADING['MANAGE_SECTIONS']; ?>" />
|
258 |
|
|
</a>
|
259 |
|
|
<?php } else { ?>
|
260 |
584
|
doc
|
<a href="<?php echo ADMIN_URL; ?>/pages/sections.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $HEADING['MANAGE_SECTIONS']; ?>">
|
261 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/noclock_16.png" border="0" alt="<?php echo $HEADING['MANAGE_SECTIONS']; ?>" /></a>
|
262 |
552
|
thorn
|
<?php } ?>
|
263 |
|
|
<?php } ?>
|
264 |
|
|
<?php } ?>
|
265 |
|
|
</td>
|
266 |
|
|
<td width="20">
|
267 |
238
|
stefan
|
<?php if($page['position'] != 1) { ?>
|
268 |
|
|
<?php if($page['visibility'] != 'deleted') { ?>
|
269 |
|
|
<?php if($admin->get_permission('pages_settings') == true AND $can_modify == true) { ?>
|
270 |
|
|
<a href="<?php echo ADMIN_URL; ?>/pages/move_up.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MOVE_UP']; ?>">
|
271 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/up_16.png" border="0" alt="^" />
|
272 |
|
|
</a>
|
273 |
|
|
<?php } ?>
|
274 |
|
|
<?php } ?>
|
275 |
|
|
<?php } ?>
|
276 |
|
|
</td>
|
277 |
|
|
<td width="20">
|
278 |
|
|
<?php if($page['position'] != $num_pages) { ?>
|
279 |
|
|
<?php if($page['visibility'] != 'deleted') { ?>
|
280 |
|
|
<?php if($admin->get_permission('pages_settings') == true AND $can_modify == true) { ?>
|
281 |
|
|
<a href="<?php echo ADMIN_URL; ?>/pages/move_down.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MOVE_DOWN']; ?>">
|
282 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/down_16.png" border="0" alt="v" />
|
283 |
|
|
</a>
|
284 |
|
|
<?php } ?>
|
285 |
|
|
<?php } ?>
|
286 |
|
|
<?php } ?>
|
287 |
|
|
</td>
|
288 |
|
|
<td width="20">
|
289 |
|
|
<?php if($admin->get_permission('pages_delete') == true AND $can_modify == true) { ?>
|
290 |
|
|
<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']; ?>">
|
291 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/delete_16.png" border="0" alt="X" />
|
292 |
|
|
</a>
|
293 |
|
|
<?php } ?>
|
294 |
|
|
</td>
|
295 |
|
|
</tr>
|
296 |
|
|
</table>
|
297 |
|
|
</li>
|
298 |
|
|
|
299 |
|
|
<?php
|
300 |
|
|
// Get subs
|
301 |
|
|
$editable_pages=make_list($page['page_id'], $editable_pages);
|
302 |
|
|
}
|
303 |
|
|
|
304 |
|
|
}
|
305 |
|
|
?>
|
306 |
|
|
</ul>
|
307 |
|
|
<?php
|
308 |
|
|
return $editable_pages;
|
309 |
|
|
}
|
310 |
|
|
|
311 |
|
|
// Generate pages list
|
312 |
|
|
if($admin->get_permission('pages_view') == true) {
|
313 |
|
|
?>
|
314 |
|
|
<table cellpadding="0" cellspacing="0" width="100%" border="0">
|
315 |
|
|
<tr>
|
316 |
|
|
<td>
|
317 |
|
|
<h2><?php echo $HEADING['MODIFY_DELETE_PAGE']; ?></h2>
|
318 |
|
|
</td>
|
319 |
|
|
<td align="right">
|
320 |
|
|
<?php
|
321 |
|
|
// Check if there are any pages that are in trash, and if we should show a link to the trash page
|
322 |
|
|
if(PAGE_TRASH == 'separate') {
|
323 |
|
|
$query_trash = $database->query("SELECT page_id FROM ".TABLE_PREFIX."pages WHERE visibility = 'deleted'");
|
324 |
|
|
if($query_trash->numRows() > 0) {
|
325 |
|
|
?>
|
326 |
|
|
<a href="<?php echo ADMIN_URL; ?>/pages/trash.php">
|
327 |
|
|
<img src="<?php echo ADMIN_URL; ?>/images/delete_16.png" alt="<?php echo $TEXT['PAGE_TRASH']; ?>" border="0" />
|
328 |
|
|
<?php echo $TEXT['VIEW_DELETED_PAGES']; ?></a>
|
329 |
|
|
<?php
|
330 |
|
|
}
|
331 |
|
|
}
|
332 |
|
|
?>
|
333 |
|
|
</td>
|
334 |
|
|
</tr>
|
335 |
|
|
</table>
|
336 |
|
|
<div class="pages_list">
|
337 |
584
|
doc
|
<table cellpadding="0" cellspacing="0" width="720px" border="0">
|
338 |
238
|
stefan
|
<tr>
|
339 |
584
|
doc
|
<td width="20px">
|
340 |
238
|
stefan
|
|
341 |
|
|
</td>
|
342 |
584
|
doc
|
<td width="314px">
|
343 |
529
|
doc
|
<?php echo $TEXT['VISIBILITY'] .' / ' .$TEXT['PAGE_TITLE']; ?>:
|
344 |
238
|
stefan
|
</td>
|
345 |
584
|
doc
|
<td width="256px" align="left">
|
346 |
238
|
stefan
|
<?php echo $TEXT['MENU_TITLE']; ?>:
|
347 |
|
|
</td>
|
348 |
584
|
doc
|
<td width="130px" align="center">
|
349 |
238
|
stefan
|
<?php echo $TEXT['ACTIONS']; ?>:
|
350 |
|
|
</td>
|
351 |
|
|
</tr>
|
352 |
|
|
</table>
|
353 |
|
|
<?php
|
354 |
|
|
$editable_pages = make_list(0, 0);
|
355 |
|
|
?>
|
356 |
|
|
</div>
|
357 |
|
|
<div class="empty_list">
|
358 |
|
|
<?php echo $TEXT['NONE_FOUND']; ?>
|
359 |
|
|
</div>
|
360 |
|
|
<?php
|
361 |
|
|
} else {
|
362 |
|
|
$editable_pages = 0;
|
363 |
|
|
}
|
364 |
|
|
|
365 |
|
|
// Setup template object
|
366 |
|
|
$template = new Template(ADMIN_PATH.'/pages');
|
367 |
|
|
$template->set_file('page', 'template.html');
|
368 |
|
|
$template->set_block('page', 'main_block', 'main');
|
369 |
|
|
|
370 |
|
|
// Figure out if the no pages found message should be shown or not
|
371 |
|
|
if($editable_pages == 0) {
|
372 |
|
|
?>
|
373 |
|
|
<style type="text/css">
|
374 |
|
|
.pages_list {
|
375 |
|
|
display: none;
|
376 |
|
|
}
|
377 |
|
|
</style>
|
378 |
|
|
<?php
|
379 |
|
|
} else {
|
380 |
|
|
?>
|
381 |
|
|
<style type="text/css">
|
382 |
|
|
.empty_list {
|
383 |
|
|
display: none;
|
384 |
|
|
}
|
385 |
|
|
</style>
|
386 |
|
|
<?php
|
387 |
|
|
}
|
388 |
|
|
|
389 |
|
|
// Insert values into the add page form
|
390 |
|
|
|
391 |
|
|
// Group list 1
|
392 |
546
|
doc
|
|
393 |
|
|
$query = "SELECT * FROM ".TABLE_PREFIX."groups";
|
394 |
|
|
|
395 |
238
|
stefan
|
$get_groups = $database->query($query);
|
396 |
|
|
$template->set_block('main_block', 'group_list_block', 'group_list');
|
397 |
|
|
// Insert admin group and current group first
|
398 |
|
|
$admin_group_name = $get_groups->fetchRow();
|
399 |
|
|
$template->set_var(array(
|
400 |
|
|
'ID' => 1,
|
401 |
|
|
'TOGGLE' => '',
|
402 |
|
|
'DISABLED' => ' disabled',
|
403 |
|
|
'LINK_COLOR' => '000000',
|
404 |
|
|
'CURSOR' => 'default',
|
405 |
|
|
'NAME' => $admin_group_name['name'],
|
406 |
|
|
'CHECKED' => ' checked'
|
407 |
|
|
)
|
408 |
|
|
);
|
409 |
|
|
$template->parse('group_list', 'group_list_block', true);
|
410 |
546
|
doc
|
|
411 |
238
|
stefan
|
while($group = $get_groups->fetchRow()) {
|
412 |
546
|
doc
|
// check if the user is a member of this group
|
413 |
|
|
$flag_disabled = '';
|
414 |
|
|
$flag_checked = '';
|
415 |
|
|
$flag_cursor = 'pointer';
|
416 |
|
|
$flag_color = '';
|
417 |
|
|
if (in_array($group["group_id"], $admin->get_groups_id())) {
|
418 |
|
|
$flag_disabled = ' disabled';
|
419 |
|
|
$flag_checked = ' checked';
|
420 |
|
|
$flag_cursor = 'default';
|
421 |
|
|
$flag_color = '000000';
|
422 |
|
|
}
|
423 |
|
|
|
424 |
238
|
stefan
|
// Check if the group is allowed to edit pages
|
425 |
|
|
$system_permissions = explode(',', $group['system_permissions']);
|
426 |
|
|
if(is_numeric(array_search('pages_modify', $system_permissions))) {
|
427 |
|
|
$template->set_var(array(
|
428 |
|
|
'ID' => $group['group_id'],
|
429 |
|
|
'TOGGLE' => $group['group_id'],
|
430 |
546
|
doc
|
'CHECKED' => $flag_checked,
|
431 |
|
|
'DISABLED' => $flag_disabled,
|
432 |
|
|
'LINK_COLOR' => $flag_color,
|
433 |
|
|
'CURSOR' => $flag_checked,
|
434 |
238
|
stefan
|
'NAME' => $group['name'],
|
435 |
|
|
)
|
436 |
|
|
);
|
437 |
|
|
$template->parse('group_list', 'group_list_block', true);
|
438 |
|
|
}
|
439 |
|
|
}
|
440 |
|
|
// Group list 2
|
441 |
546
|
doc
|
|
442 |
|
|
$query = "SELECT * FROM ".TABLE_PREFIX."groups";
|
443 |
|
|
|
444 |
238
|
stefan
|
$get_groups = $database->query($query);
|
445 |
|
|
$template->set_block('main_block', 'group_list_block2', 'group_list2');
|
446 |
|
|
// Insert admin group and current group first
|
447 |
|
|
$admin_group_name = $get_groups->fetchRow();
|
448 |
|
|
$template->set_var(array(
|
449 |
|
|
'ID' => 1,
|
450 |
|
|
'TOGGLE' => '',
|
451 |
|
|
'DISABLED' => ' disabled',
|
452 |
|
|
'LINK_COLOR' => '000000',
|
453 |
|
|
'CURSOR' => 'default',
|
454 |
|
|
'NAME' => $admin_group_name['name'],
|
455 |
|
|
'CHECKED' => ' checked'
|
456 |
|
|
)
|
457 |
|
|
);
|
458 |
|
|
$template->parse('group_list2', 'group_list_block2', true);
|
459 |
546
|
doc
|
|
460 |
238
|
stefan
|
while($group = $get_groups->fetchRow()) {
|
461 |
546
|
doc
|
// check if the user is a member of this group
|
462 |
|
|
$flag_disabled = '';
|
463 |
|
|
$flag_checked = '';
|
464 |
|
|
$flag_cursor = 'pointer';
|
465 |
|
|
$flag_color = '';
|
466 |
|
|
if (in_array($group["group_id"], $admin->get_groups_id())) {
|
467 |
|
|
$flag_disabled = ' disabled';
|
468 |
|
|
$flag_checked = ' checked';
|
469 |
|
|
$flag_cursor = 'default';
|
470 |
|
|
$flag_color = '000000';
|
471 |
|
|
}
|
472 |
|
|
|
473 |
238
|
stefan
|
$template->set_var(array(
|
474 |
|
|
'ID' => $group['group_id'],
|
475 |
|
|
'TOGGLE' => $group['group_id'],
|
476 |
546
|
doc
|
'CHECKED' => $flag_checked,
|
477 |
|
|
'DISABLED' => $flag_disabled,
|
478 |
|
|
'LINK_COLOR' => $flag_color,
|
479 |
|
|
'CURSOR' => $flag_cursor,
|
480 |
238
|
stefan
|
'NAME' => $group['name'],
|
481 |
|
|
)
|
482 |
|
|
);
|
483 |
|
|
$template->parse('group_list2', 'group_list_block2', true);
|
484 |
|
|
}
|
485 |
|
|
|
486 |
|
|
// Parent page list
|
487 |
|
|
$database = new database();
|
488 |
|
|
function parent_list($parent) {
|
489 |
|
|
global $admin, $database, $template;
|
490 |
|
|
$query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE parent = '$parent' AND visibility!='deleted' ORDER BY position ASC";
|
491 |
|
|
$get_pages = $database->query($query);
|
492 |
|
|
while($page = $get_pages->fetchRow()) {
|
493 |
650
|
thorn
|
if($admin->page_is_visible($page)==false)
|
494 |
|
|
continue;
|
495 |
238
|
stefan
|
// Stop users from adding pages with a level of more than the set page level limit
|
496 |
|
|
if($page['level']+1 < PAGE_LEVEL_LIMIT) {
|
497 |
|
|
// Get user perms
|
498 |
|
|
$admin_groups = explode(',', str_replace('_', '', $page['admin_groups']));
|
499 |
|
|
$admin_users = explode(',', str_replace('_', '', $page['admin_users']));
|
500 |
546
|
doc
|
|
501 |
|
|
$in_group = FALSE;
|
502 |
|
|
foreach($admin->get_groups_id() as $cur_gid){
|
503 |
|
|
if (in_array($cur_gid, $admin_groups)) {
|
504 |
|
|
$in_group = TRUE;
|
505 |
|
|
}
|
506 |
|
|
}
|
507 |
|
|
if(($in_group) OR is_numeric(array_search($admin->get_user_id(), $admin_users))) {
|
508 |
238
|
stefan
|
$can_modify = true;
|
509 |
|
|
} else {
|
510 |
|
|
$can_modify = false;
|
511 |
|
|
}
|
512 |
|
|
// Title -'s prefix
|
513 |
|
|
$title_prefix = '';
|
514 |
|
|
for($i = 1; $i <= $page['level']; $i++) { $title_prefix .= ' - '; }
|
515 |
|
|
$template->set_var(array(
|
516 |
|
|
'ID' => $page['page_id'],
|
517 |
442
|
Ruebenwurz
|
'TITLE' => ($title_prefix.$page['page_title'])
|
518 |
238
|
stefan
|
)
|
519 |
|
|
);
|
520 |
|
|
if($can_modify == true) {
|
521 |
|
|
$template->set_var('DISABLED', '');
|
522 |
|
|
} else {
|
523 |
398
|
Ruebenwurz
|
$template->set_var('DISABLED', ' disabled="disabled" style="color: #aaa;"');
|
524 |
238
|
stefan
|
}
|
525 |
|
|
$template->parse('page_list2', 'page_list_block2', true);
|
526 |
|
|
}
|
527 |
|
|
parent_list($page['page_id']);
|
528 |
|
|
}
|
529 |
|
|
}
|
530 |
|
|
$template->set_block('main_block', 'page_list_block2', 'page_list2');
|
531 |
|
|
if($admin->get_permission('pages_add_l0') == true) {
|
532 |
|
|
$template->set_var(array(
|
533 |
|
|
'ID' => '0',
|
534 |
|
|
'TITLE' => $TEXT['NONE'],
|
535 |
|
|
'SELECTED' => ' selected',
|
536 |
|
|
'DISABLED' => ''
|
537 |
|
|
)
|
538 |
|
|
);
|
539 |
|
|
$template->parse('page_list2', 'page_list_block2', true);
|
540 |
|
|
}
|
541 |
|
|
parent_list(0);
|
542 |
|
|
|
543 |
|
|
// Explode module permissions
|
544 |
|
|
$module_permissions = $_SESSION['MODULE_PERMISSIONS'];
|
545 |
|
|
// Modules list
|
546 |
|
|
$template->set_block('main_block', 'module_list_block', 'module_list');
|
547 |
384
|
Ruebenwurz
|
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'page' order by name");
|
548 |
238
|
stefan
|
if($result->numRows() > 0) {
|
549 |
|
|
while ($module = $result->fetchRow()) {
|
550 |
|
|
// Check if user is allowed to use this module
|
551 |
|
|
if(!is_numeric(array_search($module['directory'], $module_permissions))) {
|
552 |
|
|
$template->set_var('VALUE', $module['directory']);
|
553 |
|
|
$template->set_var('NAME', $module['name']);
|
554 |
|
|
if($module['directory'] == 'wysiwyg') {
|
555 |
|
|
$template->set_var('SELECTED', ' selected');
|
556 |
|
|
} else {
|
557 |
|
|
$template->set_var('SELECTED', '');
|
558 |
|
|
}
|
559 |
|
|
$template->parse('module_list', 'module_list_block', true);
|
560 |
|
|
}
|
561 |
|
|
}
|
562 |
|
|
}
|
563 |
|
|
|
564 |
|
|
// Insert language headings
|
565 |
|
|
$template->set_var(array(
|
566 |
|
|
'HEADING_ADD_PAGE' => $HEADING['ADD_PAGE'],
|
567 |
|
|
'HEADING_MODIFY_INTRO_PAGE' => $HEADING['MODIFY_INTRO_PAGE']
|
568 |
|
|
)
|
569 |
|
|
);
|
570 |
|
|
// Insert language text and messages
|
571 |
|
|
$template->set_var(array(
|
572 |
|
|
'TEXT_TITLE' => $TEXT['TITLE'],
|
573 |
|
|
'TEXT_TYPE' => $TEXT['TYPE'],
|
574 |
|
|
'TEXT_PARENT' => $TEXT['PARENT'],
|
575 |
|
|
'TEXT_VISIBILITY' => $TEXT['VISIBILITY'],
|
576 |
|
|
'TEXT_PUBLIC' => $TEXT['PUBLIC'],
|
577 |
|
|
'TEXT_PRIVATE' => $TEXT['PRIVATE'],
|
578 |
|
|
'TEXT_REGISTERED' => $TEXT['REGISTERED'],
|
579 |
|
|
'TEXT_HIDDEN' => $TEXT['HIDDEN'],
|
580 |
|
|
'TEXT_NONE' => $TEXT['NONE'],
|
581 |
|
|
'TEXT_NONE_FOUND' => $TEXT['NONE_FOUND'],
|
582 |
|
|
'TEXT_ADD' => $TEXT['ADD'],
|
583 |
|
|
'TEXT_RESET' => $TEXT['RESET'],
|
584 |
|
|
'TEXT_ADMINISTRATORS' => $TEXT['ADMINISTRATORS'],
|
585 |
|
|
'TEXT_PRIVATE_VIEWERS' => $TEXT['PRIVATE_VIEWERS'],
|
586 |
|
|
'TEXT_REGISTERED_VIEWERS' => $TEXT['REGISTERED_VIEWERS'],
|
587 |
|
|
'INTRO_LINK' => $MESSAGE['PAGES']['INTRO_LINK'],
|
588 |
|
|
)
|
589 |
|
|
);
|
590 |
|
|
|
591 |
|
|
// Insert permissions values
|
592 |
|
|
if($admin->get_permission('pages_add') != true) {
|
593 |
|
|
$template->set_var('DISPLAY_ADD', 'hide');
|
594 |
|
|
} elseif($admin->get_permission('pages_add_l0') != true AND $editable_pages == 0) {
|
595 |
|
|
$template->set_var('DISPLAY_ADD', 'hide');
|
596 |
|
|
}
|
597 |
|
|
if($admin->get_permission('pages_intro') != true OR INTRO_PAGE != 'enabled') {
|
598 |
|
|
$template->set_var('DISPLAY_INTRO', 'hide');
|
599 |
|
|
}
|
600 |
|
|
|
601 |
|
|
|
602 |
|
|
// Parse template object
|
603 |
|
|
$template->parse('main', 'main_block', false);
|
604 |
|
|
$template->pparse('output', 'page');
|
605 |
|
|
|
606 |
|
|
// Print admin
|
607 |
|
|
$admin->print_footer();
|
608 |
|
|
|
609 |
552
|
thorn
|
?>
|