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 ARSAVA <dokuwiki@dev.arsava.com>
13 * @link https://www.dokuwiki.org/template:vector
14 * @link https://www.dokuwiki.org/devel:templates
15 * @link https://www.dokuwiki.org/devel:coding_style
16 * @link https://www.dokuwiki.org/devel:environment
17 * @link https://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 ARSAVA <dokuwiki@dev.arsava.com>
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 <https://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 ARSAVA <dokuwiki@dev.arsava.com>
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 ARSAVA <dokuwiki@dev.arsava.com>
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 is
140 *        represented by 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 ARSAVA <dokuwiki@dev.arsava.com>
175 * @return bool
176 * @see _vector_renderButtons()
177 * @see _vector_renderBoxes()
178 * @link http://www.wikipedia.org/wiki/Nofollow
179 * @link http://de.selfhtml.org/html/verweise/tastatur.htm#kuerzel
180 * @link https://www.dokuwiki.org/devel:environment
181 * @link https://www.dokuwiki.org/devel:coding_style
182 */
183function _vector_renderTabs($arr)
184{
185    //is there something useful?
186    if (empty($arr) ||
187        !is_array($arr)){
188        return false; //nope, break operation
189    }
190
191    //array to store the created tabs into
192    $elements = array();
193
194    //handle the tab data
195    foreach($arr as $li_id => $element){
196        //basic check
197        if (empty($element) ||
198            !is_array($element) ||
199            !isset($element["text"]) ||
200            (empty($element["href"]) &&
201             empty($element["wiki"]))){
202            continue; //ignore invalid stuff and go on
203        }
204        $li_created = true; //flag to control if we created any list element
205        $interim = "";
206        //do we have an external link?
207        if (!empty($element["href"])){
208            //add URL
209            $interim = "<a href=\"".hsc($element["href"])."\""; //@TODO: real URL encoding
210            //add rel="nofollow" attribute to the link?
211            if (!empty($element["nofollow"])){
212                $interim .= " rel=\"nofollow\"";
213            }
214            //mark external link?
215            if (substr($element["href"], 0, 4) === "http" ||
216                substr($element["href"], 0, 3) === "ftp"){
217                $interim .= " class=\"urlextern\"";
218            }
219            //add access key?
220            if (!empty($element["accesskey"])){
221                $interim .= " accesskey=\"".hsc($element["accesskey"])."\" title=\"[ALT+".hsc(strtoupper($element["accesskey"]))."]\"";
222            }
223            $interim .= "><span>".hsc($element["text"])."</span></a>";
224        //internal wiki link
225        }else if (!empty($element["wiki"])){
226            $interim = "<a href=\"".hsc(wl(cleanID($element["wiki"])))."\"><span>".hsc($element["text"])."</span></a>";
227        }
228        //store it
229        $elements[] = "\n        <li id=\"".hsc($li_id)."\"".(!empty($element["class"])
230                                                             ? " class=\"".hsc($element["class"])."\""
231                                                             : "").">".$interim."</li>";
232    }
233
234    //show everything created
235    if (!empty($elements)){
236        foreach ($elements as $element){
237            echo $element;
238        }
239    }
240    return true;
241}
242
243
244/**
245 * Helper to render the boxes (like a dynamic XHTML snippet)
246 *
247 * @param array The box data to render within the snippet. Each box is
248 *        represented by a subarray:
249 *        $array = array("box-id1" => array("headline" => "hello world!",
250 *                                          "xhtml"    => "I am <i>here</i>."));
251 *        Available keys within the subarrays:
252 *        - "xhtml" (mandatory)
253 *          The content of the Box you want to show as XHTML. Attention: YOU
254 *          HAVE TO TAKE CARE ABOUT FILTER EVENTUALLY USED INPUT/SECURITY. Be
255 *          aware of XSS and stuff.
256 *        - "headline" (optional)
257 *          Headline to show above the box. Leave empty/do not set for none.
258 * @author ARSAVA <dokuwiki@dev.arsava.com>
259 * @return bool
260 * @see _vector_renderButtons()
261 * @see _vector_renderTabs()
262 * @link http://www.wikipedia.org/wiki/Nofollow
263 * @link http://www.wikipedia.org/wiki/Cross-site_scripting
264 * @link https://www.dokuwiki.org/devel:coding_style
265 */
266function _vector_renderBoxes($arr)
267{
268    //is there something useful?
269    if (empty($arr) ||
270        !is_array($arr)){
271        return false; //nope, break operation
272    }
273
274    //array to store the created boxes into
275    $boxes = array();
276
277    //handle the box data
278    foreach($arr as $div_id => $contents){
279        //basic check
280        if (empty($contents) ||
281            !is_array($contents) ||
282            !isset($contents["xhtml"])){
283            continue; //ignore invalid stuff and go on
284        }
285        $interim  = "  <div id=\"".hsc($div_id)."\" class=\"portal\">\n";
286        if (isset($contents["headline"])
287            && $contents["headline"] !== ""){
288            $interim .= "    <h5>".hsc($contents["headline"])."</h5>\n";
289        }
290        $interim .= "    <div class=\"body\">\n"
291                   ."      <div class=\"dokuwiki\">\n" //dokuwiki CSS class needed cause we might have to show rendered page content
292                   .$contents["xhtml"]."\n"
293                   ."      </div>\n"
294                   ."    </div>\n"
295                   ."  </div>\n";
296        //store it
297        $boxes[] = $interim;
298    }
299    //show everything created
300    if (!empty($boxes)){
301        echo  "\n";
302        foreach ($boxes as $box){
303            echo $box;
304        }
305        echo  "\n";
306    }
307
308    return true;
309}
310
311
312/**
313 * Helper to render the footer buttons (like a dynamic XHTML snippet)
314 *
315 * @param array The button data to render within the snippet. Each element is
316 *        represented by a subarray:
317 *        $array = array("btn1" => array("img"      => DOKU_TPL."static/img/button-vector.png",
318 *                                       "href"     => "https://andreashaerter.com/",
319 *                                       "width"    => 80,
320 *                                       "height"   => 15,
321 *                                       "title"    => "Andreas Haerter's website",
322 *                                       "nofollow" => true),
323 *                       "btn2" => array("img"   => DOKU_TPL."user/mybutton1.png",
324 *                                       "href"  => wl("start", false, false, "&")),
325 *                       "btn3" => array("img"   => DOKU_TPL."user/mybutton2.png",
326 *                                       "href"  => "http://www.example.com");
327 *        Available keys within the subarrays:
328 *        - "img" (mandatory)
329 *          The relative or full path of an image/button to show. Users may
330 *          place own images within the /user/ dir of this template.
331 *        - "href" (mandatory)
332 *          URL the element should point to (as link). Please submit raw,
333 *          unencoded URLs, the encoding will be done by this function for
334 *          security reasons.
335 *        - "width" (optional)
336 *          width="<value>" will be added to the image tag if both "width" and
337 *          "height" are set (otherwise, this will be ignored).
338 *        - "height" (optional)
339 *          height="<value>" will be added to the image tag if both "height" and
340 *          "width" are set (otherwise, this will be ignored).
341 *        - "nofollow" (optional)
342 *          If set to TRUE, rel="nofollow" will be added to the link.
343 *        - "title" (optional)
344 *          title="<value>"  will be added to the link and image if "title"
345 *          is set + alt="<value>".
346 * @author ARSAVA <dokuwiki@dev.arsava.com>
347 * @return bool
348 * @see _vector_renderButtons()
349 * @see _vector_renderBoxes()
350 * @link http://www.wikipedia.org/wiki/Nofollow
351 * @link https://www.dokuwiki.org/devel:coding_style
352 */
353function _vector_renderButtons($arr)
354{
355    //array to store the created buttons into
356    $elements = array();
357
358    //handle the button data
359    foreach($arr as $li_id => $element){
360        //basic check
361        if (empty($element) ||
362            !is_array($element) ||
363            !isset($element["img"]) ||
364            !isset($element["href"])){
365            continue; //ignore invalid stuff and go on
366        }
367        $interim = "";
368
369        //add URL
370        $interim = "<a href=\"".hsc($element["href"])."\""; //@TODO: real URL encoding
371        //add rel="nofollow" attribute to the link?
372        if (!empty($element["nofollow"])){
373            $interim .= " rel=\"nofollow\"";
374        }
375        //add title attribute to the link?
376        if (!empty($element["title"])){
377            $interim .= " title=\"".hsc($element["title"])."\"";
378        }
379        $interim .= " target=\"_blank\"><img src=\"".hsc($element["img"])."\"";
380        //add width and height attribute to the image?
381        if (!empty($element["width"]) &&
382            !empty($element["height"])){
383            $interim .= " width=\"".(int)$element["width"]."\" height=\"".(int)$element["height"]."\"";
384        }
385        //add title and alt attribute to the image?
386        if (!empty($element["title"])){
387            $interim .= " title=\"".hsc($element["title"])."\" alt=\"".hsc($element["title"])."\"";
388        } else {
389            $interim .= " alt=\"\""; //alt is a mandatory attribute for images
390        }
391        $interim .= " border=\"0\" /></a>";
392
393        //store it
394        $elements[] = "      ".$interim."\n";
395    }
396
397    //show everything created
398    if (!empty($elements)){
399        echo  "\n";
400        foreach ($elements as $element){
401            echo $element;
402        }
403    }
404    return true;
405}
406
407//workaround for the "jumping textarea" IE bug. CSS only fix not possible cause
408//some DokuWiki JavaScript is triggering this bug, too. See the following for
409//info:
410//- <http://blog.andreas-haerter.com/2010/05/28/fix-msie-8-auto-scroll-textarea-css-width-percentage-bug>
411//- <http://msdn.microsoft.com/library/cc817574.aspx>
412if ($ACT === "edit" &&
413    !headers_sent()){
414    header("X-UA-Compatible: IE=EmulateIE7");
415}
416
417?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
418  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
419<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"]); ?>">
420<head>
421<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
422<title><?php tpl_pagetitle(); echo " - ".hsc($conf["title"]); ?></title>
423<?php
424//show meta-tags
425tpl_metaheaders();
426echo "<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\" />";
427
428//include default or userdefined favicon
429//
430//note: since 2011-04-22 "Rincewind RC1", there is a core function named
431//      "tpl_getFavicon()". But its functionality is not really fitting the
432//      behaviour of this template, therefore I don't use it here.
433if (file_exists(DOKU_TPLINC."user/favicon.ico")){
434    //user defined - you might find http://tools.dynamicdrive.com/favicon/
435    //useful to generate one
436    echo "\n<link rel=\"shortcut icon\" href=\"".DOKU_TPL."user/favicon.ico\" />\n";
437}elseif (file_exists(DOKU_TPLINC."user/favicon.png")){
438    //note: I do NOT recommend PNG for favicons (cause it is not supported by
439    //all browsers), but some users requested this feature.
440    echo "\n<link rel=\"shortcut icon\" href=\"".DOKU_TPL."user/favicon.png\" />\n";
441}else{
442    //default
443    echo "\n<link rel=\"shortcut icon\" href=\"".DOKU_TPL."static/3rd/dokuwiki/favicon.ico\" />\n";
444}
445
446//include default or userdefined Apple Touch Icon (see <http://j.mp/sx3NMT> for
447//details)
448if (file_exists(DOKU_TPLINC."user/apple-touch-icon.png")){
449    echo "<link rel=\"apple-touch-icon\" href=\"".DOKU_TPL."user/apple-touch-icon.png\" />\n";
450}else{
451    //default
452    echo "<link rel=\"apple-touch-icon\" href=\"".DOKU_TPL."static/3rd/dokuwiki/apple-touch-icon.png\" />\n";
453}
454
455//load userdefined js?
456if (tpl_getConf("vector_loaduserjs") && file_exists(DOKU_TPLINC."user/user.js")){
457    echo "<script type=\"text/javascript\" charset=\"utf-8\" src=\"".DOKU_TPL."user/user.js\"></script>\n";
458}
459
460//show printable version?
461if ($vector_action === "print"){
462  //note: this is just a workaround for people searching for a print version.
463  //      don't forget to update the styles.ini, this is the really important
464  //      thing! BTW: good text about this: http://is.gd/5MyG5
465  echo  "<link rel=\"stylesheet\" media=\"all\" type=\"text/css\" href=\"".DOKU_TPL."static/3rd/dokuwiki/print.css\" />\n"
466       ."<link rel=\"stylesheet\" media=\"all\" type=\"text/css\" href=\"".DOKU_TPL."static/css/print.css\" />\n";
467  if (file_exists(DOKU_TPL."user/print.css")){
468      echo "<link rel=\"stylesheet\" media=\"all\" type=\"text/css\" href=\"".DOKU_TPL."user/print.css\" />\n";
469  }
470}
471
472//load language specific css hacks?
473if (file_exists(DOKU_TPLINC."lang/".$conf["lang"]."/style.css")){
474  $interim = trim(file_get_contents(DOKU_TPLINC."lang/".$conf["lang"]."/style.css"));
475  if (!empty($interim)){
476      echo "<style type=\"text/css\" media=\"all\">\n".hsc($interim)."\n</style>\n";
477  }
478}
479?>
480<!--[if lte IE 8]><link rel="stylesheet" media="all" type="text/css" href="<?php echo DOKU_TPL; ?>static/css/screen_iehacks.css" /><![endif]-->
481<!--[if lt IE 7]><style type="text/css">body{behavior:url("<?php echo DOKU_TPL; ?>static/3rd/vector/csshover.htc")}</style><![endif]-->
482</head>
483<body class="<?php
484             //different styles/backgrounds for different page types
485             switch (true){
486                  //special: tech
487                  case ($vector_action === "detail"):
488                  case ($vector_action === "cite"):
489                  case ($ACT === "media"): //var comes from DokuWiki
490                  case ($ACT === "search"): //var comes from DokuWiki
491                    echo "mediawiki ltr ns-1 ns-special ";
492                    break;
493                  //special: wiki
494                  case (preg_match("/^wiki$|^wiki:.*?$/i", getNS(getID()))):
495                    case "mediawiki ltr capitalize-all-nouns ns-4 ns-subject ";
496                    break;
497                  //discussion
498                  case ($vector_context === "discuss"):
499                    echo "mediawiki ltr capitalize-all-nouns ns-1 ns-talk ";
500                    break;
501                  //"normal" content
502                  case ($ACT === "edit"): //var comes from DokuWiki
503                  case ($ACT === "draft"): //var comes from DokuWiki
504                  case ($ACT === "revisions"): //var comes from DokuWiki
505                  case ($vector_action === "print"):
506                  default:
507                    echo "mediawiki ltr capitalize-all-nouns ns-0 ns-subject ";
508                    break;
509              } ?>skin-vector">
510<div id="page-container">
511<div id="page-base" class="noprint"></div>
512<div id="head-base" class="noprint"></div>
513
514<!-- start div id=content -->
515<div id="content">
516  <a name="top" id="top"></a>
517  <a name="dokuwiki__top" id="dokuwiki__top"></a>
518
519  <!-- start main content area -->
520  <?php
521  //show messages (if there are any)
522  html_msgarea();
523  //show site notice
524  if (tpl_getConf("vector_sitenotice")){
525      //detect wiki page to load as content
526      if (!empty($transplugin) && //var comes from conf/boxes.php
527          is_object($transplugin) &&
528          tpl_getConf("vector_sitenotice_translate")){
529          //translated site notice?
530          $transplugin_langcur = $transplugin->hlp->getLangPart(cleanID(getId())); //current language part
531          $transplugin_langs   = explode(" ", trim($transplugin->getConf("translations"))); //available languages
532          if (empty($transplugin_langs) ||
533              empty($transplugin_langcur) ||
534              !is_array($transplugin_langs) ||
535              !in_array($transplugin_langcur, $transplugin_langs)) {
536              //current page is no translation or something is wrong, load default site notice
537              $sitenotice_location = tpl_getConf("vector_sitenotice_location");
538          } else {
539              //load language specific site notice
540              $sitenotice_location = tpl_getConf("vector_sitenotice_location")."_".$transplugin_langcur;
541          }
542      }else{
543          //default site notice, no translation
544          $sitenotice_location = tpl_getConf("vector_sitenotice_location");
545      }
546
547      //we have to show a custom site notice
548      if (empty($conf["useacl"]) ||
549          auth_quickaclcheck(cleanID($sitenotice_location)) >= AUTH_READ){ //current user got access?
550          echo "\n  <div id=\"siteNotice\" class=\"noprint\">\n";
551          //get the rendered content of the defined wiki article to use as
552          //custom site notice.
553          $interim = tpl_include_page($sitenotice_location, false);
554          if ($interim === "" ||
555              $interim === false){
556              //show creation/edit link if the defined page got no content
557              echo "[&#160;";
558              tpl_pagelink($sitenotice_location, hsc($lang["vector_fillplaceholder"]." (".hsc($sitenotice_location).")"));
559              echo "&#160;]<br />";
560          }else{
561              //show the rendered page content
562              echo  "    <div class=\"dokuwiki\">\n" //dokuwiki CSS class needed cause we are showing rendered page content
563                   .$interim."\n    "
564                   ."</div>";
565          }
566          echo "\n  </div>\n";
567      }
568  }
569  //show breadcrumps if enabled and position = top
570  if ($conf["breadcrumbs"] == true &&
571      $ACT !== "media" && //var comes from DokuWiki
572      (empty($conf["useacl"]) || //are there any users?
573       $loginname !== "" || //user is logged in?
574       !tpl_getConf("vector_closedwiki")) &&
575      tpl_getConf("vector_breadcrumbs_position") === "top"){
576      echo "\n  <div class=\"catlinks noprint\"><p>\n    ";
577      tpl_breadcrumbs();
578      echo "\n  </p></div>\n";
579  }
580  //show hierarchical breadcrumps if enabled and position = top
581  if ($conf["youarehere"] == true &&
582      $ACT !== "media" && //var comes from DokuWiki
583      (empty($conf["useacl"]) || //are there any users?
584       $loginname !== "" || //user is logged in?
585       !tpl_getConf("vector_closedwiki")) &&
586      tpl_getConf("vector_youarehere_position") === "top"){
587      echo "\n  <div class=\"catlinks noprint\"><p>\n    ";
588      tpl_youarehere();
589      echo "\n  </p></div>\n";
590  }
591  ?>
592
593  <!-- start div id bodyContent -->
594  <div id="bodyContent" class="dokuwiki">
595    <!-- start rendered wiki content -->
596    <?php
597    //flush the buffer for faster page rendering, heaviest content follows
598    if (function_exists("tpl_flush")) {
599        tpl_flush(); //exists since 2010-11-07 "Anteater"...
600    } else {
601        flush(); //...but I won't loose compatibility to 2009-12-25 "Lemming" right now.
602    }
603    //decide which type of pagecontent we have to show
604    switch ($vector_action){
605        //"image details"
606        case "detail":
607            include DOKU_TPLINC."inc_detail.php";
608            break;
609        //"cite this article"
610        case "cite":
611            include DOKU_TPLINC."inc_cite.php";
612            break;
613        //show "normal" content
614        default:
615            tpl_content(((tpl_getConf("vector_toc_position") === "article") ? true : false));
616            break;
617    }
618    ?>
619    <!-- end rendered wiki content -->
620    <div class="clearer"></div>
621  </div>
622  <!-- end div id bodyContent -->
623
624  <?php
625  //show breadcrumps if enabled and position = bottom
626  if ($conf["breadcrumbs"] == true &&
627      $ACT !== "media" && //var comes from DokuWiki
628      (empty($conf["useacl"]) || //are there any users?
629       $loginname !== "" || //user is logged in?
630       !tpl_getConf("vector_closedwiki")) &&
631      tpl_getConf("vector_breadcrumbs_position") === "bottom"){
632      echo "\n  <div class=\"catlinks noprint\"><p>\n    ";
633      tpl_breadcrumbs();
634      echo "\n  </p></div>\n";
635  }
636  //show hierarchical breadcrumps if enabled and position = bottom
637  if ($conf["youarehere"] == true &&
638      $ACT !== "media" && //var comes from DokuWiki
639      (empty($conf["useacl"]) || //are there any users?
640       $loginname !== "" || //user is logged in?
641       !tpl_getConf("vector_closedwiki")) &&
642      tpl_getConf("vector_youarehere_position") === "bottom"){
643      echo "\n  <div class=\"catlinks noprint\"><p>\n    ";
644      tpl_youarehere();
645      echo "\n  </p></div>\n";
646  }
647  ?>
648
649</div>
650<!-- end div id=content -->
651
652
653<!-- start div id=head -->
654<div id="head" class="noprint">
655  <?php
656  //show personal tools
657  if (!empty($conf["useacl"])){ //...makes only sense if there are users
658      echo  "\n"
659           ."  <div id=\"p-personal\">\n"
660           ."    <ul>\n";
661      //login?
662      if ($loginname === ""){
663          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
664      }else{
665          //username and userpage
666          echo "      <li id=\"pt-userpage\">".(tpl_getConf("vector_userpage")
667                                                ? html_wikilink(tpl_getConf("vector_userpage_ns").$loginname, hsc($loginname))
668                                                : hsc($loginname))."</li>";
669          //personal discussion
670          if (tpl_getConf("vector_discuss") &&
671              tpl_getConf("vector_userpage")){
672              echo "      <li id=\"pt-mytalk\">".html_wikilink(tpl_getConf("vector_discuss_ns").ltrim(tpl_getConf("vector_userpage_ns"), ":").$loginname, hsc($lang["vector_mytalk"]))."</li>";
673          }
674          //admin
675          if (!empty($INFO["isadmin"]) ||
676              !empty($INFO["ismanager"])){
677              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
678          }
679          //profile
680          if (actionOK("profile")){ //check if action is disabled
681              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
682          }
683          //logout
684          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
685      }
686      echo  "    </ul>\n"
687           ."  </div>\n";
688  }
689  ?>
690
691  <!-- start div id=left-navigation -->
692  <div id="left-navigation">
693    <div id="p-namespaces" class="vectorTabs">
694      <ul><?php
695          //show tabs: left. see vector/user/tabs.php to configure them
696          if (!empty($_vector_tabs_left) &&
697              is_array($_vector_tabs_left)){
698              _vector_renderTabs($_vector_tabs_left);
699          }
700          ?>
701
702      </ul>
703    </div>
704  </div>
705  <!-- end div id=left-navigation -->
706
707  <!-- start div id=right-navigation -->
708  <div id="right-navigation">
709    <div id="p-views" class="vectorTabs">
710      <ul><?php
711          //show tabs: right. see vector/user/tabs.php to configure them
712          if (!empty($_vector_tabs_right) &&
713              is_array($_vector_tabs_right)){
714              _vector_renderTabs($_vector_tabs_right);
715          }
716          ?>
717
718      </ul>
719    </div>
720<?php if (actionOK("search")){ ?>
721    <div id="p-search">
722      <h5>
723        <label for="qsearch__in"><?php echo hsc($lang["vector_search"]); ?></label>
724      </h5>
725      <form action="<?php echo wl(); ?>" accept-charset="utf-8" id="dw__search" name="dw__search">
726        <input type="hidden" name="do" value="search" />
727        <div id="simpleSearch">
728          <input id="qsearch__in" name="id" type="text" accesskey="f" value="" />
729          <button id="searchButton" type="submit" name="button" title="<?php echo hsc($lang["vector_btn_search_title"]); ?>">&nbsp;</button>
730        </div>
731        <div id="qsearch__out" class="ajax_qsearch JSpopup"></div>
732      </form>
733    </div>
734<?php } ?>
735  </div>
736  <!-- end div id=right-navigation -->
737
738</div>
739<!-- end div id=head -->
740
741<!-- start panel/sidebar -->
742<div id="panel" class="noprint">
743  <!-- start logo -->
744  <div id="p-logo">
745      <?php
746      //include default or userdefined logo
747      echo "<a href=\"".wl()."\" ";
748      if (file_exists(DOKU_TPLINC."user/logo.png")){
749          //user defined PNG
750          echo "style=\"background-image:url(".DOKU_TPL."user/logo.png);\"";
751      }elseif (file_exists(DOKU_TPLINC."user/logo.gif")){
752          //user defined GIF
753          echo "style=\"background-image:url(".DOKU_TPL."user/logo.gif);\"";
754      }elseif (file_exists(DOKU_TPLINC."user/logo.jpg")){
755          //user defined JPG
756          echo "style=\"background-image:url(".DOKU_TPL."user/logo.jpg);\"";
757      }else{
758          //default
759          echo "style=\"background-image:url(".DOKU_TPL."static/3rd/dokuwiki/logo.png);\"";
760      }
761      echo " accesskey=\"h\" title=\"[ALT+H]\"></a>\n";
762      ?>
763  </div>
764  <!-- end logo -->
765
766  <?php
767  //show boxes, see vector/user/boxes.php to configure them
768  if (!empty($_vector_boxes) &&
769      is_array($_vector_boxes)){
770      _vector_renderBoxes($_vector_boxes);
771  }
772  ?>
773
774</div>
775<!-- end panel/sidebar -->
776</div>
777<!-- end page-container -->
778
779<!-- start footer -->
780<div id="footer" class="noprint">
781  <ul id="footer-info">
782    <li id="footer-info-lastmod">
783      <?php tpl_pageinfo()?><br />
784    </li>
785    <?php
786    //copyright notice
787    if (tpl_getConf("vector_copyright")){
788        //show dokuwiki's default notice?
789        if (tpl_getConf("vector_copyright_default")){
790            echo "<li id=\"footer-info-copyright\">\n      <div class=\"dokuwiki\">";  //dokuwiki CSS class needed cause we have to show DokuWiki content
791            tpl_license(false);
792            echo "</div>\n    </li>\n";
793        //show custom notice.
794        }else{
795            //detect wiki page to load as content
796            if (!empty($transplugin) && //var comes from conf/boxes.php
797                is_object($transplugin) &&
798                tpl_getConf("vector_copyright_translate")){
799                //translated copyright notice?
800                $transplugin_langcur = $transplugin->hlp->getLangPart(cleanID(getId())); //current language part
801                $transplugin_langs   = explode(" ", trim($transplugin->getConf("translations"))); //available languages
802                if (empty($transplugin_langs) ||
803                    empty($transplugin_langcur) ||
804                    !is_array($transplugin_langs) ||
805                    !in_array($transplugin_langcur, $transplugin_langs)) {
806                    //current page is no translation or something is wrong, load default copyright notice
807                    $copyright_location = tpl_getConf("vector_copyright_location");
808                } else {
809                    //load language specific copyright notice
810                    $copyright_location = tpl_getConf("vector_copyright_location")."_".$transplugin_langcur;
811                }
812            }else{
813                //default copyright notice, no translation
814                $copyright_location = tpl_getConf("vector_copyright_location");
815            }
816
817            if (empty($conf["useacl"]) ||
818                auth_quickaclcheck(cleanID($copyright_location)) >= AUTH_READ){ //current user got access?
819                echo "<li id=\"footer-info-copyright\">\n        ";
820                //get the rendered content of the defined wiki article to use as custom notice
821                $interim = tpl_include_page($copyright_location, false);
822                if ($interim === "" ||
823                    $interim === false){
824                    //show creation/edit link if the defined page got no content
825                    echo "[&#160;";
826                    tpl_pagelink($copyright_location, hsc($lang["vector_fillplaceholder"]." (".hsc($copyright_location).")"));
827                    echo "&#160;]<br />";
828                }else{
829                    //show the rendered page content
830                    echo  "<div class=\"dokuwiki\">\n" //dokuwiki CSS class needed cause we are showing rendered page content
831                         .$interim."\n        "
832                         ."</div>";
833                }
834                echo "\n    </li>\n";
835            }
836        }
837    }
838    ?>
839  </ul>
840  <ul id="footer-places">
841    <li><?php
842        //show buttons, see vector/user/buttons.php to configure them
843        if (!empty($_vector_btns) &&
844            is_array($_vector_btns)){
845            _vector_renderButtons($_vector_btns);
846        }
847        ?>
848    </li>
849  </ul>
850  <div style="clearer"></div>
851</div>
852<!-- end footer -->
853<?php
854//provide DokuWiki housekeeping, required in all templates
855tpl_indexerWebBug();
856
857//include web analytics software
858if (file_exists(DOKU_TPLINC."/user/tracker.php")){
859    include DOKU_TPLINC."/user/tracker.php";
860}
861?>
862
863</body>
864</html>
865