Project

General

Profile

« Previous | Next » 

Revision 48

Added by stefan about 19 years ago

Fixed minor compatibility bug

View differences:

trunk/wb/framework/compatibility.php
1
<?php
2

  
3
// $Id$
4

  
5
/*
6

  
7
 Website Baker Project <http://www.websitebaker.org/>
8
 Copyright (C) 2004-2005, 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
/*
27
	This file is purely for ensuring compatibility with 3rd party
28
	contributions made for WB version 2.5.2 or below
29
*/
30
if(!defined('WB_URL')) {
31
	header('Location: ../index.php');
32
}
33

  
34
function page_link($link) {
35
	global $wb;
36
	$wb->page_link($link);
37
}
38

  
39

  
40
function page_content($block=1) {
41
	global $wb;
42
	$wb->page_content($block);
43
}
44

  
45
// Old menu call invokes new menu function
46
function page_menu($parent = 0, $menu_number = 1, $item_template = '<li><span[class]>[a][menu_title][/a]</span>', $menu_header = '<ul>', $menu_footer = '</ul>', $default_class = ' class="menu_default"', $current_class = ' class="menu_current"', $recurse = LEVEL) {
47
	global $wb;
48
	$wb->menu_number=$menu_number;
49
	$wb->menu_item_template=$item_template;
50
	$wb->menu_parent = $parent;
51
	$wb->menu_header = $menu_header; 
52
	$wb->menu_footer = $menu_footer;
53
	$wb->menu_default_class = $default_class;
54
	$wb->menu_current_class = $current_class;
55
	$wb->menu_recurse = $recurse+2; 	
56
	$wb->menu();
57
}
58

  
59
// Function for page title
60
function page_title($spacer = ' - ', $template = '[WEBSITE_TITLE][SPACER][PAGE_TITLE]') {
61
	global $wb;
62
	$wb->page_title($spacer,$template);
63
}
64

  
65
// Function for page description
66
function page_description() {
67
	global $wb;
68
	$wb->page_description();
69
}
70
// Function for page keywords
71
function page_keywords() {
72
	global $wb;
73
	$wb->page_keywords();
74
}
75
// Function for page header
76
function page_header($date_format = 'Y') {
77
	global $wb;
78
	$wb->page_header($date_format);
79
}
80
// Function for page footer
81
function page_footer($date_format = 'Y') {
82
	global $wb;
83
	$wb->page_footer($date_format);
84
}
85

  
86
// references to objects and variables that changed their names
87

  
88
$admin = &$wb;
89

  
90
$default_link=&$wb->default_link;
91

  
92
$page_trail=&$wb->page_trail;
93
$page_description=&$wb->page_description;
94
$page_keywords=&$wb->page_keywords;
95
$page_link=&$wb->link;
96

  
97
// extra_sql is not used anymore - this is basically a register_globals exploit prevention...
98
$extra_sql=&$wb->extra_sql;
99
$extra_where_sql=&$wb->extra_where_sql;
100

  
101

  
102
// Begin WB < 2.4.x template compatibility code
103
	// Make extra_sql accessable through private_sql
104
	$private_sql = $extra_sql;
105
	$private_where_sql = $extra_where_sql;
106
	// Query pages for menu
107
	$menu1 = $database->query("SELECT page_id,menu_title,page_title,link,target,visibility$extra_sql FROM ".TABLE_PREFIX."pages WHERE parent = '0' AND $extra_where_sql ORDER BY position ASC");
108
	// Check if current pages is a parent page and if we need its submenu
109
	if(PARENT == 0) {
110
		// Get the pages submenu
111
		$menu2 = $database->query("SELECT page_id,menu_title,page_title,link,target,visibility$extra_sql FROM ".TABLE_PREFIX."pages WHERE parent = '".PAGE_ID."' AND $extra_where_sql ORDER BY position ASC");
112
	} else {
113
		// Get the pages submenu
114
		$menu2 = $database->query("SELECT page_id,menu_title,page_title,link,target,visibility$extra_sql FROM ".TABLE_PREFIX."pages WHERE parent = '".PARENT."' AND $extra_where_sql ORDER BY position ASC");
115
	}
116
// End WB < 2.4.x template compatibility code
117
// Include template file
118

  
119

  
120
?>
1
<?php
2

  
3
// $Id$
4

  
5
/*
6

  
7
 Website Baker Project <http://www.websitebaker.org/>
8
 Copyright (C) 2004-2005, 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
/*
27
	This file is purely for ensuring compatibility with 3rd party
28
	contributions made for WB version 2.5.2 or below
29
*/
30
if(!defined('WB_URL')) {
31
	header('Location: ../index.php');
32
}
33

  
34
function page_link($link) {
35
	global $wb;
36
	return $wb->page_link($link);
37
}
38

  
39

  
40
function page_content($block=1) {
41
	global $wb;
42
	$wb->page_content($block);
43
}
44

  
45
// Old menu call invokes new menu function
46
function page_menu($parent = 0, $menu_number = 1, $item_template = '<li><span[class]>[a][menu_title][/a]</span>', $menu_header = '<ul>', $menu_footer = '</ul>', $default_class = ' class="menu_default"', $current_class = ' class="menu_current"', $recurse = LEVEL) {
47
	global $wb;
48
	$wb->menu_number=$menu_number;
49
	$wb->menu_item_template=$item_template;
50
	$wb->menu_parent = $parent;
51
	$wb->menu_header = $menu_header; 
52
	$wb->menu_footer = $menu_footer;
53
	$wb->menu_default_class = $default_class;
54
	$wb->menu_current_class = $current_class;
55
	$wb->menu_recurse = $recurse+2; 	
56
	$wb->menu();
57
}
58

  
59
// Function for page title
60
function page_title($spacer = ' - ', $template = '[WEBSITE_TITLE][SPACER][PAGE_TITLE]') {
61
	global $wb;
62
	$wb->page_title($spacer,$template);
63
}
64

  
65
// Function for page description
66
function page_description() {
67
	global $wb;
68
	$wb->page_description();
69
}
70
// Function for page keywords
71
function page_keywords() {
72
	global $wb;
73
	$wb->page_keywords();
74
}
75
// Function for page header
76
function page_header($date_format = 'Y') {
77
	global $wb;
78
	$wb->page_header($date_format);
79
}
80
// Function for page footer
81
function page_footer($date_format = 'Y') {
82
	global $wb;
83
	$wb->page_footer($date_format);
84
}
85

  
86
// references to objects and variables that changed their names
87

  
88
$admin = &$wb;
89

  
90
$default_link=&$wb->default_link;
91

  
92
$page_trail=&$wb->page_trail;
93
$page_description=&$wb->page_description;
94
$page_keywords=&$wb->page_keywords;
95
$page_link=&$wb->link;
96

  
97
// extra_sql is not used anymore - this is basically a register_globals exploit prevention...
98
$extra_sql=&$wb->extra_sql;
99
$extra_where_sql=&$wb->extra_where_sql;
100

  
101

  
102
// Begin WB < 2.4.x template compatibility code
103
	// Make extra_sql accessable through private_sql
104
	$private_sql = $extra_sql;
105
	$private_where_sql = $extra_where_sql;
106
	// Query pages for menu
107
	$menu1 = $database->query("SELECT page_id,menu_title,page_title,link,target,visibility$extra_sql FROM ".TABLE_PREFIX."pages WHERE parent = '0' AND $extra_where_sql ORDER BY position ASC");
108
	// Check if current pages is a parent page and if we need its submenu
109
	if(PARENT == 0) {
110
		// Get the pages submenu
111
		$menu2 = $database->query("SELECT page_id,menu_title,page_title,link,target,visibility$extra_sql FROM ".TABLE_PREFIX."pages WHERE parent = '".PAGE_ID."' AND $extra_where_sql ORDER BY position ASC");
112
	} else {
113
		// Get the pages submenu
114
		$menu2 = $database->query("SELECT page_id,menu_title,page_title,link,target,visibility$extra_sql FROM ".TABLE_PREFIX."pages WHERE parent = '".PARENT."' AND $extra_where_sql ORDER BY position ASC");
115
	}
116
// End WB < 2.4.x template compatibility code
117
// Include template file
118

  
119

  
120
?>

Also available in: Unified diff