當前位置: 首頁>>代碼示例>>PHP>>正文


PHP GWF_User::isAdmin方法代碼示例

本文整理匯總了PHP中GWF_User::isAdmin方法的典型用法代碼示例。如果您正苦於以下問題:PHP GWF_User::isAdmin方法的具體用法?PHP GWF_User::isAdmin怎麽用?PHP GWF_User::isAdmin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在GWF_User的用法示例。


在下文中一共展示了GWF_User::isAdmin方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: hasPermission

 public function hasPermission(GWF_User $user)
 {
     if ($user->getID() === $this->getVar('hdt_uid')) {
         return true;
     }
     if ($user->isStaff() || $user->isAdmin()) {
         return true;
     }
     return false;
 }
開發者ID:sinfocol,項目名稱:gwf3,代碼行數:10,代碼來源:GWF_HelpdeskTicket.php

示例2: canAffordB

 /**
  * Returns error message or false.
  * @param GWF_Order $order
  * @param GWF_User $user
  * @return string | false
  */
 public function canAffordB(GWF_Order $order, $user)
 {
     if ($user === false) {
         return false;
     }
     if ($user->isAdmin()) {
         return false;
     }
     $money = $user->getMoney();
     $price = $order->getOrderPriceTotal();
     $left = $money - $price;
     if ($left >= 0) {
         return false;
     }
     $lang = $this->loadLangGWF();
     return GWF_HTML::error('Buy with GWF', $lang->lang('err_funds', array(Module_Payment::displayPrice($money), Module_Payment::displayPrice($price), Module_Payment::displayPrice(-$left))));
 }
開發者ID:sinfocol,項目名稱:gwf3,代碼行數:23,代碼來源:Module_PaymentGWF.php

示例3: 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

示例4: 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


注:本文中的GWF_User::isAdmin方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。