xref: /template/wikiweko/main.php (revision 76362e2153d2dfc0cf5dfb2ce65edf2e3d71859c)
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 *
139*76362e21SAndreas Haerter * @param array The tab data to render within the snippet. Each element is
140*76362e21SAndreas 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
248*76362e21SAndreas 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 *
315*76362e21SAndreas Haerter * @param array The button data to render within the snippet. Each element is
316*76362e21SAndreas 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();
426766a7074SAndreas Haerterecho "<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\" />";
427fa5fcacaSAndreas Haerter
428fa5fcacaSAndreas Haerter//manually load needed CSS? this is a workaround for PHP Bug #49642. In some
429fa5fcacaSAndreas Haerter//version/os combinations PHP is not able to parse INI-file entries if there
430fa5fcacaSAndreas Haerter//are slashes "/" used for the keynames (see bugreport for more information:
431fa5fcacaSAndreas Haerter//<http://bugs.php.net/bug.php?id=49692>). to trigger this workaround, simply
432fa5fcacaSAndreas Haerter//delete/rename vector's style.ini.
433fa5fcacaSAndreas Haerterif (!file_exists(DOKU_TPLINC."style.ini")){
434fa5fcacaSAndreas 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
435fa5fcacaSAndreas Haerter}
436fa5fcacaSAndreas Haerter
437fa5fcacaSAndreas Haerter//include default or userdefined favicon
4388442308bSAndreas Haerter//
4398442308bSAndreas Haerter//note: since 2011-04-22 "Rincewind RC1", there is a core function named
4408442308bSAndreas Haerter//      "tpl_getFavicon()". But its functionality is not really fitting the
4418442308bSAndreas Haerter//      behaviour of this template, therefore I don't use it here.
442fa5fcacaSAndreas Haerterif (file_exists(DOKU_TPLINC."user/favicon.ico")){
443fa5fcacaSAndreas Haerter    //user defined - you might find http://tools.dynamicdrive.com/favicon/
444fa5fcacaSAndreas Haerter    //useful to generate one
445fa5fcacaSAndreas Haerter    echo "\n<link rel=\"shortcut icon\" href=\"".DOKU_TPL."user/favicon.ico\" />\n";
446fa5fcacaSAndreas Haerter}elseif (file_exists(DOKU_TPLINC."user/favicon.png")){
447fa5fcacaSAndreas Haerter    //note: I do NOT recommend PNG for favicons (cause it is not supported by
448fa5fcacaSAndreas Haerter    //all browsers), but some users requested this feature.
449fa5fcacaSAndreas Haerter    echo "\n<link rel=\"shortcut icon\" href=\"".DOKU_TPL."user/favicon.png\" />\n";
450fa5fcacaSAndreas Haerter}else{
451fa5fcacaSAndreas Haerter    //default
452fa5fcacaSAndreas Haerter    echo "\n<link rel=\"shortcut icon\" href=\"".DOKU_TPL."static/3rd/dokuwiki/favicon.ico\" />\n";
453fa5fcacaSAndreas Haerter}
454fa5fcacaSAndreas Haerter
455f797b6b0SAndreas Haerter//include default or userdefined Apple Touch Icon (see <http://j.mp/sx3NMT> for
456f797b6b0SAndreas Haerter//details)
457f797b6b0SAndreas Haerterif (file_exists(DOKU_TPLINC."user/apple-touch-icon.png")){
458f797b6b0SAndreas Haerter    echo "<link rel=\"apple-touch-icon\" href=\"".DOKU_TPL."user/apple-touch-icon.png\" />\n";
459f797b6b0SAndreas Haerter}else{
460f797b6b0SAndreas Haerter    //default
461f797b6b0SAndreas Haerter    echo "<link rel=\"apple-touch-icon\" href=\"".DOKU_TPL."static/3rd/dokuwiki/apple-touch-icon.png\" />\n";
462f797b6b0SAndreas Haerter}
463f797b6b0SAndreas Haerter
464fa5fcacaSAndreas Haerter//load userdefined js?
46551bf5744SGerrit Uitslagif (tpl_getConf("vector_loaduserjs") && file_exists(DOKU_TPL."user/user.js")){
466fa5fcacaSAndreas Haerter    echo "<script type=\"text/javascript\" charset=\"utf-8\" src=\"".DOKU_TPL."user/user.js\"></script>\n";
467fa5fcacaSAndreas Haerter}
468fa5fcacaSAndreas Haerter
469fa5fcacaSAndreas Haerter//show printable version?
470fa5fcacaSAndreas Haerterif ($vector_action === "print"){
471fa5fcacaSAndreas Haerter  //note: this is just a workaround for people searching for a print version.
472fa5fcacaSAndreas Haerter  //      don't forget to update the styles.ini, this is the really important
473fa5fcacaSAndreas Haerter  //      thing! BTW: good text about this: http://is.gd/5MyG5
474fa5fcacaSAndreas Haerter  echo  "<link rel=\"stylesheet\" media=\"all\" type=\"text/css\" href=\"".DOKU_TPL."static/3rd/dokuwiki/print.css\" />\n"
47551bf5744SGerrit Uitslag       ."<link rel=\"stylesheet\" media=\"all\" type=\"text/css\" href=\"".DOKU_TPL."static/css/print.css\" />\n";
47651bf5744SGerrit Uitslag  if (file_exists(DOKU_TPL."user/print.css")){
47751bf5744SGerrit Uitslag      echo "<link rel=\"stylesheet\" media=\"all\" type=\"text/css\" href=\"".DOKU_TPL."user/print.css\" />\n";
47851bf5744SGerrit Uitslag  }
479fa5fcacaSAndreas Haerter}
4806d885141SAndreas Haerter
481fa5fcacaSAndreas Haerter//load language specific css hacks?
482fa5fcacaSAndreas Haerterif (file_exists(DOKU_TPLINC."lang/".$conf["lang"]."/style.css")){
483fa5fcacaSAndreas Haerter  $interim = trim(file_get_contents(DOKU_TPLINC."lang/".$conf["lang"]."/style.css"));
484fa5fcacaSAndreas Haerter  if (!empty($interim)){
485fa5fcacaSAndreas Haerter      echo "<style type=\"text/css\" media=\"all\">\n".hsc($interim)."\n</style>\n";
486fa5fcacaSAndreas Haerter  }
487fa5fcacaSAndreas Haerter}
488fa5fcacaSAndreas Haerter?>
489ab856294SAndreas Haerter<!--[if lte IE 8]><link rel="stylesheet" media="all" type="text/css" href="<?php echo DOKU_TPL; ?>static/css/screen_iehacks.css" /><![endif]-->
490fa5fcacaSAndreas Haerter<!--[if lt IE 7]><style type="text/css">body{behavior:url("<?php echo DOKU_TPL; ?>static/3rd/vector/csshover.htc")}</style><![endif]-->
491fa5fcacaSAndreas Haerter</head>
492fa5fcacaSAndreas Haerter<body class="<?php
493fa5fcacaSAndreas Haerter             //different styles/backgrounds for different page types
494fa5fcacaSAndreas Haerter             switch (true){
495fa5fcacaSAndreas Haerter                  //special: tech
496fa5fcacaSAndreas Haerter                  case ($vector_action === "detail"):
497fa5fcacaSAndreas Haerter                  case ($vector_action === "cite"):
4986d885141SAndreas Haerter                  case ($ACT === "media"): //var comes from DokuWiki
499fa5fcacaSAndreas Haerter                  case ($ACT === "search"): //var comes from DokuWiki
500fa5fcacaSAndreas Haerter                    echo "mediawiki ltr ns-1 ns-special ";
501fa5fcacaSAndreas Haerter                    break;
502fa5fcacaSAndreas Haerter                  //special: wiki
503fa5fcacaSAndreas Haerter                  case (preg_match("/^wiki$|^wiki:.*?$/i", getNS(getID()))):
504fa5fcacaSAndreas Haerter                    case "mediawiki ltr capitalize-all-nouns ns-4 ns-subject ";
505fa5fcacaSAndreas Haerter                    break;
506fa5fcacaSAndreas Haerter                  //discussion
507fa5fcacaSAndreas Haerter                  case ($vector_context === "discuss"):
508fa5fcacaSAndreas Haerter                    echo "mediawiki ltr capitalize-all-nouns ns-1 ns-talk ";
509fa5fcacaSAndreas Haerter                    break;
510fa5fcacaSAndreas Haerter                  //"normal" content
511fa5fcacaSAndreas Haerter                  case ($ACT === "edit"): //var comes from DokuWiki
512fa5fcacaSAndreas Haerter                  case ($ACT === "draft"): //var comes from DokuWiki
513fa5fcacaSAndreas Haerter                  case ($ACT === "revisions"): //var comes from DokuWiki
514fa5fcacaSAndreas Haerter                  case ($vector_action === "print"):
515fa5fcacaSAndreas Haerter                  default:
516fa5fcacaSAndreas Haerter                    echo "mediawiki ltr capitalize-all-nouns ns-0 ns-subject ";
517fa5fcacaSAndreas Haerter                    break;
518fa5fcacaSAndreas Haerter              } ?>skin-vector">
519bde4d8fbSAndreas Haerter<div id="page-container">
520fa5fcacaSAndreas Haerter<div id="page-base" class="noprint"></div>
521fa5fcacaSAndreas Haerter<div id="head-base" class="noprint"></div>
522fa5fcacaSAndreas Haerter
523fa5fcacaSAndreas Haerter<!-- start div id=content -->
524fa5fcacaSAndreas Haerter<div id="content">
525fa5fcacaSAndreas Haerter  <a name="top" id="top"></a>
526fa5fcacaSAndreas Haerter  <a name="dokuwiki__top" id="dokuwiki__top"></a>
527fa5fcacaSAndreas Haerter
528fa5fcacaSAndreas Haerter  <!-- start main content area -->
529fa5fcacaSAndreas Haerter  <?php
530fa5fcacaSAndreas Haerter  //show messages (if there are any)
531fa5fcacaSAndreas Haerter  html_msgarea();
532fa5fcacaSAndreas Haerter  //show site notice
533fa5fcacaSAndreas Haerter  if (tpl_getConf("vector_sitenotice")){
5344d8721d7SAndreas Haerter      //detect wiki page to load as content
5354d8721d7SAndreas Haerter      if (!empty($transplugin) && //var comes from conf/boxes.php
5364d8721d7SAndreas Haerter          is_object($transplugin) &&
5374d8721d7SAndreas Haerter          tpl_getConf("vector_sitenotice_translate")){
5384d8721d7SAndreas Haerter          //translated site notice?
5394d8721d7SAndreas Haerter          $transplugin_langcur = $transplugin->hlp->getLangPart(cleanID(getId())); //current language part
5404d8721d7SAndreas Haerter          $transplugin_langs   = explode(" ", trim($transplugin->getConf("translations"))); //available languages
5414d8721d7SAndreas Haerter          if (empty($transplugin_langs) ||
5424d8721d7SAndreas Haerter              empty($transplugin_langcur) ||
5434d8721d7SAndreas Haerter              !is_array($transplugin_langs) ||
5444d8721d7SAndreas Haerter              !in_array($transplugin_langcur, $transplugin_langs)) {
5454d8721d7SAndreas Haerter              //current page is no translation or something is wrong, load default site notice
5464d8721d7SAndreas Haerter              $sitenotice_location = tpl_getConf("vector_sitenotice_location");
5474d8721d7SAndreas Haerter          } else {
5484d8721d7SAndreas Haerter              //load language specific site notice
5494d8721d7SAndreas Haerter              $sitenotice_location = tpl_getConf("vector_sitenotice_location")."_".$transplugin_langcur;
5504d8721d7SAndreas Haerter          }
5514d8721d7SAndreas Haerter      }else{
5524d8721d7SAndreas Haerter          //default site notice, no translation
5534d8721d7SAndreas Haerter          $sitenotice_location = tpl_getConf("vector_sitenotice_location");
5544d8721d7SAndreas Haerter      }
5554d8721d7SAndreas Haerter
556fa5fcacaSAndreas Haerter      //we have to show a custom site notice
557fa5fcacaSAndreas Haerter      if (empty($conf["useacl"]) ||
5584d8721d7SAndreas Haerter          auth_quickaclcheck(cleanID($sitenotice_location)) >= AUTH_READ){ //current user got access?
559fa5fcacaSAndreas Haerter          echo "\n  <div id=\"siteNotice\" class=\"noprint\">\n";
560fa5fcacaSAndreas Haerter          //get the rendered content of the defined wiki article to use as
561fa5fcacaSAndreas Haerter          //custom site notice.
5624d8721d7SAndreas Haerter          $interim = tpl_include_page($sitenotice_location, false);
563fa5fcacaSAndreas Haerter          if ($interim === "" ||
564fa5fcacaSAndreas Haerter              $interim === false){
565fa5fcacaSAndreas Haerter              //show creation/edit link if the defined page got no content
566fa5fcacaSAndreas Haerter              echo "[&#160;";
5674d8721d7SAndreas Haerter              tpl_pagelink($sitenotice_location, hsc($lang["vector_fillplaceholder"]." (".hsc($sitenotice_location).")"));
568fa5fcacaSAndreas Haerter              echo "&#160;]<br />";
569fa5fcacaSAndreas Haerter          }else{
570fa5fcacaSAndreas Haerter              //show the rendered page content
571fa5fcacaSAndreas Haerter              echo  "    <div class=\"dokuwiki\">\n" //dokuwiki CSS class needed cause we are showing rendered page content
572fa5fcacaSAndreas Haerter                   .$interim."\n    "
573fa5fcacaSAndreas Haerter                   ."</div>";
574fa5fcacaSAndreas Haerter          }
575fa5fcacaSAndreas Haerter          echo "\n  </div>\n";
576fa5fcacaSAndreas Haerter      }
577fa5fcacaSAndreas Haerter  }
578fa5fcacaSAndreas Haerter  //show breadcrumps if enabled and position = top
579fa5fcacaSAndreas Haerter  if ($conf["breadcrumbs"] == true &&
5806d885141SAndreas Haerter      $ACT !== "media" && //var comes from DokuWiki
581420ad960SAndreas Haerter      (empty($conf["useacl"]) || //are there any users?
582420ad960SAndreas Haerter       $loginname !== "" || //user is logged in?
583420ad960SAndreas Haerter       !tpl_getConf("vector_closedwiki")) &&
584fa5fcacaSAndreas Haerter      tpl_getConf("vector_breadcrumbs_position") === "top"){
585fa5fcacaSAndreas Haerter      echo "\n  <div class=\"catlinks noprint\"><p>\n    ";
586fa5fcacaSAndreas Haerter      tpl_breadcrumbs();
587fa5fcacaSAndreas Haerter      echo "\n  </p></div>\n";
588fa5fcacaSAndreas Haerter  }
589fa5fcacaSAndreas Haerter  //show hierarchical breadcrumps if enabled and position = top
590fa5fcacaSAndreas Haerter  if ($conf["youarehere"] == true &&
5916d885141SAndreas Haerter      $ACT !== "media" && //var comes from DokuWiki
592420ad960SAndreas Haerter      (empty($conf["useacl"]) || //are there any users?
593420ad960SAndreas Haerter       $loginname !== "" || //user is logged in?
594420ad960SAndreas Haerter       !tpl_getConf("vector_closedwiki")) &&
595fa5fcacaSAndreas Haerter      tpl_getConf("vector_youarehere_position") === "top"){
596fa5fcacaSAndreas Haerter      echo "\n  <div class=\"catlinks noprint\"><p>\n    ";
597fa5fcacaSAndreas Haerter      tpl_youarehere();
598fa5fcacaSAndreas Haerter      echo "\n  </p></div>\n";
599fa5fcacaSAndreas Haerter  }
600fa5fcacaSAndreas Haerter  ?>
601fa5fcacaSAndreas Haerter
602fa5fcacaSAndreas Haerter  <!-- start div id bodyContent -->
603fa5fcacaSAndreas Haerter  <div id="bodyContent" class="dokuwiki">
604fa5fcacaSAndreas Haerter    <!-- start rendered wiki content -->
605fa5fcacaSAndreas Haerter    <?php
606fa5fcacaSAndreas Haerter    //flush the buffer for faster page rendering, heaviest content follows
6073da5abdfSAndreas Haerter    if (function_exists("tpl_flush")) {
6081f09d21bSAndreas Haerter        tpl_flush(); //exists since 2010-11-07 "Anteater"...
6091f09d21bSAndreas Haerter    } else {
6101f09d21bSAndreas Haerter        flush(); //...but I won't loose compatibility to 2009-12-25 "Lemming" right now.
6111f09d21bSAndreas Haerter    }
612fa5fcacaSAndreas Haerter    //decide which type of pagecontent we have to show
613fa5fcacaSAndreas Haerter    switch ($vector_action){
614fa5fcacaSAndreas Haerter        //"image details"
615fa5fcacaSAndreas Haerter        case "detail":
616fa5fcacaSAndreas Haerter            include DOKU_TPLINC."inc_detail.php";
617fa5fcacaSAndreas Haerter            break;
618fa5fcacaSAndreas Haerter        //"cite this article"
619fa5fcacaSAndreas Haerter        case "cite":
620fa5fcacaSAndreas Haerter            include DOKU_TPLINC."inc_cite.php";
621fa5fcacaSAndreas Haerter            break;
622fa5fcacaSAndreas Haerter        //show "normal" content
623fa5fcacaSAndreas Haerter        default:
624fa5fcacaSAndreas Haerter            tpl_content(((tpl_getConf("vector_toc_position") === "article") ? true : false));
625fa5fcacaSAndreas Haerter            break;
626fa5fcacaSAndreas Haerter    }
627fa5fcacaSAndreas Haerter    ?>
628fa5fcacaSAndreas Haerter    <!-- end rendered wiki content -->
629fa5fcacaSAndreas Haerter    <div class="clearer"></div>
630fa5fcacaSAndreas Haerter  </div>
631fa5fcacaSAndreas Haerter  <!-- end div id bodyContent -->
632fa5fcacaSAndreas Haerter
633fa5fcacaSAndreas Haerter  <?php
634fa5fcacaSAndreas Haerter  //show breadcrumps if enabled and position = bottom
635fa5fcacaSAndreas Haerter  if ($conf["breadcrumbs"] == true &&
6366d885141SAndreas Haerter      $ACT !== "media" && //var comes from DokuWiki
637420ad960SAndreas Haerter      (empty($conf["useacl"]) || //are there any users?
638420ad960SAndreas Haerter       $loginname !== "" || //user is logged in?
639420ad960SAndreas Haerter       !tpl_getConf("vector_closedwiki")) &&
640fa5fcacaSAndreas Haerter      tpl_getConf("vector_breadcrumbs_position") === "bottom"){
641fa5fcacaSAndreas Haerter      echo "\n  <div class=\"catlinks noprint\"><p>\n    ";
642fa5fcacaSAndreas Haerter      tpl_breadcrumbs();
643fa5fcacaSAndreas Haerter      echo "\n  </p></div>\n";
644fa5fcacaSAndreas Haerter  }
645fa5fcacaSAndreas Haerter  //show hierarchical breadcrumps if enabled and position = bottom
646fa5fcacaSAndreas Haerter  if ($conf["youarehere"] == true &&
6476d885141SAndreas Haerter      $ACT !== "media" && //var comes from DokuWiki
648420ad960SAndreas Haerter      (empty($conf["useacl"]) || //are there any users?
649420ad960SAndreas Haerter       $loginname !== "" || //user is logged in?
650420ad960SAndreas Haerter       !tpl_getConf("vector_closedwiki")) &&
651fa5fcacaSAndreas Haerter      tpl_getConf("vector_youarehere_position") === "bottom"){
652fa5fcacaSAndreas Haerter      echo "\n  <div class=\"catlinks noprint\"><p>\n    ";
653fa5fcacaSAndreas Haerter      tpl_youarehere();
654fa5fcacaSAndreas Haerter      echo "\n  </p></div>\n";
655fa5fcacaSAndreas Haerter  }
656fa5fcacaSAndreas Haerter  ?>
657fa5fcacaSAndreas Haerter
658fa5fcacaSAndreas Haerter</div>
659fa5fcacaSAndreas Haerter<!-- end div id=content -->
660fa5fcacaSAndreas Haerter
661fa5fcacaSAndreas Haerter
662fa5fcacaSAndreas Haerter<!-- start div id=head -->
663fa5fcacaSAndreas Haerter<div id="head" class="noprint">
664fa5fcacaSAndreas Haerter  <?php
665fa5fcacaSAndreas Haerter  //show personal tools
666fa5fcacaSAndreas Haerter  if (!empty($conf["useacl"])){ //...makes only sense if there are users
667fa5fcacaSAndreas Haerter      echo  "\n"
668fa5fcacaSAndreas Haerter           ."  <div id=\"p-personal\">\n"
669fa5fcacaSAndreas Haerter           ."    <ul>\n";
670fa5fcacaSAndreas Haerter      //login?
671fa5fcacaSAndreas Haerter      if ($loginname === ""){
672fa5fcacaSAndreas 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
673fa5fcacaSAndreas Haerter      }else{
674fa5fcacaSAndreas Haerter          //username and userpage
675fa5fcacaSAndreas Haerter          echo "      <li id=\"pt-userpage\">".(tpl_getConf("vector_userpage")
676fa5fcacaSAndreas Haerter                                                ? html_wikilink(tpl_getConf("vector_userpage_ns").$loginname, hsc($loginname))
677fa5fcacaSAndreas Haerter                                                : hsc($loginname))."</li>";
678fa5fcacaSAndreas Haerter          //personal discussion
679fa5fcacaSAndreas Haerter          if (tpl_getConf("vector_discuss") &&
680fa5fcacaSAndreas Haerter              tpl_getConf("vector_userpage")){
681fa5fcacaSAndreas 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>";
682fa5fcacaSAndreas Haerter          }
683fa5fcacaSAndreas Haerter          //admin
684fa5fcacaSAndreas Haerter          if (!empty($INFO["isadmin"]) ||
685fa5fcacaSAndreas Haerter              !empty($INFO["ismanager"])){
686fa5fcacaSAndreas 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
687fa5fcacaSAndreas Haerter          }
688fa5fcacaSAndreas Haerter          //profile
689aa6ef13eSAndreas Haerter          if (actionOK("profile")){ //check if action is disabled
690fa5fcacaSAndreas 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
691aa6ef13eSAndreas Haerter          }
692fa5fcacaSAndreas Haerter          //logout
693fa5fcacaSAndreas 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
694fa5fcacaSAndreas Haerter      }
695fa5fcacaSAndreas Haerter      echo  "    </ul>\n"
696fa5fcacaSAndreas Haerter           ."  </div>\n";
697fa5fcacaSAndreas Haerter  }
698fa5fcacaSAndreas Haerter  ?>
699fa5fcacaSAndreas Haerter
700fa5fcacaSAndreas Haerter  <!-- start div id=left-navigation -->
701fa5fcacaSAndreas Haerter  <div id="left-navigation">
702fa5fcacaSAndreas Haerter    <div id="p-namespaces" class="vectorTabs">
703fa5fcacaSAndreas Haerter      <ul><?php
704fa5fcacaSAndreas Haerter          //show tabs: left. see vector/user/tabs.php to configure them
705fa5fcacaSAndreas Haerter          if (!empty($_vector_tabs_left) &&
706fa5fcacaSAndreas Haerter              is_array($_vector_tabs_left)){
707fa5fcacaSAndreas Haerter              _vector_renderTabs($_vector_tabs_left);
708fa5fcacaSAndreas Haerter          }
709fa5fcacaSAndreas Haerter          ?>
710fa5fcacaSAndreas Haerter
711fa5fcacaSAndreas Haerter      </ul>
712fa5fcacaSAndreas Haerter    </div>
713fa5fcacaSAndreas Haerter  </div>
714fa5fcacaSAndreas Haerter  <!-- end div id=left-navigation -->
715fa5fcacaSAndreas Haerter
716fa5fcacaSAndreas Haerter  <!-- start div id=right-navigation -->
717fa5fcacaSAndreas Haerter  <div id="right-navigation">
718fa5fcacaSAndreas Haerter    <div id="p-views" class="vectorTabs">
719fa5fcacaSAndreas Haerter      <ul><?php
720fa5fcacaSAndreas Haerter          //show tabs: right. see vector/user/tabs.php to configure them
721fa5fcacaSAndreas Haerter          if (!empty($_vector_tabs_right) &&
722fa5fcacaSAndreas Haerter              is_array($_vector_tabs_right)){
723fa5fcacaSAndreas Haerter              _vector_renderTabs($_vector_tabs_right);
724fa5fcacaSAndreas Haerter          }
725fa5fcacaSAndreas Haerter          ?>
726fa5fcacaSAndreas Haerter
727fa5fcacaSAndreas Haerter      </ul>
728fa5fcacaSAndreas Haerter    </div>
729aa6ef13eSAndreas Haerter<?php if (actionOK("search")){ ?>
730fa5fcacaSAndreas Haerter    <div id="p-search">
731fa5fcacaSAndreas Haerter      <h5>
732fa5fcacaSAndreas Haerter        <label for="qsearch__in"><?php echo hsc($lang["vector_search"]); ?></label>
733fa5fcacaSAndreas Haerter      </h5>
734fa5fcacaSAndreas Haerter      <form action="<?php echo wl(); ?>" accept-charset="utf-8" id="dw__search" name="dw__search">
735fa5fcacaSAndreas Haerter        <input type="hidden" name="do" value="search" />
736fa5fcacaSAndreas Haerter        <div id="simpleSearch">
737fa5fcacaSAndreas Haerter          <input id="qsearch__in" name="id" type="text" accesskey="f" value="" />
738fa5fcacaSAndreas Haerter          <button id="searchButton" type="submit" name="button" title="<?php echo hsc($lang["vector_btn_search_title"]); ?>">&nbsp;</button>
739fa5fcacaSAndreas Haerter        </div>
740fa5fcacaSAndreas Haerter        <div id="qsearch__out" class="ajax_qsearch JSpopup"></div>
741fa5fcacaSAndreas Haerter      </form>
742fa5fcacaSAndreas Haerter    </div>
743aa6ef13eSAndreas Haerter<?php } ?>
744fa5fcacaSAndreas Haerter  </div>
745fa5fcacaSAndreas Haerter  <!-- end div id=right-navigation -->
746fa5fcacaSAndreas Haerter
747fa5fcacaSAndreas Haerter</div>
748fa5fcacaSAndreas Haerter<!-- end div id=head -->
749fa5fcacaSAndreas Haerter
750fa5fcacaSAndreas Haerter<!-- start panel/sidebar -->
751fa5fcacaSAndreas Haerter<div id="panel" class="noprint">
752fa5fcacaSAndreas Haerter  <!-- start logo -->
753fa5fcacaSAndreas Haerter  <div id="p-logo">
754fa5fcacaSAndreas Haerter      <?php
755fa5fcacaSAndreas Haerter      //include default or userdefined logo
756fa5fcacaSAndreas Haerter      echo "<a href=\"".wl()."\" ";
757fa5fcacaSAndreas Haerter      if (file_exists(DOKU_TPLINC."user/logo.png")){
758fa5fcacaSAndreas Haerter          //user defined PNG
759fa5fcacaSAndreas Haerter          echo "style=\"background-image:url(".DOKU_TPL."user/logo.png);\"";
760fa5fcacaSAndreas Haerter      }elseif (file_exists(DOKU_TPLINC."user/logo.gif")){
761fa5fcacaSAndreas Haerter          //user defined GIF
762fa5fcacaSAndreas Haerter          echo "style=\"background-image:url(".DOKU_TPL."user/logo.gif);\"";
763fa5fcacaSAndreas Haerter      }elseif (file_exists(DOKU_TPLINC."user/logo.jpg")){
764fa5fcacaSAndreas Haerter          //user defined JPG
765fa5fcacaSAndreas Haerter          echo "style=\"background-image:url(".DOKU_TPL."user/logo.jpg);\"";
766fa5fcacaSAndreas Haerter      }else{
767fa5fcacaSAndreas Haerter          //default
768fa5fcacaSAndreas Haerter          echo "style=\"background-image:url(".DOKU_TPL."static/3rd/dokuwiki/logo.png);\"";
769fa5fcacaSAndreas Haerter      }
770fa5fcacaSAndreas Haerter      echo " accesskey=\"h\" title=\"[ALT+H]\"></a>\n";
771fa5fcacaSAndreas Haerter      ?>
772fa5fcacaSAndreas Haerter  </div>
773fa5fcacaSAndreas Haerter  <!-- end logo -->
774fa5fcacaSAndreas Haerter
775fa5fcacaSAndreas Haerter  <?php
776fa5fcacaSAndreas Haerter  //show boxes, see vector/user/boxes.php to configure them
777fa5fcacaSAndreas Haerter  if (!empty($_vector_boxes) &&
778fa5fcacaSAndreas Haerter      is_array($_vector_boxes)){
779fa5fcacaSAndreas Haerter      _vector_renderBoxes($_vector_boxes);
780fa5fcacaSAndreas Haerter  }
781fa5fcacaSAndreas Haerter  ?>
782fa5fcacaSAndreas Haerter
783fa5fcacaSAndreas Haerter</div>
784fa5fcacaSAndreas Haerter<!-- end panel/sidebar -->
785bde4d8fbSAndreas Haerter</div>
786bde4d8fbSAndreas Haerter<!-- end page-container -->
787fa5fcacaSAndreas Haerter
788fa5fcacaSAndreas Haerter<!-- start footer -->
78922dbb979SAndreas Haerter<div id="footer" class="noprint">
790fa5fcacaSAndreas Haerter  <ul id="footer-info">
791fa5fcacaSAndreas Haerter    <li id="footer-info-lastmod">
792fa5fcacaSAndreas Haerter      <?php tpl_pageinfo()?><br />
793fa5fcacaSAndreas Haerter    </li>
794fa5fcacaSAndreas Haerter    <?php
795fa5fcacaSAndreas Haerter    //copyright notice
796fa5fcacaSAndreas Haerter    if (tpl_getConf("vector_copyright")){
7976074be2aSAndreas Haerter        //show dokuwiki's default notice?
798fa5fcacaSAndreas Haerter        if (tpl_getConf("vector_copyright_default")){
799fa5fcacaSAndreas Haerter            echo "<li id=\"footer-info-copyright\">\n      <div class=\"dokuwiki\">";  //dokuwiki CSS class needed cause we have to show DokuWiki content
800fa5fcacaSAndreas Haerter            tpl_license(false);
801fa5fcacaSAndreas Haerter            echo "</div>\n    </li>\n";
802fa5fcacaSAndreas Haerter        //show custom notice.
803fa5fcacaSAndreas Haerter        }else{
8044d8721d7SAndreas Haerter            //detect wiki page to load as content
8054d8721d7SAndreas Haerter            if (!empty($transplugin) && //var comes from conf/boxes.php
8064d8721d7SAndreas Haerter                is_object($transplugin) &&
8074d8721d7SAndreas Haerter                tpl_getConf("vector_copyright_translate")){
8084d8721d7SAndreas Haerter                //translated copyright notice?
8094d8721d7SAndreas Haerter                $transplugin_langcur = $transplugin->hlp->getLangPart(cleanID(getId())); //current language part
8104d8721d7SAndreas Haerter                $transplugin_langs   = explode(" ", trim($transplugin->getConf("translations"))); //available languages
8114d8721d7SAndreas Haerter                if (empty($transplugin_langs) ||
8124d8721d7SAndreas Haerter                    empty($transplugin_langcur) ||
8134d8721d7SAndreas Haerter                    !is_array($transplugin_langs) ||
8144d8721d7SAndreas Haerter                    !in_array($transplugin_langcur, $transplugin_langs)) {
8154d8721d7SAndreas Haerter                    //current page is no translation or something is wrong, load default copyright notice
8164d8721d7SAndreas Haerter                    $copyright_location = tpl_getConf("vector_copyright_location");
8174d8721d7SAndreas Haerter                } else {
8184d8721d7SAndreas Haerter                    //load language specific copyright notice
8194d8721d7SAndreas Haerter                    $copyright_location = tpl_getConf("vector_copyright_location")."_".$transplugin_langcur;
8204d8721d7SAndreas Haerter                }
8214d8721d7SAndreas Haerter            }else{
8224d8721d7SAndreas Haerter                //default copyright notice, no translation
8234d8721d7SAndreas Haerter                $copyright_location = tpl_getConf("vector_copyright_location");
8244d8721d7SAndreas Haerter            }
8254d8721d7SAndreas Haerter
826fa5fcacaSAndreas Haerter            if (empty($conf["useacl"]) ||
8274d8721d7SAndreas Haerter                auth_quickaclcheck(cleanID($copyright_location)) >= AUTH_READ){ //current user got access?
828fa5fcacaSAndreas Haerter                echo "<li id=\"footer-info-copyright\">\n        ";
829fa5fcacaSAndreas Haerter                //get the rendered content of the defined wiki article to use as custom notice
8304d8721d7SAndreas Haerter                $interim = tpl_include_page($copyright_location, false);
831fa5fcacaSAndreas Haerter                if ($interim === "" ||
832fa5fcacaSAndreas Haerter                    $interim === false){
833fa5fcacaSAndreas Haerter                    //show creation/edit link if the defined page got no content
834fa5fcacaSAndreas Haerter                    echo "[&#160;";
8354d8721d7SAndreas Haerter                    tpl_pagelink($copyright_location, hsc($lang["vector_fillplaceholder"]." (".hsc($copyright_location).")"));
836fa5fcacaSAndreas Haerter                    echo "&#160;]<br />";
837fa5fcacaSAndreas Haerter                }else{
838fa5fcacaSAndreas Haerter                    //show the rendered page content
839fa5fcacaSAndreas Haerter                    echo  "<div class=\"dokuwiki\">\n" //dokuwiki CSS class needed cause we are showing rendered page content
840fa5fcacaSAndreas Haerter                         .$interim."\n        "
841fa5fcacaSAndreas Haerter                         ."</div>";
842fa5fcacaSAndreas Haerter                }
843fa5fcacaSAndreas Haerter                echo "\n    </li>\n";
844fa5fcacaSAndreas Haerter            }
845fa5fcacaSAndreas Haerter        }
846fa5fcacaSAndreas Haerter    }
847fa5fcacaSAndreas Haerter    ?>
848fa5fcacaSAndreas Haerter  </ul>
84922dbb979SAndreas Haerter  <ul id="footer-places">
850fa5fcacaSAndreas Haerter    <li><?php
851fa5fcacaSAndreas Haerter        //show buttons, see vector/user/buttons.php to configure them
852fa5fcacaSAndreas Haerter        if (!empty($_vector_btns) &&
853fa5fcacaSAndreas Haerter            is_array($_vector_btns)){
854fa5fcacaSAndreas Haerter            _vector_renderButtons($_vector_btns);
855fa5fcacaSAndreas Haerter        }
856fa5fcacaSAndreas Haerter        ?>
857fa5fcacaSAndreas Haerter    </li>
858fa5fcacaSAndreas Haerter  </ul>
859fa5fcacaSAndreas Haerter  <div style="clearer"></div>
860fa5fcacaSAndreas Haerter</div>
861fa5fcacaSAndreas Haerter<!-- end footer -->
862fa5fcacaSAndreas Haerter<?php
863fa5fcacaSAndreas Haerter//provide DokuWiki housekeeping, required in all templates
864fa5fcacaSAndreas Haertertpl_indexerWebBug();
865aa6ef13eSAndreas Haerter
866aa6ef13eSAndreas Haerter//include web analytics software
867aa6ef13eSAndreas Haerterif (file_exists(DOKU_TPLINC."/user/tracker.php")){
868aa6ef13eSAndreas Haerter    include DOKU_TPLINC."/user/tracker.php";
869aa6ef13eSAndreas Haerter}
870fa5fcacaSAndreas Haerter?>
871fa5fcacaSAndreas Haerter
872fa5fcacaSAndreas Haerter</body>
873fa5fcacaSAndreas Haerter</html>
874