Example #1
0
 public static function mayAddTag(GWF_User $user)
 {
     if ($user->isStaff()) {
         return true;
     }
     $uid = $user->getID();
     return self::table(__CLASS__)->selectFirst('1', "st_uid={$uid}") === false;
 }
Example #2
0
 public function hasPermission(GWF_User $user)
 {
     if ($user->getID() === $this->getVar('hdt_uid')) {
         return true;
     }
     if ($user->isStaff() || $user->isAdmin()) {
         return true;
     }
     return false;
 }
Example #3
0
 public function getSortableFields(GWF_User $user)
 {
     if ($user->isStaff()) {
         return array('order_id', 'user_name', 'order_price_total', 'order_site', 'order_email', 'order_descr_admin', 'order_date_ordered', 'order_status', 'order_date_paid', 'order_site');
     } else {
         return array('order_descr', 'order_date_ordered', 'order_price_total', 'order_date_paid', 'order_status', 'order_email');
     }
 }
Example #4
0
 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;
 }