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


PHP Authentication::instance方法代码示例

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


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

示例1: getInstance

 function getInstance()
 {
     if (!isset(self::$instance)) {
         $c = __CLASS__;
         self::$instance = new $c();
     }
     return self::$instance;
 }
开发者ID:ngardner,项目名称:BentoCMS,代码行数:8,代码来源:Authentication.php

示例2: getInstance

 public static function getInstance()
 {
     if (!isset(self::$instance)) {
         if (!isset(self::$authenticationUser)) {
             throw new Exception("AuthenticationUser object is not initialized.");
         }
         self::$instance = new Authentication();
     }
     return self::$instance;
 }
开发者ID:rverbrugge,项目名称:dif,代码行数:10,代码来源:Authentication.php

示例3:

/**
 * Return logged user instance
 *
 * @param void
 * @return User
 */
function &get_logged_user()
{
    static $instance = null;
    if ($instance === null) {
        $instance =& Authentication::instance();
    }
    // if
    if ($instance->provider) {
        return $instance->provider->getUser();
    } else {
        $return = null;
        return $return;
    }
    // if
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:21,代码来源:init.php

示例4: AllowedToAccess

 public function AllowedToAccess($module, $submodule, $action, $type)
 {
     if (Authentication::instance()->checkValidationAppClint() && Authorization::instance()->IsAllowedToAccess($module, $submodule, $action, $type, Authentication::instance()->getApplicationId())) {
         return true;
     } elseif (!Authentication::instance()->checkValidationAppClint() && Authorization::instance()->IsAllowedToAccess($module, $submodule, $action, $type, Authentication::instance()->getApplicationId())) {
         return true;
     } else {
         $dbMsg = SysLog::Instance()->getAllError();
         if (!empty($dbMsg)) {
             echo "<pre>";
             for ($i = 0; $i < count($dbMsg); $i++) {
                 echo $dbMsg[$i];
             }
             echo "</pre>";
         }
         Log::Instance()->SendLog('Gagal akses, request denied');
         die('You don\'t have permission to access this service');
     }
 }
开发者ID:rifkiferdian,项目名称:gtfw_boostab,代码行数:19,代码来源:ServiceSecurity.class.php

示例5: __construct

 /**
  * Constructor
  *
  * @param Request $request
  * @return ApplicationController
  */
 function __construct($request)
 {
     parent::__construct($request);
     // Set detault layout for application pages
     $this->setLayout(array('module' => SYSTEM_MODULE, 'layout' => 'wireframe'));
     // Get Smarty instance... We need it
     $this->smarty =& Smarty::instance();
     // Load and init owner company
     $this->owner_company = get_owner_company();
     if (instance_of($this->owner_company, 'Company')) {
         cache_set('owner_company', $this->owner_company);
     } else {
         $this->httpError(HTTP_ERR_NOT_FOUND, 'Owner company is not defined');
     }
     // if
     $this->application =& application();
     $this->authentication =& Authentication::instance();
     $this->logged_user =& $this->authentication->provider->getUser();
     $this->wireframe =& Wireframe::instance();
     $this->wireframe->page_company = $this->owner_company;
     $this->theme_name = instance_of($this->logged_user, 'User') ? UserConfigOptions::getValue('theme', $this->logged_user) : ConfigOptions::getValue('theme');
     $this->smarty->assign(array('root_url' => ROOT_URL, 'assets_url' => ASSETS_URL));
     // Maintenance mode
     if (ConfigOptions::getValue('maintenance_enabled')) {
         if (instance_of($this->logged_user, 'User') && $this->logged_user->isAdministrator()) {
             $this->wireframe->addPageMessage(lang('System is in maintenance mode and can be used by administrators only. <a href=":url">Click here</a> to turn off maintenance mode', array('url' => assemble_url('admin_settings_maintenance'))), 'warning');
         } else {
             $additional_error_info = ConfigOptions::getValue('maintenance_message');
             if ($additional_error_info) {
                 $additional_error_info .= "\n\n";
             }
             // if
             $additional_error_info .= lang('When system is in maintenance mode, administrators can log in and access the system') . ": " . assemble_url('login');
             $this->smarty->assign('additional_error_info', $additional_error_info);
             if ($this->restrict_access_in_maintenance_mode) {
                 $this->httpError(503);
             }
             // if
         }
         // if
     }
     // if
     // Check permissions
     if ($this->login_required && !instance_of($this->logged_user, 'User')) {
         // If async don't redirect to loging, just server proper HTTP code
         if ($this->request->isAsyncCall()) {
             $this->httpError(HTTP_ERR_UNAUTHORIZED, null, true, true);
             // Not async? Redirect to login with extracted route data...
         } else {
             $params = array();
             if ($request->matched_route != 'login') {
                 $params['re_route'] = $request->matched_route;
                 foreach ($this->request->url_params as $k => $v) {
                     if ($k == 'module' || $k == 'controller' || $k == 'action') {
                         continue;
                     }
                     // if
                     $params["re_{$k}"] = $v;
                 }
                 // foreach
             }
             // if
             $this->redirectTo($this->login_route, $params);
         }
         // if
     }
     // if
     if (instance_of($this->logged_user, 'User') && !$this->logged_user->getSystemPermission('system_access')) {
         $this->authentication->provider->logUserOut();
         $this->httpError(HTTP_ERR_FORBIDDEN);
     }
     // if
     $loaded_modules = $this->application->getModules();
     $assets_query_string = 'v=' . $this->application->version . '&modules=';
     foreach ($loaded_modules as $loaded_module) {
         $assets_query_string .= $loaded_module->getName() . ',';
     }
     // foreach
     $this->smarty->assign(array('api_status' => API_STATUS, 'application' => $this->application, 'owner_company' => $this->owner_company, 'authentication' => $this->authentication, 'logged_user' => $this->logged_user, 'request' => $this->request, 'theme_name' => $this->theme_name, 'request_time' => $this->request_time, 'loaded_modules' => $this->application->getModules(), 'captcha_url' => ROOT_URL . '/captcha.php?id=' . md5(time()), 'assets_query_string' => $assets_query_string, 'js_disabled_url' => assemble_url('js_disabled')));
     $this->smarty->assign_by_ref('wireframe', $this->wireframe);
     js_assign(array('homepage_url' => ROOT_URL, 'assets_url' => ASSETS_URL, 'indicator_url' => get_image_url('indicator.gif'), 'big_indicator_url' => get_image_url('indicator_big.gif'), 'ok_indicator_url' => get_image_url('ok_indicator.gif'), 'warning_indicator_url' => get_image_url('warning_indicator.gif'), 'error_indicator_url' => get_image_url('error_indicator.gif'), 'pending_indicator_url' => get_image_url('pending_indicator.gif'), 'url_base' => URL_BASE, 'keep_alive_interval' => KEEP_ALIVE_INTERVAL, 'refresh_session_url' => assemble_url('refresh_session'), 'jump_to_project_url' => assemble_url('jump_to_project_widget'), 'quick_add_url' => assemble_url('quick_add'), 'path_info_through_query_string' => PATH_INFO_THROUGH_QUERY_STRING, 'image_picker_url' => assemble_url('image_picker'), 'copyright_removed' => LICENSE_COPYRIGHT_REMOVED, 'custom_tabs_manager' => assemble_url('custom_tabs_manager'), 'add_milestone_url' => assemble_url('project_milestones_add', array('project_id' => '--PROJECT_ID--')), 'add_checklist_url' => assemble_url('project_checklists_add', array('project_id' => '--PROJECT_ID--')), 'add_discussion_url' => assemble_url('project_discussions_add', array('project_id' => '--PROJECT_ID--')), 'add_file_url' => assemble_url('project_files_upload', array('project_id' => '--PROJECT_ID--')), 'add_page_url' => assemble_url('project_pages_add', array('project_id' => '--PROJECT_ID--')), 'add_ticket_url' => assemble_url('project_tickets_add', array('project_id' => '--PROJECT_ID--')), 'add_timerecord_url' => assemble_url('project_time_add', array('project_id' => '--PROJECT_ID--')), 'attachment_rename_url' => assemble_url('attachment_rename', array('project_id' => '--PROJECT_ID--', 'attachment_id' => '--ATTACHMENT_ID--')), 'attachment_copy_to_url' => assemble_url('attachment_copy_to', array('project_id' => '--PROJECT_ID--', 'attachment_id' => '--ATTACHMENT_ID--')), 'attachment_move_to_url' => assemble_url('attachment_move_to', array('project_id' => '--PROJECT_ID--', 'attachment_id' => '--ATTACHMENT_ID--')), 'image_uploader_url' => assemble_url('image_uploader'), 'render_comments_url' => assemble_url('render_comments'), 'move_task_url' => assemble_url('project_task_move', array('project_id' => '--PROJECT_ID--', 'task_id' => '--TASK_ID--')), 'get_collection_url' => assemble_url('collection'), 'quick_task_reminder_url' => assemble_url('project_task_quickreminder', array('project_id' => '--PROJECT_ID--', 'task_id' => '--TASK_ID--')), 'convert_to_ticket_url' => assemble_url('project_object_convert_to_ticket', array('project_id' => '--PROJECT_ID--', 'object_id' => '--OBJECT_ID--')), 'convert_to_milestone_url' => assemble_url('project_object_convert_to_milestone', array('project_id' => '--PROJECT_ID--', 'object_id' => '--OBJECT_ID--')), 'convert_to_page_url' => assemble_url('project_object_convert_to_page', array('project_id' => '--PROJECT_ID--', 'object_id' => '--OBJECT_ID--')), 'snooze_task_url' => assemble_url('project_task_snooze', array('project_id' => '--PROJECT_ID--', 'task_id' => '--TASK_ID--'))));
     if ($this->logged_user) {
         $link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
         mysql_select_db(DB_NAME);
         if (!empty($_SESSION['pg_ttl'])) {
             mysql_query("update healingcrystals_user_visited_pages set title='" . mysql_real_escape_string($_SESSION['pg_ttl']) . "' where user_id='" . $this->logged_user->getId() . "' and access_time='" . date('Y-m-d H:i:s', $_SESSION['temp_time']) . "'");
         }
         $current_url = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
         $pos = strpos($_SERVER['QUERY_STRING'], '%2F');
         if ($pos !== false) {
             $max_pages_count_per_user = 50;
             //require_once SMARTY_PATH . '/plugins/function.page_title.php';
             //$current_page_title = smarty_function_page_title(array('default' => 'Projects'));
             //$current_page_title = PageConstruction::getPageTitle();
//.........这里部分代码省略.........
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:101,代码来源:ApplicationController.class.php

示例6: authenticate

 /**
  * Authenticate
  *
  * @param void
  * @return null
  */
 function authenticate()
 {
     $provider_class = AUTH_PROVIDER;
     use_auth_provider($provider_class);
     if (!class_exists($provider_class)) {
         use_error('ClassNotImplementedError');
         return new ClassNotImplementedError($provider_class);
     }
     // if
     $provider = new $provider_class();
     if (!instance_of($provider, 'AuthenticationProvider')) {
         return new InvalidInstanceError('provider', $provider, 'AuthenticationProvider');
     }
     // if
     $manager =& Authentication::instance($provider, false);
     $token = false;
     if (FORCE_QUERY_STRING) {
         if (ANGIE_QUERY_STRING) {
             $query_string_aprams = parse_string(ANGIE_QUERY_STRING);
             if (isset($query_string_aprams['token'])) {
                 $token = $query_string_aprams['token'];
             }
             // if
         }
         // if
     } else {
         $token = isset($_GET['token']) ? $_GET['token'] : false;
     }
     // if
     // Handle token based authentication
     if ($token !== false) {
         // Die if disabled or read-only with POST parameters
         if (API_STATUS == API_DISABLED || API_STATUS == API_READ_ONLY && count($_POST) > 0) {
             header('HTTP/1.1 403 Forbidden');
             print "<h1>HTTP/1.1 403 Forbidden</h1>\n";
             if (API_STATUS == API_DISABLED) {
                 print '<p>API is disabled</p>';
             } else {
                 print '<p>API is read-only</p>';
             }
             // if
             die;
         }
         // if
         // Get token and auth_id (old and new API key formats are supported)
         if (strpos($token, '-') !== false) {
             list($auth_id, $token) = explode('-', $token);
         } else {
             $auth_id = array_var($_GET, 'auth_id');
         }
         // if
         $user = null;
         if ($auth_id) {
             $user = Users::findById($auth_id);
         }
         // if
         if (instance_of($user, 'User') && $user->getToken() == $token) {
             $manager->provider->logUserIn($user, array('silent' => true));
             return true;
         } else {
             header('HTTP/1.1 403 Forbidden');
             print '<h1>HTTP/1.1 403 Forbidden</h1>';
             die;
         }
         // if
     }
     // if
     $manager->provider->initialize();
     return true;
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:76,代码来源:ActiveCollab.class.php

示例7: authenticate

 /**
  * Initialize authentication
  * 
  * First we get authentication provider and then we create authentication 
  * manager instance...
  *
  * @param void
  * @return null
  */
 function authenticate()
 {
     $provider_class = AUTH_PROVIDER;
     use_auth_provider($provider_class);
     if (!class_exists($provider_class)) {
         use_error('ClassNotImplementedError');
         return new ClassNotImplementedError($provider_class);
     }
     // if
     $provider = new $provider_class();
     if (!instance_of($provider, 'AuthenticationProvider')) {
         return new InvalidInstanceError('provider', $provide, 'AuthenticationProvider');
     }
     // if
     $manager =& Authentication::instance($provider);
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:25,代码来源:AngieApplication.class.php


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