Пример #1
0
 protected static function _check_expiration($type, $val)
 {
     $data = Blacklist::whereRaw("`{$type}` = '{$val}'")->first();
     if ($data) {
         if (time() >= $data->time) {
             Blacklist::destroy($data->id);
             return false;
         }
         return true;
     }
     return false;
 }
 public function delete($id = 0)
 {
     if (is_array(Input::get('ids'))) {
         $id = Input::get('ids');
     }
     $ok = Blacklist::destroy($id);
     if ($ok) {
         return Redirect::to('msg')->withInput()->with('jump_sec', 3)->with('jump_url', URL::to('admin/blacklist'))->with('message', "删除成功!");
     } else {
         return Redirect::to('msg')->withInput()->with('jump_sec', 3)->with('message', "删除失败!");
     }
 }
Пример #3
0
 /**
  * 检查用户和ip是否被禁言
  * @param $userId
  * @param $ip
  * @throws CommentApiException
  */
 protected function isBan($userId, $ip)
 {
     if (Blacklist::check_user($userId)) {
         throw new CommentApiException($userId . "被禁言~!");
     }
     if (Blacklist::check_ip($ip)) {
         throw new CommentApiException($ip . "被禁言~!");
     }
 }
Пример #4
0
 protected function _check_blacklist($user_id, $ip)
 {
     if (Blacklist::check_user($user_id)) {
         $return_arr['status'] = -19;
         return $return_arr;
     }
     if (Blacklist::check_ip($ip)) {
         $return_arr['status'] = -20;
         return $return_arr;
     }
     return false;
 }