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:

branches/2.8.x/CHANGELOG
11 11
! = Update/Change
12 12
===============================================================================
13 13

  
14
24 Feb-2012 Build 1621 Werner v.d.Decken(DarkViper)
15
# Droplet [SectionPiocker] fixed
16
+ Added new droplets [ShowWysiwyg] and [ShowRandomWysiwyg]
14 17
24 Feb-2012 Build 1620 Dietmar Woellbrink (Luisehahne)
15 18
# fixed FCKeditor lang files to utf-8 (Tks to Ruebenwurzel
16 19
24 Feb-2012 Build 1619 Dietmar Woellbrink (Luisehahne)
branches/2.8.x/wb/admin/interface/version.php
51 51

  
52 52
// check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled)
53 53
if(!defined('VERSION')) define('VERSION', '2.8.3');
54
if(!defined('REVISION')) define('REVISION', '1620');
54
if(!defined('REVISION')) define('REVISION', '1621');
55 55
if(!defined('SP')) define('SP', '');
branches/2.8.x/wb/modules/droplets/example/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;
branches/2.8.x/wb/modules/droplets/example/ShowWysiwyg.php
1
//:Display one defined WYSIWYG section
2
//:Use [[ShowSection?section=10]]
3
global $database;
4
	$content = '';
5
	$section = isset($section) ? intval($section) : 0;
6
	if ($section) {
7
		if (is_readable(WB_PATH.'/modules/wysiwyg/view.php')) {
8
		// if valid section is given and module wysiwyg is installed
9
			$iOldSectionId = intval($section_id); // save old SectionID
10
			$section_id = $section;
11
			ob_start(); // generate output by regulary wysiwyg module
12
			require(WB_PATH.'/modules/wysiwyg/view.php');
13
			$content = ob_get_clean();
14
			$section_id = $ioldSectionId; // restore old SectionId
15
		}
16
	}
17
return $content;
0 18

  
branches/2.8.x/wb/modules/droplets/example/ShowRandomWysiwyg.php
1
//:Randomly display one WYSIWYG section from a given list
2
//:Use [[ShowRandomWysiwyg?section=10,12,15,20]] possible Delimiters: [ ,;:|-+#/ ]
3
global $database;
4
	$content = '';
5
	if (isset($section)) {
6
		if( preg_match('/^[0-9]+(?:\s*\[\,\|\-\;\:\+\#\/]\s*[0-9]+\s*)*$/', $section)) {
7
			if (is_readable(WB_PATH.'/modules/wysiwyg/view.php')) {
8
			// if valid arguments given and module wysiwyg is installed
9
				$iOldSectionId = intval($section_id); // save old SectionId
10
				// split and sanitize arguments
11
				$aSections = preg_split('/[\s\,\|\-\;\:\+\#\/]+/', $section);
12
				$section_id = $sections[array_rand($sections)]; // get random element
13
				ob_start(); // generate output by wysiwyg module
14
				require(WB_PATH.'/modules/wysiwyg/view.php');
15
				$content = ob_get_clean();
16
				$section_id = $ioldSectionId; // restore old SectionId
17
			}
18
		}
19
	}
20
return $content;
0 21

  

Also available in: Unified diff