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