1 |
2
|
Manuela
|
<?php
|
2 |
|
|
/**
|
3 |
|
|
*
|
4 |
|
|
* @category admin
|
5 |
|
|
* @package pages
|
6 |
|
|
* @author WebsiteBaker Project
|
7 |
|
|
* @copyright Ryan Djurovich
|
8 |
|
|
* @copyright WebsiteBaker Org. e.V.
|
9 |
|
|
* @link http://websitebaker.org/
|
10 |
|
|
* @license http://www.gnu.org/licenses/gpl.html
|
11 |
|
|
* @platform WebsiteBaker 2.8.3
|
12 |
|
|
* @requirements PHP 5.3.6 and higher
|
13 |
|
|
* @version $Id$
|
14 |
|
|
* @filesource $HeadURL$
|
15 |
|
|
* @lastmodified $Date$
|
16 |
|
|
*
|
17 |
|
|
*/
|
18 |
|
|
if ( !defined( 'WB_PATH' ) ){ require( dirname(dirname((__DIR__))).'/config.php' ); }
|
19 |
|
|
if ( !class_exists('admin', false) ) { require(WB_PATH.'/framework/class.admin.php'); }
|
20 |
|
|
$admin = new admin('Pages', 'pages');
|
21 |
|
|
//$admin->clearIDKEY();
|
22 |
|
|
// Include the WB functions file
|
23 |
|
|
require(WB_PATH.'/framework/functions.php');
|
24 |
|
|
// eggsurplus: add child pages for a specific page
|
25 |
|
|
?>
|
26 |
|
|
<script type="text/javascript" src="<?php print ADMIN_URL; ?>/pages/eggsurplus.js"></script>
|
27 |
|
|
<?php
|
28 |
|
|
// fixes A URI contains impermissible characters or quotes around the URI are not closed.
|
29 |
|
|
$MESSAGE['PAGES_DELETE_CONFIRM'] = ($MESSAGE['PAGES_DELETE_CONFIRM']);
|
30 |
|
|
|
31 |
|
|
/**
|
32 |
|
|
* set_node()
|
33 |
|
|
*
|
34 |
|
|
* @return
|
35 |
|
|
*/
|
36 |
|
|
function set_node ($parent,& $par)
|
37 |
|
|
{
|
38 |
|
|
$retval = '';
|
39 |
|
|
if($par['num_subs'] )
|
40 |
|
|
{
|
41 |
|
|
$retval .= "\n".'<ul id="p'.$parent.'"';
|
42 |
|
|
if ($parent != 0)
|
43 |
|
|
{
|
44 |
|
|
$retval .= ' class="page_list draggable"';
|
45 |
|
|
if (isset ($_COOKIE['p'.$parent]) && $_COOKIE['p'.$parent] == '1')
|
46 |
|
|
{
|
47 |
|
|
$retval .= ' style="display:block"';
|
48 |
|
|
}
|
49 |
|
|
} else {
|
50 |
|
|
$retval .= ' class="draggable"';
|
51 |
|
|
}
|
52 |
|
|
$retval .= '>';
|
53 |
|
|
}
|
54 |
|
|
$retval .= ''."\n";
|
55 |
|
|
return $retval;
|
56 |
|
|
}
|
57 |
|
|
|
58 |
|
|
/**
|
59 |
|
|
* make_list()
|
60 |
|
|
*
|
61 |
|
|
* @return
|
62 |
|
|
*/
|
63 |
|
|
function make_list($parent = 0, $editable_pages = 0) {
|
64 |
|
|
// Get objects and vars from outside this function
|
65 |
|
|
global $admin, $template, $database, $TEXT, $MESSAGE, $HEADING, $par;
|
66 |
|
|
print set_node ($parent,$par);
|
67 |
|
|
// Get page list from database
|
68 |
|
|
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'pages` '
|
69 |
|
|
.'WHERE `parent` = '.$parent.' '
|
70 |
|
|
. ((PAGE_TRASH != 'inline') ? 'AND `visibility` != \'deleted\' ' : ' ' )
|
71 |
|
|
. 'ORDER BY `position` ASC';
|
72 |
|
|
$get_pages = $database->query($sql);
|
73 |
|
|
// Insert values into main page list
|
74 |
|
|
if($get_pages->numRows() > 0)
|
75 |
|
|
{
|
76 |
|
|
while($page = $get_pages->fetchRow(MYSQLI_ASSOC))
|
77 |
|
|
{
|
78 |
|
|
// Get user perms
|
79 |
|
|
$admin_groups = explode(',', str_replace('_', '', $page['admin_groups']));
|
80 |
|
|
$admin_users = explode(',', str_replace('_', '', $page['admin_users']));
|
81 |
|
|
$in_group = FALSE;
|
82 |
|
|
foreach($admin->get_groups_id() as $cur_gid)
|
83 |
|
|
{
|
84 |
|
|
if (in_array($cur_gid, $admin_groups))
|
85 |
|
|
{
|
86 |
|
|
$in_group = TRUE;
|
87 |
|
|
}
|
88 |
|
|
}
|
89 |
|
|
if(($in_group) || is_numeric(array_search($admin->get_user_id(), $admin_users)))
|
90 |
|
|
{
|
91 |
|
|
if($page['visibility'] == 'deleted')
|
92 |
|
|
{
|
93 |
|
|
if(PAGE_TRASH == 'inline')
|
94 |
|
|
{
|
95 |
|
|
$can_modify = true;
|
96 |
|
|
$editable_pages = $editable_pages+1;
|
97 |
|
|
} else {
|
98 |
|
|
$can_modify = false;
|
99 |
|
|
}
|
100 |
|
|
} elseif($page['visibility'] != 'deleted')
|
101 |
|
|
{
|
102 |
|
|
$can_modify = true;
|
103 |
|
|
$editable_pages = $editable_pages+1;
|
104 |
|
|
}
|
105 |
|
|
} else {
|
106 |
|
|
if($page['visibility'] == 'private')
|
107 |
|
|
{
|
108 |
|
|
continue;
|
109 |
|
|
} else {
|
110 |
|
|
$can_modify = false;
|
111 |
|
|
}
|
112 |
|
|
}
|
113 |
|
|
// Work out if we should show a plus or not
|
114 |
|
|
$sql = 'SELECT `page_id`,`admin_groups`,`admin_users` FROM `'.TABLE_PREFIX.'pages` WHERE `parent` = '.$page['page_id'].' ';
|
115 |
|
|
$sql .= (PAGE_TRASH != 'inline') ? 'AND `visibility` != \'deleted\' ' : ' ';
|
116 |
|
|
// $sql .= ' ORDER BY `position` ASC';
|
117 |
|
|
$get_page_subs = $database->query($sql);
|
118 |
|
|
$num_subs = $get_page_subs->numRows();
|
119 |
|
|
$par['num_subs'] = $num_subs;
|
120 |
|
|
/*
|
121 |
|
|
if(PAGE_TRASH != 'inline')
|
122 |
|
|
{
|
123 |
|
|
$get_page_subs = $database->query("SELECT page_id,admin_groups,admin_users FROM ".TABLE_PREFIX."pages WHERE parent = '".$page['page_id']."' AND visibility!='deleted'");
|
124 |
|
|
} else {
|
125 |
|
|
$get_page_subs = $database->query("SELECT page_id,admin_groups,admin_users FROM ".TABLE_PREFIX."pages WHERE parent = '".$page['page_id']."'");
|
126 |
|
|
}
|
127 |
|
|
print '<pre class="mod-pre rounded">function <span>'.__FUNCTION__.'( '.''.' );</span> filename: <span>'.basename(__FILE__).'</span> line: '.__LINE__.' -> <br />';
|
128 |
|
|
print_r( $page ); print '</pre>'; flush (); // ob_flush();;sleep(10); die();
|
129 |
|
|
*/
|
130 |
|
|
if($get_page_subs->numRows() > 0)
|
131 |
|
|
{
|
132 |
|
|
$display_plus = true;
|
133 |
|
|
} else {
|
134 |
|
|
$display_plus = false;
|
135 |
|
|
}
|
136 |
|
|
// Work out how many pages there are for this parent
|
137 |
|
|
$num_pages = $get_pages->numRows();
|
138 |
|
|
?>
|
139 |
|
|
<li class="p<?php echo $page['parent']; ?>">
|
140 |
|
|
<table title="<?php echo $TEXT['EXPAND'].'/'.$TEXT['COLLAPSE']; ?>" class="pages_view" >
|
141 |
|
|
<tbody>
|
142 |
|
|
<tr>
|
143 |
|
|
<td class="level_<?php echo $page['level']; ?>" style="width: 0.99525em; padding-left: <?php if($page['level'] > 0){ echo $page['level']*20; } else { echo '0'; } ?>px;">
|
144 |
|
|
<?php
|
145 |
|
|
if($display_plus == true) {
|
146 |
|
|
$img = 'none';
|
147 |
|
|
if (isset($_COOKIE['p'.$page['page_id']]) && $_COOKIE['p'.$page['page_id']] == '1')
|
148 |
|
|
{ $img = 'minus'; } else { $img = 'plus'; };
|
149 |
|
|
?>
|
150 |
|
|
<a onclick="toggle_visibility('p<?php echo $page['page_id']; ?>');" title="<?php echo $TEXT['EXPAND'].'/'.$TEXT['COLLAPSE']; ?>">
|
151 |
|
|
<img src="<?php echo THEME_URL; ?>/images/<?php echo $img; ?>_16.png" onclick="toggle_plus_minus('<?php echo $page['page_id']; ?>');" id="plus_minus_<?php echo $page['page_id']; ?>" alt="+" />
|
152 |
|
|
</a>
|
153 |
|
|
<?php
|
154 |
|
|
} else {
|
155 |
|
|
?>
|
156 |
|
|
<img src="<?php echo THEME_URL; ?>/images/blank.gif" alt="" width="16" />
|
157 |
|
|
<?php
|
158 |
|
|
}
|
159 |
|
|
?>
|
160 |
|
|
</td>
|
161 |
|
|
<?php if ($admin->get_permission('pages_modify') && ($can_modify == true)) { ?>
|
162 |
|
|
<td class="list_menu_title">
|
163 |
|
|
<a href="<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MODIFY']; ?>">
|
164 |
|
|
<?php if($page['visibility'] == 'public') { ?>
|
165 |
|
|
<img src="<?php echo THEME_URL; ?>/images/visible_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['PUBLIC']; ?>" class="page_list_rights" />
|
166 |
|
|
<?php } elseif($page['visibility'] == 'private') { ?>
|
167 |
|
|
<img src="<?php echo THEME_URL; ?>/images/private_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['PRIVATE']; ?>" class="page_list_rights" />
|
168 |
|
|
<?php } elseif($page['visibility'] == 'registered') { ?>
|
169 |
|
|
<img src="<?php echo THEME_URL; ?>/images/keys_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['REGISTERED']; ?>" class="page_list_rights" />
|
170 |
|
|
<?php } elseif($page['visibility'] == 'hidden') { ?>
|
171 |
|
|
<img src="<?php echo THEME_URL; ?>/images/hidden_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['HIDDEN']; ?>" class="page_list_rights" />
|
172 |
|
|
<?php } elseif($page['visibility'] == 'none') { ?>
|
173 |
|
|
<img src="<?php echo THEME_URL; ?>/images/none_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['NONE']; ?>" class="page_list_rights" />
|
174 |
|
|
<?php } elseif($page['visibility'] == 'deleted') { ?>
|
175 |
|
|
<img src="<?php echo THEME_URL; ?>/images/deleted_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['DELETED']; ?>" class="page_list_rights" />
|
176 |
|
|
<?php }
|
177 |
|
|
echo '<span class="modify_link">'.($page['menu_title']).'</span>'; ?>
|
178 |
|
|
</a>
|
179 |
|
|
</td>
|
180 |
|
|
<?php } else { ?>
|
181 |
|
|
<td class="list_menu_title">
|
182 |
|
|
<?php if($page['visibility'] == 'public') { ?>
|
183 |
|
|
<img src="<?php echo THEME_URL; ?>/images/visible_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['PUBLIC']; ?>" class="page_list_rights" />
|
184 |
|
|
<?php } elseif($page['visibility'] == 'private') { ?>
|
185 |
|
|
<img src="<?php echo THEME_URL; ?>/images/private_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['PRIVATE']; ?>" class="page_list_rights" />
|
186 |
|
|
<?php } elseif($page['visibility'] == 'registered') { ?>
|
187 |
|
|
<img src="<?php echo THEME_URL; ?>/images/keys_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['REGISTERED']; ?>" class="page_list_rights" />
|
188 |
|
|
<?php } elseif($page['visibility'] == 'hidden') { ?>
|
189 |
|
|
<img src="<?php echo THEME_URL; ?>/images/hidden_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['HIDDEN']; ?>" class="page_list_rights" />
|
190 |
|
|
<?php } elseif($page['visibility'] == 'none') { ?>
|
191 |
|
|
<img src="<?php echo THEME_URL; ?>/images/none_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['NONE']; ?>" class="page_list_rights" />
|
192 |
|
|
<?php } elseif($page['visibility'] == 'deleted') { ?>
|
193 |
|
|
<img src="<?php echo THEME_URL; ?>/images/deleted_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['DELETED']; ?>" class="page_list_rights" />
|
194 |
|
|
<?php }
|
195 |
|
|
echo ($page['menu_title']); ?>
|
196 |
|
|
</td>
|
197 |
|
|
<?php } ?>
|
198 |
|
|
<td class="list_page_title">
|
199 |
|
|
<?php echo ($page['page_title']); ?>
|
200 |
|
|
</td>
|
201 |
|
|
<td class="list_page_id">
|
202 |
|
|
<?php echo $page['page_id']; ?>
|
203 |
|
|
</td>
|
204 |
|
|
<td class="list_actions">
|
205 |
|
|
<?php if($page['visibility'] != 'deleted' && $page['visibility'] != 'none') { ?>
|
206 |
|
|
<a href="<?php echo $admin->page_link($page['link']); ?>" target="_blank" title="<?php echo $TEXT['VIEW']; ?>">
|
207 |
|
|
<img src="<?php echo THEME_URL; ?>/images/view_16.png" alt="<?php echo $TEXT['VIEW']; ?>" />
|
208 |
|
|
</a>
|
209 |
|
|
<?php } ?>
|
210 |
|
|
</td>
|
211 |
|
|
<td class="list_actions">
|
212 |
|
|
<?php if ($page['visibility'] != 'deleted') { ?>
|
213 |
|
|
<?php if ($admin->get_permission('pages_settings') && ($can_modify == true)) { ?>
|
214 |
|
|
<a href="<?php echo ADMIN_URL; ?>/pages/settings.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['SETTINGS']; ?>">
|
215 |
|
|
<img src="<?php echo THEME_URL; ?>/images/modify_16.png" alt="<?php echo $TEXT['SETTINGS']; ?>" />
|
216 |
|
|
</a>
|
217 |
|
|
<?php } ?>
|
218 |
|
|
<?php } else { ?>
|
219 |
|
|
<a href="<?php echo ADMIN_URL; ?>/pages/restore.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['RESTORE']; ?>">
|
220 |
|
|
<img src="<?php echo THEME_URL; ?>/images/restore_16.png" alt="<?php echo $TEXT['RESTORE']; ?>" />
|
221 |
|
|
</a>
|
222 |
|
|
<?php } ?>
|
223 |
|
|
</td>
|
224 |
|
|
<!-- MANAGE SECTIONS AND DATES BUTTONS -->
|
225 |
|
|
<td class="list_actions">
|
226 |
|
|
<?php
|
227 |
|
|
// Work-out if we should show the "manage dates" link
|
228 |
|
|
if(MANAGE_SECTIONS == 'enabled' && $admin->get_permission('pages_modify')==true && $can_modify==true)
|
229 |
|
|
{
|
230 |
|
|
$bShowSection = false;
|
231 |
|
|
$sql = 'SELECT `publ_start`, `publ_end` FROM `'.TABLE_PREFIX.'sections` '
|
232 |
|
|
. 'WHERE `page_id` = '.$page['page_id'].' AND `module` != \'menu_link\' ';
|
233 |
|
|
// $query_sections = $database->query("SELECT publ_start, publ_end FROM ".TABLE_PREFIX."sections WHERE page_id = '{$page['page_id']}' AND module != 'menu_link'");
|
234 |
|
|
if( ($query_sections = $database->query($sql)) )
|
235 |
|
|
{
|
236 |
|
|
$mdate_display=false;
|
237 |
|
|
while($mdate_res = $query_sections->fetchRow(MYSQLI_ASSOC))
|
238 |
|
|
{
|
239 |
|
|
$bShowSection = true;
|
240 |
|
|
if($mdate_res['publ_start']!='0' || $mdate_res['publ_end']!='0')
|
241 |
|
|
{
|
242 |
|
|
$mdate_display=true;
|
243 |
|
|
break;
|
244 |
|
|
}
|
245 |
|
|
}
|
246 |
|
|
if ($bShowSection) {
|
247 |
|
|
if($mdate_display==1)
|
248 |
|
|
{
|
249 |
|
|
$file=$admin->page_is_active($page)?"clock_16.png":"clock_red_16.png";
|
250 |
|
|
?>
|
251 |
|
|
<a href="<?php echo ADMIN_URL; ?>/pages/sections.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $HEADING['MANAGE_SECTIONS']; ?>">
|
252 |
|
|
<img src="<?php echo THEME_URL."/images/$file"; ?>" alt="<?php echo $HEADING['MANAGE_SECTIONS']; ?>" />
|
253 |
|
|
</a>
|
254 |
|
|
<?php } else { ?>
|
255 |
|
|
<a href="<?php echo ADMIN_URL; ?>/pages/sections.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $HEADING['MANAGE_SECTIONS']; ?>">
|
256 |
|
|
<img src="<?php echo THEME_URL; ?>/images/noclock_16.png" alt="<?php echo $HEADING['MANAGE_SECTIONS']; ?>" /></a>
|
257 |
|
|
<?php }} ?>
|
258 |
|
|
<?php } ?>
|
259 |
|
|
<?php } ?>
|
260 |
|
|
</td>
|
261 |
|
|
<td class="list_actions">
|
262 |
|
|
<?php if($page['position'] != 1) { ?>
|
263 |
|
|
<?php if($page['visibility'] != 'deleted') { ?>
|
264 |
|
|
<?php if($admin->get_permission('pages_settings') == true && $can_modify == true) { ?>
|
265 |
|
|
<a href="<?php echo ADMIN_URL; ?>/pages/move_up.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MOVE_UP']; ?>">
|
266 |
|
|
<img src="<?php echo THEME_URL; ?>/images/up_16.png" alt="<?php echo $TEXT['MOVE_UP']; ?>" />
|
267 |
|
|
</a>
|
268 |
|
|
<?php } ?>
|
269 |
|
|
<?php } ?>
|
270 |
|
|
<?php } ?>
|
271 |
|
|
</td>
|
272 |
|
|
<td class="list_actions">
|
273 |
|
|
<?php if($page['position'] != $num_pages) { ?>
|
274 |
|
|
<?php if($page['visibility'] != 'deleted') { ?>
|
275 |
|
|
<?php if($admin->get_permission('pages_settings') == true && $can_modify == true) { ?>
|
276 |
|
|
<a href="<?php echo ADMIN_URL; ?>/pages/move_down.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MOVE_DOWN']; ?>">
|
277 |
|
|
<img src="<?php echo THEME_URL; ?>/images/down_16.png" alt="<?php echo $TEXT['MOVE_DOWN']; ?>" />
|
278 |
|
|
</a>
|
279 |
|
|
<?php } ?>
|
280 |
|
|
<?php } ?>
|
281 |
|
|
<?php } ?>
|
282 |
|
|
</td>
|
283 |
|
|
<td class="list_actions">
|
284 |
|
|
<?php if($admin->get_permission('pages_delete') && $can_modify == true) { // add IdKey ?>
|
285 |
|
|
<a onclick="confirm_link('<?php echo $MESSAGE['PAGES_DELETE_CONFIRM']; ?>?','<?php echo ADMIN_URL; ?>/pages/delete.php?page_id=<?php echo $admin->getIDKEY($page['page_id']); ?>');" title="<?php echo $TEXT['DELETE']; ?>">
|
286 |
|
|
<img src="<?php echo THEME_URL; ?>/images/delete_16.png" alt="<?php echo $TEXT['DELETE']; ?>" />
|
287 |
|
|
</a>
|
288 |
|
|
<?php } ?>
|
289 |
|
|
</td>
|
290 |
|
|
<?php
|
291 |
|
|
// eggsurplus: Add action to add a page as a child
|
292 |
|
|
?>
|
293 |
|
|
<td class="list_actions">
|
294 |
|
|
<?php if (($admin->get_permission('pages_add') && ($page['visibility'] != 'deleted'))) { ?>
|
295 |
|
|
<a onclick="add_child_page('<?php echo $page['page_id']; ?>');" title="<?php echo $HEADING['ADD_CHILD_PAGE']; ?>">
|
296 |
|
|
<img src="<?php echo THEME_URL; ?>/images/siteadd.png" id="addpage_<?php echo $page['page_id']; ?>" alt="Add Child Page" />
|
297 |
|
|
</a>
|
298 |
|
|
<?php } ?>
|
299 |
|
|
</td>
|
300 |
|
|
<td class="list_actions">
|
301 |
|
|
<?php echo $page['language']; ?>
|
302 |
|
|
</td>
|
303 |
|
|
<?php if (@DEBUG) { ?>
|
304 |
|
|
<!--
|
305 |
|
|
<td class="list_actions">
|
306 |
|
|
<?php echo $page['position']; ?>
|
307 |
|
|
</td>
|
308 |
|
|
-->
|
309 |
|
|
<?php
|
310 |
|
|
}
|
311 |
|
|
// end [IC] jeggers 2009/10/14: Add action to add a page as a child
|
312 |
|
|
?>
|
313 |
|
|
</tr>
|
314 |
|
|
</tbody>
|
315 |
|
|
</table>
|
316 |
|
|
<?php
|
317 |
|
|
if ( $page['parent'] == 0)
|
318 |
|
|
{
|
319 |
|
|
$page_tmp_id = $page['page_id'];
|
320 |
|
|
}
|
321 |
|
|
// Get subs
|
322 |
|
|
$editable_pages = make_list($page['page_id'], $editable_pages);
|
323 |
|
|
print ''."\n";
|
324 |
|
|
?>
|
325 |
|
|
</li>
|
326 |
|
|
<?php
|
327 |
|
|
}
|
328 |
|
|
}
|
329 |
|
|
$output = ($par['num_subs'] )? '</ul>'."\n" : '';
|
330 |
|
|
$par['num_subs'] = (empty($output) ) ? 1 : $par['num_subs'];
|
331 |
|
|
print $output;
|
332 |
|
|
return $editable_pages;
|
333 |
|
|
}
|
334 |
|
|
|
335 |
|
|
// Generate pages list
|
336 |
|
|
if($admin->get_permission('pages_view') == true) {
|
337 |
|
|
?>
|
338 |
|
|
<div class="jsadmin hide"></div>
|
339 |
|
|
<div class="pages_tree">
|
340 |
|
|
<h2 ><?php echo $HEADING['MODIFY_DELETE_PAGE']; ?></h2>
|
341 |
|
|
<div class="pages_list block-outer" >
|
342 |
|
|
<table class="pages_list">
|
343 |
|
|
<thead>
|
344 |
|
|
<tr class="pages_list_header">
|
345 |
|
|
<th class="header_list_menu_title">
|
346 |
|
|
<?php echo $TEXT['VISIBILITY'] .' / ' .$TEXT['MENU_TITLE']; ?>:
|
347 |
|
|
</th>
|
348 |
|
|
<th class="header_list_page_title">
|
349 |
|
|
<?php echo $TEXT['PAGE_TITLE']; ?>:
|
350 |
|
|
</th>
|
351 |
|
|
<th class="header_list_page_id">
|
352 |
|
|
PID:
|
353 |
|
|
</th>
|
354 |
|
|
<th class="header_list_actions">
|
355 |
|
|
<?php echo $TEXT['ACTIONS']; ?>:
|
356 |
|
|
</th>
|
357 |
|
|
<th >
|
358 |
|
|
|
359 |
|
|
</th>
|
360 |
|
|
</tr>
|
361 |
|
|
</thead>
|
362 |
|
|
</table>
|
363 |
|
|
<?php
|
364 |
|
|
// Work-out if we should check for existing page_code
|
365 |
|
|
$field_set = $database->field_exists(TABLE_PREFIX.'pages', 'page_code');
|
366 |
|
|
|
367 |
|
|
$par = array();
|
368 |
|
|
$par['num_subs'] = 1;
|
369 |
|
|
$editable_pages = make_list(0, 0);
|
370 |
|
|
} else {
|
371 |
|
|
$editable_pages = 0;
|
372 |
|
|
}
|
373 |
|
|
?></div><?php
|
374 |
|
|
|
375 |
|
|
if(intval($editable_pages) == 0 ) {
|
376 |
|
|
?>
|
377 |
|
|
<div class="empty_list">
|
378 |
|
|
<?php echo $TEXT['NONE_FOUND']; ?>
|
379 |
|
|
</div>
|
380 |
|
|
<?php
|
381 |
|
|
}
|
382 |
|
|
// Setup template object, parse vars to it, then parse it
|
383 |
|
|
// Create new template object
|
384 |
|
|
$template = new Template(dirname($admin->correct_theme_source('pages.htt')));
|
385 |
|
|
// $template->debug = true;
|
386 |
|
|
$template->set_file('page', 'pages.htt');
|
387 |
|
|
$template->set_block('page', 'main_block', 'main');
|
388 |
|
|
// Insert values into the add page form
|
389 |
|
|
$template->set_var('FTAN', $admin->getFTAN());
|
390 |
|
|
|
391 |
|
|
// Group list 1
|
392 |
|
|
|
393 |
|
|
$query = "SELECT * FROM ".TABLE_PREFIX."groups";
|
394 |
|
|
$get_groups = $database->query($query);
|
395 |
|
|
$template->set_block('main_block', 'group_list_block', 'group_list');
|
396 |
|
|
// Insert admin group and current group first
|
397 |
|
|
$admin_group_name = $get_groups->fetchRow(MYSQLI_ASSOC);
|
398 |
|
|
$template->set_var(array(
|
399 |
|
|
'ID' => 1,
|
400 |
|
|
'TOGGLE' => '1',
|
401 |
|
|
'DISABLED' => ' disabled="disabled"',
|
402 |
|
|
'LINK_COLOR' => '000000',
|
403 |
|
|
'CURSOR' => 'default',
|
404 |
|
|
'NAME' => $admin_group_name['name'],
|
405 |
|
|
'CHECKED' => ' checked="checked"'
|
406 |
|
|
)
|
407 |
|
|
);
|
408 |
|
|
$template->parse('group_list', 'group_list_block', true);
|
409 |
|
|
|
410 |
|
|
while($group = $get_groups->fetchRow(MYSQLI_ASSOC)) {
|
411 |
|
|
// check if the user is a member of this group
|
412 |
|
|
$flag_disabled = '';
|
413 |
|
|
$flag_checked = '';
|
414 |
|
|
$flag_cursor = 'pointer';
|
415 |
|
|
$flag_color = '';
|
416 |
|
|
if (in_array($group["group_id"], $admin->get_groups_id())) {
|
417 |
|
|
$flag_disabled = ''; //' disabled';
|
418 |
|
|
$flag_checked = ' checked="checked"';
|
419 |
|
|
$flag_cursor = 'default';
|
420 |
|
|
$flag_color = '000000';
|
421 |
|
|
}
|
422 |
|
|
|
423 |
|
|
// Check if the group is allowed to edit pages
|
424 |
|
|
$system_permissions = explode(',', $group['system_permissions']);
|
425 |
|
|
if(is_numeric(array_search('pages_modify', $system_permissions))) {
|
426 |
|
|
$template->set_var(array(
|
427 |
|
|
'ID' => $group['group_id'],
|
428 |
|
|
'TOGGLE' => $group['group_id'],
|
429 |
|
|
'CHECKED' => $flag_checked,
|
430 |
|
|
'DISABLED' => $flag_disabled,
|
431 |
|
|
'LINK_COLOR' => $flag_color,
|
432 |
|
|
'CURSOR' => $flag_checked,
|
433 |
|
|
'NAME' => $group['name'],
|
434 |
|
|
)
|
435 |
|
|
);
|
436 |
|
|
$template->parse('group_list', 'group_list_block', true);
|
437 |
|
|
}
|
438 |
|
|
}
|
439 |
|
|
// Group list 2
|
440 |
|
|
|
441 |
|
|
$query = "SELECT * FROM ".TABLE_PREFIX."groups";
|
442 |
|
|
|
443 |
|
|
$get_groups = $database->query($query);
|
444 |
|
|
$template->set_block('main_block', 'group_list_block2', 'group_list2');
|
445 |
|
|
// Insert admin group and current group first
|
446 |
|
|
$admin_group_name = $get_groups->fetchRow(MYSQLI_ASSOC);
|
447 |
|
|
$template->set_var(array(
|
448 |
|
|
'ID' => 1,
|
449 |
|
|
'TOGGLE' => '1',
|
450 |
|
|
'DISABLED' => ' disabled="disabled"',
|
451 |
|
|
'LINK_COLOR' => '000000',
|
452 |
|
|
'CURSOR' => 'default',
|
453 |
|
|
'NAME' => $admin_group_name['name'],
|
454 |
|
|
'CHECKED' => ' checked="checked"'
|
455 |
|
|
)
|
456 |
|
|
);
|
457 |
|
|
$template->parse('group_list2', 'group_list_block2', true);
|
458 |
|
|
|
459 |
|
|
while($group = $get_groups->fetchRow(MYSQLI_ASSOC)) {
|
460 |
|
|
// check if the user is a member of this group
|
461 |
|
|
$flag_disabled = '';
|
462 |
|
|
$flag_checked = '';
|
463 |
|
|
$flag_cursor = 'pointer';
|
464 |
|
|
$flag_color = '';
|
465 |
|
|
if (in_array($group["group_id"], $admin->get_groups_id())) {
|
466 |
|
|
$flag_disabled = ''; //' disabled';
|
467 |
|
|
$flag_checked = ' checked="checked"';
|
468 |
|
|
$flag_cursor = 'default';
|
469 |
|
|
$flag_color = '000000';
|
470 |
|
|
}
|
471 |
|
|
|
472 |
|
|
$template->set_var(array(
|
473 |
|
|
'ID' => $group['group_id'],
|
474 |
|
|
'TOGGLE' => $group['group_id'],
|
475 |
|
|
'CHECKED' => $flag_checked,
|
476 |
|
|
'DISABLED' => $flag_disabled,
|
477 |
|
|
'LINK_COLOR' => $flag_color,
|
478 |
|
|
'CURSOR' => $flag_cursor,
|
479 |
|
|
'NAME' => $group['name'],
|
480 |
|
|
)
|
481 |
|
|
);
|
482 |
|
|
$template->parse('group_list2', 'group_list_block2', true);
|
483 |
|
|
}
|
484 |
|
|
|
485 |
|
|
|
486 |
|
|
// Parent page list
|
487 |
|
|
// $database = new database();
|
488 |
|
|
/**
|
489 |
|
|
* parent_list()
|
490 |
|
|
*
|
491 |
|
|
* @return
|
492 |
|
|
*/
|
493 |
|
|
function parent_list($parent)
|
494 |
|
|
{
|
495 |
|
|
global $admin, $database, $template, $field_set;
|
496 |
|
|
$query = 'SELECT * FROM `'.TABLE_PREFIX.'pages` '
|
497 |
|
|
. 'WHERE `parent` = '.$parent.' '
|
498 |
|
|
. 'AND `visibility` !=\'deleted\' '
|
499 |
|
|
. 'ORDER BY `position` ';
|
500 |
|
|
$get_pages = $database->query($query);
|
501 |
|
|
while($page = $get_pages->fetchRow(MYSQLI_ASSOC)) {
|
502 |
|
|
if($admin->page_is_visible($page)==false) {continue;}
|
503 |
|
|
// if parent = 0 set flag_icon
|
504 |
|
|
$template->set_var('FLAG_ROOT_ICON',' none ');
|
505 |
|
|
if( $page['parent'] == 0 && $field_set) {
|
506 |
|
|
$template->set_var('FLAG_ROOT_ICON','url('.THEME_URL.'/images/flags/'.strtolower($page['language']).'.png)');
|
507 |
|
|
}
|
508 |
|
|
// Stop users from adding pages with a level of more than the set page level limit
|
509 |
|
|
if( $page['level'] <= PAGE_LEVEL_LIMIT + 1 ) {
|
510 |
|
|
// Get user perms
|
511 |
|
|
$admin_groups = explode(',', str_replace('_', '', $page['admin_groups']));
|
512 |
|
|
$admin_users = explode(',', str_replace('_', '', $page['admin_users']));
|
513 |
|
|
|
514 |
|
|
$in_group = FALSE;
|
515 |
|
|
foreach($admin->get_groups_id() as $cur_gid) {
|
516 |
|
|
if (in_array($cur_gid, $admin_groups)) {
|
517 |
|
|
$in_group = TRUE;
|
518 |
|
|
}
|
519 |
|
|
}
|
520 |
|
|
if(($in_group) || is_numeric(array_search($admin->get_user_id(), $admin_users))) {
|
521 |
|
|
$can_modify = true;
|
522 |
|
|
} else {
|
523 |
|
|
$can_modify = false;
|
524 |
|
|
}
|
525 |
|
|
// Title -'s prefix
|
526 |
|
|
$title_prefix = '';
|
527 |
|
|
for($i = 1; $i <= $page['level']; $i++) { $title_prefix .= ' - - '; }
|
528 |
|
|
$template->set_var(array(
|
529 |
|
|
'ID' => $page['page_id'],
|
530 |
|
|
'TITLE' => ($title_prefix.$page['menu_title']),
|
531 |
|
|
'MENU-TITLE' => ($title_prefix.$page['menu_title']),
|
532 |
|
|
'PAGE-TITLE' => ($title_prefix.$page['page_title'])
|
533 |
|
|
));
|
534 |
|
|
if($can_modify == true) {
|
535 |
|
|
$template->set_var('DISABLED', '');
|
536 |
|
|
} else {
|
537 |
|
|
$template->set_var('DISABLED', ' disabled="disabled" class="disabled"');
|
538 |
|
|
}
|
539 |
|
|
$template->parse('page_list2', 'page_list_block2', true);
|
540 |
|
|
}
|
541 |
|
|
parent_list($page['page_id']);
|
542 |
|
|
}
|
543 |
|
|
}
|
544 |
|
|
$template->set_block('main_block', 'page_list_block2', 'page_list2');
|
545 |
|
|
if($admin->get_permission('pages_add_l0') == true) {
|
546 |
|
|
$template->set_var(
|
547 |
|
|
array(
|
548 |
|
|
'ID' => '0',
|
549 |
|
|
'TITLE' => $TEXT['NONE'],
|
550 |
|
|
'SELECTED' => ' selected="selected"',
|
551 |
|
|
'DISABLED' => ''
|
552 |
|
|
)
|
553 |
|
|
);
|
554 |
|
|
$template->parse('page_list2', 'page_list_block2', true);
|
555 |
|
|
}
|
556 |
|
|
parent_list(0);
|
557 |
|
|
// Explode module permissions
|
558 |
|
|
$module_permissions = $_SESSION['MODULE_PERMISSIONS'];
|
559 |
|
|
// Modules list
|
560 |
|
|
$template->set_block('main_block', 'module_list_block', 'module_list');
|
561 |
|
|
$result = $database->query("SELECT * FROM `".TABLE_PREFIX."addons` WHERE `type` = 'module' AND `function` = 'page' ORDER BY `name`");
|
562 |
|
|
if($result->numRows() > 0) {
|
563 |
|
|
while ($module = $result->fetchRow(MYSQLI_ASSOC)) {
|
564 |
|
|
// Check if user is allowed to use this module
|
565 |
|
|
if(!is_numeric(array_search($module['directory'], $module_permissions))) {
|
566 |
|
|
$template->set_var('VALUE', $module['directory']);
|
567 |
|
|
$template->set_var('NAME', $module['name']);
|
568 |
|
|
if($module['directory'] == 'wysiwyg') {
|
569 |
|
|
$template->set_var('SELECTED', ' selected="selected"');
|
570 |
|
|
} else {
|
571 |
|
|
$template->set_var('SELECTED', '');
|
572 |
|
|
}
|
573 |
|
|
$template->parse('module_list', 'module_list_block', true);
|
574 |
|
|
}
|
575 |
|
|
}
|
576 |
|
|
}
|
577 |
|
|
// Insert urls
|
578 |
|
|
$template->set_var(array(
|
579 |
|
|
'THEME_URL' => THEME_URL,
|
580 |
|
|
'WB_URL' => WB_URL,
|
581 |
|
|
'ADMIN_URL' => ADMIN_URL,
|
582 |
|
|
)
|
583 |
|
|
);
|
584 |
|
|
// Insert language headings
|
585 |
|
|
$template->set_var(array(
|
586 |
|
|
'HEADING_ADD_PAGE' => $HEADING['ADD_PAGE'],
|
587 |
|
|
'HEADING_MODIFY_INTRO_PAGE' => $HEADING['MODIFY_INTRO_PAGE']
|
588 |
|
|
)
|
589 |
|
|
);
|
590 |
|
|
// Insert language text and messages
|
591 |
|
|
$template->set_var(array(
|
592 |
|
|
'TEXT_TITLE' => $TEXT['TITLE'],
|
593 |
|
|
'TEXT_TYPE' => $TEXT['TYPE'],
|
594 |
|
|
'TEXT_PARENT' => $TEXT['PARENT'],
|
595 |
|
|
'TEXT_VISIBILITY' => $TEXT['VISIBILITY'],
|
596 |
|
|
'TEXT_PUBLIC' => $TEXT['PUBLIC'],
|
597 |
|
|
'TEXT_PRIVATE' => $TEXT['PRIVATE'],
|
598 |
|
|
'TEXT_REGISTERED' => $TEXT['REGISTERED'],
|
599 |
|
|
'TEXT_HIDDEN' => $TEXT['HIDDEN'],
|
600 |
|
|
'TEXT_NONE' => $TEXT['NONE'],
|
601 |
|
|
'TEXT_NONE_FOUND' => $TEXT['NONE_FOUND'],
|
602 |
|
|
'TEXT_ADD' => $TEXT['ADD'],
|
603 |
|
|
'TEXT_RESET' => $TEXT['RESET'],
|
604 |
|
|
'TEXT_ADMINISTRATORS' => $TEXT['ADMINISTRATORS'],
|
605 |
|
|
'TEXT_PRIVATE_VIEWERS' => $TEXT['PRIVATE_VIEWERS'],
|
606 |
|
|
'TEXT_REGISTERED_VIEWERS' => $TEXT['REGISTERED_VIEWERS'],
|
607 |
|
|
'INTRO_LINK' => $MESSAGE['PAGES']['INTRO_LINK'],
|
608 |
|
|
)
|
609 |
|
|
);
|
610 |
|
|
$template->set_block('main_block', 'add_block', 'add');
|
611 |
|
|
$template->set_block('main_block', 'intro_block', 'intro');
|
612 |
|
|
// Insert permissions values
|
613 |
|
|
if($admin->get_permission('pages_add') != true) {
|
614 |
|
|
$template->set_var('DISPLAY_ADD', 'hide');
|
615 |
|
|
$template->set_block('add', '', '');
|
616 |
|
|
} elseif($admin->get_permission('pages_add_l0') != true && $editable_pages == 0) {
|
617 |
|
|
$template->set_var('DISPLAY_ADD', 'hide');
|
618 |
|
|
$template->set_block('add', '', '');
|
619 |
|
|
} else {
|
620 |
|
|
$template->parse('add', 'add_block', true);
|
621 |
|
|
}
|
622 |
|
|
if($admin->get_permission('pages_intro') != true || INTRO_PAGE != 'enabled') {
|
623 |
|
|
$template->set_var('DISPLAY_INTRO', 'hide');
|
624 |
|
|
$template->set_block('intro', '', '');
|
625 |
|
|
} else {
|
626 |
|
|
$template->parse('intro', 'intro_block', true);
|
627 |
|
|
}
|
628 |
|
|
// Parse template object
|
629 |
|
|
$template->parse('main', 'main_block', false);
|
630 |
|
|
$template->pparse('output', 'page');
|
631 |
|
|
|
632 |
|
|
// include the required file for Javascript admin
|
633 |
|
|
/*
|
634 |
|
|
if(file_exists(WB_PATH.'/modules/jsadmin/jsadmin_backend_include.php'))
|
635 |
|
|
{
|
636 |
|
|
include(WB_PATH.'/modules/jsadmin/jsadmin_backend_include.php');
|
637 |
|
|
}
|
638 |
|
|
*/
|
639 |
|
|
// Print admin
|
640 |
|
|
$admin->print_footer(true);
|