1
|
<?php
|
2
|
|
3
|
// $Id: trash.php 1357 2010-12-27 19:50:23Z FrankH $
|
4
|
|
5
|
/*
|
6
|
|
7
|
Website Baker Project <http://www.websitebaker.org/>
|
8
|
Copyright (C) 2004-2009, 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
|
if (!$admin->checkFTAN('get'))
|
31
|
{
|
32
|
$admin->print_error($MESSAGE['PAGES']['NOT_FOUND']);
|
33
|
exit();
|
34
|
}
|
35
|
|
36
|
?>
|
37
|
<script type="text/javascript" language="javascript">
|
38
|
function toggle_viewers() {
|
39
|
if(document.add.visibility.value == 'private') {
|
40
|
document.getElementById('private_viewers').style.display = 'block';
|
41
|
document.getElementById('registered_viewers').style.display = 'none';
|
42
|
} else if(document.add.visibility.value == 'registered') {
|
43
|
document.getElementById('private_viewers').style.display = 'none';
|
44
|
document.getElementById('registered_viewers').style.display = 'block';
|
45
|
} else {
|
46
|
document.getElementById('private_viewers').style.display = 'none';
|
47
|
document.getElementById('registered_viewers').style.display = 'none';
|
48
|
}
|
49
|
}
|
50
|
function toggle_visibility(id){
|
51
|
if(document.getElementById(id).style.display == "block") {
|
52
|
document.getElementById(id).style.display = "none";
|
53
|
} else {
|
54
|
document.getElementById(id).style.display = "block";
|
55
|
}
|
56
|
}
|
57
|
var plus = new Image;
|
58
|
plus.src = "<?php echo THEME_URL; ?>/images/plus_16.png";
|
59
|
var minus = new Image;
|
60
|
minus.src = "<?php echo THEME_URL; ?>/images/minus_16.png";
|
61
|
function toggle_plus_minus(id) {
|
62
|
var img_src = document.images['plus_minus_' + id].src;
|
63
|
if(img_src == plus.src) {
|
64
|
document.images['plus_minus_' + id].src = minus.src;
|
65
|
} else {
|
66
|
document.images['plus_minus_' + id].src = plus.src;
|
67
|
}
|
68
|
}
|
69
|
</script>
|
70
|
|
71
|
<?php
|
72
|
|
73
|
function make_list($parent, $editable_pages) {
|
74
|
// Get objects and vars from outside this function
|
75
|
global $admin, $template, $database, $TEXT, $MESSAGE;
|
76
|
?>
|
77
|
<ul id="p<?php echo $parent; ?>" <?php if($parent != 0) { echo 'class="page_list"'; } ?>>
|
78
|
<?php
|
79
|
// Get page list from database
|
80
|
$database = new database();
|
81
|
$query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE parent = '$parent' AND visibility = 'deleted' ORDER BY position ASC";
|
82
|
$get_pages = $database->query($query);
|
83
|
|
84
|
// Insert values into main page list
|
85
|
if($get_pages->numRows() > 0) {
|
86
|
while($page = $get_pages->fetchRow()) {
|
87
|
// Get user perms
|
88
|
$admin_groups = explode(',', str_replace('_', '', $page['admin_groups']));
|
89
|
$admin_users = explode(',', str_replace('_', '', $page['admin_users']));
|
90
|
$in_old_group = FALSE;
|
91
|
foreach($admin->get_groups_id() as $cur_gid){
|
92
|
if (in_array($cur_gid, $old_admin_groups)) {
|
93
|
$in_old_group = TRUE;
|
94
|
}
|
95
|
}
|
96
|
if((!$in_old_group) OR is_numeric(array_search($admin->get_user_id(), $admin_users))) {
|
97
|
if($page['visibility'] == 'deleted') {
|
98
|
$can_modify = true;
|
99
|
$editable_pages = $editable_pages+1;
|
100
|
} else {
|
101
|
$can_modify = false;
|
102
|
}
|
103
|
} else {
|
104
|
$can_modify = false;
|
105
|
}
|
106
|
|
107
|
// Work out if we should show a plus or not
|
108
|
$get_page_subs = $database->query("SELECT page_id,admin_groups,admin_users FROM ".TABLE_PREFIX."pages WHERE parent = '".$page['page_id']."'");
|
109
|
if($get_page_subs->numRows() > 0) {
|
110
|
$display_plus = true;
|
111
|
} else {
|
112
|
$display_plus = false;
|
113
|
}
|
114
|
|
115
|
// Work out how many pages there are for this parent
|
116
|
$num_pages = $get_pages->numRows();
|
117
|
?>
|
118
|
|
119
|
<li id="p<?php echo $page['parent']; ?>">
|
120
|
<table cellpadding="0" cellspacing="0" border="0">
|
121
|
<tr>
|
122
|
<td width="20" style="padding-left: <?php echo $page['level']*20; ?>px;">
|
123
|
<?php
|
124
|
if($display_plus == true) {
|
125
|
?>
|
126
|
<a href="javascript: toggle_visibility('p<?php echo $page['page_id']; ?>');" title="<?php echo $TEXT['EXPAND'].'/'.$TEXT['COLLAPSE']; ?>">
|
127
|
<img src="<?php echo THEME_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="+" />
|
128
|
</a>
|
129
|
<?php
|
130
|
}
|
131
|
?>
|
132
|
</td>
|
133
|
<?php if($admin->get_permission('pages_modify') == true AND $can_modify == true AND $page['visibility'] != 'heading') { ?>
|
134
|
<td>
|
135
|
<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>
|
136
|
</td>
|
137
|
<?php } else { ?>
|
138
|
<td>
|
139
|
<?php
|
140
|
if($page['visibility'] != 'heading') {
|
141
|
echo ($page['page_title']);
|
142
|
} else {
|
143
|
echo '<b>'.($page['page_title']).'</b>';
|
144
|
}
|
145
|
?>
|
146
|
</td>
|
147
|
<?php } ?>
|
148
|
<td align="left" width="232">
|
149
|
<font color="#999999"><?php echo $page['menu_title']; ?></font>
|
150
|
</td>
|
151
|
<td align="right" valign="middle" width="30" class="icon_col">
|
152
|
<?php if($page['visibility'] == 'public') { ?>
|
153
|
<img src="<?php echo THEME_URL; ?>/images/visible_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['PUBLIC']; ?>" border="0" />
|
154
|
<?php } elseif($page['visibility'] == 'private') { ?>
|
155
|
<img src="<?php echo THEME_URL; ?>/images/private_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['PRIVATE']; ?>" border="0" />
|
156
|
<?php } elseif($page['visibility'] == 'registered') { ?>
|
157
|
<img src="<?php echo THEME_URL; ?>/images/keys_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['REGISTERED']; ?>" border="0" />
|
158
|
<?php } elseif($page['visibility'] == 'none') { ?>
|
159
|
<img src="<?php echo THEME_URL; ?>/images/hidden_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['NONE']; ?>" border="0" />
|
160
|
<?php } elseif($page['visibility'] == 'deleted') { ?>
|
161
|
<img src="<?php echo THEME_URL; ?>/images/deleted_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['DELETED']; ?>" border="0" />
|
162
|
<?php } ?>
|
163
|
</td>
|
164
|
<td width="20">
|
165
|
<?php if($page['visibility'] != 'deleted') { ?>
|
166
|
<?php if($admin->get_permission('pages_settings') == true AND $can_modify == true) { ?>
|
167
|
<a href="<?php echo ADMIN_URL; ?>/pages/settings.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['SETTINGS']; ?>">
|
168
|
<img src="<?php echo THEME_URL; ?>/images/modify_16.png" border="0" alt="<?php echo $TEXT['SETTINGS']; ?>" />
|
169
|
</a>
|
170
|
<?php } ?>
|
171
|
<?php } else { ?>
|
172
|
<a href="<?php echo ADMIN_URL; ?>/pages/restore.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['RESTORE']; ?>">
|
173
|
<img src="<?php echo THEME_URL; ?>/images/restore_16.png" border="0" alt="<?php echo $TEXT['RESTORE']; ?>" />
|
174
|
</a>
|
175
|
<?php } ?>
|
176
|
</td>
|
177
|
<td width="20">
|
178
|
<?php if($page['position'] != 1) { ?>
|
179
|
<?php if($page['visibility'] != 'deleted') { ?>
|
180
|
<?php if($admin->get_permission('pages_settings') == true AND $can_modify == true) { ?>
|
181
|
<a href="<?php echo ADMIN_URL; ?>/pages/move_up.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MOVE_UP']; ?>">
|
182
|
<img src="<?php echo THEME_URL; ?>/images/up_16.png" border="0" alt="^" />
|
183
|
</a>
|
184
|
<?php } ?>
|
185
|
<?php } ?>
|
186
|
<?php } ?>
|
187
|
</td>
|
188
|
<td width="20">
|
189
|
<?php if($page['position'] != $num_pages) { ?>
|
190
|
<?php if($page['visibility'] != 'deleted') { ?>
|
191
|
<?php if($admin->get_permission('pages_settings') == true AND $can_modify == true) { ?>
|
192
|
<a href="<?php echo ADMIN_URL; ?>/pages/move_down.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MOVE_DOWN']; ?>">
|
193
|
<img src="<?php echo THEME_URL; ?>/images/down_16.png" border="0" alt="v" />
|
194
|
</a>
|
195
|
<?php } ?>
|
196
|
<?php } ?>
|
197
|
<?php } ?>
|
198
|
</td>
|
199
|
<td width="20">
|
200
|
<?php if($admin->get_permission('pages_delete') == true AND $can_modify == true) { ?>
|
201
|
<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']; ?>">
|
202
|
<img src="<?php echo THEME_URL; ?>/images/delete_16.png" border="0" alt="X" />
|
203
|
</a>
|
204
|
<?php } ?>
|
205
|
</td>
|
206
|
</tr>
|
207
|
</table>
|
208
|
</li>
|
209
|
|
210
|
<?php
|
211
|
// Get subs
|
212
|
make_list($page['page_id'], $editable_pages);
|
213
|
}
|
214
|
|
215
|
}
|
216
|
?>
|
217
|
</ul>
|
218
|
<?php
|
219
|
return $editable_pages;
|
220
|
}
|
221
|
|
222
|
// Generate pages list
|
223
|
if($admin->get_permission('pages_view') == true) {
|
224
|
$ftan2 = $admin->getFTAN(2);
|
225
|
?>
|
226
|
<table cellpadding="0" cellspacing="0" width="100%" border="0">
|
227
|
<tr>
|
228
|
<td>
|
229
|
<h2><?php echo $HEADING['DELETED_PAGES']; ?></h2>
|
230
|
</td>
|
231
|
<td align="right">
|
232
|
<a href="<?php echo ADMIN_URL. "/pages/empty_trash.php?$ftan2"; ?>">
|
233
|
<img src="<?php echo THEME_URL; ?>/images/delete_16.png" alt="<?php echo $TEXT['PAGE_TRASH']; ?>" border="0" />
|
234
|
<?php echo $TEXT['EMPTY_TRASH']; ?></a>
|
235
|
</td>
|
236
|
</tr>
|
237
|
</table>
|
238
|
<div class="pages_list">
|
239
|
<table cellpadding="1" cellspacing="0" width="720" border="0">
|
240
|
<tr>
|
241
|
<td width="20">
|
242
|
|
243
|
</td>
|
244
|
<td>
|
245
|
<?php echo $TEXT['PAGE_TITLE']; ?>:
|
246
|
</td>
|
247
|
<td width="198" align="left">
|
248
|
<?php echo $TEXT['MENU_TITLE']; ?>:
|
249
|
</td>
|
250
|
<td width="80" align="center">
|
251
|
<?php echo $TEXT['VISIBILITY']; ?>:
|
252
|
</td>
|
253
|
<td width="90" align="center">
|
254
|
<?php echo $TEXT['ACTIONS']; ?>:
|
255
|
</td>
|
256
|
</tr>
|
257
|
</table>
|
258
|
<?php
|
259
|
$editable_pages = make_list(0, 0);
|
260
|
?>
|
261
|
</div>
|
262
|
<div class="empty_list">
|
263
|
<?php echo $TEXT['NONE_FOUND']; ?>
|
264
|
</div>
|
265
|
<?php
|
266
|
} else {
|
267
|
$editable_pages = 0;
|
268
|
}
|
269
|
|
270
|
// Figure out if the no pages found message should be shown or not
|
271
|
if($editable_pages == 0) {
|
272
|
?>
|
273
|
<style type="text/css">
|
274
|
.pages_list {
|
275
|
display: none;
|
276
|
}
|
277
|
</style>
|
278
|
<?php
|
279
|
} else {
|
280
|
?>
|
281
|
<style type="text/css">
|
282
|
.empty_list {
|
283
|
display: none;
|
284
|
}
|
285
|
</style>
|
286
|
<?php
|
287
|
}
|
288
|
|
289
|
?>
|
290
|
<br />< <a href="<?php echo ADMIN_URL; ?>/pages/index.php"><?php echo $MESSAGE['PAGES']['RETURN_TO_PAGES']; ?></a>
|
291
|
<?php
|
292
|
|
293
|
// Print admin
|
294
|
$admin->print_footer();
|
295
|
|
296
|
?>
|