Fix authentication on wiki RSS
[platal.git] / include / wiki / farmconfig.php
1 <?php if (!defined('PmWiki')) exit();
2
3 $EnablePathInfo = 1; # in fact works with apache rewrite, name is misleading
4 $EnableGUIButtons = 1;
5 $EnableUpload = 1;
6 $UploadMaxSize = 500000;
7 $LinkWikiWords = 0; # disable WikiWord links
8 $EnableIMSCaching = 1; # allow browser caching
9
10 $ScriptUrl = '.'; #\
11 $UploadUrlFmt = './uploads'; # } works thanks to the <base /> in skin
12 $PubDirUrl = './wiki'; #/
13
14 $WorkDir = '../spool/wiki.d';
15 $WikiDir = new PageStore('$FarmD/'.$WorkDir.'/$FullName');
16 $InterMapFiles[] = $globals->spoolroot.'/configs/pmwiki.intermap.txt';
17
18 $Skin = 'empty';
19
20 @include_once("$FarmD/cookbook/e-protect.php");
21 include_once($FarmD.'/scripts/xlpage-utf-8.php');
22
23 if ($action == 'rss' || $action == 'atom' || $action == 'rdf' || $action == 'dc') {
24 $FmtPV['$MarkupExcerpt'] = '$page["text"]';
25 $FeedFmt[$action]['item']['title'] = '[$Group] {$Title}';
26 $FeedFmt[$action]['item']['description'] = '$LastModifiedSummary';
27 $FeedFmt[$action]['feed']['title'] = 'Polytechnique.org :: Wiki :: $FullName';
28 $pagelist = null;
29 include_once("$FarmD/scripts/feeds.php");
30 }
31
32 // Theme-ing {{{
33
34 ## The following lines make additional editing buttons appear in the
35 ## edit page for subheadings, lists, tables, etc.
36 $GUIButtons['h2'] = array(400, '\\n!! ', '\\n', '$[Heading]',
37 '$GUIButtonDirUrlFmt/h2.gif"$[Heading]"');
38 $GUIButtons['h3'] = array(402, '\\n!!! ', '\\n', '$[Subheading]',
39 '$GUIButtonDirUrlFmt/h3.gif"$[Subheading]"');
40 $GUIButtons['indent'] = array(500, '\\n->', '\\n', '$[Indented text]',
41 '$GUIButtonDirUrlFmt/indent.gif"$[Indented text]"');
42 $GUIButtons['outdent'] = array(510, '\\n-<', '\\n', '$[Hanging indent]',
43 '$GUIButtonDirUrlFmt/outdent.gif"$[Hanging indent]"');
44 $GUIButtons['ol'] = array(520, '\\n# ', '\\n', '$[Ordered list]',
45 '$GUIButtonDirUrlFmt/ol.gif"$[Ordered (numbered) list]"');
46 $GUIButtons['ul'] = array(530, '\\n* ', '\\n', '$[Unordered list]',
47 '$GUIButtonDirUrlFmt/ul.gif"$[Unordered (bullet) list]"');
48 $GUIButtons['hr'] = array(540, '\\n----\\n', '', '',
49 '$GUIButtonDirUrlFmt/hr.gif"$[Horizontal rule]"');
50 $GUIButtons['table'] = array(600,
51 '||border=1 width=80%\\n||!Hdr ||!Hdr ||!Hdr ||\\n|| || || ||\\n|| || || ||\\n', '', '',
52 '$GUIButtonDirUrlFmt/table.gif"$[Table]"');
53
54 // set default author
55 $Author = $_SESSION['forlife'].'|'.$_SESSION['prenom'].' '.$_SESSION['nom'];
56
57 $InputTags['e_form'] = array(
58 ':html' => "<form action='{\$PageUrl}?action=edit' method='post'><div><input
59 type='hidden' name='action' value='edit' /><input
60 type='hidden' name='n' value='{\$FullName}' /><input
61 type='hidden' name='basetime' value='\$EditBaseTime' /></div>");
62
63 // set profiles to point to plat/al fiche
64 Markup('[[~platal', '<[[~', '/\[\[~([^|\]]*)(?:\|([^\]]*))?\]\]/e',
65 'PreserveText("=", doPlatalLink("$1", "$2"), "")');
66
67 // Preserve javascript
68 Markup('[[javascript', '<[[javascript:', '/\[\[javascript:([^\|]*)\|([^\]]*)?\]\]/e',
69 'PreserveText("=", \'<a href="javascript:\' . htmlentities("$1") . \'">\', "") . "$2" . PreserveText("=", "</a>", "")');
70
71 // prevent restorelinks before block apply (otherwise [[Sécurité]] will give
72 // .../S<span class='e9curit'>e9'>Sécurité</a>
73 Markup('restorelinks','<%%',"//", '');
74
75 ## [[#anchor]] in standard XHTML
76 Markup('[[#','<[[','/(?>\\[\\[#([A-Za-z][-.:\\w]*))\\]\\]/e',
77 "Keep(\"<a id='$1'></a>\",'L')");
78
79 Markup('tablebicol', '<block', '/\(:tablebicol ?([a-z_]+)?:\)/e', 'doBicol("$1")');
80 Markup('pairrows', '_end', '/class=\'pair\_pmwiki\_([0-9]+)\'/e',
81 "($1 == 1)?'':('class=\"'.(($1 % 2 == 0)?'impair':'pair').'\"')");
82 Markup('noclassth', '_end', '/<th class=\'[a-z_]+\'/', '<th');
83
84 Markup('div', '<links', '/\(:div([^:]*):([^\)]*):\)/i', '<div$1>$2</div>');
85
86 function doBicol($column=false)
87 {
88 global $TableRowIndexMax, $TableRowAttrFmt, $TableCellAttrFmt;
89 $TableRowAttrFmt = "class='pair_pmwiki_\$TableRowCount'";
90 if ($column) {
91 $TableCellAttrFmt = "class='$column'";
92 }
93 }
94
95 function doPlatalLink($link, $text)
96 {
97 if (strlen(trim($text)) == 0) {
98 $res = XDB::query("SELECT u.nom, u.prenom, u.promo, q.profile_nick AS surnom
99 FROM auth_user_md5 AS u
100 INNER JOIN auth_user_quick AS q USING(user_id)
101 INNER JOIN aliases AS a ON u.user_id = a.id
102 WHERE a.alias = {?}", $link);
103 $row = $res->fetchOneAssoc();
104 $text = $row['prenom'] . ' ' . $row['nom'] . ' X' . $row['promo'];
105 if ($row['surnom']) {
106 $text .= ' (alias ' . $row['surnom'] . ')';
107 }
108 }
109 return '<a href="profile/' . $link . '" class="popup2">' . $text . '</a>';
110 }
111
112 // }}}
113
114 $AuthFunction = 'ReadPage';
115
116 $HandleAuth['diff'] = 'edit';
117 $HandleAuth['source'] = 'edit';
118
119 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
120 ?>