Project

General

Profile

« Previous | Next » 

Revision 2032

Added by Dietmar almost 11 years ago

! /modules/droplets/example/ update some droplets and remove the old ones

View differences:

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

  
14
16 Dec-2013 Build 2032 Dietmar Woellbrink (Luisehahne)
15
! /modules/droplets/example/ update some droplets and remove the old ones
14 16
15 Dec-2013 Build 2031 Dietmar Woellbrink (Luisehahne)
15 17
# /search/search.php:: trim() parameter (Tks to evaki)
16 18
# /search/search_mod.php:: check for undefined users index
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', '2031');
54
if(!defined('REVISION')) define('REVISION', '2032');
55 55
if(!defined('SP')) define('SP', '');
branches/2.8.x/wb/modules/droplets/example/LoginBox.php
1
//:Puts a Login / Logout box on your page.
2
//:Use: [[LoginBox?redirect=url]]
3
//:Absolute or relative url possible
4
//:Remember to enable frontend login in your website settings.
5

  
6
	global $page_id,$TEXT, $MENU, $HEADING;
7

  
8
	$return_value = '<div class="login-box">'."\n";
9
	$return_admin = ' ';
10
	$wb = new admin ('Start', 'start', false, false);
11
// Get redirect
12
	$redirect_url = ((isset($_SESSION['HTTP_REFERER']) && $_SESSION['HTTP_REFERER'] != '') ? $_SESSION['HTTP_REFERER'] : WB_URL );
13
   	$redirect_url = (isset($redirect) && ($redirect!='') ? $redirect : $redirect_url);
14

  
15
	if ( ( FRONTEND_LOGIN == 'enabled') &&
16
		    ( VISIBILITY != 'private') &&
17
		        ( $wb->get_session('USER_ID') == '')  )
18
	{
19
		$return_value .= '<form action="'.LOGIN_URL.'" method="post">'."\n";
20
		$return_value .= '<input type="hidden" name="redirect" value="'.$redirect_url.'" />'."\n";
21

  
22
    	$return_value .= '<fieldset>'."\n";
23
		$return_value .= '<h1>'.$TEXT['LOGIN'].'</h1>'."\n";
24
		$return_value .= '<label for="username">'.$TEXT['USERNAME'].':</label>'."\n";
25
		$return_value .= '<p><input type="text" name="username" id="username"  /></p>'."\n";
26
		$return_value .= '<label for="password">'.$TEXT['PASSWORD'].':</label>'."\n";
27
		$return_value .= '<p><input type="password" name="password" id="password"/></p>'."\n";
28
		$return_value .= '<p><input type="submit" id="submit" value="'.$TEXT['LOGIN'].'" class="dbutton" /></p>'."\n";
29
    	$return_value .= '<ul class="login-advance">'."\n";
30
		$return_value .= '<li class="forgot"><a href="'.FORGOT_URL.'"><span>'.$TEXT['FORGOT_DETAILS'].'</span></a></li>'."\n";
31

  
32
		if (intval(FRONTEND_SIGNUP) > 0)
33
	    {
34
	        $return_value .= '<li class="sign"><a href="'.SIGNUP_URL.'">'.$TEXT['SIGNUP'].'</a></li>'."\n";
35
	    }
36
	    $return_value .= '</ul>'."\n";
37
	    $return_value .= '</fieldset>'."\n";
38
		$return_value .= '</form>'."\n";
39

  
40
	} elseif( (FRONTEND_LOGIN == true) &&
41
				(is_numeric($wb->get_session('USER_ID'))) )
42
	{
43
		$return_value .= '<form action="'.LOGOUT_URL.'" method="post" class="login-table">'."\n";
44
    	$return_value .= '<fieldset>'."\n";
45
		$return_value .= '<h1>'.$TEXT["LOGGED_IN"].'</h1>'."\n";
46
		$return_value .= '<label>'.$TEXT['WELCOME_BACK'].', '.$wb->get_display_name().'</label>'."\n";
47
		$return_value .= '<p><input type="submit" name="submit" value="'.$MENU['LOGOUT'].'" class="dbutton" /></p>'."\n";
48
        $return_value .= '<ul class="logout-advance">'."\n";
49
		if ($wb->ami_group_member('1')||$wb->get_permission('preferences'))
50
        {
51
			$return_value .= '<li class="preference"><a href="'.PREFERENCES_URL.'" title="'.$MENU['PREFERENCES'].'">'.$MENU['PREFERENCES'].'</a></li>'."\n";
52
		}
53

  
54
		//change ot the group that should get special links
55
		if ($wb->ami_group_member('1')||$wb->get_permission('admintools'))
56
        {
57
	        $return_admin .= '<li class="admin"><a target="_blank" href="'.ADMIN_URL.'/index.php" title="'.$TEXT['ADMINISTRATION'].'" class="blank_target">'.$TEXT["ADMINISTRATION"].'</a></li>'."\n";
58
			//you can add more links for your users like userpage, lastchangedpages or something
59
			$return_value .= $return_admin;
60
		}
61
        //change ot the group that should get special links
62
		if( $wb->get_permission('pages_modify') && $wb->get_page_permission( PAGE_ID ) )
63
        {
64
			$return_value .= '<li class="modify"><a target="_blank" href="'.ADMIN_URL.'/pages/modify.php?page_id='.PAGE_ID.'" title="'.$HEADING['MODIFY_PAGE'].'" class="blank_target">'.$HEADING['MODIFY_PAGE'].'</a></li>'."\n";
65
        }
66
        $return_value .= '<li>&nbsp;'.'</li>'."\n";
67
        $return_value .= '</ul>'."\n";
68
        $return_value .= '</fieldset>'."\n";
69
		$return_value .= '</form>'."\n";
70
	}
71
	$return_value .= '</div>'."\n";
72
	return $return_value;
73 0

  
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, $section_id;
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
            // split and sanitize arguments
10
            $aSections = preg_split('/[\s\,\|\-\;\:\+\#\/]+/', $section);
11
            $iOldSectionId = intval($section_id); // save old SectionID
12
            $section_id = $aSections[array_rand($aSections)]; // get random element
13
            ob_start(); // generate output by wysiwyg module
14
            $sectionAnchor = (defined('SEC_ANCHOR') && SEC_ANCHOR!='') ? SEC_ANCHOR.$section_id : 'section_'.$section_id;
15
            echo PHP_EOL.'<div id="'.$sectionAnchor.'" class="wb_'.$module.'" >'.PHP_EOL;
16
            require(WB_PATH.'/modules/wysiwyg/view.php');
17
            echo PHP_EOL.'</div><!-- '.$module.$section_id.' -->'.PHP_EOL;
18
            $content = ob_get_clean();
19
            $section_id = $iOldSectionId; // restore old SectionId
20
        }
21
    }
22
}
23
return $content;
24 0

  
branches/2.8.x/wb/modules/droplets/example/ShowWysiwyg.php
1
//:Display one defined WYSIWYG section
2
//:Use [[ShowWysiwyg?section=10]]
3
global $database, $section_id, $module;
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
        $sectionAnchor = (defined('SEC_ANCHOR') && SEC_ANCHOR!='') ? SEC_ANCHOR.$section_id : 'section_'.$section_id;
13
        echo PHP_EOL.'<div id="'.$sectionAnchor.'" class="wb_'.$module.'" >'.PHP_EOL;
14
        require(WB_PATH.'/modules/wysiwyg/view.php');
15
        echo PHP_EOL.'</div><!-- '.$module.$section_id.' -->'.PHP_EOL;
16
        $content = ob_get_clean();
17
        $section_id = $iOldSectionId; // restore old SectionId
18
    }
19
}
20
return $content;
21 0

  
branches/2.8.x/wb/modules/droplets/example/SectionPicker.php
1
//:Load the view.php from any other section-module, including the frontend.css
2
//:Use [[SectionPicker?sid=123]]
3
global $database, $wb, $TEXT, $DGTEXT,$section_id,$page_id;
4
$content = '';
5
$sid = isset($sid) ? intval($sid) : 0;
6
if( $sid ) {
7
	$oldSid = $section_id; // save old sectionID
8
	$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
			$section_id = $sid;
22
			ob_start();
23
            $sectionAnchor = (defined('SEC_ANCHOR') && SEC_ANCHOR!='') ? SEC_ANCHOR.$section_id : 'section_'.$section_id;
24
            echo PHP_EOL.'<div id="'.$sectionAnchor.'" class="wb_'.$module.'" >'.PHP_EOL;
25
            require(WB_PATH.'/modules/'.$module.'/view.php');
26
            echo PHP_EOL.'</div><!-- '.$module.$section_id.' -->'.PHP_EOL;
27
			$content = $_sFrontendCss.ob_get_clean();
28
			$section_id = $oldSid; // restore old sectionID
29
		}
30
	}
31
}
32
return $content;
33 0

  
branches/2.8.x/wb/modules/droplets/example/iLoginBox.php
1
//:Puts a Login / Logout box on your page.
2
//:Use: [[iLoginBox?redirect=url]]
3
//:Absolute or relative url possible
4
//:Remember to enable frontend login in your website settings.
5

  
6
	$mLang = Translate::getinstance();
7
	if( !(isset($wb) && is_object($wb)) ) { $wb = new frontend(); }
8
	if( !(isset($admin) && is_object($admin)) ) { $admin= new admin('##skip##'); }
9

  
10
	$return_value = '<div class="login-box">'."\n";
11
	$return_admin = ' ';
12
// Get redirect
13
	$redirect_url = ((isset($_SESSION['HTTP_REFERER']) && $_SESSION['HTTP_REFERER'] != '') ? $_SESSION['HTTP_REFERER'] : WB_URL );
14
	$redirect_url = (isset($redirect) && ($redirect!='') ? $redirect : $redirect_url);
15

  
16
	if ( ( FRONTEND_LOGIN == 'enabled') &&
17
		    ( VISIBILITY != 'private') &&
18
		        ( $wb->get_session('USER_ID') == '')  )
19
	{
20
		$return_value .= '<form action="'.LOGIN_URL.'" method="post">'."\n";
21
		$return_value .= '<input type="hidden" name="redirect" value="'.$redirect_url.'" />'."\n";
22

  
23
		$return_value .= '<fieldset>'."\n";
24
		$return_value .= '<h1>'.$mLang->TEXT_LOGIN.'</h1>'."\n";
25
		$return_value .= '<label for="username">'.$mLang->TEXT_USERNAME.':</label>'."\n";
26
		$return_value .= '<p><input type="text" name="username" id="username"  /></p>'."\n";
27
		$return_value .= '<label for="password">'.$mLang->TEXT_PASSWORD.':</label>'."\n";
28
		$return_value .= '<p><input type="password" name="password" id="password"/></p>'."\n";
29
		$return_value .= '<p><input type="submit" id="submit" value="'.$mLang->TEXT_LOGIN.'" class="dbutton" /></p>'."\n";
30
		$return_value .= '<ul class="login-advance">'."\n";
31
		$return_value .= '<li class="forgot"><a href="'.FORGOT_URL.'"><span>'.$mLang->TEXT_FORGOT_DETAILS.'</span></a></li>'."\n";
32

  
33
		if (intval(FRONTEND_SIGNUP) > 0)
34
		{
35
			$return_value .= '<li class="sign"><a href="'.SIGNUP_URL.'">'.$mLang->TEXT_SIGNUP.'</a></li>'."\n";
36
		}
37
		$return_value .= '</ul>'."\n";
38
		$return_value .= '</fieldset>'."\n";
39
		$return_value .= '</form>'."\n";
40

  
41
	} elseif( (FRONTEND_LOGIN == true) &&
42
				(is_numeric($wb->get_session('USER_ID'))) )
43
	{
44
		$return_value .= '<form action="'.LOGOUT_URL.'" method="post" class="login-table">'."\n";
45
		$return_value .= '<fieldset>'."\n";
46
		$return_value .= '<h1>'.$mLang->TEXT_LOGGED_IN.'</h1>'."\n";
47
		$return_value .= '<label>'.$mLang->TEXT_WELCOME_BACK.', '.$wb->get_display_name().'</label>'."\n";
48
		$return_value .= '<p><input type="submit" name="submit" value="'.$mLang->MENU_LOGOUT.'" class="dbutton" /></p>'."\n";
49
		$return_value .= '<ul class="logout-advance">'."\n";
50
		if ($wb->ami_group_member('1')||$admin->get_permission('preferences'))
51
		{
52
			$return_value .= '<li class="preference"><a href="'.PREFERENCES_URL.'" title="'.$mLang->MENU_PREFERENCES.'">'.$mLang->MENU_PREFERENCES.'</a></li>'."\n";
53
		}
54

  
55
		//change ot the group that should get special links
56
		if ($wb->ami_group_member('1')||$admin->get_permission('admintools'))
57
		{
58
			$return_admin .= '<li class="admin"><a target="_blank" href="'.ADMIN_URL.'/index.php" title="'.$mLang->TEXT_ADMINISTRATION.'" class="blank_target">'.$mLang->TEXT_ADMINISTRATION.'</a></li>'."\n";
59
			//you can add more links for your users like userpage, lastchangedpages or something
60
			//$return_value .= $return_admin;
61
		}
62
		//change ot the group that should get special links
63
		if( $admin->get_permission('pages_modify') && $admin->get_page_permission( PAGE_ID ) )
64
		{
65
			$return_value .= '<li class="modify"><a target="_blank" href="'.ADMIN_URL.'/pages/modify.php?page_id='.$wb->page_id.'" title="'.$mLang->HEADING_MODIFY_PAGE.'" class="blank_target">'.$mLang->HEADING_MODIFY_PAGE.'</a></li>'."\n";
66
		}
67
		$return_value .= '<li>&nbsp;'.'</li>'."\n";
68
		$return_value .= '</ul>'."\n";
69
		$return_value .= '</fieldset>'."\n";
70
		$return_value .= '</form>'."\n";
71
	}
72
	$return_value .= '</div>'."\n";
73
	return $return_value;
branches/2.8.x/wb/modules/droplets/example/iShowWysiwyg.php
1
//:Display one defined WYSIWYG section
2
//:Use [[iShowWysiwyg?section=10]]
3
global $database, $section_id, $module;
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
		$sectionAnchor = (defined('SEC_ANCHOR') && SEC_ANCHOR!='') ? SEC_ANCHOR : 'Sec';
13
		echo PHP_EOL.'<div id="'.$sectionAnchor.$section_id.'" class="section m_'.$module.'" >'.PHP_EOL;
14
		require(WB_PATH.'/modules/wysiwyg/view.php');
15
		echo PHP_EOL.'</div><!-- '.$module.$section_id.' -->'.PHP_EOL;
16
		$content = ob_get_clean();
17
		$section_id = $iOldSectionId; // restore old SectionId
18
	}
19
}
20
return $content;
branches/2.8.x/wb/modules/droplets/example/iShowRandomWysiwyg.php
1
//:Randomly display one WYSIWYG section from a given list
2
//:Use [[iShowRandomWysiwyg?section=10,12,15,20]] possible Delimiters: [ ,;:|-+#/ ]
3
global $database, $section_id,$module;
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
		// split and sanitize arguments
10
		$aSections = preg_split('/[\s\,\|\-\;\:\+\#\/]+/', $section);
11
		$iOldSectionId = intval($section_id); // save old SectionID
12
		$section_id = $aSections[array_rand($aSections)]; // get random element
13
		ob_start(); // generate output by wysiwyg module
14
		$sectionAnchor = (defined('SEC_ANCHOR') && SEC_ANCHOR!='') ? SEC_ANCHOR : 'Sec';
15
		echo PHP_EOL.'<div id="'.$sectionAnchor.$sSectionIdPrefix.'" class="section m_'.$module.'" >'.PHP_EOL;
16
		require(WB_PATH.'/modules/wysiwyg/view.php');
17
		echo PHP_EOL.'</div><!-- '.$module.$section_id.' -->'.PHP_EOL;
18
		$content = ob_get_clean();
19
		$section_id = $iOldSectionId; // restore old SectionId
20
		}
21
	}
22
}
23
return $content;
branches/2.8.x/wb/modules/droplets/example/iSectionPicker.php
1
//:Load the view.php from any other section-module, including the frontend.css
2
//:Use [[iSectionPicker?sid=123]]
3
global $database, $wb, $section_id,$page_id,$module;
4
$content = '';
5
$sid = isset($sid) ? intval($sid) : 0;
6
if( $sid ) {
7
	$oldSid = $section_id; // save old sectionID
8
	$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
			$section_id = $sid;
22
			ob_start();
23
			$sectionAnchor = (defined('SEC_ANCHOR') && SEC_ANCHOR!='') ? SEC_ANCHOR : 'Sec';
24
			echo PHP_EOL.'<div id="'.$sectionAnchor.$sSectionIdPrefix.'" class="section m_'.$module.'" >'.PHP_EOL;
25
			require(WB_PATH.'/modules/'.$module.'/view.php');
26
			echo PHP_EOL.'</div><!-- '.$module.$section_id.' -->'.PHP_EOL;
27
			$content = $_sFrontendCss.ob_get_clean();
28
			$section_id = $oldSid; // restore old sectionID
29
		}
30
	}
31
}
32
return $content;

Also available in: Unified diff