Project

General

Profile

« Previous | Next » 

Revision 1621

Added by darkviper over 12 years ago

Droplet [SectionPicker] fixed
Added new droplets [ShowWysiwyg] and [ShowRandomWysiwyg]

View differences:

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

Also available in: Unified diff