1fa5fcacaSAndreas Haerter<?php 2fa5fcacaSAndreas Haerter 3fa5fcacaSAndreas Haerter/** 4fa5fcacaSAndreas Haerter * Default box configuration of the "vector" DokuWiki template 5fa5fcacaSAndreas Haerter * 6fa5fcacaSAndreas Haerter * 7fa5fcacaSAndreas Haerter * LICENSE: This file is open source software (OSS) and may be copied under 8fa5fcacaSAndreas Haerter * certain conditions. See COPYING file for details or try to contact 9fa5fcacaSAndreas Haerter * the author(s) of this file in doubt. 10fa5fcacaSAndreas Haerter * 11fa5fcacaSAndreas Haerter * @license GPLv2 (http://www.gnu.org/licenses/gpl2.html) 12e3217ae2SAndreas Haerter * @author ARSAVA <dokuwiki@dev.arsava.com> 13e3217ae2SAndreas Haerter * @link https://www.dokuwiki.org/template:vector 14e3217ae2SAndreas Haerter * @link https://www.dokuwiki.org/devel:configuration 15fa5fcacaSAndreas Haerter */ 16fa5fcacaSAndreas Haerter 17fa5fcacaSAndreas Haerter 18fa5fcacaSAndreas Haerter 19fa5fcacaSAndreas Haerter/****************************************************************************** 20fa5fcacaSAndreas Haerter ******************************** ATTENTION ********************************* 21fa5fcacaSAndreas Haerter DO NOT MODIFY THIS FILE, IT WILL NOT BE PRESERVED ON UPDATES! 22fa5fcacaSAndreas Haerter ****************************************************************************** 23fa5fcacaSAndreas Haerter If you want to add some own boxes, have a look at the README of this 24fa5fcacaSAndreas Haerter template and "/user/boxes.php". You have been warned! 25fa5fcacaSAndreas Haerter *****************************************************************************/ 26fa5fcacaSAndreas Haerter 27fa5fcacaSAndreas Haerter 28fa5fcacaSAndreas Haerter//check if we are running within the DokuWiki environment 29fa5fcacaSAndreas Haerterif (!defined("DOKU_INC")){ 30fa5fcacaSAndreas Haerter die(); 31fa5fcacaSAndreas Haerter} 32fa5fcacaSAndreas Haerter 33fa5fcacaSAndreas Haerter 34fa5fcacaSAndreas Haerter//note: The boxes will be rendered in the order they were defined. Means: 35fa5fcacaSAndreas Haerter// first box will be rendered first, last box will be rendered at last. 36fa5fcacaSAndreas Haerter 37fa5fcacaSAndreas Haerter 38fa5fcacaSAndreas Haerter//hide boxes for anonymous clients (closed wiki)? 39fa5fcacaSAndreas Haerterif (empty($conf["useacl"]) || //are there any users? 40fa5fcacaSAndreas Haerter $loginname !== "" || //user is logged in? 41fa5fcacaSAndreas Haerter !tpl_getConf("vector_closedwiki")){ 42fa5fcacaSAndreas Haerter 43952c7991SAndreas Haerter //Languages/translations provided by Andreas Gohr's translation plugin, 44e3217ae2SAndreas Haerter //see <https://www.dokuwiki.org/plugin:translation>. Create plugin object if 4552972747SAndreas Haerter //needed. 4652972747SAndreas Haerter if (file_exists(DOKU_PLUGIN."translation/syntax.php") && 4752972747SAndreas Haerter !plugin_isdisabled("translation")){ 4852972747SAndreas Haerter $transplugin = &plugin_load("syntax", "translation"); 4952972747SAndreas Haerter } else { 5052972747SAndreas Haerter $transplugin = false; 5152972747SAndreas Haerter } 52fa5fcacaSAndreas Haerter 53fa5fcacaSAndreas Haerter //navigation 54fa5fcacaSAndreas Haerter if (tpl_getConf("vector_navigation")){ 55fa5fcacaSAndreas Haerter //headline 56fa5fcacaSAndreas Haerter $_vector_boxes["p-navigation"]["headline"] = $lang["vector_navigation"]; 57fa5fcacaSAndreas Haerter 5852972747SAndreas Haerter //detect wiki page to load as content 5952972747SAndreas Haerter if (!empty($transplugin) && 6052972747SAndreas Haerter is_object($transplugin) && 6152972747SAndreas Haerter tpl_getConf("vector_navigation_translate")){ 6252972747SAndreas Haerter //translated navigation? 6352972747SAndreas Haerter $transplugin_langcur = $transplugin->hlp->getLangPart(cleanID(getId())); //current language part 6452972747SAndreas Haerter $transplugin_langs = explode(" ", trim($transplugin->getConf("translations"))); //available languages 6552972747SAndreas Haerter if (empty($transplugin_langs) || 6652972747SAndreas Haerter empty($transplugin_langcur) || 6752972747SAndreas Haerter !is_array($transplugin_langs) || 6852972747SAndreas Haerter !in_array($transplugin_langcur, $transplugin_langs)) { 6952972747SAndreas Haerter //current page is no translation or something is wrong, load default navigation 7052972747SAndreas Haerter $nav_location = tpl_getConf("vector_navigation_location"); 7152972747SAndreas Haerter } else { 7252972747SAndreas Haerter //load language specific navigation 7352972747SAndreas Haerter $nav_location = tpl_getConf("vector_navigation_location")."_".$transplugin_langcur; 7452972747SAndreas Haerter } 7552972747SAndreas Haerter }else{ 7652972747SAndreas Haerter //default navigation, no translation 7752972747SAndreas Haerter $nav_location = tpl_getConf("vector_navigation_location"); 7852972747SAndreas Haerter } 7952972747SAndreas Haerter 80fa5fcacaSAndreas Haerter //content 81fa5fcacaSAndreas Haerter if (empty($conf["useacl"]) || 8252972747SAndreas Haerter auth_quickaclcheck(cleanID($nav_location)) >= AUTH_READ){ //current user got access? 83fa5fcacaSAndreas Haerter //get the rendered content of the defined wiki article to use as custom navigation 8452972747SAndreas Haerter $interim = tpl_include_page($nav_location, false); 85fa5fcacaSAndreas Haerter if ($interim === "" || 86fa5fcacaSAndreas Haerter $interim === false){ 87fa5fcacaSAndreas Haerter //creation/edit link if the defined page got no content 8852972747SAndreas Haerter $_vector_boxes["p-navigation"]["xhtml"] = "[ ".html_wikilink($nav_location, hsc($lang["vector_fillplaceholder"]." (".$nav_location.")"))." ]<br />"; 89fa5fcacaSAndreas Haerter }else{ 90fa5fcacaSAndreas Haerter //the rendered page content 91fa5fcacaSAndreas Haerter $_vector_boxes["p-navigation"]["xhtml"] = $interim; 92fa5fcacaSAndreas Haerter } 93fa5fcacaSAndreas Haerter } 9452972747SAndreas Haerter unset($nav_location); 95fa5fcacaSAndreas Haerter } 96fa5fcacaSAndreas Haerter 97fa5fcacaSAndreas Haerter //table of contents (TOC) - show outside the article? (this is a dirty hack but often requested) 98fa5fcacaSAndreas Haerter if (tpl_getConf("vector_toc_position") === "sidebar"){ 99fa5fcacaSAndreas Haerter //check if the current page got a TOC 100fa5fcacaSAndreas Haerter $toc = tpl_toc(true); 101fa5fcacaSAndreas Haerter if (!empty($toc)) { 102fa5fcacaSAndreas Haerter //headline 103fa5fcacaSAndreas Haerter $_vector_boxes["p-toc"]["headline"] = $lang["toc"]; //language comes from DokuWiki core 104fa5fcacaSAndreas Haerter 105fa5fcacaSAndreas Haerter //content 106fa5fcacaSAndreas Haerter $_vector_boxes["p-toc"]["xhtml"] = //get rid of some styles and the embedded headline 107fa5fcacaSAndreas Haerter str_replace(//search 108313a2ebbSAndreas Haerter array(//old TOC, until 2012-01-25 109313a2ebbSAndreas Haerter "<div class=\"tocheader toctoggle\" id=\"toc__header\">".$lang["toc"]."</div>", //language comes from DokuWiki core 110fa5fcacaSAndreas Haerter " class=\"toc\"", 111313a2ebbSAndreas Haerter " id=\"toc__inside\"", 112313a2ebbSAndreas Haerter //new TOC, since 2012-09-10 113313a2ebbSAndreas Haerter " id=\"dw__toc\"", 114313a2ebbSAndreas Haerter "<h3 class=\"toggle\">".$lang["toc"]."</h3>"), //language comes from DokuWiki core 115fa5fcacaSAndreas Haerter //replace 116fa5fcacaSAndreas Haerter "", 117fa5fcacaSAndreas Haerter //haystack 118fa5fcacaSAndreas Haerter $toc); 119fa5fcacaSAndreas Haerter } 120fa5fcacaSAndreas Haerter unset($toc); 121fa5fcacaSAndreas Haerter } 122fa5fcacaSAndreas Haerter 123fa5fcacaSAndreas Haerter //exportbox ("print/export") 124fa5fcacaSAndreas Haerter if (tpl_getConf("vector_exportbox")){ 125fa5fcacaSAndreas Haerter //headline 126fa5fcacaSAndreas Haerter $_vector_boxes["p-coll-print_export"]["headline"] = $lang["vector_exportbox"]; 127fa5fcacaSAndreas Haerter 128fa5fcacaSAndreas Haerter //content 129fa5fcacaSAndreas Haerter if (tpl_getConf("vector_exportbox_default")){ 130fa5fcacaSAndreas Haerter //define default, predefined exportbox 131fa5fcacaSAndreas Haerter $_vector_boxes["p-coll-print_export"]["xhtml"] = " <ul>\n"; 132fa5fcacaSAndreas Haerter //ODT plugin 133e3217ae2SAndreas Haerter //see <https://www.dokuwiki.org/plugin:odt> for info 134fa5fcacaSAndreas Haerter if (file_exists(DOKU_PLUGIN."odt/syntax.php") && 135fa5fcacaSAndreas Haerter !plugin_isdisabled("odt")){ 136fa5fcacaSAndreas Haerter $_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"; 137fa5fcacaSAndreas Haerter } 138fa5fcacaSAndreas Haerter //dw2pdf plugin 139e3217ae2SAndreas Haerter //see <https://www.dokuwiki.org/plugin:dw2pdf> for info 140fa5fcacaSAndreas Haerter if (file_exists(DOKU_PLUGIN."dw2pdf/action.php") && 141fa5fcacaSAndreas Haerter !plugin_isdisabled("dw2pdf")){ 142fa5fcacaSAndreas Haerter $_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"; 143fa5fcacaSAndreas Haerter //html2pdf plugin 144e3217ae2SAndreas Haerter //see <https://www.dokuwiki.org/plugin:html2pdf> for info 145fa5fcacaSAndreas Haerter } else if (file_exists(DOKU_PLUGIN."html2pdf/action.php") && 146fa5fcacaSAndreas Haerter !plugin_isdisabled("html2pdf")){ 147fa5fcacaSAndreas Haerter $_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"; 148fa5fcacaSAndreas Haerter } 149fa5fcacaSAndreas Haerter $_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" 150fa5fcacaSAndreas Haerter ." </ul>"; 151fa5fcacaSAndreas Haerter }else{ 152fa5fcacaSAndreas Haerter //we have to use a custom exportbox 153fa5fcacaSAndreas Haerter if (empty($conf["useacl"]) || 154fa5fcacaSAndreas Haerter auth_quickaclcheck(cleanID(tpl_getConf("vector_exportbox_location"))) >= AUTH_READ){ //current user got access? 155fa5fcacaSAndreas Haerter //get the rendered content of the defined wiki article to use as 156fa5fcacaSAndreas Haerter //custom exportbox 157fa5fcacaSAndreas Haerter $interim = tpl_include_page(tpl_getConf("vector_exportbox_location"), false); 158fa5fcacaSAndreas Haerter if ($interim === "" || 159fa5fcacaSAndreas Haerter $interim === false){ 160fa5fcacaSAndreas Haerter //add creation/edit link if the defined page got no content 161fa5fcacaSAndreas Haerter $_vector_boxes["p-coll-print_export"]["xhtml"] = "<li>[ ".html_wikilink(tpl_getConf("vector_exportbox_location"), hsc($lang["vector_fillplaceholder"]." (".tpl_getConf("vector_exportbox_location").")"), null)." ]<br /></li>"; 162fa5fcacaSAndreas Haerter }else{ 163fa5fcacaSAndreas Haerter //add the rendered page content 164fa5fcacaSAndreas Haerter $_vector_boxes["p-coll-print_export"]["xhtml"] = $interim; 165fa5fcacaSAndreas Haerter } 166fa5fcacaSAndreas Haerter }else{ 167fa5fcacaSAndreas Haerter //we are not allowed to show the content of the defined wiki 168fa5fcacaSAndreas Haerter //article to use as custom sitenotice. 169fa5fcacaSAndreas Haerter //$_vector_boxes["p-tb"]["xhtml"] = hsc($lang["vector_accessdenied"])." (".tpl_getConf("vector_exportbox_location").")"; 170fa5fcacaSAndreas Haerter } 171fa5fcacaSAndreas Haerter } 172fa5fcacaSAndreas Haerter } 173fa5fcacaSAndreas Haerter 174fa5fcacaSAndreas Haerter //toolbox 175fa5fcacaSAndreas Haerter if (tpl_getConf("vector_toolbox")){ 176fa5fcacaSAndreas Haerter //headline 177fa5fcacaSAndreas Haerter $_vector_boxes["p-tb"]["headline"] = $lang["vector_toolbox"]; 178fa5fcacaSAndreas Haerter 179fa5fcacaSAndreas Haerter //content 180fa5fcacaSAndreas Haerter if (tpl_getConf("vector_toolbox_default")){ 181fa5fcacaSAndreas Haerter //define default, predefined toolbox 182fa5fcacaSAndreas Haerter $_vector_boxes["p-tb"]["xhtml"] = " <ul>\n"; 183fa5fcacaSAndreas Haerter if (actionOK("backlink")){ //check if action is disabled 184fa5fcacaSAndreas Haerter $_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 185fa5fcacaSAndreas Haerter } 186fa5fcacaSAndreas Haerter if (actionOK("recent")){ //check if action is disabled 187fa5fcacaSAndreas Haerter $_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 188fa5fcacaSAndreas Haerter } 18926d590edSAndreas Haerter if (actionOK("media")){ //check if action is disabled 1900a1cb4e9SAndreas Haerter if (function_exists("media_managerURL")) { 1910a1cb4e9SAndreas Haerter //use new media manager (available on releases newer than 2011-05-25a "Rincewind" / since 2011-11-10 "Angua" RC1) 1926d885141SAndreas Haerter $_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 1930a1cb4e9SAndreas Haerter } else { 1940a1cb4e9SAndreas Haerter $_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"; 1950a1cb4e9SAndreas Haerter } 19626d590edSAndreas Haerter } 197fa5fcacaSAndreas Haerter if (actionOK("index")){ //check if action is disabled 198fa5fcacaSAndreas Haerter $_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"; 199fa5fcacaSAndreas Haerter } 200fa5fcacaSAndreas Haerter $_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" 201fa5fcacaSAndreas Haerter ." <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" 202fa5fcacaSAndreas Haerter ." </ul>"; 203fa5fcacaSAndreas Haerter }else{ 204fa5fcacaSAndreas Haerter //we have to use a custom toolbox 205fa5fcacaSAndreas Haerter if (empty($conf["useacl"]) || 206fa5fcacaSAndreas Haerter auth_quickaclcheck(cleanID(tpl_getConf("vector_toolbox_location"))) >= AUTH_READ){ //current user got access? 207fa5fcacaSAndreas Haerter //get the rendered content of the defined wiki article to use as 208fa5fcacaSAndreas Haerter //custom toolbox 209fa5fcacaSAndreas Haerter $interim = tpl_include_page(tpl_getConf("vector_toolbox_location"), false); 210fa5fcacaSAndreas Haerter if ($interim === "" || 211fa5fcacaSAndreas Haerter $interim === false){ 212fa5fcacaSAndreas Haerter //add creation/edit link if the defined page got no content 213fa5fcacaSAndreas Haerter $_vector_boxes["p-tb"]["xhtml"] = "<li>[ ".html_wikilink(tpl_getConf("vector_toolbox_location"), hsc($lang["vector_fillplaceholder"]." (".tpl_getConf("vector_toolbox_location").")"), null)." ]<br /></li>"; 214fa5fcacaSAndreas Haerter }else{ 215fa5fcacaSAndreas Haerter //add the rendered page content 216fa5fcacaSAndreas Haerter $_vector_boxes["p-tb"]["xhtml"] = $interim; 217fa5fcacaSAndreas Haerter } 218fa5fcacaSAndreas Haerter }else{ 219fa5fcacaSAndreas Haerter //we are not allowed to show the content of the defined wiki 220fa5fcacaSAndreas Haerter //article to use as custom sitenotice. 221fa5fcacaSAndreas Haerter //$_vector_boxes["p-tb"]["xhtml"] = hsc($lang["vector_accessdenied"])." (".tpl_getConf("vector_toolbox_location").")"; 222fa5fcacaSAndreas Haerter } 223fa5fcacaSAndreas Haerter } 224fa5fcacaSAndreas Haerter } 225fa5fcacaSAndreas Haerter 226e3217ae2SAndreas Haerter //QR Code of current page's URL (powered by <http://goqr.me/api/>) 227f54a831fSAndreas Haerter if (tpl_getConf("vector_qrcodebox")){ 228f54a831fSAndreas Haerter //headline 229f54a831fSAndreas Haerter $_vector_boxes["p-qrcode"]["headline"] = $lang["vector_qrcodebox"]; 230f54a831fSAndreas Haerter 231f54a831fSAndreas Haerter //content 232e3217ae2SAndreas Haerter $_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, "&"))."&size=130x130&margin=0&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>"; 233f54a831fSAndreas Haerter } 234f54a831fSAndreas Haerter 235fa5fcacaSAndreas Haerter}else{ 236fa5fcacaSAndreas Haerter 237fa5fcacaSAndreas Haerter //headline 238fa5fcacaSAndreas Haerter $_vector_boxes["p-login"]["headline"] = $lang["btn_login"]; 239fa5fcacaSAndreas Haerter $_vector_boxes["p-login"]["xhtml"] = " <ul>\n" 240fa5fcacaSAndreas Haerter ." <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 241fa5fcacaSAndreas Haerter ." </ul>"; 242fa5fcacaSAndreas Haerter 243fa5fcacaSAndreas Haerter} 244fa5fcacaSAndreas Haerter 245fa5fcacaSAndreas Haerter 246*76362e21SAndreas Haerter//Languages/translations provided by Andreas Gohr's translation plugin, 247*76362e21SAndreas Haerter//see <https://www.dokuwiki.org/plugin:translation> 248*76362e21SAndreas Haerterif (!empty($transplugin) && 249*76362e21SAndreas Haerter is_object($transplugin)){ 250*76362e21SAndreas Haerter $_vector_boxes["p-lang"]["headline"] = $lang["vector_translations"]; 251*76362e21SAndreas Haerter $_vector_boxes["p-lang"]["xhtml"] = $transplugin->_showTranslations(); 252*76362e21SAndreas Haerter} 253*76362e21SAndreas Haerter 254*76362e21SAndreas Haerter 255*76362e21SAndreas Haerter 256fa5fcacaSAndreas Haerter/****************************************************************************** 257fa5fcacaSAndreas Haerter ******************************** ATTENTION ********************************* 258fa5fcacaSAndreas Haerter DO NOT MODIFY THIS FILE, IT WILL NOT BE PRESERVED ON UPDATES! 259fa5fcacaSAndreas Haerter ****************************************************************************** 260fa5fcacaSAndreas Haerter If you want to add some own boxes, have a look at the README of this 261fa5fcacaSAndreas Haerter template and "/user/boxes.php". You have been warned! 262fa5fcacaSAndreas Haerter *****************************************************************************/ 263fa5fcacaSAndreas Haerter 264