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


PHP Authorization类代码示例

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


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

示例1: get_instance

 public static function get_instance()
 {
     if (self::$instance == false) {
         self::$instance = new Authorization();
     }
     return self::$instance;
 }
开发者ID:jedrus113,项目名称:AD_Project,代码行数:7,代码来源:Authorization.php

示例2: CanEditProblem

 public static function CanEditProblem($user_id, Problems $problem)
 {
     if (is_null($problem) || !is_a($problem, "Problems")) {
         return false;
     }
     return Authorization::IsProblemAdmin($user_id, $problem);
 }
开发者ID:kukogit,项目名称:omegaup,代码行数:7,代码来源:Authorization.php

示例3: getPanel

    public static function getPanel() {

        if( !Authorization::isAuthorized() ) return;

        $panelStyles = API::parseStylesFile(CUSTOMPATH.DS."Global.views");
        $paneltpl = $panelStyles["VeronicaAdminPanel"][2];
        $menuItemtpl = $panelStyles["VeronicaMenuListItem"][2];
        $controllers = Api::getCustom("Controller");
        $modeles = Api::getCustom("Model");
        
        $user = Authorization::getCurrentUser();
        
        $userpanel = ViewHandler::wrap("CurrentUser", $user[0]);

        
        $paneltpl = str_replace("<? echo \$USERPANEL;?>", $userpanel, $paneltpl);
        
        $list = "";
        foreach ($controllers as $controller){
            if($controller::$inAdminPanel){
                
                $l = str_replace("<? echo \$ADDCLICKHANDLER;?>", "Controller.add('".$controller::$name."');", $menuItemtpl);
                $l = str_replace("<? echo \$CLICKHANDLER;?>", "Controller.openDashboard('".$controller::$name."');", $l);
                $l = str_replace("<? echo \$COUNT;?>", "Controller.openDashboard('".$controller::$name."');", $l);
                $list .= str_replace("<? echo \$ALIAS;?>", $controller::$alias, $l);
            }
        }
        $paneltpl = str_replace("<? echo \$MENULIST;?>", $list, $paneltpl);
        return $paneltpl;

    }
开发者ID:neronmoon,项目名称:Veronica,代码行数:31,代码来源:AdminPanel.class.php

示例4: approveUser

 function approveUser($login, $pass, $createIP)
 {
     if ($this->checkPass($pass, $login)) {
         #ПРОВЕРЯЕМ ПРАВИЛЬНОСТЬ ПАРОЛЯ
         $ip = 0;
         $time = time() + 60 * 2;
         $this->hash = md5($this->generateCode(10));
         if ($createIP) {
             $ip = ip2long($_SERVER['REMOTE_ADDR']);
         }
         $this->prepareQuery("INSERT INTO sessions SET user_id=:id, time=:time, hash=:hash, ip=:ip");
         /*$this->prepareQuery("UPDATE user SET hash=:hash, ip=:ip WHERE id=:id");*/
         $this->query->bindParam(':hash', $this->hash);
         $this->query->bindParam(':ip', $ip);
         $this->query->bindParam(':id', $this->thisUser['user_id']);
         $this->query->bindParam(':time', $time);
         // Два часа!
         $this->executeQuery_Simple();
         $this->createCookie();
         // Создаем куки
         /*            $this->deleteOldSessions(); // Удаляем устаревшие сессии*/
         return true;
     } else {
         $this->errors['password_login'] = 'has-error';
         // class из bootstrap
         Authorization::logOut();
         return false;
     }
 }
开发者ID:Falscroom,项目名称:myFirstSite,代码行数:29,代码来源:model_login.php

示例5: configure

	public static function configure( $home ){
		self::$home = $home;
                $js = ""; $css = "";
                if( Authorization::isAuthorized() ){
                    $files = API::getFileList( INCLUDEPATH );
                    
                    $files = array_merge(API::getFileList( PLUGINSPATH ), $files);
                    $pos = array_search("./include/cmf/js/lib.js",$files);
                    unset($files[$pos]);
                }
                else{
                    $files = API::getFileList( INCLUDEPATH,-1 );
                    $files[] = "./include/cmf/js/lib.js";
                    $files[] = "./include/cmf/css/cmf.notify.css";
                    $files[] = "./include/cmf/css/cmf.ui.css";
                }
                
                rsort($files);
                foreach ($files as $path) {

                    $ext = pathinfo($path);
                    if( substr($ext['filename'], 0,1) == '_' ) continue;
                    $ext = $ext['extension'];
                    if($ext == "js"){
                        $js .= str_replace("{PATH}", $path, Storage::get("Template::jsInclude"));
                    }else if($ext == "css")
                        $css .= str_replace("{PATH}", $path, Storage::get("Template::cssInclude"));
                }

                self::assign("TITLE", Config::$SiteConf['name']);
                self::assign("META", Config::$SiteConf['meta']);
                self::assign("JSINCLUDE", $js);
                self::assign("CSSINCLUDE", $css);
               // l(self::$vars);
	}
开发者ID:neronmoon,项目名称:Veronica,代码行数:35,代码来源:Template.class.php

示例6: init

 public static function init()
 {
     if (empty(self::$obj)) {
         self::$obj = new Authorization();
     }
     return self::$obj;
 }
开发者ID:freecod,项目名称:UserList,代码行数:7,代码来源:auth.php

示例7: __callStatic

 /**
  * Handles the requests for post() and get()
  *
  * @param $name
  * @param $arguments
  */
 public static function __callStatic($name, $arguments)
 {
     $response = static::_transfer($name, $arguments);
     if ($response && $name != 'delete') {
         $result = static::_reponse($response);
         if ($result) {
             if (is_object($result) || !isset($result['error'])) {
                 return $result;
             } else {
                 // Expired token ?
                 if (isset($result['error']['message']) && $result['error']['message'] == Auth::$_errors['oAuthTokenExpired']) {
                     if (isset($arguments[2])) {
                         Authorization::oAuthRefreshToken($arguments[2], 'updateSession', 'force');
                         call_user_func(array('Rest', $name), $arguments);
                     } else {
                         return compact('result', 'name', 'arguments', 'response');
                     }
                 } else {
                     if (isset($result['error']['message']) && $result['error']['message'] != 'Forbidden' && $result['error']['message'] != 'Not Found') {
                         return compact('result', 'name', 'arguments', 'response');
                     }
                 }
             }
         } else {
             return compact('result', 'name', 'arguments', 'response');
         }
     } else {
         if ($name != 'delete') {
             return compact('result', 'name', 'arguments', 'response');
         }
     }
 }
开发者ID:unDemian,项目名称:gcdc-migrate,代码行数:38,代码来源:Rest.php

示例8: Insert

 public static function Insert($data, $settings, $marathon, $campaign, $database)
 {
     if (!Authorization::IsAuthorized($settings)) {
         return new ZdpArrayObject(['error' => 'You are not authorized to perform this action.']);
     }
     $playerID;
     $gameID;
     $scheduleStartTime;
     $scheduleEndTime;
     $scheduleUnlockAmount;
     $error = false;
     $errorMessage;
     if (array_key_exists('PlayerID', $data)) {
         $playerID = $data['PlayerID'];
     } else {
         $error = true;
         $errorMessage = 'No player id was provided.';
     }
     if (array_key_exists('GameID', $data)) {
         $gameID = $data['GameID'];
     } else {
         $error = true;
         $errorMessage = 'No game id was provided.';
     }
     if (array_key_exists('StartTime', $data)) {
         $scheduleStartTime = $data['StartTime'];
     } else {
         $error = true;
         $errorMessage = 'No start time was provided.';
     }
     if (array_key_exists('EndTime', $data)) {
         $scheduleEndTime = $data['EndTime'];
     } else {
         $error = true;
         $errorMessage = 'No end time was provided.';
     }
     if (array_key_exists('UnlockAmount', $data)) {
         $scheduleUnlockAmount = $data['UnlockAmount'];
     } else {
         $error = true;
         $errorMessage = 'No unlock amount was provided.';
     }
     if ($database instanceof ZdpArrayObject) {
         $error = true;
         $errorMessage = $database['error'];
     }
     if (!$error) {
         $sql = 'CALL sp_insert_schedule (:game_id, :campaign_id, :player_id, :schedule_endtime, :schedule_starttime, :schedule_unlockamount)';
         $statement = $database->prepare($sql);
         if ($statement->execute([':game_id' => $gameID, ':campaign_id' => $campaign, ':player_id' => $playerID, ':schedule_starttime' => $scheduleStartTime, ':schedule_endtime' => $scheduleEndTime, ':schedule_unlockamount' => $scheduleUnlockAmount])) {
             $schedules = $statement->fetchAll(PDO::FETCH_ASSOC);
             $output = new ZdpArrayObject(['result' => new ZdpArrayObject(['schedule' => $schedules])]);
         } else {
             $output = new ZdpArrayObject(['error' => $statement->errorInfo()]);
         }
     } else {
         $output = new ZdpArrayObject(['error' => $errorMessage]);
     }
     return $output;
 }
开发者ID:noahshrader,项目名称:zdp,代码行数:60,代码来源:Schedules.class.php

示例9: editCategory

 public function editCategory($id)
 {
     if (Authorization::Authorize('Admin')) {
         $this->view->category = $this->model->getCategory();
         // viet code xy lu o day
         $this->data = array();
         $this->view->title = 'Edit Category';
         $this->view->cat = $this->model->showCatById($id);
         if (isset($_POST['submit'])) {
             if (empty($_POST['catname'])) {
                 $this->view->msg = "Vui lòng nhập tên Category";
                 $this->view->renderAdmin('category/editcategory');
             } else {
                 $this->data['catname'] = mysqli_real_escape_string($this->model->connect, $_POST['catname']);
                 $this->data['parent'] = $_POST['category'];
                 if ($this->model->editCat($this->data, $id) == true) {
                     $this->view->redirect('listcategory');
                 } else {
                     $this->view->msg = "Edit category faild";
                     $this->view->renderAdmin('category/editcategory');
                 }
             }
         } else {
             $this->view->renderAdmin("category/editcategory");
         }
     } else {
         $this->view->render("user/index");
     }
 }
开发者ID:hant0811,项目名称:Repro_News,代码行数:29,代码来源:category_Controller.php

示例10: Insert

 public static function Insert($data, $settings, $marathon, $campaign, $database)
 {
     if (!Authorization::IsAuthorized($settings)) {
         return new ZdpArrayObject(['error' => 'You are not authorized to perform this action.']);
     }
     $playerName;
     $error = false;
     if (array_key_exists('name', $POST) && trim($_POST['name']) != '') {
         $playerName = $_POST['name'];
     } else {
         $error = true;
         $errorMessage = 'No player name was provided.';
     }
     if ($database instanceof ZdpArrayObject) {
         $error = true;
         $errorMessage = $database['error'];
     }
     if (!$error) {
         $sql = 'CALL sp_insert_player (:campaign_id, :marathon_id, :player_name)';
         $statement = $database->prepare($sql);
         if ($statement->execute([':marathon_id' => $marathon, ':campaign_id' => $campaign, ':player_name' => $playerName])) {
             $players = $statement->fetchAll(PDO::FETCH_ASSOC);
             $output = new ZdpArrayObject(['result' => new ZdpArrayObject(['player' => $players])]);
         } else {
             $output = new ZdpArrayObject(['error' => $statement->errorInfo()]);
         }
     } else {
         $output = new ZdpArrayObject(['error' => $errorMessage]);
     }
     return $output;
 }
开发者ID:noahshrader,项目名称:zdp,代码行数:31,代码来源:Players.class.php

示例11: validateRequest

 /**
  * Validate requests for grader apis
  *
  * @param Request $r
  * @throws ForbiddenAccessException
  */
 private static function validateRequest(Request $r)
 {
     self::authenticateRequest($r);
     if (!Authorization::IsSystemAdmin($r['current_user_id'])) {
         throw new ForbiddenAccessException();
     }
 }
开发者ID:andreasantillana,项目名称:omegaup,代码行数:13,代码来源:GraderController.php

示例12: run

 /**
  * @return retorna un peticion solicitada 
  */
 public static function run(Request $peticion)
 {
     $controller = $peticion->getControlador() . "Controller";
     $rutaControlador = ROOT . "controllers" . DS . $controller . ".php";
     $metodo = $peticion->getMetodo();
     $args = $peticion->getArgs();
     //exit;
     if (is_readable($rutaControlador)) {
         require_once $rutaControlador;
         $Controlador = new $controller();
         if (is_callable(array($controller, $metodo))) {
             $metodo = $peticion->getMetodo();
         } else {
             $metodo = "index";
         }
         if ($metodo == 'login') {
             # code...
         } else {
             Authorization::Logged();
         }
         if (isset($args)) {
             call_user_func_array(array($Controlador, $metodo), $args);
         } else {
             call_user_func(array($Controlador, $metodo));
         }
     } else {
         throw new Exception("Controlador no encontrado ");
     }
 }
开发者ID:salvaroad,项目名称:framework3,代码行数:32,代码来源:Bootstrap.php

示例13: run

 /**
  * run ejecuta clase Request
  * permite llamar una funcion sin necesidad de instanciar la clase
  * @param  string $peticion parametro que se recibe de Request
  * @var  string controller almacena controlador
  * @var  string rutaControlador guarda ruta del controlador
  * @var  string $metodo invoca a la funcion getMetodo de request
  * @var  string $args invoca a la funcion getArgs de request
  * */
 public static function run(Request $peticion)
 {
     $controller = $peticion->getControlador() . 'Controller';
     $rutaControlador = ROOT . 'controllers' . DS . $controller . '.php';
     $metodo = $peticion->getMetodo();
     $args = $peticion->getArgs();
     if (is_readable($rutaControlador)) {
         include_once $rutaControlador;
         $controlador = new $controller();
         if (is_callable(array($controller, $metodo))) {
             $metodo = $peticion->getMetodo();
         } else {
             $metodo = 'index';
         }
         if ($metodo == 'login') {
         } else {
             Authorization::logged();
         }
         if (isset($args)) {
             call_user_func_array(array($controlador, $metodo), $args);
         } else {
             call_user_func_array(array($controller, $metodo));
         }
     } else {
         throw new Exception("Controlador no encontrado");
     }
 }
开发者ID:jeromdz,项目名称:framework_Evaluacion,代码行数:36,代码来源:Bootstrap.php

示例14: delete_session

 public function delete_session()
 {
     $user_id = (int) $_COOKIE['user_id'];
     $this->prepare("DELETE FROM sessions WHERE user_id=:id");
     $this->query->bindParam(':id', $user_id, PDO::PARAM_INT);
     $this->execute_simple();
     Authorization::delete_cookie();
 }
开发者ID:RhmBWT,项目名称:WofT,代码行数:8,代码来源:model_authorization.php

示例15: index

 /**
  * Display the specified resource.
  *
  * @param  int  $hash
  * @return Response
  */
 public function index($hash)
 {
     if ($hash) {
         $wishes = $this->service->getWishesForUser($hash);
     } else {
         $wishes = $this->service->getWishesForUser(\Authorization::user()->hash);
     }
     return $this->returnWishlist($wishes);
 }
开发者ID:HOFB,项目名称:HOFB,代码行数:15,代码来源:WishlistController.php


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