PageRenderTime 60ms CodeModel.GetById 26ms RepoModel.GetById 1ms app.codeStats 0ms

/wiki/lib/tpl/vector/main.php

https://github.com/gbby/folders2web
PHP | 813 lines | 478 code | 64 blank | 271 comment | 71 complexity | 469338f299a933b9500a3fbf54575974 MD5 | raw file
Possible License(s): GPL-2.0
  1. <?php
  2. /**
  3. * Main file of the "vector" template for DokuWiki
  4. *
  5. *
  6. * LICENSE: This file is open source software (OSS) and may be copied under
  7. * certain conditions. See COPYING file for details or try to contact
  8. * the author(s) of this file in doubt.
  9. *
  10. * @license GPLv2 (http://www.gnu.org/licenses/gpl2.html)
  11. * @author Andreas Haerter <development@andreas-haerter.com>
  12. * @link http://andreas-haerter.com/projects/dokuwiki-template-vector
  13. * @link http://www.dokuwiki.org/template:vector
  14. * @link http://www.dokuwiki.org/devel:templates
  15. * @link http://www.dokuwiki.org/devel:coding_style
  16. * @link http://www.dokuwiki.org/devel:environment
  17. * @link http://www.dokuwiki.org/devel:action_modes
  18. */
  19. //check if we are running within the DokuWiki environment
  20. if (!defined("DOKU_INC")){
  21. die();
  22. }
  23. ini_set('display_errors', false);
  24. /**
  25. * Stores the template wide action
  26. *
  27. * Different DokuWiki actions requiring some template logic. Therefore the
  28. * template has to know, what we are doing right now - and that is what this
  29. * var is for.
  30. *
  31. * Please have a look at the "mediamanager.php" and "detail.php" file in the
  32. * same folder, they are also influencing the var's value.
  33. *
  34. * @var string
  35. * @author Andreas Haerter <development@andreas-haerter.com>
  36. */
  37. $vector_action = "article";
  38. //note: I used $_REQUEST before (cause DokuWiki controls and fills it. Normally,
  39. // using $_REQUEST is a possible security threat. For details, see
  40. // <http://www.suspekt.org/2008/10/01/php-53-and-delayed-cross-site-request-forgerieshijacking/>
  41. // and <http://forum.dokuwiki.org/post/16524>), but it did not work as
  42. // expected by me (maybe it is a reference and setting $vector_action
  43. // also changed the contents of $_REQUEST?!). That is why I switched back,
  44. // checking $_GET and $_POST like I did it before.
  45. if (!empty($_GET["vecdo"])){
  46. $vector_action = (string)$_GET["vecdo"];
  47. }elseif (!empty($_POST["vecdo"])){
  48. $vector_action = (string)$_POST["vecdo"];
  49. }
  50. if (!empty($vector_action) &&
  51. $vector_action !== "article" &&
  52. $vector_action !== "print" &&
  53. $vector_action !== "detail" &&
  54. $vector_action !== "mediamanager" &&
  55. $vector_action !== "cite"){
  56. //ignore unknown values
  57. $vector_action = "article";
  58. }
  59. /**
  60. * Stores the template wide context
  61. *
  62. * This template offers discussion pages via common articles, which should be
  63. * marked as "special". DokuWiki does not know any "special" articles, therefore
  64. * we have to take care about detecting if the current page is a discussion
  65. * page or not.
  66. *
  67. * @var string
  68. * @author Andreas Haerter <development@andreas-haerter.com>
  69. */
  70. $vector_context = "article";
  71. if (preg_match("/^".tpl_getConf("vector_discuss_ns")."?$|^".tpl_getConf("vector_discuss_ns").".*?$/i", ":".getNS(getID()))){
  72. $vector_context = "discuss";
  73. }
  74. /**
  75. * Stores the name the current client used to login
  76. *
  77. * @var string
  78. * @author Andreas Haerter <development@andreas-haerter.com>
  79. */
  80. $loginname = "";
  81. if (!empty($conf["useacl"])){
  82. if (isset($_SERVER["REMOTE_USER"]) && //no empty() but isset(): "0" may be a valid username...
  83. $_SERVER["REMOTE_USER"] !== ""){
  84. $loginname = $_SERVER["REMOTE_USER"]; //$INFO["client"] would not work here (-> e.g. if
  85. //current IP differs from the one used to login)
  86. }
  87. }
  88. //get needed language array
  89. include DOKU_TPLINC."lang/en/lang.php";
  90. //overwrite English language values with available translations
  91. if (!empty($conf["lang"]) &&
  92. $conf["lang"] !== "en" &&
  93. file_exists(DOKU_TPLINC."/lang/".$conf["lang"]."/lang.php")){
  94. //get language file (partially translated language files are no problem
  95. //cause non translated stuff is still existing as English array value)
  96. include DOKU_TPLINC."/lang/".$conf["lang"]."/lang.php";
  97. }
  98. //detect revision
  99. $rev = (int)$INFO["rev"]; //$INFO comes from the DokuWiki core
  100. if ($rev < 1){
  101. $rev = (int)$INFO["lastmod"];
  102. }
  103. //get tab config
  104. include DOKU_TPLINC."/conf/tabs.php"; //default
  105. if (file_exists(DOKU_TPLINC."/user/tabs.php")){
  106. include DOKU_TPLINC."/user/tabs.php"; //add user defined
  107. }
  108. //get boxes config
  109. include DOKU_TPLINC."/conf/boxes.php"; //default
  110. if (file_exists(DOKU_TPLINC."/user/boxes.php")){
  111. include DOKU_TPLINC."/user/boxes.php"; //add user defined
  112. }
  113. //get button config
  114. include DOKU_TPLINC."/conf/buttons.php"; //default
  115. if (file_exists(DOKU_TPLINC."/user/buttons.php")){
  116. include DOKU_TPLINC."/user/buttons.php"; //add user defined
  117. }
  118. /**
  119. * Helper to render the tabs (like a dynamic XHTML snippet)
  120. *
  121. * @param array The tab data to render within the snippet. Each element
  122. * is represented through a subarray:
  123. * $array = array("tab1" => array("text" => "hello world!",
  124. * "href" => "http://www.example.com"
  125. * "nofollow" => true),
  126. * "tab2" => array("text" => "I did it again",
  127. * "href" => DOKU_BASE."doku.php?id=foobar",
  128. * "class" => "foobar-css"),
  129. * "tab3" => array("text" => "I did it again and again",
  130. * "href" => wl("start", false, false, "&"),
  131. * "class" => "foobar-css"),
  132. * "tab4" => array("text" => "Home",
  133. * "wiki" => ":start"
  134. * "accesskey" => "H"));
  135. * Available keys within the subarrays:
  136. * - "text" (mandatory)
  137. * The text/label of the element.
  138. * - "href" (optional)
  139. * URL the element should point to (as link). Please submit raw,
  140. * unencoded URLs, the encoding will be done by this function for
  141. * security reasons. If the URL is not relative
  142. * (= starts with http(s)://), the URL will be treated as external
  143. * (=a special style will be used if "class" is not set).
  144. * - "wiki" (optional)
  145. * ID of a WikiPage to link (like ":start" or ":wiki:foobar").
  146. * - "class" (optional)
  147. * Name of an additional CSS class to use for the element content.
  148. * Works only in combination with "text" or "href", NOT with "wiki"
  149. * (will be ignored in this case).
  150. * - "nofollow" (optional)
  151. * If set to TRUE, rel="nofollow" will be added to the link if "href"
  152. * is set (otherwise this flag will do nothing).
  153. * - "accesskey" (optional)
  154. * accesskey="<value>" will be added to the link if "href" is set
  155. * (otherwise this option will do nothing).
  156. * @author Andreas Haerter <development@andreas-haerter.com>
  157. * @see _vector_renderButtons()
  158. * @see _vector_renderBoxes()
  159. * @link http://www.wikipedia.org/wiki/Nofollow
  160. * @link http://de.selfhtml.org/html/verweise/tastatur.htm#kuerzel
  161. * @link http://www.dokuwiki.org/devel:environment
  162. * @link http://www.dokuwiki.org/devel:coding_style
  163. */
  164. function _vector_renderTabs($arr)
  165. {
  166. //is there something useful?
  167. if (empty($arr) ||
  168. !is_array($arr)){
  169. return false; //nope, break operation
  170. }
  171. //array to store the created tabs into
  172. $elements = array();
  173. //handle the tab data
  174. foreach($arr as $li_id => $element){
  175. //basic check
  176. if (empty($element) ||
  177. !is_array($element) ||
  178. !isset($element["text"]) ||
  179. (empty($element["href"]) &&
  180. empty($element["wiki"]))){
  181. continue; //ignore invalid stuff and go on
  182. }
  183. $li_created = true; //flag to control if we created any list element
  184. $interim = "";
  185. //do we have an external link?
  186. if (!empty($element["href"])){
  187. //add URL
  188. $interim = "<a href=\"".hsc($element["href"])."\""; //@TODO: real URL encoding
  189. //add rel="nofollow" attribute to the link?
  190. if (!empty($element["nofollow"])){
  191. $interim .= " rel=\"nofollow\"";
  192. }
  193. //mark external link?
  194. if (substr($element["href"], 0, 4) === "http" ||
  195. substr($element["href"], 0, 3) === "ftp"){
  196. $interim .= " class=\"urlextern\"";
  197. }
  198. //add access key?
  199. if (!empty($element["accesskey"])){
  200. $interim .= " accesskey=\"".hsc($element["accesskey"])."\" title=\"[ALT+".hsc(strtoupper($element["accesskey"]))."]\"";
  201. }
  202. $interim .= "><span>".hsc($element["text"])."</span></a>";
  203. //internal wiki link
  204. }else if (!empty($element["wiki"])){
  205. $interim = "<a href=\"".hsc(wl(cleanID($element["wiki"])))."\"><span>".hsc($element["text"])."</span></a>";
  206. }
  207. //store it
  208. $elements[] = "\n <li id=\"".hsc($li_id)."\"".(!empty($element["class"])
  209. ? " class=\"".hsc($element["class"])."\""
  210. : "").">".$interim."</li>";
  211. }
  212. //show everything created
  213. if (!empty($elements)){
  214. foreach ($elements as $element){
  215. echo $element;
  216. }
  217. }
  218. return true;
  219. }
  220. /**
  221. * Helper to render the boxes (like a dynamic XHTML snippet)
  222. *
  223. * @param array The box data to render within the snippet. Each box is
  224. * represented through a subarray:
  225. * $array = array("box-id1" => array("headline" => "hello world!",
  226. * "xhtml" => "I am <i>here</i>."));
  227. * Available keys within the subarrays:
  228. * - "xhtml" (mandatory)
  229. * The content of the Box you want to show as XHTML. Attention: YOU
  230. * HAVE TO TAKE CARE ABOUT FILTER EVENTUALLY USED INPUT/SECURITY. Be
  231. * aware of XSS and stuff.
  232. * - "headline" (optional)
  233. * Headline to show above the box. Leave empty/do not set for none.
  234. * @author Andreas Haerter <development@andreas-haerter.com>
  235. * @see _vector_renderButtons()
  236. * @see _vector_renderTabs()
  237. * @link http://www.wikipedia.org/wiki/Nofollow
  238. * @link http://www.wikipedia.org/wiki/Cross-site_scripting
  239. * @link http://www.dokuwiki.org/devel:coding_style
  240. */
  241. function _vector_renderBoxes($arr)
  242. {
  243. //is there something useful?
  244. if (empty($arr) ||
  245. !is_array($arr)){
  246. return false; //nope, break operation
  247. }
  248. //array to store the created boxes into
  249. $boxes = array();
  250. //handle the box data
  251. foreach($arr as $div_id => $contents){
  252. //basic check
  253. if (empty($contents) ||
  254. !is_array($contents) ||
  255. !isset($contents["xhtml"])){
  256. continue; //ignore invalid stuff and go on
  257. }
  258. $interim = " <div id=\"".hsc($div_id)."\" class=\"portal\">\n";
  259. if (isset($contents["headline"])
  260. && $contents["headline"] !== ""){
  261. $interim .= " <h5>".hsc($contents["headline"])."</h5>\n";
  262. }
  263. $interim .= " <div class=\"body\">\n"
  264. ." <div class=\"dokuwiki\">\n" //dokuwiki CSS class needed cause we might have to show rendered page content
  265. .$contents["xhtml"]."\n"
  266. ." </div>\n"
  267. ." </div>\n"
  268. ." </div>\n";
  269. //store it
  270. $boxes[] = $interim;
  271. }
  272. //show everything created
  273. if (!empty($boxes)){
  274. echo "\n";
  275. foreach ($boxes as $box){
  276. echo $box;
  277. }
  278. echo "\n";
  279. }
  280. return true;
  281. }
  282. /**
  283. * Helper to render the footer buttons (like a dynamic XHTML snippet)
  284. *
  285. * @param array The button data to render within the snippet. Each element
  286. * is represented through a subarray:
  287. * $array = array("btn1" => array("img" => DOKU_TPL."static/img/button-vector.png",
  288. * "href" => "http://andreas-haerter.com/projects/dokuwiki-template-vector",
  289. * "width" => 80,
  290. * "height" => 15,
  291. * "title" => "vector for DokuWiki",
  292. * "nofollow" => false),
  293. * "btn2" => array("img" => DOKU_TPL."user/mybutton1.png",
  294. * "href" => wl("start", false, false, "&")),
  295. * "btn3" => array("img" => DOKU_TPL."user/mybutton2.png",
  296. * "href" => "http://www.example.com");
  297. * Available keys within the subarrays:
  298. * - "img" (mandatory)
  299. * The relative or full path of an image/button to show. Users may
  300. * place own images within the /user/ dir of this template.
  301. * - "href" (mandatory)
  302. * URL the element should point to (as link). Please submit raw,
  303. * unencoded URLs, the encoding will be done by this function for
  304. * security reasons.
  305. * - "width" (optional)
  306. * width="<value>" will be added to the image tag if both "width" and
  307. * "height" are set (otherwise, this will be ignored).
  308. * - "height" (optional)
  309. * height="<value>" will be added to the image tag if both "height" and
  310. * "width" are set (otherwise, this will be ignored).
  311. * - "nofollow" (optional)
  312. * If set to TRUE, rel="nofollow" will be added to the link.
  313. * - "title" (optional)
  314. * title="<value>" will be added to the link and image if "title"
  315. * is set + alt="<value>".
  316. * @author Andreas Haerter <development@andreas-haerter.com>
  317. * @see _vector_renderButtons()
  318. * @see _vector_renderBoxes()
  319. * @link http://www.wikipedia.org/wiki/Nofollow
  320. * @link http://www.dokuwiki.org/devel:coding_style
  321. */
  322. function _vector_renderButtons($arr)
  323. {
  324. //array to store the created buttons into
  325. $elements = array();
  326. //handle the button data
  327. foreach($arr as $li_id => $element){
  328. //basic check
  329. if (empty($element) ||
  330. !is_array($element) ||
  331. !isset($element["img"]) ||
  332. !isset($element["href"])){
  333. continue; //ignore invalid stuff and go on
  334. }
  335. $interim = "";
  336. //add URL
  337. $interim = "<a href=\"".hsc($element["href"])."\""; //@TODO: real URL encoding
  338. //add rel="nofollow" attribute to the link?
  339. if (!empty($element["nofollow"])){
  340. $interim .= " rel=\"nofollow\"";
  341. }
  342. //add title attribute to the link?
  343. if (!empty($element["title"])){
  344. $interim .= " title=\"".hsc($element["title"])."\"";
  345. }
  346. $interim .= " target=\"_blank\"><img src=\"".hsc($element["img"])."\"";
  347. //add width and height attribute to the image?
  348. if (!empty($element["width"]) &&
  349. !empty($element["height"])){
  350. $interim .= " width=\"".(int)$element["width"]."\" height=\"".(int)$element["height"]."\"";
  351. }
  352. //add title and alt attribute to the image?
  353. if (!empty($element["title"])){
  354. $interim .= " title=\"".hsc($element["title"])."\" alt=\"".hsc($element["title"])."\"";
  355. } else {
  356. $interim .= " alt=\"\""; //alt is a mandatory attribute for images
  357. }
  358. $interim .= " border=\"0\" /></a>";
  359. //store it
  360. $elements[] = " ".$interim."\n";
  361. }
  362. //show everything created
  363. if (!empty($elements)){
  364. echo "\n";
  365. foreach ($elements as $element){
  366. echo $element;
  367. }
  368. }
  369. return true;
  370. }
  371. //workaround for the "jumping textarea" IE bug. CSS only fix not possible cause
  372. //some DokuWiki JavaScript is triggering this bug, too. See the following for
  373. //info:
  374. //- <http://blog.andreas-haerter.com/2010/05/28/fix-msie-8-auto-scroll-textarea-css-width-percentage-bug>
  375. //- <http://msdn.microsoft.com/library/cc817574.aspx>
  376. if ($ACT === "edit" &&
  377. !headers_sent()){
  378. header("X-UA-Compatible: IE=EmulateIE7");
  379. }
  380. ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  381. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  382. <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"]); ?>">
  383. <head>
  384. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  385. <title><?php tpl_pagetitle(); echo " - ".hsc($conf["title"]); ?></title>
  386. <!-- link to own generated RSS feed -->
  387. <link rel="alternate" type="application/rss+xml" title="Selected pages (subscribe to this!)"
  388. href="http://reganmian.net/wiki/feed.xml">
  389. <?php
  390. //show meta-tags
  391. tpl_metaheaders();
  392. //manually load needed CSS? this is a workaround for PHP Bug #49642. In some
  393. //version/os combinations PHP is not able to parse INI-file entries if there
  394. //are slashes "/" used for the keynames (see bugreport for more information:
  395. //<http://bugs.php.net/bug.php?id=49692>). to trigger this workaround, simply
  396. //delete/rename vector's style.ini.
  397. if (!file_exists(DOKU_TPLINC."style.ini")){
  398. 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
  399. }
  400. //include default or userdefined favicon
  401. if (file_exists(DOKU_TPLINC."user/favicon.ico")) {
  402. //user defined - you might find http://tools.dynamicdrive.com/favicon/
  403. //useful to generate one
  404. echo "\n<link rel=\"shortcut icon\" href=\"".DOKU_TPL."user/favicon.ico\" />\n";
  405. } elseif (file_exists(DOKU_TPLINC."user/favicon.png")) {
  406. //note: I do NOT recommend PNG for favicons (cause it is not supported by
  407. //all browsers), but some users requested this feature.
  408. echo "\n<link rel=\"shortcut icon\" href=\"".DOKU_TPL."user/favicon.png\" />\n";
  409. }else{
  410. //default
  411. echo "\n<link rel=\"shortcut icon\" href=\"".DOKU_TPL."static/3rd/dokuwiki/favicon.ico\" />\n";
  412. }
  413. //load userdefined js?
  414. if (tpl_getConf("vector_loaduserjs")){
  415. echo "<script type=\"text/javascript\" charset=\"utf-8\" src=\"".DOKU_TPL."user/user.js\"></script>\n";
  416. }
  417. //show printable version?
  418. if ($vector_action === "print"){
  419. //note: this is just a workaround for people searching for a print version.
  420. // don't forget to update the styles.ini, this is the really important
  421. // thing! BTW: good text about this: http://is.gd/5MyG5
  422. echo "<link rel=\"stylesheet\" media=\"all\" type=\"text/css\" href=\"".DOKU_TPL."static/3rd/dokuwiki/print.css\" />\n"
  423. ."<link rel=\"stylesheet\" media=\"all\" type=\"text/css\" href=\"".DOKU_TPL."static/css/print.css\" />\n"
  424. ."<link rel=\"stylesheet\" media=\"all\" type=\"text/css\" href=\"".DOKU_TPL."user/print.css\" />\n";
  425. }
  426. //load language specific css hacks?
  427. if (file_exists(DOKU_TPLINC."lang/".$conf["lang"]."/style.css")){
  428. $interim = trim(file_get_contents(DOKU_TPLINC."lang/".$conf["lang"]."/style.css"));
  429. if (!empty($interim)){
  430. echo "<style type=\"text/css\" media=\"all\">\n".hsc($interim)."\n</style>\n";
  431. }
  432. }
  433. ?>
  434. <!--[if lt IE 7]><style type="text/css">body{behavior:url("<?php echo DOKU_TPL; ?>static/3rd/vector/csshover.htc")}</style><![endif]-->
  435. </head>
  436. <body class="<?php
  437. //different styles/backgrounds for different page types
  438. switch (true){
  439. //special: tech
  440. case ($vector_action === "detail"):
  441. case ($vector_action === "mediamanager"):
  442. case ($vector_action === "cite"):
  443. case ($ACT === "search"): //var comes from DokuWiki
  444. echo "mediawiki ltr ns-1 ns-special ";
  445. break;
  446. //special: wiki
  447. case (preg_match("/^wiki$|^wiki:.*?$/i", getNS(getID()))):
  448. case "mediawiki ltr capitalize-all-nouns ns-4 ns-subject ";
  449. break;
  450. //discussion
  451. case ($vector_context === "discuss"):
  452. echo "mediawiki ltr capitalize-all-nouns ns-1 ns-talk ";
  453. break;
  454. //"normal" content
  455. case ($ACT === "edit"): //var comes from DokuWiki
  456. case ($ACT === "draft"): //var comes from DokuWiki
  457. case ($ACT === "revisions"): //var comes from DokuWiki
  458. case ($vector_action === "print"):
  459. default:
  460. echo "mediawiki ltr capitalize-all-nouns ns-0 ns-subject ";
  461. break;
  462. }
  463. //add additional CSS class to hide some elements when
  464. //we have to show the (not) embedded mediamanager
  465. if ($vector_action === "mediamanager" &&
  466. !tpl_getConf("vector_mediamanager_embedded")){
  467. echo "mmanagernotembedded ";
  468. } ?>skin-vector">
  469. <div id="page-container">
  470. <div id="page-base" class="noprint"></div>
  471. <div id="head-base" class="noprint"></div>
  472. <!-- start div id=content -->
  473. <div id="content">
  474. <a name="top" id="top"></a>
  475. <a name="dokuwiki__top" id="dokuwiki__top"></a>
  476. <!-- start main content area -->
  477. <?php
  478. //show messages (if there are any)
  479. html_msgarea();
  480. //show site notice
  481. if (tpl_getConf("vector_sitenotice")){
  482. //we have to show a custom sitenotice
  483. if (empty($conf["useacl"]) ||
  484. auth_quickaclcheck(cleanID(tpl_getConf("vector_sitenotice_location"))) >= AUTH_READ){ //current user got access?
  485. echo "\n <div id=\"siteNotice\" class=\"noprint\">\n";
  486. //get the rendered content of the defined wiki article to use as
  487. //custom sitenotice.
  488. $interim = tpl_include_page(tpl_getConf("vector_sitenotice_location"), false);
  489. if ($interim === "" ||
  490. $interim === false){
  491. //show creation/edit link if the defined page got no content
  492. echo "[&#160;";
  493. tpl_pagelink(tpl_getConf("vector_sitenotice_location"), hsc($lang["vector_fillplaceholder"]." (".tpl_getConf("vector_sitenotice_location").")"));
  494. echo "&#160;]<br />";
  495. }else{
  496. //show the rendered page content
  497. echo " <div class=\"dokuwiki\">\n" //dokuwiki CSS class needed cause we are showing rendered page content
  498. .$interim."\n "
  499. ."</div>";
  500. }
  501. echo "\n </div>\n";
  502. }
  503. }
  504. //show breadcrumps if enabled and position = top
  505. if ($conf["breadcrumbs"] == true &&
  506. tpl_getConf("vector_breadcrumbs_position") === "top"){
  507. echo "\n <div class=\"catlinks noprint\"><p>\n ";
  508. tpl_breadcrumbs();
  509. echo "\n </p></div>\n";
  510. }
  511. //show hierarchical breadcrumps if enabled and position = top
  512. if ($conf["youarehere"] == true &&
  513. tpl_getConf("vector_youarehere_position") === "top"){
  514. echo "\n <div class=\"catlinks noprint\"><p>\n ";
  515. tpl_youarehere();
  516. echo "\n </p></div>\n";
  517. }
  518. ?>
  519. <!-- start div id bodyContent -->
  520. <div id="bodyContent" class="dokuwiki">
  521. <!-- start rendered wiki content -->
  522. <?php
  523. //flush the buffer for faster page rendering, heaviest content follows
  524. flush();
  525. //decide which type of pagecontent we have to show
  526. switch ($vector_action){
  527. //"image details"
  528. case "detail":
  529. include DOKU_TPLINC."inc_detail.php";
  530. break;
  531. //file browser/"mediamanager"
  532. case "mediamanager":
  533. include DOKU_TPLINC."inc_mediamanager.php";
  534. break;
  535. //"cite this article"
  536. case "cite":
  537. include DOKU_TPLINC."inc_cite.php";
  538. break;
  539. //show "normal" content
  540. default:
  541. if($vector_context == "discuss"){
  542. $disqus = &plugin_load('syntax','disqus');
  543. echo $disqus->_disqus();
  544. }else{
  545. tpl_content(((tpl_getConf("vector_toc_position") === "article") ? true : false));}
  546. break;
  547. }
  548. ?>
  549. <!-- end rendered wiki content -->
  550. <div class="clearer"></div>
  551. </div>
  552. <!-- end div id bodyContent -->
  553. <?php
  554. //show breadcrumps if enabled and position = bottom
  555. if ($conf["breadcrumbs"] == true &&
  556. tpl_getConf("vector_breadcrumbs_position") === "bottom"){
  557. echo "\n <div class=\"catlinks noprint\"><p>\n ";
  558. tpl_breadcrumbs();
  559. echo "\n </p></div>\n";
  560. }
  561. //show hierarchical breadcrumps if enabled and position = bottom
  562. if ($conf["youarehere"] == true &&
  563. tpl_getConf("vector_youarehere_position") === "bottom"){
  564. echo "\n <div class=\"catlinks noprint\"><p>\n ";
  565. tpl_youarehere();
  566. echo "\n </p></div>\n";
  567. }
  568. ?>
  569. </div>
  570. <!-- end div id=content -->
  571. <!-- start div id=head -->
  572. <div id="head" class="noprint">
  573. <?php
  574. //show personal tools
  575. if (!empty($conf["useacl"])){ //...makes only sense if there are users
  576. echo "\n"
  577. ." <div id=\"p-personal\">\n"
  578. ." <ul>\n";
  579. //login?
  580. if ($loginname === ""){
  581. 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
  582. }else{
  583. //username and userpage
  584. echo " <li id=\"pt-userpage\">".(tpl_getConf("vector_userpage")
  585. ? html_wikilink(tpl_getConf("vector_userpage_ns").$loginname, hsc($loginname))
  586. : hsc($loginname))."</li>";
  587. //personal discussion
  588. if (tpl_getConf("vector_discuss") &&
  589. tpl_getConf("vector_userpage")){
  590. echo " <li id=\"pt-mytalk\">".html_wikilink(tpl_getConf("vector_discuss_ns").ltrim(tpl_getConf("vector_userpage_ns"), ":").$loginname, hsc($lang["vector_mytalk"]))."</li>";
  591. }
  592. //admin
  593. if (!empty($INFO["isadmin"]) ||
  594. !empty($INFO["ismanager"])){
  595. 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
  596. }
  597. //profile
  598. if (actionOK("profile")){ //check if action is disabled
  599. 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
  600. }
  601. //logout
  602. 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
  603. }
  604. echo " </ul>\n"
  605. ." </div>\n";
  606. }
  607. ?>
  608. <!-- start div id=left-navigation -->
  609. <div id="left-navigation">
  610. <div id="p-namespaces" class="vectorTabs">
  611. <ul><?php
  612. //show tabs: left. see vector/user/tabs.php to configure them
  613. if (!empty($_vector_tabs_left) &&
  614. is_array($_vector_tabs_left)){
  615. _vector_renderTabs($_vector_tabs_left);
  616. }
  617. ?>
  618. </ul>
  619. </div>
  620. </div>
  621. <!-- end div id=left-navigation -->
  622. <!-- start div id=right-navigation -->
  623. <div id="right-navigation">
  624. <div id="p-views" class="vectorTabs">
  625. <ul><?php
  626. //show tabs: right. see vector/user/tabs.php to configure them
  627. if (!empty($_vector_tabs_right) &&
  628. is_array($_vector_tabs_right)){
  629. _vector_renderTabs($_vector_tabs_right);
  630. }
  631. ?>
  632. </ul>
  633. </div>
  634. <?php if (actionOK("search")){ ?>
  635. <div id="p-search">
  636. <h5>
  637. <label for="qsearch__in"><?php echo hsc($lang["vector_search"]); ?></label>
  638. </h5>
  639. <form action="<?php echo wl(); ?>" accept-charset="utf-8" id="dw__search" name="dw__search">
  640. <input type="hidden" name="do" value="search" />
  641. <div id="simpleSearch">
  642. <input id="qsearch__in" name="id" type="text" accesskey="f" value="" />
  643. <button id="searchButton" type="submit" name="button" title="<?php echo hsc($lang["vector_btn_search_title"]); ?>">&nbsp;</button>
  644. </div>
  645. <div id="qsearch__out" class="ajax_qsearch JSpopup"></div>
  646. </form>
  647. </div>
  648. <?php } ?>
  649. </div>
  650. <!-- end div id=right-navigation -->
  651. </div>
  652. <!-- end div id=head -->
  653. <!-- start panel/sidebar -->
  654. <div id="panel" class="noprint">
  655. <!-- start logo -->
  656. <div id="p-logo">
  657. <?php
  658. //include default or userdefined logo
  659. echo "<a href=\"".wl()."\" ";
  660. if (file_exists(DOKU_TPLINC."user/logo.png")){
  661. //user defined PNG
  662. echo "style=\"background-image:url(".DOKU_TPL."user/logo.png);\"";
  663. }elseif (file_exists(DOKU_TPLINC."user/logo.gif")){
  664. //user defined GIF
  665. echo "style=\"background-image:url(".DOKU_TPL."user/logo.gif);\"";
  666. }elseif (file_exists(DOKU_TPLINC."user/logo.jpg")){
  667. //user defined JPG
  668. echo "style=\"background-image:url(".DOKU_TPL."user/logo.jpg);\"";
  669. }else{
  670. //default
  671. echo "style=\"background-image:url(".DOKU_TPL."static/3rd/dokuwiki/logo.png);\"";
  672. }
  673. echo " accesskey=\"h\" title=\"[ALT+H]\"></a>\n";
  674. ?>
  675. </div>
  676. <!-- end logo -->
  677. <?php
  678. //show boxes, see vector/user/boxes.php to configure them
  679. if (!empty($_vector_boxes) &&
  680. is_array($_vector_boxes)){
  681. _vector_renderBoxes($_vector_boxes);
  682. }
  683. ?>
  684. </div>
  685. <!-- end panel/sidebar -->
  686. </div>
  687. <!-- end page-container -->
  688. <!-- start footer -->
  689. <div id="footer">
  690. <ul id="footer-info">
  691. <li id="footer-info-lastmod">
  692. <?php tpl_pageinfo()?><br />
  693. </li>
  694. <?php
  695. //copyright notice
  696. if (tpl_getConf("vector_copyright")){
  697. //show dokuwiki's default notice?
  698. if (tpl_getConf("vector_copyright_default")){
  699. echo "<li id=\"footer-info-copyright\">\n <div class=\"dokuwiki\">"; //dokuwiki CSS class needed cause we have to show DokuWiki content
  700. tpl_license(false);
  701. echo "</div>\n </li>\n";
  702. //show custom notice.
  703. }else{
  704. if (empty($conf["useacl"]) ||
  705. auth_quickaclcheck(cleanID(tpl_getConf("vector_copyright_location"))) >= AUTH_READ){ //current user got access?
  706. echo "<li id=\"footer-info-copyright\">\n ";
  707. //get the rendered content of the defined wiki article to use as custom notice
  708. $interim = tpl_include_page(tpl_getConf("vector_copyright_location"), false);
  709. if ($interim === "" ||
  710. $interim === false){
  711. //show creation/edit link if the defined page got no content
  712. echo "[&#160;";
  713. tpl_pagelink(tpl_getConf("vector_copyright_location"), hsc($lang["vector_fillplaceholder"]." (".tpl_getConf("vector_copyright_location").")"));
  714. echo "&#160;]<br />";
  715. }else{
  716. //show the rendered page content
  717. echo "<div class=\"dokuwiki\">\n" //dokuwiki CSS class needed cause we are showing rendered page content
  718. .$interim."\n "
  719. ."</div>";
  720. }
  721. echo "\n </li>\n";
  722. }
  723. }
  724. }
  725. ?>
  726. </ul>
  727. <ul id="footer-places" class="noprint">
  728. <li><?php
  729. //show buttons, see vector/user/buttons.php to configure them
  730. if (!empty($_vector_btns) &&
  731. is_array($_vector_btns)){
  732. _vector_renderButtons($_vector_btns);
  733. }
  734. ?>
  735. </li>
  736. </ul>
  737. <div style="clearer"></div>
  738. </div>
  739. <!-- end footer -->
  740. <?php
  741. //provide DokuWiki housekeeping, required in all templates
  742. tpl_indexerWebBug();
  743. //include web analytics software
  744. if (file_exists(DOKU_TPLINC."/user/tracker.php")){
  745. include DOKU_TPLINC."/user/tracker.php";
  746. }
  747. ?>
  748. </body>
  749. </html>