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