X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fplatal.php;h=f2d4d96b684086cdc66448976829e7c977d71c6d;hb=a5878ac19cc6ea75a753470cf68b7d2180d6cd51;hp=4ba474058f466e2f062b5bf97f5722d4d0bc4e96;hpb=787bb3d745141f2f85bd947ad7dd775d2c63f908;p=platal.git diff --git a/modules/platal.php b/modules/platal.php index 4ba4740..f2d4d96 100644 --- a/modules/platal.php +++ b/modules/platal.php @@ -1,6 +1,6 @@ $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 @@ -55,6 +55,7 @@ class PlatalModule extends PLModule '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), ); } @@ -63,6 +64,8 @@ class PlatalModule extends PLModule { if (S::logged()) { pl_redirect('events'); + } else if (!@$GLOBALS['IS_XNET_SITE']) { + pl_redirect('review'); } } @@ -84,6 +87,7 @@ class PlatalModule extends PLModule $page->changeTpl('platal/changeLog.tpl'); $clog = pl_entities(file_get_contents(dirname(__FILE__).'/../ChangeLog')); + $clog = preg_replace('/=+\s*/', '
', $clog);
         // url catch only (not all wiki syntax)
         $clog = preg_replace(array(
             '/((?:https?|ftp):\/\/(?:\.*,*[\w@~%$£µ&i#\-+=_\/\?;])*)/ui',
@@ -96,6 +100,7 @@ class PlatalModule extends PLModule
           $clog);
         $clog = preg_replace('!(#[0-9]+(,[0-9]+)*)!e', 'bugize("\1")', $clog);
         $clog = preg_replace('!vim:.*$!', '', $clog);
+        $clog = preg_replace("!(
(\\s|\n)*)?
(\s|\n)*
((\\s|\n)*
)?!m", "", "
$clog
"); $page->assign('ChangeLog', $clog); } @@ -180,8 +185,11 @@ class PlatalModule extends PLModule function handler_password(&$page) { + global $globals; + if (Post::has('response2')) { require_once 'secure_hash.inc.php'; + S::assert_xsrf_token(); $_SESSION['password'] = $password = Post::v('response2'); @@ -190,6 +198,16 @@ class PlatalModule extends PLModule 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', ''); @@ -326,6 +344,7 @@ Adresse de secours : " . Post::v('email') : "")); function handler_tmpPWD(&$page, $certif = null) { + global $globals; XDB::execute('DELETE FROM perte_pass WHERE DATE_SUB(NOW(), INTERVAL 380 MINUTE) > created'); @@ -339,11 +358,22 @@ Adresse de secours : " . Post::v('email') : "")); $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 { @@ -417,6 +447,31 @@ Adresse de secours : " . Post::v('email') : "")); $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: