Better message.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Sat, 31 May 2008 17:13:06 +0000 (19:13 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Sat, 31 May 2008 17:13:06 +0000 (19:13 +0200)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
class.xorg.auth.php
widget.post.perms.php

index c47e404..e284f1a 100644 (file)
@@ -28,6 +28,7 @@ class xorgAuth extends dcAuth {
       if (isset($core->blog)) {
         $this->sudo(array($this, 'updateUserPerms'));
       }
+      $core->getUserBlogs();
     }
   }
 
@@ -184,7 +185,6 @@ class xorgAuth extends dcAuth {
     $path = "http://murphy.m4x.org/~x2003bruneau/dotclear/";
     return '<fieldset>'.
       '<p><a href="' . $path . 'auth/Xorg?path=/~x2003bruneau/dotclear/admin/index.php">Via Polytechnique.org</a></p>' .
-      '<p><a href="' . $path . 'admin/auth.php">Via le formulaire</a></p>' .
       '</fieldset>'.
       '<p>'.__('You must accept cookies in order to use the private area.').'</p>';
   }
index 988851a..1d6e9ce 100644 (file)
@@ -107,11 +107,24 @@ class xorgPostPermsFilter extends rsExtPostPublic {
     return false;
   }
 
+  private static function showMessage(&$rs) {
+    $metas = unserialize($rs->field('post_meta'));
+    global $core;
+    $str = '<p class="error">'
+         . 'Vous n\'avez pas les droits suffisants pour lire ce billet<br />';
+    if (!$core->auth->userID()) {
+      $str .= 'Vous devez vous <a href="' . $core->blog->url . 'auth/Xorg?path=' . $_SERVER['REQUEST_URI'] .'">authentifier</a>';
+    } else {
+      $str .= 'Tu dois ĂȘtre membre du groupe pour lire ce message';
+    }
+    return $str . '</p>';
+  }
+
   public static function getContent(&$rs, $absolute_urls = false) {
     if (self::canRead($rs)) {
       return parent::getContent(&$rs, $absolute_urls);
     } else if (!self::isExtended($rs)) {
-      return '<p class="error">Vous n\'avez pas les droits suffisants pour lire ce billet</p>';
+      return self::showMessage($rs);
     } else {
       return null;
     }
@@ -121,7 +134,7 @@ class xorgPostPermsFilter extends rsExtPostPublic {
     if (self::canRead($rs)) {
       return parent::getContent(&$rs, $absolute_urls);
     } else if (self::isExtended($rs)) {
-      return '<p class="error">Vous n\'avez pas les droits suffisants pour lire ce billet</p>';
+      return self::showMessage($rs);
     } else {
       return null;
     }