1ed7b5f09Sandi<?php 215fae107Sandi/** 315fae107Sandi * HTML output functions 415fae107Sandi * 515fae107Sandi * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 615fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 715fae107Sandi */ 815fae107Sandi 9ed7b5f09Sandiif(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); 10e226efe1SAndreas Gohrif(!defined('NL')) define('NL',"\n"); 116bbae538Sandirequire_once(DOKU_INC.'inc/parserutils.php'); 126bbae538Sandi 13f3f0262cSandi/** 14f3f0262cSandi * Convenience function to quickly build a wikilink 1515fae107Sandi * 1615fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 17f3f0262cSandi */ 1830f1737dSandifunction html_wikilink($id,$name=NULL,$search=''){ 19723d78dbSandi static $xhtml_renderer = NULL; 20723d78dbSandi if(is_null($xhtml_renderer)){ 21fdf3dcb9SMatthias Urlichs require_once(DOKU_INC.'inc/parser/xhtml.php'); 22723d78dbSandi $xhtml_renderer = new Doku_Renderer_xhtml(); 23f3f0262cSandi } 24f3f0262cSandi 25cffcc403Sandi return $xhtml_renderer->internallink($id,$name,$search,true); 26f3f0262cSandi} 27f3f0262cSandi 28f3f0262cSandi/** 29c19fe9c0Sandi * Helps building long attribute lists 30c19fe9c0Sandi * 31c19fe9c0Sandi * @author Andreas Gohr <andi@splitbrain.org> 32c19fe9c0Sandi */ 33c19fe9c0Sandifunction html_attbuild($attributes){ 34c19fe9c0Sandi $ret = ''; 35c19fe9c0Sandi foreach ( $attributes as $key => $value ) { 36c19fe9c0Sandi $ret .= $key.'="'.formtext($value).'" '; 37c19fe9c0Sandi } 38c19fe9c0Sandi return trim($ret); 39c19fe9c0Sandi} 40c19fe9c0Sandi 41c19fe9c0Sandi/** 42f3f0262cSandi * The loginform 4315fae107Sandi * 4415fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 455b62573aSAndreas Gohr * @triggers HTML_LOGINFORM_INJECTION 46f3f0262cSandi */ 47f3f0262cSandifunction html_login(){ 48f3f0262cSandi global $lang; 49f3f0262cSandi global $conf; 50f3f0262cSandi global $ID; 51cd52f92dSchris global $auth; 52f3f0262cSandi 53c112d578Sandi print p_locale_xhtml('login'); 54f3f0262cSandi ?> 5596331712SAnika Henke <div class="centeralign"> 568d975344SAndreas Gohr <form action="<?php echo script()?>" accept-charset="<?php echo $lang['encoding']?>" 571440e523SAnika Henke method="post" id="dw__login"> 58f3f0262cSandi <fieldset> 594da078a3Smatthiasgrimm <legend><?php echo $lang['btn_login']?></legend> 604da078a3Smatthiasgrimm <input type="hidden" name="id" value="<?php echo $ID?>" /> 61f3f0262cSandi <input type="hidden" name="do" value="login" /> 62b6912aeaSAndreas Gohr <label class="block"> 634da078a3Smatthiasgrimm <span><?php echo $lang['user']?></span> 648d975344SAndreas Gohr <input type="text" name="u" value="<?php echo formText($_REQUEST['u'])?>" 658d975344SAndreas Gohr class="edit" id="focus__this" /> 66f3f0262cSandi </label><br /> 67b6912aeaSAndreas Gohr <label class="block"> 684da078a3Smatthiasgrimm <span><?php echo $lang['pass']?></span> 69f3f0262cSandi <input type="password" name="p" class="edit" /> 70f3f0262cSandi </label><br /> 715b62573aSAndreas Gohr 725b62573aSAndreas Gohr <?php //bad and dirty event insert hook 735b62573aSAndreas Gohr $evdata = array(); 745b62573aSAndreas Gohr trigger_event('HTML_LOGINFORM_INJECTION', $evdata); 755b62573aSAndreas Gohr ?> 765b62573aSAndreas Gohr 770c1887a0SAndreas Gohr <label for="remember__me" class="simple"> 784d6f545eSAndreas Gohr <input type="checkbox" name="r" id="remember__me" value="1" /> 794da078a3Smatthiasgrimm <span><?php echo $lang['remember']?></span> 80132bdbfeSandi </label> 818d975344SAndreas Gohr <input type="submit" value="<?php echo $lang['btn_login']?>" class="button" /> 82f3f0262cSandi </fieldset> 83f3f0262cSandi </form> 844da078a3Smatthiasgrimm <?php 85409d7af7SAndreas Gohr if($auth->canDo('addUser') && actionOK('register')){ 86f3f0262cSandi print '<p>'; 87f3f0262cSandi print $lang['reghere']; 881d5856cfSAndreas Gohr print ': <a href="'.wl($ID,'do=register').'" rel="nofollow" class="wikilink1">'.$lang['register'].'</a>'; 89f3f0262cSandi print '</p>'; 90f3f0262cSandi } 918b06d178Schris 92409d7af7SAndreas Gohr if ($auth->canDo('modPass') && actionOK('resendpwd')) { 938b06d178Schris print '<p>'; 948b06d178Schris print $lang['pwdforget']; 951d5856cfSAndreas Gohr print ': <a href="'.wl($ID,'do=resendpwd').'" rel="nofollow" class="wikilink1">'.$lang['btn_resendpwd'].'</a>'; 968b06d178Schris print '</p>'; 978b06d178Schris } 98f3f0262cSandi ?> 99f3f0262cSandi </div> 1004da078a3Smatthiasgrimm <?php 1016bbae538Sandi/* 1026bbae538Sandi FIXME provide new hook 103f3f0262cSandi if(@file_exists('includes/login.txt')){ 104f3f0262cSandi print io_cacheParse('includes/login.txt'); 105f3f0262cSandi } 1066bbae538Sandi*/ 107f3f0262cSandi} 108f3f0262cSandi 109f3f0262cSandi/** 11015fae107Sandi * prints a section editing button 11135dae8b0SBen Coburn * used as a callback in html_secedit 11215fae107Sandi * 11315fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 11415fae107Sandi */ 11535dae8b0SBen Coburnfunction html_secedit_button($matches){ 116f3f0262cSandi global $ID; 117041d7a86SBen Coburn global $INFO; 118041d7a86SBen Coburn 119041d7a86SBen Coburn $section = $matches[2]; 120041d7a86SBen Coburn $name = $matches[1]; 121041d7a86SBen Coburn 122f3f0262cSandi $secedit = ''; 123f3f0262cSandi $secedit .= '<div class="secedit">'; 124f3f0262cSandi $secedit .= html_btn('secedit',$ID,'', 125f3f0262cSandi array('do' => 'edit', 126306b2c85SDenis Simakov 'lines' => "$section", 127306b2c85SDenis Simakov 'rev' => $INFO['lastmod']), 12835dae8b0SBen Coburn 'post', $name); 129f3f0262cSandi $secedit .= '</div>'; 130f3f0262cSandi return $secedit; 131f3f0262cSandi} 132f3f0262cSandi 13315fae107Sandi/** 13415fae107Sandi * inserts section edit buttons if wanted or removes the markers 13515fae107Sandi * 13615fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 13715fae107Sandi */ 138f3f0262cSandifunction html_secedit($text,$show=true){ 139f3f0262cSandi global $INFO; 14035dae8b0SBen Coburn 141c112d578Sandi if($INFO['writable'] && $show && !$INFO['rev']){ 14235dae8b0SBen Coburn $text = preg_replace_callback('#<!-- SECTION "(.*?)" \[(\d+-\d*)\] -->#', 14335dae8b0SBen Coburn 'html_secedit_button', $text); 144f3f0262cSandi }else{ 14535dae8b0SBen Coburn $text = preg_replace('#<!-- SECTION "(.*?)" \[(\d+-\d*)\] -->#','',$text); 146f3f0262cSandi } 14735dae8b0SBen Coburn 148f3f0262cSandi return $text; 149f3f0262cSandi} 150f3f0262cSandi 151f3f0262cSandi/** 152d6c9c552Smatthiasgrimm * Just the back to top button (in its own form) 1536b13307fSandi * 1546b13307fSandi * @author Andreas Gohr <andi@splitbrain.org> 1556b13307fSandi */ 1566b13307fSandifunction html_topbtn(){ 1576b13307fSandi global $lang; 1586b13307fSandi 1596b13307fSandi $ret = ''; 16011ea018fSAndreas Gohr $ret = '<a class="nolink" href="#dokuwiki__top"><input type="button" class="button" value="'.$lang['btn_top'].'" onclick="window.scrollTo(0, 0)" title="'.$lang['btn_top'].'" /></a>'; 161df7b6005Sandi 1626b13307fSandi return $ret; 1636b13307fSandi} 1646b13307fSandi 1656b13307fSandi/** 166d67ca2c0Smatthiasgrimm * Just the back to media window button in its own form 167d67ca2c0Smatthiasgrimm * 168d67ca2c0Smatthiasgrimm * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net> 169d67ca2c0Smatthiasgrimm */ 170d67ca2c0Smatthiasgrimmfunction html_backtomedia_button($params,$akey=''){ 171d67ca2c0Smatthiasgrimm global $conf; 172d67ca2c0Smatthiasgrimm global $lang; 173d67ca2c0Smatthiasgrimm 1743df72098SAndreas Gohr $ret = '<form class="button" method="get" action="'.DOKU_BASE.'lib/exe/mediamanager.php"><div class="no">'; 175d67ca2c0Smatthiasgrimm 176d67ca2c0Smatthiasgrimm reset($params); 177d67ca2c0Smatthiasgrimm while (list($key, $val) = each($params)) { 178d67ca2c0Smatthiasgrimm $ret .= '<input type="hidden" name="'.$key.'" '; 179d67ca2c0Smatthiasgrimm $ret .= 'value="'.htmlspecialchars($val).'" />'; 180d67ca2c0Smatthiasgrimm } 181d67ca2c0Smatthiasgrimm 182d67ca2c0Smatthiasgrimm $ret .= '<input type="submit" value="'.htmlspecialchars($lang['btn_backtomedia']).'" class="button" '; 18311ea018fSAndreas Gohr $tit = htmlspecialchars($lang['btn_backtomedia']); 184d67ca2c0Smatthiasgrimm if($akey){ 18511ea018fSAndreas Gohr $tit .= ' [ALT+'.strtoupper($akey).']'; 186d67ca2c0Smatthiasgrimm $ret .= 'accesskey="'.$akey.'" '; 187d67ca2c0Smatthiasgrimm } 18811ea018fSAndreas Gohr $ret .= 'title="'.$tit.'" '; 189d67ca2c0Smatthiasgrimm $ret .= '/>'; 1904beabca9SAnika Henke $ret .= '</div></form>'; 191d67ca2c0Smatthiasgrimm 192d67ca2c0Smatthiasgrimm return $ret; 193d67ca2c0Smatthiasgrimm} 194d67ca2c0Smatthiasgrimm 195d67ca2c0Smatthiasgrimm/** 196d67ca2c0Smatthiasgrimm * Displays a button (using its own form) 19735dae8b0SBen Coburn * If tooltip exists, the access key tooltip is replaced. 19815fae107Sandi * 19915fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 200f3f0262cSandi */ 20135dae8b0SBen Coburnfunction html_btn($name,$id,$akey,$params,$method='get',$tooltip=''){ 202f3f0262cSandi global $conf; 203f3f0262cSandi global $lang; 204f3f0262cSandi 205f3f0262cSandi $label = $lang['btn_'.$name]; 206f3f0262cSandi 207f3f0262cSandi $ret = ''; 20835dae8b0SBen Coburn $tip = ''; 209f3f0262cSandi 21049c713a3Sandi //filter id (without urlencoding) 21149c713a3Sandi $id = idfilter($id,false); 212f3f0262cSandi 213f3f0262cSandi //make nice URLs even for buttons 2146c7843b5Sandi if($conf['userewrite'] == 2){ 2156c7843b5Sandi $script = DOKU_BASE.DOKU_SCRIPT.'/'.$id; 2166c7843b5Sandi }elseif($conf['userewrite']){ 2176c7843b5Sandi $script = DOKU_BASE.$id; 2186c7843b5Sandi }else{ 2198b00ebcfSandi $script = DOKU_BASE.DOKU_SCRIPT; 220f3f0262cSandi $params['id'] = $id; 221f3f0262cSandi } 222f3f0262cSandi 2234beabca9SAnika Henke $ret .= '<form class="button" method="'.$method.'" action="'.$script.'"><div class="no">'; 224f3f0262cSandi 22506a4bf8fSAndreas Gohr if(is_array($params)){ 226f3f0262cSandi reset($params); 227f3f0262cSandi while (list($key, $val) = each($params)) { 228f3f0262cSandi $ret .= '<input type="hidden" name="'.$key.'" '; 229f3f0262cSandi $ret .= 'value="'.htmlspecialchars($val).'" />'; 230f3f0262cSandi } 23106a4bf8fSAndreas Gohr } 232f3f0262cSandi 23335dae8b0SBen Coburn if ($tooltip!='') { 23435dae8b0SBen Coburn $tip = htmlspecialchars($tooltip); 23511ea018fSAndreas Gohr }else{ 23611ea018fSAndreas Gohr $tip = htmlspecialchars($label); 23711ea018fSAndreas Gohr } 23811ea018fSAndreas Gohr 23911ea018fSAndreas Gohr $ret .= '<input type="submit" value="'.htmlspecialchars($label).'" class="button" '; 24011ea018fSAndreas Gohr if($akey){ 24111ea018fSAndreas Gohr $tip .= ' [ALT+'.strtoupper($akey).']'; 24211ea018fSAndreas Gohr $ret .= 'accesskey="'.$akey.'" '; 24335dae8b0SBen Coburn } 24435dae8b0SBen Coburn $ret .= 'title="'.$tip.'" '; 245f3f0262cSandi $ret .= '/>'; 2464beabca9SAnika Henke $ret .= '</div></form>'; 247f3f0262cSandi 248f3f0262cSandi return $ret; 249f3f0262cSandi} 250f3f0262cSandi 251f3f0262cSandi/** 25215fae107Sandi * show a wiki page 25315fae107Sandi * 25415fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 25515fae107Sandi */ 2566bbae538Sandifunction html_show($txt=''){ 257f3f0262cSandi global $ID; 258f3f0262cSandi global $REV; 259f3f0262cSandi global $HIGH; 260f3f0262cSandi //disable section editing for old revisions or in preview 2615400331dSandi if($txt || $REV){ 2626bbae538Sandi $secedit = false; 2636bbae538Sandi }else{ 2646bbae538Sandi $secedit = true; 265f3f0262cSandi } 266f3f0262cSandi 2676bbae538Sandi if ($txt){ 268f3f0262cSandi //PreviewHeader 26950835be7SAndreas Gohr print '<br id="scroll__here" />'; 270c112d578Sandi print p_locale_xhtml('preview'); 271f3f0262cSandi print '<div class="preview">'; 2729dc2c2afSandi print html_secedit(p_render('xhtml',p_get_instructions($txt),$info),$secedit); 27346723c19SAndreas Gohr print '<div class="clearer"></div>'; 274f3f0262cSandi print '</div>'; 2756bbae538Sandi 276f3f0262cSandi }else{ 277c112d578Sandi if ($REV) print p_locale_xhtml('showrev'); 278c112d578Sandi $html = p_wiki_xhtml($ID,$REV,true); 2796bbae538Sandi $html = html_secedit($html,$secedit); 280f3f0262cSandi print html_hilight($html,$HIGH); 281f3f0262cSandi } 282f3f0262cSandi} 283f3f0262cSandi 284f3f0262cSandi/** 285ee4c4a1bSAndreas Gohr * ask the user about how to handle an exisiting draft 286ee4c4a1bSAndreas Gohr * 287ee4c4a1bSAndreas Gohr * @author Andreas Gohr <andi@splitbrain.org> 288ee4c4a1bSAndreas Gohr */ 289ee4c4a1bSAndreas Gohrfunction html_draft(){ 290ee4c4a1bSAndreas Gohr global $INFO; 291ee4c4a1bSAndreas Gohr global $ID; 292ee4c4a1bSAndreas Gohr global $lang; 293ee4c4a1bSAndreas Gohr global $conf; 294ee4c4a1bSAndreas Gohr $draft = unserialize(io_readFile($INFO['draft'],false)); 295ee4c4a1bSAndreas Gohr $text = cleanText(con($draft['prefix'],$draft['text'],$draft['suffix'],true)); 296ee4c4a1bSAndreas Gohr 297ee4c4a1bSAndreas Gohr echo p_locale_xhtml('draft'); 298ee4c4a1bSAndreas Gohr ?> 299ee4c4a1bSAndreas Gohr <form id="dw__editform" method="post" action="<?php echo script()?>" 300ee4c4a1bSAndreas Gohr accept-charset="<?php echo $lang['encoding']?>"><div class="no"> 301ee4c4a1bSAndreas Gohr <input type="hidden" name="id" value="<?php echo $ID?>" /> 302ee4c4a1bSAndreas Gohr <input type="hidden" name="date" value="<?php echo $draft['date']?>" /></div> 303ee4c4a1bSAndreas Gohr <textarea name="wikitext" id="wiki__text" readonly="readonly" cols="80" rows="10" class="edit"><?php echo "\n".formText($text)?></textarea> 304ee4c4a1bSAndreas Gohr 305ee4c4a1bSAndreas Gohr <div id="draft__status"><?php echo $lang['draftdate'].' '.date($conf['dformat'],filemtime($INFO['draft']))?></div> 306ee4c4a1bSAndreas Gohr 30718829381SAndreas Gohr <input class="button" type="submit" name="do[recover]" value="<?php echo $lang['btn_recover']?>" tabindex="1" /> 30818829381SAndreas Gohr <input class="button" type="submit" name="do[draftdel]" value="<?php echo $lang['btn_draftdel']?>" tabindex="2" /> 30918829381SAndreas Gohr <input class="button" type="submit" name="do[show]" value="<?php echo $lang['btn_cancel']?>" tabindex="3" /> 310ee4c4a1bSAndreas Gohr </form> 311ee4c4a1bSAndreas Gohr <?php 312ee4c4a1bSAndreas Gohr} 313ee4c4a1bSAndreas Gohr 314ee4c4a1bSAndreas Gohr/** 315f3f0262cSandi * Highlights searchqueries in HTML code 31615fae107Sandi * 31715fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 3187209be23SAndreas Gohr * @author Harry Fuecks <hfuecks@gmail.com> 319f3f0262cSandi */ 320f3f0262cSandifunction html_hilight($html,$query){ 3217209be23SAndreas Gohr //split at common delimiters 3229d9c165eSAndreas Gohr $queries = preg_split ('/[\s\'"\\\\`()\]\[?:!\.{};,#+*<>\\/]+/',$query,-1,PREG_SPLIT_NO_EMPTY); 323f3f0262cSandi foreach ($queries as $q){ 324f3f0262cSandi $q = preg_quote($q,'/'); 3257209be23SAndreas Gohr $html = preg_replace_callback("/((<[^>]*)|$q)/i",'html_hilight_callback',$html); 326f3f0262cSandi } 327f3f0262cSandi return $html; 328f3f0262cSandi} 329f3f0262cSandi 330f3f0262cSandi/** 3317209be23SAndreas Gohr * Callback used by html_hilight() 3327209be23SAndreas Gohr * 3337209be23SAndreas Gohr * @author Harry Fuecks <hfuecks@gmail.com> 3347209be23SAndreas Gohr */ 3357209be23SAndreas Gohrfunction html_hilight_callback($m) { 3367209be23SAndreas Gohr $hlight = unslash($m[0]); 3377209be23SAndreas Gohr if ( !isset($m[2])) { 3387209be23SAndreas Gohr $hlight = '<span class="search_hit">'.$hlight.'</span>'; 3397209be23SAndreas Gohr } 3407209be23SAndreas Gohr return $hlight; 3417209be23SAndreas Gohr} 3427209be23SAndreas Gohr 3437209be23SAndreas Gohr/** 34415fae107Sandi * Run a search and display the result 34515fae107Sandi * 34615fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 347f3f0262cSandi */ 348f3f0262cSandifunction html_search(){ 349ed7b5f09Sandi require_once(DOKU_INC.'inc/search.php'); 350506fa893SAndreas Gohr require_once(DOKU_INC.'inc/fulltext.php'); 351f3f0262cSandi global $conf; 352f3f0262cSandi global $QUERY; 353f3f0262cSandi global $ID; 354f3f0262cSandi global $lang; 355f3f0262cSandi 356c112d578Sandi print p_locale_xhtml('searchpage'); 357f3f0262cSandi flush(); 358f3f0262cSandi 359d0ab54f6SMichael Klier chi@chimeric.de //check if search is restricted to namespace 360d0ab54f6SMichael Klier chi@chimeric.de if(preg_match('/([^@]*)@([^@]*)/',$QUERY,$match)) { 361d0ab54f6SMichael Klier chi@chimeric.de $id = cleanID($match[1]); 362d0ab54f6SMichael Klier chi@chimeric.de if(empty($id)) { 363d0ab54f6SMichael Klier chi@chimeric.de print '<div class="nothing">'.$lang['nothingfound'].'</div>'; 364d0ab54f6SMichael Klier chi@chimeric.de flush(); 365d0ab54f6SMichael Klier chi@chimeric.de return; 366d0ab54f6SMichael Klier chi@chimeric.de } 367d0ab54f6SMichael Klier chi@chimeric.de } else { 368d0ab54f6SMichael Klier chi@chimeric.de $id = cleanID($QUERY); 369d0ab54f6SMichael Klier chi@chimeric.de } 370d0ab54f6SMichael Klier chi@chimeric.de 3714d9ff3d5Sandi //show progressbar 372e226efe1SAndreas Gohr print '<div class="centeralign" id="dw__loading">'.NL; 373e226efe1SAndreas Gohr print '<script type="text/javascript" charset="utf-8"><!--//--><![CDATA[//><!--'.NL; 374e226efe1SAndreas Gohr print 'showLoadBar();'.NL; 375e226efe1SAndreas Gohr print '//--><!]]></script>'.NL; 376e226efe1SAndreas Gohr print '<br /></div>'.NL; 3779edac8a8SAndreas Gohr flush(); 3784d9ff3d5Sandi 379f3f0262cSandi //do quick pagesearch 380f3f0262cSandi $data = array(); 381d0ab54f6SMichael Klier chi@chimeric.de 382d0ab54f6SMichael Klier chi@chimeric.de $data = ft_pageLookup($id); 383f3f0262cSandi if(count($data)){ 384f3f0262cSandi sort($data); 385f3f0262cSandi print '<div class="search_quickresult">'; 386746855cfSBen Coburn print '<h3>'.$lang['quickhits'].':</h3>'; 3874f732f0eSAnika Henke print '<ul class="search_quickhits">'; 388140c93f3SAnika Henke foreach($data as $id){ 3894f732f0eSAnika Henke print '<li> '; 390506fa893SAndreas Gohr print html_wikilink(':'.$id,$conf['useheading']?NULL:$id); 3914f732f0eSAnika Henke print '</li> '; 392f3f0262cSandi } 393140c93f3SAnika Henke print '</ul> '; 394f3f0262cSandi //clear float (see http://www.complexspiral.com/publications/containing-floats/) 395f3f0262cSandi print '<div class="clearer"> </div>'; 396f3f0262cSandi print '</div>'; 397f3f0262cSandi } 398f3f0262cSandi flush(); 399f3f0262cSandi 400f3f0262cSandi //do fulltext search 401506fa893SAndreas Gohr $data = ft_pageSearch($QUERY,$poswords); 402f3f0262cSandi if(count($data)){ 403506fa893SAndreas Gohr $num = 1; 404506fa893SAndreas Gohr foreach($data as $id => $cnt){ 405f3f0262cSandi print '<div class="search_result">'; 406506fa893SAndreas Gohr print html_wikilink(':'.$id,$conf['useheading']?NULL:$id,$poswords); 407506fa893SAndreas Gohr print ': <span class="search_cnt">'.$cnt.' '.$lang['hits'].'</span><br />'; 408506fa893SAndreas Gohr if($num < 15){ // create snippets for the first number of matches only #FIXME add to conf ? 409506fa893SAndreas Gohr print '<div class="search_snippet">'.ft_snippet($id,$poswords).'</div>'; 410506fa893SAndreas Gohr } 411f3f0262cSandi print '</div>'; 412506fa893SAndreas Gohr flush(); 413506fa893SAndreas Gohr $num++; 414f3f0262cSandi } 415f3f0262cSandi }else{ 416820fa24bSandi print '<div class="nothing">'.$lang['nothingfound'].'</div>'; 417f3f0262cSandi } 4184d9ff3d5Sandi 4194d9ff3d5Sandi //hide progressbar 420e226efe1SAndreas Gohr print '<script type="text/javascript" charset="utf-8"><!--//--><![CDATA[//><!--'.NL; 421e226efe1SAndreas Gohr print 'hideLoadBar("dw__loading");'.NL; 422e226efe1SAndreas Gohr print '//--><!]]></script>'.NL; 4239edac8a8SAndreas Gohr flush(); 424f3f0262cSandi} 425f3f0262cSandi 42615fae107Sandi/** 42715fae107Sandi * Display error on locked pages 42815fae107Sandi * 42915fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 43015fae107Sandi */ 431ee20e7d1Sandifunction html_locked(){ 432f3f0262cSandi global $ID; 433f3f0262cSandi global $conf; 434f3f0262cSandi global $lang; 43588f522e9Sandi global $INFO; 436f3f0262cSandi 437c9b4bd1eSBen Coburn $locktime = filemtime(wikiLockFN($ID)); 438f3f0262cSandi $expire = @date($conf['dformat'], $locktime + $conf['locktime'] ); 439f3f0262cSandi $min = round(($conf['locktime'] - (time() - $locktime) )/60); 440f3f0262cSandi 441c112d578Sandi print p_locale_xhtml('locked'); 442f3f0262cSandi print '<ul>'; 4430c6b58a8SAndreas Gohr print '<li><div class="li"><strong>'.$lang['lockedby'].':</strong> '.$INFO['locked'].'</li>'; 4440c6b58a8SAndreas Gohr print '<li><div class="li"><strong>'.$lang['lockexpire'].':</strong> '.$expire.' ('.$min.' min)</div></li>'; 445f3f0262cSandi print '</ul>'; 446f3f0262cSandi} 447f3f0262cSandi 44815fae107Sandi/** 44915fae107Sandi * list old revisions 45015fae107Sandi * 45115fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 45271726d78SBen Coburn * @author Ben Coburn <btcoburn@silicodon.net> 45315fae107Sandi */ 45471726d78SBen Coburnfunction html_revisions($first=0){ 455f3f0262cSandi global $ID; 456f3f0262cSandi global $INFO; 457f3f0262cSandi global $conf; 458f3f0262cSandi global $lang; 45971726d78SBen Coburn /* we need to get one additionally log entry to be able to 46071726d78SBen Coburn * decide if this is the last page or is there another one. 46171726d78SBen Coburn * see html_recent() 46271726d78SBen Coburn */ 46371726d78SBen Coburn $revisions = getRevisions($ID, $first, $conf['recent']+1); 46471726d78SBen Coburn if(count($revisions)==0 && $first!=0){ 46571726d78SBen Coburn $first=0; 46671726d78SBen Coburn $revisions = getRevisions($ID, $first, $conf['recent']+1);; 46771726d78SBen Coburn } 46871726d78SBen Coburn $hasNext = false; 46971726d78SBen Coburn if (count($revisions)>$conf['recent']) { 47071726d78SBen Coburn $hasNext = true; 47171726d78SBen Coburn array_pop($revisions); // remove extra log entry 47271726d78SBen Coburn } 47371726d78SBen Coburn 474f3f0262cSandi $date = @date($conf['dformat'],$INFO['lastmod']); 475f3f0262cSandi 476c112d578Sandi print p_locale_xhtml('revisions'); 477f3f0262cSandi print '<ul>'; 47871726d78SBen Coburn if($INFO['exists'] && $first==0){ 479ebf1501fSBen Coburn print (isset($INFO['meta']) && isset($INFO['meta']['last_change']) && $INFO['meta']['last_change']['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) ? '<li class="minor">' : '<li>'; 4800c6b58a8SAndreas Gohr print '<div class="li">'; 481f9b2fe70Sandi 482f9b2fe70Sandi print $date; 483f9b2fe70Sandi 48402e51121SAnika Henke print ' <img src="'.DOKU_BASE.'lib/images/blank.gif" width="15" height="11" alt="" /> '; 485cffcc403Sandi 486f9b2fe70Sandi print '<a class="wikilink1" href="'.wl($ID).'">'.$ID.'</a> '; 487652610a2Sandi 48841396b71SAndreas Gohr print ' – '; 489652610a2Sandi print $INFO['sum']; 49088f522e9Sandi print ' <span class="user">'; 4915aa52fafSBen Coburn print (empty($INFO['editor']))?('('.$lang['external_edit'].')'):$INFO['editor']; 49288f522e9Sandi print '</span> '; 493652610a2Sandi 494652610a2Sandi print '('.$lang['current'].')'; 4950c6b58a8SAndreas Gohr print '</div>'; 496652610a2Sandi print '</li>'; 497f3f0262cSandi } 498f3f0262cSandi 499f3f0262cSandi foreach($revisions as $rev){ 500f3f0262cSandi $date = date($conf['dformat'],$rev); 501fb53bfe2SBen Coburn $info = getRevisionInfo($ID,$rev,true); 502652610a2Sandi 503ebf1501fSBen Coburn print ($info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) ? '<li class="minor">' : '<li>'; 5040c6b58a8SAndreas Gohr print '<div class="li">'; 505f9b2fe70Sandi print $date; 506f9b2fe70Sandi 50741396b71SAndreas Gohr if(@file_exists(wikiFN($ID,$rev))){ 508cffcc403Sandi print ' <a href="'.wl($ID,"rev=$rev,do=diff").'">'; 509d94f4568SAndreas Gohr $p = array(); 510d94f4568SAndreas Gohr $p['src'] = DOKU_BASE.'lib/images/diff.png'; 511d94f4568SAndreas Gohr $p['width'] = 15; 512d94f4568SAndreas Gohr $p['height'] = 11; 513d94f4568SAndreas Gohr $p['title'] = $lang['diff']; 514d94f4568SAndreas Gohr $p['alt'] = $lang['diff']; 515d94f4568SAndreas Gohr $att = buildAttributes($p); 516d94f4568SAndreas Gohr print "<img $att />"; 517cffcc403Sandi print '</a> '; 518cffcc403Sandi 519f9b2fe70Sandi print '<a class="wikilink1" href="'.wl($ID,"rev=$rev").'">'.$ID.'</a>'; 52041396b71SAndreas Gohr }else{ 52141396b71SAndreas Gohr print ' <img src="'.DOKU_BASE.'lib/images/blank.gif" width="15" height="11" alt="" /> '; 52241396b71SAndreas Gohr print $ID; 52341396b71SAndreas Gohr } 524f9b2fe70Sandi 52541396b71SAndreas Gohr print ' – '; 526f243a77fSandi print htmlspecialchars($info['sum']); 52788f522e9Sandi print ' <span class="user">'; 52888f522e9Sandi if($info['user']){ 52988f522e9Sandi print $info['user']; 53088f522e9Sandi }else{ 531652610a2Sandi print $info['ip']; 53288f522e9Sandi } 53388f522e9Sandi print '</span>'; 534652610a2Sandi 5350c6b58a8SAndreas Gohr print '</div>'; 536f3f0262cSandi print '</li>'; 537f3f0262cSandi } 538f3f0262cSandi print '</ul>'; 53971726d78SBen Coburn 54071726d78SBen Coburn print '<div class="pagenav">'; 54171726d78SBen Coburn $last = $first + $conf['recent']; 54271726d78SBen Coburn if ($first > 0) { 54371726d78SBen Coburn $first -= $conf['recent']; 54471726d78SBen Coburn if ($first < 0) $first = 0; 54571726d78SBen Coburn print '<div class="pagenav-prev">'; 546eeb83e57SBen Coburn print html_btn('newer',$ID,"p",array('do' => 'revisions', 'first' => $first)); 54771726d78SBen Coburn print '</div>'; 54871726d78SBen Coburn } 54971726d78SBen Coburn if ($hasNext) { 55071726d78SBen Coburn print '<div class="pagenav-next">'; 551eeb83e57SBen Coburn print html_btn('older',$ID,"n",array('do' => 'revisions', 'first' => $last)); 55271726d78SBen Coburn print '</div>'; 55371726d78SBen Coburn } 55471726d78SBen Coburn print '</div>'; 55571726d78SBen Coburn 556f3f0262cSandi} 557f3f0262cSandi 55815fae107Sandi/** 55915fae107Sandi * display recent changes 56015fae107Sandi * 56115fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 5625749f1ceSmatthiasgrimm * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net> 56371726d78SBen Coburn * @author Ben Coburn <btcoburn@silicodon.net> 56415fae107Sandi */ 565a39955b0Smatthiasgrimmfunction html_recent($first=0){ 566f3f0262cSandi global $conf; 567cffcc403Sandi global $lang; 568dbb00abcSEsther Brunner global $ID; 5695749f1ceSmatthiasgrimm /* we need to get one additionally log entry to be able to 5705749f1ceSmatthiasgrimm * decide if this is the last page or is there another one. 5715749f1ceSmatthiasgrimm * This is the cheapest solution to get this information. 5725749f1ceSmatthiasgrimm */ 573b6912aeaSAndreas Gohr $recents = getRecents($first,$conf['recent'] + 1,getNS($ID)); 5745749f1ceSmatthiasgrimm if(count($recents) == 0 && $first != 0){ 5755749f1ceSmatthiasgrimm $first=0; 57671726d78SBen Coburn $recents = getRecents($first,$conf['recent'] + 1,getNS($ID)); 5775749f1ceSmatthiasgrimm } 57871726d78SBen Coburn $hasNext = false; 57971726d78SBen Coburn if (count($recents)>$conf['recent']) { 58071726d78SBen Coburn $hasNext = true; 58171726d78SBen Coburn array_pop($recents); // remove extra log entry 58271726d78SBen Coburn } 583f3f0262cSandi 584c112d578Sandi print p_locale_xhtml('recent'); 585f3f0262cSandi print '<ul>'; 586a39955b0Smatthiasgrimm 587d437bcc4SAndreas Gohr foreach($recents as $recent){ 588d437bcc4SAndreas Gohr $date = date($conf['dformat'],$recent['date']); 589ebf1501fSBen Coburn print ($recent['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) ? '<li class="minor">' : '<li>'; 5900c6b58a8SAndreas Gohr print '<div class="li">'; 591cffcc403Sandi 592f9b2fe70Sandi print $date.' '; 593f9b2fe70Sandi 594d437bcc4SAndreas Gohr print '<a href="'.wl($recent['id'],"do=diff").'">'; 595d94f4568SAndreas Gohr $p = array(); 596d94f4568SAndreas Gohr $p['src'] = DOKU_BASE.'lib/images/diff.png'; 597d94f4568SAndreas Gohr $p['width'] = 15; 598d94f4568SAndreas Gohr $p['height'] = 11; 599d94f4568SAndreas Gohr $p['title'] = $lang['diff']; 600d94f4568SAndreas Gohr $p['alt'] = $lang['diff']; 601d94f4568SAndreas Gohr $att = buildAttributes($p); 602d94f4568SAndreas Gohr print "<img $att />"; 603cffcc403Sandi print '</a> '; 604cffcc403Sandi 605d437bcc4SAndreas Gohr print '<a href="'.wl($recent['id'],"do=revisions").'">'; 606d94f4568SAndreas Gohr $p = array(); 607d94f4568SAndreas Gohr $p['src'] = DOKU_BASE.'lib/images/history.png'; 608d94f4568SAndreas Gohr $p['width'] = 12; 609d94f4568SAndreas Gohr $p['height'] = 14; 610d94f4568SAndreas Gohr $p['title'] = $lang['btn_revs']; 611d94f4568SAndreas Gohr $p['alt'] = $lang['btn_revs']; 612d94f4568SAndreas Gohr $att = buildAttributes($p); 613d94f4568SAndreas Gohr print "<img $att />"; 614cffcc403Sandi print '</a> '; 615cffcc403Sandi 616d437bcc4SAndreas Gohr print html_wikilink(':'.$recent['id'],$conf['useheading']?NULL:$recent['id']); 61741396b71SAndreas Gohr print ' – '.htmlspecialchars($recent['sum']); 618b6912aeaSAndreas Gohr 61988f522e9Sandi print ' <span class="user">'; 620d437bcc4SAndreas Gohr if($recent['user']){ 621d437bcc4SAndreas Gohr print $recent['user']; 62288f522e9Sandi }else{ 623d437bcc4SAndreas Gohr print $recent['ip']; 62488f522e9Sandi } 62588f522e9Sandi print '</span>'; 626cffcc403Sandi 6270c6b58a8SAndreas Gohr print '</div>'; 628f3f0262cSandi print '</li>'; 629f3f0262cSandi } 630f3f0262cSandi print '</ul>'; 631a39955b0Smatthiasgrimm 632a39955b0Smatthiasgrimm print '<div class="pagenav">'; 6335749f1ceSmatthiasgrimm $last = $first + $conf['recent']; 634a39955b0Smatthiasgrimm if ($first > 0) { 635a39955b0Smatthiasgrimm $first -= $conf['recent']; 636a39955b0Smatthiasgrimm if ($first < 0) $first = 0; 637a39955b0Smatthiasgrimm print '<div class="pagenav-prev">'; 6385749f1ceSmatthiasgrimm print html_btn('newer','',"p",array('do' => 'recent', 'first' => $first)); 639a39955b0Smatthiasgrimm print '</div>'; 640a39955b0Smatthiasgrimm } 64171726d78SBen Coburn if ($hasNext) { 642a39955b0Smatthiasgrimm print '<div class="pagenav-next">'; 6435749f1ceSmatthiasgrimm print html_btn('older','',"n",array('do' => 'recent', 'first' => $last)); 644a39955b0Smatthiasgrimm print '</div>'; 645a39955b0Smatthiasgrimm } 646a39955b0Smatthiasgrimm print '</div>'; 647f3f0262cSandi} 648f3f0262cSandi 64915fae107Sandi/** 65015fae107Sandi * Display page index 65115fae107Sandi * 65215fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 65315fae107Sandi */ 654f3f0262cSandifunction html_index($ns){ 655ed7b5f09Sandi require_once(DOKU_INC.'inc/search.php'); 656f3f0262cSandi global $conf; 657f3f0262cSandi global $ID; 658f3f0262cSandi $dir = $conf['datadir']; 659f3f0262cSandi $ns = cleanID($ns); 66030f1737dSandi #fixme use appropriate function 661f3f0262cSandi if(empty($ns)){ 662f3f0262cSandi $ns = dirname(str_replace(':','/',$ID)); 663f3f0262cSandi if($ns == '.') $ns =''; 664f3f0262cSandi } 66588d3a917Sandi $ns = utf8_encodeFN(str_replace(':','/',$ns)); 666f3f0262cSandi 667c112d578Sandi print p_locale_xhtml('index'); 668f3f0262cSandi 669f3f0262cSandi $data = array(); 670f3f0262cSandi search($data,$conf['datadir'],'search_index',array('ns' => $ns)); 671cb70c441Sandi print html_buildlist($data,'idx','html_list_index','html_li_index'); 672f3f0262cSandi} 673f3f0262cSandi 674f3f0262cSandi/** 67515fae107Sandi * Index item formatter 67615fae107Sandi * 677f3f0262cSandi * User function for html_buildlist() 67815fae107Sandi * 67915fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 680f3f0262cSandi */ 681f3f0262cSandifunction html_list_index($item){ 682d98d4540SBen Coburn global $ID; 683f3f0262cSandi $ret = ''; 684f3f0262cSandi $base = ':'.$item['id']; 685f3f0262cSandi $base = substr($base,strrpos($base,':')+1); 686f3f0262cSandi if($item['type']=='d'){ 687f3f0262cSandi $ret .= '<a href="'.wl($ID,'idx='.$item['id']).'" class="idx_dir">'; 688f3f0262cSandi $ret .= $base; 689f3f0262cSandi $ret .= '</a>'; 690f3f0262cSandi }else{ 691f3f0262cSandi $ret .= html_wikilink(':'.$item['id']); 692f3f0262cSandi } 693f3f0262cSandi return $ret; 694f3f0262cSandi} 695f3f0262cSandi 696f3f0262cSandi/** 697cb70c441Sandi * Index List item 698cb70c441Sandi * 699cb70c441Sandi * This user function is used in html_build_lidt to build the 700cb70c441Sandi * <li> tags for namespaces when displaying the page index 701cb70c441Sandi * it gives different classes to opened or closed "folders" 702cb70c441Sandi * 703cb70c441Sandi * @author Andreas Gohr <andi@splitbrain.org> 704cb70c441Sandi */ 705cb70c441Sandifunction html_li_index($item){ 706cb70c441Sandi if($item['type'] == "f"){ 707cb70c441Sandi return '<li class="level'.$item['level'].'">'; 708cb70c441Sandi }elseif($item['open']){ 709cb70c441Sandi return '<li class="open">'; 710cb70c441Sandi }else{ 711cb70c441Sandi return '<li class="closed">'; 712cb70c441Sandi } 713cb70c441Sandi} 714cb70c441Sandi 715cb70c441Sandi/** 716cb70c441Sandi * Default List item 717cb70c441Sandi * 718cb70c441Sandi * @author Andreas Gohr <andi@splitbrain.org> 719cb70c441Sandi */ 720cb70c441Sandifunction html_li_default($item){ 721cb70c441Sandi return '<li class="level'.$item['level'].'">'; 722cb70c441Sandi} 723cb70c441Sandi 724cb70c441Sandi/** 72515fae107Sandi * Build an unordered list 72615fae107Sandi * 727f3f0262cSandi * Build an unordered list from the given $data array 728f3f0262cSandi * Each item in the array has to have a 'level' property 729f3f0262cSandi * the item itself gets printed by the given $func user 730cb70c441Sandi * function. The second and optional function is used to 731cb70c441Sandi * print the <li> tag. Both user function need to accept 732cb70c441Sandi * a single item. 73315fae107Sandi * 734c5a8fd96SAndreas Gohr * Both user functions can be given as array to point to 735c5a8fd96SAndreas Gohr * a member of an object. 736c5a8fd96SAndreas Gohr * 73715fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 738f3f0262cSandi */ 739cb70c441Sandifunction html_buildlist($data,$class,$func,$lifunc='html_li_default'){ 740f3f0262cSandi $level = 0; 741f3f0262cSandi $opens = 0; 742f3f0262cSandi $ret = ''; 743f3f0262cSandi 744f3f0262cSandi foreach ($data as $item){ 745f3f0262cSandi 746f3f0262cSandi if( $item['level'] > $level ){ 747f3f0262cSandi //open new list 748df52d0feSandi for($i=0; $i<($item['level'] - $level); $i++){ 749df52d0feSandi if ($i) $ret .= "<li class=\"clear\">\n"; 750f3f0262cSandi $ret .= "\n<ul class=\"$class\">\n"; 751df52d0feSandi } 752f3f0262cSandi }elseif( $item['level'] < $level ){ 753f3f0262cSandi //close last item 754f3f0262cSandi $ret .= "</li>\n"; 755f3f0262cSandi for ($i=0; $i<($level - $item['level']); $i++){ 756f3f0262cSandi //close higher lists 757f3f0262cSandi $ret .= "</ul>\n</li>\n"; 758f3f0262cSandi } 759f3f0262cSandi }else{ 760f3f0262cSandi //close last item 761f3f0262cSandi $ret .= "</li>\n"; 762f3f0262cSandi } 763f3f0262cSandi 764f3f0262cSandi //remember current level 765f3f0262cSandi $level = $item['level']; 766f3f0262cSandi 767f3f0262cSandi //print item 76834dbe711Schris $ret .= call_user_func($lifunc,$item); 7690c6b58a8SAndreas Gohr $ret .= '<div class="li">'; 77034dbe711Schris 77134dbe711Schris $ret .= call_user_func($func,$item); 7720c6b58a8SAndreas Gohr $ret .= '</div>'; 773f3f0262cSandi } 774f3f0262cSandi 775f3f0262cSandi //close remaining items and lists 776f3f0262cSandi for ($i=0; $i < $level; $i++){ 777f3f0262cSandi $ret .= "</li></ul>\n"; 778f3f0262cSandi } 779f3f0262cSandi 780f3f0262cSandi return $ret; 781f3f0262cSandi} 782f3f0262cSandi 78315fae107Sandi/** 78415fae107Sandi * display backlinks 78515fae107Sandi * 78615fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 78715fae107Sandi */ 788f3f0262cSandifunction html_backlinks(){ 78954f4c056SAndreas Gohr require_once(DOKU_INC.'inc/fulltext.php'); 790f3f0262cSandi global $ID; 791f3f0262cSandi global $conf; 792f3f0262cSandi 793c112d578Sandi print p_locale_xhtml('backlinks'); 794f3f0262cSandi 79554f4c056SAndreas Gohr $data = ft_backlinks($ID); 796f3f0262cSandi 797f3f0262cSandi print '<ul class="idx">'; 79854f4c056SAndreas Gohr foreach($data as $blink){ 7990c6b58a8SAndreas Gohr print '<li><div class="li">'; 80054f4c056SAndreas Gohr print html_wikilink(':'.$blink,$conf['useheading']?NULL:$blink); 8010c6b58a8SAndreas Gohr print '</div></li>'; 802f3f0262cSandi } 803f3f0262cSandi print '</ul>'; 804f3f0262cSandi} 805f3f0262cSandi 80615fae107Sandi/** 80715fae107Sandi * show diff 80815fae107Sandi * 80915fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 81015fae107Sandi */ 811f3f0262cSandifunction html_diff($text='',$intro=true){ 812ed7b5f09Sandi require_once(DOKU_INC.'inc/DifferenceEngine.php'); 813f3f0262cSandi global $ID; 814f3f0262cSandi global $REV; 815f3f0262cSandi global $lang; 816f3f0262cSandi global $conf; 817e1bd90ffSAndreas Gohr 818f3f0262cSandi if($text){ 819e1bd90ffSAndreas Gohr $df = new Diff(explode("\n",htmlspecialchars(rawWiki($ID,''))), 820e1bd90ffSAndreas Gohr explode("\n",htmlspecialchars(cleanText($text)))); 821f3f0262cSandi $left = '<a class="wikilink1" href="'.wl($ID).'">'. 822f3f0262cSandi $ID.' '.date($conf['dformat'],@filemtime(wikiFN($ID))).'</a>'. 823f3f0262cSandi $lang['current']; 824f3f0262cSandi $right = $lang['yours']; 825f3f0262cSandi }else{ 8262a355ffaSDavid Lorentsen //check if current revision exist 8272a355ffaSDavid Lorentsen if(!@file_exists(wikiFN($ID))){ 8282a355ffaSDavid Lorentsen $revs = getRevisions($ID, 0, 2); 8292a355ffaSDavid Lorentsen $rc = $revs[1]; 8302a355ffaSDavid Lorentsen } 8314d58bd99Sandi if($REV){ 8324d58bd99Sandi $r = $REV; 8334d58bd99Sandi }else{ 8342a355ffaSDavid Lorentsen if(empty($revs)){ 8354d58bd99Sandi //use last revision if none given 83671726d78SBen Coburn $revs = getRevisions($ID, 0, 1); 8372a355ffaSDavid Lorentsen } 8384d58bd99Sandi $r = $revs[0]; 8394d58bd99Sandi } 8404d58bd99Sandi 841e1bd90ffSAndreas Gohr if($r){ 842e1bd90ffSAndreas Gohr $df = new Diff(explode("\n",htmlspecialchars(rawWiki($ID,$r))), 843e1bd90ffSAndreas Gohr explode("\n",htmlspecialchars(rawWiki($ID,'')))); 8444d58bd99Sandi $left = '<a class="wikilink1" href="'.wl($ID,"rev=$r").'">'. 8452a355ffaSDavid Lorentsen $ID.' '.date($conf['dformat'],(isset($rc) ? $rc : $r)).'</a>'; 846e1bd90ffSAndreas Gohr }else{ 847e1bd90ffSAndreas Gohr $df = new Diff(array(''), 848e1bd90ffSAndreas Gohr explode("\n",htmlspecialchars(rawWiki($ID,'')))); 849e1bd90ffSAndreas Gohr $left = '<a class="wikilink1" href="'.wl($ID).'">'. 850e1bd90ffSAndreas Gohr $ID.'</a>'; 851e1bd90ffSAndreas Gohr } 852f3f0262cSandi $right = '<a class="wikilink1" href="'.wl($ID).'">'. 8532a355ffaSDavid Lorentsen $ID.' '.date($conf['dformat'],(isset($rc) ? $r : @filemtime(wikiFN($ID)))).'</a> '. 854f3f0262cSandi $lang['current']; 855f3f0262cSandi } 856f3f0262cSandi $tdf = new TableDiffFormatter(); 857c112d578Sandi if($intro) print p_locale_xhtml('diff'); 858f3f0262cSandi ?> 859daf4ca4eSAnika Henke <table class="diff"> 860f3f0262cSandi <tr> 861daf4ca4eSAnika Henke <th colspan="2"> 8624da078a3Smatthiasgrimm <?php echo $left?> 863daf4ca4eSAnika Henke </th> 864daf4ca4eSAnika Henke <th colspan="2"> 8654da078a3Smatthiasgrimm <?php echo $right?> 866daf4ca4eSAnika Henke </th> 867f3f0262cSandi </tr> 8684da078a3Smatthiasgrimm <?php echo $tdf->format($df)?> 869f3f0262cSandi </table> 8704da078a3Smatthiasgrimm <?php 871f3f0262cSandi} 872f3f0262cSandi 87315fae107Sandi/** 87415fae107Sandi * show warning on conflict detection 87515fae107Sandi * 87615fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 87715fae107Sandi */ 878f3f0262cSandifunction html_conflict($text,$summary){ 879f3f0262cSandi global $ID; 880f3f0262cSandi global $lang; 881f3f0262cSandi 882c112d578Sandi print p_locale_xhtml('conflict'); 883f3f0262cSandi ?> 8841dd0c202SAnika Henke <form id="dw__editform" method="post" action="<?php echo script()?>" accept-charset="<?php echo $lang['encoding']?>"> 88596331712SAnika Henke <div class="centeralign"> 8864da078a3Smatthiasgrimm <input type="hidden" name="id" value="<?php echo $ID?>" /> 8874da078a3Smatthiasgrimm <input type="hidden" name="wikitext" value="<?php echo formText($text)?>" /> 8884da078a3Smatthiasgrimm <input type="hidden" name="summary" value="<?php echo formText($summary)?>" /> 889f3f0262cSandi 89018829381SAndreas Gohr <input class="button" type="submit" name="do[save]" value="<?php echo $lang['btn_save']?>" accesskey="s" title="<?php echo $lang['btn_save']?> [ALT+S]" /> 89118829381SAndreas Gohr <input class="button" type="submit" name="do[cancel]" value="<?php echo $lang['btn_cancel']?>" /> 892f3f0262cSandi </div> 893f3f0262cSandi </form> 894f3f0262cSandi <br /><br /><br /><br /> 8954da078a3Smatthiasgrimm <?php 896f3f0262cSandi} 897f3f0262cSandi 898f3f0262cSandi/** 89915fae107Sandi * Prints the global message array 90015fae107Sandi * 90115fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 902f3f0262cSandi */ 903f3f0262cSandifunction html_msgarea(){ 904f3f0262cSandi global $MSG; 905f3f0262cSandi 906f3f0262cSandi if(!isset($MSG)) return; 907f3f0262cSandi 908f3f0262cSandi foreach($MSG as $msg){ 909f3f0262cSandi print '<div class="'.$msg['lvl'].'">'; 910f3f0262cSandi print $msg['msg']; 911f3f0262cSandi print '</div>'; 912f3f0262cSandi } 913f3f0262cSandi} 914f3f0262cSandi 915f3f0262cSandi/** 916f3f0262cSandi * Prints the registration form 91715fae107Sandi * 91815fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 919c9570649SAndreas Gohr * @triggers HTML_REGISTERFORM_INJECTION 920f3f0262cSandi */ 921f3f0262cSandifunction html_register(){ 922f3f0262cSandi global $lang; 923cab2716aSmatthias.grimm global $conf; 924f3f0262cSandi global $ID; 925f3f0262cSandi 926c112d578Sandi print p_locale_xhtml('register'); 927f3f0262cSandi?> 92896331712SAnika Henke <div class="centeralign"> 9291dd0c202SAnika Henke <form id="dw__register" method="post" action="<?php echo wl($ID)?>" accept-charset="<?php echo $lang['encoding']?>"> 93096331712SAnika Henke <fieldset> 931f3f0262cSandi <input type="hidden" name="do" value="register" /> 932f3f0262cSandi <input type="hidden" name="save" value="1" /> 93396331712SAnika Henke 9344da078a3Smatthiasgrimm <legend><?php echo $lang['register']?></legend> 935b6912aeaSAndreas Gohr <label class="block"> 9364da078a3Smatthiasgrimm <?php echo $lang['user']?> 9374da078a3Smatthiasgrimm <input type="text" name="login" class="edit" size="50" value="<?php echo formText($_POST['login'])?>" /> 938f3f0262cSandi </label><br /> 939cab2716aSmatthias.grimm 940cab2716aSmatthias.grimm <?php 941cab2716aSmatthias.grimm if (!$conf['autopasswd']) { 942cab2716aSmatthias.grimm ?> 943b6912aeaSAndreas Gohr <label class="block"> 9444da078a3Smatthiasgrimm <?php echo $lang['pass']?> 945cab2716aSmatthias.grimm <input type="password" name="pass" class="edit" size="50" /> 946cab2716aSmatthias.grimm </label><br /> 947b6912aeaSAndreas Gohr <label class="block"> 9484da078a3Smatthiasgrimm <?php echo $lang['passchk']?> 949cab2716aSmatthias.grimm <input type="password" name="passchk" class="edit" size="50" /> 950cab2716aSmatthias.grimm </label><br /> 951cab2716aSmatthias.grimm <?php 952cab2716aSmatthias.grimm } 953cab2716aSmatthias.grimm ?> 954cab2716aSmatthias.grimm 955b6912aeaSAndreas Gohr <label class="block"> 9564da078a3Smatthiasgrimm <?php echo $lang['fullname']?> 9574da078a3Smatthiasgrimm <input type="text" name="fullname" class="edit" size="50" value="<?php echo formText($_POST['fullname'])?>" /> 958f3f0262cSandi </label><br /> 959b6912aeaSAndreas Gohr <label class="block"> 9604da078a3Smatthiasgrimm <?php echo $lang['email']?> 9614da078a3Smatthiasgrimm <input type="text" name="email" class="edit" size="50" value="<?php echo formText($_POST['email'])?>" /> 962f3f0262cSandi </label><br /> 963c9570649SAndreas Gohr <?php //bad and dirty event insert hook 964c9570649SAndreas Gohr $evdata = array(); 965c9570649SAndreas Gohr trigger_event('HTML_REGISTERFORM_INJECTION', $evdata); 966c9570649SAndreas Gohr ?> 9674da078a3Smatthiasgrimm <input type="submit" class="button" value="<?php echo $lang['register']?>" /> 968f3f0262cSandi </fieldset> 969f3f0262cSandi </form> 970f3f0262cSandi </div> 9714da078a3Smatthiasgrimm<?php 972f3f0262cSandi} 973f3f0262cSandi 974f3f0262cSandi/** 9758b06d178Schris * Print the update profile form 9768b06d178Schris * 9778b06d178Schris * @author Christopher Smith <chris@jalakai.co.uk> 9788b06d178Schris * @author Andreas Gohr <andi@splitbrain.org> 9798b06d178Schris */ 9808b06d178Schrisfunction html_updateprofile(){ 9818b06d178Schris global $lang; 9828b06d178Schris global $conf; 9838b06d178Schris global $ID; 9848b06d178Schris global $INFO; 98582fd59b6SAndreas Gohr global $auth; 9868b06d178Schris 9878b06d178Schris print p_locale_xhtml('updateprofile'); 9888b06d178Schris 9898b06d178Schris if (empty($_POST['fullname'])) $_POST['fullname'] = $INFO['userinfo']['name']; 9908b06d178Schris if (empty($_POST['email'])) $_POST['email'] = $INFO['userinfo']['mail']; 9918b06d178Schris?> 99296331712SAnika Henke <div class="centeralign"> 9931dd0c202SAnika Henke <form id="dw__register" method="post" action="<?php echo wl($ID)?>" accept-charset="<?php echo $lang['encoding']?>"> 99496331712SAnika Henke <fieldset style="width: 80%;"> 9958b06d178Schris <input type="hidden" name="do" value="profile" /> 9968b06d178Schris <input type="hidden" name="save" value="1" /> 99796331712SAnika Henke 9988b06d178Schris <legend><?php echo $lang['profile']?></legend> 9998b06d178Schris <label class="block"> 10008b06d178Schris <?php echo $lang['user']?> 10018b06d178Schris <input type="text" name="fullname" disabled="disabled" class="edit" size="50" value="<?php echo formText($_SERVER['REMOTE_USER'])?>" /> 10028b06d178Schris </label><br /> 10038b06d178Schris <label class="block"> 10048b06d178Schris <?php echo $lang['fullname']?> 100582fd59b6SAndreas Gohr <input type="text" name="fullname" <?php if(!$auth->canDo('modName')) echo 'disabled="disabled"'?> class="edit" size="50" value="<?php echo formText($_POST['fullname'])?>" /> 10068b06d178Schris </label><br /> 10078b06d178Schris <label class="block"> 10088b06d178Schris <?php echo $lang['email']?> 100982fd59b6SAndreas Gohr <input type="text" name="email" <?php if(!$auth->canDo('modName')) echo 'disabled="disabled"'?> class="edit" size="50" value="<?php echo formText($_POST['email'])?>" /> 10108b06d178Schris </label><br /><br /> 101182fd59b6SAndreas Gohr 101282fd59b6SAndreas Gohr <?php if($auth->canDo('modPass')) { ?> 10138b06d178Schris <label class="block"> 10148b06d178Schris <?php echo $lang['newpass']?> 10158b06d178Schris <input type="password" name="newpass" class="edit" size="50" /> 10168b06d178Schris </label><br /> 10178b06d178Schris <label class="block"> 10188b06d178Schris <?php echo $lang['passchk']?> 10198b06d178Schris <input type="password" name="passchk" class="edit" size="50" /> 10208b06d178Schris </label><br /> 102182fd59b6SAndreas Gohr <?php } ?> 10228b06d178Schris 10238b06d178Schris <?php if ($conf['profileconfirm']) { ?> 10248b06d178Schris <br /> 10258b06d178Schris <label class="block"> 10268b06d178Schris <?php echo $lang['oldpass']?> 10278b06d178Schris <input type="password" name="oldpass" class="edit" size="50" /> 10288b06d178Schris </label><br /> 10298b06d178Schris <?php } ?> 1030*28a97b17SEsther Brunner <?php //bad and dirty event insert hook 1031*28a97b17SEsther Brunner $evdata = array(); 1032*28a97b17SEsther Brunner trigger_event('HTML_PROFILEFORM_INJECTION', $evdata); 1033*28a97b17SEsther Brunner ?> 10344cb79657SMatthias Grimm <input type="submit" class="button" value="<?php echo $lang['btn_save']?>" /> 10358b06d178Schris <input type="reset" class="button" value="<?php echo $lang['btn_reset']?>" /> 10368b06d178Schris </fieldset> 10378b06d178Schris </form> 10388b06d178Schris </div> 10398b06d178Schris<?php 10408b06d178Schris} 10418b06d178Schris 10428b06d178Schris/** 1043f3f0262cSandi * This displays the edit form (lots of logic included) 104415fae107Sandi * 10457146cee2SAndreas Gohr * @fixme this is a huge lump of code and should be modularized 1046016b6153SAndreas Gohr * @triggers HTML_PAGE_FROMTEMPLATE 1047c9570649SAndreas Gohr * @triggers HTML_EDITFORM_INJECTION 104815fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 1049f3f0262cSandi */ 1050f3f0262cSandifunction html_edit($text=null,$include='edit'){ //FIXME: include needed? 1051f3f0262cSandi global $ID; 1052f3f0262cSandi global $REV; 1053f3f0262cSandi global $DATE; 1054f3f0262cSandi global $RANGE; 1055f3f0262cSandi global $PRE; 1056f3f0262cSandi global $SUF; 1057f3f0262cSandi global $INFO; 1058f3f0262cSandi global $SUM; 1059f3f0262cSandi global $lang; 1060f3f0262cSandi global $conf; 1061f3f0262cSandi 1062f3f0262cSandi //set summary default 1063f3f0262cSandi if(!$SUM){ 1064f3f0262cSandi if($REV){ 1065f3f0262cSandi $SUM = $lang['restored']; 1066f3f0262cSandi }elseif(!$INFO['exists']){ 1067f3f0262cSandi $SUM = $lang['created']; 1068f3f0262cSandi } 1069f3f0262cSandi } 1070f3f0262cSandi 1071f3f0262cSandi //no text? Load it! 1072f3f0262cSandi if(!isset($text)){ 1073f3f0262cSandi $pr = false; //no preview mode 10747146cee2SAndreas Gohr if($INFO['exists']){ 1075f3f0262cSandi if($RANGE){ 1076f3f0262cSandi list($PRE,$text,$SUF) = rawWikiSlices($RANGE,$ID,$REV); 1077f3f0262cSandi }else{ 1078f3f0262cSandi $text = rawWiki($ID,$REV); 1079f3f0262cSandi } 1080f3f0262cSandi }else{ 10817146cee2SAndreas Gohr //try to load a pagetemplate 1082b7d5a5f0SAndreas Gohr $data = array($ID); 1083016b6153SAndreas Gohr $text = trigger_event('HTML_PAGE_FROMTEMPLATE',$data,'pageTemplate',true); 10847146cee2SAndreas Gohr } 10857146cee2SAndreas Gohr }else{ 1086f3f0262cSandi $pr = true; //preview mode 1087f3f0262cSandi } 1088f3f0262cSandi 1089f3f0262cSandi $wr = $INFO['writable']; 1090f3f0262cSandi if($wr){ 1091c112d578Sandi if ($REV) print p_locale_xhtml('editrev'); 1092c112d578Sandi print p_locale_xhtml($include); 1093d98d4540SBen Coburn $ro=false; 1094f3f0262cSandi }else{ 1095409d7af7SAndreas Gohr // check pseudo action 'source' 1096409d7af7SAndreas Gohr if(!actionOK('source')){ 1097409d7af7SAndreas Gohr msg('Command disabled: source',-1); 1098409d7af7SAndreas Gohr return; 1099409d7af7SAndreas Gohr } 1100c112d578Sandi print p_locale_xhtml('read'); 1101f3f0262cSandi $ro='readonly="readonly"'; 1102f3f0262cSandi } 1103f3f0262cSandi if(!$DATE) $DATE = $INFO['lastmod']; 1104dc57ef04Sandi 1105dc57ef04Sandi 1106f3f0262cSandi?> 110763afe2a6SAnika Henke <div style="width:99%;"> 110842c7abd6SAndreas Gohr 110963afe2a6SAnika Henke <div class="toolbar"> 1110bb4866bdSchris <div id="draft__status"><?php if(!empty($INFO['draft'])) echo $lang['draftdate'].' '.date($conf['dformat']);?></div> 1111409d7af7SAndreas Gohr <div id="tool__bar"><?php if(!$ro){?><a href="<?php echo DOKU_BASE?>lib/exe/mediamanager.php?ns=<?php echo $INFO['namespace']?>" 1112409d7af7SAndreas Gohr target="_blank"><?php echo $lang['mediaselect'] ?></a><?php }?></div> 111320d062caSAndreas Gohr 11144da078a3Smatthiasgrimm <?php if($wr){?> 1115e226efe1SAndreas Gohr <script type="text/javascript" charset="utf-8"><!--//--><![CDATA[//><!-- 11164da078a3Smatthiasgrimm <?php /* sets changed to true when previewed */?> 11174da078a3Smatthiasgrimm textChanged = <?php ($pr) ? print 'true' : print 'false' ?>; 1118e226efe1SAndreas Gohr //--><!]]></script> 111924a33b42SAndreas Gohr <span id="spell__action"></span> 112024a33b42SAndreas Gohr <div id="spell__suggest"></div> 1121ee4c4a1bSAndreas Gohr <?php } ?> 112263afe2a6SAnika Henke </div> 112324a33b42SAndreas Gohr <div id="spell__result"></div> 112463afe2a6SAnika Henke 112542c7abd6SAndreas Gohr 112642c7abd6SAndreas Gohr <form id="dw__editform" method="post" action="<?php echo script()?>" accept-charset="<?php echo $lang['encoding']?>"><div class="no"> 112742c7abd6SAndreas Gohr <input type="hidden" name="id" value="<?php echo $ID?>" /> 112842c7abd6SAndreas Gohr <input type="hidden" name="rev" value="<?php echo $REV?>" /> 112942c7abd6SAndreas Gohr <input type="hidden" name="date" value="<?php echo $DATE?>" /> 113042c7abd6SAndreas Gohr <input type="hidden" name="prefix" value="<?php echo formText($PRE)?>" /> 113142c7abd6SAndreas Gohr <input type="hidden" name="suffix" value="<?php echo formText($SUF)?>" /> 113242c7abd6SAndreas Gohr </div> 113342c7abd6SAndreas Gohr 113424a33b42SAndreas Gohr <textarea name="wikitext" id="wiki__text" <?php echo $ro?> cols="80" rows="10" class="edit" tabindex="1"><?php echo "\n".formText($text)?></textarea> 113563afe2a6SAnika Henke 113688e6a4f2SAndreas Gohr <?php //bad and dirty event insert hook 113788e6a4f2SAndreas Gohr $evdata = array('writable' => $wr); 113888e6a4f2SAndreas Gohr trigger_event('HTML_EDITFORM_INJECTION', $evdata); 113988e6a4f2SAndreas Gohr ?> 114088e6a4f2SAndreas Gohr 114124a33b42SAndreas Gohr <div id="wiki__editbar"> 114224a33b42SAndreas Gohr <div id="size__ctl"></div> 11434da078a3Smatthiasgrimm <?php if($wr){?> 1144fa24fadbSAnika Henke <div class="editButtons"> 114518829381SAndreas Gohr <input class="button" id="edbtn__save" type="submit" name="do[save]" value="<?php echo $lang['btn_save']?>" accesskey="s" title="<?php echo $lang['btn_save']?> [ALT+S]" tabindex="4" /> 114618829381SAndreas Gohr <input class="button" id="edbtn__preview" type="submit" name="do[preview]" value="<?php echo $lang['btn_preview']?>" accesskey="p" title="<?php echo $lang['btn_preview']?> [ALT+P]" tabindex="5" /> 114742c7abd6SAndreas Gohr <input class="button" type="submit" name="do[draftdel]" value="<?php echo $lang['btn_cancel']?>" tabindex="6" /> 1148fa24fadbSAnika Henke </div> 11494da078a3Smatthiasgrimm <?php } ?> 11504da078a3Smatthiasgrimm <?php if($wr){ ?> 1151fa24fadbSAnika Henke <div class="summary"> 115224a33b42SAndreas Gohr <label for="edit__summary" class="nowrap"><?php echo $lang['summary']?>:</label> 115324a33b42SAndreas Gohr <input type="text" class="edit" name="summary" id="edit__summary" size="50" value="<?php echo formText($SUM)?>" tabindex="2" /> 1154b6912aeaSAndreas Gohr <?php html_minoredit()?> 1155fa24fadbSAnika Henke </div> 11564da078a3Smatthiasgrimm <?php }?> 115763afe2a6SAnika Henke </div> 115842c7abd6SAndreas Gohr </form> 115963afe2a6SAnika Henke </div> 11604da078a3Smatthiasgrimm<?php 1161f3f0262cSandi} 1162f3f0262cSandi 1163f3f0262cSandi/** 1164b6912aeaSAndreas Gohr * Adds a checkbox for minor edits for logged in users 1165b6912aeaSAndreas Gohr * 1166b6912aeaSAndreas Gohr * @author Andrea Gohr <andi@splitbrain.org> 1167b6912aeaSAndreas Gohr */ 1168b6912aeaSAndreas Gohrfunction html_minoredit(){ 1169b6912aeaSAndreas Gohr global $conf; 1170b6912aeaSAndreas Gohr global $lang; 1171b6912aeaSAndreas Gohr // minor edits are for logged in users only 1172b6912aeaSAndreas Gohr if(!$conf['useacl'] || !$_SERVER['REMOTE_USER']){ 1173b6912aeaSAndreas Gohr return; 1174b6912aeaSAndreas Gohr } 1175b6912aeaSAndreas Gohr 1176b6912aeaSAndreas Gohr $p = array(); 1177b6912aeaSAndreas Gohr $p['name'] = 'minor'; 1178b6912aeaSAndreas Gohr $p['type'] = 'checkbox'; 1179b6912aeaSAndreas Gohr $p['id'] = 'minoredit'; 1180b6912aeaSAndreas Gohr $p['tabindex'] = 3; 1181b6912aeaSAndreas Gohr $p['value'] = '1'; 1182bb4866bdSchris if(!empty($_REQUEST['minor'])) $p['checked']='checked'; 1183b6912aeaSAndreas Gohr $att = buildAttributes($p); 1184b6912aeaSAndreas Gohr 1185fa24fadbSAnika Henke print '<span class="nowrap">'; 1186b6912aeaSAndreas Gohr print "<input $att />"; 1187b6912aeaSAndreas Gohr print '<label for="minoredit">'; 1188b6912aeaSAndreas Gohr print $lang['minoredit']; 1189b6912aeaSAndreas Gohr print '</label>'; 1190fa24fadbSAnika Henke print '</span>'; 1191b6912aeaSAndreas Gohr} 1192b6912aeaSAndreas Gohr 1193b6912aeaSAndreas Gohr/** 1194f3f0262cSandi * prints some debug info 119515fae107Sandi * 119615fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 1197f3f0262cSandi */ 1198f3f0262cSandifunction html_debug(){ 1199f3f0262cSandi global $conf; 1200d16a4edaSandi global $lang; 12015298a619SAndreas Gohr global $auth; 1202100a97e3SAndreas Gohr global $INFO; 1203100a97e3SAndreas Gohr 120428fb55ffSandi //remove sensitive data 120528fb55ffSandi $cnf = $conf; 120628fb55ffSandi $cnf['auth']='***'; 120728fb55ffSandi $cnf['notify']='***'; 12083dc3a5f1Sandi $cnf['ftp']='***'; 1209100a97e3SAndreas Gohr $nfo = $INFO; 1210100a97e3SAndreas Gohr $nfo['userinfo'] = '***'; 1211100a97e3SAndreas Gohr $ses = $_SESSION; 1212100a97e3SAndreas Gohr $ses[$conf['title']]['auth'] = '***'; 1213f3f0262cSandi 1214f3f0262cSandi print '<html><body>'; 1215f3f0262cSandi 1216f3f0262cSandi print '<p>When reporting bugs please send all the following '; 1217f3f0262cSandi print 'output as a mail to andi@splitbrain.org '; 1218f3f0262cSandi print 'The best way to do this is to save this page in your browser</p>'; 1219f3f0262cSandi 1220100a97e3SAndreas Gohr print '<b>$INFO:</b><pre>'; 1221100a97e3SAndreas Gohr print_r($nfo); 1222100a97e3SAndreas Gohr print '</pre>'; 1223100a97e3SAndreas Gohr 1224f3f0262cSandi print '<b>$_SERVER:</b><pre>'; 1225f3f0262cSandi print_r($_SERVER); 1226f3f0262cSandi print '</pre>'; 1227f3f0262cSandi 1228f3f0262cSandi print '<b>$conf:</b><pre>'; 122928fb55ffSandi print_r($cnf); 1230f3f0262cSandi print '</pre>'; 1231f3f0262cSandi 1232ed7b5f09Sandi print '<b>DOKU_BASE:</b><pre>'; 1233ed7b5f09Sandi print DOKU_BASE; 1234f3f0262cSandi print '</pre>'; 1235f3f0262cSandi 1236ed7b5f09Sandi print '<b>abs DOKU_BASE:</b><pre>'; 1237ed7b5f09Sandi print DOKU_URL; 1238ed7b5f09Sandi print '</pre>'; 1239ed7b5f09Sandi 1240ed7b5f09Sandi print '<b>rel DOKU_BASE:</b><pre>'; 1241f3f0262cSandi print dirname($_SERVER['PHP_SELF']).'/'; 1242f3f0262cSandi print '</pre>'; 1243f3f0262cSandi 1244f3f0262cSandi print '<b>PHP Version:</b><pre>'; 1245f3f0262cSandi print phpversion(); 1246f3f0262cSandi print '</pre>'; 1247f3f0262cSandi 1248f3f0262cSandi print '<b>locale:</b><pre>'; 1249f3f0262cSandi print setlocale(LC_ALL,0); 1250f3f0262cSandi print '</pre>'; 1251f3f0262cSandi 1252d16a4edaSandi print '<b>encoding:</b><pre>'; 1253d16a4edaSandi print $lang['encoding']; 1254d16a4edaSandi print '</pre>'; 1255d16a4edaSandi 12565298a619SAndreas Gohr if($auth){ 12575298a619SAndreas Gohr print '<b>Auth backend capabilities:</b><pre>'; 12585298a619SAndreas Gohr print_r($auth->cando); 12595298a619SAndreas Gohr print '</pre>'; 12605298a619SAndreas Gohr } 12615298a619SAndreas Gohr 12623aa54d7cSAndreas Gohr print '<b>$_SESSION:</b><pre>'; 1263100a97e3SAndreas Gohr print_r($ses); 12643aa54d7cSAndreas Gohr print '</pre>'; 12653aa54d7cSAndreas Gohr 1266f3f0262cSandi print '<b>Environment:</b><pre>'; 1267f3f0262cSandi print_r($_ENV); 1268f3f0262cSandi print '</pre>'; 1269f3f0262cSandi 1270f3f0262cSandi print '<b>PHP settings:</b><pre>'; 1271f3f0262cSandi $inis = ini_get_all(); 1272f3f0262cSandi print_r($inis); 1273f3f0262cSandi print '</pre>'; 1274f3f0262cSandi 1275f3f0262cSandi print '</body></html>'; 1276f3f0262cSandi} 1277f3f0262cSandi 1278c19fe9c0Sandifunction html_admin(){ 1279c19fe9c0Sandi global $ID; 1280f8cc712eSAndreas Gohr global $INFO; 1281c19fe9c0Sandi global $lang; 1282ca3a6df1SMatthias Grimm global $conf; 1283c19fe9c0Sandi 1284c112d578Sandi print p_locale_xhtml('admin'); 1285c19fe9c0Sandi 128611e2ce22Schris // build menu of admin functions from the plugins that handle them 128711e2ce22Schris $pluginlist = plugin_list('admin'); 128811e2ce22Schris $menu = array(); 128911e2ce22Schris foreach ($pluginlist as $p) { 129011e2ce22Schris if($obj =& plugin_load('admin',$p) === NULL) continue; 1291f8cc712eSAndreas Gohr 1292f8cc712eSAndreas Gohr // check permissions 1293f8cc712eSAndreas Gohr if($obj->forAdminOnly() && !$INFO['isadmin']) continue; 1294f8cc712eSAndreas Gohr 129511e2ce22Schris $menu[] = array('plugin' => $p, 129611e2ce22Schris 'prompt' => $obj->getMenuText($conf['lang']), 129711e2ce22Schris 'sort' => $obj->getMenuSort() 129811e2ce22Schris ); 129911e2ce22Schris } 130011e2ce22Schris 1301746855cfSBen Coburn usort($menu, 'p_sort_modes'); 130211e2ce22Schris 130311e2ce22Schris // output the menu 130411e2ce22Schris ptln('<ul>'); 130511e2ce22Schris 130611e2ce22Schris foreach ($menu as $item) { 130711e2ce22Schris if (!$item['prompt']) continue; 13080c6b58a8SAndreas Gohr ptln(' <li><div class="li"><a href="'.wl($ID, 'do=admin&page='.$item['plugin']).'">'.$item['prompt'].'</a></div></li>'); 130911e2ce22Schris } 131011e2ce22Schris 131111e2ce22Schris ptln('</ul>'); 1312ca3a6df1SMatthias Grimm} 1313c19fe9c0Sandi 13148b06d178Schris/** 13158b06d178Schris * Form to request a new password for an existing account 13168b06d178Schris * 13178b06d178Schris * @author Benoit Chesneau <benoit@bchesneau.info> 131811e2ce22Schris */ 13198b06d178Schrisfunction html_resendpwd() { 13208b06d178Schris global $lang; 13218b06d178Schris global $conf; 13228b06d178Schris global $ID; 1323c19fe9c0Sandi 13248b06d178Schris print p_locale_xhtml('resendpwd'); 13258b06d178Schris?> 132696331712SAnika Henke <div class="centeralign"> 13271dd0c202SAnika Henke <form id="dw__resendpwd" action="<?php echo wl($ID)?>" accept-charset="<?php echo $lang['encoding']?>" method="post"> 13288b06d178Schris <fieldset> 13298b06d178Schris <br /> 1330753d5abfSMatthias Grimm <legend><?php echo $lang['resendpwd']?></legend> 13318b06d178Schris <input type="hidden" name="do" value="resendpwd" /> 13328b06d178Schris <input type="hidden" name="save" value="1" /> 13338b06d178Schris <label class="block"> 13348b06d178Schris <span><?php echo $lang['user']?></span> 13358b06d178Schris <input type="text" name="login" value="<?php echo formText($_POST['login'])?>" class="edit" /><br /><br /> 13368b06d178Schris </label><br /> 13378b06d178Schris <input type="submit" value="<?php echo $lang['btn_resendpwd']?>" class="button" /> 13388b06d178Schris </fieldset> 13398b06d178Schris </form> 13408b06d178Schris </div> 13418b06d178Schris<?php 13428b06d178Schris} 1343340756e4Sandi 1344340756e4Sandi//Setup VIM: ex: et ts=2 enc=utf-8 : 1345