xref: /template/wikiweko/main.php (revision 23ebf7a692bc5d810250413f2f98b767598e4d07)
1fa5fcacaSAndreas Haerter<?php
2fa5fcacaSAndreas Haerter
3fa5fcacaSAndreas Haerter/**
4fa5fcacaSAndreas Haerter * Main file of the "vector" template for DokuWiki
5fa5fcacaSAndreas Haerter *
6fa5fcacaSAndreas Haerter *
7fa5fcacaSAndreas Haerter * LICENSE: This file is open source software (OSS) and may be copied under
8fa5fcacaSAndreas Haerter *          certain conditions. See COPYING file for details or try to contact
9fa5fcacaSAndreas Haerter *          the author(s) of this file in doubt.
10fa5fcacaSAndreas Haerter *
11fa5fcacaSAndreas Haerter * @license GPLv2 (http://www.gnu.org/licenses/gpl2.html)
12e3217ae2SAndreas Haerter * @author ARSAVA <dokuwiki@dev.arsava.com>
13e3217ae2SAndreas Haerter * @link https://www.dokuwiki.org/template:vector
14e3217ae2SAndreas Haerter * @link https://www.dokuwiki.org/devel:templates
15e3217ae2SAndreas Haerter * @link https://www.dokuwiki.org/devel:coding_style
16e3217ae2SAndreas Haerter * @link https://www.dokuwiki.org/devel:environment
17e3217ae2SAndreas Haerter * @link https://www.dokuwiki.org/devel:action_modes
18fa5fcacaSAndreas Haerter */
19fa5fcacaSAndreas Haerter
20fa5fcacaSAndreas Haerter
21fa5fcacaSAndreas Haerter//check if we are running within the DokuWiki environment
22fa5fcacaSAndreas Haerterif (!defined("DOKU_INC")){
23fa5fcacaSAndreas Haerter    die();
24fa5fcacaSAndreas Haerter}
25fa5fcacaSAndreas Haerter
26fa5fcacaSAndreas Haerter
27fa5fcacaSAndreas Haerter/**
28fa5fcacaSAndreas Haerter * Stores the template wide action
29fa5fcacaSAndreas Haerter *
30fa5fcacaSAndreas Haerter * Different DokuWiki actions requiring some template logic. Therefore the
31fa5fcacaSAndreas Haerter * template has to know, what we are doing right now - and that is what this
32fa5fcacaSAndreas Haerter * var is for.
33fa5fcacaSAndreas Haerter *
346d885141SAndreas Haerter * Please have a look at the "detail.php" file in the same folder, it is also
356d885141SAndreas Haerter * influencing the var's value.
36fa5fcacaSAndreas Haerter *
37fa5fcacaSAndreas Haerter * @var string
38e3217ae2SAndreas Haerter * @author ARSAVA <dokuwiki@dev.arsava.com>
39fa5fcacaSAndreas Haerter */
40fa5fcacaSAndreas Haerter$vector_action = "article";
41fa5fcacaSAndreas Haerter//note: I used $_REQUEST before (cause DokuWiki controls and fills it. Normally,
42fa5fcacaSAndreas Haerter//      using $_REQUEST is a possible security threat. For details, see
43fa5fcacaSAndreas Haerter//      <http://www.suspekt.org/2008/10/01/php-53-and-delayed-cross-site-request-forgerieshijacking/>
44e3217ae2SAndreas Haerter//      and <https://forum.dokuwiki.org/post/16524>), but it did not work as
45fa5fcacaSAndreas Haerter//      expected by me (maybe it is a reference and setting $vector_action
46fa5fcacaSAndreas Haerter//      also changed the contents of $_REQUEST?!). That is why I switched back,
47fa5fcacaSAndreas Haerter//      checking $_GET and $_POST like I did it before.
48fa5fcacaSAndreas Haerterif (!empty($_GET["vecdo"])){
49fa5fcacaSAndreas Haerter    $vector_action = (string)$_GET["vecdo"];
50fa5fcacaSAndreas Haerter}elseif (!empty($_POST["vecdo"])){
51fa5fcacaSAndreas Haerter    $vector_action = (string)$_POST["vecdo"];
52fa5fcacaSAndreas Haerter}
53fa5fcacaSAndreas Haerterif (!empty($vector_action) &&
54fa5fcacaSAndreas Haerter    $vector_action !== "article" &&
55fa5fcacaSAndreas Haerter    $vector_action !== "print" &&
56fa5fcacaSAndreas Haerter    $vector_action !== "detail" &&
57fa5fcacaSAndreas Haerter    $vector_action !== "cite"){
58fa5fcacaSAndreas Haerter    //ignore unknown values
59fa5fcacaSAndreas Haerter    $vector_action = "article";
60fa5fcacaSAndreas Haerter}
61fa5fcacaSAndreas Haerter
62fa5fcacaSAndreas Haerter
63fa5fcacaSAndreas Haerter/**
64fa5fcacaSAndreas Haerter * Stores the template wide context
65fa5fcacaSAndreas Haerter *
66fa5fcacaSAndreas Haerter * This template offers discussion pages via common articles, which should be
67fa5fcacaSAndreas Haerter * marked as "special". DokuWiki does not know any "special" articles, therefore
68fa5fcacaSAndreas Haerter * we have to take care about detecting if the current page is a discussion
69fa5fcacaSAndreas Haerter * page or not.
70fa5fcacaSAndreas Haerter *
71fa5fcacaSAndreas Haerter * @var string
72e3217ae2SAndreas Haerter * @author ARSAVA <dokuwiki@dev.arsava.com>
73fa5fcacaSAndreas Haerter */
74fa5fcacaSAndreas Haerter$vector_context = "article";
75fa5fcacaSAndreas Haerterif (preg_match("/^".tpl_getConf("vector_discuss_ns")."?$|^".tpl_getConf("vector_discuss_ns").".*?$/i", ":".getNS(getID()))){
76fa5fcacaSAndreas Haerter    $vector_context = "discuss";
77fa5fcacaSAndreas Haerter}
78fa5fcacaSAndreas Haerter
79fa5fcacaSAndreas Haerter
80fa5fcacaSAndreas Haerter/**
81fa5fcacaSAndreas Haerter * Stores the name the current client used to login
82fa5fcacaSAndreas Haerter *
83fa5fcacaSAndreas Haerter * @var string
84e3217ae2SAndreas Haerter * @author ARSAVA <dokuwiki@dev.arsava.com>
85fa5fcacaSAndreas Haerter */
86fa5fcacaSAndreas Haerter$loginname = "";
87fa5fcacaSAndreas Haerterif (!empty($conf["useacl"])){
88fa5fcacaSAndreas Haerter    if (isset($_SERVER["REMOTE_USER"]) && //no empty() but isset(): "0" may be a valid username...
89fa5fcacaSAndreas Haerter        $_SERVER["REMOTE_USER"] !== ""){
90fa5fcacaSAndreas Haerter        $loginname = $_SERVER["REMOTE_USER"]; //$INFO["client"] would not work here (-> e.g. if
91fa5fcacaSAndreas Haerter                                              //current IP differs from the one used to login)
92fa5fcacaSAndreas Haerter    }
93fa5fcacaSAndreas Haerter}
94fa5fcacaSAndreas Haerter
95fa5fcacaSAndreas Haerter
96fa5fcacaSAndreas Haerter//get needed language array
97fa5fcacaSAndreas Haerterinclude DOKU_TPLINC."lang/en/lang.php";
98fa5fcacaSAndreas Haerter//overwrite English language values with available translations
99fa5fcacaSAndreas Haerterif (!empty($conf["lang"]) &&
100fa5fcacaSAndreas Haerter    $conf["lang"] !== "en" &&
101fa5fcacaSAndreas Haerter    file_exists(DOKU_TPLINC."/lang/".$conf["lang"]."/lang.php")){
102fa5fcacaSAndreas Haerter    //get language file (partially translated language files are no problem
103fa5fcacaSAndreas Haerter    //cause non translated stuff is still existing as English array value)
104fa5fcacaSAndreas Haerter    include DOKU_TPLINC."/lang/".$conf["lang"]."/lang.php";
105fa5fcacaSAndreas Haerter}
106fa5fcacaSAndreas Haerter
107fa5fcacaSAndreas Haerter
108fa5fcacaSAndreas Haerter//detect revision
1099b358098SAndreas Haerter$rev = (int)$INFO["rev"]; //$INFO comes from the DokuWiki core
110fa5fcacaSAndreas Haerterif ($rev < 1){
111fa5fcacaSAndreas Haerter    $rev = (int)$INFO["lastmod"];
112fa5fcacaSAndreas Haerter}
113fa5fcacaSAndreas Haerter
114fa5fcacaSAndreas Haerter
115fa5fcacaSAndreas Haerter//get tab config
116fa5fcacaSAndreas Haerterinclude DOKU_TPLINC."/conf/tabs.php";  //default
117fa5fcacaSAndreas Haerterif (file_exists(DOKU_TPLINC."/user/tabs.php")){
118fa5fcacaSAndreas Haerter    include DOKU_TPLINC."/user/tabs.php"; //add user defined
119fa5fcacaSAndreas Haerter}
120fa5fcacaSAndreas Haerter
121fa5fcacaSAndreas Haerter
122fa5fcacaSAndreas Haerter//get boxes config
123fa5fcacaSAndreas Haerterinclude DOKU_TPLINC."/conf/boxes.php"; //default
124fa5fcacaSAndreas Haerterif (file_exists(DOKU_TPLINC."/user/boxes.php")){
125fa5fcacaSAndreas Haerter    include DOKU_TPLINC."/user/boxes.php"; //add user defined
126fa5fcacaSAndreas Haerter}
127fa5fcacaSAndreas Haerter
128fa5fcacaSAndreas Haerter
129fa5fcacaSAndreas Haerter//get button config
130fa5fcacaSAndreas Haerterinclude DOKU_TPLINC."/conf/buttons.php"; //default
131fa5fcacaSAndreas Haerterif (file_exists(DOKU_TPLINC."/user/buttons.php")){
132fa5fcacaSAndreas Haerter    include DOKU_TPLINC."/user/buttons.php"; //add user defined
133fa5fcacaSAndreas Haerter}
134fa5fcacaSAndreas Haerter
135fa5fcacaSAndreas Haerter
136fa5fcacaSAndreas Haerter/**
137fa5fcacaSAndreas Haerter * Helper to render the tabs (like a dynamic XHTML snippet)
138fa5fcacaSAndreas Haerter *
13976362e21SAndreas Haerter * @param array The tab data to render within the snippet. Each element is
14076362e21SAndreas Haerter *        represented by a subarray:
141fa5fcacaSAndreas Haerter *        $array = array("tab1" => array("text"     => "hello world!",
142fa5fcacaSAndreas Haerter *                                       "href"     => "http://www.example.com"
143fa5fcacaSAndreas Haerter *                                       "nofollow" => true),
144fa5fcacaSAndreas Haerter *                       "tab2" => array("text"  => "I did it again",
145fa5fcacaSAndreas Haerter *                                       "href"  => DOKU_BASE."doku.php?id=foobar",
146fa5fcacaSAndreas Haerter *                                       "class" => "foobar-css"),
147fa5fcacaSAndreas Haerter *                       "tab3" => array("text"  => "I did it again and again",
148fa5fcacaSAndreas Haerter *                                       "href"  => wl("start", false, false, "&"),
149fa5fcacaSAndreas Haerter *                                       "class" => "foobar-css"),
150fa5fcacaSAndreas Haerter *                       "tab4" => array("text"      => "Home",
151fa5fcacaSAndreas Haerter *                                       "wiki"      => ":start"
152fa5fcacaSAndreas Haerter *                                       "accesskey" => "H"));
153fa5fcacaSAndreas Haerter *        Available keys within the subarrays:
154fa5fcacaSAndreas Haerter *        - "text" (mandatory)
155fa5fcacaSAndreas Haerter *          The text/label of the element.
156fa5fcacaSAndreas Haerter *        - "href" (optional)
157fa5fcacaSAndreas Haerter *          URL the element should point to (as link). Please submit raw,
158fa5fcacaSAndreas Haerter *          unencoded URLs, the encoding will be done by this function for
159fa5fcacaSAndreas Haerter *          security reasons. If the URL is not relative
160fa5fcacaSAndreas Haerter *          (= starts with http(s)://), the URL will be treated as external
161fa5fcacaSAndreas Haerter *          (=a special style will be used if "class" is not set).
162fa5fcacaSAndreas Haerter *        - "wiki" (optional)
163fa5fcacaSAndreas Haerter *          ID of a WikiPage to link (like ":start" or ":wiki:foobar").
164fa5fcacaSAndreas Haerter *        - "class" (optional)
165fa5fcacaSAndreas Haerter *          Name of an additional CSS class to use for the element content.
166fa5fcacaSAndreas Haerter *          Works only in combination with "text" or "href", NOT with "wiki"
167fa5fcacaSAndreas Haerter *          (will be ignored in this case).
168fa5fcacaSAndreas Haerter *        - "nofollow" (optional)
169fa5fcacaSAndreas Haerter *          If set to TRUE, rel="nofollow" will be added to the link if "href"
170fa5fcacaSAndreas Haerter *          is set (otherwise this flag will do nothing).
171fa5fcacaSAndreas Haerter *        - "accesskey" (optional)
172fa5fcacaSAndreas Haerter *          accesskey="<value>" will be added to the link if "href" is set
173fa5fcacaSAndreas Haerter *          (otherwise this option will do nothing).
174e3217ae2SAndreas Haerter * @author ARSAVA <dokuwiki@dev.arsava.com>
17551bf5744SGerrit Uitslag * @return bool
176fa5fcacaSAndreas Haerter * @see _vector_renderButtons()
177fa5fcacaSAndreas Haerter * @see _vector_renderBoxes()
178fa5fcacaSAndreas Haerter * @link http://www.wikipedia.org/wiki/Nofollow
179fa5fcacaSAndreas Haerter * @link http://de.selfhtml.org/html/verweise/tastatur.htm#kuerzel
180e3217ae2SAndreas Haerter * @link https://www.dokuwiki.org/devel:environment
181e3217ae2SAndreas Haerter * @link https://www.dokuwiki.org/devel:coding_style
182fa5fcacaSAndreas Haerter */
183fa5fcacaSAndreas Haerterfunction _vector_renderTabs($arr)
184fa5fcacaSAndreas Haerter{
185fa5fcacaSAndreas Haerter    //is there something useful?
186fa5fcacaSAndreas Haerter    if (empty($arr) ||
187fa5fcacaSAndreas Haerter        !is_array($arr)){
188fa5fcacaSAndreas Haerter        return false; //nope, break operation
189fa5fcacaSAndreas Haerter    }
190fa5fcacaSAndreas Haerter
191fa5fcacaSAndreas Haerter    //array to store the created tabs into
192fa5fcacaSAndreas Haerter    $elements = array();
193fa5fcacaSAndreas Haerter
194fa5fcacaSAndreas Haerter    //handle the tab data
195fa5fcacaSAndreas Haerter    foreach($arr as $li_id => $element){
196fa5fcacaSAndreas Haerter        //basic check
197fa5fcacaSAndreas Haerter        if (empty($element) ||
198fa5fcacaSAndreas Haerter            !is_array($element) ||
199fa5fcacaSAndreas Haerter            !isset($element["text"]) ||
200fa5fcacaSAndreas Haerter            (empty($element["href"]) &&
201fa5fcacaSAndreas Haerter             empty($element["wiki"]))){
202fa5fcacaSAndreas Haerter            continue; //ignore invalid stuff and go on
203fa5fcacaSAndreas Haerter        }
204fa5fcacaSAndreas Haerter        $li_created = true; //flag to control if we created any list element
205fa5fcacaSAndreas Haerter        $interim = "";
206fa5fcacaSAndreas Haerter        //do we have an external link?
207fa5fcacaSAndreas Haerter        if (!empty($element["href"])){
208fa5fcacaSAndreas Haerter            //add URL
209fa5fcacaSAndreas Haerter            $interim = "<a href=\"".hsc($element["href"])."\""; //@TODO: real URL encoding
210fa5fcacaSAndreas Haerter            //add rel="nofollow" attribute to the link?
211fa5fcacaSAndreas Haerter            if (!empty($element["nofollow"])){
212fa5fcacaSAndreas Haerter                $interim .= " rel=\"nofollow\"";
213fa5fcacaSAndreas Haerter            }
214fa5fcacaSAndreas Haerter            //mark external link?
215fa5fcacaSAndreas Haerter            if (substr($element["href"], 0, 4) === "http" ||
216fa5fcacaSAndreas Haerter                substr($element["href"], 0, 3) === "ftp"){
217fa5fcacaSAndreas Haerter                $interim .= " class=\"urlextern\"";
218fa5fcacaSAndreas Haerter            }
219fa5fcacaSAndreas Haerter            //add access key?
220fa5fcacaSAndreas Haerter            if (!empty($element["accesskey"])){
221fa5fcacaSAndreas Haerter                $interim .= " accesskey=\"".hsc($element["accesskey"])."\" title=\"[ALT+".hsc(strtoupper($element["accesskey"]))."]\"";
222fa5fcacaSAndreas Haerter            }
223fa5fcacaSAndreas Haerter            $interim .= "><span>".hsc($element["text"])."</span></a>";
224fa5fcacaSAndreas Haerter        //internal wiki link
225fa5fcacaSAndreas Haerter        }else if (!empty($element["wiki"])){
226fa5fcacaSAndreas Haerter            $interim = "<a href=\"".hsc(wl(cleanID($element["wiki"])))."\"><span>".hsc($element["text"])."</span></a>";
227fa5fcacaSAndreas Haerter        }
228fa5fcacaSAndreas Haerter        //store it
229fa5fcacaSAndreas Haerter        $elements[] = "\n        <li id=\"".hsc($li_id)."\"".(!empty($element["class"])
230fa5fcacaSAndreas Haerter                                                             ? " class=\"".hsc($element["class"])."\""
231fa5fcacaSAndreas Haerter                                                             : "").">".$interim."</li>";
232fa5fcacaSAndreas Haerter    }
233fa5fcacaSAndreas Haerter
234fa5fcacaSAndreas Haerter    //show everything created
235fa5fcacaSAndreas Haerter    if (!empty($elements)){
236fa5fcacaSAndreas Haerter        foreach ($elements as $element){
237fa5fcacaSAndreas Haerter            echo $element;
238fa5fcacaSAndreas Haerter        }
239fa5fcacaSAndreas Haerter    }
240fa5fcacaSAndreas Haerter    return true;
241fa5fcacaSAndreas Haerter}
242fa5fcacaSAndreas Haerter
243fa5fcacaSAndreas Haerter
244fa5fcacaSAndreas Haerter/**
245fa5fcacaSAndreas Haerter * Helper to render the boxes (like a dynamic XHTML snippet)
246fa5fcacaSAndreas Haerter *
247fa5fcacaSAndreas Haerter * @param array The box data to render within the snippet. Each box is
24876362e21SAndreas Haerter *        represented by a subarray:
249fa5fcacaSAndreas Haerter *        $array = array("box-id1" => array("headline" => "hello world!",
250fa5fcacaSAndreas Haerter *                                          "xhtml"    => "I am <i>here</i>."));
251fa5fcacaSAndreas Haerter *        Available keys within the subarrays:
252fa5fcacaSAndreas Haerter *        - "xhtml" (mandatory)
253fa5fcacaSAndreas Haerter *          The content of the Box you want to show as XHTML. Attention: YOU
254fa5fcacaSAndreas Haerter *          HAVE TO TAKE CARE ABOUT FILTER EVENTUALLY USED INPUT/SECURITY. Be
255fa5fcacaSAndreas Haerter *          aware of XSS and stuff.
256fa5fcacaSAndreas Haerter *        - "headline" (optional)
257fa5fcacaSAndreas Haerter *          Headline to show above the box. Leave empty/do not set for none.
258e3217ae2SAndreas Haerter * @author ARSAVA <dokuwiki@dev.arsava.com>
25951bf5744SGerrit Uitslag * @return bool
260fa5fcacaSAndreas Haerter * @see _vector_renderButtons()
261fa5fcacaSAndreas Haerter * @see _vector_renderTabs()
262fa5fcacaSAndreas Haerter * @link http://www.wikipedia.org/wiki/Nofollow
263fa5fcacaSAndreas Haerter * @link http://www.wikipedia.org/wiki/Cross-site_scripting
264e3217ae2SAndreas Haerter * @link https://www.dokuwiki.org/devel:coding_style
265fa5fcacaSAndreas Haerter */
266fa5fcacaSAndreas Haerterfunction _vector_renderBoxes($arr)
267fa5fcacaSAndreas Haerter{
268fa5fcacaSAndreas Haerter    //is there something useful?
269fa5fcacaSAndreas Haerter    if (empty($arr) ||
270fa5fcacaSAndreas Haerter        !is_array($arr)){
271fa5fcacaSAndreas Haerter        return false; //nope, break operation
272fa5fcacaSAndreas Haerter    }
273fa5fcacaSAndreas Haerter
274fa5fcacaSAndreas Haerter    //array to store the created boxes into
275fa5fcacaSAndreas Haerter    $boxes = array();
276fa5fcacaSAndreas Haerter
277fa5fcacaSAndreas Haerter    //handle the box data
278fa5fcacaSAndreas Haerter    foreach($arr as $div_id => $contents){
279fa5fcacaSAndreas Haerter        //basic check
280fa5fcacaSAndreas Haerter        if (empty($contents) ||
281fa5fcacaSAndreas Haerter            !is_array($contents) ||
282fa5fcacaSAndreas Haerter            !isset($contents["xhtml"])){
283fa5fcacaSAndreas Haerter            continue; //ignore invalid stuff and go on
284fa5fcacaSAndreas Haerter        }
285fa5fcacaSAndreas Haerter        $interim  = "  <div id=\"".hsc($div_id)."\" class=\"portal\">\n";
286fa5fcacaSAndreas Haerter        if (isset($contents["headline"])
287fa5fcacaSAndreas Haerter            && $contents["headline"] !== ""){
288fa5fcacaSAndreas Haerter            $interim .= "    <h5>".hsc($contents["headline"])."</h5>\n";
289fa5fcacaSAndreas Haerter        }
290fa5fcacaSAndreas Haerter        $interim .= "    <div class=\"body\">\n"
291fa5fcacaSAndreas Haerter                   ."      <div class=\"dokuwiki\">\n" //dokuwiki CSS class needed cause we might have to show rendered page content
292fa5fcacaSAndreas Haerter                   .$contents["xhtml"]."\n"
293fa5fcacaSAndreas Haerter                   ."      </div>\n"
294fa5fcacaSAndreas Haerter                   ."    </div>\n"
295fa5fcacaSAndreas Haerter                   ."  </div>\n";
296fa5fcacaSAndreas Haerter        //store it
297fa5fcacaSAndreas Haerter        $boxes[] = $interim;
298fa5fcacaSAndreas Haerter    }
299fa5fcacaSAndreas Haerter    //show everything created
300fa5fcacaSAndreas Haerter    if (!empty($boxes)){
301fa5fcacaSAndreas Haerter        echo  "\n";
302fa5fcacaSAndreas Haerter        foreach ($boxes as $box){
303fa5fcacaSAndreas Haerter            echo $box;
304fa5fcacaSAndreas Haerter        }
305fa5fcacaSAndreas Haerter        echo  "\n";
306fa5fcacaSAndreas Haerter    }
307fa5fcacaSAndreas Haerter
308fa5fcacaSAndreas Haerter    return true;
309fa5fcacaSAndreas Haerter}
310fa5fcacaSAndreas Haerter
311fa5fcacaSAndreas Haerter
312fa5fcacaSAndreas Haerter/**
313fa5fcacaSAndreas Haerter * Helper to render the footer buttons (like a dynamic XHTML snippet)
314fa5fcacaSAndreas Haerter *
31576362e21SAndreas Haerter * @param array The button data to render within the snippet. Each element is
31676362e21SAndreas Haerter *        represented by a subarray:
317fa5fcacaSAndreas Haerter *        $array = array("btn1" => array("img"      => DOKU_TPL."static/img/button-vector.png",
318e3217ae2SAndreas Haerter *                                       "href"     => "https://andreashaerter.com/",
319fa5fcacaSAndreas Haerter *                                       "width"    => 80,
320fa5fcacaSAndreas Haerter *                                       "height"   => 15,
321e3217ae2SAndreas Haerter *                                       "title"    => "Andreas Haerter's website",
322e3217ae2SAndreas Haerter *                                       "nofollow" => true),
323fa5fcacaSAndreas Haerter *                       "btn2" => array("img"   => DOKU_TPL."user/mybutton1.png",
324fa5fcacaSAndreas Haerter *                                       "href"  => wl("start", false, false, "&")),
325fa5fcacaSAndreas Haerter *                       "btn3" => array("img"   => DOKU_TPL."user/mybutton2.png",
326fa5fcacaSAndreas Haerter *                                       "href"  => "http://www.example.com");
327fa5fcacaSAndreas Haerter *        Available keys within the subarrays:
328fa5fcacaSAndreas Haerter *        - "img" (mandatory)
329fa5fcacaSAndreas Haerter *          The relative or full path of an image/button to show. Users may
330fa5fcacaSAndreas Haerter *          place own images within the /user/ dir of this template.
331fa5fcacaSAndreas Haerter *        - "href" (mandatory)
332fa5fcacaSAndreas Haerter *          URL the element should point to (as link). Please submit raw,
333fa5fcacaSAndreas Haerter *          unencoded URLs, the encoding will be done by this function for
334fa5fcacaSAndreas Haerter *          security reasons.
335fa5fcacaSAndreas Haerter *        - "width" (optional)
336fa5fcacaSAndreas Haerter *          width="<value>" will be added to the image tag if both "width" and
337fa5fcacaSAndreas Haerter *          "height" are set (otherwise, this will be ignored).
338fa5fcacaSAndreas Haerter *        - "height" (optional)
339fa5fcacaSAndreas Haerter *          height="<value>" will be added to the image tag if both "height" and
340fa5fcacaSAndreas Haerter *          "width" are set (otherwise, this will be ignored).
341fa5fcacaSAndreas Haerter *        - "nofollow" (optional)
342fa5fcacaSAndreas Haerter *          If set to TRUE, rel="nofollow" will be added to the link.
343fa5fcacaSAndreas Haerter *        - "title" (optional)
344fa5fcacaSAndreas Haerter *          title="<value>"  will be added to the link and image if "title"
345fa5fcacaSAndreas Haerter *          is set + alt="<value>".
346e3217ae2SAndreas Haerter * @author ARSAVA <dokuwiki@dev.arsava.com>
34751bf5744SGerrit Uitslag * @return bool
348fa5fcacaSAndreas Haerter * @see _vector_renderButtons()
349fa5fcacaSAndreas Haerter * @see _vector_renderBoxes()
350fa5fcacaSAndreas Haerter * @link http://www.wikipedia.org/wiki/Nofollow
351e3217ae2SAndreas Haerter * @link https://www.dokuwiki.org/devel:coding_style
352fa5fcacaSAndreas Haerter */
353fa5fcacaSAndreas Haerterfunction _vector_renderButtons($arr)
354fa5fcacaSAndreas Haerter{
355fa5fcacaSAndreas Haerter    //array to store the created buttons into
356fa5fcacaSAndreas Haerter    $elements = array();
357fa5fcacaSAndreas Haerter
358fa5fcacaSAndreas Haerter    //handle the button data
359fa5fcacaSAndreas Haerter    foreach($arr as $li_id => $element){
360fa5fcacaSAndreas Haerter        //basic check
361fa5fcacaSAndreas Haerter        if (empty($element) ||
362fa5fcacaSAndreas Haerter            !is_array($element) ||
363fa5fcacaSAndreas Haerter            !isset($element["img"]) ||
364fa5fcacaSAndreas Haerter            !isset($element["href"])){
365fa5fcacaSAndreas Haerter            continue; //ignore invalid stuff and go on
366fa5fcacaSAndreas Haerter        }
367fa5fcacaSAndreas Haerter        $interim = "";
368fa5fcacaSAndreas Haerter
369fa5fcacaSAndreas Haerter        //add URL
370fa5fcacaSAndreas Haerter        $interim = "<a href=\"".hsc($element["href"])."\""; //@TODO: real URL encoding
371fa5fcacaSAndreas Haerter        //add rel="nofollow" attribute to the link?
372fa5fcacaSAndreas Haerter        if (!empty($element["nofollow"])){
373fa5fcacaSAndreas Haerter            $interim .= " rel=\"nofollow\"";
374fa5fcacaSAndreas Haerter        }
375fa5fcacaSAndreas Haerter        //add title attribute to the link?
376fa5fcacaSAndreas Haerter        if (!empty($element["title"])){
377fa5fcacaSAndreas Haerter            $interim .= " title=\"".hsc($element["title"])."\"";
378fa5fcacaSAndreas Haerter        }
379fa5fcacaSAndreas Haerter        $interim .= " target=\"_blank\"><img src=\"".hsc($element["img"])."\"";
380fa5fcacaSAndreas Haerter        //add width and height attribute to the image?
381fa5fcacaSAndreas Haerter        if (!empty($element["width"]) &&
382fa5fcacaSAndreas Haerter            !empty($element["height"])){
383fa5fcacaSAndreas Haerter            $interim .= " width=\"".(int)$element["width"]."\" height=\"".(int)$element["height"]."\"";
384fa5fcacaSAndreas Haerter        }
385fa5fcacaSAndreas Haerter        //add title and alt attribute to the image?
386fa5fcacaSAndreas Haerter        if (!empty($element["title"])){
387fa5fcacaSAndreas Haerter            $interim .= " title=\"".hsc($element["title"])."\" alt=\"".hsc($element["title"])."\"";
388fa5fcacaSAndreas Haerter        } else {
389fa5fcacaSAndreas Haerter            $interim .= " alt=\"\""; //alt is a mandatory attribute for images
390fa5fcacaSAndreas Haerter        }
391fa5fcacaSAndreas Haerter        $interim .= " border=\"0\" /></a>";
392fa5fcacaSAndreas Haerter
393fa5fcacaSAndreas Haerter        //store it
394fa5fcacaSAndreas Haerter        $elements[] = "      ".$interim."\n";
395fa5fcacaSAndreas Haerter    }
396fa5fcacaSAndreas Haerter
397fa5fcacaSAndreas Haerter    //show everything created
398fa5fcacaSAndreas Haerter    if (!empty($elements)){
399fa5fcacaSAndreas Haerter        echo  "\n";
400fa5fcacaSAndreas Haerter        foreach ($elements as $element){
401fa5fcacaSAndreas Haerter            echo $element;
402fa5fcacaSAndreas Haerter        }
403fa5fcacaSAndreas Haerter    }
404fa5fcacaSAndreas Haerter    return true;
405fa5fcacaSAndreas Haerter}
406fa5fcacaSAndreas Haerter
407fa5fcacaSAndreas Haerter//workaround for the "jumping textarea" IE bug. CSS only fix not possible cause
408fa5fcacaSAndreas Haerter//some DokuWiki JavaScript is triggering this bug, too. See the following for
409fa5fcacaSAndreas Haerter//info:
410fa5fcacaSAndreas Haerter//- <http://blog.andreas-haerter.com/2010/05/28/fix-msie-8-auto-scroll-textarea-css-width-percentage-bug>
411fa5fcacaSAndreas Haerter//- <http://msdn.microsoft.com/library/cc817574.aspx>
412fa5fcacaSAndreas Haerterif ($ACT === "edit" &&
413fa5fcacaSAndreas Haerter    !headers_sent()){
414fa5fcacaSAndreas Haerter    header("X-UA-Compatible: IE=EmulateIE7");
415fa5fcacaSAndreas Haerter}
416fa5fcacaSAndreas Haerter
417fa5fcacaSAndreas Haerter?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
418fa5fcacaSAndreas Haerter  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
419098e70cbSAndreas Haerter<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"]); ?>">
420fa5fcacaSAndreas Haerter<head>
421fa5fcacaSAndreas Haerter<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
422fa5fcacaSAndreas Haerter<title><?php tpl_pagetitle(); echo " - ".hsc($conf["title"]); ?></title>
423fa5fcacaSAndreas Haerter<?php
424fa5fcacaSAndreas Haerter//show meta-tags
425fa5fcacaSAndreas Haertertpl_metaheaders();
426*23ebf7a6SRuben Carlo Benanteecho "<meta name=\"viewport\" content=\"width=device-width,initial-scale=0.8\" />";
427fa5fcacaSAndreas Haerter
428fa5fcacaSAndreas Haerter//include default or userdefined favicon
4298442308bSAndreas Haerter//
4308442308bSAndreas Haerter//note: since 2011-04-22 "Rincewind RC1", there is a core function named
4318442308bSAndreas Haerter//      "tpl_getFavicon()". But its functionality is not really fitting the
4328442308bSAndreas Haerter//      behaviour of this template, therefore I don't use it here.
433fa5fcacaSAndreas Haerterif (file_exists(DOKU_TPLINC."user/favicon.ico")){
434fa5fcacaSAndreas Haerter    //user defined - you might find http://tools.dynamicdrive.com/favicon/
435fa5fcacaSAndreas Haerter    //useful to generate one
436fa5fcacaSAndreas Haerter    echo "\n<link rel=\"shortcut icon\" href=\"".DOKU_TPL."user/favicon.ico\" />\n";
437fa5fcacaSAndreas Haerter}elseif (file_exists(DOKU_TPLINC."user/favicon.png")){
438fa5fcacaSAndreas Haerter    //note: I do NOT recommend PNG for favicons (cause it is not supported by
439fa5fcacaSAndreas Haerter    //all browsers), but some users requested this feature.
440fa5fcacaSAndreas Haerter    echo "\n<link rel=\"shortcut icon\" href=\"".DOKU_TPL."user/favicon.png\" />\n";
441fa5fcacaSAndreas Haerter}else{
442fa5fcacaSAndreas Haerter    //default
443fa5fcacaSAndreas Haerter    echo "\n<link rel=\"shortcut icon\" href=\"".DOKU_TPL."static/3rd/dokuwiki/favicon.ico\" />\n";
444fa5fcacaSAndreas Haerter}
445fa5fcacaSAndreas Haerter
446f797b6b0SAndreas Haerter//include default or userdefined Apple Touch Icon (see <http://j.mp/sx3NMT> for
447f797b6b0SAndreas Haerter//details)
448f797b6b0SAndreas Haerterif (file_exists(DOKU_TPLINC."user/apple-touch-icon.png")){
449f797b6b0SAndreas Haerter    echo "<link rel=\"apple-touch-icon\" href=\"".DOKU_TPL."user/apple-touch-icon.png\" />\n";
450f797b6b0SAndreas Haerter}else{
451f797b6b0SAndreas Haerter    //default
452f797b6b0SAndreas Haerter    echo "<link rel=\"apple-touch-icon\" href=\"".DOKU_TPL."static/3rd/dokuwiki/apple-touch-icon.png\" />\n";
453f797b6b0SAndreas Haerter}
454f797b6b0SAndreas Haerter
455fa5fcacaSAndreas Haerter//load userdefined js?
45662fce009SAndreas Haerterif (tpl_getConf("vector_loaduserjs") && file_exists(DOKU_TPLINC."user/user.js")){
457fa5fcacaSAndreas Haerter    echo "<script type=\"text/javascript\" charset=\"utf-8\" src=\"".DOKU_TPL."user/user.js\"></script>\n";
458fa5fcacaSAndreas Haerter}
459fa5fcacaSAndreas Haerter
460fa5fcacaSAndreas Haerter//show printable version?
461fa5fcacaSAndreas Haerterif ($vector_action === "print"){
462fa5fcacaSAndreas Haerter  //note: this is just a workaround for people searching for a print version.
463fa5fcacaSAndreas Haerter  //      don't forget to update the styles.ini, this is the really important
464fa5fcacaSAndreas Haerter  //      thing! BTW: good text about this: http://is.gd/5MyG5
465fa5fcacaSAndreas Haerter  echo  "<link rel=\"stylesheet\" media=\"all\" type=\"text/css\" href=\"".DOKU_TPL."static/3rd/dokuwiki/print.css\" />\n"
46651bf5744SGerrit Uitslag       ."<link rel=\"stylesheet\" media=\"all\" type=\"text/css\" href=\"".DOKU_TPL."static/css/print.css\" />\n";
46751bf5744SGerrit Uitslag  if (file_exists(DOKU_TPL."user/print.css")){
46851bf5744SGerrit Uitslag      echo "<link rel=\"stylesheet\" media=\"all\" type=\"text/css\" href=\"".DOKU_TPL."user/print.css\" />\n";
46951bf5744SGerrit Uitslag  }
470fa5fcacaSAndreas Haerter}
4716d885141SAndreas Haerter
472fa5fcacaSAndreas Haerter//load language specific css hacks?
473fa5fcacaSAndreas Haerterif (file_exists(DOKU_TPLINC."lang/".$conf["lang"]."/style.css")){
474fa5fcacaSAndreas Haerter  $interim = trim(file_get_contents(DOKU_TPLINC."lang/".$conf["lang"]."/style.css"));
475fa5fcacaSAndreas Haerter  if (!empty($interim)){
476fa5fcacaSAndreas Haerter      echo "<style type=\"text/css\" media=\"all\">\n".hsc($interim)."\n</style>\n";
477fa5fcacaSAndreas Haerter  }
478fa5fcacaSAndreas Haerter}
479fa5fcacaSAndreas Haerter?>
480ab856294SAndreas Haerter<!--[if lte IE 8]><link rel="stylesheet" media="all" type="text/css" href="<?php echo DOKU_TPL; ?>static/css/screen_iehacks.css" /><![endif]-->
481fa5fcacaSAndreas Haerter<!--[if lt IE 7]><style type="text/css">body{behavior:url("<?php echo DOKU_TPL; ?>static/3rd/vector/csshover.htc")}</style><![endif]-->
482fa5fcacaSAndreas Haerter</head>
483fa5fcacaSAndreas Haerter<body class="<?php
484fa5fcacaSAndreas Haerter             //different styles/backgrounds for different page types
485fa5fcacaSAndreas Haerter             switch (true){
486fa5fcacaSAndreas Haerter                  //special: tech
487fa5fcacaSAndreas Haerter                  case ($vector_action === "detail"):
488fa5fcacaSAndreas Haerter                  case ($vector_action === "cite"):
4896d885141SAndreas Haerter                  case ($ACT === "media"): //var comes from DokuWiki
490fa5fcacaSAndreas Haerter                  case ($ACT === "search"): //var comes from DokuWiki
491fa5fcacaSAndreas Haerter                    echo "mediawiki ltr ns-1 ns-special ";
492fa5fcacaSAndreas Haerter                    break;
493fa5fcacaSAndreas Haerter                  //special: wiki
494fa5fcacaSAndreas Haerter                  case (preg_match("/^wiki$|^wiki:.*?$/i", getNS(getID()))):
495fa5fcacaSAndreas Haerter                    case "mediawiki ltr capitalize-all-nouns ns-4 ns-subject ";
496fa5fcacaSAndreas Haerter                    break;
497fa5fcacaSAndreas Haerter                  //discussion
498fa5fcacaSAndreas Haerter                  case ($vector_context === "discuss"):
499fa5fcacaSAndreas Haerter                    echo "mediawiki ltr capitalize-all-nouns ns-1 ns-talk ";
500fa5fcacaSAndreas Haerter                    break;
501fa5fcacaSAndreas Haerter                  //"normal" content
502fa5fcacaSAndreas Haerter                  case ($ACT === "edit"): //var comes from DokuWiki
503fa5fcacaSAndreas Haerter                  case ($ACT === "draft"): //var comes from DokuWiki
504fa5fcacaSAndreas Haerter                  case ($ACT === "revisions"): //var comes from DokuWiki
505fa5fcacaSAndreas Haerter                  case ($vector_action === "print"):
506fa5fcacaSAndreas Haerter                  default:
507fa5fcacaSAndreas Haerter                    echo "mediawiki ltr capitalize-all-nouns ns-0 ns-subject ";
508fa5fcacaSAndreas Haerter                    break;
509fa5fcacaSAndreas Haerter              } ?>skin-vector">
510bde4d8fbSAndreas Haerter<div id="page-container">
511fa5fcacaSAndreas Haerter<div id="page-base" class="noprint"></div>
512fa5fcacaSAndreas Haerter<div id="head-base" class="noprint"></div>
513fa5fcacaSAndreas Haerter
514fa5fcacaSAndreas Haerter<!-- start div id=content -->
515fa5fcacaSAndreas Haerter<div id="content">
516fa5fcacaSAndreas Haerter  <a name="top" id="top"></a>
517fa5fcacaSAndreas Haerter  <a name="dokuwiki__top" id="dokuwiki__top"></a>
518fa5fcacaSAndreas Haerter
519fa5fcacaSAndreas Haerter  <!-- start main content area -->
520fa5fcacaSAndreas Haerter  <?php
521fa5fcacaSAndreas Haerter  //show messages (if there are any)
522fa5fcacaSAndreas Haerter  html_msgarea();
523fa5fcacaSAndreas Haerter  //show site notice
524fa5fcacaSAndreas Haerter  if (tpl_getConf("vector_sitenotice")){
5254d8721d7SAndreas Haerter      //detect wiki page to load as content
5264d8721d7SAndreas Haerter      if (!empty($transplugin) && //var comes from conf/boxes.php
5274d8721d7SAndreas Haerter          is_object($transplugin) &&
5284d8721d7SAndreas Haerter          tpl_getConf("vector_sitenotice_translate")){
5294d8721d7SAndreas Haerter          //translated site notice?
5304d8721d7SAndreas Haerter          $transplugin_langcur = $transplugin->hlp->getLangPart(cleanID(getId())); //current language part
5314d8721d7SAndreas Haerter          $transplugin_langs   = explode(" ", trim($transplugin->getConf("translations"))); //available languages
5324d8721d7SAndreas Haerter          if (empty($transplugin_langs) ||
5334d8721d7SAndreas Haerter              empty($transplugin_langcur) ||
5344d8721d7SAndreas Haerter              !is_array($transplugin_langs) ||
5354d8721d7SAndreas Haerter              !in_array($transplugin_langcur, $transplugin_langs)) {
5364d8721d7SAndreas Haerter              //current page is no translation or something is wrong, load default site notice
5374d8721d7SAndreas Haerter              $sitenotice_location = tpl_getConf("vector_sitenotice_location");
5384d8721d7SAndreas Haerter          } else {
5394d8721d7SAndreas Haerter              //load language specific site notice
5404d8721d7SAndreas Haerter              $sitenotice_location = tpl_getConf("vector_sitenotice_location")."_".$transplugin_langcur;
5414d8721d7SAndreas Haerter          }
5424d8721d7SAndreas Haerter      }else{
5434d8721d7SAndreas Haerter          //default site notice, no translation
5444d8721d7SAndreas Haerter          $sitenotice_location = tpl_getConf("vector_sitenotice_location");
5454d8721d7SAndreas Haerter      }
5464d8721d7SAndreas Haerter
547fa5fcacaSAndreas Haerter      //we have to show a custom site notice
548fa5fcacaSAndreas Haerter      if (empty($conf["useacl"]) ||
5494d8721d7SAndreas Haerter          auth_quickaclcheck(cleanID($sitenotice_location)) >= AUTH_READ){ //current user got access?
550fa5fcacaSAndreas Haerter          echo "\n  <div id=\"siteNotice\" class=\"noprint\">\n";
551fa5fcacaSAndreas Haerter          //get the rendered content of the defined wiki article to use as
552fa5fcacaSAndreas Haerter          //custom site notice.
5534d8721d7SAndreas Haerter          $interim = tpl_include_page($sitenotice_location, false);
554fa5fcacaSAndreas Haerter          if ($interim === "" ||
555fa5fcacaSAndreas Haerter              $interim === false){
556fa5fcacaSAndreas Haerter              //show creation/edit link if the defined page got no content
557fa5fcacaSAndreas Haerter              echo "[&#160;";
5584d8721d7SAndreas Haerter              tpl_pagelink($sitenotice_location, hsc($lang["vector_fillplaceholder"]." (".hsc($sitenotice_location).")"));
559fa5fcacaSAndreas Haerter              echo "&#160;]<br />";
560fa5fcacaSAndreas Haerter          }else{
561fa5fcacaSAndreas Haerter              //show the rendered page content
562fa5fcacaSAndreas Haerter              echo  "    <div class=\"dokuwiki\">\n" //dokuwiki CSS class needed cause we are showing rendered page content
563fa5fcacaSAndreas Haerter                   .$interim."\n    "
564fa5fcacaSAndreas Haerter                   ."</div>";
565fa5fcacaSAndreas Haerter          }
566fa5fcacaSAndreas Haerter          echo "\n  </div>\n";
567fa5fcacaSAndreas Haerter      }
568fa5fcacaSAndreas Haerter  }
569fa5fcacaSAndreas Haerter  //show breadcrumps if enabled and position = top
570fa5fcacaSAndreas Haerter  if ($conf["breadcrumbs"] == true &&
5716d885141SAndreas Haerter      $ACT !== "media" && //var comes from DokuWiki
572420ad960SAndreas Haerter      (empty($conf["useacl"]) || //are there any users?
573420ad960SAndreas Haerter       $loginname !== "" || //user is logged in?
574420ad960SAndreas Haerter       !tpl_getConf("vector_closedwiki")) &&
575fa5fcacaSAndreas Haerter      tpl_getConf("vector_breadcrumbs_position") === "top"){
576fa5fcacaSAndreas Haerter      echo "\n  <div class=\"catlinks noprint\"><p>\n    ";
577fa5fcacaSAndreas Haerter      tpl_breadcrumbs();
578fa5fcacaSAndreas Haerter      echo "\n  </p></div>\n";
579fa5fcacaSAndreas Haerter  }
580fa5fcacaSAndreas Haerter  //show hierarchical breadcrumps if enabled and position = top
581fa5fcacaSAndreas Haerter  if ($conf["youarehere"] == true &&
5826d885141SAndreas Haerter      $ACT !== "media" && //var comes from DokuWiki
583420ad960SAndreas Haerter      (empty($conf["useacl"]) || //are there any users?
584420ad960SAndreas Haerter       $loginname !== "" || //user is logged in?
585420ad960SAndreas Haerter       !tpl_getConf("vector_closedwiki")) &&
586fa5fcacaSAndreas Haerter      tpl_getConf("vector_youarehere_position") === "top"){
587fa5fcacaSAndreas Haerter      echo "\n  <div class=\"catlinks noprint\"><p>\n    ";
588fa5fcacaSAndreas Haerter      tpl_youarehere();
589fa5fcacaSAndreas Haerter      echo "\n  </p></div>\n";
590fa5fcacaSAndreas Haerter  }
591fa5fcacaSAndreas Haerter  ?>
592fa5fcacaSAndreas Haerter
593fa5fcacaSAndreas Haerter  <!-- start div id bodyContent -->
594fa5fcacaSAndreas Haerter  <div id="bodyContent" class="dokuwiki">
595fa5fcacaSAndreas Haerter    <!-- start rendered wiki content -->
596fa5fcacaSAndreas Haerter    <?php
597fa5fcacaSAndreas Haerter    //flush the buffer for faster page rendering, heaviest content follows
5983da5abdfSAndreas Haerter    if (function_exists("tpl_flush")) {
5991f09d21bSAndreas Haerter        tpl_flush(); //exists since 2010-11-07 "Anteater"...
6001f09d21bSAndreas Haerter    } else {
6011f09d21bSAndreas Haerter        flush(); //...but I won't loose compatibility to 2009-12-25 "Lemming" right now.
6021f09d21bSAndreas Haerter    }
603fa5fcacaSAndreas Haerter    //decide which type of pagecontent we have to show
604fa5fcacaSAndreas Haerter    switch ($vector_action){
605fa5fcacaSAndreas Haerter        //"image details"
606fa5fcacaSAndreas Haerter        case "detail":
607fa5fcacaSAndreas Haerter            include DOKU_TPLINC."inc_detail.php";
608fa5fcacaSAndreas Haerter            break;
609fa5fcacaSAndreas Haerter        //"cite this article"
610fa5fcacaSAndreas Haerter        case "cite":
611fa5fcacaSAndreas Haerter            include DOKU_TPLINC."inc_cite.php";
612fa5fcacaSAndreas Haerter            break;
613fa5fcacaSAndreas Haerter        //show "normal" content
614fa5fcacaSAndreas Haerter        default:
615fa5fcacaSAndreas Haerter            tpl_content(((tpl_getConf("vector_toc_position") === "article") ? true : false));
616fa5fcacaSAndreas Haerter            break;
617fa5fcacaSAndreas Haerter    }
618fa5fcacaSAndreas Haerter    ?>
619fa5fcacaSAndreas Haerter    <!-- end rendered wiki content -->
620fa5fcacaSAndreas Haerter    <div class="clearer"></div>
621fa5fcacaSAndreas Haerter  </div>
622fa5fcacaSAndreas Haerter  <!-- end div id bodyContent -->
623fa5fcacaSAndreas Haerter
624fa5fcacaSAndreas Haerter  <?php
625fa5fcacaSAndreas Haerter  //show breadcrumps if enabled and position = bottom
626fa5fcacaSAndreas Haerter  if ($conf["breadcrumbs"] == true &&
6276d885141SAndreas Haerter      $ACT !== "media" && //var comes from DokuWiki
628420ad960SAndreas Haerter      (empty($conf["useacl"]) || //are there any users?
629420ad960SAndreas Haerter       $loginname !== "" || //user is logged in?
630420ad960SAndreas Haerter       !tpl_getConf("vector_closedwiki")) &&
631fa5fcacaSAndreas Haerter      tpl_getConf("vector_breadcrumbs_position") === "bottom"){
632fa5fcacaSAndreas Haerter      echo "\n  <div class=\"catlinks noprint\"><p>\n    ";
633fa5fcacaSAndreas Haerter      tpl_breadcrumbs();
634fa5fcacaSAndreas Haerter      echo "\n  </p></div>\n";
635fa5fcacaSAndreas Haerter  }
636fa5fcacaSAndreas Haerter  //show hierarchical breadcrumps if enabled and position = bottom
637fa5fcacaSAndreas Haerter  if ($conf["youarehere"] == true &&
6386d885141SAndreas Haerter      $ACT !== "media" && //var comes from DokuWiki
639420ad960SAndreas Haerter      (empty($conf["useacl"]) || //are there any users?
640420ad960SAndreas Haerter       $loginname !== "" || //user is logged in?
641420ad960SAndreas Haerter       !tpl_getConf("vector_closedwiki")) &&
642fa5fcacaSAndreas Haerter      tpl_getConf("vector_youarehere_position") === "bottom"){
643fa5fcacaSAndreas Haerter      echo "\n  <div class=\"catlinks noprint\"><p>\n    ";
644fa5fcacaSAndreas Haerter      tpl_youarehere();
645fa5fcacaSAndreas Haerter      echo "\n  </p></div>\n";
646fa5fcacaSAndreas Haerter  }
647fa5fcacaSAndreas Haerter  ?>
648fa5fcacaSAndreas Haerter
649fa5fcacaSAndreas Haerter</div>
650fa5fcacaSAndreas Haerter<!-- end div id=content -->
651fa5fcacaSAndreas Haerter
652fa5fcacaSAndreas Haerter
653fa5fcacaSAndreas Haerter<!-- start div id=head -->
654fa5fcacaSAndreas Haerter<div id="head" class="noprint">
655fa5fcacaSAndreas Haerter  <?php
656fa5fcacaSAndreas Haerter  //show personal tools
657fa5fcacaSAndreas Haerter  if (!empty($conf["useacl"])){ //...makes only sense if there are users
658fa5fcacaSAndreas Haerter      echo  "\n"
659fa5fcacaSAndreas Haerter           ."  <div id=\"p-personal\">\n"
660fa5fcacaSAndreas Haerter           ."    <ul>\n";
661fa5fcacaSAndreas Haerter      //login?
662fa5fcacaSAndreas Haerter      if ($loginname === ""){
663fa5fcacaSAndreas Haerter          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
664fa5fcacaSAndreas Haerter      }else{
665fa5fcacaSAndreas Haerter          //username and userpage
666fa5fcacaSAndreas Haerter          echo "      <li id=\"pt-userpage\">".(tpl_getConf("vector_userpage")
667fa5fcacaSAndreas Haerter                                                ? html_wikilink(tpl_getConf("vector_userpage_ns").$loginname, hsc($loginname))
668fa5fcacaSAndreas Haerter                                                : hsc($loginname))."</li>";
669fa5fcacaSAndreas Haerter          //personal discussion
670fa5fcacaSAndreas Haerter          if (tpl_getConf("vector_discuss") &&
671fa5fcacaSAndreas Haerter              tpl_getConf("vector_userpage")){
672fa5fcacaSAndreas Haerter              echo "      <li id=\"pt-mytalk\">".html_wikilink(tpl_getConf("vector_discuss_ns").ltrim(tpl_getConf("vector_userpage_ns"), ":").$loginname, hsc($lang["vector_mytalk"]))."</li>";
673*23ebf7a6SRuben Carlo Benante              //echo "      <li id=\"pt-mytalk\">".html_wikilink(tpl_getConf("vector_discuss_ns").$loginname, hsc($lang["vector_mytalk"]))."</li>";
674fa5fcacaSAndreas Haerter          }
675fa5fcacaSAndreas Haerter          //admin
676fa5fcacaSAndreas Haerter          if (!empty($INFO["isadmin"]) ||
677fa5fcacaSAndreas Haerter              !empty($INFO["ismanager"])){
678fa5fcacaSAndreas Haerter              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
679fa5fcacaSAndreas Haerter          }
680fa5fcacaSAndreas Haerter          //profile
681aa6ef13eSAndreas Haerter          if (actionOK("profile")){ //check if action is disabled
682fa5fcacaSAndreas Haerter              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
683aa6ef13eSAndreas Haerter          }
684fa5fcacaSAndreas Haerter          //logout
685fa5fcacaSAndreas Haerter          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
686fa5fcacaSAndreas Haerter      }
687fa5fcacaSAndreas Haerter      echo  "    </ul>\n"
688fa5fcacaSAndreas Haerter           ."  </div>\n";
689fa5fcacaSAndreas Haerter  }
690fa5fcacaSAndreas Haerter  ?>
691fa5fcacaSAndreas Haerter
692fa5fcacaSAndreas Haerter  <!-- start div id=left-navigation -->
693fa5fcacaSAndreas Haerter  <div id="left-navigation">
694fa5fcacaSAndreas Haerter    <div id="p-namespaces" class="vectorTabs">
695fa5fcacaSAndreas Haerter      <ul><?php
696fa5fcacaSAndreas Haerter          //show tabs: left. see vector/user/tabs.php to configure them
697fa5fcacaSAndreas Haerter          if (!empty($_vector_tabs_left) &&
698fa5fcacaSAndreas Haerter              is_array($_vector_tabs_left)){
699fa5fcacaSAndreas Haerter              _vector_renderTabs($_vector_tabs_left);
700fa5fcacaSAndreas Haerter          }
701fa5fcacaSAndreas Haerter          ?>
702fa5fcacaSAndreas Haerter
703fa5fcacaSAndreas Haerter      </ul>
704fa5fcacaSAndreas Haerter    </div>
705fa5fcacaSAndreas Haerter  </div>
706fa5fcacaSAndreas Haerter  <!-- end div id=left-navigation -->
707fa5fcacaSAndreas Haerter
708fa5fcacaSAndreas Haerter  <!-- start div id=right-navigation -->
709fa5fcacaSAndreas Haerter  <div id="right-navigation">
710fa5fcacaSAndreas Haerter    <div id="p-views" class="vectorTabs">
711fa5fcacaSAndreas Haerter      <ul><?php
712fa5fcacaSAndreas Haerter          //show tabs: right. see vector/user/tabs.php to configure them
713fa5fcacaSAndreas Haerter          if (!empty($_vector_tabs_right) &&
714fa5fcacaSAndreas Haerter              is_array($_vector_tabs_right)){
715fa5fcacaSAndreas Haerter              _vector_renderTabs($_vector_tabs_right);
716fa5fcacaSAndreas Haerter          }
717fa5fcacaSAndreas Haerter          ?>
718fa5fcacaSAndreas Haerter
719fa5fcacaSAndreas Haerter      </ul>
720fa5fcacaSAndreas Haerter    </div>
721aa6ef13eSAndreas Haerter<?php if (actionOK("search")){ ?>
722fa5fcacaSAndreas Haerter    <div id="p-search">
723fa5fcacaSAndreas Haerter      <h5>
724fa5fcacaSAndreas Haerter        <label for="qsearch__in"><?php echo hsc($lang["vector_search"]); ?></label>
725fa5fcacaSAndreas Haerter      </h5>
726fa5fcacaSAndreas Haerter      <form action="<?php echo wl(); ?>" accept-charset="utf-8" id="dw__search" name="dw__search">
727fa5fcacaSAndreas Haerter        <input type="hidden" name="do" value="search" />
728fa5fcacaSAndreas Haerter        <div id="simpleSearch">
729fa5fcacaSAndreas Haerter          <input id="qsearch__in" name="id" type="text" accesskey="f" value="" />
730fa5fcacaSAndreas Haerter          <button id="searchButton" type="submit" name="button" title="<?php echo hsc($lang["vector_btn_search_title"]); ?>">&nbsp;</button>
731fa5fcacaSAndreas Haerter        </div>
732fa5fcacaSAndreas Haerter        <div id="qsearch__out" class="ajax_qsearch JSpopup"></div>
733fa5fcacaSAndreas Haerter      </form>
734fa5fcacaSAndreas Haerter    </div>
735aa6ef13eSAndreas Haerter<?php } ?>
736fa5fcacaSAndreas Haerter  </div>
737fa5fcacaSAndreas Haerter  <!-- end div id=right-navigation -->
738fa5fcacaSAndreas Haerter
739fa5fcacaSAndreas Haerter</div>
740fa5fcacaSAndreas Haerter<!-- end div id=head -->
741fa5fcacaSAndreas Haerter
742fa5fcacaSAndreas Haerter<!-- start panel/sidebar -->
743fa5fcacaSAndreas Haerter<div id="panel" class="noprint">
744fa5fcacaSAndreas Haerter  <!-- start logo -->
745fa5fcacaSAndreas Haerter  <div id="p-logo">
746fa5fcacaSAndreas Haerter      <?php
747fa5fcacaSAndreas Haerter      //include default or userdefined logo
748fa5fcacaSAndreas Haerter      echo "<a href=\"".wl()."\" ";
749fa5fcacaSAndreas Haerter      if (file_exists(DOKU_TPLINC."user/logo.png")){
750fa5fcacaSAndreas Haerter          //user defined PNG
751fa5fcacaSAndreas Haerter          echo "style=\"background-image:url(".DOKU_TPL."user/logo.png);\"";
752fa5fcacaSAndreas Haerter      }elseif (file_exists(DOKU_TPLINC."user/logo.gif")){
753fa5fcacaSAndreas Haerter          //user defined GIF
754fa5fcacaSAndreas Haerter          echo "style=\"background-image:url(".DOKU_TPL."user/logo.gif);\"";
755fa5fcacaSAndreas Haerter      }elseif (file_exists(DOKU_TPLINC."user/logo.jpg")){
756fa5fcacaSAndreas Haerter          //user defined JPG
757fa5fcacaSAndreas Haerter          echo "style=\"background-image:url(".DOKU_TPL."user/logo.jpg);\"";
758fa5fcacaSAndreas Haerter      }else{
759fa5fcacaSAndreas Haerter          //default
760fa5fcacaSAndreas Haerter          echo "style=\"background-image:url(".DOKU_TPL."static/3rd/dokuwiki/logo.png);\"";
761fa5fcacaSAndreas Haerter      }
762fa5fcacaSAndreas Haerter      echo " accesskey=\"h\" title=\"[ALT+H]\"></a>\n";
763fa5fcacaSAndreas Haerter      ?>
764fa5fcacaSAndreas Haerter  </div>
765fa5fcacaSAndreas Haerter  <!-- end logo -->
766fa5fcacaSAndreas Haerter
767fa5fcacaSAndreas Haerter  <?php
768fa5fcacaSAndreas Haerter  //show boxes, see vector/user/boxes.php to configure them
769fa5fcacaSAndreas Haerter  if (!empty($_vector_boxes) &&
770fa5fcacaSAndreas Haerter      is_array($_vector_boxes)){
771fa5fcacaSAndreas Haerter      _vector_renderBoxes($_vector_boxes);
772fa5fcacaSAndreas Haerter  }
773fa5fcacaSAndreas Haerter  ?>
774fa5fcacaSAndreas Haerter
775fa5fcacaSAndreas Haerter</div>
776fa5fcacaSAndreas Haerter<!-- end panel/sidebar -->
777bde4d8fbSAndreas Haerter</div>
778bde4d8fbSAndreas Haerter<!-- end page-container -->
779fa5fcacaSAndreas Haerter
780fa5fcacaSAndreas Haerter<!-- start footer -->
78122dbb979SAndreas Haerter<div id="footer" class="noprint">
782fa5fcacaSAndreas Haerter  <ul id="footer-info">
783fa5fcacaSAndreas Haerter    <li id="footer-info-lastmod">
784fa5fcacaSAndreas Haerter      <?php tpl_pageinfo()?><br />
785fa5fcacaSAndreas Haerter    </li>
786fa5fcacaSAndreas Haerter    <?php
787fa5fcacaSAndreas Haerter    //copyright notice
788fa5fcacaSAndreas Haerter    if (tpl_getConf("vector_copyright")){
7896074be2aSAndreas Haerter        //show dokuwiki's default notice?
790fa5fcacaSAndreas Haerter        if (tpl_getConf("vector_copyright_default")){
791fa5fcacaSAndreas Haerter            echo "<li id=\"footer-info-copyright\">\n      <div class=\"dokuwiki\">";  //dokuwiki CSS class needed cause we have to show DokuWiki content
792fa5fcacaSAndreas Haerter            tpl_license(false);
793fa5fcacaSAndreas Haerter            echo "</div>\n    </li>\n";
794fa5fcacaSAndreas Haerter        //show custom notice.
795fa5fcacaSAndreas Haerter        }else{
7964d8721d7SAndreas Haerter            //detect wiki page to load as content
7974d8721d7SAndreas Haerter            if (!empty($transplugin) && //var comes from conf/boxes.php
7984d8721d7SAndreas Haerter                is_object($transplugin) &&
7994d8721d7SAndreas Haerter                tpl_getConf("vector_copyright_translate")){
8004d8721d7SAndreas Haerter                //translated copyright notice?
8014d8721d7SAndreas Haerter                $transplugin_langcur = $transplugin->hlp->getLangPart(cleanID(getId())); //current language part
8024d8721d7SAndreas Haerter                $transplugin_langs   = explode(" ", trim($transplugin->getConf("translations"))); //available languages
8034d8721d7SAndreas Haerter                if (empty($transplugin_langs) ||
8044d8721d7SAndreas Haerter                    empty($transplugin_langcur) ||
8054d8721d7SAndreas Haerter                    !is_array($transplugin_langs) ||
8064d8721d7SAndreas Haerter                    !in_array($transplugin_langcur, $transplugin_langs)) {
8074d8721d7SAndreas Haerter                    //current page is no translation or something is wrong, load default copyright notice
8084d8721d7SAndreas Haerter                    $copyright_location = tpl_getConf("vector_copyright_location");
8094d8721d7SAndreas Haerter                } else {
8104d8721d7SAndreas Haerter                    //load language specific copyright notice
8114d8721d7SAndreas Haerter                    $copyright_location = tpl_getConf("vector_copyright_location")."_".$transplugin_langcur;
8124d8721d7SAndreas Haerter                }
8134d8721d7SAndreas Haerter            }else{
8144d8721d7SAndreas Haerter                //default copyright notice, no translation
8154d8721d7SAndreas Haerter                $copyright_location = tpl_getConf("vector_copyright_location");
8164d8721d7SAndreas Haerter            }
8174d8721d7SAndreas Haerter
818fa5fcacaSAndreas Haerter            if (empty($conf["useacl"]) ||
8194d8721d7SAndreas Haerter                auth_quickaclcheck(cleanID($copyright_location)) >= AUTH_READ){ //current user got access?
820fa5fcacaSAndreas Haerter                echo "<li id=\"footer-info-copyright\">\n        ";
821fa5fcacaSAndreas Haerter                //get the rendered content of the defined wiki article to use as custom notice
8224d8721d7SAndreas Haerter                $interim = tpl_include_page($copyright_location, false);
823fa5fcacaSAndreas Haerter                if ($interim === "" ||
824fa5fcacaSAndreas Haerter                    $interim === false){
825fa5fcacaSAndreas Haerter                    //show creation/edit link if the defined page got no content
826fa5fcacaSAndreas Haerter                    echo "[&#160;";
8274d8721d7SAndreas Haerter                    tpl_pagelink($copyright_location, hsc($lang["vector_fillplaceholder"]." (".hsc($copyright_location).")"));
828fa5fcacaSAndreas Haerter                    echo "&#160;]<br />";
829fa5fcacaSAndreas Haerter                }else{
830fa5fcacaSAndreas Haerter                    //show the rendered page content
831fa5fcacaSAndreas Haerter                    echo  "<div class=\"dokuwiki\">\n" //dokuwiki CSS class needed cause we are showing rendered page content
832fa5fcacaSAndreas Haerter                         .$interim."\n        "
833fa5fcacaSAndreas Haerter                         ."</div>";
834fa5fcacaSAndreas Haerter                }
835fa5fcacaSAndreas Haerter                echo "\n    </li>\n";
836fa5fcacaSAndreas Haerter            }
837fa5fcacaSAndreas Haerter        }
838fa5fcacaSAndreas Haerter    }
839fa5fcacaSAndreas Haerter    ?>
840fa5fcacaSAndreas Haerter  </ul>
84122dbb979SAndreas Haerter  <ul id="footer-places">
842fa5fcacaSAndreas Haerter    <li><?php
843fa5fcacaSAndreas Haerter        //show buttons, see vector/user/buttons.php to configure them
844fa5fcacaSAndreas Haerter        if (!empty($_vector_btns) &&
845fa5fcacaSAndreas Haerter            is_array($_vector_btns)){
846fa5fcacaSAndreas Haerter            _vector_renderButtons($_vector_btns);
847fa5fcacaSAndreas Haerter        }
848fa5fcacaSAndreas Haerter        ?>
849fa5fcacaSAndreas Haerter    </li>
850fa5fcacaSAndreas Haerter  </ul>
851fa5fcacaSAndreas Haerter  <div style="clearer"></div>
852fa5fcacaSAndreas Haerter</div>
853fa5fcacaSAndreas Haerter<!-- end footer -->
854fa5fcacaSAndreas Haerter<?php
855fa5fcacaSAndreas Haerter//provide DokuWiki housekeeping, required in all templates
856fa5fcacaSAndreas Haertertpl_indexerWebBug();
857aa6ef13eSAndreas Haerter
858aa6ef13eSAndreas Haerter//include web analytics software
859aa6ef13eSAndreas Haerterif (file_exists(DOKU_TPLINC."/user/tracker.php")){
860aa6ef13eSAndreas Haerter    include DOKU_TPLINC."/user/tracker.php";
861aa6ef13eSAndreas Haerter}
862fa5fcacaSAndreas Haerter?>
863fa5fcacaSAndreas Haerter
864fa5fcacaSAndreas Haerter</body>
865fa5fcacaSAndreas Haerter</html>
866