xref: /template/wikiweko/main.php (revision dbba3fd5d0de6350525ab4e6b6e68b8896a78a4e)
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@syn-systems.com>
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@syn-systems.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 <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@syn-systems.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 Andreas Haerter <ah@syn-systems.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
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@syn-systems.com>
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@syn-systems.com>
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://syn-systems.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@syn-systems.com>
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      //detect wiki page to load as content
529      if (!empty($transplugin) && //var comes from conf/boxes.php
530          is_object($transplugin) &&
531          tpl_getConf("vector_sitenotice_translate")){
532          //translated site notice?
533          $transplugin_langcur = $transplugin->hlp->getLangPart(cleanID(getId())); //current language part
534          $transplugin_langs   = explode(" ", trim($transplugin->getConf("translations"))); //available languages
535          if (empty($transplugin_langs) ||
536              empty($transplugin_langcur) ||
537              !is_array($transplugin_langs) ||
538              !in_array($transplugin_langcur, $transplugin_langs)) {
539              //current page is no translation or something is wrong, load default site notice
540              $sitenotice_location = tpl_getConf("vector_sitenotice_location");
541          } else {
542              //load language specific site notice
543              $sitenotice_location = tpl_getConf("vector_sitenotice_location")."_".$transplugin_langcur;
544          }
545      }else{
546          //default site notice, no translation
547          $sitenotice_location = tpl_getConf("vector_sitenotice_location");
548      }
549
550      //we have to show a custom site notice
551      if (empty($conf["useacl"]) ||
552          auth_quickaclcheck(cleanID($sitenotice_location)) >= AUTH_READ){ //current user got access?
553          echo "\n  <div id=\"siteNotice\" class=\"noprint\">\n";
554          //get the rendered content of the defined wiki article to use as
555          //custom site notice.
556          $interim = tpl_include_page($sitenotice_location, false);
557          if ($interim === "" ||
558              $interim === false){
559              //show creation/edit link if the defined page got no content
560              echo "[&#160;";
561              tpl_pagelink($sitenotice_location, hsc($lang["vector_fillplaceholder"]." (".hsc($sitenotice_location).")"));
562              echo "&#160;]<br />";
563          }else{
564              //show the rendered page content
565              echo  "    <div class=\"dokuwiki\">\n" //dokuwiki CSS class needed cause we are showing rendered page content
566                   .$interim."\n    "
567                   ."</div>";
568          }
569          echo "\n  </div>\n";
570      }
571  }
572  //show breadcrumps if enabled and position = top
573  if ($conf["breadcrumbs"] == true &&
574      $ACT !== "media" && //var comes from DokuWiki
575      (empty($conf["useacl"]) || //are there any users?
576       $loginname !== "" || //user is logged in?
577       !tpl_getConf("vector_closedwiki")) &&
578      tpl_getConf("vector_breadcrumbs_position") === "top"){
579      echo "\n  <div class=\"catlinks noprint\"><p>\n    ";
580      tpl_breadcrumbs();
581      echo "\n  </p></div>\n";
582  }
583  //show hierarchical breadcrumps if enabled and position = top
584  if ($conf["youarehere"] == true &&
585      $ACT !== "media" && //var comes from DokuWiki
586      (empty($conf["useacl"]) || //are there any users?
587       $loginname !== "" || //user is logged in?
588       !tpl_getConf("vector_closedwiki")) &&
589      tpl_getConf("vector_youarehere_position") === "top"){
590      echo "\n  <div class=\"catlinks noprint\"><p>\n    ";
591      tpl_youarehere();
592      echo "\n  </p></div>\n";
593  }
594  ?>
595
596  <!-- start div id bodyContent -->
597  <div id="bodyContent" class="dokuwiki">
598    <!-- start rendered wiki content -->
599    <?php
600    //flush the buffer for faster page rendering, heaviest content follows
601    if (function_exists("tpl_flush")) {
602        tpl_flush(); //exists since 2010-11-07 "Anteater"...
603    } else {
604        flush(); //...but I won't loose compatibility to 2009-12-25 "Lemming" right now.
605    }
606    //decide which type of pagecontent we have to show
607    switch ($vector_action){
608        //"image details"
609        case "detail":
610            include DOKU_TPLINC."inc_detail.php";
611            break;
612        //"cite this article"
613        case "cite":
614            include DOKU_TPLINC."inc_cite.php";
615            break;
616        //show "normal" content
617        default:
618            tpl_content(((tpl_getConf("vector_toc_position") === "article") ? true : false));
619            break;
620    }
621    ?>
622    <!-- end rendered wiki content -->
623    <div class="clearer"></div>
624  </div>
625  <!-- end div id bodyContent -->
626
627  <?php
628  //show breadcrumps if enabled and position = bottom
629  if ($conf["breadcrumbs"] == true &&
630      $ACT !== "media" && //var comes from DokuWiki
631      (empty($conf["useacl"]) || //are there any users?
632       $loginname !== "" || //user is logged in?
633       !tpl_getConf("vector_closedwiki")) &&
634      tpl_getConf("vector_breadcrumbs_position") === "bottom"){
635      echo "\n  <div class=\"catlinks noprint\"><p>\n    ";
636      tpl_breadcrumbs();
637      echo "\n  </p></div>\n";
638  }
639  //show hierarchical breadcrumps if enabled and position = bottom
640  if ($conf["youarehere"] == true &&
641      $ACT !== "media" && //var comes from DokuWiki
642      (empty($conf["useacl"]) || //are there any users?
643       $loginname !== "" || //user is logged in?
644       !tpl_getConf("vector_closedwiki")) &&
645      tpl_getConf("vector_youarehere_position") === "bottom"){
646      echo "\n  <div class=\"catlinks noprint\"><p>\n    ";
647      tpl_youarehere();
648      echo "\n  </p></div>\n";
649  }
650  ?>
651
652</div>
653<!-- end div id=content -->
654
655
656<!-- start div id=head -->
657<div id="head" class="noprint">
658  <?php
659  //show personal tools
660  if (!empty($conf["useacl"])){ //...makes only sense if there are users
661      echo  "\n"
662           ."  <div id=\"p-personal\">\n"
663           ."    <ul>\n";
664      //login?
665      if ($loginname === ""){
666          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
667      }else{
668          //username and userpage
669          echo "      <li id=\"pt-userpage\">".(tpl_getConf("vector_userpage")
670                                                ? html_wikilink(tpl_getConf("vector_userpage_ns").$loginname, hsc($loginname))
671                                                : hsc($loginname))."</li>";
672          //personal discussion
673          if (tpl_getConf("vector_discuss") &&
674              tpl_getConf("vector_userpage")){
675              echo "      <li id=\"pt-mytalk\">".html_wikilink(tpl_getConf("vector_discuss_ns").ltrim(tpl_getConf("vector_userpage_ns"), ":").$loginname, hsc($lang["vector_mytalk"]))."</li>";
676          }
677          //admin
678          if (!empty($INFO["isadmin"]) ||
679              !empty($INFO["ismanager"])){
680              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
681          }
682          //profile
683          if (actionOK("profile")){ //check if action is disabled
684              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
685          }
686          //logout
687          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
688      }
689      echo  "    </ul>\n"
690           ."  </div>\n";
691  }
692  ?>
693
694  <!-- start div id=left-navigation -->
695  <div id="left-navigation">
696    <div id="p-namespaces" class="vectorTabs">
697      <ul><?php
698          //show tabs: left. see vector/user/tabs.php to configure them
699          if (!empty($_vector_tabs_left) &&
700              is_array($_vector_tabs_left)){
701              _vector_renderTabs($_vector_tabs_left);
702          }
703          ?>
704
705      </ul>
706    </div>
707  </div>
708  <!-- end div id=left-navigation -->
709
710  <!-- start div id=right-navigation -->
711  <div id="right-navigation">
712    <div id="p-views" class="vectorTabs">
713      <ul><?php
714          //show tabs: right. see vector/user/tabs.php to configure them
715          if (!empty($_vector_tabs_right) &&
716              is_array($_vector_tabs_right)){
717              _vector_renderTabs($_vector_tabs_right);
718          }
719          ?>
720
721      </ul>
722    </div>
723<?php if (actionOK("search")){ ?>
724    <div id="p-search">
725      <h5>
726        <label for="qsearch__in"><?php echo hsc($lang["vector_search"]); ?></label>
727      </h5>
728      <form action="<?php echo wl(); ?>" accept-charset="utf-8" id="dw__search" name="dw__search">
729        <input type="hidden" name="do" value="search" />
730        <div id="simpleSearch">
731          <input id="qsearch__in" name="id" type="text" accesskey="f" value="" />
732          <button id="searchButton" type="submit" name="button" title="<?php echo hsc($lang["vector_btn_search_title"]); ?>">&nbsp;</button>
733        </div>
734        <div id="qsearch__out" class="ajax_qsearch JSpopup"></div>
735      </form>
736    </div>
737<?php } ?>
738  </div>
739  <!-- end div id=right-navigation -->
740
741</div>
742<!-- end div id=head -->
743
744<!-- start panel/sidebar -->
745<div id="panel" class="noprint">
746  <!-- start logo -->
747  <div id="p-logo">
748      <?php
749      //include default or userdefined logo
750      echo "<a href=\"".wl()."\" ";
751      if (file_exists(DOKU_TPLINC."user/logo.png")){
752          //user defined PNG
753          echo "style=\"background-image:url(".DOKU_TPL."user/logo.png);\"";
754      }elseif (file_exists(DOKU_TPLINC."user/logo.gif")){
755          //user defined GIF
756          echo "style=\"background-image:url(".DOKU_TPL."user/logo.gif);\"";
757      }elseif (file_exists(DOKU_TPLINC."user/logo.jpg")){
758          //user defined JPG
759          echo "style=\"background-image:url(".DOKU_TPL."user/logo.jpg);\"";
760      }else{
761          //default
762          echo "style=\"background-image:url(".DOKU_TPL."static/3rd/dokuwiki/logo.png);\"";
763      }
764      echo " accesskey=\"h\" title=\"[ALT+H]\"></a>\n";
765      ?>
766  </div>
767  <!-- end logo -->
768
769  <?php
770  //show boxes, see vector/user/boxes.php to configure them
771  if (!empty($_vector_boxes) &&
772      is_array($_vector_boxes)){
773      _vector_renderBoxes($_vector_boxes);
774  }
775  ?>
776
777</div>
778<!-- end panel/sidebar -->
779</div>
780<!-- end page-container -->
781
782<!-- start footer -->
783<div id="footer">
784  <ul id="footer-info">
785    <li id="footer-info-lastmod">
786      <?php tpl_pageinfo()?><br />
787    </li>
788    <?php
789    //copyright notice
790    if (tpl_getConf("vector_copyright")){
791        //show dokuwiki's default notice?
792        if (tpl_getConf("vector_copyright_default")){
793            echo "<li id=\"footer-info-copyright\">\n      <div class=\"dokuwiki\">";  //dokuwiki CSS class needed cause we have to show DokuWiki content
794            tpl_license(false);
795            echo "</div>\n    </li>\n";
796        //show custom notice.
797        }else{
798            //detect wiki page to load as content
799            if (!empty($transplugin) && //var comes from conf/boxes.php
800                is_object($transplugin) &&
801                tpl_getConf("vector_copyright_translate")){
802                //translated copyright notice?
803                $transplugin_langcur = $transplugin->hlp->getLangPart(cleanID(getId())); //current language part
804                $transplugin_langs   = explode(" ", trim($transplugin->getConf("translations"))); //available languages
805                if (empty($transplugin_langs) ||
806                    empty($transplugin_langcur) ||
807                    !is_array($transplugin_langs) ||
808                    !in_array($transplugin_langcur, $transplugin_langs)) {
809                    //current page is no translation or something is wrong, load default copyright notice
810                    $copyright_location = tpl_getConf("vector_copyright_location");
811                } else {
812                    //load language specific copyright notice
813                    $copyright_location = tpl_getConf("vector_copyright_location")."_".$transplugin_langcur;
814                }
815            }else{
816                //default copyright notice, no translation
817                $copyright_location = tpl_getConf("vector_copyright_location");
818            }
819
820            if (empty($conf["useacl"]) ||
821                auth_quickaclcheck(cleanID($copyright_location)) >= AUTH_READ){ //current user got access?
822                echo "<li id=\"footer-info-copyright\">\n        ";
823                //get the rendered content of the defined wiki article to use as custom notice
824                $interim = tpl_include_page($copyright_location, false);
825                if ($interim === "" ||
826                    $interim === false){
827                    //show creation/edit link if the defined page got no content
828                    echo "[&#160;";
829                    tpl_pagelink($copyright_location, hsc($lang["vector_fillplaceholder"]." (".hsc($copyright_location).")"));
830                    echo "&#160;]<br />";
831                }else{
832                    //show the rendered page content
833                    echo  "<div class=\"dokuwiki\">\n" //dokuwiki CSS class needed cause we are showing rendered page content
834                         .$interim."\n        "
835                         ."</div>";
836                }
837                echo "\n    </li>\n";
838            }
839        }
840    }
841    ?>
842  </ul>
843  <ul id="footer-places" class="noprint">
844    <li><?php
845        //show buttons, see vector/user/buttons.php to configure them
846        if (!empty($_vector_btns) &&
847            is_array($_vector_btns)){
848            _vector_renderButtons($_vector_btns);
849        }
850        ?>
851    </li>
852  </ul>
853  <div style="clearer"></div>
854</div>
855<!-- end footer -->
856<?php
857//provide DokuWiki housekeeping, required in all templates
858tpl_indexerWebBug();
859
860//include web analytics software
861if (file_exists(DOKU_TPLINC."/user/tracker.php")){
862    include DOKU_TPLINC."/user/tracker.php";
863}
864?>
865
866</body>
867</html>
868