$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);
}
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;
// 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);
$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('!<author>.*?\..*?\.(\d{4})\|(.*?)</author>!u', '<author>$2 (X$1)</author>', $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);
@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 {{{
Markup('[[~platal', '<[[~', '/\[\[~([^|\]]*)(?:\|([^\]]*))?\]\]/e',
'PreserveText("=", doPlatalLink("$1", "$2"), "")');
+// Preserve javascript
+Markup('[[javascript', '<[[javascript:', '/\[\[javascript:([^\|]*)\|([^\]]*)?\]\]/e',
+ 'PreserveText("=", \'<a href="javascript:\' . htmlentities("$1") . \'">\', "") . "$2" . PreserveText("=", "</a>", "")');
+
// prevent restorelinks before block apply (otherwise [[Sécurité]] will give
// .../S<span class='e9curit'>e9'>Sécurité</a>
Markup('restorelinks','<%%',"//", '');