1
|
//:Load the view.php from any other section-module
|
2
|
//:Use [[SectionPicker?sid=123]]
|
3
|
global $database, $wb, $TEXT, $DGTEXT;
|
4
|
$content = '';
|
5
|
$sid = isset($sid) ? intval($sid) : 0;
|
6
|
if( $sid ) {
|
7
|
$sql = 'SELECT `module` FROM `'.TABLE_PREFIX.'sections` ';
|
8
|
$sql .= 'WHERE `section_id`='.$sid;
|
9
|
if (($module = $database->get_one($sql))) {
|
10
|
if (is_readable(WB_PATH.'/modules/'.$module.'/view.php')) {
|
11
|
$_sFrontendCss = '/modules/'.$module.'/frontend.css';
|
12
|
if(is_readable(WB_PATH.$_sFrontendCss)) {
|
13
|
$_sSearch = preg_quote(WB_URL.'/modules/'.$module.'/frontend.css', '/');
|
14
|
if(preg_match('/<link[^>]*?href\s*=\s*\"'.$_sSearch.'\".*?\/>/si', $wb_page_data)) {
|
15
|
$_sFrontendCss = '';
|
16
|
}else {
|
17
|
$_sFrontendCss = '<link href="'.WB_URL.$_sFrontendCss.'" rel="stylesheet" type="text/css" media="screen" />';
|
18
|
}
|
19
|
} else { $_sFrontendCss = ''; }
|
20
|
ob_start();
|
21
|
$oldSid = $section_id; // save old sectionID
|
22
|
$section_id = $sid;
|
23
|
require(WB_PATH.'/modules/'.$module.'/view.php');
|
24
|
$content = $_sFrontendCss.ob_get_clean();
|
25
|
$section_id = $oldSid; // restore old sectionID
|
26
|
}
|
27
|
}
|
28
|
}
|
29
|
return $content;
|