本文整理汇总了PHP中AuthUser类的典型用法代码示例。如果您正苦于以下问题:PHP AuthUser类的具体用法?PHP AuthUser怎么用?PHP AuthUser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AuthUser类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: actionLogout
/**
* Destroy user session.
*/
public function actionLogout()
{
try {
$user = new AuthUser();
$user->signOut();
$this->flashSuccess = "You have been logged out";
} catch (AuthUserNotAuthenticatedException $e) {
$this->flashSuccess = 'You are already logged out';
}
// create token & display login form
$this->bag->token = Fari_FormToken::create();
$this->renderAction('login');
}
开发者ID:radekstepan,项目名称:Fireside,代码行数:16,代码来源:AuthPresenter.php
示例2: checkLogin
/**
* 验证当前访问节点是否有权限
* @param string $module 模块名称
* @param string $node 节点名称
* @return bool ture/false:
*/
static function checkLogin($module, $node)
{
// 判断该项目是否需要认证
if (C('USER_AUTH_ON') === false) {
return true;
}
// 判断当前模块是否为不需要认证模块
if (C('NOT_AUTH_NODE') != '') {
$notauths = explode(',', C('NOT_AUTH_NODE'));
if (in_array($module . '-' . $node, $notauths)) {
return true;
}
}
// 认证方式1为登陆认证,2为实时认证
if (C('USER_AUTH_TYPE') === 1) {
$accesslists = isset($_SESSION[C('USER_AUTH_KEY')]) ? $_SESSION[C('USER_AUTH_KEY')] : AuthUser::getAccessList();
}
if (C('USER_AUTH_TYPE') === 2) {
$accesslists = AuthUser::getAccessList();
}
//print_r($accesslists);exit;
// print_r($_SESSION);exit;
if (isset($accesslists[$module]) && in_array($node, $accesslists[$module])) {
return true;
} else {
return false;
}
}
开发者ID:ohjack,项目名称:newErp,代码行数:34,代码来源:authuser.class.php
示例3: _checkLog
public static function _checkLog()
{
AuthUser::load();
if (!AuthUser::isLoggedIn()) {
redirect(get_url('login'));
}
}
开发者ID:nowotny,项目名称:Fancy-Image-Gallery,代码行数:7,代码来源:FancyImageGalleryController.php
示例4: __construct
function __construct()
{
AuthUser::load();
if (!AuthUser::isLoggedIn()) {
redirect(get_url('login'));
}
}
开发者ID:albertobraschi,项目名称:toad,代码行数:7,代码来源:PluginController.php
示例5: _save
/**
* Saves the settings.
*/
private final function _save()
{
$data = $_POST['setting'];
// CSRF checks
if (isset($_POST['csrf_token'])) {
$csrf_token = $_POST['csrf_token'];
if (!SecureToken::validateToken($csrf_token, BASE_URL . 'setting')) {
Flash::set('error', __('Invalid CSRF token found!'));
Observer::notify('csrf_token_invalid', AuthUser::getUserName());
redirect(get_url('setting'));
}
} else {
Flash::set('error', __('No CSRF token found!'));
Observer::notify('csrf_token_not_found', AuthUser::getUserName());
redirect(get_url('setting'));
}
if (!isset($data['allow_html_title'])) {
$data['allow_html_title'] = 'off';
}
use_helper('Kses');
$allowed = array('img' => array('src' => array()), 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), 'b' => array(), 'blockquote' => array('cite' => array()), 'br' => array(), 'code' => array(), 'em' => array(), 'i' => array(), 'p' => array(), 'strike' => array(), 'strong' => array());
$data['admin_title'] = kses(trim($data['admin_title']), $allowed);
Setting::saveFromData($data);
Flash::set('success', __('Settings have been saved!'));
redirect(get_url('setting'));
}
开发者ID:sindotnet,项目名称:cona,代码行数:29,代码来源:SettingController.php
示例6: _checkPermission
private static function _checkPermission()
{
AuthUser::load();
if (!AuthUser::isLoggedIn()) {
redirect(get_url('login'));
}
}
开发者ID:julpi,项目名称:FreshCMS,代码行数:7,代码来源:CommentController.php
示例7: submit_address
public function submit_address($fields = array())
{
$checkout = $this->config['checkoutPath'];
$out = null;
// wolf authentication
if (!AuthUser::isLoggedIn() && (!isset($_SESSION['shipping_address']) || empty($_SESSION['shipping_address'])) || 1 == 1) {
$out .= "<div class=\"shipping_address_form\">";
$out .= "<div id=\"form_response\"><h2 class=\"checkout-error error-message\">Please provide the following information!</h2></div>";
//$out .= "<div id=\"form_response\"><h2 class=\"checkout-error error-message\">Please provide the following information!</h2><div>";
//$this->disablePaypalCheckout = " disabled='disabled'";
$out .= " <form id=\"shipping_address\" name=\"shipping_address\" action=\"" . $_SERVER['REQUEST_URI'] . "\" method=\"post\">";
$out .= " <p><label>Delivery Address</label></p><br/><br/>";
if (!empty($fields)) {
foreach ($fields['label'] as $k => $label) {
$out .= $this->draw_field($k, $fields);
}
}
//$out .= " <input onclick=\"submit_any_form('#submit_address');\" name=\"submit_address\" id=\"submit_address\" type=\"submit\" value=\"Save Addres\" />";
$out .= " <input class=\"ajaxsubmit\" name=\"submit_address\" id=\"submit_address\" type=\"submit\" value=\"Save Addres\" />";
$out .= " </form>";
$out .= "</div>";
} else {
$out = '';
}
// display shipping address form
if ($checkout != $this->config['checkoutPath'] || 1 == 1) {
return $out;
} else {
return null;
}
}
开发者ID:ariksavage,项目名称:template2.adsourorg,代码行数:31,代码来源:shipping.php
示例8: beforeSave
public function beforeSave()
{
$this->created_on = date('Y-m-d H:i:s');
$this->username = AuthUser::getRecord()->name;
$this->message = __($this->message, array(':username' => $this->username));
return true;
}
开发者ID:julpi,项目名称:freshcms_dashboard,代码行数:7,代码来源:DashboardLogEntry.php
示例9: pay
/**
* @method POST
*/
function pay()
{
// parse request
parse_str($this->request->data, $request);
$token = $request['token'];
$plan = $request['plan'];
// get an authuser
$authUser = new AuthUser();
if (isset($authUser->UserUniqId)) {
// check if authorized
Stripe::setApiKey(STRIPE_API_KEY);
// create a new customer and subscribe them to the plan
$customer = Stripe_Customer::create(array("card" => $token, "plan" => $plan, "email" => $authUser->Email));
// get back the id and the end period for the plan
$id = $customer->id;
$end = $customer->subscription->current_period_end;
// #debug print 'end='.$end;
date_default_timezone_set('UTC');
// create a date from the timestamp returned by Stripe
$renewalDate = gmdate("Y-m-d H:i:s", intval($end));
// #debug print ' renewalDate='.$renewalDate;
// by default, you should not have to update a payment
$updatePayment = 0;
// update the db and session
Site::SetSubscription($authUser->SiteUniqId, $plan, $id, $renewalDate, $updatePayment);
AuthUser::SetPlan($plan, $renewalDate, $updatePayment);
// return a json response
return new Tonic\Response(Tonic\Response::OK);
} else {
return new Tonic\Response(Tonic\Response::UNAUTHORIZED);
}
}
开发者ID:eavesmonkey,项目名称:respond,代码行数:35,代码来源:pay.php
示例10: __construct
public function __construct()
{
$mod = trim($_GET['mod']);
$act = trim($_GET['act']);
if (C('IS_AUTH_ON') === true) {
if (!AuthUser::checkLogin($mod, $act)) {
if (!$_SESSION[C("USER_AUTH_ID")]) {
echo '<script language="javascript">
self.location="index.php?mod=public&act=login";
</script>';
} elseif ($_SESSION[C("USER_AUTH_ID")]) {
//$data = array('data'=>array('您尚未有此权限'), 'link'=>$_SERVER['HTTP_REFERER']);
//goErrMsgPage($data);exit;
echo '您尚未有此权限';
exit;
} else {
//$data = array('data'=>array('还未登陆!'), 'link'=>'index.php?mod=public&act=login');
//goErrMsgPage($data);exit;
echo '还未登陆!';
exit;
}
exit;
}
}
self::$_username = isset($_SESSION['userName']) ? $_SESSION['userName'] : "";
self::$_userid = isset($_SESSION[C("USER_AUTH_ID")]) ? $_SESSION[C("USER_AUTH_ID")] : 0;
self::$_companyid = isset($_SESSION['companyId']) ? $_SESSION['companyId'] : 0;
self::$_systemid = C('AUTH_SYSTEM_ID');
//初始化smarty
require WEB_PATH . 'lib/template/smarty/Smarty.class.php';
$this->smarty = new Smarty();
$this->smarty->template_dir = WEB_PATH . 'html/template/v1/';
$this->smarty->compile_dir = WEB_PATH . 'smarty/templates_c/';
$this->smarty->config_dir = WEB_PATH . 'smarty/configs/';
$this->smarty->cache_dir = WEB_PATH . 'smarty/cache/';
$this->smarty->debugging = false;
$this->smarty->caching = false;
$this->smarty->cache_lifetime = 120;
//初始化提交过来的变量(post and get)
if (isset($_GET)) {
foreach ($_GET as $gk => $gv) {
$this->smarty->assign('g_' . $gk, $gv);
}
}
if (isset($_POST)) {
foreach ($_POST as $pk => $pv) {
$this->smarty->assign('p_' . $pk, $pv);
}
}
$this->smarty->assign('mod', $mod);
//模块权限
$this->smarty->assign('act', $act);
//操作权限
$this->smarty->assign('_username', self::$_username);
$this->smarty->assign('_userid', self::$_userid);
//初始化当前页码
$this->page = isset($_GET['page']) && intval($_GET['page']) > 0 ? intval($_GET['page']) : 1;
$this->smarty->assign("page", $this->page);
}
开发者ID:ohjack,项目名称:newErp,代码行数:59,代码来源:base.view.php
示例11: __construct
public function __construct()
{
AuthUser::load();
if (!AuthUser::isLoggedIn()) {
redirect(get_url('login'));
}
$this->assignToLayout('sidebar', new View('translate/sidebar'));
}
开发者ID:chaobj001,项目名称:tt,代码行数:8,代码来源:TranslateController.php
示例12: deactivate_plugin
function deactivate_plugin($plugin)
{
if (!AuthUser::hasPermission('administrator')) {
Flash::set('error', __('You do not have permission to access the requested page!'));
redirect(get_url());
}
Plugin::deactivate($plugin);
}
开发者ID:albertobraschi,项目名称:toad,代码行数:8,代码来源:SettingController.php
示例13: __construct
function __construct()
{
AuthUser::load();
if (!AuthUser::isLoggedIn()) {
redirect(get_url('login'));
}
$this->setLayout('backend');
}
开发者ID:albertobraschi,项目名称:toad,代码行数:8,代码来源:CommentController.php
示例14: __construct
public function __construct()
{
AuthUser::load();
if (!AuthUser::isLoggedIn()) {
echo 'Please Login';
header('location:index.php?job=login');
}
}
开发者ID:chaobj001,项目名称:tt,代码行数:8,代码来源:AdminUserController.class.php
示例15: __construct
public function __construct()
{
$mod = trim($_GET['mod']);
$act = trim($_GET['act']);
#################### smarty初始化 start ####################
require WEB_PATH . 'lib/template/smarty/Smarty.class.php';
$this->smarty = new Smarty();
$this->smarty->template_dir = WEB_PATH . 'html/template/v1' . DIRECTORY_SEPARATOR;
$this->smarty->compile_dir = WEB_PATH . 'smarty/templates_c' . DIRECTORY_SEPARATOR;
$this->smarty->config_dir = WEB_PATH . 'smarty/configs' . DIRECTORY_SEPARATOR;
$this->smarty->cache_dir = WEB_PATH . 'smarty/cache' . DIRECTORY_SEPARATOR;
$this->smarty->debugging = false;
$this->smarty->caching = false;
$this->smarty->cache_lifetime = 120;
#################### smarty初始化 end ####################
if (C('IS_AUTH_ON') === true) {
if (AuthUser::checkLogin($mod, $act)) {
//$this->error('请先登录', 'index.php?mod=public&act=login');
}
}
if (!in_array($act, array('login', 'logout', 'userLogin'))) {
$now_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
//记录当前页面url
setcookie('now_url', $now_url, time() + 86400);
}
$this->_menul1 = isset($_SESSION['menul1']) ? $_SESSION['menul1'] : array();
$this->_menul2 = isset($_SESSION['menul2']) ? $_SESSION['menul2'] : array();
$this->_menul3 = isset($_SESSION['menul3']) ? $_SESSION['menul3'] : array();
$this->_username = isset($_SESSION['userCnName']) ? $_SESSION['userCnName'] : "xx";
$this->_userid = isset($_SESSION['userId']) ? $_SESSION['userId'] : 0;
$this->_companyid = isset($_SESSION['companyId']) ? $_SESSION['companyId'] : 0;
$this->_systemid = '12';
//初始化提交过来的变量(post and get)
if (isset($_GET)) {
foreach ($_GET as $gk => $gv) {
$this->smarty->assign('g_' . $gk, $gv);
}
}
if (isset($_POST)) {
foreach ($_POST as $pk => $pv) {
$this->smarty->assign('p_' . $pk, $pv);
}
}
$this->smarty->assign('curusername', $_SESSION['userName']);
//设置当前用户名
$this->smarty->assign('mod', $mod);
//模块权限
$this->smarty->assign('act', $act);
//操作权限
$this->smarty->assign('_username', $this->_username);
$this->smarty->assign('_userid', $this->_userid);
$this->smarty->assign('menul1', $this->_menul1);
$this->smarty->assign('menul2', $this->_menul2);
$this->smarty->assign('menul3', $this->_menul3);
//初始化当前页码
$this->page = isset($_GET['page']) && intval($_GET['page']) > 0 ? intval($_GET['page']) : 1;
$this->smarty->assign("page", $this->page);
}
开发者ID:ohjack,项目名称:newErp,代码行数:58,代码来源:base.view.php
示例16: beforeUpdate
public function beforeUpdate()
{
if (!Observer::notify('layout_before_edit', $this)) {
return false;
}
$this->updated_by_id = AuthUser::getId();
$this->updated_on = date('Y-m-d H:i:s');
return true;
}
开发者ID:julpi,项目名称:FreshCMS,代码行数:9,代码来源:Layout.php
示例17: ru_logout
function ru_logout()
{
// Allow plugins to handle logout events
Observer::notify('logout_requested');
$username = AuthUser::getUserName();
AuthUser::logout();
Observer::notify('admin_after_logout', $username);
redirect(get_url());
}
开发者ID:blr21560,项目名称:registered_users,代码行数:9,代码来源:index.php
示例18: __construct
public function __construct()
{
AuthUser::load();
if (!AuthUser::isLoggedIn()) {
redirect(get_url('login'));
}
$this->setLayout('backend');
$this->assignToLayout('sidebar', new View('../../plugins/frog_tags/views/sidebar'));
}
开发者ID:harendt,项目名称:frog_tags,代码行数:9,代码来源:FrogTagsController.php
示例19: __construct
function __construct()
{
if (defined('CMS_BACKEND')) {
AuthUser::load();
if (!AuthUser::isLoggedIn()) {
redirect(get_url('login'));
}
}
}
开发者ID:ariksavage,项目名称:superior-optical-eyewear,代码行数:9,代码来源:PluginController.php
示例20: beforeSave
public function beforeSave()
{
$this->created_on = date("Y-m-d H:i:s");
if (!AuthUser::isLoggedIn()) {
$this->username = "system";
} else {
$this->username = AuthUser::getRecord()->name;
}
return true;
}
开发者ID:pawedWolf,项目名称:wolfcms-dashboard,代码行数:10,代码来源:DashboardLogEntry.php
注:本文中的AuthUser类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论