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


PHP Model_User::query方法代码示例

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


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

示例1: action_login

 public function action_login()
 {
     $lUsername = Input::post('username', null);
     $lPassword = Input::post('password', null);
     $lError = ['status' => 'error', 'message' => 'error_msg_1'];
     if (empty($lUsername) || empty($lPassword)) {
         die(json_encode(['status' => 'error', 'message' => 'Missing params'], JSON_UNESCAPED_UNICODE));
     }
     $lUser = Model_User::query()->where('username', $lUsername)->get_one();
     if (empty($lUser)) {
         die(json_encode($lError, JSON_UNESCAPED_UNICODE));
     }
     $lUser = $lUser->to_array();
     $lUser['profile_fields'] = unserialize($lUser['profile_fields']);
     if (!empty($lUser['profile_fields']['is_deleted'])) {
         die(json_encode($lError, JSON_UNESCAPED_UNICODE));
     }
     if (!empty($lUser['profile_fields']['is_blocked'])) {
         die(json_encode(['status' => 'error', 'message' => 'User is blocked'], JSON_UNESCAPED_UNICODE));
     }
     if (Auth::login($lUsername, $lPassword)) {
         die(json_encode(['status' => 'ok'], JSON_UNESCAPED_UNICODE));
     }
     die(json_encode($lError, JSON_UNESCAPED_UNICODE));
 }
开发者ID:FTTA,项目名称:devels,代码行数:25,代码来源:General.php

示例2: getMailMagazieCount

 /**
  * 新規会員数
  *
  * @access private
  * @param
  * @return int
  * @author ida
  */
 private function getMailMagazieCount()
 {
     $query = \Model_User::query();
     $query->where(array(array('mm_flag', \Model_User::MM_FLAG_OK), array('register_status', 'IN', array(\Model_User::REGISTER_STATUS_INACTIVATED, \Model_User::REGISTER_STATUS_ACTIVATED))));
     $count = $query->count();
     return $count;
 }
开发者ID:eva-tuantran,项目名称:use-knife-solo-instead-chef-solo-day13,代码行数:15,代码来源:index.php

示例3: action_remove

 public function action_remove($user_id)
 {
     // check for admin
     if (!Auth::member(5)) {
         \Response::redirect_back('home');
     }
     $user = Model_User::query()->where('id', $user_id)->get_one();
     $user->delete();
     Response::Redirect('users');
 }
开发者ID:aircross,项目名称:MeeLa-Premium-URL-Shortener,代码行数:10,代码来源:users.php

示例4: action_index

 public function action_index()
 {
     $this->dataGlobal['pageTitle'] = __('backend.category.manage');
     // Pagination
     $config = array('pagination_url' => \Uri::current(), 'total_items' => \Model_User::count(), 'per_page' => floor(\Model_User::count() / 2), 'uri_segment' => 'page');
     $this->data['pagination'] = $pagination = \Pagination::forge('authors_pagination', $config);
     // Get categories
     $this->data['authors'] = \Model_User::query()->offset($pagination->offset)->limit($pagination->per_page)->order_by('created_at', 'DESC')->get();
     return \Response::forge(\View::forge('backend/author/index')->set($this->data, null, false));
 }
开发者ID:daniel-rodas,项目名称:rodasnet.com,代码行数:10,代码来源:author.php

示例5: action_index

 public function action_index()
 {
     $this->template = View::forge("students/template");
     // login
     if (Input::post("email", null) !== null and Security::check_token()) {
         $email = Input::post('email', null);
         $password = Input::post('password', null);
         $where = [["email", $email], ["deleted_at", 0]];
         $gameUser = Model_User::find("all", ["where" => $where]);
         if (count($gameUser) >= 1) {
             if ($this->auth->login($email, $password)) {
                 if (Input::post('remember_me', null) == 1) {
                     $this->auth->remember_me();
                 }
                 $type = Input::post('type', 0);
                 if (Input::post('pay', 0) != 1 && Input::post('doc', 0) != 1) {
                     Response::redirect('/students/top');
                 } else {
                     if (Input::post('pay') != 0 || Input::post('pay') != NULL) {
                         if (Input::post('method', 0) == 1) {
                             Response::redirect('/coursefee/cash/?g=1#upload');
                         } elseif (Input::post('method', 0) == 2) {
                             Response::redirect('/coursefee/remit/?g=2#done');
                         } elseif (Input::post('method', 0) == 3) {
                             Response::redirect('/students/courses');
                         } elseif (Input::post('method', 0) == 4) {
                             Response::redirect('/coursefee/cash/?g=4#upload');
                         }
                     }
                     if (Input::post('doc', 0) != 0 || Input::post('doc') != NULL) {
                         $user = Model_User::query()->where('email', $email)->where('deleted_at', 0)->limit(1)->get_one();
                         $query = Model_User::find($user->id);
                         $place = $query->place;
                         if ($place == 1) {
                             Response::redirect('/join/?open=2');
                         } else {
                             Response::redirect('/join/?open=1');
                         }
                     }
                 }
             } else {
                 Response::redirect('/students/signin?e=1');
             }
         } else {
             Response::redirect('/students/signin?e=1');
         }
     }
     $view = View::forge("students/signin");
     $this->template->content = $view;
     $this->template->title = "Signin";
     $this->template->auth_status = false;
 }
开发者ID:Trd-vandolph,项目名称:game-bootcamp,代码行数:52,代码来源:signin.php

示例6: post_is_unique

 public function post_is_unique()
 {
     if (Input::is_ajax()) {
         //            $this->format = 'json';
         $username = Input::post('username');
         $username = Model_User::query()->where('email', $username)->get_one();
         if ($username === null) {
             return $this->response(array('unique' => true));
         }
         return $this->response(array('unique' => false));
     }
     return false;
 }
开发者ID:daniel-rodas,项目名称:rodasnet.com,代码行数:13,代码来源:user.php

示例7: action_show_by_author

 /**
  * Get all categorys from author
  * @param  string $author username
  */
 public function action_show_by_author($author = false)
 {
     $author = $this->data['author'] = \Model_User::query()->where('username', $author)->get_one();
     if (!$author) {
         \Messages::error(__('frontend.author.not-found'));
         \Response::redirect_back(\Router::get('homepage'));
     } else {
         // Pagination
         $config = array('pagination_url' => \Uri::current(), 'total_items' => count($author->posts), 'per_page' => \Config::get('application.pagination.per_page'), 'uri_segment' => 'page');
         $this->data['pagination'] = $pagination = \Pagination::forge('category_pagination', $config);
         // Get categorys
         $this->data['categories'] = Model_Category::query()->where('user_id', $author->id)->order_by('created_at', 'DESC')->offset($pagination->offset)->limit($pagination->per_page)->get();
         return \Response::forge(\View::forge('frontend/category/author')->set($this->data, null, false));
     }
 }
开发者ID:daniel-rodas,项目名称:rodasnet.com,代码行数:19,代码来源:category.php

示例8: action_index

 public function action_index()
 {
     $where = [["group_id", 1], ["deleted_at", 0]];
     $query = Model_User::query()->where('group_id', '=', 1)->where('deleted_at', '=', 0);
     if ($search_text = Input::get("search_text", "")) {
         $query->where_open()->where('email', 'like', "%{$search_text}%")->or_where('firstname', 'like', "%{$search_text}%")->or_where('middlename', 'like', "%{$search_text}%")->or_where('lastname', 'like', "%{$search_text}%")->or_where('lastname', 'like', "%{$search_text}%")->or_where(DB::expr("CONCAT(trim(firstname),' ',trim(middlename))"), 'like', "%{$search_text}%")->or_where(DB::expr("CONCAT(trim(middlename),' ',trim(firstname))"), 'like', "%{$search_text}%")->or_where(DB::expr("CONCAT(trim(firstname),' ',trim(lastname))"), 'like', "%{$search_text}%")->or_where(DB::expr("CONCAT(trim(lastname),' ',trim(firstname))"), 'like', "%{$search_text}%")->or_where(DB::expr("CONCAT(trim(middlename),' ',trim(lastname))"), 'like', "%{$search_text}%")->or_where(DB::expr("CONCAT(trim(lastname),' ',trim(middlename))"), 'like', "%{$search_text}%")->or_where(DB::expr("CONCAT(trim(firstname),' ',trim(middlename),' ',trim(lastname))"), 'like', "%{$search_text}%")->or_where(DB::expr("CONCAT(trim(lastname),' ',trim(middlename),' ',trim(firstname))"), 'like', "%{$search_text}%")->or_where(DB::expr("CONCAT(trim(lastname),' ',trim(firstname),' ',trim(middlename))"), 'like', "%{$search_text}%")->order_by("id", "desc")->where_close();
     }
     $data["result"] = $query->get();
     $data["users"] = Model_User::find("all", ["where" => $where, "order_by" => [["id", "desc"]]]);
     Input::get("search_text", "") ? $pages = 'result' : ($pages = 'users');
     $config = array('pagination_url' => "?search_text=" . Input::get("search_text", ""), 'uri_segment' => "p", 'num_links' => 9, 'per_page' => 20, 'total_items' => count($data[$pages]));
     $data["pager"] = Pagination::forge('mypagination', $config);
     $data[$pages] = array_slice($data[$pages], $data["pager"]->offset, $data["pager"]->per_page);
     $view = View::forge("admin/students/index", $data);
     $this->template->content = $view;
 }
开发者ID:Trd-vandolph,项目名称:game-bootcamp,代码行数:16,代码来源:students.php

示例9: action_showAll

 public function action_showAll()
 {
     $lPage = Input::get('current_page', 0);
     \Config::load('db', true);
     $lItemsPerPage = \Config::get('db.items_per_page');
     $lResult = Model_User::query()->limit($lItemsPerPage)->offset($lPage * $lItemsPerPage)->get();
     $lUsers = [];
     $n = 0;
     foreach ($lResult as $lVal) {
         $lUsers[$n] = $lVal->to_array();
         $lUsers[$n]['profile_fields'] = unserialize($lUsers[$n]['profile_fields']);
         $n++;
     }
     $lPagination = Pagination::forge('data_table', array('pagination_url' => '/main/index', 'total_items' => DB::count_last_query(), 'num_links' => 3, 'per_page' => $lItemsPerPage, 'current_page' => $lPage, 'uri_segment' => 'current_page'))->render();
     $this->template->content = View::forge('users/show_all_users', ['pagination' => $lPagination, 'users' => $lUsers]);
     return $this->template;
 }
开发者ID:FTTA,项目名称:devels,代码行数:17,代码来源:users.php

示例10: action_index

 public function action_index()
 {
     // was the login form posted?
     if (\Input::method() == 'POST') {
         // perform a login
         if (Auth::login(Input::Post('username'), Input::Post('password'))) {
             // the user is succesfully logged in
             \Response::redirect_back('home');
         } else {
             // ERROR USER NAME OR PASS BAD
             $user = Model_User::query()->where('username', Input::Post('username'))->get_one();
             if (empty($user) === false) {
                 Session::Set('error', 'Invalid password!');
             } else {
                 Session::Set('error', 'There is no username / email : ' . Input::Post('username'));
             }
         }
     }
     $this->template->content = View::forge('login/index');
 }
开发者ID:aircross,项目名称:MeeLa-Premium-URL-Shortener,代码行数:20,代码来源:login.php

示例11: action_delete

 public function action_delete()
 {
     $lUserId = Input::post('user_id', null);
     if (!$lUserId || !is_numeric($lUserId)) {
         die(json_encode(['status' => 'error', 'message' => 'Invalid user ID'], JSON_UNESCAPED_UNICODE));
     }
     $lUser = Model_User::query()->where('id', $lUserId)->get_one()->to_array();
     $lUser = array_merge($lUser, unserialize($lUser['profile_fields']));
     $lIsOwner = $lUser['id'] == $this->current_user['id'];
     if (!$this->is_admin && !$lIsOwner) {
         die(json_encode(['status' => 'error', 'message' => 'Access denied'], JSON_UNESCAPED_UNICODE));
     }
     $lResult = Auth::update_user(['is_deleted' => true], $lUser['username']);
     if ($lResult) {
         if ($lIsOwner) {
             Auth::logout();
         }
         die(json_encode(['status' => 'ok'], JSON_UNESCAPED_UNICODE));
     }
     die(json_encode(['status' => 'error', 'message' => 'User was not deleted'], JSON_UNESCAPED_UNICODE));
 }
开发者ID:FTTA,项目名称:devels,代码行数:21,代码来源:Users.php

示例12: action_edit

 public function action_edit()
 {
     $this->template->scripts[] = 'profile.js';
     $this->template->scripts[] = 'file_uploader.js';
     $this->template->styles[] = 'file_uploader.css';
     $lUserId = Input::get('user_id', null);
     $lUser = Model_User::query()->where('id', $lUserId)->get_one()->to_array();
     $lUser = array_merge($lUser, unserialize($lUser['profile_fields']));
     $lIsOwner = $lUser['id'] == $this->current_user['id'];
     $lIsAdmin = $this->current_user['role_id'] == AuthModule::UR_ADMIN;
     if (!$lIsOwner && !$lIsAdmin) {
         throw new Exception('You do not have access');
     }
     //$lUserData = Auth::get_profile_fields();
     //$lUserData['user_id']   = $this->current_user['id'];
     //$lUserData['email']     = Auth::get_email();
     //$lUserData['username']  = Auth::get('username');
     if (!empty($lUser['avatar_id'])) {
         $lUser['avatar'] = Model_Avatars::getById($lUser['avatar_id']);
     }
     $this->template->content = View::forge('user_edit', ['user_data' => $lUser, 'admin_mode' => $lIsAdmin && !$lIsOwner]);
     return $this->template;
 }
开发者ID:FTTA,项目名称:devels,代码行数:23,代码来源:Profile.php

示例13: action_login

 public function action_login()
 {
     $login_log = new Model_Users_Log_Login();
     if (Input::method() == 'POST') {
         if (Auth::login(Input::post('username'), Input::post('password'))) {
             list($driver, $user_id) = Auth::get_user_id();
             $login_log->user_id = $user_id;
             $login_log->status = 1;
             $login_log->login_time = strtotime('NOW');
             $login_log->attempted_login = Input::post('username');
             $login_log->ip_address = $_SERVER['REMOTE_ADDR'];
             $login_log->save();
             Response::redirect('/');
         } else {
             $query = Model_User::query()->where('username', Input::post('username'));
             if ($query->count() > 0) {
                 $attempt = $query->get_one();
                 $user_id = $attempt->id;
                 $login_log->user_id = $user_id;
                 $login_log->status = 2;
                 $login_log->login_time = strtotime('NOW');
                 $login_log->attempted_login = Input::post('username');
                 $login_log->ip_address = $_SERVER['REMOTE_ADDR'];
             } else {
                 $user_id = 0;
                 $login_log->user_id = $user_id;
                 $login_log->status = 2;
                 $login_log->login_time = strtotime('NOW');
                 $login_log->attempted_login = Input::post('username');
                 $login_log->ip_address = $_SERVER['REMOTE_ADDR'];
             }
             $login_log->save();
             Session::set_flash('fail', 'Invalid Username or Password!');
         }
     }
     return View::forge('welcome/login', array('title' => 'Login'));
 }
开发者ID:ClixLtd,项目名称:pccupload,代码行数:37,代码来源:user.php

示例14: action_mailRegist

    public function action_mailRegist($token = null)
    {
        if ($token == null) {
            return Response::forge("不正なパラメータです。");
        }
        //メール送信済みユーザーからtokenが一致するものを取得
        $query = Model_MailUser::query()->where('token', $token);
        $user = $query->get_one();
        if ($user == null) {
            return Response::forge("不正なパラメータです。");
        }
        $query2 = Model_User::query()->where('username', $user->userName);
        $count = $query2->count();
        if ($count != 0) {
            $dsc2 = <<<END
<BR>
既に登録済みです。
<a href = "/index">トップページに戻る</a>\t\t\t\t
END;
            return Response::forge($dsc2);
        }
        //メール送信からの経過時刻
        $diffTime = time() - $user->created_at;
        //			return Response::forge($diffTime.'秒経過');
        if ($diffTime < REGIST_TIME) {
            //ユーザー登録成功
            Auth::create_user($user->userName, $user->password, $user->email, 3);
            //3 = user
            //新規作成したユーザーでログイン
            if (Auth::validate_user($user->userName, $user->password)) {
                Auth::login($user->userName, $user->password);
                $dsc2 = <<<END
<BR>
ユーザー登録に成功しました。
<a href = "/index">トップページに戻る</a>\t\t\t\t
END;
                $log = new Logging();
                $log->writeLog_Info('New user regist.');
                return Response::forge($dsc2);
            }
            return Response::forge("ユーザー登録に失敗しました。");
        } else {
            $log = new Logging();
            $log->writeLog_Info('New user regist time out');
            return Response::forge("ユーザー登録制限時間を過ぎました。");
        }
    }
开发者ID:katsuwo,项目名称:bbs,代码行数:47,代码来源:index.php

示例15: valid_field

 public static function valid_field($field, $val)
 {
     $result = Model_User::query()->where(array($field => $val));
     return $result->count() > 0;
 }
开发者ID:khoapld,项目名称:wjshop,代码行数:5,代码来源:user.php


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