From a2b461cee28a1cfef200039caec99158a6b906f3 Mon Sep 17 00:00:00 2001 From: x2003bruneau Date: Tue, 10 Apr 2007 09:20:50 +0000 Subject: [PATCH] Fix authentication on wiki RSS 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 | 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(-) diff --git a/include/wiki.inc.php b/include/wiki.inc.php index de810be..aa0c654 100644 --- a/include/wiki.inc.php +++ b/include/wiki.inc.php @@ -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; diff --git a/include/wiki/engine.php b/include/wiki/engine.php index b294af9..0ecc3ad 100644 --- a/include/wiki/engine.php +++ b/include/wiki/engine.php @@ -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; diff --git a/include/wiki/farmconfig.php b/include/wiki/farmconfig.php index 51650ee..d62c5c7 100644 --- a/include/wiki/farmconfig.php +++ b/include/wiki/farmconfig.php @@ -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"]'; diff --git a/include/xorg/session.inc.php b/include/xorg/session.inc.php index c6ea8e4..f3582ce 100644 --- a/include/xorg/session.inc.php +++ b/include/xorg/session.inc.php @@ -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 diff --git a/modules/admin.php b/modules/admin.php index 89a3165..392d523 100644 --- a/modules/admin.php +++ b/modules/admin.php @@ -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'); diff --git a/templates/admin/wiki.tpl b/templates/admin/wiki.tpl index ebcc34c..441ed04 100644 --- a/templates/admin/wiki.tpl +++ b/templates/admin/wiki.tpl @@ -68,7 +68,7 @@ {/literal}

- {icon name=magnifier"} Voir les changements récents + {icon name=magnifier"} Voir les changements récents

-- 2.1.4