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