Project

General

Profile

1
<?php
2

    
3
// $Id: trash.php 944 2009-02-22 09:39:58Z Ruebenwurzel $
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
?>
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 THEME_URL; ?>/images/plus_16.png";
53
var minus = new Image;
54
minus.src = "<?php echo THEME_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
<?php
66

    
67
function make_list($parent, $editable_pages) {
68
	// Get objects and vars from outside this function
69
	global $admin, $template, $database, $TEXT, $MESSAGE;
70
	?>
71
	<ul id="p<?php echo $parent; ?>" <?php if($parent != 0) { echo 'class="page_list"'; } ?>>
72
	<?php	
73
	// Get page list from database
74
	$database = new database();
75
	$query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE parent = '$parent' AND visibility = 'deleted' ORDER BY position ASC";
76
	$get_pages = $database->query($query);
77
	
78
	// Insert values into main page list
79
	if($get_pages->numRows() > 0)	{
80
		while($page = $get_pages->fetchRow()) {
81
			// Get user perms
82
			$admin_groups = explode(',', str_replace('_', '', $page['admin_groups']));
83
			$admin_users = explode(',', str_replace('_', '', $page['admin_users']));
84
			$in_old_group = FALSE;
85
			foreach($admin->get_groups_id() as $cur_gid){
86
			    if (in_array($cur_gid, $old_admin_groups)) {
87
				$in_old_group = TRUE;
88
			    }
89
			}
90
			if((!$in_old_group) OR is_numeric(array_search($admin->get_user_id(), $admin_users))) {
91
				if($page['visibility'] == 'deleted') {
92
					$can_modify = true;
93
					$editable_pages = $editable_pages+1;
94
				} else {
95
					$can_modify = false;
96
				}
97
			} else {
98
				$can_modify = false;
99
			}
100
						
101
			// Work out if we should show a plus or not
102
			$get_page_subs = $database->query("SELECT page_id,admin_groups,admin_users FROM ".TABLE_PREFIX."pages WHERE parent = '".$page['page_id']."'");
103
			if($get_page_subs->numRows() > 0) {
104
				$display_plus = true;
105
			} else {
106
				$display_plus = false;
107
			}
108
			
109
			// Work out how many pages there are for this parent
110
			$num_pages = $get_pages->numRows();
111
			?>
112
			
113
			<li id="p<?php echo $page['parent']; ?>">
114
			<table cellpadding="0" cellspacing="0" border="0">
115
			<tr>
116
				<td width="20" style="padding-left: <?php echo $page['level']*20; ?>px;">
117
					<?php
118
					if($display_plus == true) {
119
					?>
120
					<a href="javascript: toggle_visibility('p<?php echo $page['page_id']; ?>');" title="<?php echo $TEXT['EXPAND'].'/'.$TEXT['COLLAPSE']; ?>">
121
						<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="+" />
122
					</a>
123
					<?php
124
					}
125
					?>
126
				</td>
127
				<?php if($admin->get_permission('pages_modify') == true AND $can_modify == true AND $page['visibility'] != 'heading') { ?>
128
				<td>
129
					<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>
130
				</td>
131
				<?php } else { ?>
132
				<td>
133
					<?php
134
					if($page['visibility'] != 'heading') {
135
						echo ($page['page_title']);
136
					} else {
137
						echo '<b>'.($page['page_title']).'</b>';
138
					}
139
					?>
140
				</td>
141
				<?php } ?>
142
				<td align="left" width="232">
143
					<font color="#999999"><?php echo $page['menu_title']; ?></font>
144
				</td>
145
				<td align="right" valign="middle" width="30" class="icon_col">
146
				<?php if($page['visibility'] == 'public') { ?>
147
					<img src="<?php echo THEME_URL; ?>/images/visible_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['PUBLIC']; ?>" border="0" />
148
				<?php } elseif($page['visibility'] == 'private') { ?>
149
					<img src="<?php echo THEME_URL; ?>/images/private_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['PRIVATE']; ?>" border="0" />
150
				<?php } elseif($page['visibility'] == 'registered') { ?>
151
					<img src="<?php echo THEME_URL; ?>/images/keys_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['REGISTERED']; ?>" border="0" />
152
				<?php } elseif($page['visibility'] == 'none') { ?>
153
					<img src="<?php echo THEME_URL; ?>/images/hidden_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['NONE']; ?>" border="0" />
154
				<?php } elseif($page['visibility'] == 'deleted') { ?>
155
					<img src="<?php echo THEME_URL; ?>/images/deleted_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['DELETED']; ?>" border="0" />
156
				<?php } ?>
157
				</td>
158
				<td width="20">
159
					<?php if($page['visibility'] != 'deleted') { ?>
160
						<?php if($admin->get_permission('pages_settings') == true AND $can_modify == true) { ?>
161
						<a href="<?php echo ADMIN_URL; ?>/pages/settings.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['SETTINGS']; ?>">
162
							<img src="<?php echo THEME_URL; ?>/images/modify_16.png" border="0" alt="<?php echo $TEXT['SETTINGS']; ?>" />
163
						</a>
164
						<?php } ?>
165
					<?php } else { ?>
166
						<a href="<?php echo ADMIN_URL; ?>/pages/restore.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['RESTORE']; ?>">
167
							<img src="<?php echo THEME_URL; ?>/images/restore_16.png" border="0" alt="<?php echo $TEXT['RESTORE']; ?>" />
168
						</a>
169
					<?php } ?>
170
				</td>
171
				<td width="20">
172
				<?php if($page['position'] != 1) { ?>
173
					<?php if($page['visibility'] != 'deleted') { ?>
174
						<?php if($admin->get_permission('pages_settings') == true AND $can_modify == true) { ?>
175
						<a href="<?php echo ADMIN_URL; ?>/pages/move_up.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MOVE_UP']; ?>">
176
							<img src="<?php echo THEME_URL; ?>/images/up_16.png" border="0" alt="^" />
177
						</a>
178
						<?php } ?>
179
					<?php } ?>
180
				<?php } ?>
181
				</td>
182
				<td width="20">
183
				<?php if($page['position'] != $num_pages) { ?>
184
					<?php if($page['visibility'] != 'deleted') { ?>
185
						<?php if($admin->get_permission('pages_settings') == true AND $can_modify == true) { ?>
186
						<a href="<?php echo ADMIN_URL; ?>/pages/move_down.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MOVE_DOWN']; ?>">
187
							<img src="<?php echo THEME_URL; ?>/images/down_16.png" border="0" alt="v" />
188
						</a>
189
						<?php } ?>
190
					<?php } ?>
191
				<?php } ?>
192
				</td>
193
				<td width="20">
194
					<?php if($admin->get_permission('pages_delete') == true AND $can_modify == true) { ?>
195
					<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']; ?>">
196
						<img src="<?php echo THEME_URL; ?>/images/delete_16.png" border="0" alt="X" />
197
					</a>
198
					<?php } ?>
199
				</td>
200
			</tr>
201
			</table>
202
			</li>
203
							
204
			<?php
205
			// Get subs
206
			make_list($page['page_id'], $editable_pages);
207
		}
208

    
209
	}
210
	?>
211
	</ul>
212
	<?php
213
	return $editable_pages;
214
}
215

    
216
// Generate pages list
217
if($admin->get_permission('pages_view') == true) {
218
	?>
219
	<table cellpadding="0" cellspacing="0" width="100%" border="0">
220
	<tr>
221
		<td>
222
			<h2><?php echo $HEADING['DELETED_PAGES']; ?></h2>
223
		</td>
224
		<td align="right">
225
				<a href="<?php echo ADMIN_URL; ?>/pages/empty_trash.php">
226
				<img src="<?php echo THEME_URL; ?>/images/delete_16.png" alt="<?php echo $TEXT['PAGE_TRASH']; ?>" border="0" />
227
				<?php echo $TEXT['EMPTY_TRASH']; ?></a>
228
		</td>
229
	</tr>
230
	</table>
231
	<div class="pages_list">
232
	<table cellpadding="1" cellspacing="0" width="720" border="0">
233
	<tr>
234
		<td width="20">
235
			&nbsp;
236
		</td>
237
		<td>
238
			<?php echo $TEXT['PAGE_TITLE']; ?>:
239
		</td>
240
		<td width="198" align="left">
241
			<?php echo $TEXT['MENU_TITLE']; ?>:
242
		</td>
243
		<td width="80" align="center">
244
			<?php echo $TEXT['VISIBILITY']; ?>:
245
		</td>
246
		<td width="90" align="center">
247
			<?php echo $TEXT['ACTIONS']; ?>:
248
		</td>		
249
	</tr>
250
	</table>
251
	<?php
252
	$editable_pages = make_list(0, 0);
253
	?>
254
	</div>
255
	<div class="empty_list">
256
		<?php echo $TEXT['NONE_FOUND']; ?>
257
	</div>
258
	<?php
259
} else {
260
	$editable_pages = 0;
261
}
262

    
263
// Figure out if the no pages found message should be shown or not
264
if($editable_pages == 0) {
265
	?>
266
	<style type="text/css">
267
	.pages_list {
268
		display: none;
269
	}
270
	</style>
271
	<?php
272
} else {
273
	?>
274
	<style type="text/css">
275
	.empty_list {
276
		display: none;
277
	}
278
	</style>
279
	<?php
280
}
281

    
282
?>
283
<br />< <a href="<?php echo ADMIN_URL; ?>/pages/index.php"><?php echo $MESSAGE['PAGES']['RETURN_TO_PAGES']; ?></a>
284
<?php
285

    
286
// Print admin 
287
$admin->print_footer();
288

    
289
?>
(16-16/16)