本文整理汇总了PHP中S::logged方法的典型用法代码示例。如果您正苦于以下问题:PHP S::logged方法的具体用法?PHP S::logged怎么用?PHP S::logged使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类S
的用法示例。
在下文中一共展示了S::logged方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
global $globals;
parent::__construct();
// Set the default page
$this->changeTpl('platal/index.tpl');
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) {
$this->addJsLink('json2.js');
}
$this->addJsLink('jquery.xorg.js');
$this->addJsLink('overlib.js');
$this->addJsLink('core.js');
$this->addJsLink('xorg.js');
if ($globals->core->sentry_js_dsn) {
$this->addJsLink('raven.min.js');
}
$this->setTitle('le site des élèves et anciens élèves de l\'École polytechnique');
if (S::logged() && S::user()->checkPerms('admin')) {
$types = array(S::user()->type);
$perms = DirEnum::getOptions(DirEnum::ACCOUNTTYPES);
ksort($perms);
foreach ($perms as $type => $perm) {
if (!empty($perm) && $type != $types[0]) {
$types[] = $type;
}
}
$this->assign('account_types_list', $types);
$skins = DirEnum::getOptions(DirEnum::SKINS);
asort($skins);
$this->assign('skin_list', $skins);
}
}
示例2: assign_json_to_map
public static function assign_json_to_map(PlPage $page, $pids = null)
{
if (!is_null($pids)) {
$where = XDB::format(' AND pa.pid IN {?}', $pids);
} else {
$where = '';
}
if (!S::logged() || !S::user()->checkPerms('directory_ax')) {
$where .= " AND pa.pub = 'public'";
$name_publicity = 'public';
} else {
if (!S::user()->checkPerms('directory_private')) {
$where .= " AND pa.pub = 'ax'";
$name_publicity = 'public';
} else {
$name_publicity = 'private';
}
}
$data = XDB::rawFetchAllAssoc('SELECT pa.latitude, pa.longitude, GROUP_CONCAT(DISTINCT p.hrpid SEPARATOR \',\') AS hrpid,
GROUP_CONCAT(pd.promo SEPARATOR \',\') AS promo,
GROUP_CONCAT(DISTINCT pd.' . $name_publicity . '_name, \' (\', pd.promo, \')\' SEPARATOR \', \') AS name,
GROUP_CONCAT(DISTINCT pa.pid SEPARATOR \',\') AS pid
FROM profile_addresses AS pa
INNER JOIN profiles AS p ON (pa.pid = p.pid)
INNER JOIN profile_display AS pd ON (pd.pid = pa.pid)
WHERE pa.type = \'home\' AND p.deathdate IS NULL AND pa.latitude IS NOT NULL AND pa.longitude IS NOT NULL' . $where . '
GROUP BY pa.latitude, pa.longitude');
$page->jsonAssign('data', $data);
}
示例3: handler_news
function handler_news($page, $id = false)
{
if (S::logged()) {
$this->handler_news_new($page, $id);
} else {
$this->handler_news_current($page, $id);
}
}
示例4: handler_out
function handler_out($page, $hash = null, $issue_id = null)
{
$hash = $hash == 'nohash' ? null : $hash;
if (!$hash) {
if (!S::logged()) {
return PL_DO_AUTH;
}
}
return $this->handler_nl($page, 'out', $hash, $issue_id);
}
示例5: force_login
public function force_login(PlPage $page)
{
header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');
if (S::logged()) {
$page->changeTpl('core/password_prompt_logged.tpl');
} else {
$page->changeTpl('core/password_prompt.tpl');
}
$page->assign_by_ref('platal', $this);
$page->run();
}
示例6: defaultForEdit
public static function defaultForEdit($max_level = null)
{
if (!S::logged()) {
$vis = self::get(self::VIEW_NONE);
} else {
$vis = S::user()->editVisibility();
}
if ($max_level != null) {
return $vis->restrict($max_level);
} else {
return $vis;
}
}
示例7: startAvailableAuth
public function startAvailableAuth()
{
if (!S::logged() && Get::has('auth')) {
if (!$this->start(AUTH_PASSWD)) {
return false;
}
}
global $globals;
if (!S::logged() && $globals->xnet->auth_baseurl) {
// prevent connection to be linked to disconnection
if (($i = strpos($_SERVER['REQUEST_URI'], 'exit')) !== false) {
$returl = "http://{$_SERVER['SERVER_NAME']}" . substr($_SERVER['REQUEST_URI'], 0, $i);
} else {
$returl = "http://{$_SERVER['SERVER_NAME']}{$_SERVER['REQUEST_URI']}";
}
$url = $globals->xnet->auth_baseurl;
$url .= "?session=" . session_id();
$url .= "&challenge=" . S::v('challenge');
$url .= "&pass=" . md5(S::v('challenge') . $globals->xnet->secret);
$url .= "&url=" . urlencode($returl);
S::set('loginX', $url);
}
if (S::logged() && $globals->asso()) {
$perms = S::v('perms');
$perms->rmFlag('groupadmin');
$perms->rmFlag('groupmember');
$perms->rmFlag('groupannu');
if (may_update()) {
$perms->addFlag('groupadmin');
$perms->addFlag('groupmember');
$perms->addFlag('groupannu');
}
if (is_member()) {
$perms->addFlag('groupmember');
if ($globals->asso('pub') != 'private') {
$perms->addFlag('groupannu');
}
} else {
if ($globals->asso('pub') == 'public') {
$perms->addFlag('groupannu');
}
}
if ($globals->asso('cat') == 'Promotions') {
$perms->addFlag('groupannu');
}
S::set('perms', $perms);
}
return true;
}
示例8: smarty_function_poison
function smarty_function_poison($params, $smarty)
{
if (S::logged()) {
return '';
}
$count = isset($params['count']) ? $params['count'] : 20;
$seed = isset($params['seed']) ? $params['seed'] : date('r');
Platal::load('poison', 'poison.inc.php');
$emails = get_poison_emails($seed, $count);
$str = "<textarea>";
foreach ($emails as $email) {
$str .= "<a href=\"mailto:{$email}\">{$email}</a> ";
}
return $str . '</textarea>';
}
示例9: 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);
}
示例10: handler_ig_search
function handler_ig_search($page)
{
if (Env::has('quick') && Env::s('quick') != '') {
global $globals;
require_once 'userset.inc.php';
$view = new QuickSearchSet();
$view->addMod('gadget', 'Gadget', true);
$view->apply(null, $page);
$nb_tot = $view->count();
$page->assign('result_count', $nb_tot);
if (!S::logged() && $nb_tot > $globals->search->public_max) {
$page->assign('error', 'Votre recherche a généré trop de résultats pour un affichage public.');
} elseif ($nb_tot > $globals->search->private_max) {
$page->assign('error', 'Recherche trop générale.');
} elseif (empty($nb_tot)) {
$page->assign('error', 'Il n\'existe personne correspondant à ces critères dans la base !');
} else {
$page->assign('error', false);
}
}
require_once 'gadgets/gadgets.inc.php';
init_igoogle_html('gadgets/ig-search.tpl', AUTH_PUBLIC);
}
示例11: check_surveyPerms
function check_surveyPerms($page, $survey, $silent = false, $admin_allowed = true)
{
$this->load('survey.inc.php');
if ($survey->isMode(Survey::MODE_ALL)) {
// if the survey is not reserved to alumni
return true;
}
if (!S::logged()) {
return false;
}
$profile = S::user()->profile();
if (!$profile) {
return false;
}
// checks promotion
$allowed = false;
foreach ($profile->yearspromo() as $p) {
if ($survey->checkPromo($p)) {
$allowed = true;
break;
}
}
if ($allowed) {
return true;
}
if (S::admin() && $admin_allowed) {
if (!$silent) {
$page->trigWarning('Tu as accès à ce sondage car tu es administrateur du site.');
}
return true;
}
if (!$silent) {
$page->kill("Tu n'as pas accès à ce sondage car il est réservé à d'autres promotions.");
}
return false;
}
示例12: handler_openid
function handler_openid($page, $login = null)
{
$this->load('openid.inc.php');
$requested_user = User::getSilent($login);
$server = new OpenId();
// Spec §4.1.2: if "openid.mode" is absent, we SHOULD assume that
// the request is not an OpenId message.
if (!$server->IsOpenIdRequest()) {
if ($requested_user) {
$server->RenderDiscoveryPage($page, $requested_user);
return;
} else {
pl_redirect('Xorg/OpenId');
}
exit;
}
// Initializes the OpenId environment from the request.
$server->Initialize();
// In modes 'checkid_immediate' and 'checkid_setup', we need to check
// by ourselves that we want to allow the user to be authenticated.
// Otherwise it can simply be forwarded to the Server object.
if ($server->IsAuthorizationRequest()) {
$authorized = S::logged() && $server->IsUserAuthorized(S::user()) && $server->IsEndpointTrusted(S::user());
if ($authorized) {
// TODO(vzanotti): SReg requests are currently not honored if
// the website is already trusted. We may want to redirect SReg
// requests to /openid/trust, to allow the user to choose.
$server->AnswerRequest(true);
} else {
if ($server->IsImmediateRequest()) {
$server->AnswerRequest(false);
} else {
// The user is currently not authorized to get her authorization
// request approved. Two possibilities:
// * the endpoint is not yet trusted => redirect to openid/trust
// * the user is not logged in => log in the user.
//
// The second case requires a special handling when the request
// was POSTed, as our current log in mechanism does not preserve
// POST arguments.
$openid_args = $server->GetQueryStringForRequest();
if (S::logged()) {
pl_redirect('openid/trust', $openid_args);
} else {
if (Post::has('openid_mode')) {
pl_redirect('openid', $openid_args);
} else {
return PL_DO_AUTH;
}
}
}
}
} else {
$server->HandleRequest();
}
// All requests should have been answered at this point. The best here
// is to get the user back to a safe page.
pl_redirect('');
}
示例13: handler_skin
function handler_skin($page)
{
if (Env::v('skin', '') != '') {
S::set('skin', Env::v('skin'));
if (S::logged()) {
S::user()->skin(Env::v('skin'));
}
}
$res = XDB::query('SELECT s.name, s.label, s.description, COUNT(a.skin) frequency
FROM skins AS s
LEFT JOIN account AS a ON a.skin = s.name
WHERE s.visibility = 1
GROUP BY s.name
ORDER BY frequency DESC');
$skins = $res->fetchAllAssoc();
$total = 0;
foreach ($skins as $skin) {
$total += $skin['frequency'];
}
$page->assign('total', $total);
$page->assign('skinsList', $skins);
$page->assign('title', "Modification de l'habillage");
$page->addCssLink('profile.css');
$page->changeTpl("profile/skins.tpl");
}
示例14: useMenu
private function useMenu()
{
global $globals;
$menu = array();
$sub = array();
$sub['tous les groupes'] = 'plan';
$sub['documentation'] = 'Xnet';
if (S::user()->type == 'xnet') {
$sub['mon compte'] = 'edit';
$sub['mes préférences'] = $globals->xnet->xorg_baseurl . 'prefs';
}
$sub['signaler un bug'] = array('href' => 'send_bug/' . $_SERVER['REQUEST_URI'], 'class' => 'popup_840x600');
$menu["no_title"] = $sub;
$perms = S::v('perms');
$dim = $globals->asso('diminutif');
if (S::logged() && $globals->asso()) {
$sub = array();
$sub['présentation'] = "login/{$dim}/";
if ($perms->hasFlag('groupannu')) {
$sub['annuaire du groupe'] = "{$dim}/annuaire";
$sub['trombinoscope'] = "{$dim}/trombi";
}
if ($globals->asso('forum')) {
$sub['forum'] = "{$dim}/forum";
}
if ($perms->hasFlag('groupmember')) {
if ($globals->asso('mail_domain')) {
$sub['listes de diffusion'] = "{$dim}/lists";
}
if ($globals->asso('has_nl')) {
$sub['newsletter'] = "{$dim}/nl";
}
}
$sub['événement'] = "{$dim}/events";
if ($perms->hasFlag('groupadmin')) {
$sub['télépaiement'] = "{$dim}/payment";
}
$menu[$globals->asso('nom')] = $sub;
}
if ($globals->asso() && is_object($perms) && $perms->hasFlag('groupadmin')) {
$sub = array();
$sub['modifier l\'accueil'] = "{$dim}/edit";
$sub['gérer les annonces'] = "{$dim}/admin/announces";
if ($globals->asso('mail_domain')) {
if (!$globals->asso('disable_mails')) {
$sub['envoyer un mail'] = "{$dim}/mail";
}
$sub['créer une liste'] = "{$dim}/lists/create";
$sub['créer un alias'] = "{$dim}/alias/create";
}
if (!$globals->asso('has_nl')) {
$sub['créer la newsletter'] = "{$dim}/admin/nl/enable";
}
if (S::admin()) {
$sub['gérer les groupes'] = array('href' => 'admin', 'style' => 'color: gray;');
$sub['clear cache'] = array('href' => 'purge_cache?token=' . S::v('xsrf_token'), 'style' => 'color: gray;');
}
$menu['Administrer'] = $sub;
} elseif (S::admin()) {
$sub = array();
$sub['gérer les groupes'] = 'admin';
$sub['clear cache'] = 'purge_cache?token=' . S::v('xsrf_token');
$menu['Administrer'] = $sub;
}
$this->assign('menu', $menu);
}
示例15: manage_ping
function manage_ping($page, $id)
{
if (S::logged()) {
$res = XDB::query("SELECT uid, description FROM laf WHERE oid = {?}", $id)->fetchOneAssoc();
$user = new User($res['uid']);
$user->select(array(User::SELECT_BASE => array()));
$message = 'Un message a été envoyé à ' . $user->displayName() . ' (' . $user->bestEmail() . ') pour lui signaler que tu as retrouvé son objet.';
$page->assign('message', $message);
$mail = new FrankizMailer("lostandfound/mail.tpl");
$mail->assign('object', $res);
$mail->assign('user', S::user());
$mail->assign('type', 'ping');
$mail->SetFrom(S::user()->bestEmail(), S::user()->displayName());
$mail->AddAddress($user->bestEmail(), $user->displayName());
$mail->subject('[Frankiz] Objet perdu');
$mail->send(false);
} else {
$page->assign('not_logged', 'true');
}
}