<?php
/***************************************************************************
- * Copyright (C) 2003-2007 Polytechnique.org *
+ * Copyright (C) 2003-2008 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
{
return array(
'index' => $this->make_hook('index', AUTH_PUBLIC),
- 'cacert.pem' => $this->make_hook('cacert', AUTH_PUBLIC),
+ 'cacert.pem' => $this->make_hook('cacert', AUTH_PUBLIC),
'changelog' => $this->make_hook('changelog', AUTH_PUBLIC),
// Preferences thingies
'password/smtp' => $this->make_hook('smtppass', AUTH_MDP),
'recovery' => $this->make_hook('recovery', AUTH_PUBLIC),
'exit' => $this->make_hook('exit', AUTH_PUBLIC),
+ 'review' => $this->make_hook('review', AUTH_PUBLIC),
'deconnexion.php' => $this->make_hook('exit', AUTH_PUBLIC),
);
}
{
if (S::logged()) {
pl_redirect('events');
+ } else if (!@$GLOBALS['IS_XNET_SITE']) {
+ pl_redirect('review');
}
}
$page->changeTpl('platal/changeLog.tpl');
$clog = pl_entities(file_get_contents(dirname(__FILE__).'/../ChangeLog'));
+ $clog = preg_replace('/=+\s*/', '</pre><hr /><pre>', $clog);
// url catch only (not all wiki syntax)
$clog = preg_replace(array(
'/((?:https?|ftp):\/\/(?:\.*,*[\w@~%$£µ&i#\-+=_\/\?;])*)/ui',
$clog);
$clog = preg_replace('!(#[0-9]+(,[0-9]+)*)!e', 'bugize("\1")', $clog);
$clog = preg_replace('!vim:.*$!', '', $clog);
+ $clog = preg_replace("!(<hr />(\\s|\n)*)?<pre>(\s|\n)*</pre>((\\s|\n)*<hr />)?!m", "", "<pre>$clog</pre>");
$page->assign('ChangeLog', $clog);
}
function handler_password(&$page)
{
+ global $globals;
+
if (Post::has('response2')) {
require_once 'secure_hash.inc.php';
$_SESSION['password'] = $password = Post::v('response2');
- XDB::execute('UPDATE auth_user_md5
+ XDB::execute('UPDATE auth_user_md5
SET password={?}
WHERE user_id={?}', $password,
S::v('uid'));
+ // If GoogleApps is enabled, and the user did choose to use synchronized passwords,
+ // 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'));
+ if ($account->active() && $account->sync_password) {
+ $account->set_password($password);
+ }
+ }
+
$log =& S::v('log');
$log->log('passwd', '');
{
$page->changeTpl('platal/acces_smtp.tpl');
$page->assign('xorg_title','Polytechnique.org - Acces SMTP/NNTP');
-
+
require_once 'wiki.inc.php';
wiki_require_page('Xorg.SMTPSécurisé');
wiki_require_page('Xorg.NNTPSécurisé');
$pass = Env::v('smtppass1');
$log = S::v('log');
- if (Env::v('op') == "Valider" && strlen($pass) >= 6
- && Env::v('smtppass1') == Env::v('smtppass2'))
+ if (Env::v('op') == "Valider" && strlen($pass) >= 6
+ && Env::v('smtppass1') == Env::v('smtppass2'))
{
XDB::execute('UPDATE auth_user_md5 SET smtppass = {?}
WHERE user_id = {?}', $pass, $uid);
$log->log("passwd_del");
}
- $res = XDB::query("SELECT IF(smtppass != '', 'actif', '')
+ $res = XDB::query("SELECT IF(smtppass != '', 'actif', '')
FROM auth_user_md5
WHERE user_id = {?}", $uid);
$page->assign('actif', $res->fetchOneCell());
list($uid, $naissance) = $res->fetchOneRow();
if ($naissance == $birth) {
+ $res = XDB::query("SELECT COUNT(*)
+ FROM emails
+ WHERE uid = {?} AND flags != 'panne' AND flags != 'filter'", $uid);
+ $count = intval($res->fetchOneCell());
+ if ($count == 0) {
+ $page->assign('no_addr', true);
+ return;
+ }
+
$page->assign('ok', true);
- $url = rand_url_id();
- XDB::execute('INSERT INTO perte_pass (certificat,uid,created)
+ $url = rand_url_id();
+ XDB::execute('INSERT INTO perte_pass (certificat,uid,created)
VALUES ({?},{?},NOW())', $url, $uid);
$res = XDB::query('SELECT email
FROM emails
$mails = implode(', ', $res->fetchColumn());
}
$mymail = new PlMailer();
- $mymail->setFrom('"Gestion des mots de passe" <support+password@polytechnique.org>');
+ $mymail->setFrom('"Gestion des mots de passe" <support+password@' . $globals->mail->domain . '>');
$mymail->addTo($mails);
$mymail->setSubject('Ton certificat d\'authentification');
$mymail->setTxtBody("Visite la page suivante qui expire dans six heures :
{$globals->baseurl}/tmpPWD/$url
-Si en cliquant dessus tu n'y arrives pas, copie intégralement l'adresse dans la barre de ton navigateur.
+Si en cliquant dessus tu n'y arrives pas, copie intégralement l'adresse dans la barre de ton navigateur. Si tu n'as pas utilisé ce lien dans six heures, tu peux tout simplement recommencer cette procédure.
---
+--
Polytechnique.org
\"Le portail des élèves & anciens élèves de l'Ecole polytechnique\"
function handler_tmpPWD(&$page, $certif = null)
{
+ global $globals;
XDB::execute('DELETE FROM perte_pass
WHERE DATE_SUB(NOW(), INTERVAL 380 MINUTE) > created');
$uid = $ligne["uid"];
if (Post::has('response2')) {
$password = Post::v('response2');
- $logger = new CoreLogger($uid);
XDB::query('UPDATE auth_user_md5 SET password={?}
WHERE user_id={?} AND perms IN("admin","user")',
$password, $uid);
XDB::query('DELETE FROM perte_pass WHERE certificat={?}', $certif);
+
+ // If GoogleApps is enabled, and the user did choose to use synchronized passwords,
+ // updates the Google Apps password as well.
+ if ($globals->mailstorage->googleapps_domain) {
+ require_once 'googleapps.inc.php';
+ $account = new GoogleAppsAccount($uid);
+ if ($account->active() && $account->sync_password) {
+ $account->set_password($password);
+ }
+ }
+
+ $logger = new CoreLogger($uid);
$logger->log("passwd","");
$page->changeTpl('platal/tmpPWD.success.tpl');
} else {
$page->changeTpl('platal/exit.tpl');
}
}
+
+ function handler_review(&$page, $action = null, $mode = null)
+ {
+ require_once 'wiki.inc.php';
+ require_once dirname(__FILE__) . '/platal/review.inc.php';
+ $dir = wiki_work_dir();
+ $dom = 'Review';
+ if (@$GLOBALS['IS_XNET_SITE']) {
+ $dom .= 'Xnet';
+ }
+ if (!is_dir($dir)) {
+ $page->kill("Impossible de trouver le wiki");
+ }
+ if (!file_exists($dir . '/' . $dom . '.Admin')) {
+ $page->kill("Impossible de trouver la page d'administration");
+ }
+ $conf = preg_grep('/^text=/', explode("\n", file_get_contents($dir . '/' . $dom . '.Admin')));
+ $conf = preg_split('/(text\=|\%0a)/', array_shift($conf), -1, PREG_SPLIT_NO_EMPTY);
+ $wiz = new PlWizard('Tour d\'horizon', 'core/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]);
+ }
+ $wiz->apply($page, 'review', $action, $mode);
+ }
}
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: