Fix authentication on wiki RSS
authorx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Tue, 10 Apr 2007 09:20:50 +0000 (09:20 +0000)
committerx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Tue, 10 Apr 2007 09:20:50 +0000 (09:20 +0000)
Add a link to the "AllRecentChanges" RSS on admin/wiki

 include/wiki.inc.php         |    9 ++++-----
 include/wiki/engine.php      |    2 +-
 include/wiki/farmconfig.php  |    2 +-
 include/xorg/session.inc.php |    2 +-
 modules/admin.php            |    4 ++++
 templates/admin/wiki.tpl     |    2 +-
 6 files changed, 12 insertions(+), 9 deletions(-)

git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1677 839d8a87-29fc-0310-9880-83ba4fa771e5

include/wiki.inc.php
include/wiki/engine.php
include/wiki/farmconfig.php
include/xorg/session.inc.php
modules/admin.php
templates/admin/wiki.tpl

index de810be..aa0c654 100644 (file)
@@ -122,10 +122,7 @@ function wiki_apply_feed_perms($perm)
 
     require_once 'rss.inc.php';
     $uid = init_rss(null, Env::v('user'), Env::v('hash'));
-    if (!$uid) {
-        exit;
-    }
-    $res = XDB::query('SELECT user_id, IF (nom_usage <> \'\', nom_usage, nom) AS nom, prenom, perms
+    $res = XDB::query('SELECT user_id AS uid, IF (nom_usage <> \'\', nom_usage, nom) AS nom, prenom, perms
                          FROM auth_user_md5
                         WHERE user_id = {?}', $uid);
     if (!$res->numRows()) {
@@ -133,7 +130,9 @@ function wiki_apply_feed_perms($perm)
     }
     $table = $res->fetchOneAssoc();
     $_SESSION = array_merge($_SESSION, $table, array('forlife' => Env::v('user')));
-    if ($perm == 'logged' || S::has_perms()) {
+    require_once 'xorg/session.inc.php';
+    $_SESSION['perms'] =& XorgSession::make_perms($_SESSION['perms']);
+    if ($perm == 'logged' || $_SESSION['perms']->hasFlag('admin')) {
         return;
     }
     exit;
index b294af9..0ecc3ad 100644 (file)
@@ -33,7 +33,7 @@ $feed  = false;
 // Check user perms
 switch (Env::v('action')) {
   case 'rss': case 'atom': case 'sdf': case 'dc':
-    wiki_apply_feed_perms($perms['0']);  
+    wiki_apply_feed_perms($perms[0]);
     $feed = true;
   case '': case 'search': 
     break;
index 51650ee..d62c5c7 100644 (file)
@@ -18,7 +18,7 @@ $InterMapFiles[]  = $globals->spoolroot.'/configs/pmwiki.intermap.txt';
 $Skin             = 'empty';
 
 @include_once("$FarmD/cookbook/e-protect.php");
-include_once($FarmD.'/scripts/xlpage-utf-8.php');
+include_once($FarmD.'/scripts/xlpage-utf-8.php'); 
 
 if ($action == 'rss'  || $action == 'atom' || $action == 'rdf'  || $action == 'dc') {
     $FmtPV['$MarkupExcerpt'] = '$page["text"]';
index c6ea8e4..f3582ce 100644 (file)
@@ -239,7 +239,7 @@ function try_cookie()
 function start_connexion ($uid, $identified)
 {
     $res  = XDB::query("
-    SELECT  u.user_id AS uid, prenom, nom, perms, promo, matricule, password, FIND_IN_SET('femme', u.flags) AS femme,
+        SELECT  u.user_id AS uid, prenom, nom, perms, promo, matricule, password, FIND_IN_SET('femme', u.flags) AS femme,
                 UNIX_TIMESTAMP(s.start) AS lastlogin, s.host, a.alias AS forlife, a2.alias AS bestalias,
                 q.core_mail_fmt AS mail_fmt, UNIX_TIMESTAMP(q.banana_last) AS banana_last, q.watch_last, q.core_rss_hash,
                 FIND_IN_SET('watch', u.flags) AS watch_account, q.last_version
index 89a3165..392d523 100644 (file)
@@ -898,6 +898,10 @@ class AdminModule extends PLModule
     {
         require_once 'wiki.inc.php';
 
+        if (S::v('core_rss_hash')) {
+           $page->setRssLink('Changement Récents',
+                             '/Site/AllRecentChanges?action=rss&user=' . S::v('forlife') . '&hash=' . S::v('core_rss_hash'));
+        }
         // update wiki perms
         if ($action == 'update') {
             $perms_read = Post::v('read');
index ebcc34c..441ed04 100644 (file)
@@ -68,7 +68,7 @@
 {/literal}
 
 <p class="center">
-  {icon name=magnifier"} <a href="Site/AllRecentChanges">Voir les changements récents</a>
+   {icon name=magnifier"} <a href="Site/AllRecentChanges">Voir les changements récents</a>
 </p>
 
 <form action="admin/wiki/update" method="post" id="update_pages">