1 | <?php
|
---|
2 |
|
---|
3 | /**
|
---|
4 | * Main file of the "monobook" template for DokuWiki
|
---|
5 | *
|
---|
6 | *
|
---|
7 | * LICENSE: This file is open source software (OSS) and may be copied under
|
---|
8 | * certain conditions. See COPYING file for details or try to contact
|
---|
9 | * the author(s) of this file in doubt.
|
---|
10 | *
|
---|
11 | * @license GPLv2 (http://www.gnu.org/licenses/gpl2.html)
|
---|
12 | * @author Andreas Haerter <[email protected]>
|
---|
13 | * @link http://andreas-haerter.com/projects/dokuwiki-template-monobook
|
---|
14 | * @link http://www.dokuwiki.org/template:monobook
|
---|
15 | * @link http://www.dokuwiki.org/devel:templates
|
---|
16 | * @link http://www.dokuwiki.org/devel:coding_style
|
---|
17 | * @link http://www.dokuwiki.org/devel:environment
|
---|
18 | * @link http://www.dokuwiki.org/devel:action_modes
|
---|
19 | */
|
---|
20 |
|
---|
21 | //check if we are running within the DokuWiki environment
|
---|
22 | if (!defined("DOKU_INC")){
|
---|
23 | die();
|
---|
24 | }
|
---|
25 |
|
---|
26 | // Hardcode these paths, as this template will be loaded via SkinLoader
|
---|
27 | if(!defined('GSMONO_TPL'))
|
---|
28 | {
|
---|
29 | define('GSMONO_TPL', DOKU_BASE.'lib/tpl/greenstone-monobook/');
|
---|
30 | }
|
---|
31 | if(!defined('GSMONO_TPLINC'))
|
---|
32 | {
|
---|
33 | define('GSMONO_TPLINC', DOKU_INC.'lib/tpl/greenstone-monobook/');
|
---|
34 | }
|
---|
35 |
|
---|
36 | /** Override some config options - regardless of what is set in dokuwiki */
|
---|
37 | $conf['youarehere'] = true;
|
---|
38 | $conf['breadcrumbs'] = false;
|
---|
39 | $conf['toptoclevel'] = 2;
|
---|
40 |
|
---|
41 | /**
|
---|
42 | * Stores the template wide action
|
---|
43 | *
|
---|
44 | * Different DokuWiki actions requiring some template logic. Therefore the
|
---|
45 | * template has to know, what we are doing right now - and that is what this
|
---|
46 | * var is for.
|
---|
47 | *
|
---|
48 | * Please have a look at the "detail.php" file in the same folder, it is also
|
---|
49 | * influencing the var's value.
|
---|
50 | *
|
---|
51 | * @var string
|
---|
52 | * @author Andreas Haerter <[email protected]>
|
---|
53 | */
|
---|
54 | $monobook_action = "article";
|
---|
55 | //note: I used $_REQUEST before (cause DokuWiki controls and fills it. Normally,
|
---|
56 | // using $_REQUEST is a possible security threat. For details, see
|
---|
57 | // <http://www.suspekt.org/2008/10/01/php-53-and-delayed-cross-site-request-forgerieshijacking/>
|
---|
58 | // and <http://forum.dokuwiki.org/post/16524>), but it did not work as
|
---|
59 | // expected by me (maybe it is a reference and setting $monobook_action
|
---|
60 | // also changed the contents of $_REQUEST?!). That is why I switched back,
|
---|
61 | // checking $_GET and $_POST like I did it before.
|
---|
62 | if (!empty($_GET["mddo"])){
|
---|
63 | $monobook_action = (string)$_GET["mddo"];
|
---|
64 | }elseif (!empty($_POST["mddo"])){
|
---|
65 | $monobook_action = (string)$_POST["mddo"];
|
---|
66 | }
|
---|
67 | if (!empty($monobook_action) &&
|
---|
68 | $monobook_action !== "article" &&
|
---|
69 | $monobook_action !== "print" &&
|
---|
70 | $monobook_action !== "detail" &&
|
---|
71 | $monobook_action !== "cite"){
|
---|
72 | //ignore unknown values
|
---|
73 | $monobook_action = "article";
|
---|
74 | }
|
---|
75 |
|
---|
76 |
|
---|
77 | /**
|
---|
78 | * Stores the template wide context
|
---|
79 | *
|
---|
80 | * This template offers discussion pages via common articles, which should be
|
---|
81 | * marked as "special". DokuWiki does not know any "special" articles, therefore
|
---|
82 | * we have to take care about detecting if the current page is a discussion
|
---|
83 | * page or not.
|
---|
84 | *
|
---|
85 | * @var string
|
---|
86 | * @author Andreas Haerter <[email protected]>
|
---|
87 | */
|
---|
88 | $monobook_context = "article";
|
---|
89 | if (preg_match("/^".tpl_getConf("monobook_discuss_ns")."?$|^".tpl_getConf("monobook_discuss_ns").".*?$/i", ":".getNS(getID()))){
|
---|
90 | $monobook_context = "discuss";
|
---|
91 | }
|
---|
92 |
|
---|
93 |
|
---|
94 | /**
|
---|
95 | * Stores the name the current client used to login
|
---|
96 | *
|
---|
97 | * @var string
|
---|
98 | * @author Andreas Haerter <[email protected]>
|
---|
99 | */
|
---|
100 | $loginname = "";
|
---|
101 | if (!empty($conf["useacl"])){
|
---|
102 | if (isset($_SERVER["REMOTE_USER"]) && //no empty() but isset(): "0" may be a valid username...
|
---|
103 | $_SERVER["REMOTE_USER"] !== ""){
|
---|
104 | $loginname = $_SERVER["REMOTE_USER"]; //$INFO["client"] would not work here (-> e.g. if
|
---|
105 | //current IP differs from the one used to login)
|
---|
106 | }
|
---|
107 | }
|
---|
108 |
|
---|
109 |
|
---|
110 | //get needed language array
|
---|
111 | include GSMONO_TPLINC."lang/en/lang.php";
|
---|
112 | //overwrite English language values with available translations
|
---|
113 | if (!empty($conf["lang"]) &&
|
---|
114 | $conf["lang"] !== "en" &&
|
---|
115 | file_exists(GSMONO_TPLINC."/lang/".$conf["lang"]."/lang.php")){
|
---|
116 | //get language file (partially translated language files are no problem
|
---|
117 | //cause non translated stuff is still existing as English array value)
|
---|
118 | include GSMONO_TPLINC."/lang/".$conf["lang"]."/lang.php";
|
---|
119 | }
|
---|
120 |
|
---|
121 |
|
---|
122 | //detect revision
|
---|
123 | $rev = (int)$INFO["rev"]; //$INFO comes from the DokuWiki core
|
---|
124 | if ($rev < 1){
|
---|
125 | $rev = (int)$INFO["lastmod"];
|
---|
126 | }
|
---|
127 |
|
---|
128 |
|
---|
129 | //get tab config
|
---|
130 | include GSMONO_TPLINC."/conf/tabs.php"; //default
|
---|
131 | if (file_exists(GSMONO_TPLINC."/user/tabs.php")){
|
---|
132 | include GSMONO_TPLINC."/user/tabs.php"; //user defined
|
---|
133 | }
|
---|
134 |
|
---|
135 |
|
---|
136 | //get boxes config
|
---|
137 | include GSMONO_TPLINC."/conf/boxes.php"; //default
|
---|
138 | if (file_exists(GSMONO_TPLINC."/user/boxes.php")){
|
---|
139 | include GSMONO_TPLINC."/user/boxes.php"; //user defined
|
---|
140 | }
|
---|
141 |
|
---|
142 |
|
---|
143 | //get button config
|
---|
144 | include GSMONO_TPLINC."/conf/buttons.php"; //default
|
---|
145 | if (file_exists(GSMONO_TPLINC."/user/buttons.php")){
|
---|
146 | include GSMONO_TPLINC."/user/buttons.php"; //user defined
|
---|
147 | }
|
---|
148 |
|
---|
149 |
|
---|
150 | /**
|
---|
151 | * Helper to render the tabs (like a dynamic XHTML snippet)
|
---|
152 | *
|
---|
153 | *
|
---|
154 | * NOTE: This function is heavily inspired by "writeMBPortlet(), context.php" of
|
---|
155 | * the "Monobook for Dokuwiki" template by Terence J. Grant.
|
---|
156 | *
|
---|
157 | * @param array The tab data to render within the snippet. Each element
|
---|
158 | * is represented through a subarray:
|
---|
159 | * $array = array("tab1" => array("text" => "hello world!",
|
---|
160 | * "href" => "http://www.example.com"
|
---|
161 | * "nofollow" => true),
|
---|
162 | * "tab2" => array("text" => "I did it again",
|
---|
163 | * "href" => DOKU_BASE."doku.php?id=foobar",
|
---|
164 | * "class" => "foobar-css"),
|
---|
165 | * "tab3" => array("text" => "I did it again and again",
|
---|
166 | * "href" => wl("start", false, false, "&"),
|
---|
167 | * "class" => "foobar-css"),
|
---|
168 | * "tab4" => array("text" => "Home",
|
---|
169 | * "wiki" => ":start"
|
---|
170 | * "accesskey" => "H"));
|
---|
171 | * Available keys within the subarrays:
|
---|
172 | * - "text" (mandatory)
|
---|
173 | * The text/label of the element.
|
---|
174 | * - "href" (optional)
|
---|
175 | * URL the element should point to (as link). Please submit raw,
|
---|
176 | * unencoded URLs, the encoding will be done by this function for
|
---|
177 | * security reasons. If the URL is not relative
|
---|
178 | * (= starts with http(s)://), the URL will be treated as external
|
---|
179 | * (=a special style will be used if "class" is not set).
|
---|
180 | * - "wiki" (optional)
|
---|
181 | * ID of a WikiPage to link (like ":start" or ":wiki:foobar").
|
---|
182 | * - "class" (optional)
|
---|
183 | * Name of an additional CSS class to use for the element content.
|
---|
184 | * Works only in combination with "text" or "href", NOT with "wiki"
|
---|
185 | * (will be ignored in this case).
|
---|
186 | * - "nofollow" (optional)
|
---|
187 | * If set to TRUE, rel="nofollow" will be added to the link if "href"
|
---|
188 | * is set (otherwise this flag will do nothing).
|
---|
189 | * - "accesskey" (optional)
|
---|
190 | * accesskey="<value>" will be added to the link if "href" is set
|
---|
191 | * (otherwise this option will do nothing).
|
---|
192 | * @author Andreas Haerter <[email protected]>
|
---|
193 | * @see _monobook_renderButtons()
|
---|
194 | * @see _monobook_renderBoxes()
|
---|
195 | * @link http://www.wikipedia.org/wiki/Nofollow
|
---|
196 | * @link http://de.selfhtml.org/html/verweise/tastatur.htm#kuerzel
|
---|
197 | * @link http://www.dokuwiki.org/devel:environment
|
---|
198 | * @link http://www.dokuwiki.org/devel:coding_style
|
---|
199 | */
|
---|
200 | function _monobook_renderTabs($arr)
|
---|
201 | {
|
---|
202 | //is there something useful?
|
---|
203 | if (empty($arr) ||
|
---|
204 | !is_array($arr)){
|
---|
205 | return false; //nope, break operation
|
---|
206 | }
|
---|
207 |
|
---|
208 | //array to store the created tabs into
|
---|
209 | $elements = array();
|
---|
210 |
|
---|
211 | //handle the tab data
|
---|
212 | foreach($arr as $li_id => $element){
|
---|
213 | //basic check
|
---|
214 | if (empty($element) ||
|
---|
215 | !is_array($element) ||
|
---|
216 | !isset($element["text"])){
|
---|
217 | continue; //ignore invalid stuff and go on
|
---|
218 | }
|
---|
219 | $li_created = true; //flag to control if we created any list element
|
---|
220 | $interim = "";
|
---|
221 | //do we have an external link?
|
---|
222 | if (!empty($element["href"])){
|
---|
223 | //add URL
|
---|
224 | $interim = "<a href=\"".hsc($element["href"])."\""; //@TODO: real URL encoding
|
---|
225 | //add rel="nofollow" attribute to the link?
|
---|
226 | if (!empty($element["nofollow"])){
|
---|
227 | $interim .= " rel=\"nofollow\"";
|
---|
228 | }
|
---|
229 | //add special css class?
|
---|
230 | if (!empty($element["class"])){
|
---|
231 | $interim .= " class=\"".hsc($element["class"])."\"";
|
---|
232 | } elseif (substr($element["href"], 0, 4) === "http" ||
|
---|
233 | substr($element["href"], 0, 3) === "ftp"){
|
---|
234 | $interim .= " class=\"urlextern\"";
|
---|
235 | }
|
---|
236 | //add access key?
|
---|
237 | if (!empty($element["accesskey"])){
|
---|
238 | $interim .= " accesskey=\"".hsc($element["accesskey"])."\" title=\"[ALT+".hsc(strtoupper($element["accesskey"]))."]\"";
|
---|
239 | }
|
---|
240 | $interim .= ">".hsc($element["text"])."</a>";
|
---|
241 | //internal wiki link
|
---|
242 | }else if (!empty($element["wiki"])){
|
---|
243 | //add special css class?
|
---|
244 | if (!empty($element["class"])){
|
---|
245 | $interim = "<span class=\"".hsc($element["class"])."\">".html_wikilink($element["wiki"], hsc($element["text"]))."</span>";
|
---|
246 | }else{
|
---|
247 | $interim = html_wikilink($element["wiki"], hsc($element["text"]));
|
---|
248 | }
|
---|
249 | /* Following works, but I think it is too heavy... //use a wiki page as content
|
---|
250 | } elseif ($element["wiki_include"]){
|
---|
251 |
|
---|
252 | //we have to show a wiki page. get the rendered content of the
|
---|
253 | //defined wiki article to use as content.
|
---|
254 | $interim = tpl_include_page($element["wiki_include"], false);
|
---|
255 | if ($interim === "" ||
|
---|
256 | $interim === false){
|
---|
257 | //show creation/edit link if the defined page got no content
|
---|
258 | $interim = "[ ".html_wikilink($element["wiki_include"], hsc($lang["monobook_fillplaceholder"]." (".hsc($element["wiki_include"]).")"))." ]<br />";
|
---|
259 | }*/
|
---|
260 | //text only
|
---|
261 | }else{
|
---|
262 | $interim = "<span";
|
---|
263 | //add special css class?
|
---|
264 | if (!empty($element["class"])){
|
---|
265 | $interim .= " class=\"".hsc($element["class"])."\"";
|
---|
266 | }else{
|
---|
267 | $interim .= " style=\"color:#ccc;\"";
|
---|
268 | }
|
---|
269 | $interim .= "> ".hsc($element["text"])." </span>";
|
---|
270 | }
|
---|
271 | //store it
|
---|
272 | $elements[] = " <li id=\"".hsc($li_id)."\">".$interim."</li>\n";
|
---|
273 | }
|
---|
274 |
|
---|
275 | //show everything created
|
---|
276 | if (!empty($elements)){
|
---|
277 | echo "\n"
|
---|
278 | ." <div id=\"p-cactions\" class=\"portlet\">\n" //don't touch the id, it is needed as css selector
|
---|
279 | ." <ul>\n";
|
---|
280 | foreach ($elements as $element){
|
---|
281 | echo $element;
|
---|
282 | }
|
---|
283 | echo " </ul>\n"
|
---|
284 | ." </div>\n";
|
---|
285 | }
|
---|
286 | return true;
|
---|
287 | }
|
---|
288 |
|
---|
289 |
|
---|
290 | /**
|
---|
291 | * Helper to render the boxes (like a dynamic XHTML snippet)
|
---|
292 | *
|
---|
293 | *
|
---|
294 | * NOTE: This function is heavily inspired by "writeMBPortlet(), context.php" of
|
---|
295 | * the "Monobook for Dokuwiki" template by Terence J. Grant.
|
---|
296 | *
|
---|
297 | * @param array The box data to render within the snippet. Each box is
|
---|
298 | * represented through a subarray:
|
---|
299 | * $array = array("box-id1" => array("headline" => "hello world!",
|
---|
300 | * "xhtml" => "I am <i>here</i>."));
|
---|
301 | * Available keys within the subarrays:
|
---|
302 | * - "xhtml" (mandatory)
|
---|
303 | * The content of the Box you want to show as XHTML. Attention: YOU
|
---|
304 | * HAVE TO TAKE CARE ABOUT FILTER EVENTUALLY USED INPUT/SECURITY. Be
|
---|
305 | * aware of XSS and stuff.
|
---|
306 | * - "headline" (optional)
|
---|
307 | * Headline to show above the box. Leave empty/do not set for none.
|
---|
308 | * @author Andreas Haerter <[email protected]>
|
---|
309 | * @see _monobook_renderButtons()
|
---|
310 | * @see _monobook_renderTabs()
|
---|
311 | * @link http://www.wikipedia.org/wiki/Nofollow
|
---|
312 | * @link http://www.wikipedia.org/wiki/Cross-site_scripting
|
---|
313 | * @link http://www.dokuwiki.org/devel:coding_style
|
---|
314 | */
|
---|
315 | function _monobook_renderBoxes($arr)
|
---|
316 | {
|
---|
317 | //is there something useful?
|
---|
318 | if (empty($arr) ||
|
---|
319 | !is_array($arr)){
|
---|
320 | return false; //nope, break operation
|
---|
321 | }
|
---|
322 |
|
---|
323 | //array to store the created boxes into
|
---|
324 | $boxes = array();
|
---|
325 | $search_handled = false;
|
---|
326 |
|
---|
327 | //handle the box data
|
---|
328 | foreach($arr as $div_id => $contents){
|
---|
329 | //basic check
|
---|
330 | if (empty($contents) ||
|
---|
331 | !is_array($contents) ||
|
---|
332 | !isset($contents["xhtml"])){
|
---|
333 | continue; //ignore invalid stuff and go on
|
---|
334 | }
|
---|
335 | $interim = " <div class=\"portlet\" id=\"".hsc($div_id)."\">\n";
|
---|
336 | if (isset($contents["headline"])
|
---|
337 | && $contents["headline"] !== ""){
|
---|
338 | //hack for search box
|
---|
339 | if ($search_handled === true ||
|
---|
340 | $div_id !== "p-search") {
|
---|
341 | $interim .= " <h5>".hsc($contents["headline"])."</h5>\n";
|
---|
342 | } else {
|
---|
343 | $interim .= " <h5><label for=\"qsearch__in\">".hsc($contents["headline"])."</label></h5>\n";
|
---|
344 | }
|
---|
345 | }
|
---|
346 | $interim .= " <div class=\"pBody\">\n"
|
---|
347 | ." <div class=\"dokuwiki\">\n" //dokuwiki CSS class needed cause we might have to show rendered page content
|
---|
348 | .$contents["xhtml"]."\n"
|
---|
349 | ." </div>\n"
|
---|
350 | ." </div>\n"
|
---|
351 | ." </div>\n";
|
---|
352 | //hack for search box
|
---|
353 | if ($search_handled === false &&
|
---|
354 | $div_id === "p-search") {
|
---|
355 | $interim .= " <div id=\"qsearch__out\" class=\"ajax_qsearch JSpopup\"></div>\n";
|
---|
356 | //set flag
|
---|
357 | $search_handled = true;
|
---|
358 | }
|
---|
359 | //store it
|
---|
360 | $boxes[] = $interim;
|
---|
361 | }
|
---|
362 | //show everything created
|
---|
363 | if (!empty($boxes)){
|
---|
364 | echo "\n";
|
---|
365 | foreach ($boxes as $box){
|
---|
366 | echo $box;
|
---|
367 | }
|
---|
368 | echo "\n";
|
---|
369 | }
|
---|
370 |
|
---|
371 | return true;
|
---|
372 | }
|
---|
373 |
|
---|
374 |
|
---|
375 | /**
|
---|
376 | * Helper to render the footer buttons (like a dynamic XHTML snippet)
|
---|
377 | *
|
---|
378 | * @param array The button data to render within the snippet. Each element
|
---|
379 | * is represented through a subarray:
|
---|
380 | * $array = array("btn1" => array("img" => GSMONO_TPL."static/img/button-monobook.png",
|
---|
381 | * "href" => "http://andreas-haerter.com/projects/dokuwiki-template-monobook",
|
---|
382 | * "width" => 80,
|
---|
383 | * "height" => 15,
|
---|
384 | * "title" => "monobook for DokuWiki",
|
---|
385 | * "nofollow" => false),
|
---|
386 | * "btn2" => array("img" => GSMONO_TPL."user/mybutton1.png",
|
---|
387 | * "href" => wl("start", false, false, "&")),
|
---|
388 | * "btn3" => array("img" => GSMONO_TPL."user/mybutton2.png",
|
---|
389 | * "href" => "http://www.example.com");
|
---|
390 | * Available keys within the subarrays:
|
---|
391 | * - "img" (mandatory)
|
---|
392 | * The relative or full path of an image/button to show. Users may
|
---|
393 | * place own images within the /user/ dir of this template.
|
---|
394 | * - "href" (mandatory)
|
---|
395 | * URL the element should point to (as link). Please submit raw,
|
---|
396 | * unencoded URLs, the encoding will be done by this function for
|
---|
397 | * security reasons.
|
---|
398 | * - "width" (optional)
|
---|
399 | * width="<value>" will be added to the image tag if both "width" and
|
---|
400 | * "height" are set (otherwise, this will be ignored).
|
---|
401 | * - "height" (optional)
|
---|
402 | * height="<value>" will be added to the image tag if both "height" and
|
---|
403 | * "width" are set (otherwise, this will be ignored).
|
---|
404 | * - "nofollow" (optional)
|
---|
405 | * If set to TRUE, rel="nofollow" will be added to the link.
|
---|
406 | * - "title" (optional)
|
---|
407 | * title="<value>" will be added to the link and image if "title"
|
---|
408 | * is set + alt="<value>".
|
---|
409 | * @author Andreas Haerter <[email protected]>
|
---|
410 | * @see _monobook_renderButtons()
|
---|
411 | * @see _monobook_renderBoxes()
|
---|
412 | * @link http://www.wikipedia.org/wiki/Nofollow
|
---|
413 | * @link http://www.dokuwiki.org/devel:coding_style
|
---|
414 | */
|
---|
415 | function _monobook_renderButtons($arr)
|
---|
416 | {
|
---|
417 | //array to store the created buttons into
|
---|
418 | $elements = array();
|
---|
419 |
|
---|
420 | //handle the button data
|
---|
421 | foreach($arr as $li_id => $element){
|
---|
422 | //basic check
|
---|
423 | if (empty($element) ||
|
---|
424 | !is_array($element) ||
|
---|
425 | !isset($element["img"]) ||
|
---|
426 | !isset($element["href"])){
|
---|
427 | continue; //ignore invalid stuff and go on
|
---|
428 | }
|
---|
429 | $interim = "";
|
---|
430 |
|
---|
431 | //add URL
|
---|
432 | $interim = "<a href=\"".hsc($element["href"])."\""; //@TODO: real URL encoding
|
---|
433 | //add rel="nofollow" attribute to the link?
|
---|
434 | if (!empty($element["nofollow"])){
|
---|
435 | $interim .= " rel=\"nofollow\"";
|
---|
436 | }
|
---|
437 | //add title attribute to the link?
|
---|
438 | if (!empty($element["title"])){
|
---|
439 | $interim .= " title=\"".hsc($element["title"])."\"";
|
---|
440 | }
|
---|
441 | $interim .= " target=\"_blank\"><img src=\"".hsc($element["img"])."\"";
|
---|
442 | //add width and height attribute to the image?
|
---|
443 | if (!empty($element["width"]) &&
|
---|
444 | !empty($element["height"])){
|
---|
445 | $interim .= " width=\"".(int)$element["width"]."\" height=\"".(int)$element["height"]."\"";
|
---|
446 | }
|
---|
447 | //add title and alt attribute to the image?
|
---|
448 | if (!empty($element["title"])){
|
---|
449 | $interim .= " title=\"".hsc($element["title"])."\" alt=\"".hsc($element["title"])."\"";
|
---|
450 | } else {
|
---|
451 | $interim .= " alt=\"\""; //alt is a mandatory attribute for images
|
---|
452 | }
|
---|
453 | $interim .= " border=\"0\" /></a>";
|
---|
454 |
|
---|
455 | //store it
|
---|
456 | $elements[] = " ".$interim."\n";
|
---|
457 | }
|
---|
458 |
|
---|
459 | //show everything created
|
---|
460 | if (!empty($elements)){
|
---|
461 | echo "\n";
|
---|
462 | foreach ($elements as $element){
|
---|
463 | echo $element;
|
---|
464 | }
|
---|
465 | }
|
---|
466 | return true;
|
---|
467 | }
|
---|
468 |
|
---|
469 | //workaround for the "jumping textarea" IE bug. CSS only fix not possible cause
|
---|
470 | //some DokuWiki JavaScript is triggering this bug, too. See the following for
|
---|
471 | //info:
|
---|
472 | //- <http://blog.andreas-haerter.com/2010/05/28/fix-msie-8-auto-scroll-textarea-css-width-percentage-bug>
|
---|
473 | //- <http://msdn.microsoft.com/library/cc817574.aspx>
|
---|
474 | if ($ACT === "edit" &&
|
---|
475 | !headers_sent()){
|
---|
476 | header("X-UA-Compatible: IE=EmulateIE7");
|
---|
477 | }
|
---|
478 |
|
---|
479 | ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
---|
480 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
---|
481 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo hsc($conf["lang"]); ?>" lang="<?php echo hsc($conf["lang"]); ?>" dir="<?php echo hsc($lang["direction"]); ?>">
|
---|
482 | <head>
|
---|
483 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
---|
484 | <title><?php tpl_pagetitle(); echo " - ".hsc($conf["title"]); ?></title>
|
---|
485 | <?php
|
---|
486 | //show meta-tags
|
---|
487 | tpl_metaheaders();
|
---|
488 | echo "<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\" />";
|
---|
489 |
|
---|
490 | //manually load needed CSS? this is a workaround for PHP Bug #49642. In some
|
---|
491 | //version/os combinations PHP is not able to parse INI-file entries if there
|
---|
492 | //are slashes "/" used for the keynames (see bugreport for more information:
|
---|
493 | //<http://bugs.php.net/bug.php?id=49692>). to trigger this workaround, simply
|
---|
494 | //delete/rename monobook's style.ini.
|
---|
495 | if (!file_exists(GSMONO_TPLINC."style.ini")){
|
---|
496 | echo "<link rel=\"stylesheet\" media=\"all\" type=\"text/css\" href=\"".GSMONO_TPL."bug49642.php".((!empty($lang["direction"]) && $lang["direction"] === "rtl") ? "?langdir=rtl" : "")."\" />\n"; //var comes from DokuWiki core
|
---|
497 | }
|
---|
498 |
|
---|
499 | //include default or userdefined favicon
|
---|
500 | //
|
---|
501 | //note: since 2011-04-22 "Rincewind RC1", there is a core function named
|
---|
502 | // "tpl_getFavicon()". But its functionality is not really fitting the
|
---|
503 | // behaviour of this template, therefore I don't use it here.
|
---|
504 | if (file_exists(GSMONO_TPLINC."user/favicon.ico")){
|
---|
505 | //user defined - you might find http://tools.dynamicdrive.com/favicon/
|
---|
506 | //useful to generate one
|
---|
507 | echo "\n<link rel=\"shortcut icon\" href=\"".GSMONO_TPL."user/favicon.ico\" />\n";
|
---|
508 | }elseif (file_exists(GSMONO_TPLINC."user/favicon.png")){
|
---|
509 | //note: I do NOT recommend PNG for favicons (cause it is not supported by
|
---|
510 | //all browsers), but some users requested this feature.
|
---|
511 | echo "\n<link rel=\"shortcut icon\" href=\"".GSMONO_TPL."user/favicon.png\" />\n";
|
---|
512 | }else{
|
---|
513 | //default
|
---|
514 | echo "\n<link rel=\"shortcut icon\" href=\"".GSMONO_TPL."static/3rd/dokuwiki/favicon.ico\" />\n";
|
---|
515 | }
|
---|
516 |
|
---|
517 | //include default or userdefined Apple Touch Icon (see <http://j.mp/sx3NMT> for
|
---|
518 | //details)
|
---|
519 | if (file_exists(GSMONO_TPLINC."user/apple-touch-icon.png")){
|
---|
520 | echo "<link rel=\"apple-touch-icon\" href=\"".GSMONO_TPL."user/apple-touch-icon.png\" />\n";
|
---|
521 | }else{
|
---|
522 | //default
|
---|
523 | echo "<link rel=\"apple-touch-icon\" href=\"".GSMONO_TPL."static/3rd/dokuwiki/apple-touch-icon.png\" />\n";
|
---|
524 | }
|
---|
525 |
|
---|
526 | //load userdefined js?
|
---|
527 | if (tpl_getConf("monobook_loaduserjs")){
|
---|
528 | echo "<script type=\"text/javascript\" charset=\"utf-8\" src=\"".GSMONO_TPL."user/user.js\"></script>\n";
|
---|
529 | }
|
---|
530 |
|
---|
531 | //show printable version?
|
---|
532 | if ($monobook_action === "print"){
|
---|
533 | //note: this is just a workaround for people searching for a print version.
|
---|
534 | // don't forget to update the styles.ini, this is the really important
|
---|
535 | // thing! BTW: good text about this: http://is.gd/5MyG5
|
---|
536 | echo "<link rel=\"stylesheet\" media=\"all\" type=\"text/css\" href=\"".GSMONO_TPL."static/css/print.css\" />\n"
|
---|
537 | ."<link rel=\"stylesheet\" media=\"all\" type=\"text/css\" href=\"".GSMONO_TPL."static/3rd/wikipedia/commonPrint.css\" />\n"
|
---|
538 | ."<link rel=\"stylesheet\" media=\"all\" type=\"text/css\" href=\"".GSMONO_TPL."user/print.css\" />\n";
|
---|
539 | }
|
---|
540 |
|
---|
541 | //load language specific css hacks?
|
---|
542 | if (file_exists(GSMONO_TPLINC."lang/".$conf["lang"]."/style.css")){
|
---|
543 | $interim = trim(file_get_contents(GSMONO_TPLINC."lang/".$conf["lang"]."/style.css"));
|
---|
544 | if (!empty($interim)){
|
---|
545 | echo "<style type=\"text/css\" media=\"all\">\n".hsc($interim)."\n</style>\n";
|
---|
546 | }
|
---|
547 | }
|
---|
548 | ?>
|
---|
549 | <!--[if lt IE 5.5000]><link rel="stylesheet" media="all" type="text/css" href="<?php echo GSMONO_TPL; ?>static/3rd/monobook/IE50Fixes.css" /><![endif]-->
|
---|
550 | <!--[if IE 5.5000]><link rel="stylesheet" media="all" type="text/css" href="<?php echo GSMONO_TPL; ?>static/3rd/monobook/IE55Fixes.css" /><![endif]-->
|
---|
551 | <!--[if IE 6]><link rel="stylesheet" media="all" type="text/css" href="<?php echo GSMONO_TPL; ?>static/3rd/monobook/IE60Fixes.css" /><![endif]-->
|
---|
552 | <!--[if IE 7]><link rel="stylesheet" media="all" type="text/css" href="<?php echo GSMONO_TPL; ?>static/3rd/monobook/IE70Fixes.css" /><![endif]-->
|
---|
553 | <!--[if lt IE 7]><script type="text/javascript" charset="utf-8" src="<?php echo GSMONO_TPL; ?>static/3rd/wikipedia/IEFixes.js"></script><meta http-equiv="imagetoolbar" content="no" /><![endif]-->
|
---|
554 | </head>
|
---|
555 | <body class="<?php //different styles/backgrounds for different page types
|
---|
556 | switch (true){
|
---|
557 | //special: tech
|
---|
558 | case ($monobook_action === "detail"):
|
---|
559 | case ($monobook_action === "cite"):
|
---|
560 | case ($ACT === "media"): //var comes from DokuWiki
|
---|
561 | case ($ACT === "search"): //var comes from DokuWiki
|
---|
562 | echo "mediawiki ns-2 ltr";
|
---|
563 | break;
|
---|
564 | //special: other
|
---|
565 | case ($ACT === "edit"): //var comes from DokuWiki
|
---|
566 | case ($ACT === "draft"): //var comes from DokuWiki
|
---|
567 | case ($ACT === "revisions"): //var comes from DokuWiki
|
---|
568 | case ($monobook_context === "discuss"):
|
---|
569 | case (preg_match("/^wiki$|^wiki:.*?$/i", getNS(getID()))):
|
---|
570 | echo "mediawiki ns-1 ltr";
|
---|
571 | break;
|
---|
572 | //"normal" content
|
---|
573 | case ($monobook_action === "print"):
|
---|
574 | default:
|
---|
575 | echo "mediawiki ns-0 ltr";
|
---|
576 | break;
|
---|
577 | }
|
---|
578 | ?>">
|
---|
579 | <div id="globalWrapper">
|
---|
580 |
|
---|
581 | <div id="column-content">
|
---|
582 | <div id="content">
|
---|
583 | <a name="top" id="top"></a>
|
---|
584 | <a name="dokuwiki__top" id="dokuwiki__top"></a>
|
---|
585 | <div id="bodyContent">
|
---|
586 | <div class="dokuwiki">
|
---|
587 | <!-- start main content area -->
|
---|
588 | <?php
|
---|
589 | //show messages (if there are any)
|
---|
590 | html_msgarea();
|
---|
591 | //show site notice
|
---|
592 | if (tpl_getConf("monobook_sitenotice")){
|
---|
593 | //we have to show a custom sitenotice
|
---|
594 | if (empty($conf["useacl"]) ||
|
---|
595 | auth_quickaclcheck(cleanID(tpl_getConf("monobook_sitenotice_location"))) >= AUTH_READ){ //current user got access?
|
---|
596 | echo "\n <div id=\"siteNotice\" class=\"noprint\">\n";
|
---|
597 | //get the rendered content of the defined wiki article to use as
|
---|
598 | //custom sitenotice.
|
---|
599 | $interim = tpl_include_page(tpl_getConf("monobook_sitenotice_location"), false);
|
---|
600 | if ($interim === "" ||
|
---|
601 | $interim === false){
|
---|
602 | //show creation/edit link if the defined page got no content
|
---|
603 | echo "[ ";
|
---|
604 | tpl_pagelink(tpl_getConf("monobook_sitenotice_location"), hsc($lang["monobook_fillplaceholder"]." (".tpl_getConf("monobook_sitenotice_location").")"));
|
---|
605 | echo " ]<br />";
|
---|
606 | }else{
|
---|
607 | //show the rendered page content
|
---|
608 | echo $interim;
|
---|
609 | }
|
---|
610 | echo "\n </div>\n";
|
---|
611 | }
|
---|
612 | }
|
---|
613 | //show breadcrumps if enabled and positioned on top
|
---|
614 | if ($conf["breadcrumbs"] == true &&
|
---|
615 | $ACT !== "media" && //var comes from DokuWiki
|
---|
616 | (empty($conf["useacl"]) || //are there any users?
|
---|
617 | $loginname !== "" || //user is logged in?
|
---|
618 | !tpl_getConf("monobook_closedwiki")) &&
|
---|
619 | tpl_getConf("monobook_breadcrumbs_position") === "top"){
|
---|
620 | echo "\n <div class=\"catlinks noprint\"><p>\n ";
|
---|
621 | tpl_breadcrumbs();
|
---|
622 | echo "\n </p></div>\n";
|
---|
623 | }
|
---|
624 | //show hierarchical breadcrumps if enabled and positioned on top
|
---|
625 | if ($conf["youarehere"] == true &&
|
---|
626 | $ACT !== "media" && //var comes from DokuWiki
|
---|
627 | (empty($conf["useacl"]) || //are there any users?
|
---|
628 | $loginname !== "" || //user is logged in?
|
---|
629 | !tpl_getConf("monobook_closedwiki"))){// &&
|
---|
630 | // tpl_getConf("monobook_youarehere_position") === "top"){
|
---|
631 | echo "\n <div class=\"catlinks noprint\"><p>\n ";
|
---|
632 | tpl_youarehere();
|
---|
633 | echo "\n </p></div>\n";
|
---|
634 | }
|
---|
635 | ?>
|
---|
636 |
|
---|
637 | <!-- start rendered wiki content -->
|
---|
638 | <?php
|
---|
639 | //flush the buffer for faster page rendering, heaviest content follows
|
---|
640 | if (function_exists("tpl_flush")) {
|
---|
641 | tpl_flush(); //exists since 2010-11-07 "Anteater"...
|
---|
642 | } else {
|
---|
643 | flush(); //...but I won't loose compatibility to 2009-12-25 "Lemming" right now.
|
---|
644 | }
|
---|
645 | //decide which type of pagecontent we have to show
|
---|
646 | switch ($monobook_action){
|
---|
647 | //"image details"
|
---|
648 | case "detail":
|
---|
649 | include GSMONO_TPLINC."inc_detail.php";
|
---|
650 | break;
|
---|
651 | //"cite this article"
|
---|
652 | case "cite":
|
---|
653 | include GSMONO_TPLINC."inc_cite.php";
|
---|
654 | break;
|
---|
655 | //show "normal" content
|
---|
656 | default:
|
---|
657 | tpl_content(((tpl_getConf("monobook_toc_position") === "article") ? true : false));
|
---|
658 | break;
|
---|
659 | }
|
---|
660 | ?>
|
---|
661 | <!-- end rendered wiki content -->
|
---|
662 |
|
---|
663 | <br />
|
---|
664 | <?php
|
---|
665 | //show breadcrumps if enabled and positioned on bottom
|
---|
666 | if ($conf["breadcrumbs"] == true &&
|
---|
667 | $ACT !== "media" && //var comes from DokuWiki
|
---|
668 | (empty($conf["useacl"]) || //are there any users?
|
---|
669 | $loginname !== "" || //user is logged in?
|
---|
670 | !tpl_getConf("monobook_closedwiki")) &&
|
---|
671 | tpl_getConf("monobook_breadcrumbs_position") === "bottom"){
|
---|
672 | echo "\n <div class=\"catlinks noprint\"><p>\n ";
|
---|
673 | tpl_breadcrumbs();
|
---|
674 | echo "\n </p></div>\n";
|
---|
675 | }
|
---|
676 | //show hierarchical breadcrumps if enabled and positioned on bottom
|
---|
677 | if ($conf["youarehere"] == true &&
|
---|
678 | $ACT !== "media" && //var comes from DokuWiki
|
---|
679 | (empty($conf["useacl"]) || //are there any users?
|
---|
680 | $loginname !== "" || //user is logged in?
|
---|
681 | !tpl_getConf("monobook_closedwiki"))){ // &&
|
---|
682 | // tpl_getConf("monobook_youarehere_position") === "bottom"){
|
---|
683 | echo "\n <div class=\"catlinks noprint\"><p>\n ";
|
---|
684 | tpl_youarehere();
|
---|
685 | echo "\n </p></div>\n";
|
---|
686 | }
|
---|
687 | ?>
|
---|
688 |
|
---|
689 | <!-- end main content area -->
|
---|
690 | <div class="visualClear"></div>
|
---|
691 | </div>
|
---|
692 | </div>
|
---|
693 | </div>
|
---|
694 | </div>
|
---|
695 |
|
---|
696 | <div id="column-one" class="noprint">
|
---|
697 | <div class="portlet" id="p-logo">
|
---|
698 | <?php
|
---|
699 | //include default or userdefined logo
|
---|
700 | echo "<a href=\"".wl()."\" ";
|
---|
701 | if (file_exists(GSMONO_TPLINC."user/logo.png")){
|
---|
702 | //user defined PNG
|
---|
703 | echo "style=\"background-image:url(".GSMONO_TPL."user/logo.png);\"";
|
---|
704 | }elseif (file_exists(GSMONO_TPLINC."user/logo.gif")){
|
---|
705 | //user defined GIF
|
---|
706 | echo "style=\"background-image:url(".GSMONO_TPL."user/logo.gif);\"";
|
---|
707 | }elseif (file_exists(GSMONO_TPLINC."user/logo.jpg")){
|
---|
708 | //user defined JPG
|
---|
709 | echo "style=\"background-image:url(".GSMONO_TPL."user/logo.jpg);\"";
|
---|
710 | }else{
|
---|
711 | //default
|
---|
712 | echo "style=\"background-image:url(".GSMONO_TPL."static/3rd/dokuwiki/logo.png);\"";
|
---|
713 | }
|
---|
714 | echo " accesskey=\"h\" title=\"Back to start [ALT+H]\"></a>\n";
|
---|
715 | ?>
|
---|
716 | </div>
|
---|
717 | <?php
|
---|
718 | //show tabs, see monobook/user/tabs.php to configure them
|
---|
719 | if (!empty($_monobook_tabs) &&
|
---|
720 | is_array($_monobook_tabs)){
|
---|
721 | _monobook_renderTabs($_monobook_tabs);
|
---|
722 | }
|
---|
723 |
|
---|
724 | //show personal tools
|
---|
725 | if (!empty($conf["useacl"])){ //...makes only sense if there are users
|
---|
726 | echo "\n"
|
---|
727 | ." <div id=\"p-personal\" class=\"portlet\">\n"
|
---|
728 | ." <div class=\"pBody\">\n"
|
---|
729 | ." <ul>\n";
|
---|
730 | //login?
|
---|
731 | if ($loginname === ""){
|
---|
732 | echo " <li id=\"pt-login\"><a href=\"".wl(cleanID(getId()), array("do" => "login"))."\" rel=\"nofollow\">".hsc($lang["btn_login"])."</a></li>\n"; //language comes from DokuWiki core
|
---|
733 | }else{
|
---|
734 | //username and userpage
|
---|
735 | echo " <li id=\"pt-userpage\">".(tpl_getConf("monobook_userpage")
|
---|
736 | ? html_wikilink(tpl_getConf("monobook_userpage_ns").$loginname, hsc($loginname))
|
---|
737 | : hsc($loginname))."</li>";
|
---|
738 | //admin
|
---|
739 | if (!empty($INFO["isadmin"]) ||
|
---|
740 | !empty($INFO["ismanager"])){
|
---|
741 | echo " <li id=\"pt-admin\"><a href=\"".wl(cleanID(getId()), array("do" => "admin"))."\" rel=\"nofollow\">".hsc($lang["btn_admin"])."</a></li>\n"; //language comes from DokuWiki core
|
---|
742 | }
|
---|
743 | //personal discussion
|
---|
744 | if (tpl_getConf("monobook_discuss") &&
|
---|
745 | tpl_getConf("monobook_userpage")){
|
---|
746 | echo " <li id=\"pt-mytalk\">".html_wikilink(tpl_getConf("monobook_discuss_ns").ltrim(tpl_getConf("monobook_userpage_ns"), ":").$loginname, hsc($lang["monobook_tab_mytalk"]))."</li>";
|
---|
747 | }
|
---|
748 | //profile
|
---|
749 | echo " <li id=\"pt-preferences\"><a href=\"http://www.greenstone.org/users/change.php\" rel=\"nofollow\">".hsc($lang["btn_profile"])."</a></li>\n"; //language comes from DokuWiki core
|
---|
750 | //logout
|
---|
751 | echo " <li id=\"pt-logout\"><a href=\"".wl(cleanID(getId()), array("do" => "logout"))."\" rel=\"nofollow\">".hsc($lang["btn_logout"])."</a></li>\n"; //language comes from DokuWiki core
|
---|
752 | }
|
---|
753 | echo " </ul>\n"
|
---|
754 | ." </div>\n"
|
---|
755 | ." </div>\n";
|
---|
756 | }
|
---|
757 |
|
---|
758 | //show boxes, see monobook/user/boxes.php to configure them
|
---|
759 | if (!empty($_monobook_boxes) &&
|
---|
760 | is_array($_monobook_boxes)){
|
---|
761 | _monobook_renderBoxes($_monobook_boxes);
|
---|
762 | }
|
---|
763 | ?>
|
---|
764 | </div> <!-- end of the left (by default at least) column -->
|
---|
765 |
|
---|
766 | <div class="visualClear"></div>
|
---|
767 |
|
---|
768 | <div id="footer">
|
---|
769 | <div id="footer-buttons" class="noprint">
|
---|
770 | <?php
|
---|
771 | //show buttons, see monobook/user/buttons.php to configure them
|
---|
772 | if (!empty($_monobook_btns) &&
|
---|
773 | is_array($_monobook_btns)){
|
---|
774 | _monobook_renderButtons($_monobook_btns);
|
---|
775 | }
|
---|
776 | ?>
|
---|
777 | </div>
|
---|
778 | <ul id="f-list">
|
---|
779 | <li id="lastmod">
|
---|
780 | <?php tpl_pageinfo()?><br />
|
---|
781 | </li>
|
---|
782 | <?php
|
---|
783 | //copyright notice
|
---|
784 | if (tpl_getConf("monobook_copyright")){
|
---|
785 | //show dokuwiki's default notice?
|
---|
786 | if (tpl_getConf("monobook_copyright_default")){
|
---|
787 | echo "<li id=\"copyright\">\n <div class=\"dokuwiki\">";
|
---|
788 | tpl_license(false);
|
---|
789 | echo "</div>\n </li>\n";
|
---|
790 | //show custom notice.
|
---|
791 | }else{
|
---|
792 | if (empty($conf["useacl"]) ||
|
---|
793 | auth_quickaclcheck(cleanID(tpl_getConf("monobook_copyright_location"))) >= AUTH_READ){ //current user got access?
|
---|
794 | echo "<li id=\"copyright\">\n ";
|
---|
795 | //get the rendered content of the defined wiki article to use as custom notice
|
---|
796 | $interim = tpl_include_page(tpl_getConf("monobook_copyright_location"), false);
|
---|
797 | if ($interim === "" ||
|
---|
798 | $interim === false){
|
---|
799 | //show creation/edit link if the defined page got no content
|
---|
800 | echo "[ ";
|
---|
801 | tpl_pagelink(tpl_getConf("monobook_copyright_location"), hsc($lang["monobook_fillplaceholder"]." (".tpl_getConf("monobook_copyright_location").")"));
|
---|
802 | echo " ]<br />";
|
---|
803 | }else{
|
---|
804 | //show the rendered page content
|
---|
805 | echo "<div class=\"dokuwiki\">\n" //dokuwiki CSS class needed cause we are showing rendered page content
|
---|
806 | .$interim."\n "
|
---|
807 | ."</div>";
|
---|
808 | }
|
---|
809 | echo "\n </li>\n";
|
---|
810 | }
|
---|
811 | }
|
---|
812 | }
|
---|
813 | ?>
|
---|
814 | <li id="usermod" class="noprint">
|
---|
815 | <?php tpl_userinfo(); ?><br />
|
---|
816 | </li>
|
---|
817 | </ul>
|
---|
818 | </div>
|
---|
819 |
|
---|
820 | </div> <!-- end of global wrap -->
|
---|
821 | <a href="<?php echo wl("", array("do" => "recent"));?>" accesskey="r" style="visibility:hidden;" rel="nofollow"> </a>
|
---|
822 | <?php
|
---|
823 | //provide DokuWiki housekeeping, required in all templates
|
---|
824 | tpl_indexerWebBug();
|
---|
825 |
|
---|
826 | //include web analytics software
|
---|
827 | if (file_exists(GSMONO_TPLINC."/user/tracker.php")){
|
---|
828 | include GSMONO_TPLINC."/user/tracker.php";
|
---|
829 | }
|
---|
830 | ?>
|
---|
831 | </body>
|
---|
832 | </html>
|
---|