Project

General

Profile

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