Project

General

Profile

1
<?php
2
/*
3
*
4
*                       About WebsiteBaker
5
*
6
* Website Baker is a PHP-based Content Management System (CMS)
7
* designed with one goal in mind: to enable its users to produce websites
8
* with ease.
9
*
10
*                       LICENSE INFORMATION
11
*
12
* WebsiteBaker is free software; you can redistribute it and/or
13
* modify it under the terms of the GNU General Public License
14
* as published by the Free Software Foundation; either version 2
15
* of the License, or (at your option) any later version.
16
*
17
* WebsiteBaker is distributed in the hope that it will be useful,
18
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20
* See the GNU General Public License for more details.
21
*
22
* You should have received a copy of the GNU General Public License
23
* along with this program; if not, write to the Free Software
24
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25
*
26
*                   WebsiteBaker Extra Information
27
*
28
*
29
*/
30
/**
31
 *
32
 * @category        admin
33
 * @package         pages
34
 * @author          WebsiteBaker Project
35
 * @copyright       2004-2009, Ryan Djurovich
36
 * @copyright       2009-2010, Website Baker Org. e.V.
37
 * @link			http://www.websitebaker2.org/
38
 * @license         http://www.gnu.org/licenses/gpl.html
39
 * @platform        WebsiteBaker 2.8.x
40
 * @requirements    PHP 4.3.4 and higher
41
 * @version         $Id: modify.php 1271 2010-01-23 02:30:24Z Luisehahne $
42
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/admin/pages/modify.php $
43
 * @lastmodified    $Date: 2010-01-23 03:30:24 +0100 (Sat, 23 Jan 2010) $
44
 *
45
*/
46

    
47
// Get page id
48
if(!isset($_GET['page_id']) OR !is_numeric($_GET['page_id'])) {
49
	header("Location: index.php");
50
	exit(0);
51
} else {
52
	$page_id = $_GET['page_id'];
53
}
54

    
55
// Create new admin object
56
require('../../config.php');
57
require_once(WB_PATH.'/framework/class.admin.php');
58
$admin = new admin('Pages', 'pages_modify');
59

    
60
// Get perms
61
if(!$admin->get_page_permission($page_id,'admin')) {
62
	$admin->print_error($MESSAGE['PAGES']['INSUFFICIENT_PERMISSIONS']);
63
}
64

    
65
$sectionId = isset($_GET['wysiwyg']) ? htmlspecialchars($admin->get_get('wysiwyg')) : NULL;
66

    
67
// Get page details
68
$results_array=$admin->get_page_details($page_id);
69

    
70
// Get display name of person who last modified the page
71
$user=$admin->get_user_details($results_array['modified_by']);
72

    
73
// Convert the unix ts for modified_when to human a readable form
74

    
75
$modified_ts = ($results_array['modified_when'] != 0)
76
        ? $modified_ts = gmdate(TIME_FORMAT.', '.DATE_FORMAT, $results_array['modified_when']+TIMEZONE)
77
        : 'Unknown';
78

    
79
// Include page info script
80
$template = new Template(THEME_PATH.'/templates');
81
$template->set_file('page', 'pages_modify.htt');
82
$template->set_block('page', 'main_block', 'main');
83
$template->set_var(array(
84
								'PAGE_ID' => $results_array['page_id'],
85
								'PAGE_TITLE' => ($results_array['page_title']),
86
								'MENU_TITLE' => ($results_array['menu_title']),
87
								'MODIFIED_BY' => $user['display_name'],
88
								'MODIFIED_BY_USERNAME' => $user['username'],
89
								'MODIFIED_WHEN' => $modified_ts,
90
								'ADMIN_URL' => ADMIN_URL,
91
								'WB_URL' => WB_URL,
92
								'WB_PATH' => WB_PATH,
93
								'THEME_URL' => THEME_URL
94
								)
95
						);
96
if($modified_ts == 'Unknown') {
97
	$template->set_var('CLASS_DISPLAY_MODIFIED', 'hide');
98
} else {
99
	$template->set_var('CLASS_DISPLAY_MODIFIED', '');
100
}
101

    
102
// Work-out if we should show the "manage sections" link
103
$query_sections = $database->query("SELECT section_id FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' AND module = 'menu_link'");
104
if($query_sections->numRows() > 0) {
105
	$template->set_var('DISPLAY_MANAGE_SECTIONS', 'display:none;');
106
} elseif(MANAGE_SECTIONS == 'enabled') {
107
	$template->set_var('TEXT_MANAGE_SECTIONS', $HEADING['MANAGE_SECTIONS']);
108
} else {
109
	$template->set_var('DISPLAY_MANAGE_SECTIONS', 'display:none;');
110
}
111

    
112
// Insert language TEXT
113
$template->set_var(array(
114
								'TEXT_CURRENT_PAGE' => $TEXT['CURRENT_PAGE'],
115
								'TEXT_CHANGE_SETTINGS' => $TEXT['CHANGE_SETTINGS'],
116
								'LAST_MODIFIED' => $MESSAGE['PAGES']['LAST_MODIFIED'],
117
								'HEADING_MODIFY_PAGE' => $HEADING['MODIFY_PAGE']
118
								)
119
						);
120

    
121
// Parse and print header template
122
$template->parse('main', 'main_block', false);
123
$template->pparse('output', 'page');
124

    
125
// get template used for the displayed page (for displaying block details)
126
if (SECTION_BLOCKS)
127
{
128
	$sql = "SELECT `template` from `" . TABLE_PREFIX . "pages` WHERE `page_id` = '$page_id' ";
129
	$result = $database->query($sql);
130
	if ($result && $result->numRows() == 1) {
131
		$row = $result->fetchRow();
132
		$page_template = ($row['template'] == '') ? DEFAULT_TEMPLATE : $row['template'];
133
		// include template info file if exists
134
		if (file_exists(WB_PATH . '/templates/' . $page_template . '/info.php')) {
135
			include_once(WB_PATH . '/templates/' . $page_template . '/info.php');
136
		}
137
	}
138
}
139

    
140
// Get sections for this page
141
$module_permissions = $_SESSION['MODULE_PERMISSIONS'];
142
// workout for edit only one section for faster pageloading
143
// Constant later set in wb_settings, in meantime defined in framework/initialize.php
144
if(defined('EDIT_ONE_SECTION') and EDIT_ONE_SECTION and is_numeric($sectionId))
145
{
146
$query_sections = $database->query("SELECT section_id, module, block
147
	FROM ".TABLE_PREFIX."sections WHERE section_id = '$sectionId' ORDER BY position ASC");
148
}
149
else
150
{
151
$query_sections = $database->query("SELECT section_id, module, block
152
	FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' ORDER BY position ASC");
153
}
154

    
155
if($query_sections->numRows() > 0)
156
{
157
	while($section = $query_sections->fetchRow())
158
    {
159
		$section_id = $section['section_id'];
160
		$module = $section['module'];
161
		//Have permission?
162
		if(!is_numeric(array_search($module, $module_permissions)))
163
        {
164
			// Include the modules editing script if it exists
165
			if(file_exists(WB_PATH.'/modules/'.$module.'/modify.php'))
166
            {
167
				print /* '<a name="'.$section_id.'"></a>'. */"\n";
168
				// output block name if blocks are enabled
169
				if (SECTION_BLOCKS) {
170
					if (isset($block[$section['block']]) && trim(strip_tags(($block[$section['block']]))) != '')
171
                    {
172
						$block_name = htmlentities(strip_tags($block[$section['block']]));
173
					} else {
174
						if ($section['block'] == 1)
175
                        {
176
							$block_name = $TEXT['MAIN'];
177
						} else {
178
							$block_name = '#' . (int) $section['block'];
179
						}
180
					}
181
					print '<div id="wb'.$section['section_id'].'"><b>' . $TEXT['BLOCK'] . ': </b>' . $block_name;
182
					print '<b>  Modul: </b>' . $section['module']." ";
183
					print '<b>  ID: </b>' . $section_id."</div>\n";
184
				}
185
				require(WB_PATH.'/modules/'.$module.'/modify.php');
186
			}
187
		}
188
	}
189
}
190

    
191
// Print admin footer
192
$admin->print_footer();
193

    
194
?>
(8-8/21)