当前位置: 首页>>代码示例>>PHP>>正文


PHP GWF_User::getLevel方法代码示例

本文整理汇总了PHP中GWF_User::getLevel方法的典型用法代码示例。如果您正苦于以下问题:PHP GWF_User::getLevel方法的具体用法?PHP GWF_User::getLevel怎么用?PHP GWF_User::getLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GWF_User的用法示例。


在下文中一共展示了GWF_User::getLevel方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getPermissionQueryList

 /**
  * Get permission query for a user. (View)
  * @param GWF_User $user
  * @return string
  */
 public static function getPermissionQueryList($user)
 {
     $enabled = GWF_Download::ENABLED;
     if ($user === false) {
         $guest_view = GWF_Download::GUEST_VISIBLE;
         return "dl_gid=0 AND dl_level=0 AND dl_options&{$guest_view} AND dl_options&{$enabled}";
     }
     if ($user->isAdmin()) {
         return '';
     }
     $uid = $user->getID();
     $level = $user->getLevel();
     $ug = GWF_TABLE_PREFIX . 'usergroup';
     return "( dl_level<={$level} AND dl_options&{$enabled} AND ((dl_gid=0) OR (SELECT 1 FROM {$ug} WHERE ug_userid={$uid} AND ug_groupid=dl_gid)) )";
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:20,代码来源:GWF_Download.php

示例2: isContactHidden

 public function isContactHidden(GWF_User $user)
 {
     return $this->isContactHiddenLevel($user->getLevel());
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:4,代码来源:GWF_Profile.php

示例3: validate_limits

 public function validate_limits(GWF_User $from, GWF_User $to)
 {
     $options = GWF_PMOptions::getPMOptions($to);
     if ($from->isGuest() && !$options->isOptionEnabled(GWF_PMOptions::ALLOW_GUEST_PM)) {
         return $this->error('err_user_no_ppm');
     }
     if ($from->isAdmin() || $from->isStaff()) {
         return false;
     }
     if (!$this->cfgIsPMLimited()) {
         return false;
     }
     if ($from->getLevel() <= $options->getVar('pmo_level')) {
         return $this->error('err_user_pmo_level', array($options->getVar('pmo_level')));
     }
     $user = GWF_Session::getUser();
     $uid = GWF_Session::getUserID();
     $within = $this->cfgLimitTimeout();
     $cut = GWF_Time::getDate(GWF_Date::LEN_SECOND, time() - $within);
     $count = GDO::table('GWF_PM')->countRows("pm_from={$uid} AND pm_date>'{$cut}'");
     $max = $this->calcPMLimit($user);
     if ($count >= $max) {
         return $this->lang('err_limit', array($max, GWF_Time::humanDuration($within)));
     }
     return false;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:26,代码来源:Module_PM.php

示例4: getPermissionText

 /**
  * Check if we have permission to view that link. In case we do, return empty string. else return verbose permission text.
  * @param Module_Links $module
  * @param GWF_User $user
  * @return string
  */
 public function getPermissionText(Module_Links $module, $user)
 {
     static $text = NULL;
     if ($text === NULL) {
         $text = array($module->lang('permtext_in_mod'), $module->lang('permtext_score', array('%1%')), $module->lang('permtext_member'), $module->lang('permtext_group', array('%1%')));
     }
     if ($this->isInModeration()) {
         return $text[0];
     }
     $score = $user === false ? 0 : $user->getLevel();
     # Check score
     $need_score = $this->getVar('link_score');
     if ($score < $need_score) {
         return str_replace('%1%', $need_score, $text[1]);
     }
     # Check memberlink
     if ($user === false && $this->isMemberLink()) {
         return $text[2];
     }
     # Check group
     $need_gid = $this->getGroupID();
     if ($need_gid > 0) {
         if ($user === false || !$user->isInGroupID($need_gid)) {
             return str_replace('%1%', GWF_Group::getByID($need_gid)->displayName(), $text[3]);
         }
     }
     return '';
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:34,代码来源:GWF_Links.php

示例5: isAuthor

 /**
  * Check if user is an author.
  * @param GWF_User $user
  * @return boolean
  */
 public function isAuthor(GWF_User $user)
 {
     # Field is empty so everyone can add.
     if ('' === ($authors = trim($this->cfgAuthors()))) {
         return true;
     }
     # Check author level
     if ($this->cfgAuthorLevel() > $user->getLevel()) {
         return false;
         # Nope
     }
     # Check author groupnames
     foreach (preg_split('/[,;]+/', $authors) as $groupname) {
         if ($user->isInGroupName($groupname)) {
             return true;
         }
     }
     # Nope
     return false;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:25,代码来源:Module_PageBuilder.php


注:本文中的GWF_User::getLevel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。