Project

General

Profile

« Previous | Next » 

Revision 1717

Added by Dietmar about 12 years ago

! update droplets uninstall, upgrade
! add $database=WbDatabase::getInstance();
! update /examples/

View differences:

branches/2.8.x/CHANGELOG
13 13

  
14 14

  
15 15

  
16
29 Aug-2012 Build 1717 Dietmar Woellbrink (Luisehahne)
17
! update droplets uninstall, upgrade
18
! add $database=WbDatabase::getInstance();
19
! update /examples/
20
29 Aug-2012 Build 1716 Dietmar Woellbrink (Luisehahne)
21
! update folder admin/settings admin/skel/htt
22
! change Template to div container
16 23
29 Aug-2012 Build 1715 Dietmar Woellbrink (Luisehahne)
17 24
! forgot some files in folder admin
18 25
29 Aug-2012 Build 1714 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', '1716');
54
if(!defined('REVISION')) define('REVISION', '1717');
55 55
if(!defined('SP')) define('SP', '');
branches/2.8.x/wb/modules/droplets/example/SectionPicker.php
1
//:Load the view.php from any other section-module
1
//:Load the view.php from any other section-module, including the frontend.css
2 2
//:Use [[SectionPicker?sid=123]]
3
global $database, $wb, $TEXT, $DGTEXT;
3
global $database, $wb, $TEXT, $DGTEXT,$section_id,$page_id;
4 4
$content = '';
5 5
$sid = isset($sid) ? intval($sid) : 0;
6 6
if( $sid ) {
7
	$oldSid = $section_id; // save old sectionID
7 8
	$sql  = 'SELECT `module` FROM `'.TABLE_PREFIX.'sections` ';
8 9
	$sql .= 'WHERE `section_id`='.$sid;
9 10
	if (($module = $database->get_one($sql))) {
......
18 19
				}
19 20
			} else { $_sFrontendCss = ''; }
20 21
			ob_start();
21
			$oldSid = $section_id; // save old sectionID
22 22
			$section_id = $sid;
23 23
			require(WB_PATH.'/modules/'.$module.'/view.php');
24 24
			$content = $_sFrontendCss.ob_get_clean();
branches/2.8.x/wb/modules/droplets/example/iParentPageIcon.php
9 9
$type = !isset($type) ? 0 : (intval($type) % 3);
10 10
$icontypes = array( 0=>'page_icon', 1=>'menu_icon_0', 2=>'menu_icon_1');
11 11
$icon_url = '';
12
if( isset($icon) && file_exists(WB_PATH.'/'.TEMPLATE.'/'.$icon) )
12
if( isset($icon) && is_readable(WB_PATH.'/templates/'.TEMPLATE.'/'.$icon) )
13 13
{
14
	$icon_url = WB_REL.'/'.TEMPLATE.'/'.$icon;
14
	$icon_url = WB_REL.'/templates/'.TEMPLATE.'/'.$icon;
15 15
}
16 16
$tmp_trail = $wb->page_trail;
17 17
$tmp_trail = array_reverse($tmp_trail);
branches/2.8.x/wb/modules/droplets/example/EditThisPage.php
1
//:Puts a EditThisPage link on your page, if you have the rights
2
//:Use [[EditThisPage]]
3

  
4
global $page_id, $HEADING;
5
$retVal = '';
6
$wb = new admin ('Start', 'start', false, false);
7
if (FRONTEND_LOGIN == true && is_numeric($wb->get_session('USER_ID')))
8
{
9

  
10
	if( $wb->get_permission('pages_modify') && $wb->get_page_permission( PAGE_ID ) )
11
	{
12
		$retVal .= '<div class="page-modify">'."\n";
13
		$retVal .= '<a target="_blank" href="'.ADMIN_URL.'/pages/modify.php?page_id='.PAGE_ID.'" title="'.$HEADING['MODIFY_PAGE'].'" class="blank_target">';
14
		$retVal .= '<img src="'.ADMIN_URL . '/images/modify_16.png" alt="'.$HEADING['MODIFY_PAGE'].'" />';
15
		$retVal .= '<span>'.$HEADING['MODIFY_PAGE'].'</span>';
16
		$retVal .= '</a>';
17
		$retVal .= '</div>'."\n";
18
	}
19
}
20
return $retVal;
0 21

  
branches/2.8.x/wb/modules/droplets/example/LoginBox.php
3 3
//:Absolute or relative url possible
4 4
//:Remember to enable frontend login in your website settings.
5 5

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

  
8 8
	$return_value = '<div class="login-box">'."\n";
9 9
	$return_admin = ' ';
10
	// Return a system permission
11
	function get_permission($name, $type = 'system')
12
	{
13
	   	global $wb;
14
	// Append to permission type
15
		$type .= '_permissions';
16
		// Check if we have a section to check for
17
		if($name == 'start') {
18
			return true;
19
		} else {
20
			// Set system permissions var
21
			$system_permissions = $wb->get_session('SYSTEM_PERMISSIONS');
22
			// Set module permissions var
23
			$module_permissions = $wb->get_session('MODULE_PERMISSIONS');
24
			// Set template permissions var
25
			$template_permissions = $wb->get_session('TEMPLATE_PERMISSIONS');
26
			// Return true if system perm = 1
27
			if (isset($$type) && is_array($$type) && is_numeric(array_search($name, $$type))) {
28
				if($type == 'system_permissions') {
29
					return true;
30
				} else {
31
					return false;
32
				}
33
			} else {
34
				if($type == 'system_permissions') {
35
					return false;
36
				} else {
37
					return true;
38
				}
39
			}
40
		}
41
	}
42

  
43
	function get_page_permission($page, $action='admin') {
44
		if ($action!='viewing'){ $action='admin';}
45
		$action_groups=$action.'_groups';
46
		$action_users=$action.'_users';
47
		if (is_array($page)) {
48
				$groups=$page[$action_groups];
49
				$users=$page[$action_users];
50
		} else {
51
			global $database,$wb;
52
			$results = $database->query("SELECT $action_groups,$action_users FROM ".TABLE_PREFIX."pages WHERE page_id = '$page'");
53
			$result = $results->fetchRow();
54
			$groups = explode(',', str_replace('_', '', $result[$action_groups]));
55
			$users = explode(',', str_replace('_', '', $result[$action_users]));
56
		}
57

  
58
		$in_group = FALSE;
59
		foreach($wb->get_groups_id() as $cur_gid){
60
		    if (in_array($cur_gid, $groups)) {
61
		        $in_group = TRUE;
62
		    }
63
		}
64
		if((!$in_group) AND !is_numeric(array_search($wb->get_user_id(), $users))) {
65
			return false;
66
		}
67
		return true;
68
	}
69

  
10
	$wb = new admin ('Start', 'start', false, false);
70 11
// Get redirect
71 12
	$redirect_url = ((isset($_SESSION['HTTP_REFERER']) && $_SESSION['HTTP_REFERER'] != '') ? $_SESSION['HTTP_REFERER'] : WB_URL );
72 13
   	$redirect_url = (isset($redirect) && ($redirect!='') ? $redirect : $redirect_url);
......
76 17
		        ( $wb->get_session('USER_ID') == '')  )
77 18
	{
78 19
		$return_value .= '<form action="'.LOGIN_URL.'" method="post">'."\n";
79
		$return_value .= '<input type="hidden" name="url" value="'.$redirect_url.'" />'."\n";
20
		$return_value .= '<input type="hidden" name="redirect" value="'.$redirect_url.'" />'."\n";
21

  
80 22
    	$return_value .= '<fieldset>'."\n";
81 23
		$return_value .= '<h1>'.$TEXT['LOGIN'].'</h1>'."\n";
82 24
		$return_value .= '<label for="username">'.$TEXT['USERNAME'].':</label>'."\n";
......
95 37
	    $return_value .= '</fieldset>'."\n";
96 38
		$return_value .= '</form>'."\n";
97 39

  
98
	} elseif( (FRONTEND_LOGIN == 'enabled') &&
40
	} elseif( (FRONTEND_LOGIN == true) &&
99 41
				(is_numeric($wb->get_session('USER_ID'))) )
100 42
	{
101
			$return_value .= '<form action="'.LOGOUT_URL.'" method="post" class="login-table">'."\n";
102
        	$return_value .= '<fieldset>'."\n";
103
			$return_value .= '<h1>'.$TEXT["LOGGED_IN"].'</h1>'."\n";
104
			$return_value .= '<label>'.$TEXT['WELCOME_BACK'].', '.$wb->get_display_name().'</label>'."\n";
105
			$return_value .= '<p><input type="submit" name="submit" value="'.$MENU['LOGOUT'].'" class="dbutton" /></p>'."\n";
106
	        $return_value .= '<ul class="logout-advance">'."\n";
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
        {
107 51
			$return_value .= '<li class="preference"><a href="'.PREFERENCES_URL.'" title="'.$MENU['PREFERENCES'].'">'.$MENU['PREFERENCES'].'</a></li>'."\n";
52
		}
108 53

  
109
			if ($wb->ami_group_member('1'))  //change ot the group that should get special links
110
	        {
111
		        $return_admin .= '<li class="admin"><a target="_blank" href="'.ADMIN_URL.'/index.php" title="'.$TEXT['ADMINISTRATION'].'" class="blank_target">'.$TEXT["ADMINISTRATION"].'</a></li>'."\n";
112
				//you can add more links for your users like userpage, lastchangedpages or something
113
				$return_value .= $return_admin;
114
			}
115
            //change ot the group that should get special links
116
			if( get_permission('pages_modify') && get_page_permission( PAGE_ID ) )
117
	        {
118
				$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";
119
	        }
120
	        $return_value .= '</ul>'."\n";
121
	        $return_value .= '</fieldset>'."\n";
122
			$return_value .= '</form>'."\n";
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";
123 70
	}
124 71
	$return_value .= '</div>'."\n";
125 72
	return $return_value;
branches/2.8.x/wb/modules/droplets/uninstall.php
24 24
	throw new IllegalFileException();
25 25
}
26 26
/* -------------------------------------------------------- */
27
$database=WbDatabase::getInstance();
27 28

  
28 29
$sql  = 'DROP TABLE IF EXISTS `'.TABLE_PREFIX.'mod_droplets` ';
29 30
$database->query($sql);
branches/2.8.x/wb/modules/droplets/upgrade.php
24 24
	throw new IllegalFileException();
25 25
}
26 26
/* -------------------------------------------------------- */
27

  
27
$database=WbDatabase::getInstance();
28 28
$table_name = TABLE_PREFIX .'mod_droplets';
29 29
$description = 'INT NOT NULL default 0 ';
30 30
$database->field_add($table_name,'show_wysiwyg',$description.'AFTER `active`' );

Also available in: Unified diff