projects
/
platal.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Uses the proper name for display and removes old related name references.
[platal.git]
/
modules
/
platal.php
diff --git
a/modules/platal.php
b/modules/platal.php
index
f89c57c
..
1f1a643
100644
(file)
--- a/
modules/platal.php
+++ b/
modules/platal.php
@@
-1,6
+1,6
@@
<?php
/***************************************************************************
<?php
/***************************************************************************
- * Copyright (C) 2003-200
8
Polytechnique.org *
+ * Copyright (C) 2003-200
9
Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
@@
-62,6
+62,11
@@
class PlatalModule extends PLModule
function handler_index(&$page)
{
function handler_index(&$page)
{
+ // Include X-XRDS-Location response-header for Yadis discovery
+ global $globals;
+ header('X-XRDS-Location: ' . $globals->baseurl . '/openid/idp_xrds');
+
+ // Redirect to the suitable page
if (S::logged()) {
pl_redirect('events');
} else if (!@$GLOBALS['IS_XNET_SITE']) {
if (S::logged()) {
pl_redirect('events');
} else if (!@$GLOBALS['IS_XNET_SITE']) {
@@
-87,7
+92,7
@@
class PlatalModule extends PLModule
$page->changeTpl('platal/changeLog.tpl');
$clog = pl_entities(file_get_contents(dirname(__FILE__).'/../ChangeLog'));
$page->changeTpl('platal/changeLog.tpl');
$clog = pl_entities(file_get_contents(dirname(__FILE__).'/../ChangeLog'));
- $clog = preg_replace('/=+\s*/', '</pre><hr /><pre>', $clog);
+ $clog = preg_replace('/=
==
+\s*/', '</pre><hr /><pre>', $clog);
// url catch only (not all wiki syntax)
$clog = preg_replace(array(
'/((?:https?|ftp):\/\/(?:\.*,*[\w@~%$£µ&i#\-+=_\/\?;])*)/ui',
// url catch only (not all wiki syntax)
$clog = preg_replace(array(
'/((?:https?|ftp):\/\/(?:\.*,*[\w@~%$£µ&i#\-+=_\/\?;])*)/ui',
@@
-122,7
+127,7
@@
class PlatalModule extends PLModule
function handler_prefs(&$page)
{
$page->changeTpl('platal/preferences.tpl');
function handler_prefs(&$page)
{
$page->changeTpl('platal/preferences.tpl');
- $page->setTitle('
Polytechnique.org -
Mes préférences');
+ $page->setTitle('Mes préférences');
if (Post::has('mail_fmt')) {
$fmt = Post::v('mail_fmt');
if (Post::has('mail_fmt')) {
$fmt = Post::v('mail_fmt');
@@
-137,13
+142,21
@@
class PlatalModule extends PLModule
if (Post::has('rss')) {
$this->__set_rss_state(Post::b('rss'));
}
if (Post::has('rss')) {
$this->__set_rss_state(Post::b('rss'));
}
+
+ # FIXME: this code is not multi-domain compatible. We should decide how
+ # carva will extend to users not in the main domain.
+ $res = XDB::query("SELECT alias
+ FROM aliases
+ WHERE id = {?} AND FIND_IN_SET('bestalias', flags)",
+ S::user()->id());
+ $page->assign('bestalias', $res->fetchOneCell());
}
function handler_webredir(&$page)
{
$page->changeTpl('platal/webredirect.tpl');
}
function handler_webredir(&$page)
{
$page->changeTpl('platal/webredirect.tpl');
- $page->setTitle('
Polytechnique.org -
Redirection de page WEB');
+ $page->setTitle('Redirection de page WEB');
$log =& S::v('log');
$url = Env::v('url');
$log =& S::v('log');
$url = Env::v('url');
@@
-169,6
+182,14
@@
class PlatalModule extends PLModule
WHERE user_id = {?}',
S::v('uid'));
$page->assign('carva', $res->fetchOneCell());
WHERE user_id = {?}',
S::v('uid'));
$page->assign('carva', $res->fetchOneCell());
+
+ # FIXME: this code is not multi-domain compatible. We should decide how
+ # carva will extend to users not in the main domain.
+ $res = XDB::query("SELECT alias
+ FROM aliases
+ WHERE id = {?} AND FIND_IN_SET('bestalias', flags)",
+ S::user()->id());
+ $page->assign('bestalias', $res->fetchOneCell());
}
function handler_prefs_rss(&$page)
}
function handler_prefs_rss(&$page)
@@
-202,18
+223,14
@@
class PlatalModule extends PLModule
// updates the Google Apps password as well.
if ($globals->mailstorage->googleapps_domain) {
require_once 'googleapps.inc.php';
// updates the Google Apps password as well.
if ($globals->mailstorage->googleapps_domain) {
require_once 'googleapps.inc.php';
- $account = new GoogleAppsAccount(S::
v('uid'), S::v('forlife'
));
+ $account = new GoogleAppsAccount(S::
user(
));
if ($account->active() && $account->sync_password) {
$account->set_password($password);
}
}
if ($account->active() && $account->sync_password) {
$account->set_password($password);
}
}
- $log =& S::v('log');
- S::logger()->log('passwd', '');
-
- if (Cookie::v('ORGaccess')) {
- setcookie('ORGaccess', hash_encrypt($password), (time()+25920000), '/', '' ,0);
- }
+ S::logger()->log('passwd');
+ Platal::session()->setAccessCookie(true);
$page->changeTpl('platal/motdepasse.success.tpl');
$page->run();
$page->changeTpl('platal/motdepasse.success.tpl');
$page->run();
@@
-221,13
+238,13
@@
class PlatalModule extends PLModule
$page->changeTpl('platal/motdepasse.tpl');
$page->addJsLink('motdepasse.js');
$page->changeTpl('platal/motdepasse.tpl');
$page->addJsLink('motdepasse.js');
- $page->setTitle('
Polytechnique.org -
Mon mot de passe');
+ $page->setTitle('Mon mot de passe');
}
function handler_smtppass(&$page)
{
$page->changeTpl('platal/acces_smtp.tpl');
}
function handler_smtppass(&$page)
{
$page->changeTpl('platal/acces_smtp.tpl');
- $page->setTitle('
Polytechnique.org -
Acces SMTP/NNTP');
+ $page->setTitle('Acces SMTP/NNTP');
$wp = new PlWikiPage('Xorg.SMTPSécurisé');
$wp->buildCache();
$wp = new PlWikiPage('Xorg.SMTPSécurisé');
$wp->buildCache();
@@
-335,8
+352,7
@@
Adresse de secours : " . Post::v('email') : ""));
$mymail->send();
// on cree un objet logger et on log l'evenement
$mymail->send();
// on cree un objet logger et on log l'evenement
- $logger = $_SESSION['log'] = new PlLogger($uid);
- S::logger()->log('recovery', $mails);
+ S::logger(uid)->log('recovery', $mails);
} else {
$page->trigError('Les informations que tu as rentrées ne permettent pas de récupérer ton mot de passe.<br />'.
'Si tu as un homonyme, utilise prenom.nom.promo comme login');
} else {
$page->trigError('Les informations que tu as rentrées ne permettent pas de récupérer ton mot de passe.<br />'.
'Si tu as un homonyme, utilise prenom.nom.promo comme login');
@@
-368,14
+384,13
@@
Adresse de secours : " . Post::v('email') : ""));
// updates the Google Apps password as well.
if ($globals->mailstorage->googleapps_domain) {
require_once 'googleapps.inc.php';
// updates the Google Apps password as well.
if ($globals->mailstorage->googleapps_domain) {
require_once 'googleapps.inc.php';
- $account = new GoogleAppsAccount(
$uid
);
+ $account = new GoogleAppsAccount(
User::getSilent($uid)
);
if ($account->active() && $account->sync_password) {
$account->set_password($password);
}
}
if ($account->active() && $account->sync_password) {
$account->set_password($password);
}
}
- $logger = new PlLogger($uid);
- S::logger()->log("passwd","");
+ S::logger($uid)->log("passwd", "");
$page->changeTpl('platal/tmpPWD.success.tpl');
} else {
$page->changeTpl('platal/motdepasse.tpl');
$page->changeTpl('platal/tmpPWD.success.tpl');
} else {
$page->changeTpl('platal/motdepasse.tpl');
@@
-388,7
+403,7
@@
Adresse de secours : " . Post::v('email') : ""));
global $globals;
$page->changeTpl('platal/skins.tpl');
global $globals;
$page->changeTpl('platal/skins.tpl');
- $page->setTitle('
Polytechnique.org -
Skins');
+ $page->setTitle('Skins');
if (Env::has('newskin')) { // formulaire soumis, traitons les données envoyées
XDB::execute('UPDATE auth_user_quick
if (Env::has('newskin')) { // formulaire soumis, traitons les données envoyées
XDB::execute('UPDATE auth_user_quick
@@
-412,32
+427,22
@@
Adresse de secours : " . Post::v('email') : ""));
function handler_exit(&$page, $level = null)
{
if (S::has('suid')) {
function handler_exit(&$page, $level = null)
{
if (S::has('suid')) {
- $a4l = S::v('forlife');
$suid = S::v('suid');
$log = S::v('log');
$suid = S::v('suid');
$log = S::v('log');
- S::logger()->log("suid_stop", S::
v('forlife') . " by " . $suid['forlife
']);
+ S::logger()->log("suid_stop", S::
user()->login() . " by " . $suid['hruid
']);
Platal::session()->stopSUID();
Platal::session()->stopSUID();
- pl_redirect('admin/user/' .
$a4l
);
+ pl_redirect('admin/user/' .
S::user()->login()
);
}
if ($level == 'forget' || $level == 'forgetall') {
}
if ($level == 'forget' || $level == 'forgetall') {
- setcookie('ORGaccess', '', time() - 3600, '/', '', 0);
- Cookie::kill('ORGaccess');
- if (isset($_SESSION['log']))
- S::logger()->log("cookie_off");
+ Platal::session()->killAccessCookie();
}
if ($level == 'forgetuid' || $level == 'forgetall') {
}
if ($level == 'forgetuid' || $level == 'forgetall') {
- setcookie('ORGuid', '', time() - 3600, '/', '', 0);
- Cookie::kill('ORGuid');
- setcookie('ORGdomain', '', time() - 3600, '/', '', 0);
- Cookie::kill('ORGdomain');
+ Platal::session()->killLoginFormCookies();
}
}
- if (isset($_SESSION['log'])) {
- $ref = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
- S::logger()->log('deconnexion',$ref);
- }
+ S::logger()->log('deconnexion', @$_SERVER['HTTP_REFERER']);
Platal::session()->destroy();
if (Get::has('redirect')) {
Platal::session()->destroy();
if (Get::has('redirect')) {
@@
-449,14
+454,18
@@
Adresse de secours : " . Post::v('email') : ""));
function handler_review(&$page, $action = null, $mode = null)
{
function handler_review(&$page, $action = null, $mode = null)
{
- require_once dirname(__FILE__) . '/platal/review.inc.php';
+ // Include X-XRDS-Location response-header for Yadis discovery
+ global $globals;
+ header('X-XRDS-Location: ' . $globals->baseurl . '/openid/idp_xrds');
+
+ $this->load('review.inc.php');
$dom = 'Review';
if (@$GLOBALS['IS_XNET_SITE']) {
$dom .= 'Xnet';
}
$wp = new PlWikiPage($dom . '.Admin');
$conf = explode('%0a', $wp->getField('text'));
$dom = 'Review';
if (@$GLOBALS['IS_XNET_SITE']) {
$dom .= 'Xnet';
}
$wp = new PlWikiPage($dom . '.Admin');
$conf = explode('%0a', $wp->getField('text'));
- $wiz = new PlWizard('Tour d\'horizon',
'core/plwizard.tpl'
, true);
+ $wiz = new PlWizard('Tour d\'horizon',
PlPage::getCoreTpl('plwizard.tpl')
, true);
foreach ($conf as $line) {
$list = preg_split('/\s*[*|]\s*/', $line, -1, PREG_SPLIT_NO_EMPTY);
$wiz->addPage('ReviewPage', $list[0], $list[1]);
foreach ($conf as $line) {
$list = preg_split('/\s*[*|]\s*/', $line, -1, PREG_SPLIT_NO_EMPTY);
$wiz->addPage('ReviewPage', $list[0], $list[1]);