Moving to GitHub.
[platal.git] / include / security.inc.php
index 1d54167..827e39d 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2011 Polytechnique.org                              *
+ *  Copyright (C) 2003-2014 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -105,7 +105,12 @@ function send_warning_mail($title, $body = '')
     $mailer->setFrom("webmaster@" . $globals->mail->domain);
     $mailer->addTo($globals->core->admin_email);
     $mailer->setSubject("[Plat/al Security Alert] $title");
-    $mailer->setTxtBody($body . "Identifiants de session :\n" . var_export($_SESSION, true) . "\n\n"
+    // Note: we can't do $session = var_export($_SESSION, true) as var_export
+    // doesn't handle circular dependency correctly.
+    ob_start();
+    var_dump($_SESSION);
+    $session = ob_get_clean();
+    $mailer->setTxtBody($body . "Identifiants de session :\n" . $session . "\n\n"
         ."Identifiants de connexion :\n" . var_export($_SERVER, true));
     $mailer->send();
 }
@@ -116,5 +121,5 @@ function kill_sessions()
     shell_exec('sudo -u root ' . dirname(dirname(__FILE__)) . '/bin/kill_sessions.sh');
 }
 
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker fenc=utf-8:
 ?>