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