Project

General

Profile

« Previous | Next » 

Revision 1333

Added by Dietmar over 14 years ago

start recoding without style display:none

View differences:

modify.php
17 17
*/
18 18

  
19 19
// Get page id
20
if(!isset($_GET['page_id']) OR !is_numeric($_GET['page_id'])) {
20
if(!isset($_GET['page_id']) || !is_numeric($_GET['page_id'])) {
21 21
	header("Location: index.php");
22 22
	exit(0);
23 23
} else {
......
27 27
// Create new admin object
28 28
require('../../config.php');
29 29
require_once(WB_PATH.'/framework/class.admin.php');
30

  
30 31
$admin = new admin('Pages', 'pages_modify');
31 32

  
32 33
// Get perms
......
52 53
$template = new Template(THEME_PATH.'/templates');
53 54
$template->set_file('page', 'pages_modify.htt');
54 55
$template->set_block('page', 'main_block', 'main');
56

  
55 57
$template->set_var(array(
56
								'PAGE_ID' => $results_array['page_id'],
57
								'PAGE_TITLE' => ($results_array['page_title']),
58
								'MENU_TITLE' => ($results_array['menu_title']),
59
								'MODIFIED_BY' => $user['display_name'],
60
								'MODIFIED_BY_USERNAME' => $user['username'],
61
								'MODIFIED_WHEN' => $modified_ts,
62
								'ADMIN_URL' => ADMIN_URL,
63
								'WB_URL' => WB_URL,
64
								'WB_PATH' => WB_PATH,
65
								'THEME_URL' => THEME_URL
66
								)
67
						);
68
if($modified_ts == 'Unknown') {
58
			'PAGE_ID' => $results_array['page_id'],
59
			'PAGE_TITLE' => ($results_array['page_title']),
60
			'MENU_TITLE' => ($results_array['menu_title']),
61
			'ADMIN_URL' => ADMIN_URL,
62
			'WB_URL' => WB_URL,
63
			'WB_PATH' => WB_PATH,
64
			'THEME_URL' => THEME_URL
65
			));
66

  
67
$template->set_var(array(
68
			'MODIFIED_BY' => $user['display_name'],
69
			'MODIFIED_BY_USERNAME' => $user['username'],
70
			'MODIFIED_WHEN' => $modified_ts,
71
			'LAST_MODIFIED' => $MESSAGE['PAGES']['LAST_MODIFIED'],
72
			));
73

  
74
$template->set_block('main_block', 'show_modify_block', 'show_modify');
75
if($modified_ts == 'Unknown')
76
{
77
    $template->set_block('show_modify', '');
69 78
	$template->set_var('CLASS_DISPLAY_MODIFIED', 'hide');
79

  
70 80
} else {
71 81
	$template->set_var('CLASS_DISPLAY_MODIFIED', '');
82
    $template->parse('show_modify', 'show_modify_block', true);
72 83
}
73 84

  
74 85
// Work-out if we should show the "manage sections" link
75
$query_sections = $database->query("SELECT section_id FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' AND module = 'menu_link'");
76
if($query_sections->numRows() > 0) {
86
$sql  = 'SELECT `section_id` FROM `'.TABLE_PREFIX.'sections` WHERE `page_id` = '.(int)$page_id.' ';
87
$sql .= 'AND `module` = "menu_link"';
88
$query_sections = $database->query($sql);
89

  
90
$template->set_block('main_block', 'show_section_block', 'show_section');
91
if($query_sections->numRows() > 0)
92
{
93
	$template->set_block('show_section', '');
77 94
	$template->set_var('DISPLAY_MANAGE_SECTIONS', 'display:none;');
78
} elseif(MANAGE_SECTIONS == 'enabled') {
95

  
96
} elseif(MANAGE_SECTIONS == 'enabled')
97
{
98

  
79 99
	$template->set_var('TEXT_MANAGE_SECTIONS', $HEADING['MANAGE_SECTIONS']);
100
    $template->parse('show_section', 'show_section_block', true);
101

  
80 102
} else {
103
	$template->set_block('show_section', '');
81 104
	$template->set_var('DISPLAY_MANAGE_SECTIONS', 'display:none;');
105

  
82 106
}
83 107

  
84 108
// Insert language TEXT
85 109
$template->set_var(array(
86
								'TEXT_CURRENT_PAGE' => $TEXT['CURRENT_PAGE'],
87
								'TEXT_CHANGE_SETTINGS' => $TEXT['CHANGE_SETTINGS'],
88
								'LAST_MODIFIED' => $MESSAGE['PAGES']['LAST_MODIFIED'],
89
								'HEADING_MODIFY_PAGE' => $HEADING['MODIFY_PAGE']
90
								)
91
						);
110
				'TEXT_CURRENT_PAGE' => $TEXT['CURRENT_PAGE'],
111
				'TEXT_CHANGE_SETTINGS' => $TEXT['CHANGE_SETTINGS'],
112
				'HEADING_MODIFY_PAGE' => $HEADING['MODIFY_PAGE']
113
				));
92 114

  
93 115
// Parse and print header template
94 116
$template->parse('main', 'main_block', false);
......
103 125
		$row = $result->fetchRow();
104 126
		$page_template = ($row['template'] == '') ? DEFAULT_TEMPLATE : $row['template'];
105 127
		// include template info file if exists
106
		if (file_exists(WB_PATH . '/templates/' . $page_template . '/info.php')) {
128
		if (file_exists(WB_PATH . '/templates/' . $page_template . '/info.php'))
129
		{
107 130
			include_once(WB_PATH . '/templates/' . $page_template . '/info.php');
108 131
		}
109 132
	}
......
113 136
$module_permissions = $_SESSION['MODULE_PERMISSIONS'];
114 137
// workout for edit only one section for faster pageloading
115 138
// Constant later set in wb_settings, in meantime defined in framework/initialize.php
116
if(defined('EDIT_ONE_SECTION') and EDIT_ONE_SECTION and is_numeric($sectionId))
117
{
118
$query_sections = $database->query("SELECT section_id, module, block
119
	FROM ".TABLE_PREFIX."sections WHERE section_id = '$sectionId' ORDER BY position ASC");
120
}
121
else
122
{
123
$query_sections = $database->query("SELECT section_id, module, block
124
	FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' ORDER BY position ASC");
125
}
139
$sql = 'SELECT `section_id`, `module`, `block` FROM `'.TABLE_PREFIX.'sections` ';
126 140

  
141
$sql .= (defined('EDIT_ONE_SECTION') && EDIT_ONE_SECTION && is_numeric($sectionId))
142
		? 'WHERE `section_id` = '.$sectionId
143
		: 'WHERE `page_id` = '.intval($page_id);
144
$sql .= ' ORDER BY position ASC';
145
$query_sections = $database->query($sql);
127 146
if($query_sections->numRows() > 0)
128 147
{
129 148
	while($section = $query_sections->fetchRow())

Also available in: Unified diff