Revision 1696
Added by Dietmar about 12 years ago
index.php | ||
---|---|---|
4 | 4 |
* @category frontend |
5 | 5 |
* @package page |
6 | 6 |
* @author WebsiteBaker Project |
7 |
* @copyright 2009-, Website Baker Org. e.V.
|
|
7 |
* @copyright 2009-, WebsiteBaker Org. e.V. |
|
8 | 8 |
* @link http://www.websitebaker2.org/ |
9 | 9 |
* @license http://www.gnu.org/licenses/gpl.html |
10 | 10 |
* @platform WebsiteBaker 2.8.x |
... | ... | |
60 | 60 |
require(WB_PATH.'/framework/frontend.functions.php'); |
61 | 61 |
|
62 | 62 |
// redirect menu-link |
63 |
$this_page_id = PAGE_ID; |
|
63 |
/** |
|
64 |
* |
|
65 |
* Removed the extra handling of menu links in index.php |
|
66 |
* Moved it to the view.php of module menu links. |
|
67 |
* Now the extra functionality of this module is seperated from the |
|
68 |
* core and you can uninstall it if you like. |
|
69 |
* Freeing the core from unnecessary code. |
|
70 |
* |
|
71 |
* |
|
72 |
*/ |
|
64 | 73 |
|
65 |
$php43 = version_compare(phpversion(), '4.3', '>='); |
|
66 |
|
|
67 |
$sql = 'SELECT `module`, `block` FROM `'.TABLE_PREFIX.'sections` '; |
|
68 |
$sql .= 'WHERE `page_id` = '.(int)$this_page_id.' AND `module` = "menu_link"'; |
|
69 |
$query_this_module = $database->query($sql); |
|
70 |
if($query_this_module->numRows() == 1) // This is a menu_link. Get link of target-page and redirect |
|
71 |
{ |
|
72 |
// get target_page_id |
|
73 |
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'mod_menu_link` WHERE `page_id` = '.(int)$this_page_id; |
|
74 |
$query_tpid = $database->query($sql); |
|
75 |
if($query_tpid->numRows() == 1) |
|
76 |
{ |
|
77 |
$res = $query_tpid->fetchRow(); |
|
78 |
$target_page_id = $res['target_page_id']; |
|
79 |
$redirect_type = $res['redirect_type']; |
|
80 |
$anchor = ($res['anchor'] != '0' ? '#'.(string)$res['anchor'] : ''); |
|
81 |
$extern = $res['extern']; |
|
82 |
// set redirect-type |
|
83 |
if($redirect_type == 301) |
|
84 |
{ |
|
85 |
if($php43) |
|
86 |
{ |
|
87 |
@header('HTTP/1.1 301 Moved Permanently', TRUE, 301); |
|
88 |
} |
|
89 |
else |
|
90 |
{ |
|
91 |
@header('HTTP/1.1 301 Moved Permanently'); |
|
92 |
} |
|
93 |
} |
|
94 |
if($target_page_id == -1) |
|
95 |
{ |
|
96 |
if($extern != '') |
|
97 |
{ |
|
98 |
$target_url = $extern.$anchor; |
|
99 |
header('Location: '.$target_url); |
|
100 |
exit; |
|
101 |
} |
|
102 |
} |
|
103 |
else |
|
104 |
{ |
|
105 |
// get link of target-page |
|
106 |
$sql = 'SELECT `link` FROM `'.TABLE_PREFIX.'pages` WHERE `page_id` = '.$target_page_id; |
|
107 |
$target_page_link = $database->get_one($sql); |
|
108 |
if($target_page_link != null) |
|
109 |
{ |
|
110 |
$target_url = WB_URL.PAGES_DIRECTORY.$target_page_link.PAGE_EXTENSION.$anchor; |
|
111 |
header('Location: '.$target_url); |
|
112 |
exit; |
|
113 |
} |
|
114 |
} |
|
115 |
} |
|
116 |
} |
|
117 |
//Get pagecontent in buffer for Droplets and/or Filter operations |
|
118 | 74 |
ob_start(); |
119 | 75 |
require(WB_PATH.'/templates/'.TEMPLATE.'/index.php'); |
120 | 76 |
$output = ob_get_contents(); |
Also available in: Unified diff
move extra handling of menu links in index.php to the view.php of module menu links {Tks to NorHei)