Project

General

Profile

« Previous | Next » 

Revision 1163

Added by Dietmar over 14 years ago

shows more details in wysiwyg editor

View differences:

branches/2.8.x/CHANGELOG
11 11
! = Update/Change
12 12

  
13 13
------------------------------------- 2.8.1 -------------------------------------
14
12-Oct-2009 Dietmar Woellbrink
15
!	shows more details in wysiwyg editor
14 16
10-Oct-2009 Dietmar Woellbrink
15 17
!	small update upgrade.php to reset newsfiles to created dates
16 18
10-Oct-2009 Dietmar Woellbrink
branches/2.8.x/wb/admin/pages/modify.php
1
<?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
// 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
if(!$admin->get_page_permission($page_id,'admin')) {
41
	$admin->print_error($MESSAGE['PAGES']['INSUFFICIENT_PERMISSIONS']);
42
}
43

  
44
// Get page details
45
$results_array=$admin->get_page_details($page_id);
46

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

  
50
// 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(THEME_PATH.'/templates');
59
$template->set_file('page', 'pages_modify.htt');
60
$template->set_block('page', 'main_block', 'main');
61
$template->set_var(array(
62
								'PAGE_ID' => $results_array['page_id'],
63
								'PAGE_TITLE' => ($results_array['page_title']),
64
								'MODIFIED_BY' => $user['display_name'],
65
								'MODIFIED_BY_USERNAME' => $user['username'],
66
								'MODIFIED_WHEN' => $modified_ts,
67
								'ADMIN_URL' => ADMIN_URL,
68
								'WB_URL' => WB_URL,
69
								'WB_PATH' => WB_PATH,
70
								'THEME_URL' => THEME_URL
71
								)
72
						);
73
if($modified_ts == 'Unknown') {
74
	$template->set_var('DISPLAY_MODIFIED', 'hide');
75
} else {
76
	$template->set_var('DISPLAY_MODIFIED', '');
77
}
78

  
79
// Work-out if we should show the "manage sections" link
80
$query_sections = $database->query("SELECT section_id FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' AND module = 'menu_link'");
81
if($query_sections->numRows() > 0) {
82
	$template->set_var('DISPLAY_MANAGE_SECTIONS', 'none');
83
} elseif(MANAGE_SECTIONS == 'enabled') {
84
	$template->set_var('TEXT_MANAGE_SECTIONS', $HEADING['MANAGE_SECTIONS']);
85
} else {
86
	$template->set_var('DISPLAY_MANAGE_SECTIONS', 'none');
87
}
88

  
89
// Insert language TEXT
90
$template->set_var(array(
91
								'TEXT_CURRENT_PAGE' => $TEXT['CURRENT_PAGE'],
92
								'TEXT_CHANGE_SETTINGS' => $TEXT['CHANGE_SETTINGS'],
93
								'LAST_MODIFIED' => $MESSAGE['PAGES']['LAST_MODIFIED'],
94
								'HEADING_MODIFY_PAGE' => $HEADING['MODIFY_PAGE']
95
								)
96
						);
97

  
98
// Parse and print header template
99
$template->parse('main', 'main_block', false);
100
$template->pparse('output', 'page');
101

  
102
// get template used for the displayed page (for displaying block details)
103
if (SECTION_BLOCKS) {
104
	$sql = "SELECT `template` from `" . TABLE_PREFIX . "pages` WHERE `page_id` = '$page_id' ";
105
	$result = $database->query($sql);
106
	if ($result && $result->numRows() == 1) {
107
		$row = $result->fetchRow();
108
		$page_template = ($row['template'] == '') ? DEFAULT_TEMPLATE : $row['template'];
109
		// include template info file if exists
110
		if (file_exists(WB_PATH . '/templates/' . $page_template . '/info.php')) {
111
			include_once(WB_PATH . '/templates/' . $page_template . '/info.php');
112
		}
113
	}
114
}
115
	
116
// Get sections for this page
117
$module_permissions = $_SESSION['MODULE_PERMISSIONS'];
118
$query_sections = $database->query("SELECT section_id, module, block 
119
	FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' ORDER BY position ASC");
120
if($query_sections->numRows() > 0) {
121
	while($section = $query_sections->fetchRow()) {
122
		$section_id = $section['section_id'];
123
		$module = $section['module'];
124
		//Have permission?
125
		if(!is_numeric(array_search($module, $module_permissions))) {
126
			// Include the modules editing script if it exists
127
			if(file_exists(WB_PATH.'/modules/'.$module.'/modify.php')) {
128
				echo '<a name="'.$section_id.'"></a>';
129
				// output block name if blocks are enabled
130
				if (SECTION_BLOCKS) {
131
					if (isset($block[$section['block']]) && trim(strip_tags(($block[$section['block']]))) != '') {
132
						$block_name = htmlentities(strip_tags($block[$section['block']]));
133
					} else {
134
						if ($section['block'] == 1) {
135
							$block_name = $TEXT['MAIN'];
136
						} else {
137
							$block_name = '#' . (int) $section['block'];
138
						}
139
					}
140
					echo '<b>' . $TEXT['BLOCK'] . ': </b>' . $block_name;
141
				}
142
				require(WB_PATH.'/modules/'.$module.'/modify.php');
143
			}
144
		}
145
	}
146
}
147

  
148
// Print admin footer
149
$admin->print_footer();
150

  
1
<?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
// 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
if(!$admin->get_page_permission($page_id,'admin')) {
41
	$admin->print_error($MESSAGE['PAGES']['INSUFFICIENT_PERMISSIONS']);
42
}
43

  
44
// Get page details
45
$results_array=$admin->get_page_details($page_id);
46

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

  
50
// 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(THEME_PATH.'/templates');
59
$template->set_file('page', 'pages_modify.htt');
60
$template->set_block('page', 'main_block', 'main');
61
$template->set_var(array(
62
								'PAGE_ID' => $results_array['page_id'],
63
								'PAGE_TITLE' => ($results_array['page_title']),
64
								'MODIFIED_BY' => $user['display_name'],
65
								'MODIFIED_BY_USERNAME' => $user['username'],
66
								'MODIFIED_WHEN' => $modified_ts,
67
								'ADMIN_URL' => ADMIN_URL,
68
								'WB_URL' => WB_URL,
69
								'WB_PATH' => WB_PATH,
70
								'THEME_URL' => THEME_URL
71
								)
72
						);
73
if($modified_ts == 'Unknown') {
74
	$template->set_var('DISPLAY_MODIFIED', 'hide');
75
} else {
76
	$template->set_var('DISPLAY_MODIFIED', '');
77
}
78

  
79
// Work-out if we should show the "manage sections" link
80
$query_sections = $database->query("SELECT section_id FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' AND module = 'menu_link'");
81
if($query_sections->numRows() > 0) {
82
	$template->set_var('DISPLAY_MANAGE_SECTIONS', 'none');
83
} elseif(MANAGE_SECTIONS == 'enabled') {
84
	$template->set_var('TEXT_MANAGE_SECTIONS', $HEADING['MANAGE_SECTIONS']);
85
} else {
86
	$template->set_var('DISPLAY_MANAGE_SECTIONS', 'none');
87
}
88

  
89
// Insert language TEXT
90
$template->set_var(array(
91
								'TEXT_CURRENT_PAGE' => $TEXT['CURRENT_PAGE'],
92
								'TEXT_CHANGE_SETTINGS' => $TEXT['CHANGE_SETTINGS'],
93
								'LAST_MODIFIED' => $MESSAGE['PAGES']['LAST_MODIFIED'],
94
								'HEADING_MODIFY_PAGE' => $HEADING['MODIFY_PAGE']
95
								)
96
						);
97

  
98
// Parse and print header template
99
$template->parse('main', 'main_block', false);
100
$template->pparse('output', 'page');
101

  
102
// get template used for the displayed page (for displaying block details)
103
if (SECTION_BLOCKS)
104
{
105
	$sql = "SELECT `template` from `" . TABLE_PREFIX . "pages` WHERE `page_id` = '$page_id' ";
106
	$result = $database->query($sql);
107
	if ($result && $result->numRows() == 1) {
108
		$row = $result->fetchRow();
109
		$page_template = ($row['template'] == '') ? DEFAULT_TEMPLATE : $row['template'];
110
		// include template info file if exists
111
		if (file_exists(WB_PATH . '/templates/' . $page_template . '/info.php')) {
112
			include_once(WB_PATH . '/templates/' . $page_template . '/info.php');
113
		}
114
	}
115
}
116

  
117
// Get sections for this page
118
$module_permissions = $_SESSION['MODULE_PERMISSIONS'];
119
$query_sections = $database->query("SELECT section_id, module, block
120
	FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' ORDER BY position ASC");
121
if($query_sections->numRows() > 0)
122
{
123
	while($section = $query_sections->fetchRow())
124
    {
125
		$section_id = $section['section_id'];
126
		$module = $section['module'];
127
		//Have permission?
128
		if(!is_numeric(array_search($module, $module_permissions)))
129
        {
130
			// Include the modules editing script if it exists
131
			if(file_exists(WB_PATH.'/modules/'.$module.'/modify.php'))
132
            {
133
				print '<a name="'.$section_id.'">&nbsp;</a>'."\n";
134
				// output block name if blocks are enabled
135
				if (SECTION_BLOCKS) {
136
					if (isset($block[$section['block']]) && trim(strip_tags(($block[$section['block']]))) != '')
137
                    {
138
						$block_name = htmlentities(strip_tags($block[$section['block']]));
139
					} else {
140
						if ($section['block'] == 1)
141
                        {
142
							$block_name = $TEXT['MAIN'];
143
						} else {
144
							$block_name = '#' . (int) $section['block'];
145
						}
146
					}
147
					print '<b>' . $TEXT['BLOCK'] . ': </b>' . $block_name;
148
					print '<b>  Modul: </b>' . $section['module']." ";
149
					print '<b>  ID: </b>' . $section_id."\n";
150
				}
151
				require(WB_PATH.'/modules/'.$module.'/modify.php');
152
			}
153
		}
154
	}
155
}
156

  
157
// Print admin footer
158
$admin->print_footer();
159

  
151 160
?>

Also available in: Unified diff