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


PHP RequestUtil类代码示例

本文整理汇总了PHP中RequestUtil的典型用法代码示例。如果您正苦于以下问题:PHP RequestUtil类的具体用法?PHP RequestUtil怎么用?PHP RequestUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: index

 public function index()
 {
     $workTime = new WorkTimeUtil();
     if (RequestUtil::isPost()) {
         $params = RequestUtil::postParams();
         $params = array_map(function ($time) {
             if (!preg_match("~^\\d{2}:\\d{2}:\\d{2}\$~", $time)) {
                 return "{$time}:00";
             } else {
                 return $time;
             }
         }, $params);
         $allDay = $workTime->build($params['allDayStart'], $params['allDayEnd']);
         $morningShift = $workTime->build($params['morningShiftStart'], $params['morningShiftEnd']);
         $middayShift = $workTime->build($params['middayShiftStart'], $params['middayShiftEnd']);
         $nightShift = $workTime->build($params['nightShiftStart'], $params['nightShiftEnd']);
         $workTime->saveWorkTime($allDay, $morningShift, $nightShift, $middayShift);
         $workTime->getTime();
     }
     list($allDayStart, $allDayEnd) = $workTime->explode($workTime->getAllDay());
     list($morningShiftStart, $morningShiftEnd) = $workTime->explode($workTime->getMorningShift());
     list($middayShiftStart, $middayShiftEnd) = $workTime->explode($workTime->getMiddayShift());
     list($nightShiftStart, $nightShiftEnd) = $workTime->explode($workTime->getNightShift());
     $setting = array('allDayStart' => $allDayStart, 'allDayEnd' => $allDayEnd, 'morningShiftStart' => $morningShiftStart, 'morningShiftEnd' => $morningShiftEnd, 'nightShiftStart' => $nightShiftStart, 'nightShiftEnd' => $nightShiftEnd, 'middayShiftStart' => $middayShiftStart, 'middayShiftEnd' => $middayShiftEnd);
     $this->view('workTimeSetting', array('setting' => $setting));
 }
开发者ID:guohao214,项目名称:xinya,代码行数:26,代码来源:WorkTime.php

示例2: updateSlider

 public function updateSlider($sliderId)
 {
     if (!$sliderId) {
         $this->message('ID不能为空!');
     }
     if (RequestUtil::isPost()) {
         $this->sliderModel->deleteSliderCache();
         $params = RequestUtil::postParams();
         // href
         if (!preg_match('~^http[s]?://~', $params['href'])) {
             $params['href'] = 'http://' . $params['href'];
         }
         if ($this->sliderModel->rules()->run()) {
             $upload = UploadUtil::commonUpload(array('upload/resize_200x200', 'upload/resize_100x100', 'upload/resize_600x600'));
             if ($upload) {
                 $params['pic'] = $upload;
             }
             $returnUrl = 'slider/updateSlider/' . $sliderId;
             if ((new CurdUtil($this->sliderModel))->update(array('slider_id' => $sliderId), $params)) {
                 $this->message('修改成功!', $returnUrl);
             } else {
                 $this->message('修改失败!', $returnUrl);
             }
         }
     }
     $slider = (new CurdUtil($this->sliderModel))->readOne(array('slider_id' => $sliderId, 'disabled' => 0));
     if (!$slider) {
         $this->message('记录不存在或者已被删除!', 'slider/index');
     }
     $this->view('slider/updateSlider', array('slider' => $slider));
 }
开发者ID:guohao214,项目名称:xinya,代码行数:31,代码来源:Slider.php

示例3: index

 public function index()
 {
     $error = '';
     if (RequestUtil::isPost()) {
         $validate = new ValidateUtil();
         $validate->required('user_name');
         $validate->required('password');
         $validate->required('verify_code');
         $params = RequestUtil::postParams();
         if ($params['verify_code'] != UserUtil::getVerifyCode()) {
             $error = '验证码错误!';
         } else {
             if ($validate->run()) {
                 $userModel = new UserModel();
                 $params['password'] = $userModel->encodePassword($params['password']);
                 $where = array('user_name' => $params['user_name'], 'password' => $params['password']);
                 $user = (new CurdUtil($userModel))->readOne($where, 'user_id desc', '*, user_type+0 as type');
                 if (!$user) {
                     $error = '登录失败,账号或者密码错误,请重试!';
                 } else {
                     (new CurdUtil($userModel))->update($where, array('last_login_time' => DateUtil::now()));
                     UserUtil::saveUser($user);
                     if (UserUtil::isAdmin()) {
                         ResponseUtil::redirect(UrlUtil::createBackendUrl('project/index'));
                     } else {
                         ResponseUtil::redirect(UrlUtil::createBackendUrl('beautician/index'));
                     }
                 }
             }
         }
     }
     $this->load->view('backend/login', array('error' => $error));
 }
开发者ID:guohao214,项目名称:xinya,代码行数:33,代码来源:Login.php

示例4: _finish

 protected function _finish($code, $originalRedirectUri)
 {
     // This endpoint requires "Basic" auth.
     $clientCredentials = $this->appInfo->getKey() . ":" . $this->appInfo->getSecret();
     $authHeaderValue = "Basic " . base64_encode($clientCredentials);
     $response = RequestUtil::doPostWithSpecificAuth($this->clientIdentifier, $authHeaderValue, $this->userLocale, $this->appInfo->getHost()->getApi(), "1/oauth2/token", array("grant_type" => "authorization_code", "code" => $code, "redirect_uri" => $originalRedirectUri));
     if ($response->statusCode !== 200) {
         throw RequestUtil::unexpectedStatus($response);
     }
     $parts = RequestUtil::parseResponseJson($response->body);
     if (!array_key_exists('token_type', $parts) or !is_string($parts['token_type'])) {
         throw new Exception_BadResponse("Missing \"token_type\" field.");
     }
     $tokenType = $parts['token_type'];
     if (!array_key_exists('access_token', $parts) or !is_string($parts['access_token'])) {
         throw new Exception_BadResponse("Missing \"access_token\" field.");
     }
     $accessToken = $parts['access_token'];
     if (!array_key_exists('uid', $parts) or !is_string($parts['uid'])) {
         throw new Exception_BadResponse("Missing \"uid\" string field.");
     }
     $userId = $parts['uid'];
     if ($tokenType !== "Bearer" && $tokenType !== "bearer") {
         throw new Exception_BadResponse("Unknown \"token_type\"; expecting \"Bearer\", got  " . Client::q($tokenType));
     }
     return array($accessToken, $userId);
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:27,代码来源:WebAuthBase.php

示例5: __construct

 public function __construct($totalSize = 0, $config = 'pagination')
 {
     $config = ConfigUtil::loadConfig($config);
     $instance = get_instance();
     $config['total_rows'] = $totalSize;
     $config['base_url'] = RequestUtil::CM();
     $instance->load->library('pagination', $config);
     $this->pagination = $instance->pagination;
 }
开发者ID:guohao214,项目名称:xinya,代码行数:9,代码来源:PaginationUtil.php

示例6: GetConnectionString

 /**
  * Get connection string based on request variables
  */
 protected function GetConnectionString()
 {
     $cstring = new DBConnectionString();
     $cstring->Host = RequestUtil::Get('host');
     $cstring->Port = RequestUtil::Get('port');
     $cstring->Username = RequestUtil::Get('username');
     $cstring->Password = RequestUtil::Get('password');
     $cstring->DBName = RequestUtil::Get('schema');
     return $cstring;
 }
开发者ID:niceboy120,项目名称:phreeze,代码行数:13,代码来源:BaseController.php

示例7: Init

 /**
  * Initialize the GlobalConfig object
  */
 static function Init()
 {
     if (!self::$IS_INITIALIZED) {
         require_once 'verysimple/HTTP/RequestUtil.php';
         RequestUtil::NormalizeUrlRewrite();
         require_once 'verysimple/Phreeze/Controller.php';
         Controller::$SmartyViewPrefix = '';
         Controller::$DefaultRedirectMode = 'header';
         self::$IS_INITIALIZED = true;
     }
 }
开发者ID:muralhaa,项目名称:imoveis,代码行数:14,代码来源:_global_config.php

示例8: Login

 /**
  * Process the login, create the user session and then redirect to 
  * the appropriate page
  */
 public function Login()
 {
     $user = new ExampleUser();
     if ($user->Login(RequestUtil::Get('username'), RequestUtil::Get('password'))) {
         // login success
         $this->SetCurrentUser($user);
         $this->Redirect('SecureExample.UserPage');
     } else {
         // login failed
         $this->Redirect('SecureExample.LoginForm', 'Combinaçãoo de usuário ou senha incorretos');
     }
 }
开发者ID:joaoricardorm,项目名称:phreeze,代码行数:16,代码来源:SecureExampleController.php

示例9: Login

 /**
  * Process the login, create the user session and then redirect to 
  * the appropriate page
  */
 public function Login()
 {
     $user = new User($this->Phreezer);
     if ($user->Login(RequestUtil::Get('username'), RequestUtil::Get('password'))) {
         // login success
         $this->SetCurrentUser($user);
         $this->Redirect('Secure.UserPage');
     } else {
         // login failed
         $this->Redirect('Secure.LoginForm', 'Usuario e senha invalidos.');
     }
 }
开发者ID:edusalazar,项目名称:imoveis,代码行数:16,代码来源:SecureController.php

示例10: index

 public function index($limit = '')
 {
     // 获得查询参数, 查询参数都为like模糊查询
     $where = RequestUtil::buildLikeQueryParamsWithDisabled();
     $this->db->select('*');
     $orders = (new CurdUtil($this->offlineOrderModel))->readLimit($where, $limit, 'offline_order_id desc');
     $ordersCount = (new CurdUtil($this->offlineOrderModel))->count($where);
     $pages = (new PaginationUtil($ordersCount))->pagination();
     $shops = (new ShopModel())->getAllShops();
     $beauticians = (new BeauticianModel())->getAllFormatBeauticians();
     $this->view('offline/order', array('orders' => $orders, 'pages' => $pages, 'beauticians' => $beauticians, 'params' => RequestUtil::getParams(), 'shops' => $shops, 'limit' => $limit));
 }
开发者ID:guohao214,项目名称:xinya,代码行数:12,代码来源:OfflineOrder.php

示例11: index

 public function index($limit = '')
 {
     // 获得查询参数, 查询参数都为like模糊查询
     $where = RequestUtil::buildLikeQueryParamsWithDisabled();
     $this->db->select('*');
     $customers = (new CurdUtil($this->customerModel))->readLimit($where, $limit, 'customer_id desc');
     $customersCount = (new CurdUtil($this->customerModel))->count($where);
     $pages = (new PaginationUtil($customersCount))->pagination();
     // 用户的性别,值为1时是男性,值为2时是女性,值为0时是未知
     $sex = array('未知', '男', '女');
     $this->view('customer/index', array('customers' => $customers, 'pages' => $pages, 'params' => RequestUtil::getParams(), 'limit' => $limit, 'sex' => $sex));
 }
开发者ID:guohao214,项目名称:xinya,代码行数:12,代码来源:Customer.php

示例12: addForNewUserProject

 /**
  * 增加新用户专享
  */
 public function addForNewUserProject()
 {
     if (RequestUtil::isPost()) {
         $params = RequestUtil::postParams();
         $insertId = (new CurdUtil($this->projectPropertyModel))->create($params);
         if ($insertId) {
             $this->message('新增成功!', 'ProjectProperty/projectForNewUserList');
         } else {
             $this->message('新增失败!');
         }
     }
     $categories = (new CategoryModel())->getAllCategories();
     $this->view('projectProperty/forNewUser', array('categories' => $categories));
 }
开发者ID:guohao214,项目名称:xinya,代码行数:17,代码来源:ProjectProperty.php

示例13: testDisallowed

 static function testDisallowed($url, $expectedExceptionMessage)
 {
     $curl = RequestUtil::mkCurl("test-ssl", $url);
     $curl->set(CURLOPT_RETURNTRANSFER, true);
     try {
         $curl->exec();
     } catch (Exception_NetworkIO $ex) {
         if (strpos($ex->getMessage(), $expectedExceptionMessage) == 0) {
             return true;
         } else {
             throw $ex;
         }
     }
     return false;
 }
开发者ID:harshzalavadiya,项目名称:SimpleDropboxUploader,代码行数:15,代码来源:SSLTester.php

示例14: addArticle

 public function addArticle()
 {
     if (RequestUtil::isPost()) {
         if ($this->articleModel->rules()->run()) {
             $params = RequestUtil::postParams();
             $insertId = (new CurdUtil($this->articleModel))->create(array_merge($params, array('create_time' => DateUtil::now())));
             if ($insertId) {
                 $this->message('新增文章成功!', 'article/index');
             } else {
                 $this->message('新增文章失败!', 'article/index');
             }
         }
     }
     $this->view('article/addArticle');
 }
开发者ID:guohao214,项目名称:xinya,代码行数:15,代码来源:Article.php

示例15: addShop

 /**
  * 添加店铺
  */
 public function addShop()
 {
     if (RequestUtil::isPost()) {
         if ($this->shopModel->rules()->run()) {
             $params = RequestUtil::postParams();
             $params['shop_logo'] = UploadUtil::commonUpload(array('upload/resize_200x200', 'upload/resize_100x100'));
             $insertId = (new CurdUtil($this->shopModel))->create(array_merge($params, array('create_time' => DateUtil::now())));
             if ($insertId) {
                 $this->message('新增店铺成功!', 'shop/index');
             } else {
                 $this->message('新增店铺失败!', 'shop/index');
             }
         }
     }
     $this->view('shop/addShop');
 }
开发者ID:guohao214,项目名称:xinya,代码行数:19,代码来源:Shop.php


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