1
|
<?php
|
2
|
/****************************************************************************
|
3
|
* SVN Version information:
|
4
|
*
|
5
|
* $Id: modify.php 1245 2010-01-14 03:25:50Z Luisehahne $
|
6
|
*
|
7
|
*****************************************************************************
|
8
|
* WebsiteBaker
|
9
|
*
|
10
|
* WebsiteBaker Project <http://www.websitebaker2.org/>
|
11
|
* Copyright (C) 2009, Website Baker Org. e.V.
|
12
|
* http://start.websitebaker2.org/impressum-datenschutz.php
|
13
|
* Copyright (C) 2004-2009, Ryan Djurovich
|
14
|
*
|
15
|
* About WebsiteBaker
|
16
|
*
|
17
|
* Website Baker is a PHP-based Content Management System (CMS)
|
18
|
* designed with one goal in mind: to enable its users to produce websites
|
19
|
* with ease.
|
20
|
*
|
21
|
*****************************************************************************
|
22
|
*
|
23
|
*****************************************************************************
|
24
|
* LICENSE INFORMATION
|
25
|
*
|
26
|
* WebsiteBaker is free software; you can redistribute it and/or
|
27
|
* modify it under the terms of the GNU General Public License
|
28
|
* as published by the Free Software Foundation; either version 2
|
29
|
* of the License, or (at your option) any later version.
|
30
|
*
|
31
|
* WebsiteBaker is distributed in the hope that it will be useful,
|
32
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
33
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
34
|
* See the GNU General Public License for more details.
|
35
|
*
|
36
|
* You should have received a copy of the GNU General Public License
|
37
|
* along with this program; if not, write to the Free Software
|
38
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
39
|
****************************************************************************
|
40
|
*
|
41
|
*****************************************************************************
|
42
|
* WebsiteBaker Extra Information
|
43
|
*
|
44
|
*
|
45
|
*
|
46
|
*
|
47
|
*****************************************************************************/
|
48
|
/**
|
49
|
* @category admin
|
50
|
* @package pages
|
51
|
* @author Ryan Djurovich
|
52
|
* @copyright 2004-2009, Ryan Djurovich
|
53
|
* @copyright 2009-2010, Website Baker Org. e.V.
|
54
|
* @version $Id: modify.php 1245 2010-01-14 03:25:50Z Luisehahne $
|
55
|
* @platform WebsiteBaker 2.8.x
|
56
|
* @requirements >= PHP 4.3.4
|
57
|
* @license http://www.gnu.org/licenses/gpl.html
|
58
|
*
|
59
|
*/
|
60
|
|
61
|
// Get page id
|
62
|
if(!isset($_GET['page_id']) OR !is_numeric($_GET['page_id'])) {
|
63
|
header("Location: index.php");
|
64
|
exit(0);
|
65
|
} else {
|
66
|
$page_id = $_GET['page_id'];
|
67
|
}
|
68
|
|
69
|
// Create new admin object
|
70
|
require('../../config.php');
|
71
|
require_once(WB_PATH.'/framework/class.admin.php');
|
72
|
$admin = new admin('Pages', 'pages_modify');
|
73
|
|
74
|
// Get perms
|
75
|
if(!$admin->get_page_permission($page_id,'admin')) {
|
76
|
$admin->print_error($MESSAGE['PAGES']['INSUFFICIENT_PERMISSIONS']);
|
77
|
}
|
78
|
|
79
|
$sectionId = isset($_GET['wysiwyg']) ? htmlspecialchars($admin->get_get('wysiwyg')) : NULL;
|
80
|
|
81
|
// Get page details
|
82
|
$results_array=$admin->get_page_details($page_id);
|
83
|
|
84
|
// Get display name of person who last modified the page
|
85
|
$user=$admin->get_user_details($results_array['modified_by']);
|
86
|
|
87
|
// Convert the unix ts for modified_when to human a readable form
|
88
|
|
89
|
$modified_ts = ($results_array['modified_when'] != 0)
|
90
|
? $modified_ts = gmdate(TIME_FORMAT.', '.DATE_FORMAT, $results_array['modified_when']+TIMEZONE)
|
91
|
: 'Unknown';
|
92
|
|
93
|
// Include page info script
|
94
|
$template = new Template(THEME_PATH.'/templates');
|
95
|
$template->set_file('page', 'pages_modify.htt');
|
96
|
$template->set_block('page', 'main_block', 'main');
|
97
|
$template->set_var(array(
|
98
|
'PAGE_ID' => $results_array['page_id'],
|
99
|
'PAGE_TITLE' => ($results_array['page_title']),
|
100
|
'MENU_TITLE' => ($results_array['menu_title']),
|
101
|
'MODIFIED_BY' => $user['display_name'],
|
102
|
'MODIFIED_BY_USERNAME' => $user['username'],
|
103
|
'MODIFIED_WHEN' => $modified_ts,
|
104
|
'ADMIN_URL' => ADMIN_URL,
|
105
|
'WB_URL' => WB_URL,
|
106
|
'WB_PATH' => WB_PATH,
|
107
|
'THEME_URL' => THEME_URL
|
108
|
)
|
109
|
);
|
110
|
if($modified_ts == 'Unknown') {
|
111
|
$template->set_var('CLASS_DISPLAY_MODIFIED', 'hide');
|
112
|
} else {
|
113
|
$template->set_var('CLASS_DISPLAY_MODIFIED', '');
|
114
|
}
|
115
|
|
116
|
// Work-out if we should show the "manage sections" link
|
117
|
$query_sections = $database->query("SELECT section_id FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' AND module = 'menu_link'");
|
118
|
if($query_sections->numRows() > 0) {
|
119
|
$template->set_var('DISPLAY_MANAGE_SECTIONS', 'display:none;');
|
120
|
} elseif(MANAGE_SECTIONS == 'enabled') {
|
121
|
$template->set_var('TEXT_MANAGE_SECTIONS', $HEADING['MANAGE_SECTIONS']);
|
122
|
} else {
|
123
|
$template->set_var('DISPLAY_MANAGE_SECTIONS', 'display:none;');
|
124
|
}
|
125
|
|
126
|
// Insert language TEXT
|
127
|
$template->set_var(array(
|
128
|
'TEXT_CURRENT_PAGE' => $TEXT['CURRENT_PAGE'],
|
129
|
'TEXT_CHANGE_SETTINGS' => $TEXT['CHANGE_SETTINGS'],
|
130
|
'LAST_MODIFIED' => $MESSAGE['PAGES']['LAST_MODIFIED'],
|
131
|
'HEADING_MODIFY_PAGE' => $HEADING['MODIFY_PAGE']
|
132
|
)
|
133
|
);
|
134
|
|
135
|
// Parse and print header template
|
136
|
$template->parse('main', 'main_block', false);
|
137
|
$template->pparse('output', 'page');
|
138
|
|
139
|
// get template used for the displayed page (for displaying block details)
|
140
|
if (SECTION_BLOCKS)
|
141
|
{
|
142
|
$sql = "SELECT `template` from `" . TABLE_PREFIX . "pages` WHERE `page_id` = '$page_id' ";
|
143
|
$result = $database->query($sql);
|
144
|
if ($result && $result->numRows() == 1) {
|
145
|
$row = $result->fetchRow();
|
146
|
$page_template = ($row['template'] == '') ? DEFAULT_TEMPLATE : $row['template'];
|
147
|
// include template info file if exists
|
148
|
if (file_exists(WB_PATH . '/templates/' . $page_template . '/info.php')) {
|
149
|
include_once(WB_PATH . '/templates/' . $page_template . '/info.php');
|
150
|
}
|
151
|
}
|
152
|
}
|
153
|
|
154
|
// Get sections for this page
|
155
|
$module_permissions = $_SESSION['MODULE_PERMISSIONS'];
|
156
|
// workout for edit only one section for faster pageloading
|
157
|
// Constant later set in wb_settings, in meantime defined in framework/initialize.php
|
158
|
if(defined('EDIT_ONE_SECTION') and EDIT_ONE_SECTION and is_numeric($sectionId))
|
159
|
{
|
160
|
$query_sections = $database->query("SELECT section_id, module, block
|
161
|
FROM ".TABLE_PREFIX."sections WHERE section_id = '$sectionId' ORDER BY position ASC");
|
162
|
}
|
163
|
else
|
164
|
{
|
165
|
$query_sections = $database->query("SELECT section_id, module, block
|
166
|
FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' ORDER BY position ASC");
|
167
|
}
|
168
|
|
169
|
if($query_sections->numRows() > 0)
|
170
|
{
|
171
|
while($section = $query_sections->fetchRow())
|
172
|
{
|
173
|
$section_id = $section['section_id'];
|
174
|
$module = $section['module'];
|
175
|
//Have permission?
|
176
|
if(!is_numeric(array_search($module, $module_permissions)))
|
177
|
{
|
178
|
// Include the modules editing script if it exists
|
179
|
if(file_exists(WB_PATH.'/modules/'.$module.'/modify.php'))
|
180
|
{
|
181
|
print /* '<a name="'.$section_id.'"></a>'. */"\n";
|
182
|
// output block name if blocks are enabled
|
183
|
if (SECTION_BLOCKS) {
|
184
|
if (isset($block[$section['block']]) && trim(strip_tags(($block[$section['block']]))) != '')
|
185
|
{
|
186
|
$block_name = htmlentities(strip_tags($block[$section['block']]));
|
187
|
} else {
|
188
|
if ($section['block'] == 1)
|
189
|
{
|
190
|
$block_name = $TEXT['MAIN'];
|
191
|
} else {
|
192
|
$block_name = '#' . (int) $section['block'];
|
193
|
}
|
194
|
}
|
195
|
print '<div id="wb'.$section['section_id'].'"><b>' . $TEXT['BLOCK'] . ': </b>' . $block_name;
|
196
|
print '<b> Modul: </b>' . $section['module']." ";
|
197
|
print '<b> ID: </b>' . $section_id."</div>\n";
|
198
|
}
|
199
|
require(WB_PATH.'/modules/'.$module.'/modify.php');
|
200
|
}
|
201
|
}
|
202
|
}
|
203
|
}
|
204
|
|
205
|
// Print admin footer
|
206
|
$admin->print_footer();
|
207
|
|
208
|
?>
|