• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Authorization类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: makeAuth

    public static function makeAuth($args) {

        $md5pass = md5($args[1].Config::$Security['passwordsalt']);
        $table = Config::$DBConf['prefix'].Authorization::$table;
        $row = DB::getRow("Select * From $table Where `login`='$args[0]' and `password`='$md5pass'");
        if($row != NULL && $row['status'] == '0' ){
            self::$user = $row;
            DB::exec( "UPDATE $table SET `status` = 1 WHERE `login` = '".$args[0]."'" );
            setcookie("user_name",$row['name'], time()+60*60*24*365);
            setcookie("user_id",$row['id'], time()+60*60*24*365);
            return $row['category'];
        }else return NULL;
    }
开发者ID:neronmoon,项目名称:Veronica,代码行数:13,代码来源:Authorization.class.php


示例17: runParentTransaction

 protected function runParentTransaction($amount = 10.0)
 {
     self::authorizeFromEnv();
     $transaction = new Authorization();
     $transaction->money->setAmount($amount);
     $transaction->money->setCurrency('EUR');
     $transaction->setDescription('test');
     $transaction->setTrackingId('my_custom_variable');
     $transaction->card->setCardNumber('4200000000000000');
     $transaction->card->setCardHolder('John Doe');
     $transaction->card->setCardExpMonth(1);
     $transaction->card->setCardExpYear(2030);
     $transaction->card->setCardCvc('123');
     $transaction->customer->setFirstName('John');
     $transaction->customer->setLastName('Doe');
     $transaction->customer->setCountry('LV');
     $transaction->customer->setAddress('Demo str 12');
     $transaction->customer->setCity('Riga');
     $transaction->customer->setZip('LV-1082');
     $transaction->customer->setIp('127.0.0.1');
     $transaction->customer->setEmail('[email protected]');
     return $transaction->submit();
 }
开发者ID:Alroniks,项目名称:begateway-api-php,代码行数:23,代码来源:CaptureTest.php


示例18: Start

 static function Start($auth = [])
 {
     $called_class = get_called_class();
     if (count($auth)) {
         $where = [];
         foreach ($auth as $k => $v) {
             $where[] = "`" . es($k) . "` = '" . es($v) . "'";
         }
         $res = q("\n\t\t\t\tSELECT `access`" . (count($called_class::$datas) ? ',`' . implode('`,`', $called_class::$datas) . '`' : '') . "\n\t\t\t\tFROM `fw_users`\n\t\t\t\tWHERE " . implode(" AND ", $where) . "\n\t\t\t");
         if (!$res->num_rows) {
             Authorization::logout();
             redirect('/');
         }
         $row = $res->fetch_assoc();
         if ($row['access'] != 1) {
             Authorization::logout();
             $_SESSION['error'] = 'no-access';
             redirect('/');
         }
         foreach ($called_class::$datas as $k => $v) {
             $called_class::${$v} = $row[$v];
             // unset($row[$v]); -- Раскомментировать после обновления функционала на сайте
         }
         if (count($row)) {
             self::$data = $row;
         }
     } elseif (isset($_COOKIE['autologinid'], $_COOKIE['autologinhash'])) {
         $auth = new Authorization();
         if (!$auth->authByHash($_COOKIE['autologinid'], $_COOKIE['autologinhash'])) {
             Authorization::logout();
             redirect('/');
         }
     }
     if (!empty(self::$data['id']) && !empty(self::$autoupdate)) {
         q("\n\t\t\t\tUPDATE `fw_users` SET\n\t\t\t\t`browser` = '" . (isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '') . "',\n\t\t\t\t`ip` = '" . es($_SERVER['REMOTE_ADDR']) . "'\n\t\t\t\tWHERE `id` = " . (int) self::$data['id'] . "\n\t\t\t");
     }
 }
开发者ID:schoolphp,项目名称:library,代码行数:37,代码来源:User.php


示例19: index

 public function index()
 {
     $this->view->title = "Dashboard";
     if (Authorization::Authorize('Admin')) {
         $this->view->title = "Dashboard";
         $this->view->cat = $this->model->getCat();
         $this->view->post = $this->model->getPost();
         $this->view->comment = $this->model->getComment();
         $this->view->user = $this->model->getUser();
         $this->view->page = $this->model->getPage();
         $this->view->renderAdmin("dashboard/index");
     } else {
         $this->view->render("user/index");
     }
 }
开发者ID:hant0811,项目名称:Repro_News,代码行数:15,代码来源:dashboard_Controller.php


示例20: deleteSite

 public function deleteSite(&$markerSite)
 {
     $distribution = Distribution::find($markerSite->distribution);
     Authorization::where('atlas_id', '=', $markerSite->id)->delete();
     Log::info("Deleted authorization " . $markerSite->id . " from " . $_SERVER['REMOTE_ADDR']);
     Log::info("Deleting Site" . $markerSite->id . " from " . $_SERVER['REMOTE_ADDR']);
     $markerSite->delete();
     Log::info("Deleted Site");
     Log::info("Distribution name=" . $distribution->name . " id=" . $distribution->id . " standard=" . $distribution->is_standard);
     if ($distribution && $distribution->isNonStandard()) {
         Log::info("Deleting distribution " . $distribution->id . " from " . $_SERVER['REMOTE_ADDR']);
         $distribution->delete();
         Log::info("Deleted Distribution");
     }
 }
开发者ID:skvithalani,项目名称:openmrs-contrib-atlas,代码行数:15,代码来源:MarkerSiteService.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP AuthorizationPolicy类代码示例发布时间:2022-05-23
下一篇:
PHP Authority类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap