Source for file RoomAllowed.class.php

Documentation is available at RoomAllowed.class.php

  1. <?php
  2. /**
  3.  * Class RoomAllowed, check permissions for any user in any room
  4.  *
  5.  * LICENSE: CREATIVE COMMONS PUBLIC LICENSE  "Namensnennung — Nicht-kommerziell 2.0"
  6.  *
  7.  * @copyright  2009 <SEDesign />
  8.  * @license    http://creativecommons.org/licenses/by-nc/2.0/de/
  9.  * @version    $3.0.6$
  10.  * @link       http://www.sedesign.de/de_produkte_chat-v3.html
  11.  * @since      File available since Alpha 1.0
  12.  */
  13.  
  14. class RoomAllowed extends EtChatConfig
  15. {
  16.  
  17.     /**
  18.     * Status for each user to use requested room
  19.     * @var int 
  20.     */
  21.     public $room_status=0;
  22.     
  23.     /**
  24.     * Constructor
  25.     * Function zur Prüfung der Rechte der User im Raum
  26.     * Return as $room_status: 1=allowed; 0=not_allowed; 2=password required
  27.     *
  28.     * @param int $room_id  from etchat_rooms.etchat_id_room
  29.     * @param int $room_priv  from etchat_rooms.etchat_room_goup
  30.     * @return void 
  31.     */
  32.     public function __construct ($room_priv$room_id){
  33.     
  34.         // call parent Constructor from class EtChatConfig
  35.         parent::__construct();
  36.         
  37.         $room_allowed=0;
  38.         
  39.         if ($room_priv==1 && ($_SESSION['etchat_'.$this->_prefix.'user_priv']=="admin" || $_SESSION['etchat_'.$this->_prefix.'user_priv']=="mod")) $room_allowed=1;
  40.         if ($room_priv==2 && $_SESSION['etchat_'.$this->_prefix.'user_priv']=="admin"$room_allowed=1;
  41.         if ($room_priv==0$room_allowed=1;
  42.  
  43.         if ($room_priv==3 && $_SESSION['etchat_'.$this->_prefix.'user_priv']!="admin"$room_allowed=2;
  44.         if ($room_priv==3 && $_SESSION['etchat_'.$this->_prefix.'user_priv']=="admin"$room_allowed=1;
  45.  
  46.         if (is_array($_SESSION['etchat_'.$this->_prefix.'roompw_array']&& $room_priv==3 && in_array($room_id$_SESSION['etchat_'.$this->_prefix.'roompw_array'])) $room_allowed=1;
  47.  
  48.         // Set the permission to the $this->room_status
  49.         $this->room_status = $room_allowed;
  50.     }
  51. }

Documentation generated on Tue, 22 Dec 2009 09:42:51 +0100 by phpDocumentor 1.4.1