includes/sessions.php
changeset 1252 e34c23a35dc9
parent 1242 9aa09b0a7544
child 1253 13f8d373da67
equal deleted inserted replaced
1251:d543689ed2eb 1252:e34c23a35dc9
  4475 		$this->namespace = $namespace;
  4475 		$this->namespace = $namespace;
  4476 		
  4476 		
  4477 		$pathskey = $paths->nslist[$this->namespace].sanitize_page_id($this->page_id);
  4477 		$pathskey = $paths->nslist[$this->namespace].sanitize_page_id($this->page_id);
  4478 		$ns = namespace_factory($this->page_id, $this->namespace);
  4478 		$ns = namespace_factory($this->page_id, $this->namespace);
  4479 		$cdata = $ns->get_cdata();
  4479 		$cdata = $ns->get_cdata();
  4480 		$ppwm = $cdata['wiki_mode'];
  4480 		
  4481 		unset($ns, $cdata);
  4481 		$this->wiki_mode = false;
  4482 		
  4482 		$wiki_mode_eligible = ($session->user_logged_in && getConfig('wiki_mode_require_login', 0) == 1) || getConfig('wiki_mode_require_login', 0) == 0;
  4483 		if ( $ppwm == 1 && ( $session->user_logged_in || getConfig('wiki_mode_require_login') != '1' ) )
  4483 		$global_wiki_mode = getConfig('wiki_mode', 0) == 1;
       
  4484 		if ( $wiki_mode_eligible && (($cdata['wiki_mode'] == 2 && $global_wiki_mode) || $cdata['wiki_mode'] == 1))
  4484 			$this->wiki_mode = true;
  4485 			$this->wiki_mode = true;
  4485 		else if ( $ppwm == 1 && !$session->user_logged_in && getConfig('wiki_mode_require_login') == '1' )
       
  4486 			$this->wiki_mode = true;
       
  4487 		else if ( $ppwm == 0 )
       
  4488 			$this->wiki_mode = false;
       
  4489 		else if ( $ppwm == 2 )
       
  4490 		{
       
  4491 			if ( $this->user_id > 1 )
       
  4492 			{
       
  4493 				$this->wiki_mode = ( getConfig('wiki_mode') == '1' );
       
  4494 			}
       
  4495 			else
       
  4496 			{
       
  4497 				$this->wiki_mode = ( getConfig('wiki_mode') == '1' && getConfig('wiki_mode_require_login') != '1' );
       
  4498 			}
       
  4499 		}
       
  4500 		else
       
  4501 		{
       
  4502 			// Ech. Internal logic failure, this should never happen.
       
  4503 			return false;
       
  4504 		}
       
  4505 	}
  4486 	}
  4506 	
  4487 	
  4507 	/**
  4488 	/**
  4508 	 * Tells us whether permission $type is allowed or not based on the current rules.
  4489 	 * Tells us whether permission $type is allowed or not based on the current rules.
  4509 	 * @param string $type The permission identifier ($acl_type passed to sessionManager::register_acl_type())
  4490 	 * @param string $type The permission identifier ($acl_type passed to sessionManager::register_acl_type())