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