Revision 1289
Added by kweitzel almost 15 years ago
index.php | ||
---|---|---|
1 | 1 |
<?php |
2 |
/** |
|
3 |
* |
|
4 |
* @category admin |
|
5 |
* @package pages |
|
6 |
* @author WebsiteBaker Project |
|
7 |
* @copyright 2004-2009, Ryan Djurovich |
|
8 |
* @copyright 2009-2010, 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 4.3.4 and higher |
|
13 |
* @version $Id$ |
|
14 |
* @filesource $HeadURL: $ |
|
15 |
* @lastmodified $Date: $ |
|
16 |
* |
|
17 |
*/ |
|
2 | 18 |
|
3 |
// $Id$ |
|
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 | 19 |
require('../../config.php'); |
27 | 20 |
require_once(WB_PATH.'/framework/class.admin.php'); |
28 | 21 |
$admin = new admin('Pages', 'pages'); |
29 | 22 |
// Include the WB functions file |
30 | 23 |
require_once(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 |
|
31 | 28 |
|
29 |
|
|
32 | 30 |
function make_list($parent, $editable_pages) { |
33 | 31 |
// Get objects and vars from outside this function |
34 | 32 |
global $admin, $template, $database, $TEXT, $MESSAGE, $HEADING, $page_tmp_id; |
35 | 33 |
?> |
36 | 34 |
<ul id="p<?php echo $parent; ?>" <?php if($parent != 0) { echo 'class="page_list" '; if(isset($_COOKIE['p'.$parent]) && $_COOKIE['p'.$parent] == '1'){ echo 'style="display:block"'; }} ?>> |
37 | 35 |
<?php |
36 |
// $database = new database(); |
|
37 |
|
|
38 | 38 |
// Get page list from database |
39 |
$database = new database(); |
|
40 |
if(PAGE_TRASH != 'inline') { |
|
41 |
$query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE parent = '$parent' AND visibility != 'deleted' ORDER BY position ASC"; |
|
39 |
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'pages` WHERE `parent` = '.$parent; |
|
40 |
$sql .= (PAGE_TRASH != 'inline') ? ' AND `visibility` != "deleted"' : ''; |
|
41 |
$sql .= ' ORDER BY `position` ASC'; |
|
42 |
$get_pages = $database->query($sql); |
|
43 |
/* |
|
44 |
if(PAGE_TRASH != 'inline') |
|
45 |
{ |
|
46 |
$sql = "SELECT * FROM ".TABLE_PREFIX."pages WHERE parent = '$parent' AND visibility != 'deleted' ORDER BY position ASC"; |
|
42 | 47 |
} else { |
43 |
$query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE parent = '$parent' ORDER BY position ASC";
|
|
48 |
$sql = "SELECT * FROM ".TABLE_PREFIX."pages WHERE parent = '$parent' ORDER BY position ASC";
|
|
44 | 49 |
} |
45 |
$get_pages = $database->query($query);
|
|
50 |
*/
|
|
46 | 51 |
// Insert values into main page list |
47 | 52 |
if($get_pages->numRows() > 0) { |
48 | 53 |
while($page = $get_pages->fetchRow()) { |
... | ... | |
50 | 55 |
$admin_groups = explode(',', str_replace('_', '', $page['admin_groups'])); |
51 | 56 |
$admin_users = explode(',', str_replace('_', '', $page['admin_users'])); |
52 | 57 |
$in_group = FALSE; |
53 |
foreach($admin->get_groups_id() as $cur_gid) { |
|
54 |
if (in_array($cur_gid, $admin_groups)) { |
|
58 |
foreach($admin->get_groups_id() as $cur_gid) |
|
59 |
{ |
|
60 |
if (in_array($cur_gid, $admin_groups)) |
|
61 |
{ |
|
55 | 62 |
$in_group = TRUE; |
56 | 63 |
} |
57 | 64 |
} |
58 |
if(($in_group) OR is_numeric(array_search($admin->get_user_id(), $admin_users))) { |
|
59 |
if($page['visibility'] == 'deleted') { |
|
60 |
if(PAGE_TRASH == 'inline') { |
|
65 |
if(($in_group) OR is_numeric(array_search($admin->get_user_id(), $admin_users))) |
|
66 |
{ |
|
67 |
if($page['visibility'] == 'deleted') |
|
68 |
{ |
|
69 |
if(PAGE_TRASH == 'inline') |
|
70 |
{ |
|
61 | 71 |
$can_modify = true; |
62 | 72 |
$editable_pages = $editable_pages+1; |
63 | 73 |
} else { |
64 | 74 |
$can_modify = false; |
65 | 75 |
} |
66 |
} elseif($page['visibility'] != 'deleted') { |
|
76 |
} elseif($page['visibility'] != 'deleted') |
|
77 |
{ |
|
67 | 78 |
$can_modify = true; |
68 | 79 |
$editable_pages = $editable_pages+1; |
69 | 80 |
} |
70 | 81 |
} else { |
71 |
if($page['visibility'] == 'private') { |
|
82 |
if($page['visibility'] == 'private') |
|
83 |
{ |
|
72 | 84 |
continue; |
73 | 85 |
} |
74 | 86 |
else { |
... | ... | |
76 | 88 |
} |
77 | 89 |
} |
78 | 90 |
// Work out if we should show a plus or not |
79 |
if(PAGE_TRASH != 'inline') { |
|
91 |
$sql = 'SELECT `page_id`,`admin_groups`,`admin_users` FROM `'.TABLE_PREFIX.'pages` WHERE `parent` = '.$page['page_id']; |
|
92 |
$sql .= (PAGE_TRASH != 'inline') ? ' AND `visibility` != "deleted"' : ''; |
|
93 |
// $sql .= ' ORDER BY `position` ASC'; |
|
94 |
$get_page_subs = $database->query($sql); |
|
95 |
/* |
|
96 |
if(PAGE_TRASH != 'inline') |
|
97 |
{ |
|
80 | 98 |
$get_page_subs = $database->query("SELECT page_id,admin_groups,admin_users FROM ".TABLE_PREFIX."pages WHERE parent = '".$page['page_id']."' AND visibility!='deleted'"); |
81 | 99 |
} else { |
82 | 100 |
$get_page_subs = $database->query("SELECT page_id,admin_groups,admin_users FROM ".TABLE_PREFIX."pages WHERE parent = '".$page['page_id']."'"); |
83 | 101 |
} |
84 |
if($get_page_subs->numRows() > 0) { |
|
102 |
*/ |
|
103 |
if($get_page_subs->numRows() > 0) |
|
104 |
{ |
|
85 | 105 |
$display_plus = true; |
86 | 106 |
} else { |
87 | 107 |
$display_plus = false; |
... | ... | |
104 | 124 |
?> |
105 | 125 |
</td> |
106 | 126 |
<?php if($admin->get_permission('pages_modify') == true AND $can_modify == true) { ?> |
107 |
<td class="list_page_title">
|
|
127 |
<td class="list_menu_title">
|
|
108 | 128 |
<a href="<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MODIFY']; ?>"> |
109 | 129 |
<?php if($page['visibility'] == 'public') { ?> |
110 | 130 |
<img src="<?php echo THEME_URL; ?>/images/visible_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['PUBLIC']; ?>" class="page_list_rights" /> |
... | ... | |
118 | 138 |
<img src="<?php echo THEME_URL; ?>/images/none_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['NONE']; ?>" class="page_list_rights" /> |
119 | 139 |
<?php } elseif($page['visibility'] == 'deleted') { ?> |
120 | 140 |
<img src="<?php echo THEME_URL; ?>/images/deleted_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['DELETED']; ?>" class="page_list_rights" /> |
121 |
<?php }
|
|
122 |
echo '<span class="modify_link">'.($page['page_title']).'</span>'; ?>
|
|
141 |
<?php } |
|
142 |
echo '<span class="modify_link">'.($page['menu_title']).'</span>'; ?>
|
|
123 | 143 |
</a> |
124 | 144 |
</td> |
125 | 145 |
<?php } else { ?> |
126 |
<td class="list_page_title">
|
|
146 |
<td class="list_menu_title">
|
|
127 | 147 |
<?php if($page['visibility'] == 'public') { ?> |
128 | 148 |
<img src="<?php echo THEME_URL; ?>/images/visible_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['PUBLIC']; ?>" class="page_list_rights" /> |
129 | 149 |
<?php } elseif($page['visibility'] == 'private') { ?> |
... | ... | |
137 | 157 |
<?php } elseif($page['visibility'] == 'deleted') { ?> |
138 | 158 |
<img src="<?php echo THEME_URL; ?>/images/deleted_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['DELETED']; ?>" class="page_list_rights" /> |
139 | 159 |
<?php } |
140 |
echo ($page['page_title']); ?>
|
|
160 |
echo ($page['menu_title']); ?>
|
|
141 | 161 |
</td> |
142 | 162 |
<?php } ?> |
143 |
<td class="list_menu_title">
|
|
144 |
<?php echo ($page['menu_title']); ?>
|
|
163 |
<td class="list_page_title">
|
|
164 |
<?php echo ($page['page_title']); ?>
|
|
145 | 165 |
</td> |
146 | 166 |
<td class="list_page_id"> |
147 | 167 |
<?php echo $page['page_id']; ?> |
... | ... | |
170 | 190 |
<td class="list_actions"> |
171 | 191 |
<?php |
172 | 192 |
// Work-out if we should show the "manage dates" link |
173 |
if(MANAGE_SECTIONS == 'enabled' && $admin->get_permission('pages_modify')==true && $can_modify==true) { |
|
174 |
$query_sections = $database->query("SELECT publ_start, publ_end FROM ".TABLE_PREFIX."sections WHERE page_id = '{$page['page_id']}' AND module != 'menu_link'"); |
|
175 |
if($query_sections->numRows() > 0) { |
|
193 |
if(MANAGE_SECTIONS == 'enabled' && $admin->get_permission('pages_modify')==true && $can_modify==true) |
|
194 |
{ |
|
195 |
|
|
196 |
$sql = 'SELECT `publ_start`, `publ_end` FROM `'.TABLE_PREFIX.'sections`'; |
|
197 |
$sql .= ' WHERE `page_id` = '.$page['page_id'].' AND `module` != "menu_link"'; |
|
198 |
$query_sections = $database->query($sql); |
|
199 |
|
|
200 |
// $query_sections = $database->query("SELECT publ_start, publ_end FROM ".TABLE_PREFIX."sections WHERE page_id = '{$page['page_id']}' AND module != 'menu_link'"); |
|
201 |
|
|
202 |
if($query_sections->numRows() > 0) |
|
203 |
{ |
|
176 | 204 |
$mdate_display=false; |
177 |
while($mdate_res = $query_sections->fetchRow()) { |
|
178 |
if($mdate_res['publ_start']!='0' || $mdate_res['publ_end']!='0') { |
|
205 |
while($mdate_res = $query_sections->fetchRow()) |
|
206 |
{ |
|
207 |
if($mdate_res['publ_start']!='0' || $mdate_res['publ_end']!='0') |
|
208 |
{ |
|
179 | 209 |
$mdate_display=true; |
180 | 210 |
break; |
181 | 211 |
} |
182 | 212 |
} |
183 |
if($mdate_display==1) { |
|
213 |
if($mdate_display==1) |
|
214 |
{ |
|
184 | 215 |
$file=$admin->page_is_active($page)?"clock_16.png":"clock_red_16.png"; |
185 | 216 |
?> |
186 | 217 |
<a href="<?php echo ADMIN_URL; ?>/pages/sections.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $HEADING['MANAGE_SECTIONS']; ?>"> |
187 |
<img src="<?php echo THEME_URL."/images/$file"; ?>" border="0" alt="<?php echo $HEADING['MANAGE_SECTIONS']; ?>" />
|
|
218 |
<img src="<?php echo THEME_URL."/images/$file"; ?>" border="0" alt="<?php echo $HEADING['MANAGE_SECTIONS']; ?>" /> |
|
188 | 219 |
</a> |
189 | 220 |
<?php } else { ?> |
190 | 221 |
<a href="<?php echo ADMIN_URL; ?>/pages/sections.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $HEADING['MANAGE_SECTIONS']; ?>"> |
191 |
<img src="<?php echo THEME_URL; ?>/images/noclock_16.png" border="0" alt="<?php echo $HEADING['MANAGE_SECTIONS']; ?>" /></a>
|
|
222 |
<img src="<?php echo THEME_URL; ?>/images/noclock_16.png" border="0" alt="<?php echo $HEADING['MANAGE_SECTIONS']; ?>" /></a> |
|
192 | 223 |
<?php } ?> |
193 | 224 |
<?php } ?> |
194 | 225 |
<?php } ?> |
... | ... | |
222 | 253 |
</a> |
223 | 254 |
<?php } ?> |
224 | 255 |
</td> |
256 |
<?php |
|
257 |
// eggsurplus: Add action to add a page as a child |
|
258 |
?> |
|
259 |
<td class="list_actions"> |
|
260 |
<?php if($admin->get_permission('pages_delete') == true AND $can_modify == true) { ?> |
|
261 |
<a href="javascript:add_child_page('<?php echo $page['page_id']; ?>');" title="<?php echo $TEXT['ADD']; ?>"> |
|
262 |
<img src="<?php echo THEME_URL; ?>/images/plus_16.png" name="addpage_<?php echo $page['page_id']; ?>" border="0" alt="Add Child Page" /> |
|
263 |
</a> |
|
264 |
<?php } ?> |
|
265 |
</td> |
|
266 |
<?php |
|
267 |
// end [IC] jeggers 2009/10/14: Add action to add a page as a child |
|
268 |
?> |
|
269 |
|
|
225 | 270 |
</tr> |
226 | 271 |
</table> |
227 | 272 |
</li> |
228 | 273 |
<?php |
229 |
if ( $page['parent'] = 0) { |
|
274 |
if ( $page['parent'] = 0) |
|
275 |
{ |
|
230 | 276 |
$page_tmp_id = $page['page_id']; |
231 | 277 |
} |
232 | 278 |
// Get subs |
... | ... | |
268 | 314 |
<div class="pages_list"> |
269 | 315 |
<table cellpadding="0" cellspacing="0" border="0"> |
270 | 316 |
<tr> |
317 |
<td class="header_list_menu_title"> |
|
318 |
<?php echo $TEXT['VISIBILITY'] .' / ' .$TEXT['MENU_TITLE']; ?>: |
|
319 |
</td> |
|
271 | 320 |
<td class="header_list_page_title"> |
272 |
<?php echo $TEXT['VISIBILITY'] .' / ' .$TEXT['PAGE_TITLE']; ?>:
|
|
321 |
<?php echo $TEXT['PAGE_TITLE']; ?>: |
|
273 | 322 |
</td> |
274 |
<td class="header_list_menu_title"> |
|
275 |
<?php echo $TEXT['MENU_TITLE']; ?>: |
|
276 |
</td> |
|
277 | 323 |
<td class="header_list_page_id"> |
278 | 324 |
ID: |
279 | 325 |
</td> |
... | ... | |
283 | 329 |
</tr> |
284 | 330 |
</table> |
285 | 331 |
<?php |
332 |
// Work-out if we should check for existing page_code |
|
333 |
$field_sql = $database->query("DESCRIBE ".TABLE_PREFIX."pages page_code"); |
|
334 |
$field_set = $field_sql->numRows(); |
|
335 |
|
|
286 | 336 |
$page_tmp_id = 0; |
287 | 337 |
$editable_pages = make_list(0, 0); |
288 | 338 |
?> |
... | ... | |
415 | 465 |
$template->parse('group_list2', 'group_list_block2', true); |
416 | 466 |
} |
417 | 467 |
|
468 |
|
|
418 | 469 |
// Parent page list |
419 |
$database = new database(); |
|
420 |
function parent_list($parent) { |
|
421 |
global $admin, $database, $template; |
|
470 |
// $database = new database(); |
|
471 |
function parent_list($parent) |
|
472 |
{ |
|
473 |
global $admin, $database, $template, $field_set; |
|
422 | 474 |
$query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE parent = '$parent' AND visibility!='deleted' ORDER BY position ASC"; |
423 | 475 |
$get_pages = $database->query($query); |
424 | 476 |
while($page = $get_pages->fetchRow()) { |
... | ... | |
426 | 478 |
continue; |
427 | 479 |
// if parent = 0 set flag_icon |
428 | 480 |
$template->set_var('FLAG_ROOT_ICON',' none '); |
429 |
if( $page['parent'] == 0 ) { |
|
481 |
if( $page['parent'] == 0 && $field_set) {
|
|
430 | 482 |
$template->set_var('FLAG_ROOT_ICON','url('.THEME_URL.'/images/flags/'.strtolower($page['language']).'.png)'); |
431 | 483 |
} |
432 | 484 |
// Stop users from adding pages with a level of more than the set page level limit |
... | ... | |
451 | 503 |
for($i = 1; $i <= $page['level']; $i++) { $title_prefix .= ' - '; } |
452 | 504 |
$template->set_var(array( |
453 | 505 |
'ID' => $page['page_id'], |
454 |
'TITLE' => ($title_prefix.$page['page_title']) |
|
506 |
'TITLE' => ($title_prefix.$page['menu_title']), |
|
507 |
'MENU-TITLE' => ($title_prefix.$page['menu_title']), |
|
508 |
'PAGE-TITLE' => ($title_prefix.$page['page_title']) |
|
455 | 509 |
) |
456 | 510 |
); |
457 | 511 |
if($can_modify == true) { |
Also available in: Unified diff
Branch 2.8.1 merged back into Trunk