From: x2003bruneau Date: Sun, 4 Feb 2007 07:37:59 +0000 (+0000) Subject: Improve wiki RSS X-Git-Tag: xorg/0.9.14~291 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=0a5cc8b1ccf72f045d10d0bafac7cff8bda0afca;p=platal.git Improve wiki RSS git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1476 839d8a87-29fc-0310-9880-83ba4fa771e5 --- diff --git a/include/globals.inc.php.in b/include/globals.inc.php.in index 0554899..74fb56c 100644 --- a/include/globals.inc.php.in +++ b/include/globals.inc.php.in @@ -51,7 +51,6 @@ class PlatalGlobals $this->read_config(); $this->setlocale(); - require_once dirname(__FILE__) . '/../classes/xdb.php'; XDB::connect($this->dbhost, $this->dbuser, $this->dbpwd, $this->dbdb, 'utf8', $this->debug); } diff --git a/include/wiki/engine.php b/include/wiki/engine.php index 628bdf3..859dd95 100644 --- a/include/wiki/engine.php +++ b/include/wiki/engine.php @@ -28,9 +28,12 @@ if (!$n) { new_skinned_page('core/wiki.tpl'); $perms = wiki_get_perms($n); +$feed = false; // Check user perms switch (Env::v('action')) { + case 'rss': case 'atom': case 'sdf': case 'dc': + $feed = true; case '': case 'search': case 'rss': case 'atom': break; @@ -62,7 +65,6 @@ if ($p = Post::v('setwperms')) { // Generate cache even if we don't have access rights $wiki_cache = wiki_work_dir().'/cache_'.wiki_filename($n).'.tpl'; $cache_exists = file_exists($wiki_cache); -$feed = in_array(Env::v('action'), array('rss', 'atom', 'sdf', 'dc')); if (Env::v('action') || !$cache_exists) { if ($cache_exists && !$feed) { unlink($wiki_cache); @@ -84,10 +86,13 @@ if (Env::v('action') || !$cache_exists) { $wiki_exists = file_exists(wiki_work_dir() . '/' . wiki_filename($n)); -if (Env::v('action') && !$feed) { +if ($feed) { + $wikiAll = str_replace('dc:contributor', 'author', $wikiAll); + $wikiAll = preg_replace('!.*?\..*?\.(\d{4})\|(.*?)!u', '$2 (X$1)', $wikiAll); +} elseif (Env::v('action')) { $page->assign('xorg_extra_header', substr($wikiAll, 0, $i)); $wikiAll = substr($wikiAll, $j); -} elseif (!$feed) { +} else { if (!$cache_exists && $wiki_exists) { $wikiAll = substr($wikiAll, $j); wiki_putfile($wiki_cache, $wikiAll); diff --git a/include/wiki/farmconfig.php b/include/wiki/farmconfig.php index 081a9ed..07977fe 100644 --- a/include/wiki/farmconfig.php +++ b/include/wiki/farmconfig.php @@ -20,10 +20,13 @@ $Skin = 'empty'; @include_once("$FarmD/cookbook/e-protect.php"); include_once($FarmD.'/scripts/xlpage-utf-8.php'); -if ($action == 'rss' || - $action == 'atom' || - $action == 'rdf' || - $action == 'dc') include_once("$FarmD/scripts/feeds.php"); +if ($action == 'rss' || $action == 'atom' || $action == 'rdf' || $action == 'dc') { + include_once("$FarmD/scripts/feeds.php"); + $FmtPV['$MarkupExcerpt'] = '$page["text"]'; + $FeedFmt[$action]['item']['title'] = '[$Group] {$Title}'; + $FeedFmt[$action]['item']['description'] = '$LastModifiedSummary'; + $FeedFmt[$action]['feed']['title'] = 'Polytechnique.org :: Wiki :: $FullName'; +} // Theme-ing {{{ @@ -60,6 +63,10 @@ $InputTags['e_form'] = array( Markup('[[~platal', '<[[~', '/\[\[~([^|\]]*)(?:\|([^\]]*))?\]\]/e', 'PreserveText("=", doPlatalLink("$1", "$2"), "")'); +// Preserve javascript +Markup('[[javascript', '<[[javascript:', '/\[\[javascript:([^\|]*)\|([^\]]*)?\]\]/e', + 'PreserveText("=", \'\', "") . "$2" . PreserveText("=", "", "")'); + // prevent restorelinks before block apply (otherwise [[Sécurité]] will give // .../Se9'>Sécurité Markup('restorelinks','<%%',"//", '');