You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

264 lines
15 KiB

  1. <?php
  2. /**
  3. * Default box configuration of the "vector" DokuWiki template
  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 ARSAVA <dokuwiki@dev.arsava.com>
  12. * @link https://www.dokuwiki.org/template:vector
  13. * @link https://www.dokuwiki.org/devel:configuration
  14. */
  15. /******************************************************************************
  16. ******************************** ATTENTION *********************************
  17. DO NOT MODIFY THIS FILE, IT WILL NOT BE PRESERVED ON UPDATES!
  18. ******************************************************************************
  19. If you want to add some own boxes, have a look at the README of this
  20. template and "/user/boxes.php". You have been warned!
  21. *****************************************************************************/
  22. //check if we are running within the DokuWiki environment
  23. if (!defined("DOKU_INC")){
  24. die();
  25. }
  26. //note: The boxes will be rendered in the order they were defined. Means:
  27. // first box will be rendered first, last box will be rendered at last.
  28. //hide boxes for anonymous clients (closed wiki)?
  29. if (empty($conf["useacl"]) || //are there any users?
  30. $loginname !== "" || //user is logged in?
  31. !tpl_getConf("vector_closedwiki")){
  32. //Languages/translations provided by Andreas Gohr's translation plugin,
  33. //see <https://www.dokuwiki.org/plugin:translation>. Create plugin object if
  34. //needed.
  35. if (file_exists(DOKU_PLUGIN."translation/syntax.php") &&
  36. !plugin_isdisabled("translation")){
  37. $transplugin = &plugin_load("syntax", "translation");
  38. } else {
  39. $transplugin = false;
  40. }
  41. //navigation
  42. if (tpl_getConf("vector_navigation")){
  43. //headline
  44. $_vector_boxes["p-navigation"]["headline"] = $lang["vector_navigation"];
  45. //detect wiki page to load as content
  46. if (!empty($transplugin) &&
  47. is_object($transplugin) &&
  48. tpl_getConf("vector_navigation_translate")){
  49. //translated navigation?
  50. $transplugin_langcur = $transplugin->hlp->getLangPart(cleanID(getId())); //current language part
  51. $transplugin_langs = explode(" ", trim($transplugin->getConf("translations"))); //available languages
  52. if (empty($transplugin_langs) ||
  53. empty($transplugin_langcur) ||
  54. !is_array($transplugin_langs) ||
  55. !in_array($transplugin_langcur, $transplugin_langs)) {
  56. //current page is no translation or something is wrong, load default navigation
  57. $nav_location = tpl_getConf("vector_navigation_location");
  58. } else {
  59. //load language specific navigation
  60. $nav_location = tpl_getConf("vector_navigation_location")."_".$transplugin_langcur;
  61. }
  62. }else{
  63. //default navigation, no translation
  64. $nav_location = tpl_getConf("vector_navigation_location");
  65. }
  66. //content
  67. if (empty($conf["useacl"]) ||
  68. auth_quickaclcheck(cleanID($nav_location)) >= AUTH_READ){ //current user got access?
  69. //get the rendered content of the defined wiki article to use as custom navigation
  70. $interim = tpl_include_page($nav_location, false);
  71. if ($interim === "" ||
  72. $interim === false){
  73. //creation/edit link if the defined page got no content
  74. $_vector_boxes["p-navigation"]["xhtml"] = "[&#160;".html_wikilink($nav_location, hsc($lang["vector_fillplaceholder"]." (".$nav_location.")"))."&#160;]<br />";
  75. }else{
  76. //the rendered page content
  77. $_vector_boxes["p-navigation"]["xhtml"] = $interim;
  78. }
  79. }
  80. unset($nav_location);
  81. }
  82. //table of contents (TOC) - show outside the article? (this is a dirty hack but often requested)
  83. if (tpl_getConf("vector_toc_position") === "sidebar"){
  84. //check if the current page got a TOC
  85. $toc = tpl_toc(true);
  86. if (!empty($toc)) {
  87. //headline
  88. $_vector_boxes["p-toc"]["headline"] = $lang["toc"]; //language comes from DokuWiki core
  89. //content
  90. $_vector_boxes["p-toc"]["xhtml"] = //get rid of some styles and the embedded headline
  91. str_replace(//search
  92. array(//old TOC, until 2012-01-25
  93. "<div class=\"tocheader toctoggle\" id=\"toc__header\">".$lang["toc"]."</div>", //language comes from DokuWiki core
  94. " class=\"toc\"",
  95. " id=\"toc__inside\"",
  96. //new TOC, since 2012-09-10
  97. " id=\"dw__toc\"",
  98. "<h3 class=\"toggle\">".$lang["toc"]."</h3>"), //language comes from DokuWiki core
  99. //replace
  100. "",
  101. //haystack
  102. $toc);
  103. }
  104. unset($toc);
  105. }
  106. //exportbox ("print/export")
  107. if (tpl_getConf("vector_exportbox")){
  108. //headline
  109. $_vector_boxes["p-coll-print_export"]["headline"] = $lang["vector_exportbox"];
  110. //content
  111. if (tpl_getConf("vector_exportbox_default")){
  112. //define default, predefined exportbox
  113. $_vector_boxes["p-coll-print_export"]["xhtml"] = " <ul>\n";
  114. //ODT plugin
  115. //see <https://www.dokuwiki.org/plugin:odt> for info
  116. if (file_exists(DOKU_PLUGIN."odt/syntax.php") &&
  117. !plugin_isdisabled("odt")){
  118. $_vector_boxes["p-coll-print_export"]["xhtml"] .= " <li id=\"coll-download-as-odt\"><a href=\"".wl(cleanID(getId()), array("do" => "export_odt"))."\" rel=\"nofollow\">".hsc($lang["vector_exportbxdef_downloadodt"])."</a></li>\n";
  119. }
  120. //dw2pdf plugin
  121. //see <https://www.dokuwiki.org/plugin:dw2pdf> for info
  122. if (file_exists(DOKU_PLUGIN."dw2pdf/action.php") &&
  123. !plugin_isdisabled("dw2pdf")){
  124. $_vector_boxes["p-coll-print_export"]["xhtml"] .= " <li id=\"coll-download-as-rl\"><a href=\"".wl(cleanID(getId()), array("do" => "export_pdf"))."\" rel=\"nofollow\">".hsc($lang["vector_exportbxdef_downloadpdf"])."</a></li>\n";
  125. //html2pdf plugin
  126. //see <https://www.dokuwiki.org/plugin:html2pdf> for info
  127. } else if (file_exists(DOKU_PLUGIN."html2pdf/action.php") &&
  128. !plugin_isdisabled("html2pdf")){
  129. $_vector_boxes["p-coll-print_export"]["xhtml"] .= " <li id=\"coll-download-as-rl\"><a href=\"".wl(cleanID(getId()), array("do" => "export_pdf"))."\" rel=\"nofollow\">".hsc($lang["vector_exportbxdef_downloadpdf"])."</a></li>\n";
  130. }
  131. $_vector_boxes["p-coll-print_export"]["xhtml"] .= " <li id=\"t-print\"><a href=\"".wl(cleanID(getId()), array("rev" =>(int)$rev, "vecdo" => "print"))."\" rel=\"nofollow\">".hsc($lang["vector_exportbxdef_print"])."</a></li>\n"
  132. ." </ul>";
  133. }else{
  134. //we have to use a custom exportbox
  135. if (empty($conf["useacl"]) ||
  136. auth_quickaclcheck(cleanID(tpl_getConf("vector_exportbox_location"))) >= AUTH_READ){ //current user got access?
  137. //get the rendered content of the defined wiki article to use as
  138. //custom exportbox
  139. $interim = tpl_include_page(tpl_getConf("vector_exportbox_location"), false);
  140. if ($interim === "" ||
  141. $interim === false){
  142. //add creation/edit link if the defined page got no content
  143. $_vector_boxes["p-coll-print_export"]["xhtml"] = "<li>[&#160;".html_wikilink(tpl_getConf("vector_exportbox_location"), hsc($lang["vector_fillplaceholder"]." (".tpl_getConf("vector_exportbox_location").")"), null)."&#160;]<br /></li>";
  144. }else{
  145. //add the rendered page content
  146. $_vector_boxes["p-coll-print_export"]["xhtml"] = $interim;
  147. }
  148. }else{
  149. //we are not allowed to show the content of the defined wiki
  150. //article to use as custom sitenotice.
  151. //$_vector_boxes["p-tb"]["xhtml"] = hsc($lang["vector_accessdenied"])." (".tpl_getConf("vector_exportbox_location").")";
  152. }
  153. }
  154. }
  155. //toolbox
  156. if (tpl_getConf("vector_toolbox")){
  157. //headline
  158. $_vector_boxes["p-tb"]["headline"] = $lang["vector_toolbox"];
  159. //content
  160. if (tpl_getConf("vector_toolbox_default")){
  161. //define default, predefined toolbox
  162. $_vector_boxes["p-tb"]["xhtml"] = " <ul>\n";
  163. if (actionOK("backlink")){ //check if action is disabled
  164. $_vector_boxes["p-tb"]["xhtml"] .= " <li id=\"t-whatlinkshere\"><a href=\"".wl(cleanID(getId()), array("do" => "backlink"))."\">".hsc($lang["vector_toolbxdef_whatlinkshere"])."</a></li>\n"; //we might use tpl_actionlink("backlink", "", "", hsc($lang["vector_toolbxdef_whatlinkshere"]), true), but it would be the only toolbox link where this is possible... therefore I don't use it to be consistent
  165. }
  166. if (actionOK("recent")){ //check if action is disabled
  167. $_vector_boxes["p-tb"]["xhtml"] .= " <li id=\"t-recentchanges\"><a href=\"".wl("", array("do" => "recent"))."\" rel=\"nofollow\">".hsc($lang["btn_recent"])."</a></li>\n"; //language comes from DokuWiki core
  168. }
  169. if (actionOK("media")){ //check if action is disabled
  170. if (function_exists("media_managerURL")) {
  171. //use new media manager (available on releases newer than 2011-05-25a "Rincewind" / since 2011-11-10 "Angua" RC1)
  172. $_vector_boxes["p-tb"]["xhtml"] .= " <li id=\"t-upload\"><a href=\"".wl("", array("do" => "media"))."\" rel=\"nofollow\">".hsc($lang["btn_media"])."</a></li>\n"; //language comes from DokuWiki core
  173. } else {
  174. $_vector_boxes["p-tb"]["xhtml"] .= " <li id=\"t-upload\"><a href=\"".DOKU_BASE."lib/exe/mediamanager.php?ns=".getNS(getID())."\" rel=\"nofollow\">".hsc($lang["vector_toolbxdef_upload"])."</a></li>\n";
  175. }
  176. }
  177. if (actionOK("index")){ //check if action is disabled
  178. $_vector_boxes["p-tb"]["xhtml"] .= " <li id=\"t-special\"><a href=\"".wl("", array("do" => "index"))."\" rel=\"nofollow\">".hsc($lang["vector_toolbxdef_siteindex"])."</a></li>\n";
  179. }
  180. $_vector_boxes["p-tb"]["xhtml"] .= " <li id=\"t-permanent\"><a href=\"".wl(cleanID(getId()), array("rev" =>(int)$rev))."\" rel=\"nofollow\">".hsc($lang["vector_toolboxdef_permanent"])."</a></li>\n"
  181. ." <li id=\"t-cite\"><a href=\"".wl(cleanID(getId()), array("rev" =>(int)$rev, "vecdo" => "cite"))."\" rel=\"nofollow\">".hsc($lang["vector_toolboxdef_cite"])."</a></li>\n"
  182. ." </ul>";
  183. }else{
  184. //we have to use a custom toolbox
  185. if (empty($conf["useacl"]) ||
  186. auth_quickaclcheck(cleanID(tpl_getConf("vector_toolbox_location"))) >= AUTH_READ){ //current user got access?
  187. //get the rendered content of the defined wiki article to use as
  188. //custom toolbox
  189. $interim = tpl_include_page(tpl_getConf("vector_toolbox_location"), false);
  190. if ($interim === "" ||
  191. $interim === false){
  192. //add creation/edit link if the defined page got no content
  193. $_vector_boxes["p-tb"]["xhtml"] = "<li>[&#160;".html_wikilink(tpl_getConf("vector_toolbox_location"), hsc($lang["vector_fillplaceholder"]." (".tpl_getConf("vector_toolbox_location").")"), null)."&#160;]<br /></li>";
  194. }else{
  195. //add the rendered page content
  196. $_vector_boxes["p-tb"]["xhtml"] = $interim;
  197. }
  198. }else{
  199. //we are not allowed to show the content of the defined wiki
  200. //article to use as custom sitenotice.
  201. //$_vector_boxes["p-tb"]["xhtml"] = hsc($lang["vector_accessdenied"])." (".tpl_getConf("vector_toolbox_location").")";
  202. }
  203. }
  204. }
  205. //QR Code of current page's URL (powered by <http://goqr.me/api/>)
  206. if (tpl_getConf("vector_qrcodebox")){
  207. //headline
  208. $_vector_boxes["p-qrcode"]["headline"] = $lang["vector_qrcodebox"];
  209. //content
  210. $_vector_boxes["p-qrcode"]["xhtml"] = " <span id=\"t-qrcode\">".((cleanID(getID()) === "start") ? "<a href=\"http://".(($conf["lang"] !== "de") ? "goqr.me" : "goqr.me/de")."/\" target=\"_blank\" rel=\"nofollow\">" : "")."<img src=\"".((!empty($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] === "on") ? "https" : "http")."://api.qrserver.com/v1/create-qr-code/?data=".urlencode(wl(cleanID(getId()), false, true, "&"))."&#38;size=130x130&#38;margin=0&#38;bgcolor=f3f3f3\" alt=\"".hsc($lang["vector_qrcodebox_qrcode"])." ".hsc(tpl_pagetitle(null, true))." (".hsc($lang["vector_qrcodebox_genforcurrentpage"]).")\" title=\"".hsc($lang["vector_qrcodebox_urlofcurrentpage"])."\" />".((cleanID(getID()) === "start") ? "</a>" : "")."</span>";
  211. }
  212. }else{
  213. //headline
  214. $_vector_boxes["p-login"]["headline"] = $lang["btn_login"];
  215. $_vector_boxes["p-login"]["xhtml"] = " <ul>\n"
  216. ." <li id=\"t-login\"><a href=\"".wl(cleanID(getId()), array("do" => "login"))."\" rel=\"nofollow\">".hsc($lang["btn_login"])."</a></li>\n" //language comes from DokuWiki core
  217. ." </ul>";
  218. }
  219. //Languages/translations provided by Andreas Gohr's translation plugin,
  220. //see <https://www.dokuwiki.org/plugin:translation>
  221. if (!empty($transplugin) &&
  222. is_object($transplugin)){
  223. $_vector_boxes["p-lang"]["headline"] = $lang["vector_translations"];
  224. $_vector_boxes["p-lang"]["xhtml"] = $transplugin->_showTranslations();
  225. }
  226. /******************************************************************************
  227. ******************************** ATTENTION *********************************
  228. DO NOT MODIFY THIS FILE, IT WILL NOT BE PRESERVED ON UPDATES!
  229. ******************************************************************************
  230. If you want to add some own boxes, have a look at the README of this
  231. template and "/user/boxes.php". You have been warned!
  232. *****************************************************************************/