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


PHP S::suid方法代码示例

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


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

示例1: handler_sso

 function handler_sso($page)
 {
     $this->load('sso.inc.php');
     // First, perform security checks.
     if (!wats4u_sso_check()) {
         return PL_BAD_REQUEST;
     }
     global $globals;
     if (!S::logged()) {
         // Request auth.
         $page->assign('external_auth', true);
         $page->assign('ext_url', $globals->wats4u->public_url);
         $page->setTitle('Authentification');
         $page->setDefaultSkin('group_login');
         $page->assign('group', null);
         return PL_DO_AUTH;
     }
     if (!S::user()->checkPerms(PERMS_USER)) {
         // External (X.net) account
         return PL_FORBIDDEN;
     }
     // Update the last login information (unless the user is in SUID).
     $uid = S::i('uid');
     if (!S::suid()) {
         global $platal;
         S::logger($uid)->log('connexion_wats4u', $platal->path . ' ' . urldecode($_GET['url']));
     }
     // If we logged in specifically for this 'external_auth' request
     // and didn't want to "keep access to services", we kill the session
     // just before returning.
     // See classes/xorgsession.php:startSessionAs
     if (S::b('external_auth_exit')) {
         S::logger()->log('deconnexion', @$_SERVER['HTTP_REFERER']);
         Platal::session()->killAccessCookie();
         Platal::session()->destroy();
     }
     // Compute return URL
     $full_return = wats4u_sso_build_return_url(S::user());
     if ($full_return === "") {
         // Something went wrong
         $page->kill("Erreur dans le traitement de la requête Wats4U.");
     }
     http_redirect($full_return);
 }
开发者ID:Ekleog,项目名称:platal,代码行数:44,代码来源:wats4u.php

示例2: stopSUID

 public function stopSUID()
 {
     $perms = S::suid('perms');
     if (!parent::stopSUID()) {
         return false;
     }
     S::kill('may_update');
     S::kill('is_member');
     S::set('perms', $perms);
     return true;
 }
开发者ID:Ekleog,项目名称:platal,代码行数:11,代码来源:xnetsession.php

示例3: setAccessCookie

 public function setAccessCookie($replace = false, $log = true)
 {
     if (S::suid() || $replace && !Cookie::blank('access')) {
         return;
     }
     Cookie::set('access', sha1(S::user()->password()), 300, true);
     if ($log) {
         S::logger()->log('cookie_on');
     }
 }
开发者ID:Ekleog,项目名称:platal,代码行数:10,代码来源:xorgsession.php

示例4: handler_exit

 function handler_exit($page, $level = null)
 {
     if (S::suid()) {
         $old = S::user()->login();
         S::logger()->log('suid_stop', $old . " by " . S::suid('hruid'));
         Platal::session()->stopSUID();
         $target = S::s('suid_startpage');
         S::kill('suid_startpage');
         if (!empty($target)) {
             http_redirect($target);
         }
         pl_redirect('admin/user/' . $old);
     }
     if ($level == 'forget' || $level == 'forgetall') {
         Platal::session()->killAccessCookie();
     }
     if ($level == 'forgetuid' || $level == 'forgetall') {
         Platal::session()->killLoginFormCookies();
     }
     if (S::logged()) {
         S::logger()->log('deconnexion', @$_SERVER['HTTP_REFERER']);
         Platal::session()->destroy();
     }
     if (Get::has('redirect')) {
         http_redirect(rawurldecode(Get::v('redirect')));
     } else {
         $page->changeTpl('platal/exit.tpl');
     }
 }
开发者ID:Ekleog,项目名称:platal,代码行数:29,代码来源:platal.php

示例5: handler_user

 function handler_user($page, $login = false)
 {
     global $globals;
     $page->changeTpl('admin/user.tpl');
     $page->setTitle('Administration - Compte');
     if (S::suid()) {
         $page->kill("Déjà en SUID !!!");
     }
     // Loads the user identity using the environment.
     if ($login) {
         $user = User::get($login);
     }
     if (empty($user)) {
         pl_redirect('admin/accounts');
     }
     $listClient = new MMList(S::user());
     $login = $user->login();
     $registered = $user->state != 'pending';
     // Form processing
     if (!empty($_POST)) {
         S::assert_xsrf_token();
         if (Post::has('uid') && Post::i('uid') != $user->id()) {
             $page->kill('Une erreur s\'est produite');
         }
     }
     // Handles specific requests (AX sync, su, ...).
     if (Post::has('log_account')) {
         pl_redirect("admin/logger?loguser={$login}&year=" . date('Y') . "&month=" . date('m'));
     }
     if (Post::has('su_account') && $registered) {
         if (!Platal::session()->startSUID($user)) {
             $page->trigError('Impossible d\'effectuer un SUID sur ' . $user->login());
         } else {
             pl_redirect("");
         }
     }
     // Handles account deletion.
     if (Post::has('account_deletion_confirmation')) {
         $uid = $user->id();
         $name = $user->fullName();
         $profile = $user->profile();
         if ($profile && Post::b('clear_profile')) {
             $user->profile()->clear();
         }
         $user->clear(true);
         $page->trigSuccess("L'utilisateur {$name} ({$uid}) a bien été désinscrit.");
         if (Post::b('erase_account')) {
             XDB::execute('DELETE FROM  accounts
                                 WHERE  uid = {?}', $uid);
             $page->trigSuccess("L'utilisateur {$name} ({$uid}) a été supprimé de la base de données");
         }
     }
     // Account Form {{{
     require_once 'emails.inc.php';
     $to_update = array();
     if (Post::has('disable_weak_access')) {
         $to_update['weak_password'] = null;
     } else {
         if (Post::has('update_account')) {
             if (!$user->hasProfile()) {
                 require_once 'name.func.inc.php';
                 $name_update = false;
                 $lastname = capitalize_name(Post::t('lastname'));
                 $firstname = capitalize_name(Post::t('firstname'));
                 if ($lastname != $user->lastname) {
                     $to_update['lastname'] = $lastname;
                     $name_update = true;
                 }
                 if (Post::s('type') != 'virtual' && $firstname != $user->firstname) {
                     $to_update['firstname'] = $firstname;
                     $name_update = true;
                 }
                 if ($name_update) {
                     if (Post::s('type') == 'virtual') {
                         $firstname = '';
                     }
                     $to_update['full_name'] = build_full_name($firstname, $lastname);
                     $to_update['directory_name'] = build_directory_name($firstname, $lastname);
                     $to_update['sort_name'] = build_sort_name($firstname, $lastname);
                 }
                 if (Post::s('display_name') != $user->displayName()) {
                     $to_update['display_name'] = Post::s('display_name');
                 }
             }
             if (Post::s('sex') != ($user->isFemale() ? 'female' : 'male')) {
                 $to_update['sex'] = Post::s('sex');
                 if ($user->hasProfile()) {
                     XDB::execute('UPDATE  profiles
                                  SET  sex = {?}
                                WHERE  pid = {?}', Post::s('sex'), $user->profile()->id());
                 }
             }
             if (!Post::blank('pwhash')) {
                 $to_update['password'] = Post::s('pwhash');
                 require_once 'googleapps.inc.php';
                 $account = new GoogleAppsAccount($user);
                 if ($account->active() && $account->sync_password) {
                     $account->set_password(Post::s('pwhash'));
                 }
             }
//.........这里部分代码省略.........
开发者ID:Ekleog,项目名称:platal,代码行数:101,代码来源:admin.php

示例6: handler_change_rights

 function handler_change_rights($page)
 {
     if (Env::has('right') && (may_update() || S::suid())) {
         switch (Env::v('right')) {
             case 'admin':
                 Platal::session()->stopSUID();
                 break;
             case 'anim':
                 Platal::session()->doSelfSuid();
                 may_update(true);
                 is_member(true);
                 break;
             case 'member':
                 Platal::session()->doSelfSuid();
                 may_update(false, true);
                 is_member(true);
                 break;
             case 'logged':
                 Platal::session()->doSelfSuid();
                 may_update(false, true);
                 is_member(false, true);
                 break;
         }
     }
     if (!empty($_SERVER['HTTP_REFERER'])) {
         http_redirect($_SERVER['HTTP_REFERER']);
     } else {
         pl_redirect('');
     }
 }
开发者ID:Ekleog,项目名称:platal,代码行数:30,代码来源:xnetgrp.php

示例7: setAccessCookie

 public function setAccessCookie($replace = false)
 {
     Cookie::set('uid', S::user()->id(), 300);
     if (S::suid() || $replace && !Cookie::blank('hash')) {
         return;
     }
     // FIXME : should switch to true instead of false for HTTPS safety
     Cookie::set('hash', sha1(S::user()->password()), 300, false);
 }
开发者ID:netixx,项目名称:frankiz,代码行数:9,代码来源:frankizsession.php

示例8: handler_lists

 function handler_lists($page, $order_by = null, $order = null)
 {
     require_once 'emails.inc.php';
     if (!$this->get_lists_domain()) {
         return PL_NOT_FOUND;
     }
     $page->changeTpl('xnetlists/index.tpl');
     if (Get::has('del')) {
         S::assert_xsrf_token();
         $mlist = $this->prepare_list(Get::v('del'));
         $mlist->unsubscribe();
         pl_redirect('lists');
     }
     if (Get::has('add')) {
         S::assert_xsrf_token();
         $mlist = $this->prepare_list(Get::v('add'));
         $mlist->subscribe();
         pl_redirect('lists');
     }
     if (Post::has('del_alias') && may_update()) {
         S::assert_xsrf_token();
         $alias = Post::t('del_alias');
         list($local_part, ) = explode('@', $alias);
         delete_list_alias($local_part, $this->get_lists_domain());
         $page->trigSuccess($alias . ' supprimé !');
     }
     $client = $this->prepare_client();
     $listes = $client->get_lists();
     // Default ordering is by ascending names.
     if (is_null($order_by) || is_null($order) || !in_array($order_by, array('list', 'desc', 'nbsub')) || !in_array($order, array('asc', 'desc'))) {
         $order_by = 'list';
         $order = 'asc';
     }
     $compare = function ($a, $b) use($order_by, $order) {
         switch ($order_by) {
             case 'desc':
                 $a[$order_by] = replace_accent($a[$order_by]);
                 $b[$order_by] = replace_accent($b[$order_by]);
             case 'list':
                 $res = strcasecmp($a[$order_by], $b[$order_by]);
                 break;
             case 'nbsub':
                 $res = $a[$order_by] - $b[$order_by];
                 break;
             default:
                 $res = 0;
         }
         if ($order == 'asc') {
             return $res;
         }
         return $res * -1;
     };
     usort($listes, $compare);
     $page->assign('listes', $listes);
     $page->assign('order_by', $order_by);
     $page->assign('order', $order);
     $page->assign('aliases', iterate_list_alias($this->get_lists_domain()));
     $page->assign('may_update', may_update());
     if (S::suid()) {
         $page->trigWarning("Attention : l'affichage des listes de diffusion ne tient pas compte de l'option « Voir le site comme… ».");
     }
     global $globals;
     if (count($listes) > 0 && !$globals->asso('has_ml')) {
         XDB::execute("UPDATE  groups\n                             SET  flags = CONCAT_WS(',', IF(flags = '', NULL, flags), 'has_ml')\n                           WHERE  id = {?}", $globals->asso('id'));
     }
 }
开发者ID:Ekleog,项目名称:platal,代码行数:66,代码来源:xnetlists.php


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