1
|
<?php
|
2
|
|
3
|
// $Id: trash.php 116 2005-09-16 21:20:22Z stefan $
|
4
|
|
5
|
/*
|
6
|
|
7
|
Website Baker Project <http://www.websitebaker.org/>
|
8
|
Copyright (C) 2004-2005, Ryan Djurovich
|
9
|
|
10
|
Website Baker is free software; you can redistribute it and/or modify
|
11
|
it under the terms of the GNU General Public License as published by
|
12
|
the Free Software Foundation; either version 2 of the License, or
|
13
|
(at your option) any later version.
|
14
|
|
15
|
Website Baker is distributed in the hope that it will be useful,
|
16
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18
|
GNU General Public License for more details.
|
19
|
|
20
|
You should have received a copy of the GNU General Public License
|
21
|
along with Website Baker; if not, write to the Free Software
|
22
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
23
|
|
24
|
*/
|
25
|
|
26
|
require('../../config.php');
|
27
|
require_once(WB_PATH.'/framework/class.admin.php');
|
28
|
$admin = new admin('Pages', 'pages');
|
29
|
|
30
|
?>
|
31
|
<script type="text/javascript" language="javascript">
|
32
|
function toggle_viewers() {
|
33
|
if(document.add.visibility.value == 'private') {
|
34
|
document.getElementById('private_viewers').style.display = 'block';
|
35
|
document.getElementById('registered_viewers').style.display = 'none';
|
36
|
} else if(document.add.visibility.value == 'registered') {
|
37
|
document.getElementById('private_viewers').style.display = 'none';
|
38
|
document.getElementById('registered_viewers').style.display = 'block';
|
39
|
} else {
|
40
|
document.getElementById('private_viewers').style.display = 'none';
|
41
|
document.getElementById('registered_viewers').style.display = 'none';
|
42
|
}
|
43
|
}
|
44
|
function toggle_visibility(id){
|
45
|
if(document.getElementById(id).style.display == "block") {
|
46
|
document.getElementById(id).style.display = "none";
|
47
|
} else {
|
48
|
document.getElementById(id).style.display = "block";
|
49
|
}
|
50
|
}
|
51
|
var plus = new Image;
|
52
|
plus.src = "<?php echo ADMIN_URL; ?>/images/plus_16.png";
|
53
|
var minus = new Image;
|
54
|
minus.src = "<?php echo ADMIN_URL; ?>/images/minus_16.png";
|
55
|
function toggle_plus_minus(id) {
|
56
|
var img_src = document.images['plus_minus_' + id].src;
|
57
|
if(img_src == plus.src) {
|
58
|
document.images['plus_minus_' + id].src = minus.src;
|
59
|
} else {
|
60
|
document.images['plus_minus_' + id].src = plus.src;
|
61
|
}
|
62
|
}
|
63
|
</script>
|
64
|
|
65
|
<style type="text/css">
|
66
|
.pages_list img {
|
67
|
display: block;
|
68
|
}
|
69
|
ul, li {
|
70
|
list-style: none;
|
71
|
margin: 0;
|
72
|
padding: 0;
|
73
|
}
|
74
|
.page_list {
|
75
|
display: none;
|
76
|
}
|
77
|
</style>
|
78
|
|
79
|
<noscript>
|
80
|
<style type="text/css">
|
81
|
.page_list {
|
82
|
display: block;
|
83
|
}
|
84
|
</style>
|
85
|
</noscript>
|
86
|
<?php
|
87
|
|
88
|
function make_list($parent, $editable_pages) {
|
89
|
// Get objects and vars from outside this function
|
90
|
global $admin, $template, $database, $TEXT, $MESSAGE;
|
91
|
?>
|
92
|
<ul id="p<?php echo $parent; ?>" <?php if($parent != 0) { echo 'class="page_list"'; } ?>>
|
93
|
<?php
|
94
|
// Get page list from database
|
95
|
$database = new database();
|
96
|
$query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE parent = '$parent' AND visibility = 'deleted' ORDER BY position ASC";
|
97
|
$get_pages = $database->query($query);
|
98
|
|
99
|
// Insert values into main page list
|
100
|
if($get_pages->numRows() > 0) {
|
101
|
while($page = $get_pages->fetchRow()) {
|
102
|
// Get user perms
|
103
|
$admin_groups = explode(',', str_replace('_', '', $page['admin_groups']));
|
104
|
$admin_users = explode(',', str_replace('_', '', $page['admin_users']));
|
105
|
if(is_numeric(array_search($admin->get_group_id(), $admin_groups)) OR is_numeric(array_search($admin->get_user_id(), $admin_users))) {
|
106
|
if($page['visibility'] == 'deleted') {
|
107
|
$can_modify = true;
|
108
|
$editable_pages = $editable_pages+1;
|
109
|
} else {
|
110
|
$can_modify = false;
|
111
|
}
|
112
|
} else {
|
113
|
$can_modify = false;
|
114
|
}
|
115
|
|
116
|
// Work out if we should show a plus or not
|
117
|
$get_page_subs = $database->query("SELECT page_id,admin_groups,admin_users FROM ".TABLE_PREFIX."pages WHERE parent = '".$page['page_id']."'");
|
118
|
if($get_page_subs->numRows() > 0) {
|
119
|
$display_plus = true;
|
120
|
} else {
|
121
|
$display_plus = false;
|
122
|
}
|
123
|
|
124
|
// Work out how many pages there are for this parent
|
125
|
$num_pages = $get_pages->numRows();
|
126
|
?>
|
127
|
|
128
|
<li id="p<?php echo $page['parent']; ?>" style="padding: 2px 0px 2px 0px;">
|
129
|
<table width="720" cellpadding="1" cellspacing="0" border="0" style="background-color: #F0F0F0;">
|
130
|
<tr>
|
131
|
<td width="20" style="padding-left: <?php echo $page['level']*20; ?>px;">
|
132
|
<?php
|
133
|
if($display_plus == true) {
|
134
|
?>
|
135
|
<a href="javascript: toggle_visibility('p<?php echo $page['page_id']; ?>');" title="<?php echo $TEXT['EXPAND'].'/'.$TEXT['COLLAPSE']; ?>">
|
136
|
<img src="<?php echo ADMIN_URL; ?>/images/plus_16.png" onclick="toggle_plus_minus('<?php echo $page['page_id']; ?>');" name="plus_minus_<?php echo $page['page_id']; ?>" border="0" alt="+" />
|
137
|
</a>
|
138
|
<?php
|
139
|
}
|
140
|
?>
|
141
|
</td>
|
142
|
<?php if($admin->get_permission('pages_modify') == true AND $can_modify == true AND $page['visibility'] != 'heading') { ?>
|
143
|
<td>
|
144
|
<a href="<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MODIFY']; ?>"><?php echo ($page['page_title']); ?></a>
|
145
|
</td>
|
146
|
<?php } else { ?>
|
147
|
<td>
|
148
|
<?php
|
149
|
if($page['visibility'] != 'heading') {
|
150
|
echo ($page['page_title']);
|
151
|
} else {
|
152
|
echo '<b>'.($page['page_title']).'</b>';
|
153
|
}
|
154
|
?>
|
155
|
</td>
|
156
|
<?php } ?>
|
157
|
<td align="left" width="232">
|
158
|
<font color="#999999"><?php echo $page['menu_title']; ?></font>
|
159
|
</td>
|
160
|
<td align="right" valign="middle" width="30" style="padding-right: 20px;">
|
161
|
<?php if($page['visibility'] == 'public') { ?>
|
162
|
<img src="<?php echo ADMIN_URL; ?>/images/visible_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['PUBLIC']; ?>" border="0" />
|
163
|
<?php } elseif($page['visibility'] == 'private') { ?>
|
164
|
<img src="<?php echo ADMIN_URL; ?>/images/private_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['PRIVATE']; ?>" border="0" />
|
165
|
<?php } elseif($page['visibility'] == 'registered') { ?>
|
166
|
<img src="<?php echo ADMIN_URL; ?>/images/keys_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['REGISTERED']; ?>" border="0" />
|
167
|
<?php } elseif($page['visibility'] == 'none') { ?>
|
168
|
<img src="<?php echo ADMIN_URL; ?>/images/hidden_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['NONE']; ?>" border="0" />
|
169
|
<?php } elseif($page['visibility'] == 'deleted') { ?>
|
170
|
<img src="<?php echo ADMIN_URL; ?>/images/deleted_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['DELETED']; ?>" border="0" />
|
171
|
<?php } ?>
|
172
|
</td>
|
173
|
<td width="20">
|
174
|
<?php if($page['visibility'] != 'deleted') { ?>
|
175
|
<?php if($admin->get_permission('pages_settings') == true AND $can_modify == true) { ?>
|
176
|
<a href="<?php echo ADMIN_URL; ?>/pages/settings.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['SETTINGS']; ?>">
|
177
|
<img src="<?php echo ADMIN_URL; ?>/images/modify_16.png" border="0" alt="<?php echo $TEXT['SETTINGS']; ?>" />
|
178
|
</a>
|
179
|
<?php } ?>
|
180
|
<?php } else { ?>
|
181
|
<a href="<?php echo ADMIN_URL; ?>/pages/restore.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['RESTORE']; ?>">
|
182
|
<img src="<?php echo ADMIN_URL; ?>/images/restore_16.png" border="0" alt="<?php echo $TEXT['RESTORE']; ?>" />
|
183
|
</a>
|
184
|
<?php } ?>
|
185
|
</td>
|
186
|
<td width="20">
|
187
|
<?php if($page['position'] != 1) { ?>
|
188
|
<?php if($page['visibility'] != 'deleted') { ?>
|
189
|
<?php if($admin->get_permission('pages_settings') == true AND $can_modify == true) { ?>
|
190
|
<a href="<?php echo ADMIN_URL; ?>/pages/move_up.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MOVE_UP']; ?>">
|
191
|
<img src="<?php echo ADMIN_URL; ?>/images/up_16.png" border="0" alt="^" />
|
192
|
</a>
|
193
|
<?php } ?>
|
194
|
<?php } ?>
|
195
|
<?php } ?>
|
196
|
</td>
|
197
|
<td width="20">
|
198
|
<?php if($page['position'] != $num_pages) { ?>
|
199
|
<?php if($page['visibility'] != 'deleted') { ?>
|
200
|
<?php if($admin->get_permission('pages_settings') == true AND $can_modify == true) { ?>
|
201
|
<a href="<?php echo ADMIN_URL; ?>/pages/move_down.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MOVE_DOWN']; ?>">
|
202
|
<img src="<?php echo ADMIN_URL; ?>/images/down_16.png" border="0" alt="v" />
|
203
|
</a>
|
204
|
<?php } ?>
|
205
|
<?php } ?>
|
206
|
<?php } ?>
|
207
|
</td>
|
208
|
<td width="20">
|
209
|
<?php if($admin->get_permission('pages_delete') == true AND $can_modify == true) { ?>
|
210
|
<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']; ?>">
|
211
|
<img src="<?php echo ADMIN_URL; ?>/images/delete_16.png" border="0" alt="X" />
|
212
|
</a>
|
213
|
<?php } ?>
|
214
|
</td>
|
215
|
</tr>
|
216
|
</table>
|
217
|
</li>
|
218
|
|
219
|
<?php
|
220
|
// Get subs
|
221
|
make_list($page['page_id'], $editable_pages);
|
222
|
}
|
223
|
|
224
|
}
|
225
|
?>
|
226
|
</ul>
|
227
|
<?php
|
228
|
return $editable_pages;
|
229
|
}
|
230
|
|
231
|
// Generate pages list
|
232
|
if($admin->get_permission('pages_view') == true) {
|
233
|
?>
|
234
|
<table cellpadding="0" cellspacing="0" width="100%" border="0">
|
235
|
<tr>
|
236
|
<td>
|
237
|
<h2><?php echo $HEADING['DELETED_PAGES']; ?></h2>
|
238
|
</td>
|
239
|
<td align="right">
|
240
|
<a href="<?php echo ADMIN_URL; ?>/pages/empty_trash.php">
|
241
|
<img src="<?php echo ADMIN_URL; ?>/images/delete_16.png" alt="<?php echo $TEXT['PAGE_TRASH']; ?>" border="0" />
|
242
|
<?php echo $TEXT['EMPTY_TRASH']; ?></a>
|
243
|
</td>
|
244
|
</tr>
|
245
|
</table>
|
246
|
<div class="pages_list">
|
247
|
<table cellpadding="1" cellspacing="0" width="720" border="0">
|
248
|
<tr>
|
249
|
<td width="20">
|
250
|
|
251
|
</td>
|
252
|
<td>
|
253
|
<?php echo $TEXT['PAGE_TITLE']; ?>:
|
254
|
</td>
|
255
|
<td width="198" align="left">
|
256
|
<?php echo $TEXT['MENU_TITLE']; ?>:
|
257
|
</td>
|
258
|
<td width="80" align="center">
|
259
|
<?php echo $TEXT['VISIBILITY']; ?>:
|
260
|
</td>
|
261
|
<td width="90" align="center">
|
262
|
<?php echo $TEXT['ACTIONS']; ?>:
|
263
|
</td>
|
264
|
</tr>
|
265
|
</table>
|
266
|
<?php
|
267
|
$editable_pages = make_list(0, 0);
|
268
|
?>
|
269
|
</div>
|
270
|
<div class="empty_list">
|
271
|
<?php echo $TEXT['NONE_FOUND']; ?>
|
272
|
</div>
|
273
|
<?php
|
274
|
} else {
|
275
|
$editable_pages = 0;
|
276
|
}
|
277
|
|
278
|
// Figure out if the no pages found message should be shown or not
|
279
|
if($editable_pages == 0) {
|
280
|
?>
|
281
|
<style type="text/css">
|
282
|
.pages_list {
|
283
|
display: none;
|
284
|
}
|
285
|
</style>
|
286
|
<?php
|
287
|
} else {
|
288
|
?>
|
289
|
<style type="text/css">
|
290
|
.empty_list {
|
291
|
display: none;
|
292
|
}
|
293
|
</style>
|
294
|
<?php
|
295
|
}
|
296
|
|
297
|
?>
|
298
|
<br />< <a href="<?php echo ADMIN_URL; ?>/pages/index.php"><?php echo $MESSAGE['PAGES']['RETURN_TO_PAGES']; ?></a>
|
299
|
<?php
|
300
|
|
301
|
// Print admin
|
302
|
$admin->print_footer();
|
303
|
|
304
|
?>
|