1<?php 2 3/** 4 * Main file of the "monobook" template for DokuWiki 5 * 6 * 7 * LICENSE: This file is open source software (OSS) and may be copied under 8 * certain conditions. See COPYING file for details or try to contact 9 * the author(s) of this file in doubt. 10 * 11 * @license GPLv2 (http://www.gnu.org/licenses/gpl2.html) 12 * @author ARSAVA <dokuwiki@dev.arsava.com> 13 * @link https://www.dokuwiki.org/template:monobook 14 * @link https://www.dokuwiki.org/devel:templates 15 * @link https://www.dokuwiki.org/devel:coding_style 16 * @link https://www.dokuwiki.org/devel:environment 17 * @link https://www.dokuwiki.org/devel:action_modes 18 */ 19 20 21//check if we are running within the DokuWiki environment 22if (!defined("DOKU_INC")){ 23 die(); 24} 25 26 27/** 28 * Stores the template wide action 29 * 30 * Different DokuWiki actions requiring some template logic. Therefore the 31 * template has to know, what we are doing right now - and that is what this 32 * var is for. 33 * 34 * Please have a look at the "detail.php" file in the same folder, it is also 35 * influencing the var's value. 36 * 37 * @var string 38 * @author ARSAVA <dokuwiki@dev.arsava.com> 39 */ 40$monobook_action = "article"; 41//note: I used $_REQUEST before (cause DokuWiki controls and fills it. Normally, 42// using $_REQUEST is a possible security threat. For details, see 43// <http://www.suspekt.org/2008/10/01/php-53-and-delayed-cross-site-request-forgerieshijacking/> 44// and <https://forum.dokuwiki.org/post/16524>), but it did not work as 45// expected by me (maybe it is a reference and setting $monobook_action 46// also changed the contents of $_REQUEST?!). That is why I switched back, 47// checking $_GET and $_POST like I did it before. 48if (!empty($_GET["mddo"])){ 49 $monobook_action = (string)$_GET["mddo"]; 50}elseif (!empty($_POST["mddo"])){ 51 $monobook_action = (string)$_POST["mddo"]; 52} 53if (!empty($monobook_action) && 54 $monobook_action !== "article" && 55 $monobook_action !== "print" && 56 $monobook_action !== "detail" && 57 $monobook_action !== "cite"){ 58 //ignore unknown values 59 $monobook_action = "article"; 60} 61 62 63/** 64 * Stores the template wide context 65 * 66 * This template offers discussion pages via common articles, which should be 67 * marked as "special". DokuWiki does not know any "special" articles, therefore 68 * we have to take care about detecting if the current page is a discussion 69 * page or not. 70 * 71 * @var string 72 * @author ARSAVA <dokuwiki@dev.arsava.com> 73 */ 74$monobook_context = "article"; 75if (preg_match("/^".tpl_getConf("monobook_discuss_ns")."?$|^".tpl_getConf("monobook_discuss_ns").".*?$/i", ":".getNS(getID()))){ 76 $monobook_context = "discuss"; 77} 78 79 80/** 81 * Stores the name the current client used to login 82 * 83 * @var string 84 * @author ARSAVA <dokuwiki@dev.arsava.com> 85 */ 86$loginname = ""; 87if (!empty($conf["useacl"])){ 88 if (isset($_SERVER["REMOTE_USER"]) && //no empty() but isset(): "0" may be a valid username... 89 $_SERVER["REMOTE_USER"] !== ""){ 90 $loginname = $_SERVER["REMOTE_USER"]; //$INFO["client"] would not work here (-> e.g. if 91 //current IP differs from the one used to login) 92 } 93} 94 95 96//get needed language array 97include DOKU_TPLINC."lang/en/lang.php"; 98//overwrite English language values with available translations 99if (!empty($conf["lang"]) && 100 $conf["lang"] !== "en" && 101 file_exists(DOKU_TPLINC."/lang/".$conf["lang"]."/lang.php")){ 102 //get language file (partially translated language files are no problem 103 //cause non translated stuff is still existing as English array value) 104 include DOKU_TPLINC."/lang/".$conf["lang"]."/lang.php"; 105} 106 107 108//detect revision 109$rev = (int)$INFO["rev"]; //$INFO comes from the DokuWiki core 110if ($rev < 1){ 111 $rev = (int)$INFO["lastmod"]; 112} 113 114 115//get tab config 116include DOKU_TPLINC."/conf/tabs.php"; //default 117if (file_exists(DOKU_TPLINC."/user/tabs.php")){ 118 include DOKU_TPLINC."/user/tabs.php"; //user defined 119} 120 121 122//get boxes config 123include DOKU_TPLINC."/conf/boxes.php"; //default 124if (file_exists(DOKU_TPLINC."/user/boxes.php")){ 125 include DOKU_TPLINC."/user/boxes.php"; //user defined 126} 127 128 129//get button config 130include DOKU_TPLINC."/conf/buttons.php"; //default 131if (file_exists(DOKU_TPLINC."/user/buttons.php")){ 132 include DOKU_TPLINC."/user/buttons.php"; //user defined 133} 134 135 136/** 137 * Helper to render the tabs (like a dynamic XHTML snippet) 138 * 139 * 140 * NOTE: This function is heavily inspired by "writeMBPortlet(), context.php" of 141 * the "Monobook for Dokuwiki" template by Terence J. Grant. 142 * 143 * @param array The tab data to render within the snippet. Each element is 144 * represented by a subarray: 145 * $array = array("tab1" => array("text" => "hello world!", 146 * "href" => "http://www.example.com" 147 * "nofollow" => true), 148 * "tab2" => array("text" => "I did it again", 149 * "href" => DOKU_BASE."doku.php?id=foobar", 150 * "class" => "foobar-css"), 151 * "tab3" => array("text" => "I did it again and again", 152 * "href" => wl("start", false, false, "&"), 153 * "class" => "foobar-css"), 154 * "tab4" => array("text" => "Home", 155 * "wiki" => ":start" 156 * "accesskey" => "H")); 157 * Available keys within the subarrays: 158 * - "text" (mandatory) 159 * The text/label of the element. 160 * - "href" (optional) 161 * URL the element should point to (as link). Please submit raw, 162 * unencoded URLs, the encoding will be done by this function for 163 * security reasons. If the URL is not relative 164 * (= starts with http(s)://), the URL will be treated as external 165 * (=a special style will be used if "class" is not set). 166 * - "wiki" (optional) 167 * ID of a WikiPage to link (like ":start" or ":wiki:foobar"). 168 * - "class" (optional) 169 * Name of an additional CSS class to use for the element content. 170 * Works only in combination with "text" or "href", NOT with "wiki" 171 * (will be ignored in this case). 172 * - "nofollow" (optional) 173 * If set to TRUE, rel="nofollow" will be added to the link if "href" 174 * is set (otherwise this flag will do nothing). 175 * - "accesskey" (optional) 176 * accesskey="<value>" will be added to the link if "href" is set 177 * (otherwise this option will do nothing). 178 * @author ARSAVA <dokuwiki@dev.arsava.com> 179 * @return bool 180 * @see _monobook_renderButtons() 181 * @see _monobook_renderBoxes() 182 * @link http://www.wikipedia.org/wiki/Nofollow 183 * @link http://de.selfhtml.org/html/verweise/tastatur.htm#kuerzel 184 * @link https://www.dokuwiki.org/devel:environment 185 * @link https://www.dokuwiki.org/devel:coding_style 186 */ 187function _monobook_renderTabs($arr) 188{ 189 //is there something useful? 190 if (empty($arr) || 191 !is_array($arr)){ 192 return false; //nope, break operation 193 } 194 195 //array to store the created tabs into 196 $elements = array(); 197 198 //handle the tab data 199 foreach($arr as $li_id => $element){ 200 //basic check 201 if (empty($element) || 202 !is_array($element) || 203 !isset($element["text"])){ 204 continue; //ignore invalid stuff and go on 205 } 206 $li_created = true; //flag to control if we created any list element 207 $interim = ""; 208 //do we have an external link? 209 if (!empty($element["href"])){ 210 //add URL 211 $interim = "<a href=\"".hsc($element["href"])."\""; //@TODO: real URL encoding 212 //add rel="nofollow" attribute to the link? 213 if (!empty($element["nofollow"])){ 214 $interim .= " rel=\"nofollow\""; 215 } 216 //add special css class? 217 if (!empty($element["class"])){ 218 $interim .= " class=\"".hsc($element["class"])."\""; 219 } elseif (substr($element["href"], 0, 4) === "http" || 220 substr($element["href"], 0, 3) === "ftp"){ 221 $interim .= " class=\"urlextern\""; 222 } 223 //add access key? 224 if (!empty($element["accesskey"])){ 225 $interim .= " accesskey=\"".hsc($element["accesskey"])."\" title=\"[ALT+".hsc(strtoupper($element["accesskey"]))."]\""; 226 } 227 $interim .= ">".hsc($element["text"])."</a>"; 228 //internal wiki link 229 }else if (!empty($element["wiki"])){ 230 //add special css class? 231 if (!empty($element["class"])){ 232 $interim = "<span class=\"".hsc($element["class"])."\">".html_wikilink($element["wiki"], hsc($element["text"]))."</span>"; 233 }else{ 234 $interim = html_wikilink($element["wiki"], hsc($element["text"])); 235 } 236 /* Following works, but I think it is too heavy... //use a wiki page as content 237 } elseif ($element["wiki_include"]){ 238 239 //we have to show a wiki page. get the rendered content of the 240 //defined wiki article to use as content. 241 $interim = tpl_include_page($element["wiki_include"], false); 242 if ($interim === "" || 243 $interim === false){ 244 //show creation/edit link if the defined page got no content 245 $interim = "[ ".html_wikilink($element["wiki_include"], hsc($lang["monobook_fillplaceholder"]." (".hsc($element["wiki_include"]).")"))." ]<br />"; 246 }*/ 247 //text only 248 }else{ 249 $interim = "<span"; 250 //add special css class? 251 if (!empty($element["class"])){ 252 $interim .= " class=\"".hsc($element["class"])."\""; 253 }else{ 254 $interim .= " style=\"color:#ccc;\""; 255 } 256 $interim .= "> ".hsc($element["text"])." </span>"; 257 } 258 //store it 259 $elements[] = " <li id=\"".hsc($li_id)."\">".$interim."</li>\n"; 260 } 261 262 //show everything created 263 if (!empty($elements)){ 264 echo "\n" 265 ." <div id=\"p-cactions\" class=\"portlet\">\n" //don't touch the id, it is needed as css selector 266 ." <ul>\n"; 267 foreach ($elements as $element){ 268 echo $element; 269 } 270 echo " </ul>\n" 271 ." </div>\n"; 272 } 273 return true; 274} 275 276 277/** 278 * Helper to render the boxes (like a dynamic XHTML snippet) 279 * 280 * 281 * NOTE: This function is heavily inspired by "writeMBPortlet(), context.php" of 282 * the "Monobook for Dokuwiki" template by Terence J. Grant. 283 * 284 * @param array The box data to render within the snippet. Each box is 285 * represented by a subarray: 286 * $array = array("box-id1" => array("headline" => "hello world!", 287 * "xhtml" => "I am <i>here</i>.")); 288 * Available keys within the subarrays: 289 * - "xhtml" (mandatory) 290 * The content of the Box you want to show as XHTML. Attention: YOU 291 * HAVE TO TAKE CARE ABOUT FILTER EVENTUALLY USED INPUT/SECURITY. Be 292 * aware of XSS and stuff. 293 * - "headline" (optional) 294 * Headline to show above the box. Leave empty/do not set for none. 295 * @author ARSAVA <dokuwiki@dev.arsava.com> 296 * @return bool 297 * @see _monobook_renderButtons() 298 * @see _monobook_renderTabs() 299 * @link http://www.wikipedia.org/wiki/Nofollow 300 * @link http://www.wikipedia.org/wiki/Cross-site_scripting 301 * @link https://www.dokuwiki.org/devel:coding_style 302 */ 303function _monobook_renderBoxes($arr) 304{ 305 //is there something useful? 306 if (empty($arr) || 307 !is_array($arr)){ 308 return false; //nope, break operation 309 } 310 311 //array to store the created boxes into 312 $boxes = array(); 313 $search_handled = false; 314 315 //handle the box data 316 foreach($arr as $div_id => $contents){ 317 //basic check 318 if (empty($contents) || 319 !is_array($contents) || 320 !isset($contents["xhtml"])){ 321 continue; //ignore invalid stuff and go on 322 } 323 $interim = " <div class=\"portlet\" id=\"".hsc($div_id)."\">\n"; 324 if (isset($contents["headline"]) 325 && $contents["headline"] !== ""){ 326 //hack for search box 327 if ($search_handled === true || 328 $div_id !== "p-search") { 329 $interim .= " <h5>".hsc($contents["headline"])."</h5>\n"; 330 } else { 331 $interim .= " <h5><label for=\"qsearch__in\">".hsc($contents["headline"])."</label></h5>\n"; 332 } 333 } 334 $interim .= " <div class=\"pBody\">\n" 335 ." <div class=\"dokuwiki\">\n" //dokuwiki CSS class needed cause we might have to show rendered page content 336 .$contents["xhtml"]."\n" 337 ." </div>\n" 338 ." </div>\n" 339 ." </div>\n"; 340 //hack for search box 341 if ($search_handled === false && 342 $div_id === "p-search") { 343 $interim .= " <div id=\"qsearch__out\" class=\"ajax_qsearch JSpopup\"></div>\n"; 344 //set flag 345 $search_handled = true; 346 } 347 //store it 348 $boxes[] = $interim; 349 } 350 //show everything created 351 if (!empty($boxes)){ 352 echo "\n"; 353 foreach ($boxes as $box){ 354 echo $box; 355 } 356 echo "\n"; 357 } 358 359 return true; 360} 361 362 363/** 364 * Helper to render the footer buttons (like a dynamic XHTML snippet) 365 * 366 * @param array The button data to render within the snippet. Each element is 367 * represented by a subarray: 368 * $array = array("btn1" => array("img" => DOKU_TPL."static/img/button-monobook.png", 369 * "href" => "https://andreashaerter.com/", 370 * "width" => 80, 371 * "height" => 15, 372 * "title" => "Andreas Haerters's website", 373 * "nofollow" => true), 374 * "btn2" => array("img" => DOKU_TPL."user/mybutton1.png", 375 * "href" => wl("start", false, false, "&")), 376 * "btn3" => array("img" => DOKU_TPL."user/mybutton2.png", 377 * "href" => "http://www.example.com"); 378 * Available keys within the subarrays: 379 * - "img" (mandatory) 380 * The relative or full path of an image/button to show. Users may 381 * place own images within the /user/ dir of this template. 382 * - "href" (mandatory) 383 * URL the element should point to (as link). Please submit raw, 384 * unencoded URLs, the encoding will be done by this function for 385 * security reasons. 386 * - "width" (optional) 387 * width="<value>" will be added to the image tag if both "width" and 388 * "height" are set (otherwise, this will be ignored). 389 * - "height" (optional) 390 * height="<value>" will be added to the image tag if both "height" and 391 * "width" are set (otherwise, this will be ignored). 392 * - "nofollow" (optional) 393 * If set to TRUE, rel="nofollow" will be added to the link. 394 * - "title" (optional) 395 * title="<value>" will be added to the link and image if "title" 396 * is set + alt="<value>". 397 * @author ARSAVA <dokuwiki@dev.arsava.com> 398 * @return bool 399 * @see _monobook_renderButtons() 400 * @see _monobook_renderBoxes() 401 * @link http://www.wikipedia.org/wiki/Nofollow 402 * @link https://www.dokuwiki.org/devel:coding_style 403 */ 404function _monobook_renderButtons($arr) 405{ 406 //array to store the created buttons into 407 $elements = array(); 408 409 //handle the button data 410 foreach($arr as $li_id => $element){ 411 //basic check 412 if (empty($element) || 413 !is_array($element) || 414 !isset($element["img"]) || 415 !isset($element["href"])){ 416 continue; //ignore invalid stuff and go on 417 } 418 $interim = ""; 419 420 //add URL 421 $interim = "<a href=\"".hsc($element["href"])."\""; //@TODO: real URL encoding 422 //add rel="nofollow" attribute to the link? 423 if (!empty($element["nofollow"])){ 424 $interim .= " rel=\"nofollow\""; 425 } 426 //add title attribute to the link? 427 if (!empty($element["title"])){ 428 $interim .= " title=\"".hsc($element["title"])."\""; 429 } 430 $interim .= " target=\"_blank\"><img src=\"".hsc($element["img"])."\""; 431 //add width and height attribute to the image? 432 if (!empty($element["width"]) && 433 !empty($element["height"])){ 434 $interim .= " width=\"".(int)$element["width"]."\" height=\"".(int)$element["height"]."\""; 435 } 436 //add title and alt attribute to the image? 437 if (!empty($element["title"])){ 438 $interim .= " title=\"".hsc($element["title"])."\" alt=\"".hsc($element["title"])."\""; 439 } else { 440 $interim .= " alt=\"\""; //alt is a mandatory attribute for images 441 } 442 $interim .= " border=\"0\" /></a>"; 443 444 //store it 445 $elements[] = " ".$interim."\n"; 446 } 447 448 //show everything created 449 if (!empty($elements)){ 450 echo "\n"; 451 foreach ($elements as $element){ 452 echo $element; 453 } 454 } 455 return true; 456} 457 458//workaround for the "jumping textarea" IE bug. CSS only fix not possible cause 459//some DokuWiki JavaScript is triggering this bug, too. See the following for 460//info: 461//- <http://blog.andreas-haerter.com/2010/05/28/fix-msie-8-auto-scroll-textarea-css-width-percentage-bug> 462//- <http://msdn.microsoft.com/library/cc817574.aspx> 463if ($ACT === "edit" && 464 !headers_sent()){ 465 header("X-UA-Compatible: IE=EmulateIE7"); 466} 467 468?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 469 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 470<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"]); ?>"> 471<head> 472<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 473<title><?php tpl_pagetitle(); echo " - ".hsc($conf["title"]); ?></title> 474<?php 475//show meta-tags 476tpl_metaheaders(); 477echo "<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\" />"; 478 479//include default or userdefined favicon 480// 481//note: since 2011-04-22 "Rincewind RC1", there is a core function named 482// "tpl_getFavicon()". But its functionality is not really fitting the 483// behaviour of this template, therefore I don't use it here. 484if (file_exists(DOKU_TPLINC."user/favicon.ico")){ 485 //user defined - you might find http://tools.dynamicdrive.com/favicon/ 486 //useful to generate one 487 echo "\n<link rel=\"shortcut icon\" href=\"".DOKU_TPL."user/favicon.ico\" />\n"; 488}elseif (file_exists(DOKU_TPLINC."user/favicon.png")){ 489 //note: I do NOT recommend PNG for favicons (cause it is not supported by 490 //all browsers), but some users requested this feature. 491 echo "\n<link rel=\"shortcut icon\" href=\"".DOKU_TPL."user/favicon.png\" />\n"; 492}else{ 493 //default 494 echo "\n<link rel=\"shortcut icon\" href=\"".DOKU_TPL."static/3rd/dokuwiki/favicon.ico\" />\n"; 495} 496 497//include default or userdefined Apple Touch Icon (see <http://j.mp/sx3NMT> for 498//details) 499if (file_exists(DOKU_TPLINC."user/apple-touch-icon.png")){ 500 echo "<link rel=\"apple-touch-icon\" href=\"".DOKU_TPL."user/apple-touch-icon.png\" />\n"; 501}else{ 502 //default 503 echo "<link rel=\"apple-touch-icon\" href=\"".DOKU_TPL."static/3rd/dokuwiki/apple-touch-icon.png\" />\n"; 504} 505 506//load userdefined js? 507if (tpl_getConf("monobook_loaduserjs") && file_exists(DOKU_TPLINC."user/user.js")){ 508 echo "<script type=\"text/javascript\" charset=\"utf-8\" src=\"".DOKU_TPL."user/user.js\"></script>\n"; 509} 510 511//show printable version? 512if ($monobook_action === "print"){ 513 //note: this is just a workaround for people searching for a print version. 514 // don't forget to update the styles.ini, this is the really important 515 // thing! BTW: good text about this: http://is.gd/5MyG5 516 echo "<link rel=\"stylesheet\" media=\"all\" type=\"text/css\" href=\"".DOKU_TPL."static/css/print.css\" />\n" 517 ."<link rel=\"stylesheet\" media=\"all\" type=\"text/css\" href=\"".DOKU_TPL."static/3rd/wikipedia/commonPrint.css\" />\n"; 518 if (file_exists(DOKU_TPL."user/print.css")){ 519 echo "<link rel=\"stylesheet\" media=\"all\" type=\"text/css\" href=\"".DOKU_TPL."user/print.css\" />\n"; 520 } 521} 522 523//load language specific css hacks? 524if (file_exists(DOKU_TPLINC."lang/".$conf["lang"]."/style.css")){ 525 $interim = trim(file_get_contents(DOKU_TPLINC."lang/".$conf["lang"]."/style.css")); 526 if (!empty($interim)){ 527 echo "<style type=\"text/css\" media=\"all\">\n".hsc($interim)."\n</style>\n"; 528 } 529} 530?> 531<!--[if lte IE 8]><link rel="stylesheet" media="all" type="text/css" href="<?php echo DOKU_TPL; ?>static/css/screen_iehacks.css" /><![endif]--> 532<!--[if lt IE 5.5000]><link rel="stylesheet" media="all" type="text/css" href="<?php echo DOKU_TPL; ?>static/3rd/monobook/IE50Fixes.css" /><![endif]--> 533<!--[if IE 5.5000]><link rel="stylesheet" media="all" type="text/css" href="<?php echo DOKU_TPL; ?>static/3rd/monobook/IE55Fixes.css" /><![endif]--> 534<!--[if IE 6]><link rel="stylesheet" media="all" type="text/css" href="<?php echo DOKU_TPL; ?>static/3rd/monobook/IE60Fixes.css" /><![endif]--> 535<!--[if IE 7]><link rel="stylesheet" media="all" type="text/css" href="<?php echo DOKU_TPL; ?>static/3rd/monobook/IE70Fixes.css" /><![endif]--> 536<!--[if lt IE 7]><script type="text/javascript" charset="utf-8" src="<?php echo DOKU_TPL; ?>static/3rd/wikipedia/IEFixes.js"></script><meta http-equiv="imagetoolbar" content="no" /><![endif]--> 537</head> 538<body class="<?php //different styles/backgrounds for different page types 539 switch (true){ 540 //special: tech 541 case ($monobook_action === "detail"): 542 case ($monobook_action === "cite"): 543 case ($ACT === "media"): //var comes from DokuWiki 544 case ($ACT === "search"): //var comes from DokuWiki 545 echo "mediawiki ns-2 ltr"; 546 break; 547 //special: other 548 case ($ACT === "edit"): //var comes from DokuWiki 549 case ($ACT === "draft"): //var comes from DokuWiki 550 case ($ACT === "revisions"): //var comes from DokuWiki 551 case ($monobook_context === "discuss"): 552 case (preg_match("/^wiki$|^wiki:.*?$/i", getNS(getID()))): 553 echo "mediawiki ns-1 ltr"; 554 break; 555 //"normal" content 556 case ($monobook_action === "print"): 557 default: 558 echo "mediawiki ns-0 ltr"; 559 break; 560 } 561 ?>"> 562<div id="globalWrapper"> 563 564 <div id="column-content"> 565 <div id="content"> 566 <a name="top" id="top"></a> 567 <a name="dokuwiki__top" id="dokuwiki__top"></a> 568 <div id="bodyContent"> 569 <div class="dokuwiki"> 570 <!-- start main content area --> 571 <?php 572 //show messages (if there are any) 573 html_msgarea(); 574 //show site notice 575 if (tpl_getConf("monobook_sitenotice")){ 576 //detect wiki page to load as content 577 if (!empty($transplugin) && //var comes from conf/boxes.php 578 is_object($transplugin) && 579 tpl_getConf("monobook_sitenotice_translate")){ 580 //translated site notice? 581 $transplugin_langcur = $transplugin->hlp->getLangPart(cleanID(getId())); //current language part 582 $transplugin_langs = explode(" ", trim($transplugin->getConf("translations"))); //available languages 583 if (empty($transplugin_langs) || 584 empty($transplugin_langcur) || 585 !is_array($transplugin_langs) || 586 !in_array($transplugin_langcur, $transplugin_langs)) { 587 //current page is no translation or something is wrong, load default site notice 588 $sitenotice_location = tpl_getConf("monobook_sitenotice_location"); 589 } else { 590 //load language specific site notice 591 $sitenotice_location = tpl_getConf("monobook_sitenotice_location")."_".$transplugin_langcur; 592 } 593 }else{ 594 //default site notice, no translation 595 $sitenotice_location = tpl_getConf("monobook_sitenotice_location"); 596 } 597 598 //we have to show a custom site notice 599 if (empty($conf["useacl"]) || 600 auth_quickaclcheck(cleanID($sitenotice_location)) >= AUTH_READ){ //current user got access? 601 echo "\n <div id=\"siteNotice\" class=\"noprint\">\n"; 602 //get the rendered content of the defined wiki article to use as 603 //custom site notice. 604 $interim = tpl_include_page($sitenotice_location, false); 605 if ($interim === "" || 606 $interim === false){ 607 //show creation/edit link if the defined page got no content 608 echo "[ "; 609 tpl_pagelink($sitenotice_location, hsc($lang["monobook_fillplaceholder"]." (".hsc($sitenotice_location).")")); 610 echo " ]<br />"; 611 }else{ 612 //show the rendered page content 613 echo $interim; 614 } 615 echo "\n </div>\n"; 616 } 617 } 618 //show breadcrumps if enabled and positioned on top 619 if ($conf["breadcrumbs"] == true && 620 $ACT !== "media" && //var comes from DokuWiki 621 (empty($conf["useacl"]) || //are there any users? 622 $loginname !== "" || //user is logged in? 623 !tpl_getConf("monobook_closedwiki")) && 624 tpl_getConf("monobook_breadcrumbs_position") === "top"){ 625 echo "\n <div class=\"catlinks noprint\"><p>\n "; 626 tpl_breadcrumbs(); 627 echo "\n </p></div>\n"; 628 } 629 //show hierarchical breadcrumps if enabled and positioned on top 630 if ($conf["youarehere"] == true && 631 $ACT !== "media" && //var comes from DokuWiki 632 (empty($conf["useacl"]) || //are there any users? 633 $loginname !== "" || //user is logged in? 634 !tpl_getConf("monobook_closedwiki")) && 635 tpl_getConf("monobook_youarehere_position") === "top"){ 636 echo "\n <div class=\"catlinks noprint\"><p>\n "; 637 tpl_youarehere(); 638 echo "\n </p></div>\n"; 639 } 640 ?> 641 642 <!-- start rendered wiki content --> 643 <?php 644 //flush the buffer for faster page rendering, heaviest content follows 645 if (function_exists("tpl_flush")) { 646 tpl_flush(); //exists since 2010-11-07 "Anteater"... 647 } else { 648 flush(); //...but I won't loose compatibility to 2009-12-25 "Lemming" right now. 649 } 650 //decide which type of pagecontent we have to show 651 switch ($monobook_action){ 652 //"image details" 653 case "detail": 654 include DOKU_TPLINC."inc_detail.php"; 655 break; 656 //"cite this article" 657 case "cite": 658 include DOKU_TPLINC."inc_cite.php"; 659 break; 660 //show "normal" content 661 default: 662 tpl_content(((tpl_getConf("monobook_toc_position") === "article") ? true : false)); 663 break; 664 } 665 ?> 666 <!-- end rendered wiki content --> 667 668 <br /> 669 <?php 670 //show breadcrumps if enabled and positioned on bottom 671 if ($conf["breadcrumbs"] == true && 672 $ACT !== "media" && //var comes from DokuWiki 673 (empty($conf["useacl"]) || //are there any users? 674 $loginname !== "" || //user is logged in? 675 !tpl_getConf("monobook_closedwiki")) && 676 tpl_getConf("monobook_breadcrumbs_position") === "bottom"){ 677 echo "\n <div class=\"catlinks noprint\"><p>\n "; 678 tpl_breadcrumbs(); 679 echo "\n </p></div>\n"; 680 } 681 //show hierarchical breadcrumps if enabled and positioned on bottom 682 if ($conf["youarehere"] == true && 683 $ACT !== "media" && //var comes from DokuWiki 684 (empty($conf["useacl"]) || //are there any users? 685 $loginname !== "" || //user is logged in? 686 !tpl_getConf("monobook_closedwiki")) && 687 tpl_getConf("monobook_youarehere_position") === "bottom"){ 688 echo "\n <div class=\"catlinks noprint\"><p>\n "; 689 tpl_youarehere(); 690 echo "\n </p></div>\n"; 691 } 692 ?> 693 694 <!-- end main content area --> 695 <div class="visualClear"></div> 696 </div> 697 </div> 698 </div> 699 </div> 700 701 <div id="column-one" class="noprint"> 702 <div class="portlet" id="p-logo"> 703 <?php 704 //include default or userdefined logo 705 echo "<a href=\"".wl()."\" "; 706 if (file_exists(DOKU_TPLINC."user/logo.png")){ 707 //user defined PNG 708 echo "style=\"background-image:url(".DOKU_TPL."user/logo.png);\""; 709 }elseif (file_exists(DOKU_TPLINC."user/logo.gif")){ 710 //user defined GIF 711 echo "style=\"background-image:url(".DOKU_TPL."user/logo.gif);\""; 712 }elseif (file_exists(DOKU_TPLINC."user/logo.jpg")){ 713 //user defined JPG 714 echo "style=\"background-image:url(".DOKU_TPL."user/logo.jpg);\""; 715 }else{ 716 //default 717 echo "style=\"background-image:url(".DOKU_TPL."static/3rd/dokuwiki/logo.png);\""; 718 } 719 echo " accesskey=\"h\" title=\"[ALT+H]\"></a>\n"; 720 ?> 721 </div> 722 <?php 723 //show tabs, see monobook/user/tabs.php to configure them 724 if (!empty($_monobook_tabs) && 725 is_array($_monobook_tabs)){ 726 _monobook_renderTabs($_monobook_tabs); 727 } 728 729 //show personal tools 730 if (!empty($conf["useacl"])){ //...makes only sense if there are users 731 echo "\n" 732 ." <div id=\"p-personal\" class=\"portlet\">\n" 733 ." <div class=\"pBody\">\n" 734 ." <ul>\n"; 735 //login? 736 if ($loginname === ""){ 737 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 738 }else{ 739 //username and userpage 740 echo " <li id=\"pt-userpage\">".(tpl_getConf("monobook_userpage") 741 ? html_wikilink(tpl_getConf("monobook_userpage_ns").$loginname, hsc($loginname)) 742 : hsc($loginname))."</li>"; 743 //admin 744 if (!empty($INFO["isadmin"]) || 745 !empty($INFO["ismanager"])){ 746 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 747 } 748 //personal discussion 749 if (tpl_getConf("monobook_discuss") && 750 tpl_getConf("monobook_userpage")){ 751 echo " <li id=\"pt-mytalk\">".html_wikilink(tpl_getConf("monobook_discuss_ns").ltrim(tpl_getConf("monobook_userpage_ns"), ":").$loginname, hsc($lang["monobook_tab_mytalk"]))."</li>"; 752 } 753 //profile 754 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 755 //logout 756 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 757 } 758 echo " </ul>\n" 759 ." </div>\n" 760 ." </div>\n"; 761 } 762 763 //show boxes, see monobook/user/boxes.php to configure them 764 if (!empty($_monobook_boxes) && 765 is_array($_monobook_boxes)){ 766 _monobook_renderBoxes($_monobook_boxes); 767 } 768 ?> 769 </div> <!-- end of the left (by default at least) column --> 770 771 <div class="visualClear"></div> 772 773 <div id="footer" class="noprint"> 774 <div id="footer-buttons"> 775 <?php 776 //show buttons, see monobook/user/buttons.php to configure them 777 if (!empty($_monobook_btns) && 778 is_array($_monobook_btns)){ 779 _monobook_renderButtons($_monobook_btns); 780 } 781 ?> 782 </div> 783 <ul id="f-list"> 784 <li id="lastmod"> 785 <?php tpl_pageinfo()?><br /> 786 </li> 787 <?php 788 //copyright notice 789 if (tpl_getConf("monobook_copyright")){ 790 //show dokuwiki's default notice? 791 if (tpl_getConf("monobook_copyright_default")){ 792 echo "<li id=\"copyright\">\n <div class=\"dokuwiki\">"; 793 tpl_license(false); 794 echo "</div>\n </li>\n"; 795 //show custom notice 796 }else{ 797 //detect wiki page to load as content 798 if (!empty($transplugin) && //var comes from conf/boxes.php 799 is_object($transplugin) && 800 tpl_getConf("monobook_copyright_translate")){ 801 //translated copyright notice? 802 $transplugin_langcur = $transplugin->hlp->getLangPart(cleanID(getId())); //current language part 803 $transplugin_langs = explode(" ", trim($transplugin->getConf("translations"))); //available languages 804 if (empty($transplugin_langs) || 805 empty($transplugin_langcur) || 806 !is_array($transplugin_langs) || 807 !in_array($transplugin_langcur, $transplugin_langs)) { 808 //current page is no translation or something is wrong, load default copyright notice 809 $copyright_location = tpl_getConf("monobook_copyright_location"); 810 } else { 811 //load language specific copyright notice 812 $copyright_location = tpl_getConf("monobook_copyright_location")."_".$transplugin_langcur; 813 } 814 }else{ 815 //default copyright notice, no translation 816 $copyright_location = tpl_getConf("monobook_copyright_location"); 817 } 818 819 if (empty($conf["useacl"]) || 820 auth_quickaclcheck(cleanID($copyright_location)) >= AUTH_READ){ //current user got access? 821 echo "<li id=\"copyright\">\n "; 822 //get the rendered content of the defined wiki article to use as custom notice 823 $interim = tpl_include_page($copyright_location, false); 824 if ($interim === "" || 825 $interim === false){ 826 //show creation/edit link if the defined page got no content 827 echo "[ "; 828 tpl_pagelink($copyright_location, hsc($lang["monobook_fillplaceholder"]." (".hsc($copyright_location).")")); 829 echo " ]<br />"; 830 }else{ 831 //show the rendered page content 832 echo "<div class=\"dokuwiki\">\n" //dokuwiki CSS class needed cause we are showing rendered page content 833 .$interim."\n " 834 ."</div>"; 835 } 836 echo "\n </li>\n"; 837 } 838 } 839 } 840 ?> 841 <li id="usermod"> 842 <?php tpl_userinfo(); ?><br /> 843 </li> 844 </ul> 845 </div> 846 847</div> <!-- end of global wrap --> 848<a href="<?php echo wl("", array("do" => "recent"));?>" accesskey="r" style="visibility:hidden;" rel="nofollow"> </a> 849<?php 850//provide DokuWiki housekeeping, required in all templates 851tpl_indexerWebBug(); 852 853//include web analytics software 854if (file_exists(DOKU_TPLINC."/user/tracker.php")){ 855 include DOKU_TPLINC."/user/tracker.php"; 856} 857?> 858</body> 859</html> 860