Project

General

Profile

« Previous | Next » 

Revision 546

Added by doc almost 17 years ago

added the "users in multiple groups" feature (closes parts of ticket #546)

View differences:

class.frontend.php
201 201
			// Check if the user is authenticated
202 202
			if($this->is_authenticated() == false) {
203 203
				// User needs to login first
204
				header("Location: ".WB_URL."/account/login.php?redirect=".$this->link);
204
				header("Location: ".WB_URL."/account/login".PAGE_EXTENSION.'?redirect='.$this->link);
205 205
				exit(0);
206 206
			}
207 207
			// Check if we should show this page
......
250 250
		// Work-out if login menu constants should be set
251 251
		if(FRONTEND_LOGIN) {
252 252
			// Set login menu constants
253
			define('LOGIN_URL', WB_URL.'/account/login.php');
254
			define('LOGOUT_URL', WB_URL.'/account/logout.php');
255
			define('FORGOT_URL', WB_URL.'/account/forgot.php');
256
			define('PREFERENCES_URL', WB_URL.'/account/preferences.php');
257
			define('SIGNUP_URL', WB_URL.'/account/signup.php');
253
			define('LOGIN_URL', WB_URL.'/account/login'.PAGE_EXTENSION);
254
			define('LOGOUT_URL', WB_URL.'/account/logout'.PAGE_EXTENSION);
255
			define('FORGOT_URL', WB_URL.'/account/forgot'.PAGE_EXTENSION);
256
			define('PREFERENCES_URL', WB_URL.'/account/preferences'.PAGE_EXTENSION);
257
			define('SIGNUP_URL', WB_URL.'/account/signup'.PAGE_EXTENSION);
258 258
		}
259 259
	}
260 260
	
......
345 345
				if($page['visibility'] == 'private') {
346 346
					$viewing_groups = explode(',', $page['viewing_groups']);
347 347
					$viewing_users = explode(',', $page['viewing_users']);
348
					if(!in_array($this->get_group_id(), $viewing_groups) && (!in_array($this->get_user_id(), $viewing_users))) {
348
					
349
					$is_viewing_user = in_array($this->get_user_id(), $viewing_users);
350

  
351
					$access_granted = FALSE;
352
					foreach ($this->get_groups_id() as $group_id) {
353

  
354
						if(in_array($group_id, $viewing_groups) || ($is_viewing_user)) {
355
							$access_granted = TRUE;
356
						}
357
					}
358
					if (!$access_granted) {
349 359
						continue;
350 360
					}
351 361
				}

Also available in: Unified diff