Exemplo n.º 1
0
 /** User Class, Called all the time
  * 
  * @staticvar 
  * @uses ModYes
  * @uses AdminYes
  * @uses get_awcsforum_word
  * @uses GetUserPermission
  * @since Version 2.5.8
  */
 function __construct()
 {
     global $wgUser, $awcUser_lang;
     static $here_already = null;
     if ($here_already == 'yes') {
         return;
     }
     $here_already = 'yes';
     define('UserPerm', awcsforum_funcs::GetUserPermission($wgUser));
     $this->mId = $wgUser->mId;
     $this->mName = $wgUser->mName;
     if ($this->mName == " ") {
         $this->mName = wfGetIP();
     }
     $this->mRealName = $wgUser->mRealName;
     $this->mEmail = $wgUser->mEmail;
     $this->mTouched = $wgUser->mTouched;
     $this->cols = $wgUser->mOptions['cols'];
     $this->mOptions_cols = $wgUser->mOptions['cols'];
     $this->rows = $wgUser->mOptions['rows'];
     $this->language = $wgUser->mOptions['language'];
     if (strlen($this->language) == 0) {
         $this->language = awcs_forum_lang_default;
     }
     $awcUser_lang = $this->language;
     // awc_pdie($this->language);
     $this->nickname = isset($wgUser->mOptions['nickname']) ? $wgUser->mOptions['nickname'] : null;
     $this->timecorrection = isset($wgUser->mOptions['timecorrection']) ? $wgUser->mOptions['timecorrection'] : null;
     $this->mTouched = $wgUser->mTouched;
     $this->mGroups = $wgUser->mGroups;
     $this->mEditCount = isset($wgUser->mOptions['mEditCount']) ? $wgUser->mEditCount : null;
     $this->fancysig = isset($wgUser->fancysig) ? $wgUser->fancysig : null;
     $this->riched_disable = isset($wgUser->mOptions['riched_disable']) ? $wgUser->mOptions['riched_disable'] : 1;
     $this->edit_count = isset($wgUser->mEditCount) ? $wgUser->mEditCount : null;
     $this->canRead = $wgUser->isAllowed("awc_CanNotView") ? false : true;
     $this->canPost = $wgUser->isAllowed("awc_CanNotPost") ? false : true;
     $this->canDelete = $wgUser->isAllowed("awc_CanNotDelete") ? false : $wgUser->isAllowed("awc_CanDelete") ? true : false;
     $this->canEdit = $wgUser->isAllowed("awc_CanNotEdit") ? false : $wgUser->isAllowed("awc_CanEdit") ? true : false;
     $this->canSearch = $wgUser->isAllowed("awc_CanNotSearch") ? false : $wgUser->isAllowed("awc_CanSearch") ? true : false;
     foreach ($wgUser->mGroups as $groupis) {
         switch ($groupis) {
             case 'Forum:Mod':
                 self::ModYes();
                 $wgUser->mEffectiveGroups[] = '*';
                 // used for cat & forums perm...
                 $wgUser->mEffectiveGroups[] = 'user';
                 // used for cat & forums perm...
                 break;
             case 'Forum:Admin':
                 self::AdminYes();
                 $wgUser->mEffectiveGroups[] = '*';
                 // used for cat & forums perm...
                 $wgUser->mEffectiveGroups[] = 'user';
                 // used for cat & forums perm...
                 $wgUser->mEffectiveGroups[] = 'Forum:Mod';
                 // used for cat & forums perm...
                 break;
             case 'bureaucrat':
             case 'sysop':
                 $wgUser->mEffectiveGroups[] = 'Forum:Admin';
                 // used for cat & forums perm...
                 $wgUser->mEffectiveGroups[] = 'Forum:Mod';
                 // used for cat & forums perm...
                 $wgUser->mEffectiveGroups[] = '*';
                 // used for cat & forums perm...
                 $wgUser->mEffectiveGroups[] = 'user';
                 // used for cat & forums perm...
                 self::AdminYes();
                 break;
         }
     }
     $wgUser->mEffectiveGroups = array_unique($wgUser->mEffectiveGroups);
     // poor.. poor... poor...
     define('UserGroupPerm', implode(',', $wgUser->mEffectiveGroups));
     if (empty($wgUser->mGroups)) {
         $this->group = get_awcsforum_word('word_mem');
     } else {
         // find out how to get group names in different languages
         $this->group = implode(',', $wgUser->mGroups);
     }
     $this->isLoggedIn = $wgUser->isLoggedIn();
     $this->pw = array();
     #if($this->isLoggedIn == 1){
     if (isset($_SESSION['forumPW'])) {
         $ids = explode(',', $_SESSION['forumPW']);
         foreach ($ids as $id) {
             $this->pw[$id] = $id;
         }
         #die();
     }
     #} else {
     #$this->pw[0] = 0;
     #}
     #awc_pdie($_SESSION);
     // $this->canPost =
 }