* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-class CoreModule extends PLModule
+function bugize($list)
{
- function menu_entries()
- {
- return array();
+ $list = split(',', $list);
+ $ans = array();
+
+ foreach ($list as $bug) {
+ $clean = str_replace('#', '', $bug);
+ $ans[] = "<a href='http://trackers.polytechnique.org/task/$clean'>$bug</a>";
}
+ return join(',', $ans);
+}
+
+
+class CoreModule extends PLModule
+{
function handlers()
{
return array(
- '403' => $this->make_hook('403', AUTH_PUBLIC),
- '404' => $this->make_hook('404', AUTH_PUBLIC),
- 'exit' => $this->make_hook('exit', AUTH_PUBLIC),
+ '403' => $this->make_hook('403', AUTH_PUBLIC),
+ '404' => $this->make_hook('404', AUTH_PUBLIC),
+ 'exit' => $this->make_hook('exit', AUTH_PUBLIC),
+ 'cacert.pem' => $this->make_hook('cacert', AUTH_PUBLIC),
+ 'changelog' => $this->make_hook('changelog', AUTH_PUBLIC),
+ 'purge_cache' => $this->make_hook('purge_cache', AUTH_COOKIE, 'admin')
);
}
+ function handler_index(&$page)
+ {
+ if (logged()) {
+ redirect("events");
+ }
+
+ return PL_OK;
+ }
+
+ function handler_cacert(&$page)
+ {
+ $data = file_get_contents('/etc/ssl/xorgCA/cacert.pem');
+ header('Content-Type: application/x-x509-ca-cert');
+ header('Content-Length: '.strlen($data));
+ echo $data;
+ exit;
+ }
+
+ function handler_changelog(&$page)
+ {
+ $page->changeTpl('changeLog.tpl');
+
+ $clog = htmlentities(file_get_contents(dirname(__FILE__).'/../ChangeLog'));
+ $clog = preg_replace('!(#[0-9]+(,[0-9]+)*)!e', 'bugize("\1")', $clog);
+ $page->assign('ChangeLog', $clog);
+ }
+
function handler_exit(&$page, $level = null)
{
if (Session::has('suid')) {
Session::kill('suid');
redirect($globals->baseurl.'/admin/utilisateurs.php?login='.$a4l);
} else {
- redirect("login.php");
+ redirect("events");
}
}
$page->changeTpl('404.tpl');
return PL_OK;
}
+
+ function handler_purge_cache(&$page)
+ {
+ require_once 'wiki.inc.php';
+
+ $page->clear_compiled_tpl();
+ wiki_clear_all_cache();
+
+ redirect(empty($_SERVER['HTTP_REFERER']) ? './' : $_SERVER['HTTP_REFERER']);
+ }
}
?>