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