xref: /template/wikiweko/main.php (revision 4c65b9a30982e0653692e5132b4cbd9158de3f41)
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//manually load needed CSS? this is a workaround for PHP Bug #49642. In some
429//version/os combinations PHP is not able to parse INI-file entries if there
430//are slashes "/" used for the keynames (see bugreport for more information:
431//<http://bugs.php.net/bug.php?id=49692>). to trigger this workaround, simply
432//delete/rename vector's style.ini.
433if (!file_exists(DOKU_TPLINC."style.ini")){
434    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
435}
436
437//include default or userdefined favicon
438//
439//note: since 2011-04-22 "Rincewind RC1", there is a core function named
440//      "tpl_getFavicon()". But its functionality is not really fitting the
441//      behaviour of this template, therefore I don't use it here.
442if (file_exists(DOKU_TPLINC."user/favicon.ico")){
443    //user defined - you might find http://tools.dynamicdrive.com/favicon/
444    //useful to generate one
445    echo "\n<link rel=\"shortcut icon\" href=\"".DOKU_TPL."user/favicon.ico\" />\n";
446}elseif (file_exists(DOKU_TPLINC."user/favicon.png")){
447    //note: I do NOT recommend PNG for favicons (cause it is not supported by
448    //all browsers), but some users requested this feature.
449    echo "\n<link rel=\"shortcut icon\" href=\"".DOKU_TPL."user/favicon.png\" />\n";
450}else{
451    //default
452    echo "\n<link rel=\"shortcut icon\" href=\"".DOKU_TPL."static/3rd/dokuwiki/favicon.ico\" />\n";
453}
454
455//include default or userdefined Apple Touch Icon (see <http://j.mp/sx3NMT> for
456//details)
457if (file_exists(DOKU_TPLINC."user/apple-touch-icon.png")){
458    echo "<link rel=\"apple-touch-icon\" href=\"".DOKU_TPL."user/apple-touch-icon.png\" />\n";
459}else{
460    //default
461    echo "<link rel=\"apple-touch-icon\" href=\"".DOKU_TPL."static/3rd/dokuwiki/apple-touch-icon.png\" />\n";
462}
463
464//load userdefined js?
465if (tpl_getConf("vector_loaduserjs") && file_exists(DOKU_TPL."user/user.js")){
466    echo "<script type=\"text/javascript\" charset=\"utf-8\" src=\"".DOKU_TPL."user/user.js\"></script>\n";
467}
468
469//show printable version?
470if ($vector_action === "print"){
471  //note: this is just a workaround for people searching for a print version.
472  //      don't forget to update the styles.ini, this is the really important
473  //      thing! BTW: good text about this: http://is.gd/5MyG5
474  echo  "<link rel=\"stylesheet\" media=\"all\" type=\"text/css\" href=\"".DOKU_TPL."static/3rd/dokuwiki/print.css\" />\n"
475       ."<link rel=\"stylesheet\" media=\"all\" type=\"text/css\" href=\"".DOKU_TPL."static/css/print.css\" />\n";
476  if (file_exists(DOKU_TPL."user/print.css")){
477      echo "<link rel=\"stylesheet\" media=\"all\" type=\"text/css\" href=\"".DOKU_TPL."user/print.css\" />\n";
478  }
479}
480
481//load language specific css hacks?
482if (file_exists(DOKU_TPLINC."lang/".$conf["lang"]."/style.css")){
483  $interim = trim(file_get_contents(DOKU_TPLINC."lang/".$conf["lang"]."/style.css"));
484  if (!empty($interim)){
485      echo "<style type=\"text/css\" media=\"all\">\n".hsc($interim)."\n</style>\n";
486  }
487}
488?>
489<!--[if lte IE 8]><link rel="stylesheet" media="all" type="text/css" href="<?php echo DOKU_TPL; ?>static/css/screen_iehacks.css" /><![endif]-->
490<!--[if lt IE 7]><style type="text/css">body{behavior:url("<?php echo DOKU_TPL; ?>static/3rd/vector/csshover.htc")}</style><![endif]-->
491</head>
492<body class="<?php
493             //different styles/backgrounds for different page types
494             switch (true){
495                  //special: tech
496                  case ($vector_action === "detail"):
497                  case ($vector_action === "cite"):
498                  case ($ACT === "media"): //var comes from DokuWiki
499                  case ($ACT === "search"): //var comes from DokuWiki
500                    echo "mediawiki ltr ns-1 ns-special ";
501                    break;
502                  //special: wiki
503                  case (preg_match("/^wiki$|^wiki:.*?$/i", getNS(getID()))):
504                    case "mediawiki ltr capitalize-all-nouns ns-4 ns-subject ";
505                    break;
506                  //discussion
507                  case ($vector_context === "discuss"):
508                    echo "mediawiki ltr capitalize-all-nouns ns-1 ns-talk ";
509                    break;
510                  //"normal" content
511                  case ($ACT === "edit"): //var comes from DokuWiki
512                  case ($ACT === "draft"): //var comes from DokuWiki
513                  case ($ACT === "revisions"): //var comes from DokuWiki
514                  case ($vector_action === "print"):
515                  default:
516                    echo "mediawiki ltr capitalize-all-nouns ns-0 ns-subject ";
517                    break;
518              } ?>skin-vector">
519<div id="page-container">
520<div id="page-base" class="noprint"></div>
521<div id="head-base" class="noprint"></div>
522
523<!-- start div id=content -->
524<div id="content">
525  <a name="top" id="top"></a>
526  <a name="dokuwiki__top" id="dokuwiki__top"></a>
527
528  <!-- start main content area -->
529  <?php
530  //show messages (if there are any)
531  html_msgarea();
532  //show site notice
533  if (tpl_getConf("vector_sitenotice")){
534      //detect wiki page to load as content
535      if (!empty($transplugin) && //var comes from conf/boxes.php
536          is_object($transplugin) &&
537          tpl_getConf("vector_sitenotice_translate")){
538          //translated site notice?
539          $transplugin_langcur = $transplugin->hlp->getLangPart(cleanID(getId())); //current language part
540          $transplugin_langs   = explode(" ", trim($transplugin->getConf("translations"))); //available languages
541          if (empty($transplugin_langs) ||
542              empty($transplugin_langcur) ||
543              !is_array($transplugin_langs) ||
544              !in_array($transplugin_langcur, $transplugin_langs)) {
545              //current page is no translation or something is wrong, load default site notice
546              $sitenotice_location = tpl_getConf("vector_sitenotice_location");
547          } else {
548              //load language specific site notice
549              $sitenotice_location = tpl_getConf("vector_sitenotice_location")."_".$transplugin_langcur;
550          }
551      }else{
552          //default site notice, no translation
553          $sitenotice_location = tpl_getConf("vector_sitenotice_location");
554      }
555
556      //we have to show a custom site notice
557      if (empty($conf["useacl"]) ||
558          auth_quickaclcheck(cleanID($sitenotice_location)) >= AUTH_READ){ //current user got access?
559          echo "\n  <div id=\"siteNotice\" class=\"noprint\">\n";
560          //get the rendered content of the defined wiki article to use as
561          //custom site notice.
562          $interim = tpl_include_page($sitenotice_location, false);
563          if ($interim === "" ||
564              $interim === false){
565              //show creation/edit link if the defined page got no content
566              echo "[&#160;";
567              tpl_pagelink($sitenotice_location, hsc($lang["vector_fillplaceholder"]." (".hsc($sitenotice_location).")"));
568              echo "&#160;]<br />";
569          }else{
570              //show the rendered page content
571              echo  "    <div class=\"dokuwiki\">\n" //dokuwiki CSS class needed cause we are showing rendered page content
572                   .$interim."\n    "
573                   ."</div>";
574          }
575          echo "\n  </div>\n";
576      }
577  }
578  //show breadcrumps if enabled and position = top
579  if ($conf["breadcrumbs"] == true &&
580      $ACT !== "media" && //var comes from DokuWiki
581      (empty($conf["useacl"]) || //are there any users?
582       $loginname !== "" || //user is logged in?
583       !tpl_getConf("vector_closedwiki")) &&
584      tpl_getConf("vector_breadcrumbs_position") === "top"){
585      echo "\n  <div class=\"catlinks noprint\"><p>\n    ";
586      tpl_breadcrumbs();
587      echo "\n  </p></div>\n";
588  }
589  //show hierarchical breadcrumps if enabled and position = top
590  if ($conf["youarehere"] == true &&
591      $ACT !== "media" && //var comes from DokuWiki
592      (empty($conf["useacl"]) || //are there any users?
593       $loginname !== "" || //user is logged in?
594       !tpl_getConf("vector_closedwiki")) &&
595      tpl_getConf("vector_youarehere_position") === "top"){
596      echo "\n  <div class=\"catlinks noprint\"><p>\n    ";
597      tpl_youarehere();
598      echo "\n  </p></div>\n";
599  }
600  ?>
601
602  <!-- start div id bodyContent -->
603  <div id="bodyContent" class="dokuwiki">
604    <!-- start rendered wiki content -->
605    <?php
606    //flush the buffer for faster page rendering, heaviest content follows
607    if (function_exists("tpl_flush")) {
608        tpl_flush(); //exists since 2010-11-07 "Anteater"...
609    } else {
610        flush(); //...but I won't loose compatibility to 2009-12-25 "Lemming" right now.
611    }
612    //decide which type of pagecontent we have to show
613    switch ($vector_action){
614        //"image details"
615        case "detail":
616            include DOKU_TPLINC."inc_detail.php";
617            break;
618        //"cite this article"
619        case "cite":
620            include DOKU_TPLINC."inc_cite.php";
621            break;
622        //show "normal" content
623        default:
624            tpl_content(((tpl_getConf("vector_toc_position") === "article") ? true : false));
625            break;
626    }
627    ?>
628    <!-- end rendered wiki content -->
629    <div class="clearer"></div>
630  </div>
631  <!-- end div id bodyContent -->
632
633  <?php
634  //show breadcrumps if enabled and position = bottom
635  if ($conf["breadcrumbs"] == true &&
636      $ACT !== "media" && //var comes from DokuWiki
637      (empty($conf["useacl"]) || //are there any users?
638       $loginname !== "" || //user is logged in?
639       !tpl_getConf("vector_closedwiki")) &&
640      tpl_getConf("vector_breadcrumbs_position") === "bottom"){
641      echo "\n  <div class=\"catlinks noprint\"><p>\n    ";
642      tpl_breadcrumbs();
643      echo "\n  </p></div>\n";
644  }
645  //show hierarchical breadcrumps if enabled and position = bottom
646  if ($conf["youarehere"] == true &&
647      $ACT !== "media" && //var comes from DokuWiki
648      (empty($conf["useacl"]) || //are there any users?
649       $loginname !== "" || //user is logged in?
650       !tpl_getConf("vector_closedwiki")) &&
651      tpl_getConf("vector_youarehere_position") === "bottom"){
652      echo "\n  <div class=\"catlinks noprint\"><p>\n    ";
653      tpl_youarehere();
654      echo "\n  </p></div>\n";
655  }
656  ?>
657
658</div>
659<!-- end div id=content -->
660
661
662<!-- start div id=head -->
663<div id="head" class="noprint">
664  <?php
665  //show personal tools
666  if (!empty($conf["useacl"])){ //...makes only sense if there are users
667      echo  "\n"
668           ."  <div id=\"p-personal\">\n"
669           ."    <ul>\n";
670      //login?
671      if ($loginname === ""){
672          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
673      }else{
674          //username and userpage
675          echo "      <li id=\"pt-userpage\">".(tpl_getConf("vector_userpage")
676                                                ? html_wikilink(tpl_getConf("vector_userpage_ns").$loginname, hsc($loginname))
677                                                : hsc($loginname))."</li>";
678          //personal discussion
679          if (tpl_getConf("vector_discuss") &&
680              tpl_getConf("vector_userpage")){
681              echo "      <li id=\"pt-mytalk\">".html_wikilink(tpl_getConf("vector_discuss_ns").ltrim(tpl_getConf("vector_userpage_ns"), ":").$loginname, hsc($lang["vector_mytalk"]))."</li>";
682          }
683          //admin
684          if (!empty($INFO["isadmin"]) ||
685              !empty($INFO["ismanager"])){
686              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
687          }
688          //profile
689          if (actionOK("profile")){ //check if action is disabled
690              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
691          }
692          //logout
693          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
694      }
695      echo  "    </ul>\n"
696           ."  </div>\n";
697  }
698  ?>
699
700  <!-- start div id=left-navigation -->
701  <div id="left-navigation">
702    <div id="p-namespaces" class="vectorTabs">
703      <ul><?php
704          //show tabs: left. see vector/user/tabs.php to configure them
705          if (!empty($_vector_tabs_left) &&
706              is_array($_vector_tabs_left)){
707              _vector_renderTabs($_vector_tabs_left);
708          }
709          ?>
710
711      </ul>
712    </div>
713  </div>
714  <!-- end div id=left-navigation -->
715
716  <!-- start div id=right-navigation -->
717  <div id="right-navigation">
718    <div id="p-views" class="vectorTabs">
719      <ul><?php
720          //show tabs: right. see vector/user/tabs.php to configure them
721          if (!empty($_vector_tabs_right) &&
722              is_array($_vector_tabs_right)){
723              _vector_renderTabs($_vector_tabs_right);
724          }
725          ?>
726
727      </ul>
728    </div>
729<?php if (actionOK("search")){ ?>
730    <div id="p-search">
731      <h5>
732        <label for="qsearch__in"><?php echo hsc($lang["vector_search"]); ?></label>
733      </h5>
734      <form action="<?php echo wl(); ?>" accept-charset="utf-8" id="dw__search" name="dw__search">
735        <input type="hidden" name="do" value="search" />
736        <div id="simpleSearch">
737          <input id="qsearch__in" name="id" type="text" accesskey="f" value="" />
738          <button id="searchButton" type="submit" name="button" title="<?php echo hsc($lang["vector_btn_search_title"]); ?>">&nbsp;</button>
739        </div>
740        <div id="qsearch__out" class="ajax_qsearch JSpopup"></div>
741      </form>
742    </div>
743<?php } ?>
744  </div>
745  <!-- end div id=right-navigation -->
746
747</div>
748<!-- end div id=head -->
749
750<!-- start panel/sidebar -->
751<div id="panel" class="noprint">
752  <!-- start logo -->
753  <div id="p-logo">
754      <?php
755      //include default or userdefined logo
756      echo "<a href=\"".wl()."\" ";
757      if (file_exists(DOKU_TPLINC."user/logo.png")){
758          //user defined PNG
759          echo "style=\"background-image:url(".DOKU_TPL."user/logo.png);\"";
760      }elseif (file_exists(DOKU_TPLINC."user/logo.gif")){
761          //user defined GIF
762          echo "style=\"background-image:url(".DOKU_TPL."user/logo.gif);\"";
763      }elseif (file_exists(DOKU_TPLINC."user/logo.jpg")){
764          //user defined JPG
765          echo "style=\"background-image:url(".DOKU_TPL."user/logo.jpg);\"";
766      }else{
767          //default
768          echo "style=\"background-image:url(".DOKU_TPL."static/3rd/dokuwiki/logo.png);\"";
769      }
770      echo " accesskey=\"h\" title=\"[ALT+H]\"></a>\n";
771      ?>
772  </div>
773  <!-- end logo -->
774
775  <?php
776  //show boxes, see vector/user/boxes.php to configure them
777  if (!empty($_vector_boxes) &&
778      is_array($_vector_boxes)){
779      _vector_renderBoxes($_vector_boxes);
780  }
781  ?>
782
783</div>
784<!-- end panel/sidebar -->
785</div>
786<!-- end page-container -->
787
788<!-- start footer -->
789<div id="footer" class="noprint">
790  <ul id="footer-info">
791    <li id="footer-info-lastmod">
792      <?php tpl_pageinfo()?><br />
793    </li>
794    <?php
795    //copyright notice
796    if (tpl_getConf("vector_copyright")){
797        //show dokuwiki's default notice?
798        if (tpl_getConf("vector_copyright_default")){
799            echo "<li id=\"footer-info-copyright\">\n      <div class=\"dokuwiki\">";  //dokuwiki CSS class needed cause we have to show DokuWiki content
800            tpl_license(false);
801            echo "</div>\n    </li>\n";
802        //show custom notice.
803        }else{
804            //detect wiki page to load as content
805            if (!empty($transplugin) && //var comes from conf/boxes.php
806                is_object($transplugin) &&
807                tpl_getConf("vector_copyright_translate")){
808                //translated copyright notice?
809                $transplugin_langcur = $transplugin->hlp->getLangPart(cleanID(getId())); //current language part
810                $transplugin_langs   = explode(" ", trim($transplugin->getConf("translations"))); //available languages
811                if (empty($transplugin_langs) ||
812                    empty($transplugin_langcur) ||
813                    !is_array($transplugin_langs) ||
814                    !in_array($transplugin_langcur, $transplugin_langs)) {
815                    //current page is no translation or something is wrong, load default copyright notice
816                    $copyright_location = tpl_getConf("vector_copyright_location");
817                } else {
818                    //load language specific copyright notice
819                    $copyright_location = tpl_getConf("vector_copyright_location")."_".$transplugin_langcur;
820                }
821            }else{
822                //default copyright notice, no translation
823                $copyright_location = tpl_getConf("vector_copyright_location");
824            }
825
826            if (empty($conf["useacl"]) ||
827                auth_quickaclcheck(cleanID($copyright_location)) >= AUTH_READ){ //current user got access?
828                echo "<li id=\"footer-info-copyright\">\n        ";
829                //get the rendered content of the defined wiki article to use as custom notice
830                $interim = tpl_include_page($copyright_location, false);
831                if ($interim === "" ||
832                    $interim === false){
833                    //show creation/edit link if the defined page got no content
834                    echo "[&#160;";
835                    tpl_pagelink($copyright_location, hsc($lang["vector_fillplaceholder"]." (".hsc($copyright_location).")"));
836                    echo "&#160;]<br />";
837                }else{
838                    //show the rendered page content
839                    echo  "<div class=\"dokuwiki\">\n" //dokuwiki CSS class needed cause we are showing rendered page content
840                         .$interim."\n        "
841                         ."</div>";
842                }
843                echo "\n    </li>\n";
844            }
845        }
846    }
847    ?>
848  </ul>
849  <ul id="footer-places">
850    <li><?php
851        //show buttons, see vector/user/buttons.php to configure them
852        if (!empty($_vector_btns) &&
853            is_array($_vector_btns)){
854            _vector_renderButtons($_vector_btns);
855        }
856        ?>
857    </li>
858  </ul>
859  <div style="clearer"></div>
860</div>
861<!-- end footer -->
862<?php
863//provide DokuWiki housekeeping, required in all templates
864tpl_indexerWebBug();
865
866//include web analytics software
867if (file_exists(DOKU_TPLINC."/user/tracker.php")){
868    include DOKU_TPLINC."/user/tracker.php";
869}
870?>
871
872</body>
873</html>
874