xref: /template/wikiweko/main.php (revision ab856294b0e20d9e377e58496f0705505e64a11a)
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)
12099d81c1SAndreas Haerter * @author Andreas Haerter <development@andreas-haerter.com>
13fa5fcacaSAndreas Haerter * @link http://www.dokuwiki.org/template:vector
14fa5fcacaSAndreas Haerter * @link http://www.dokuwiki.org/devel:templates
15fa5fcacaSAndreas Haerter * @link http://www.dokuwiki.org/devel:coding_style
16fa5fcacaSAndreas Haerter * @link http://www.dokuwiki.org/devel:environment
17fa5fcacaSAndreas Haerter * @link http://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
38099d81c1SAndreas Haerter * @author Andreas Haerter <development@andreas-haerter.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/>
44fa5fcacaSAndreas Haerter//      and <http://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
72099d81c1SAndreas Haerter * @author Andreas Haerter <development@andreas-haerter.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
84099d81c1SAndreas Haerter * @author Andreas Haerter <development@andreas-haerter.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 *
139fa5fcacaSAndreas Haerter * @param array The tab data to render within the snippet. Each element
1406074be2aSAndreas Haerter *        is represented through 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).
174099d81c1SAndreas Haerter * @author Andreas Haerter <development@andreas-haerter.com>
175fa5fcacaSAndreas Haerter * @see _vector_renderButtons()
176fa5fcacaSAndreas Haerter * @see _vector_renderBoxes()
177fa5fcacaSAndreas Haerter * @link http://www.wikipedia.org/wiki/Nofollow
178fa5fcacaSAndreas Haerter * @link http://de.selfhtml.org/html/verweise/tastatur.htm#kuerzel
179fa5fcacaSAndreas Haerter * @link http://www.dokuwiki.org/devel:environment
180fa5fcacaSAndreas Haerter * @link http://www.dokuwiki.org/devel:coding_style
181fa5fcacaSAndreas Haerter */
182fa5fcacaSAndreas Haerterfunction _vector_renderTabs($arr)
183fa5fcacaSAndreas Haerter{
184fa5fcacaSAndreas Haerter    //is there something useful?
185fa5fcacaSAndreas Haerter    if (empty($arr) ||
186fa5fcacaSAndreas Haerter        !is_array($arr)){
187fa5fcacaSAndreas Haerter        return false; //nope, break operation
188fa5fcacaSAndreas Haerter    }
189fa5fcacaSAndreas Haerter
190fa5fcacaSAndreas Haerter    //array to store the created tabs into
191fa5fcacaSAndreas Haerter    $elements = array();
192fa5fcacaSAndreas Haerter
193fa5fcacaSAndreas Haerter    //handle the tab data
194fa5fcacaSAndreas Haerter    foreach($arr as $li_id => $element){
195fa5fcacaSAndreas Haerter        //basic check
196fa5fcacaSAndreas Haerter        if (empty($element) ||
197fa5fcacaSAndreas Haerter            !is_array($element) ||
198fa5fcacaSAndreas Haerter            !isset($element["text"]) ||
199fa5fcacaSAndreas Haerter            (empty($element["href"]) &&
200fa5fcacaSAndreas Haerter             empty($element["wiki"]))){
201fa5fcacaSAndreas Haerter            continue; //ignore invalid stuff and go on
202fa5fcacaSAndreas Haerter        }
203fa5fcacaSAndreas Haerter        $li_created = true; //flag to control if we created any list element
204fa5fcacaSAndreas Haerter        $interim = "";
205fa5fcacaSAndreas Haerter        //do we have an external link?
206fa5fcacaSAndreas Haerter        if (!empty($element["href"])){
207fa5fcacaSAndreas Haerter            //add URL
208fa5fcacaSAndreas Haerter            $interim = "<a href=\"".hsc($element["href"])."\""; //@TODO: real URL encoding
209fa5fcacaSAndreas Haerter            //add rel="nofollow" attribute to the link?
210fa5fcacaSAndreas Haerter            if (!empty($element["nofollow"])){
211fa5fcacaSAndreas Haerter                $interim .= " rel=\"nofollow\"";
212fa5fcacaSAndreas Haerter            }
213fa5fcacaSAndreas Haerter            //mark external link?
214fa5fcacaSAndreas Haerter            if (substr($element["href"], 0, 4) === "http" ||
215fa5fcacaSAndreas Haerter                substr($element["href"], 0, 3) === "ftp"){
216fa5fcacaSAndreas Haerter                $interim .= " class=\"urlextern\"";
217fa5fcacaSAndreas Haerter            }
218fa5fcacaSAndreas Haerter            //add access key?
219fa5fcacaSAndreas Haerter            if (!empty($element["accesskey"])){
220fa5fcacaSAndreas Haerter                $interim .= " accesskey=\"".hsc($element["accesskey"])."\" title=\"[ALT+".hsc(strtoupper($element["accesskey"]))."]\"";
221fa5fcacaSAndreas Haerter            }
222fa5fcacaSAndreas Haerter            $interim .= "><span>".hsc($element["text"])."</span></a>";
223fa5fcacaSAndreas Haerter        //internal wiki link
224fa5fcacaSAndreas Haerter        }else if (!empty($element["wiki"])){
225fa5fcacaSAndreas Haerter            $interim = "<a href=\"".hsc(wl(cleanID($element["wiki"])))."\"><span>".hsc($element["text"])."</span></a>";
226fa5fcacaSAndreas Haerter        }
227fa5fcacaSAndreas Haerter        //store it
228fa5fcacaSAndreas Haerter        $elements[] = "\n        <li id=\"".hsc($li_id)."\"".(!empty($element["class"])
229fa5fcacaSAndreas Haerter                                                             ? " class=\"".hsc($element["class"])."\""
230fa5fcacaSAndreas Haerter                                                             : "").">".$interim."</li>";
231fa5fcacaSAndreas Haerter    }
232fa5fcacaSAndreas Haerter
233fa5fcacaSAndreas Haerter    //show everything created
234fa5fcacaSAndreas Haerter    if (!empty($elements)){
235fa5fcacaSAndreas Haerter        foreach ($elements as $element){
236fa5fcacaSAndreas Haerter            echo $element;
237fa5fcacaSAndreas Haerter        }
238fa5fcacaSAndreas Haerter    }
239fa5fcacaSAndreas Haerter    return true;
240fa5fcacaSAndreas Haerter}
241fa5fcacaSAndreas Haerter
242fa5fcacaSAndreas Haerter
243fa5fcacaSAndreas Haerter/**
244fa5fcacaSAndreas Haerter * Helper to render the boxes (like a dynamic XHTML snippet)
245fa5fcacaSAndreas Haerter *
246fa5fcacaSAndreas Haerter * @param array The box data to render within the snippet. Each box is
2476074be2aSAndreas Haerter *        represented through a subarray:
248fa5fcacaSAndreas Haerter *        $array = array("box-id1" => array("headline" => "hello world!",
249fa5fcacaSAndreas Haerter *                                          "xhtml"    => "I am <i>here</i>."));
250fa5fcacaSAndreas Haerter *        Available keys within the subarrays:
251fa5fcacaSAndreas Haerter *        - "xhtml" (mandatory)
252fa5fcacaSAndreas Haerter *          The content of the Box you want to show as XHTML. Attention: YOU
253fa5fcacaSAndreas Haerter *          HAVE TO TAKE CARE ABOUT FILTER EVENTUALLY USED INPUT/SECURITY. Be
254fa5fcacaSAndreas Haerter *          aware of XSS and stuff.
255fa5fcacaSAndreas Haerter *        - "headline" (optional)
256fa5fcacaSAndreas Haerter *          Headline to show above the box. Leave empty/do not set for none.
257099d81c1SAndreas Haerter * @author Andreas Haerter <development@andreas-haerter.com>
258fa5fcacaSAndreas Haerter * @see _vector_renderButtons()
259fa5fcacaSAndreas Haerter * @see _vector_renderTabs()
260fa5fcacaSAndreas Haerter * @link http://www.wikipedia.org/wiki/Nofollow
261fa5fcacaSAndreas Haerter * @link http://www.wikipedia.org/wiki/Cross-site_scripting
262fa5fcacaSAndreas Haerter * @link http://www.dokuwiki.org/devel:coding_style
263fa5fcacaSAndreas Haerter */
264fa5fcacaSAndreas Haerterfunction _vector_renderBoxes($arr)
265fa5fcacaSAndreas Haerter{
266fa5fcacaSAndreas Haerter    //is there something useful?
267fa5fcacaSAndreas Haerter    if (empty($arr) ||
268fa5fcacaSAndreas Haerter        !is_array($arr)){
269fa5fcacaSAndreas Haerter        return false; //nope, break operation
270fa5fcacaSAndreas Haerter    }
271fa5fcacaSAndreas Haerter
272fa5fcacaSAndreas Haerter    //array to store the created boxes into
273fa5fcacaSAndreas Haerter    $boxes = array();
274fa5fcacaSAndreas Haerter
275fa5fcacaSAndreas Haerter    //handle the box data
276fa5fcacaSAndreas Haerter    foreach($arr as $div_id => $contents){
277fa5fcacaSAndreas Haerter        //basic check
278fa5fcacaSAndreas Haerter        if (empty($contents) ||
279fa5fcacaSAndreas Haerter            !is_array($contents) ||
280fa5fcacaSAndreas Haerter            !isset($contents["xhtml"])){
281fa5fcacaSAndreas Haerter            continue; //ignore invalid stuff and go on
282fa5fcacaSAndreas Haerter        }
283fa5fcacaSAndreas Haerter        $interim  = "  <div id=\"".hsc($div_id)."\" class=\"portal\">\n";
284fa5fcacaSAndreas Haerter        if (isset($contents["headline"])
285fa5fcacaSAndreas Haerter            && $contents["headline"] !== ""){
286fa5fcacaSAndreas Haerter            $interim .= "    <h5>".hsc($contents["headline"])."</h5>\n";
287fa5fcacaSAndreas Haerter        }
288fa5fcacaSAndreas Haerter        $interim .= "    <div class=\"body\">\n"
289fa5fcacaSAndreas Haerter                   ."      <div class=\"dokuwiki\">\n" //dokuwiki CSS class needed cause we might have to show rendered page content
290fa5fcacaSAndreas Haerter                   .$contents["xhtml"]."\n"
291fa5fcacaSAndreas Haerter                   ."      </div>\n"
292fa5fcacaSAndreas Haerter                   ."    </div>\n"
293fa5fcacaSAndreas Haerter                   ."  </div>\n";
294fa5fcacaSAndreas Haerter        //store it
295fa5fcacaSAndreas Haerter        $boxes[] = $interim;
296fa5fcacaSAndreas Haerter    }
297fa5fcacaSAndreas Haerter    //show everything created
298fa5fcacaSAndreas Haerter    if (!empty($boxes)){
299fa5fcacaSAndreas Haerter        echo  "\n";
300fa5fcacaSAndreas Haerter        foreach ($boxes as $box){
301fa5fcacaSAndreas Haerter            echo $box;
302fa5fcacaSAndreas Haerter        }
303fa5fcacaSAndreas Haerter        echo  "\n";
304fa5fcacaSAndreas Haerter    }
305fa5fcacaSAndreas Haerter
306fa5fcacaSAndreas Haerter    return true;
307fa5fcacaSAndreas Haerter}
308fa5fcacaSAndreas Haerter
309fa5fcacaSAndreas Haerter
310fa5fcacaSAndreas Haerter/**
311fa5fcacaSAndreas Haerter * Helper to render the footer buttons (like a dynamic XHTML snippet)
312fa5fcacaSAndreas Haerter *
313fa5fcacaSAndreas Haerter * @param array The button data to render within the snippet. Each element
3146074be2aSAndreas Haerter *        is represented through a subarray:
315fa5fcacaSAndreas Haerter *        $array = array("btn1" => array("img"      => DOKU_TPL."static/img/button-vector.png",
316099d81c1SAndreas Haerter *                                       "href"     => "http://andreas-haerter.com/",
317fa5fcacaSAndreas Haerter *                                       "width"    => 80,
318fa5fcacaSAndreas Haerter *                                       "height"   => 15,
319fa5fcacaSAndreas Haerter *                                       "title"    => "vector for DokuWiki",
320fa5fcacaSAndreas Haerter *                                       "nofollow" => false),
321fa5fcacaSAndreas Haerter *                       "btn2" => array("img"   => DOKU_TPL."user/mybutton1.png",
322fa5fcacaSAndreas Haerter *                                       "href"  => wl("start", false, false, "&")),
323fa5fcacaSAndreas Haerter *                       "btn3" => array("img"   => DOKU_TPL."user/mybutton2.png",
324fa5fcacaSAndreas Haerter *                                       "href"  => "http://www.example.com");
325fa5fcacaSAndreas Haerter *        Available keys within the subarrays:
326fa5fcacaSAndreas Haerter *        - "img" (mandatory)
327fa5fcacaSAndreas Haerter *          The relative or full path of an image/button to show. Users may
328fa5fcacaSAndreas Haerter *          place own images within the /user/ dir of this template.
329fa5fcacaSAndreas Haerter *        - "href" (mandatory)
330fa5fcacaSAndreas Haerter *          URL the element should point to (as link). Please submit raw,
331fa5fcacaSAndreas Haerter *          unencoded URLs, the encoding will be done by this function for
332fa5fcacaSAndreas Haerter *          security reasons.
333fa5fcacaSAndreas Haerter *        - "width" (optional)
334fa5fcacaSAndreas Haerter *          width="<value>" will be added to the image tag if both "width" and
335fa5fcacaSAndreas Haerter *          "height" are set (otherwise, this will be ignored).
336fa5fcacaSAndreas Haerter *        - "height" (optional)
337fa5fcacaSAndreas Haerter *          height="<value>" will be added to the image tag if both "height" and
338fa5fcacaSAndreas Haerter *          "width" are set (otherwise, this will be ignored).
339fa5fcacaSAndreas Haerter *        - "nofollow" (optional)
340fa5fcacaSAndreas Haerter *          If set to TRUE, rel="nofollow" will be added to the link.
341fa5fcacaSAndreas Haerter *        - "title" (optional)
342fa5fcacaSAndreas Haerter *          title="<value>"  will be added to the link and image if "title"
343fa5fcacaSAndreas Haerter *          is set + alt="<value>".
344099d81c1SAndreas Haerter * @author Andreas Haerter <development@andreas-haerter.com>
345fa5fcacaSAndreas Haerter * @see _vector_renderButtons()
346fa5fcacaSAndreas Haerter * @see _vector_renderBoxes()
347fa5fcacaSAndreas Haerter * @link http://www.wikipedia.org/wiki/Nofollow
348fa5fcacaSAndreas Haerter * @link http://www.dokuwiki.org/devel:coding_style
349fa5fcacaSAndreas Haerter */
350fa5fcacaSAndreas Haerterfunction _vector_renderButtons($arr)
351fa5fcacaSAndreas Haerter{
352fa5fcacaSAndreas Haerter    //array to store the created buttons into
353fa5fcacaSAndreas Haerter    $elements = array();
354fa5fcacaSAndreas Haerter
355fa5fcacaSAndreas Haerter    //handle the button data
356fa5fcacaSAndreas Haerter    foreach($arr as $li_id => $element){
357fa5fcacaSAndreas Haerter        //basic check
358fa5fcacaSAndreas Haerter        if (empty($element) ||
359fa5fcacaSAndreas Haerter            !is_array($element) ||
360fa5fcacaSAndreas Haerter            !isset($element["img"]) ||
361fa5fcacaSAndreas Haerter            !isset($element["href"])){
362fa5fcacaSAndreas Haerter            continue; //ignore invalid stuff and go on
363fa5fcacaSAndreas Haerter        }
364fa5fcacaSAndreas Haerter        $interim = "";
365fa5fcacaSAndreas Haerter
366fa5fcacaSAndreas Haerter        //add URL
367fa5fcacaSAndreas Haerter        $interim = "<a href=\"".hsc($element["href"])."\""; //@TODO: real URL encoding
368fa5fcacaSAndreas Haerter        //add rel="nofollow" attribute to the link?
369fa5fcacaSAndreas Haerter        if (!empty($element["nofollow"])){
370fa5fcacaSAndreas Haerter            $interim .= " rel=\"nofollow\"";
371fa5fcacaSAndreas Haerter        }
372fa5fcacaSAndreas Haerter        //add title attribute to the link?
373fa5fcacaSAndreas Haerter        if (!empty($element["title"])){
374fa5fcacaSAndreas Haerter            $interim .= " title=\"".hsc($element["title"])."\"";
375fa5fcacaSAndreas Haerter        }
376fa5fcacaSAndreas Haerter        $interim .= " target=\"_blank\"><img src=\"".hsc($element["img"])."\"";
377fa5fcacaSAndreas Haerter        //add width and height attribute to the image?
378fa5fcacaSAndreas Haerter        if (!empty($element["width"]) &&
379fa5fcacaSAndreas Haerter            !empty($element["height"])){
380fa5fcacaSAndreas Haerter            $interim .= " width=\"".(int)$element["width"]."\" height=\"".(int)$element["height"]."\"";
381fa5fcacaSAndreas Haerter        }
382fa5fcacaSAndreas Haerter        //add title and alt attribute to the image?
383fa5fcacaSAndreas Haerter        if (!empty($element["title"])){
384fa5fcacaSAndreas Haerter            $interim .= " title=\"".hsc($element["title"])."\" alt=\"".hsc($element["title"])."\"";
385fa5fcacaSAndreas Haerter        } else {
386fa5fcacaSAndreas Haerter            $interim .= " alt=\"\""; //alt is a mandatory attribute for images
387fa5fcacaSAndreas Haerter        }
388fa5fcacaSAndreas Haerter        $interim .= " border=\"0\" /></a>";
389fa5fcacaSAndreas Haerter
390fa5fcacaSAndreas Haerter        //store it
391fa5fcacaSAndreas Haerter        $elements[] = "      ".$interim."\n";
392fa5fcacaSAndreas Haerter    }
393fa5fcacaSAndreas Haerter
394fa5fcacaSAndreas Haerter    //show everything created
395fa5fcacaSAndreas Haerter    if (!empty($elements)){
396fa5fcacaSAndreas Haerter        echo  "\n";
397fa5fcacaSAndreas Haerter        foreach ($elements as $element){
398fa5fcacaSAndreas Haerter            echo $element;
399fa5fcacaSAndreas Haerter        }
400fa5fcacaSAndreas Haerter    }
401fa5fcacaSAndreas Haerter    return true;
402fa5fcacaSAndreas Haerter}
403fa5fcacaSAndreas Haerter
404fa5fcacaSAndreas Haerter//workaround for the "jumping textarea" IE bug. CSS only fix not possible cause
405fa5fcacaSAndreas Haerter//some DokuWiki JavaScript is triggering this bug, too. See the following for
406fa5fcacaSAndreas Haerter//info:
407fa5fcacaSAndreas Haerter//- <http://blog.andreas-haerter.com/2010/05/28/fix-msie-8-auto-scroll-textarea-css-width-percentage-bug>
408fa5fcacaSAndreas Haerter//- <http://msdn.microsoft.com/library/cc817574.aspx>
409fa5fcacaSAndreas Haerterif ($ACT === "edit" &&
410fa5fcacaSAndreas Haerter    !headers_sent()){
411fa5fcacaSAndreas Haerter    header("X-UA-Compatible: IE=EmulateIE7");
412fa5fcacaSAndreas Haerter}
413fa5fcacaSAndreas Haerter
414fa5fcacaSAndreas Haerter?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
415fa5fcacaSAndreas Haerter  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
416098e70cbSAndreas 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"]); ?>">
417fa5fcacaSAndreas Haerter<head>
418fa5fcacaSAndreas Haerter<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
419fa5fcacaSAndreas Haerter<title><?php tpl_pagetitle(); echo " - ".hsc($conf["title"]); ?></title>
420fa5fcacaSAndreas Haerter<?php
421fa5fcacaSAndreas Haerter//show meta-tags
422fa5fcacaSAndreas Haertertpl_metaheaders();
423766a7074SAndreas Haerterecho "<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\" />";
424fa5fcacaSAndreas Haerter
425fa5fcacaSAndreas Haerter//manually load needed CSS? this is a workaround for PHP Bug #49642. In some
426fa5fcacaSAndreas Haerter//version/os combinations PHP is not able to parse INI-file entries if there
427fa5fcacaSAndreas Haerter//are slashes "/" used for the keynames (see bugreport for more information:
428fa5fcacaSAndreas Haerter//<http://bugs.php.net/bug.php?id=49692>). to trigger this workaround, simply
429fa5fcacaSAndreas Haerter//delete/rename vector's style.ini.
430fa5fcacaSAndreas Haerterif (!file_exists(DOKU_TPLINC."style.ini")){
431fa5fcacaSAndreas Haerter    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
432fa5fcacaSAndreas Haerter}
433fa5fcacaSAndreas Haerter
434fa5fcacaSAndreas Haerter//include default or userdefined favicon
4358442308bSAndreas Haerter//
4368442308bSAndreas Haerter//note: since 2011-04-22 "Rincewind RC1", there is a core function named
4378442308bSAndreas Haerter//      "tpl_getFavicon()". But its functionality is not really fitting the
4388442308bSAndreas Haerter//      behaviour of this template, therefore I don't use it here.
439fa5fcacaSAndreas Haerterif (file_exists(DOKU_TPLINC."user/favicon.ico")){
440fa5fcacaSAndreas Haerter    //user defined - you might find http://tools.dynamicdrive.com/favicon/
441fa5fcacaSAndreas Haerter    //useful to generate one
442fa5fcacaSAndreas Haerter    echo "\n<link rel=\"shortcut icon\" href=\"".DOKU_TPL."user/favicon.ico\" />\n";
443fa5fcacaSAndreas Haerter}elseif (file_exists(DOKU_TPLINC."user/favicon.png")){
444fa5fcacaSAndreas Haerter    //note: I do NOT recommend PNG for favicons (cause it is not supported by
445fa5fcacaSAndreas Haerter    //all browsers), but some users requested this feature.
446fa5fcacaSAndreas Haerter    echo "\n<link rel=\"shortcut icon\" href=\"".DOKU_TPL."user/favicon.png\" />\n";
447fa5fcacaSAndreas Haerter}else{
448fa5fcacaSAndreas Haerter    //default
449fa5fcacaSAndreas Haerter    echo "\n<link rel=\"shortcut icon\" href=\"".DOKU_TPL."static/3rd/dokuwiki/favicon.ico\" />\n";
450fa5fcacaSAndreas Haerter}
451fa5fcacaSAndreas Haerter
452f797b6b0SAndreas Haerter//include default or userdefined Apple Touch Icon (see <http://j.mp/sx3NMT> for
453f797b6b0SAndreas Haerter//details)
454f797b6b0SAndreas Haerterif (file_exists(DOKU_TPLINC."user/apple-touch-icon.png")){
455f797b6b0SAndreas Haerter    echo "<link rel=\"apple-touch-icon\" href=\"".DOKU_TPL."user/apple-touch-icon.png\" />\n";
456f797b6b0SAndreas Haerter}else{
457f797b6b0SAndreas Haerter    //default
458f797b6b0SAndreas Haerter    echo "<link rel=\"apple-touch-icon\" href=\"".DOKU_TPL."static/3rd/dokuwiki/apple-touch-icon.png\" />\n";
459f797b6b0SAndreas Haerter}
460f797b6b0SAndreas Haerter
461fa5fcacaSAndreas Haerter//load userdefined js?
462fa5fcacaSAndreas Haerterif (tpl_getConf("vector_loaduserjs")){
463fa5fcacaSAndreas Haerter    echo "<script type=\"text/javascript\" charset=\"utf-8\" src=\"".DOKU_TPL."user/user.js\"></script>\n";
464fa5fcacaSAndreas Haerter}
465fa5fcacaSAndreas Haerter
466fa5fcacaSAndreas Haerter//show printable version?
467fa5fcacaSAndreas Haerterif ($vector_action === "print"){
468fa5fcacaSAndreas Haerter  //note: this is just a workaround for people searching for a print version.
469fa5fcacaSAndreas Haerter  //      don't forget to update the styles.ini, this is the really important
470fa5fcacaSAndreas Haerter  //      thing! BTW: good text about this: http://is.gd/5MyG5
471fa5fcacaSAndreas Haerter  echo  "<link rel=\"stylesheet\" media=\"all\" type=\"text/css\" href=\"".DOKU_TPL."static/3rd/dokuwiki/print.css\" />\n"
472fa5fcacaSAndreas Haerter       ."<link rel=\"stylesheet\" media=\"all\" type=\"text/css\" href=\"".DOKU_TPL."static/css/print.css\" />\n"
473fa5fcacaSAndreas Haerter       ."<link rel=\"stylesheet\" media=\"all\" type=\"text/css\" href=\"".DOKU_TPL."user/print.css\" />\n";
474fa5fcacaSAndreas Haerter}
4756d885141SAndreas Haerter
476fa5fcacaSAndreas Haerter//load language specific css hacks?
477fa5fcacaSAndreas Haerterif (file_exists(DOKU_TPLINC."lang/".$conf["lang"]."/style.css")){
478fa5fcacaSAndreas Haerter  $interim = trim(file_get_contents(DOKU_TPLINC."lang/".$conf["lang"]."/style.css"));
479fa5fcacaSAndreas Haerter  if (!empty($interim)){
480fa5fcacaSAndreas Haerter      echo "<style type=\"text/css\" media=\"all\">\n".hsc($interim)."\n</style>\n";
481fa5fcacaSAndreas Haerter  }
482fa5fcacaSAndreas Haerter}
483fa5fcacaSAndreas Haerter?>
484*ab856294SAndreas Haerter<!--[if lte IE 8]><link rel="stylesheet" media="all" type="text/css" href="<?php echo DOKU_TPL; ?>static/css/screen_iehacks.css" /><![endif]-->
485fa5fcacaSAndreas Haerter<!--[if lt IE 7]><style type="text/css">body{behavior:url("<?php echo DOKU_TPL; ?>static/3rd/vector/csshover.htc")}</style><![endif]-->
486fa5fcacaSAndreas Haerter</head>
487fa5fcacaSAndreas Haerter<body class="<?php
488fa5fcacaSAndreas Haerter             //different styles/backgrounds for different page types
489fa5fcacaSAndreas Haerter             switch (true){
490fa5fcacaSAndreas Haerter                  //special: tech
491fa5fcacaSAndreas Haerter                  case ($vector_action === "detail"):
492fa5fcacaSAndreas Haerter                  case ($vector_action === "cite"):
4936d885141SAndreas Haerter                  case ($ACT === "media"): //var comes from DokuWiki
494fa5fcacaSAndreas Haerter                  case ($ACT === "search"): //var comes from DokuWiki
495fa5fcacaSAndreas Haerter                    echo "mediawiki ltr ns-1 ns-special ";
496fa5fcacaSAndreas Haerter                    break;
497fa5fcacaSAndreas Haerter                  //special: wiki
498fa5fcacaSAndreas Haerter                  case (preg_match("/^wiki$|^wiki:.*?$/i", getNS(getID()))):
499fa5fcacaSAndreas Haerter                    case "mediawiki ltr capitalize-all-nouns ns-4 ns-subject ";
500fa5fcacaSAndreas Haerter                    break;
501fa5fcacaSAndreas Haerter                  //discussion
502fa5fcacaSAndreas Haerter                  case ($vector_context === "discuss"):
503fa5fcacaSAndreas Haerter                    echo "mediawiki ltr capitalize-all-nouns ns-1 ns-talk ";
504fa5fcacaSAndreas Haerter                    break;
505fa5fcacaSAndreas Haerter                  //"normal" content
506fa5fcacaSAndreas Haerter                  case ($ACT === "edit"): //var comes from DokuWiki
507fa5fcacaSAndreas Haerter                  case ($ACT === "draft"): //var comes from DokuWiki
508fa5fcacaSAndreas Haerter                  case ($ACT === "revisions"): //var comes from DokuWiki
509fa5fcacaSAndreas Haerter                  case ($vector_action === "print"):
510fa5fcacaSAndreas Haerter                  default:
511fa5fcacaSAndreas Haerter                    echo "mediawiki ltr capitalize-all-nouns ns-0 ns-subject ";
512fa5fcacaSAndreas Haerter                    break;
513fa5fcacaSAndreas Haerter              } ?>skin-vector">
514bde4d8fbSAndreas Haerter<div id="page-container">
515fa5fcacaSAndreas Haerter<div id="page-base" class="noprint"></div>
516fa5fcacaSAndreas Haerter<div id="head-base" class="noprint"></div>
517fa5fcacaSAndreas Haerter
518fa5fcacaSAndreas Haerter<!-- start div id=content -->
519fa5fcacaSAndreas Haerter<div id="content">
520fa5fcacaSAndreas Haerter  <a name="top" id="top"></a>
521fa5fcacaSAndreas Haerter  <a name="dokuwiki__top" id="dokuwiki__top"></a>
522fa5fcacaSAndreas Haerter
523fa5fcacaSAndreas Haerter  <!-- start main content area -->
524fa5fcacaSAndreas Haerter  <?php
525fa5fcacaSAndreas Haerter  //show messages (if there are any)
526fa5fcacaSAndreas Haerter  html_msgarea();
527fa5fcacaSAndreas Haerter  //show site notice
528fa5fcacaSAndreas Haerter  if (tpl_getConf("vector_sitenotice")){
5294d8721d7SAndreas Haerter      //detect wiki page to load as content
5304d8721d7SAndreas Haerter      if (!empty($transplugin) && //var comes from conf/boxes.php
5314d8721d7SAndreas Haerter          is_object($transplugin) &&
5324d8721d7SAndreas Haerter          tpl_getConf("vector_sitenotice_translate")){
5334d8721d7SAndreas Haerter          //translated site notice?
5344d8721d7SAndreas Haerter          $transplugin_langcur = $transplugin->hlp->getLangPart(cleanID(getId())); //current language part
5354d8721d7SAndreas Haerter          $transplugin_langs   = explode(" ", trim($transplugin->getConf("translations"))); //available languages
5364d8721d7SAndreas Haerter          if (empty($transplugin_langs) ||
5374d8721d7SAndreas Haerter              empty($transplugin_langcur) ||
5384d8721d7SAndreas Haerter              !is_array($transplugin_langs) ||
5394d8721d7SAndreas Haerter              !in_array($transplugin_langcur, $transplugin_langs)) {
5404d8721d7SAndreas Haerter              //current page is no translation or something is wrong, load default site notice
5414d8721d7SAndreas Haerter              $sitenotice_location = tpl_getConf("vector_sitenotice_location");
5424d8721d7SAndreas Haerter          } else {
5434d8721d7SAndreas Haerter              //load language specific site notice
5444d8721d7SAndreas Haerter              $sitenotice_location = tpl_getConf("vector_sitenotice_location")."_".$transplugin_langcur;
5454d8721d7SAndreas Haerter          }
5464d8721d7SAndreas Haerter      }else{
5474d8721d7SAndreas Haerter          //default site notice, no translation
5484d8721d7SAndreas Haerter          $sitenotice_location = tpl_getConf("vector_sitenotice_location");
5494d8721d7SAndreas Haerter      }
5504d8721d7SAndreas Haerter
551fa5fcacaSAndreas Haerter      //we have to show a custom site notice
552fa5fcacaSAndreas Haerter      if (empty($conf["useacl"]) ||
5534d8721d7SAndreas Haerter          auth_quickaclcheck(cleanID($sitenotice_location)) >= AUTH_READ){ //current user got access?
554fa5fcacaSAndreas Haerter          echo "\n  <div id=\"siteNotice\" class=\"noprint\">\n";
555fa5fcacaSAndreas Haerter          //get the rendered content of the defined wiki article to use as
556fa5fcacaSAndreas Haerter          //custom site notice.
5574d8721d7SAndreas Haerter          $interim = tpl_include_page($sitenotice_location, false);
558fa5fcacaSAndreas Haerter          if ($interim === "" ||
559fa5fcacaSAndreas Haerter              $interim === false){
560fa5fcacaSAndreas Haerter              //show creation/edit link if the defined page got no content
561fa5fcacaSAndreas Haerter              echo "[&#160;";
5624d8721d7SAndreas Haerter              tpl_pagelink($sitenotice_location, hsc($lang["vector_fillplaceholder"]." (".hsc($sitenotice_location).")"));
563fa5fcacaSAndreas Haerter              echo "&#160;]<br />";
564fa5fcacaSAndreas Haerter          }else{
565fa5fcacaSAndreas Haerter              //show the rendered page content
566fa5fcacaSAndreas Haerter              echo  "    <div class=\"dokuwiki\">\n" //dokuwiki CSS class needed cause we are showing rendered page content
567fa5fcacaSAndreas Haerter                   .$interim."\n    "
568fa5fcacaSAndreas Haerter                   ."</div>";
569fa5fcacaSAndreas Haerter          }
570fa5fcacaSAndreas Haerter          echo "\n  </div>\n";
571fa5fcacaSAndreas Haerter      }
572fa5fcacaSAndreas Haerter  }
573fa5fcacaSAndreas Haerter  //show breadcrumps if enabled and position = top
574fa5fcacaSAndreas Haerter  if ($conf["breadcrumbs"] == true &&
5756d885141SAndreas Haerter      $ACT !== "media" && //var comes from DokuWiki
576420ad960SAndreas Haerter      (empty($conf["useacl"]) || //are there any users?
577420ad960SAndreas Haerter       $loginname !== "" || //user is logged in?
578420ad960SAndreas Haerter       !tpl_getConf("vector_closedwiki")) &&
579fa5fcacaSAndreas Haerter      tpl_getConf("vector_breadcrumbs_position") === "top"){
580fa5fcacaSAndreas Haerter      echo "\n  <div class=\"catlinks noprint\"><p>\n    ";
581fa5fcacaSAndreas Haerter      tpl_breadcrumbs();
582fa5fcacaSAndreas Haerter      echo "\n  </p></div>\n";
583fa5fcacaSAndreas Haerter  }
584fa5fcacaSAndreas Haerter  //show hierarchical breadcrumps if enabled and position = top
585fa5fcacaSAndreas Haerter  if ($conf["youarehere"] == true &&
5866d885141SAndreas Haerter      $ACT !== "media" && //var comes from DokuWiki
587420ad960SAndreas Haerter      (empty($conf["useacl"]) || //are there any users?
588420ad960SAndreas Haerter       $loginname !== "" || //user is logged in?
589420ad960SAndreas Haerter       !tpl_getConf("vector_closedwiki")) &&
590fa5fcacaSAndreas Haerter      tpl_getConf("vector_youarehere_position") === "top"){
591fa5fcacaSAndreas Haerter      echo "\n  <div class=\"catlinks noprint\"><p>\n    ";
592fa5fcacaSAndreas Haerter      tpl_youarehere();
593fa5fcacaSAndreas Haerter      echo "\n  </p></div>\n";
594fa5fcacaSAndreas Haerter  }
595fa5fcacaSAndreas Haerter  ?>
596fa5fcacaSAndreas Haerter
597fa5fcacaSAndreas Haerter  <!-- start div id bodyContent -->
598fa5fcacaSAndreas Haerter  <div id="bodyContent" class="dokuwiki">
599fa5fcacaSAndreas Haerter    <!-- start rendered wiki content -->
600fa5fcacaSAndreas Haerter    <?php
601fa5fcacaSAndreas Haerter    //flush the buffer for faster page rendering, heaviest content follows
6023da5abdfSAndreas Haerter    if (function_exists("tpl_flush")) {
6031f09d21bSAndreas Haerter        tpl_flush(); //exists since 2010-11-07 "Anteater"...
6041f09d21bSAndreas Haerter    } else {
6051f09d21bSAndreas Haerter        flush(); //...but I won't loose compatibility to 2009-12-25 "Lemming" right now.
6061f09d21bSAndreas Haerter    }
607fa5fcacaSAndreas Haerter    //decide which type of pagecontent we have to show
608fa5fcacaSAndreas Haerter    switch ($vector_action){
609fa5fcacaSAndreas Haerter        //"image details"
610fa5fcacaSAndreas Haerter        case "detail":
611fa5fcacaSAndreas Haerter            include DOKU_TPLINC."inc_detail.php";
612fa5fcacaSAndreas Haerter            break;
613fa5fcacaSAndreas Haerter        //"cite this article"
614fa5fcacaSAndreas Haerter        case "cite":
615fa5fcacaSAndreas Haerter            include DOKU_TPLINC."inc_cite.php";
616fa5fcacaSAndreas Haerter            break;
617fa5fcacaSAndreas Haerter        //show "normal" content
618fa5fcacaSAndreas Haerter        default:
619fa5fcacaSAndreas Haerter            tpl_content(((tpl_getConf("vector_toc_position") === "article") ? true : false));
620fa5fcacaSAndreas Haerter            break;
621fa5fcacaSAndreas Haerter    }
622fa5fcacaSAndreas Haerter    ?>
623fa5fcacaSAndreas Haerter    <!-- end rendered wiki content -->
624fa5fcacaSAndreas Haerter    <div class="clearer"></div>
625fa5fcacaSAndreas Haerter  </div>
626fa5fcacaSAndreas Haerter  <!-- end div id bodyContent -->
627fa5fcacaSAndreas Haerter
628fa5fcacaSAndreas Haerter  <?php
629fa5fcacaSAndreas Haerter  //show breadcrumps if enabled and position = bottom
630fa5fcacaSAndreas Haerter  if ($conf["breadcrumbs"] == true &&
6316d885141SAndreas Haerter      $ACT !== "media" && //var comes from DokuWiki
632420ad960SAndreas Haerter      (empty($conf["useacl"]) || //are there any users?
633420ad960SAndreas Haerter       $loginname !== "" || //user is logged in?
634420ad960SAndreas Haerter       !tpl_getConf("vector_closedwiki")) &&
635fa5fcacaSAndreas Haerter      tpl_getConf("vector_breadcrumbs_position") === "bottom"){
636fa5fcacaSAndreas Haerter      echo "\n  <div class=\"catlinks noprint\"><p>\n    ";
637fa5fcacaSAndreas Haerter      tpl_breadcrumbs();
638fa5fcacaSAndreas Haerter      echo "\n  </p></div>\n";
639fa5fcacaSAndreas Haerter  }
640fa5fcacaSAndreas Haerter  //show hierarchical breadcrumps if enabled and position = bottom
641fa5fcacaSAndreas Haerter  if ($conf["youarehere"] == true &&
6426d885141SAndreas Haerter      $ACT !== "media" && //var comes from DokuWiki
643420ad960SAndreas Haerter      (empty($conf["useacl"]) || //are there any users?
644420ad960SAndreas Haerter       $loginname !== "" || //user is logged in?
645420ad960SAndreas Haerter       !tpl_getConf("vector_closedwiki")) &&
646fa5fcacaSAndreas Haerter      tpl_getConf("vector_youarehere_position") === "bottom"){
647fa5fcacaSAndreas Haerter      echo "\n  <div class=\"catlinks noprint\"><p>\n    ";
648fa5fcacaSAndreas Haerter      tpl_youarehere();
649fa5fcacaSAndreas Haerter      echo "\n  </p></div>\n";
650fa5fcacaSAndreas Haerter  }
651fa5fcacaSAndreas Haerter  ?>
652fa5fcacaSAndreas Haerter
653fa5fcacaSAndreas Haerter</div>
654fa5fcacaSAndreas Haerter<!-- end div id=content -->
655fa5fcacaSAndreas Haerter
656fa5fcacaSAndreas Haerter
657fa5fcacaSAndreas Haerter<!-- start div id=head -->
658fa5fcacaSAndreas Haerter<div id="head" class="noprint">
659fa5fcacaSAndreas Haerter  <?php
660fa5fcacaSAndreas Haerter  //show personal tools
661fa5fcacaSAndreas Haerter  if (!empty($conf["useacl"])){ //...makes only sense if there are users
662fa5fcacaSAndreas Haerter      echo  "\n"
663fa5fcacaSAndreas Haerter           ."  <div id=\"p-personal\">\n"
664fa5fcacaSAndreas Haerter           ."    <ul>\n";
665fa5fcacaSAndreas Haerter      //login?
666fa5fcacaSAndreas Haerter      if ($loginname === ""){
667fa5fcacaSAndreas 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
668fa5fcacaSAndreas Haerter      }else{
669fa5fcacaSAndreas Haerter          //username and userpage
670fa5fcacaSAndreas Haerter          echo "      <li id=\"pt-userpage\">".(tpl_getConf("vector_userpage")
671fa5fcacaSAndreas Haerter                                                ? html_wikilink(tpl_getConf("vector_userpage_ns").$loginname, hsc($loginname))
672fa5fcacaSAndreas Haerter                                                : hsc($loginname))."</li>";
673fa5fcacaSAndreas Haerter          //personal discussion
674fa5fcacaSAndreas Haerter          if (tpl_getConf("vector_discuss") &&
675fa5fcacaSAndreas Haerter              tpl_getConf("vector_userpage")){
676fa5fcacaSAndreas 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>";
677fa5fcacaSAndreas Haerter          }
678fa5fcacaSAndreas Haerter          //admin
679fa5fcacaSAndreas Haerter          if (!empty($INFO["isadmin"]) ||
680fa5fcacaSAndreas Haerter              !empty($INFO["ismanager"])){
681fa5fcacaSAndreas 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
682fa5fcacaSAndreas Haerter          }
683fa5fcacaSAndreas Haerter          //profile
684aa6ef13eSAndreas Haerter          if (actionOK("profile")){ //check if action is disabled
685fa5fcacaSAndreas 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
686aa6ef13eSAndreas Haerter          }
687fa5fcacaSAndreas Haerter          //logout
688fa5fcacaSAndreas 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
689fa5fcacaSAndreas Haerter      }
690fa5fcacaSAndreas Haerter      echo  "    </ul>\n"
691fa5fcacaSAndreas Haerter           ."  </div>\n";
692fa5fcacaSAndreas Haerter  }
693fa5fcacaSAndreas Haerter  ?>
694fa5fcacaSAndreas Haerter
695fa5fcacaSAndreas Haerter  <!-- start div id=left-navigation -->
696fa5fcacaSAndreas Haerter  <div id="left-navigation">
697fa5fcacaSAndreas Haerter    <div id="p-namespaces" class="vectorTabs">
698fa5fcacaSAndreas Haerter      <ul><?php
699fa5fcacaSAndreas Haerter          //show tabs: left. see vector/user/tabs.php to configure them
700fa5fcacaSAndreas Haerter          if (!empty($_vector_tabs_left) &&
701fa5fcacaSAndreas Haerter              is_array($_vector_tabs_left)){
702fa5fcacaSAndreas Haerter              _vector_renderTabs($_vector_tabs_left);
703fa5fcacaSAndreas Haerter          }
704fa5fcacaSAndreas Haerter          ?>
705fa5fcacaSAndreas Haerter
706fa5fcacaSAndreas Haerter      </ul>
707fa5fcacaSAndreas Haerter    </div>
708fa5fcacaSAndreas Haerter  </div>
709fa5fcacaSAndreas Haerter  <!-- end div id=left-navigation -->
710fa5fcacaSAndreas Haerter
711fa5fcacaSAndreas Haerter  <!-- start div id=right-navigation -->
712fa5fcacaSAndreas Haerter  <div id="right-navigation">
713fa5fcacaSAndreas Haerter    <div id="p-views" class="vectorTabs">
714fa5fcacaSAndreas Haerter      <ul><?php
715fa5fcacaSAndreas Haerter          //show tabs: right. see vector/user/tabs.php to configure them
716fa5fcacaSAndreas Haerter          if (!empty($_vector_tabs_right) &&
717fa5fcacaSAndreas Haerter              is_array($_vector_tabs_right)){
718fa5fcacaSAndreas Haerter              _vector_renderTabs($_vector_tabs_right);
719fa5fcacaSAndreas Haerter          }
720fa5fcacaSAndreas Haerter          ?>
721fa5fcacaSAndreas Haerter
722fa5fcacaSAndreas Haerter      </ul>
723fa5fcacaSAndreas Haerter    </div>
724aa6ef13eSAndreas Haerter<?php if (actionOK("search")){ ?>
725fa5fcacaSAndreas Haerter    <div id="p-search">
726fa5fcacaSAndreas Haerter      <h5>
727fa5fcacaSAndreas Haerter        <label for="qsearch__in"><?php echo hsc($lang["vector_search"]); ?></label>
728fa5fcacaSAndreas Haerter      </h5>
729fa5fcacaSAndreas Haerter      <form action="<?php echo wl(); ?>" accept-charset="utf-8" id="dw__search" name="dw__search">
730fa5fcacaSAndreas Haerter        <input type="hidden" name="do" value="search" />
731fa5fcacaSAndreas Haerter        <div id="simpleSearch">
732fa5fcacaSAndreas Haerter          <input id="qsearch__in" name="id" type="text" accesskey="f" value="" />
733fa5fcacaSAndreas Haerter          <button id="searchButton" type="submit" name="button" title="<?php echo hsc($lang["vector_btn_search_title"]); ?>">&nbsp;</button>
734fa5fcacaSAndreas Haerter        </div>
735fa5fcacaSAndreas Haerter        <div id="qsearch__out" class="ajax_qsearch JSpopup"></div>
736fa5fcacaSAndreas Haerter      </form>
737fa5fcacaSAndreas Haerter    </div>
738aa6ef13eSAndreas Haerter<?php } ?>
739fa5fcacaSAndreas Haerter  </div>
740fa5fcacaSAndreas Haerter  <!-- end div id=right-navigation -->
741fa5fcacaSAndreas Haerter
742fa5fcacaSAndreas Haerter</div>
743fa5fcacaSAndreas Haerter<!-- end div id=head -->
744fa5fcacaSAndreas Haerter
745fa5fcacaSAndreas Haerter<!-- start panel/sidebar -->
746fa5fcacaSAndreas Haerter<div id="panel" class="noprint">
747fa5fcacaSAndreas Haerter  <!-- start logo -->
748fa5fcacaSAndreas Haerter  <div id="p-logo">
749fa5fcacaSAndreas Haerter      <?php
750fa5fcacaSAndreas Haerter      //include default or userdefined logo
751fa5fcacaSAndreas Haerter      echo "<a href=\"".wl()."\" ";
752fa5fcacaSAndreas Haerter      if (file_exists(DOKU_TPLINC."user/logo.png")){
753fa5fcacaSAndreas Haerter          //user defined PNG
754fa5fcacaSAndreas Haerter          echo "style=\"background-image:url(".DOKU_TPL."user/logo.png);\"";
755fa5fcacaSAndreas Haerter      }elseif (file_exists(DOKU_TPLINC."user/logo.gif")){
756fa5fcacaSAndreas Haerter          //user defined GIF
757fa5fcacaSAndreas Haerter          echo "style=\"background-image:url(".DOKU_TPL."user/logo.gif);\"";
758fa5fcacaSAndreas Haerter      }elseif (file_exists(DOKU_TPLINC."user/logo.jpg")){
759fa5fcacaSAndreas Haerter          //user defined JPG
760fa5fcacaSAndreas Haerter          echo "style=\"background-image:url(".DOKU_TPL."user/logo.jpg);\"";
761fa5fcacaSAndreas Haerter      }else{
762fa5fcacaSAndreas Haerter          //default
763fa5fcacaSAndreas Haerter          echo "style=\"background-image:url(".DOKU_TPL."static/3rd/dokuwiki/logo.png);\"";
764fa5fcacaSAndreas Haerter      }
765fa5fcacaSAndreas Haerter      echo " accesskey=\"h\" title=\"[ALT+H]\"></a>\n";
766fa5fcacaSAndreas Haerter      ?>
767fa5fcacaSAndreas Haerter  </div>
768fa5fcacaSAndreas Haerter  <!-- end logo -->
769fa5fcacaSAndreas Haerter
770fa5fcacaSAndreas Haerter  <?php
771fa5fcacaSAndreas Haerter  //show boxes, see vector/user/boxes.php to configure them
772fa5fcacaSAndreas Haerter  if (!empty($_vector_boxes) &&
773fa5fcacaSAndreas Haerter      is_array($_vector_boxes)){
774fa5fcacaSAndreas Haerter      _vector_renderBoxes($_vector_boxes);
775fa5fcacaSAndreas Haerter  }
776fa5fcacaSAndreas Haerter  ?>
777fa5fcacaSAndreas Haerter
778fa5fcacaSAndreas Haerter</div>
779fa5fcacaSAndreas Haerter<!-- end panel/sidebar -->
780bde4d8fbSAndreas Haerter</div>
781bde4d8fbSAndreas Haerter<!-- end page-container -->
782fa5fcacaSAndreas Haerter
783fa5fcacaSAndreas Haerter<!-- start footer -->
78422dbb979SAndreas Haerter<div id="footer" class="noprint">
785fa5fcacaSAndreas Haerter  <ul id="footer-info">
786fa5fcacaSAndreas Haerter    <li id="footer-info-lastmod">
787fa5fcacaSAndreas Haerter      <?php tpl_pageinfo()?><br />
788fa5fcacaSAndreas Haerter    </li>
789fa5fcacaSAndreas Haerter    <?php
790fa5fcacaSAndreas Haerter    //copyright notice
791fa5fcacaSAndreas Haerter    if (tpl_getConf("vector_copyright")){
7926074be2aSAndreas Haerter        //show dokuwiki's default notice?
793fa5fcacaSAndreas Haerter        if (tpl_getConf("vector_copyright_default")){
794fa5fcacaSAndreas Haerter            echo "<li id=\"footer-info-copyright\">\n      <div class=\"dokuwiki\">";  //dokuwiki CSS class needed cause we have to show DokuWiki content
795fa5fcacaSAndreas Haerter            tpl_license(false);
796fa5fcacaSAndreas Haerter            echo "</div>\n    </li>\n";
797fa5fcacaSAndreas Haerter        //show custom notice.
798fa5fcacaSAndreas Haerter        }else{
7994d8721d7SAndreas Haerter            //detect wiki page to load as content
8004d8721d7SAndreas Haerter            if (!empty($transplugin) && //var comes from conf/boxes.php
8014d8721d7SAndreas Haerter                is_object($transplugin) &&
8024d8721d7SAndreas Haerter                tpl_getConf("vector_copyright_translate")){
8034d8721d7SAndreas Haerter                //translated copyright notice?
8044d8721d7SAndreas Haerter                $transplugin_langcur = $transplugin->hlp->getLangPart(cleanID(getId())); //current language part
8054d8721d7SAndreas Haerter                $transplugin_langs   = explode(" ", trim($transplugin->getConf("translations"))); //available languages
8064d8721d7SAndreas Haerter                if (empty($transplugin_langs) ||
8074d8721d7SAndreas Haerter                    empty($transplugin_langcur) ||
8084d8721d7SAndreas Haerter                    !is_array($transplugin_langs) ||
8094d8721d7SAndreas Haerter                    !in_array($transplugin_langcur, $transplugin_langs)) {
8104d8721d7SAndreas Haerter                    //current page is no translation or something is wrong, load default copyright notice
8114d8721d7SAndreas Haerter                    $copyright_location = tpl_getConf("vector_copyright_location");
8124d8721d7SAndreas Haerter                } else {
8134d8721d7SAndreas Haerter                    //load language specific copyright notice
8144d8721d7SAndreas Haerter                    $copyright_location = tpl_getConf("vector_copyright_location")."_".$transplugin_langcur;
8154d8721d7SAndreas Haerter                }
8164d8721d7SAndreas Haerter            }else{
8174d8721d7SAndreas Haerter                //default copyright notice, no translation
8184d8721d7SAndreas Haerter                $copyright_location = tpl_getConf("vector_copyright_location");
8194d8721d7SAndreas Haerter            }
8204d8721d7SAndreas Haerter
821fa5fcacaSAndreas Haerter            if (empty($conf["useacl"]) ||
8224d8721d7SAndreas Haerter                auth_quickaclcheck(cleanID($copyright_location)) >= AUTH_READ){ //current user got access?
823fa5fcacaSAndreas Haerter                echo "<li id=\"footer-info-copyright\">\n        ";
824fa5fcacaSAndreas Haerter                //get the rendered content of the defined wiki article to use as custom notice
8254d8721d7SAndreas Haerter                $interim = tpl_include_page($copyright_location, false);
826fa5fcacaSAndreas Haerter                if ($interim === "" ||
827fa5fcacaSAndreas Haerter                    $interim === false){
828fa5fcacaSAndreas Haerter                    //show creation/edit link if the defined page got no content
829fa5fcacaSAndreas Haerter                    echo "[&#160;";
8304d8721d7SAndreas Haerter                    tpl_pagelink($copyright_location, hsc($lang["vector_fillplaceholder"]." (".hsc($copyright_location).")"));
831fa5fcacaSAndreas Haerter                    echo "&#160;]<br />";
832fa5fcacaSAndreas Haerter                }else{
833fa5fcacaSAndreas Haerter                    //show the rendered page content
834fa5fcacaSAndreas Haerter                    echo  "<div class=\"dokuwiki\">\n" //dokuwiki CSS class needed cause we are showing rendered page content
835fa5fcacaSAndreas Haerter                         .$interim."\n        "
836fa5fcacaSAndreas Haerter                         ."</div>";
837fa5fcacaSAndreas Haerter                }
838fa5fcacaSAndreas Haerter                echo "\n    </li>\n";
839fa5fcacaSAndreas Haerter            }
840fa5fcacaSAndreas Haerter        }
841fa5fcacaSAndreas Haerter    }
842fa5fcacaSAndreas Haerter    ?>
843fa5fcacaSAndreas Haerter  </ul>
84422dbb979SAndreas Haerter  <ul id="footer-places">
845fa5fcacaSAndreas Haerter    <li><?php
846fa5fcacaSAndreas Haerter        //show buttons, see vector/user/buttons.php to configure them
847fa5fcacaSAndreas Haerter        if (!empty($_vector_btns) &&
848fa5fcacaSAndreas Haerter            is_array($_vector_btns)){
849fa5fcacaSAndreas Haerter            _vector_renderButtons($_vector_btns);
850fa5fcacaSAndreas Haerter        }
851fa5fcacaSAndreas Haerter        ?>
852fa5fcacaSAndreas Haerter    </li>
853fa5fcacaSAndreas Haerter  </ul>
854fa5fcacaSAndreas Haerter  <div style="clearer"></div>
855fa5fcacaSAndreas Haerter</div>
856fa5fcacaSAndreas Haerter<!-- end footer -->
857fa5fcacaSAndreas Haerter<?php
858fa5fcacaSAndreas Haerter//provide DokuWiki housekeeping, required in all templates
859fa5fcacaSAndreas Haertertpl_indexerWebBug();
860aa6ef13eSAndreas Haerter
861aa6ef13eSAndreas Haerter//include web analytics software
862aa6ef13eSAndreas Haerterif (file_exists(DOKU_TPLINC."/user/tracker.php")){
863aa6ef13eSAndreas Haerter    include DOKU_TPLINC."/user/tracker.php";
864aa6ef13eSAndreas Haerter}
865fa5fcacaSAndreas Haerter?>
866fa5fcacaSAndreas Haerter
867fa5fcacaSAndreas Haerter</body>
868fa5fcacaSAndreas Haerter</html>
869