Force auth on newsletter unsubscription link
[platal.git] / modules / epletter.php
index 8e7fe2b..f1cd592 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2013 Polytechnique.org                              *
+ *  Copyright (C) 2003-2014 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -27,7 +27,7 @@ class EPLetterModule extends NewsletterModule
     {
         return array(
             'epletter'                   => $this->make_hook('nl',              AUTH_COOKIE, 'user'),
-            'epletter/out'               => $this->make_hook('out',             AUTH_PUBLIC),
+            'epletter/out'               => $this->make_hook('out',             AUTH_COOKIE, 'user'),
             'epletter/show'              => $this->make_hook('nl_show',         AUTH_COOKIE, 'user'),
             'epletter/search'            => $this->make_hook('nl_search',       AUTH_COOKIE, 'user'),
             'epletter/admin'             => $this->make_hook('admin_nl',        AUTH_PASSWD, 'user'),
@@ -48,6 +48,7 @@ class EPLetterModule extends NewsletterModule
 
     function handler_out($page, $hash = null, $issue_id = null)
     {
+        $hash = ($hash == 'nohash') ? null : $hash;
         if (!$hash) {
             if (!S::logged()) {
                 return PL_DO_AUTH;
@@ -57,5 +58,5 @@ class EPLetterModule extends NewsletterModule
     }
 }
 
-// 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:
 ?>