* @link https://www.dokuwiki.org/template:mnml-blog * @link https://www.dokuwiki.org/devel:templates * @link https://www.dokuwiki.org/devel:coding_style * @link https://www.dokuwiki.org/devel:environment * @link https://www.dokuwiki.org/devel:action_modes */ //check if we are running within the DokuWiki environment if (!defined("DOKU_INC")){ die(); } /** * Stores the name the current client used to login * * @var string * @author ARSAVA */ $loginname = ""; if (!empty($conf["useacl"])){ if (isset($_SERVER["REMOTE_USER"]) && //no empty() but isset(): "0" may be a valid username... $_SERVER["REMOTE_USER"] !== ""){ $loginname = $_SERVER["REMOTE_USER"]; //$INFO["client"] would not work here (-> e.g. when //current IP differs from the one used to login) } } //get needed language array include DOKU_TPLINC."lang/en/lang.php"; //overwrite English language values with available translations if (!empty($conf["lang"]) && $conf["lang"] != "en" && file_exists(DOKU_TPLINC."/lang/".$conf["lang"]."/lang.php")){ //get language file (partially translated language files are no problem //cause non translated stuff is still existing as English array value) include DOKU_TPLINC."/lang/".$conf["lang"]."/lang.php"; } //detect revision $rev = (int)$INFO["rev"]; //$INFO comes from the DokuWiki core if ($rev < 1){ $rev = (int)$INFO["lastmod"]; } //get boxes config if (file_exists(DOKU_TPLINC."/user/boxes.php")){ //user defined include DOKU_TPLINC."/user/boxes.php"; } //add box for QR Code of current page's URL (powered by ) if (tpl_getConf("mnmlblog_qrcodebox")){ $_mnmlblog_boxes["qrcode"]["headline"] = $lang["mnmlblog_qrcodebox_qrcode"]; $_mnmlblog_boxes["qrcode"]["xhtml"] = "".((cleanID(getID()) === "start") ? "" : "")."\"".hsc($lang["mnmlblog_qrcodebox_qrcode"])."".((cleanID(getID()) === "start") ? "" : "").""; } /** * Helper to render the boxes (like a dynamic XHTML snippet) * * @param array The box data to render within the snippet. Each box is * represented through an subarray: * $array = array("box-id1" => array("headline" => "hello world!", * "xhtml" => "I am here.")); * Available keys within the subarrays: * - "xhtml" (mandatory) * The content of the Box you want to show as XHTML. Attention: YOU * HAVE TO TAKE CARE ABOUT FILTER EVENTUALLY USED INPUT/SECURITY. Be * aware of XSS and stuff. * - "headline" (optional) * Headline to show above the box. Leave empty/do not set for none. * @author ARSAVA * @link http://www.wikipedia.org/wiki/Nofollow * @link http://www.wikipedia.org/wiki/Cross-site_scripting * @link https://www.dokuwiki.org/devel:coding_style */ function _mnmlblog_renderBoxes($arr) { //is there something useful? if (empty($arr) || !is_array($arr)){ return false; //nope, break operation } //array to store the created boxes into $boxes = array(); //handle the box data foreach($arr as $div_id => $contents){ //basic check if (empty($contents) || !is_array($contents) || !isset($contents["xhtml"])){ continue; //ignore invalid stuff and go on } $interim = "\n
\n"; if (!empty($contents["headline"])){ $interim .= "
".hsc($contents["headline"])."
\n"; } $interim .= "
".$contents["xhtml"]."
" ."\n
\n\n"; //store it $boxes[] = $interim; } //show everything created if (!empty($boxes)){ foreach ($boxes as $box){ echo $box; } } return true; } //workaround for the "jumping textarea" IE bug. CSS only fix not possible cause //some DokuWiki JavaScript is triggering this bug, too. See the following for //info: //- //- if ($ACT === "edit" && !headers_sent()){ header("X-UA-Compatible: IE=EmulateIE7"); } ?> " lang="" dir=""> <?php tpl_pagetitle(); echo " - ".hsc($conf["title"]); ?> "; //include default or userdefined favicon // //note: since 2011-04-22 "Rincewind RC1", there is a core function named // "tpl_getFavicon()". But its functionality is not really fitting the // behaviour of this template, therefore I don't use it here exclusively. if (file_exists(DOKU_TPLINC."user/favicon.ico")){ //user defined - you might find http://tools.dynamicdrive.com/favicon/ //useful to generate one echo "\n\n"; }elseif (file_exists(DOKU_TPLINC."user/favicon.png")){ //note: I do NOT recommend PNG for favicons (cause it is not supported by //all browsers). echo "\n\n"; }else{ //default echo "\n\n"; } //include default or userdefined Apple Touch Icon (see for //details) if (file_exists(DOKU_TPLINC."user/apple-touch-icon.png")){ echo "\n"; }else{ //default echo "\n"; } //load userdefined js? if (tpl_getConf("mnmlblog_loaduserjs") && file_exists(DOKU_TPLINC."user/user.js")){ echo "\n"; } ?>
>
\"\"/\n"; }elseif (file_exists(DOKU_TPLINC."user/logo.gif")){ //user defined GIF echo ">\"\"/\n"; }elseif (file_exists(DOKU_TPLINC."user/logo.jpg")){ //user defined JPG echo ">\"\"/\n"; }else{ //default echo " class=\"tmpl_header_logo_txt\">".hsc($conf["title"])."\n"; } //show header navigation? if (tpl_getConf("mnmlblog_headernav")){ echo "\n
\n"; //we have to show a custom navigation if (empty($conf["useacl"]) || auth_quickaclcheck(cleanID(tpl_getConf("mnmlblog_headernav_location")))){ //current user got access? //get the rendered content of the defined wiki article to use as custom navigation $interim = tpl_include_page(tpl_getConf("mnmlblog_headernav_location"), false); if ($interim === "" || $interim === false){ //show creation/edit link if the defined page got no content echo "[ "; tpl_pagelink(tpl_getConf("mnmlblog_headernav_location"), hsc($lang["mnmlblog_fillplaceholder"]." (".tpl_getConf("mnmlblog_headernav_location").")")); echo " ]
"; }else{ //show the rendered page content echo $interim; } } if (tpl_getConf("mnmlblog_search") && tpl_getConf("mnmlblog_search_pos") === "headernav"){ echo "\n
\n"; tpl_searchform(); echo "\n
\n"; } echo "
\n
\n"; } ?>
>
\n"; //we have to show a custom navigation if (empty($conf["useacl"]) || auth_quickaclcheck(cleanID(tpl_getConf("mnmlblog_sidebarnav_location")))){ //current user got access? //get the rendered content of the defined wiki article to use as custom navigation $interim = tpl_include_page(tpl_getConf("mnmlblog_sidebarnav_location"), false); if ($interim === "" || $interim === false){ //show creation/edit link if the defined page got no content echo "[ "; tpl_pagelink(tpl_getConf("mnmlblog_sidebarnav_location"), hsc($lang["mnmlblog_fillplaceholder"]." (".tpl_getConf("mnmlblog_sidebarnav_location").")")); echo " ]
"; }else{ //show the rendered page content echo $interim; } } echo "
\n"; } ?> \n" ."
".hsc($lang["mnmlblog_search"])."
\n" ."
"; tpl_searchform(); echo "\n
\n
\n"; }?> \n "; if (tpl_getConf("mnmlblog_copyright_default")){ tpl_license(false); }else{ if (empty($conf["useacl"]) || auth_quickaclcheck(cleanID(tpl_getConf("mnmlblog_copyright_location")))){ //current user got access? //get the rendered content of the defined wiki article to use as custom notice $interim = tpl_include_page(tpl_getConf("mnmlblog_copyright_location"), false); if ($interim === "" || $interim === false){ //show creation/edit link if the defined page got no content echo "[ "; tpl_pagelink(tpl_getConf("mnmlblog_copyright_location"), hsc($lang["mnmlblog_fillplaceholder"]." (".tpl_getConf("mnmlblog_copyright_location").")")); echo " ]
"; }else{ //show the rendered page content echo $interim; } } } echo "\n
\n\n"; } ?>