1 |
1163
|
Luisehahne
|
<?php
|
2 |
|
|
|
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 |
|
|
// Get page id
|
27 |
|
|
if(!isset($_GET['page_id']) OR !is_numeric($_GET['page_id'])) {
|
28 |
|
|
header("Location: index.php");
|
29 |
|
|
exit(0);
|
30 |
|
|
} else {
|
31 |
|
|
$page_id = $_GET['page_id'];
|
32 |
|
|
}
|
33 |
|
|
|
34 |
1182
|
Luisehahne
|
|
35 |
|
|
|
36 |
1163
|
Luisehahne
|
// Create new admin object
|
37 |
|
|
require('../../config.php');
|
38 |
|
|
require_once(WB_PATH.'/framework/class.admin.php');
|
39 |
|
|
$admin = new admin('Pages', 'pages_modify');
|
40 |
|
|
|
41 |
|
|
// Get perms
|
42 |
|
|
if(!$admin->get_page_permission($page_id,'admin')) {
|
43 |
|
|
$admin->print_error($MESSAGE['PAGES']['INSUFFICIENT_PERMISSIONS']);
|
44 |
|
|
}
|
45 |
|
|
|
46 |
1182
|
Luisehahne
|
$sectionId = isset($_GET['wysiwyg']) ? htmlspecialchars($admin->get_get('wysiwyg')) : NULL;
|
47 |
|
|
|
48 |
1163
|
Luisehahne
|
// Get page details
|
49 |
|
|
$results_array=$admin->get_page_details($page_id);
|
50 |
|
|
|
51 |
|
|
// Get display name of person who last modified the page
|
52 |
|
|
$user=$admin->get_user_details($results_array['modified_by']);
|
53 |
|
|
|
54 |
|
|
// Convert the unix ts for modified_when to human a readable form
|
55 |
|
|
if($results_array['modified_when'] != 0) {
|
56 |
|
|
$modified_ts = gmdate(TIME_FORMAT.', '.DATE_FORMAT, $results_array['modified_when']+TIMEZONE);
|
57 |
|
|
} else {
|
58 |
|
|
$modified_ts = 'Unknown';
|
59 |
|
|
}
|
60 |
|
|
|
61 |
|
|
// Include page info script
|
62 |
|
|
$template = new Template(THEME_PATH.'/templates');
|
63 |
|
|
$template->set_file('page', 'pages_modify.htt');
|
64 |
|
|
$template->set_block('page', 'main_block', 'main');
|
65 |
|
|
$template->set_var(array(
|
66 |
|
|
'PAGE_ID' => $results_array['page_id'],
|
67 |
|
|
'PAGE_TITLE' => ($results_array['page_title']),
|
68 |
|
|
'MODIFIED_BY' => $user['display_name'],
|
69 |
|
|
'MODIFIED_BY_USERNAME' => $user['username'],
|
70 |
|
|
'MODIFIED_WHEN' => $modified_ts,
|
71 |
|
|
'ADMIN_URL' => ADMIN_URL,
|
72 |
|
|
'WB_URL' => WB_URL,
|
73 |
|
|
'WB_PATH' => WB_PATH,
|
74 |
|
|
'THEME_URL' => THEME_URL
|
75 |
|
|
)
|
76 |
|
|
);
|
77 |
|
|
if($modified_ts == 'Unknown') {
|
78 |
|
|
$template->set_var('DISPLAY_MODIFIED', 'hide');
|
79 |
|
|
} else {
|
80 |
|
|
$template->set_var('DISPLAY_MODIFIED', '');
|
81 |
|
|
}
|
82 |
|
|
|
83 |
|
|
// Work-out if we should show the "manage sections" link
|
84 |
|
|
$query_sections = $database->query("SELECT section_id FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' AND module = 'menu_link'");
|
85 |
|
|
if($query_sections->numRows() > 0) {
|
86 |
|
|
$template->set_var('DISPLAY_MANAGE_SECTIONS', 'none');
|
87 |
|
|
} elseif(MANAGE_SECTIONS == 'enabled') {
|
88 |
|
|
$template->set_var('TEXT_MANAGE_SECTIONS', $HEADING['MANAGE_SECTIONS']);
|
89 |
|
|
} else {
|
90 |
|
|
$template->set_var('DISPLAY_MANAGE_SECTIONS', 'none');
|
91 |
|
|
}
|
92 |
|
|
|
93 |
|
|
// Insert language TEXT
|
94 |
|
|
$template->set_var(array(
|
95 |
|
|
'TEXT_CURRENT_PAGE' => $TEXT['CURRENT_PAGE'],
|
96 |
|
|
'TEXT_CHANGE_SETTINGS' => $TEXT['CHANGE_SETTINGS'],
|
97 |
|
|
'LAST_MODIFIED' => $MESSAGE['PAGES']['LAST_MODIFIED'],
|
98 |
|
|
'HEADING_MODIFY_PAGE' => $HEADING['MODIFY_PAGE']
|
99 |
|
|
)
|
100 |
|
|
);
|
101 |
|
|
|
102 |
|
|
// Parse and print header template
|
103 |
|
|
$template->parse('main', 'main_block', false);
|
104 |
|
|
$template->pparse('output', 'page');
|
105 |
|
|
|
106 |
|
|
// get template used for the displayed page (for displaying block details)
|
107 |
|
|
if (SECTION_BLOCKS)
|
108 |
|
|
{
|
109 |
|
|
$sql = "SELECT `template` from `" . TABLE_PREFIX . "pages` WHERE `page_id` = '$page_id' ";
|
110 |
|
|
$result = $database->query($sql);
|
111 |
|
|
if ($result && $result->numRows() == 1) {
|
112 |
|
|
$row = $result->fetchRow();
|
113 |
|
|
$page_template = ($row['template'] == '') ? DEFAULT_TEMPLATE : $row['template'];
|
114 |
|
|
// include template info file if exists
|
115 |
|
|
if (file_exists(WB_PATH . '/templates/' . $page_template . '/info.php')) {
|
116 |
|
|
include_once(WB_PATH . '/templates/' . $page_template . '/info.php');
|
117 |
|
|
}
|
118 |
|
|
}
|
119 |
|
|
}
|
120 |
|
|
|
121 |
|
|
// Get sections for this page
|
122 |
|
|
$module_permissions = $_SESSION['MODULE_PERMISSIONS'];
|
123 |
1182
|
Luisehahne
|
// workout for edit only one section for faster pageloading
|
124 |
|
|
// Constant later set in wb_settings, in meantime defined in framework/initialize.php
|
125 |
|
|
if(defined('EDIT_ONE_SECTION') and EDIT_ONE_SECTION and is_numeric($sectionId))
|
126 |
|
|
{
|
127 |
1163
|
Luisehahne
|
$query_sections = $database->query("SELECT section_id, module, block
|
128 |
1182
|
Luisehahne
|
FROM ".TABLE_PREFIX."sections WHERE section_id = '$sectionId' ORDER BY position ASC");
|
129 |
|
|
}
|
130 |
|
|
else
|
131 |
|
|
{
|
132 |
|
|
$query_sections = $database->query("SELECT section_id, module, block
|
133 |
1163
|
Luisehahne
|
FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' ORDER BY position ASC");
|
134 |
1182
|
Luisehahne
|
}
|
135 |
|
|
|
136 |
1163
|
Luisehahne
|
if($query_sections->numRows() > 0)
|
137 |
|
|
{
|
138 |
|
|
while($section = $query_sections->fetchRow())
|
139 |
|
|
{
|
140 |
|
|
$section_id = $section['section_id'];
|
141 |
|
|
$module = $section['module'];
|
142 |
|
|
//Have permission?
|
143 |
|
|
if(!is_numeric(array_search($module, $module_permissions)))
|
144 |
|
|
{
|
145 |
|
|
// Include the modules editing script if it exists
|
146 |
|
|
if(file_exists(WB_PATH.'/modules/'.$module.'/modify.php'))
|
147 |
|
|
{
|
148 |
1182
|
Luisehahne
|
print /* '<a name="'.$section_id.'"></a>'. */"\n";
|
149 |
1163
|
Luisehahne
|
// output block name if blocks are enabled
|
150 |
|
|
if (SECTION_BLOCKS) {
|
151 |
|
|
if (isset($block[$section['block']]) && trim(strip_tags(($block[$section['block']]))) != '')
|
152 |
|
|
{
|
153 |
|
|
$block_name = htmlentities(strip_tags($block[$section['block']]));
|
154 |
|
|
} else {
|
155 |
|
|
if ($section['block'] == 1)
|
156 |
|
|
{
|
157 |
|
|
$block_name = $TEXT['MAIN'];
|
158 |
|
|
} else {
|
159 |
|
|
$block_name = '#' . (int) $section['block'];
|
160 |
|
|
}
|
161 |
|
|
}
|
162 |
1206
|
Luisehahne
|
print '<div id="wb'.$section['section_id'].'"><b>' . $TEXT['BLOCK'] . ': </b>' . $block_name;
|
163 |
1163
|
Luisehahne
|
print '<b> Modul: </b>' . $section['module']." ";
|
164 |
1182
|
Luisehahne
|
print '<b> ID: </b>' . $section_id."</div>\n";
|
165 |
1163
|
Luisehahne
|
}
|
166 |
|
|
require(WB_PATH.'/modules/'.$module.'/modify.php');
|
167 |
|
|
}
|
168 |
|
|
}
|
169 |
|
|
}
|
170 |
|
|
}
|
171 |
|
|
|
172 |
|
|
// Print admin footer
|
173 |
|
|
$admin->print_footer();
|
174 |
|
|
|
175 |
4
|
ryan
|
?>
|