1 |
4
|
ryan
|
<?php
|
2 |
|
|
|
3 |
36
|
stefan
|
// $Id$
|
4 |
4
|
ryan
|
|
5 |
|
|
/*
|
6 |
|
|
|
7 |
|
|
Website Baker Project <http://www.websitebaker.org/>
|
8 |
519
|
Ruebenwurz
|
Copyright (C) 2004-2008, Ryan Djurovich
|
9 |
4
|
ryan
|
|
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 |
|
|
// Get page id
|
27 |
|
|
if(!isset($_GET['page_id']) OR !is_numeric($_GET['page_id'])) {
|
28 |
|
|
header("Location: index.php");
|
29 |
286
|
stefan
|
exit(0);
|
30 |
4
|
ryan
|
} else {
|
31 |
|
|
$page_id = $_GET['page_id'];
|
32 |
|
|
}
|
33 |
|
|
|
34 |
|
|
// Create new admin object
|
35 |
|
|
require('../../config.php');
|
36 |
|
|
require_once(WB_PATH.'/framework/class.admin.php');
|
37 |
|
|
$admin = new admin('Pages', 'pages_modify');
|
38 |
|
|
|
39 |
|
|
// Get perms
|
40 |
319
|
stefan
|
if(!$admin->get_page_permission($page_id,'admin')) {
|
41 |
4
|
ryan
|
$admin->print_error($MESSAGE['PAGES']['INSUFFICIENT_PERMISSIONS']);
|
42 |
|
|
}
|
43 |
|
|
|
44 |
|
|
// Get page details
|
45 |
319
|
stefan
|
$results_array=$admin->get_page_details($page_id);
|
46 |
4
|
ryan
|
|
47 |
|
|
// Get display name of person who last modified the page
|
48 |
319
|
stefan
|
$user=$admin->get_user_details($results_array['modified_by']);
|
49 |
|
|
|
50 |
4
|
ryan
|
// Convert the unix ts for modified_when to human a readable form
|
51 |
|
|
if($results_array['modified_when'] != 0) {
|
52 |
|
|
$modified_ts = gmdate(TIME_FORMAT.', '.DATE_FORMAT, $results_array['modified_when']+TIMEZONE);
|
53 |
|
|
} else {
|
54 |
|
|
$modified_ts = 'Unknown';
|
55 |
|
|
}
|
56 |
|
|
|
57 |
|
|
// Include page info script
|
58 |
|
|
$template = new Template(ADMIN_PATH.'/pages');
|
59 |
|
|
$template->set_file('page', 'modify.html');
|
60 |
|
|
$template->set_block('page', 'main_block', 'main');
|
61 |
|
|
$template->set_var(array(
|
62 |
|
|
'PAGE_ID' => $results_array['page_id'],
|
63 |
442
|
Ruebenwurz
|
'PAGE_TITLE' => ($results_array['page_title']),
|
64 |
4
|
ryan
|
'MODIFIED_BY' => $user['display_name'],
|
65 |
|
|
'MODIFIED_BY_USERNAME' => $user['username'],
|
66 |
|
|
'MODIFIED_WHEN' => $modified_ts,
|
67 |
|
|
'ADMIN_URL' => ADMIN_URL
|
68 |
|
|
)
|
69 |
|
|
);
|
70 |
|
|
if($modified_ts == 'Unknown') {
|
71 |
|
|
$template->set_var('DISPLAY_MODIFIED', 'hide');
|
72 |
|
|
} else {
|
73 |
|
|
$template->set_var('DISPLAY_MODIFIED', '');
|
74 |
|
|
}
|
75 |
|
|
|
76 |
|
|
// Work-out if we should show the "manage sections" link
|
77 |
|
|
$query_sections = $database->query("SELECT section_id FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' AND module = 'menu_link'");
|
78 |
|
|
if($query_sections->numRows() > 0) {
|
79 |
|
|
$template->set_var('DISPLAY_MANAGE_SECTIONS', 'none');
|
80 |
|
|
} elseif(MANAGE_SECTIONS == 'enabled') {
|
81 |
|
|
$template->set_var('TEXT_MANAGE_SECTIONS', $HEADING['MANAGE_SECTIONS']);
|
82 |
|
|
} else {
|
83 |
|
|
$template->set_var('DISPLAY_MANAGE_SECTIONS', 'none');
|
84 |
|
|
}
|
85 |
|
|
|
86 |
|
|
// Insert language TEXT
|
87 |
|
|
$template->set_var(array(
|
88 |
|
|
'TEXT_CURRENT_PAGE' => $TEXT['CURRENT_PAGE'],
|
89 |
|
|
'TEXT_CHANGE_SETTINGS' => $TEXT['CHANGE_SETTINGS'],
|
90 |
|
|
'LAST_MODIFIED' => $MESSAGE['PAGES']['LAST_MODIFIED'],
|
91 |
|
|
'HEADING_MODIFY_PAGE' => $HEADING['MODIFY_PAGE']
|
92 |
|
|
)
|
93 |
|
|
);
|
94 |
|
|
|
95 |
|
|
// Parse and print header template
|
96 |
|
|
$template->parse('main', 'main_block', false);
|
97 |
|
|
$template->pparse('output', 'page');
|
98 |
|
|
|
99 |
|
|
// Get sections for this page
|
100 |
410
|
Ruebenwurz
|
$module_permissions = $_SESSION['MODULE_PERMISSIONS'];
|
101 |
4
|
ryan
|
$query_sections = $database->query("SELECT section_id,module FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' ORDER BY position ASC");
|
102 |
|
|
if($query_sections->numRows() > 0) {
|
103 |
|
|
while($section = $query_sections->fetchRow()) {
|
104 |
|
|
$section_id = $section['section_id'];
|
105 |
|
|
$module = $section['module'];
|
106 |
410
|
Ruebenwurz
|
//Have permission?
|
107 |
|
|
if(!is_numeric(array_search($module, $module_permissions))) {
|
108 |
|
|
// Include the modules editing script if it exists
|
109 |
|
|
if(file_exists(WB_PATH.'/modules/'.$module.'/modify.php')) {
|
110 |
|
|
echo '<a name="'.$section_id.'"></a>';
|
111 |
|
|
require(WB_PATH.'/modules/'.$module.'/modify.php');
|
112 |
|
|
}
|
113 |
4
|
ryan
|
}
|
114 |
|
|
}
|
115 |
|
|
}
|
116 |
|
|
|
117 |
|
|
// Print admin footer
|
118 |
|
|
$admin->print_footer();
|
119 |
|
|
|
120 |
|
|
?>
|