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 9ed7b5f09Sandi if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); 10f3f0262cSandi 116bbae538Sandi require_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> 45f3f0262cSandi */ 46f3f0262cSandifunction html_login(){ 47f3f0262cSandi global $lang; 48f3f0262cSandi global $conf; 49f3f0262cSandi global $ID; 50cd52f92dSchris global $auth; 51f3f0262cSandi 52c112d578Sandi print p_locale_xhtml('login'); 53f3f0262cSandi ?> 5496331712SAnika Henke <div class="centeralign"> 558d975344SAndreas Gohr <form action="<?php echo script()?>" accept-charset="<?php echo $lang['encoding']?>" 561440e523SAnika Henke method="post" id="dw__login"> 57f3f0262cSandi <fieldset> 584da078a3Smatthiasgrimm <legend><?php echo $lang['btn_login']?></legend> 594da078a3Smatthiasgrimm <input type="hidden" name="id" value="<?php echo $ID?>" /> 60f3f0262cSandi <input type="hidden" name="do" value="login" /> 61b6912aeaSAndreas Gohr <label class="block"> 624da078a3Smatthiasgrimm <span><?php echo $lang['user']?></span> 638d975344SAndreas Gohr <input type="text" name="u" value="<?php echo formText($_REQUEST['u'])?>" 648d975344SAndreas Gohr class="edit" id="focus__this" /> 65f3f0262cSandi </label><br /> 66b6912aeaSAndreas Gohr <label class="block"> 674da078a3Smatthiasgrimm <span><?php echo $lang['pass']?></span> 68f3f0262cSandi <input type="password" name="p" class="edit" /> 69f3f0262cSandi </label><br /> 700c1887a0SAndreas Gohr <label for="remember__me" class="simple"> 714d6f545eSAndreas Gohr <input type="checkbox" name="r" id="remember__me" value="1" /> 724da078a3Smatthiasgrimm <span><?php echo $lang['remember']?></span> 73132bdbfeSandi </label> 748d975344SAndreas Gohr <input type="submit" value="<?php echo $lang['btn_login']?>" class="button" /> 75f3f0262cSandi </fieldset> 76f3f0262cSandi </form> 774da078a3Smatthiasgrimm <?php 78409d7af7SAndreas Gohr if($auth->canDo('addUser') && actionOK('register')){ 79f3f0262cSandi print '<p>'; 80f3f0262cSandi print $lang['reghere']; 811d5856cfSAndreas Gohr print ': <a href="'.wl($ID,'do=register').'" rel="nofollow" class="wikilink1">'.$lang['register'].'</a>'; 82f3f0262cSandi print '</p>'; 83f3f0262cSandi } 848b06d178Schris 85409d7af7SAndreas Gohr if ($auth->canDo('modPass') && actionOK('resendpwd')) { 868b06d178Schris print '<p>'; 878b06d178Schris print $lang['pwdforget']; 881d5856cfSAndreas Gohr print ': <a href="'.wl($ID,'do=resendpwd').'" rel="nofollow" class="wikilink1">'.$lang['btn_resendpwd'].'</a>'; 898b06d178Schris print '</p>'; 908b06d178Schris } 91f3f0262cSandi ?> 92f3f0262cSandi </div> 934da078a3Smatthiasgrimm <?php 946bbae538Sandi/* 956bbae538Sandi FIXME provide new hook 96f3f0262cSandi if(@file_exists('includes/login.txt')){ 97f3f0262cSandi print io_cacheParse('includes/login.txt'); 98f3f0262cSandi } 996bbae538Sandi*/ 100f3f0262cSandi} 101f3f0262cSandi 102f3f0262cSandi/** 10315fae107Sandi * prints a section editing button 10435dae8b0SBen Coburn * used as a callback in html_secedit 10515fae107Sandi * 10615fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 10715fae107Sandi */ 10835dae8b0SBen Coburnfunction html_secedit_button($matches){ 109f3f0262cSandi global $ID; 110041d7a86SBen Coburn global $INFO; 111041d7a86SBen Coburn 112041d7a86SBen Coburn $section = $matches[2]; 113041d7a86SBen Coburn $name = $matches[1]; 114041d7a86SBen Coburn 115f3f0262cSandi $secedit = ''; 116f3f0262cSandi $secedit .= '<div class="secedit">'; 117f3f0262cSandi $secedit .= html_btn('secedit',$ID,'', 118f3f0262cSandi array('do' => 'edit', 119306b2c85SDenis Simakov 'lines' => "$section", 120306b2c85SDenis Simakov 'rev' => $INFO['lastmod']), 12135dae8b0SBen Coburn 'post', $name); 122f3f0262cSandi $secedit .= '</div>'; 123f3f0262cSandi return $secedit; 124f3f0262cSandi} 125f3f0262cSandi 12615fae107Sandi/** 12715fae107Sandi * inserts section edit buttons if wanted or removes the markers 12815fae107Sandi * 12915fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 13015fae107Sandi */ 131f3f0262cSandifunction html_secedit($text,$show=true){ 132f3f0262cSandi global $INFO; 13335dae8b0SBen Coburn 134c112d578Sandi if($INFO['writable'] && $show && !$INFO['rev']){ 13535dae8b0SBen Coburn $text = preg_replace_callback('#<!-- SECTION "(.*?)" \[(\d+-\d*)\] -->#', 13635dae8b0SBen Coburn 'html_secedit_button', $text); 137f3f0262cSandi }else{ 13835dae8b0SBen Coburn $text = preg_replace('#<!-- SECTION "(.*?)" \[(\d+-\d*)\] -->#','',$text); 139f3f0262cSandi } 14035dae8b0SBen Coburn 141f3f0262cSandi return $text; 142f3f0262cSandi} 143f3f0262cSandi 144f3f0262cSandi/** 145d6c9c552Smatthiasgrimm * Just the back to top button (in its own form) 1466b13307fSandi * 1476b13307fSandi * @author Andreas Gohr <andi@splitbrain.org> 1486b13307fSandi */ 1496b13307fSandifunction html_topbtn(){ 1506b13307fSandi global $lang; 1516b13307fSandi 1526b13307fSandi $ret = ''; 15311ea018fSAndreas 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>'; 154df7b6005Sandi 1556b13307fSandi return $ret; 1566b13307fSandi} 1576b13307fSandi 1586b13307fSandi/** 159d67ca2c0Smatthiasgrimm * Just the back to media window button in its own form 160d67ca2c0Smatthiasgrimm * 161d67ca2c0Smatthiasgrimm * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net> 162d67ca2c0Smatthiasgrimm */ 163d67ca2c0Smatthiasgrimmfunction html_backtomedia_button($params,$akey=''){ 164d67ca2c0Smatthiasgrimm global $conf; 165d67ca2c0Smatthiasgrimm global $lang; 166d67ca2c0Smatthiasgrimm 1673df72098SAndreas Gohr $ret = '<form class="button" method="get" action="'.DOKU_BASE.'lib/exe/mediamanager.php"><div class="no">'; 168d67ca2c0Smatthiasgrimm 169d67ca2c0Smatthiasgrimm reset($params); 170d67ca2c0Smatthiasgrimm while (list($key, $val) = each($params)) { 171d67ca2c0Smatthiasgrimm $ret .= '<input type="hidden" name="'.$key.'" '; 172d67ca2c0Smatthiasgrimm $ret .= 'value="'.htmlspecialchars($val).'" />'; 173d67ca2c0Smatthiasgrimm } 174d67ca2c0Smatthiasgrimm 175d67ca2c0Smatthiasgrimm $ret .= '<input type="submit" value="'.htmlspecialchars($lang['btn_backtomedia']).'" class="button" '; 17611ea018fSAndreas Gohr $tit = htmlspecialchars($lang['btn_backtomedia']); 177d67ca2c0Smatthiasgrimm if($akey){ 17811ea018fSAndreas Gohr $tit .= ' [ALT+'.strtoupper($akey).']'; 179d67ca2c0Smatthiasgrimm $ret .= 'accesskey="'.$akey.'" '; 180d67ca2c0Smatthiasgrimm } 18111ea018fSAndreas Gohr $ret .= 'title="'.$tit.'" '; 182d67ca2c0Smatthiasgrimm $ret .= '/>'; 1834beabca9SAnika Henke $ret .= '</div></form>'; 184d67ca2c0Smatthiasgrimm 185d67ca2c0Smatthiasgrimm return $ret; 186d67ca2c0Smatthiasgrimm} 187d67ca2c0Smatthiasgrimm 188d67ca2c0Smatthiasgrimm/** 189d67ca2c0Smatthiasgrimm * Displays a button (using its own form) 19035dae8b0SBen Coburn * If tooltip exists, the access key tooltip is replaced. 19115fae107Sandi * 19215fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 193f3f0262cSandi */ 19435dae8b0SBen Coburnfunction html_btn($name,$id,$akey,$params,$method='get',$tooltip=''){ 195f3f0262cSandi global $conf; 196f3f0262cSandi global $lang; 197f3f0262cSandi 198f3f0262cSandi $label = $lang['btn_'.$name]; 199f3f0262cSandi 200f3f0262cSandi $ret = ''; 20135dae8b0SBen Coburn $tip = ''; 202f3f0262cSandi 20349c713a3Sandi //filter id (without urlencoding) 20449c713a3Sandi $id = idfilter($id,false); 205f3f0262cSandi 206f3f0262cSandi //make nice URLs even for buttons 2076c7843b5Sandi if($conf['userewrite'] == 2){ 2086c7843b5Sandi $script = DOKU_BASE.DOKU_SCRIPT.'/'.$id; 2096c7843b5Sandi }elseif($conf['userewrite']){ 2106c7843b5Sandi $script = DOKU_BASE.$id; 2116c7843b5Sandi }else{ 2128b00ebcfSandi $script = DOKU_BASE.DOKU_SCRIPT; 213f3f0262cSandi $params['id'] = $id; 214f3f0262cSandi } 215f3f0262cSandi 2164beabca9SAnika Henke $ret .= '<form class="button" method="'.$method.'" action="'.$script.'"><div class="no">'; 217f3f0262cSandi 21806a4bf8fSAndreas Gohr if(is_array($params)){ 219f3f0262cSandi reset($params); 220f3f0262cSandi while (list($key, $val) = each($params)) { 221f3f0262cSandi $ret .= '<input type="hidden" name="'.$key.'" '; 222f3f0262cSandi $ret .= 'value="'.htmlspecialchars($val).'" />'; 223f3f0262cSandi } 22406a4bf8fSAndreas Gohr } 225f3f0262cSandi 22635dae8b0SBen Coburn if ($tooltip!='') { 22735dae8b0SBen Coburn $tip = htmlspecialchars($tooltip); 22811ea018fSAndreas Gohr }else{ 22911ea018fSAndreas Gohr $tip = htmlspecialchars($label); 23011ea018fSAndreas Gohr } 23111ea018fSAndreas Gohr 23211ea018fSAndreas Gohr $ret .= '<input type="submit" value="'.htmlspecialchars($label).'" class="button" '; 23311ea018fSAndreas Gohr if($akey){ 23411ea018fSAndreas Gohr $tip .= ' [ALT+'.strtoupper($akey).']'; 23511ea018fSAndreas Gohr $ret .= 'accesskey="'.$akey.'" '; 23635dae8b0SBen Coburn } 23735dae8b0SBen Coburn $ret .= 'title="'.$tip.'" '; 238f3f0262cSandi $ret .= '/>'; 2394beabca9SAnika Henke $ret .= '</div></form>'; 240f3f0262cSandi 241f3f0262cSandi return $ret; 242f3f0262cSandi} 243f3f0262cSandi 244f3f0262cSandi/** 24515fae107Sandi * show a wiki page 24615fae107Sandi * 24715fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 24815fae107Sandi */ 2496bbae538Sandifunction html_show($txt=''){ 250f3f0262cSandi global $ID; 251f3f0262cSandi global $REV; 252f3f0262cSandi global $HIGH; 253f3f0262cSandi //disable section editing for old revisions or in preview 2545400331dSandi if($txt || $REV){ 2556bbae538Sandi $secedit = false; 2566bbae538Sandi }else{ 2576bbae538Sandi $secedit = true; 258f3f0262cSandi } 259f3f0262cSandi 2606bbae538Sandi if ($txt){ 261f3f0262cSandi //PreviewHeader 26250835be7SAndreas Gohr print '<br id="scroll__here" />'; 263c112d578Sandi print p_locale_xhtml('preview'); 264f3f0262cSandi print '<div class="preview">'; 2659dc2c2afSandi print html_secedit(p_render('xhtml',p_get_instructions($txt),$info),$secedit); 26646723c19SAndreas Gohr print '<div class="clearer"></div>'; 267f3f0262cSandi print '</div>'; 2686bbae538Sandi 269f3f0262cSandi }else{ 270c112d578Sandi if ($REV) print p_locale_xhtml('showrev'); 271c112d578Sandi $html = p_wiki_xhtml($ID,$REV,true); 2726bbae538Sandi $html = html_secedit($html,$secedit); 273f3f0262cSandi print html_hilight($html,$HIGH); 274f3f0262cSandi } 275f3f0262cSandi} 276f3f0262cSandi 277f3f0262cSandi/** 278ee4c4a1bSAndreas Gohr * ask the user about how to handle an exisiting draft 279ee4c4a1bSAndreas Gohr * 280ee4c4a1bSAndreas Gohr * @author Andreas Gohr <andi@splitbrain.org> 281ee4c4a1bSAndreas Gohr */ 282ee4c4a1bSAndreas Gohrfunction html_draft(){ 283ee4c4a1bSAndreas Gohr global $INFO; 284ee4c4a1bSAndreas Gohr global $ID; 285ee4c4a1bSAndreas Gohr global $lang; 286ee4c4a1bSAndreas Gohr global $conf; 287ee4c4a1bSAndreas Gohr $draft = unserialize(io_readFile($INFO['draft'],false)); 288ee4c4a1bSAndreas Gohr $text = cleanText(con($draft['prefix'],$draft['text'],$draft['suffix'],true)); 289ee4c4a1bSAndreas Gohr 290ee4c4a1bSAndreas Gohr echo p_locale_xhtml('draft'); 291ee4c4a1bSAndreas Gohr ?> 292ee4c4a1bSAndreas Gohr <form id="dw__editform" method="post" action="<?php echo script()?>" 293ee4c4a1bSAndreas Gohr accept-charset="<?php echo $lang['encoding']?>"><div class="no"> 294ee4c4a1bSAndreas Gohr <input type="hidden" name="id" value="<?php echo $ID?>" /> 295ee4c4a1bSAndreas Gohr <input type="hidden" name="date" value="<?php echo $draft['date']?>" /></div> 296ee4c4a1bSAndreas Gohr <textarea name="wikitext" id="wiki__text" readonly="readonly" cols="80" rows="10" class="edit"><?php echo "\n".formText($text)?></textarea> 297ee4c4a1bSAndreas Gohr 298ee4c4a1bSAndreas Gohr <div id="draft__status"><?php echo $lang['draftdate'].' '.date($conf['dformat'],filemtime($INFO['draft']))?></div> 299ee4c4a1bSAndreas Gohr 30018829381SAndreas Gohr <input class="button" type="submit" name="do[recover]" value="<?php echo $lang['btn_recover']?>" tabindex="1" /> 30118829381SAndreas Gohr <input class="button" type="submit" name="do[draftdel]" value="<?php echo $lang['btn_draftdel']?>" tabindex="2" /> 30218829381SAndreas Gohr <input class="button" type="submit" name="do[show]" value="<?php echo $lang['btn_cancel']?>" tabindex="3" /> 303ee4c4a1bSAndreas Gohr </form> 304ee4c4a1bSAndreas Gohr <?php 305ee4c4a1bSAndreas Gohr} 306ee4c4a1bSAndreas Gohr 307ee4c4a1bSAndreas Gohr/** 308f3f0262cSandi * Highlights searchqueries in HTML code 30915fae107Sandi * 31015fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 3117209be23SAndreas Gohr * @author Harry Fuecks <hfuecks@gmail.com> 312f3f0262cSandi */ 313f3f0262cSandifunction html_hilight($html,$query){ 3147209be23SAndreas Gohr //split at common delimiters 3159d9c165eSAndreas Gohr $queries = preg_split ('/[\s\'"\\\\`()\]\[?:!\.{};,#+*<>\\/]+/',$query,-1,PREG_SPLIT_NO_EMPTY); 316f3f0262cSandi foreach ($queries as $q){ 317f3f0262cSandi $q = preg_quote($q,'/'); 3187209be23SAndreas Gohr $html = preg_replace_callback("/((<[^>]*)|$q)/i",'html_hilight_callback',$html); 319f3f0262cSandi } 320f3f0262cSandi return $html; 321f3f0262cSandi} 322f3f0262cSandi 323f3f0262cSandi/** 3247209be23SAndreas Gohr * Callback used by html_hilight() 3257209be23SAndreas Gohr * 3267209be23SAndreas Gohr * @author Harry Fuecks <hfuecks@gmail.com> 3277209be23SAndreas Gohr */ 3287209be23SAndreas Gohrfunction html_hilight_callback($m) { 3297209be23SAndreas Gohr $hlight = unslash($m[0]); 3307209be23SAndreas Gohr if ( !isset($m[2])) { 3317209be23SAndreas Gohr $hlight = '<span class="search_hit">'.$hlight.'</span>'; 3327209be23SAndreas Gohr } 3337209be23SAndreas Gohr return $hlight; 3347209be23SAndreas Gohr} 3357209be23SAndreas Gohr 3367209be23SAndreas Gohr/** 33715fae107Sandi * Run a search and display the result 33815fae107Sandi * 33915fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 340f3f0262cSandi */ 341f3f0262cSandifunction html_search(){ 342ed7b5f09Sandi require_once(DOKU_INC.'inc/search.php'); 343506fa893SAndreas Gohr require_once(DOKU_INC.'inc/fulltext.php'); 344f3f0262cSandi global $conf; 345f3f0262cSandi global $QUERY; 346f3f0262cSandi global $ID; 347f3f0262cSandi global $lang; 348f3f0262cSandi 349c112d578Sandi print p_locale_xhtml('searchpage'); 350f3f0262cSandi flush(); 351f3f0262cSandi 352d0ab54f6SMichael Klier chi@chimeric.de //check if search is restricted to namespace 353d0ab54f6SMichael Klier chi@chimeric.de if(preg_match('/([^@]*)@([^@]*)/',$QUERY,$match)) { 354d0ab54f6SMichael Klier chi@chimeric.de $id = cleanID($match[1]); 355d0ab54f6SMichael Klier chi@chimeric.de if(empty($id)) { 356d0ab54f6SMichael Klier chi@chimeric.de print '<div class="nothing">'.$lang['nothingfound'].'</div>'; 357d0ab54f6SMichael Klier chi@chimeric.de flush(); 358d0ab54f6SMichael Klier chi@chimeric.de return; 359d0ab54f6SMichael Klier chi@chimeric.de } 360d0ab54f6SMichael Klier chi@chimeric.de } else { 361d0ab54f6SMichael Klier chi@chimeric.de $id = cleanID($QUERY); 362d0ab54f6SMichael Klier chi@chimeric.de } 363d0ab54f6SMichael Klier chi@chimeric.de 3644d9ff3d5Sandi //show progressbar 3659edac8a8SAndreas Gohr print '<div class="centeralign" id="dw__loading">'; 3669edac8a8SAndreas Gohr print '<script type="text/javascript" charset="utf-8">'; 367121d5fa6SAndreas Gohr print 'showLoadBar();'; 3689edac8a8SAndreas Gohr print '</script>'; 369121d5fa6SAndreas Gohr print "<br /></div>\n"; 3709edac8a8SAndreas Gohr flush(); 3714d9ff3d5Sandi 372f3f0262cSandi //do quick pagesearch 373f3f0262cSandi $data = array(); 374d0ab54f6SMichael Klier chi@chimeric.de 375d0ab54f6SMichael Klier chi@chimeric.de $data = ft_pageLookup($id); 376f3f0262cSandi if(count($data)){ 377f3f0262cSandi sort($data); 378f3f0262cSandi print '<div class="search_quickresult">'; 379746855cfSBen Coburn print '<h3>'.$lang['quickhits'].':</h3>'; 3804f732f0eSAnika Henke print '<ul class="search_quickhits">'; 381140c93f3SAnika Henke foreach($data as $id){ 3824f732f0eSAnika Henke print '<li> '; 383506fa893SAndreas Gohr print html_wikilink(':'.$id,$conf['useheading']?NULL:$id); 3844f732f0eSAnika Henke print '</li> '; 385f3f0262cSandi } 386140c93f3SAnika Henke print '</ul> '; 387f3f0262cSandi //clear float (see http://www.complexspiral.com/publications/containing-floats/) 388f3f0262cSandi print '<div class="clearer"> </div>'; 389f3f0262cSandi print '</div>'; 390f3f0262cSandi } 391f3f0262cSandi flush(); 392f3f0262cSandi 393f3f0262cSandi //do fulltext search 394506fa893SAndreas Gohr $data = ft_pageSearch($QUERY,$poswords); 395f3f0262cSandi if(count($data)){ 396506fa893SAndreas Gohr $num = 1; 397506fa893SAndreas Gohr foreach($data as $id => $cnt){ 398f3f0262cSandi print '<div class="search_result">'; 399506fa893SAndreas Gohr print html_wikilink(':'.$id,$conf['useheading']?NULL:$id,$poswords); 400506fa893SAndreas Gohr print ': <span class="search_cnt">'.$cnt.' '.$lang['hits'].'</span><br />'; 401506fa893SAndreas Gohr if($num < 15){ // create snippets for the first number of matches only #FIXME add to conf ? 402506fa893SAndreas Gohr print '<div class="search_snippet">'.ft_snippet($id,$poswords).'</div>'; 403506fa893SAndreas Gohr } 404f3f0262cSandi print '</div>'; 405506fa893SAndreas Gohr flush(); 406506fa893SAndreas Gohr $num++; 407f3f0262cSandi } 408f3f0262cSandi }else{ 409820fa24bSandi print '<div class="nothing">'.$lang['nothingfound'].'</div>'; 410f3f0262cSandi } 4114d9ff3d5Sandi 4124d9ff3d5Sandi //hide progressbar 4134beabca9SAnika Henke print '<script type="text/javascript" charset="utf-8">'; 4149edac8a8SAndreas Gohr print 'hideLoadBar("dw__loading");'; 4154d9ff3d5Sandi print '</script>'; 4169edac8a8SAndreas Gohr flush(); 417f3f0262cSandi} 418f3f0262cSandi 41915fae107Sandi/** 42015fae107Sandi * Display error on locked pages 42115fae107Sandi * 42215fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 42315fae107Sandi */ 424ee20e7d1Sandifunction html_locked(){ 425f3f0262cSandi global $ID; 426f3f0262cSandi global $conf; 427f3f0262cSandi global $lang; 42888f522e9Sandi global $INFO; 429f3f0262cSandi 430c9b4bd1eSBen Coburn $locktime = filemtime(wikiLockFN($ID)); 431f3f0262cSandi $expire = @date($conf['dformat'], $locktime + $conf['locktime'] ); 432f3f0262cSandi $min = round(($conf['locktime'] - (time() - $locktime) )/60); 433f3f0262cSandi 434c112d578Sandi print p_locale_xhtml('locked'); 435f3f0262cSandi print '<ul>'; 4360c6b58a8SAndreas Gohr print '<li><div class="li"><strong>'.$lang['lockedby'].':</strong> '.$INFO['locked'].'</li>'; 4370c6b58a8SAndreas Gohr print '<li><div class="li"><strong>'.$lang['lockexpire'].':</strong> '.$expire.' ('.$min.' min)</div></li>'; 438f3f0262cSandi print '</ul>'; 439f3f0262cSandi} 440f3f0262cSandi 44115fae107Sandi/** 44215fae107Sandi * list old revisions 44315fae107Sandi * 44415fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 44571726d78SBen Coburn * @author Ben Coburn <btcoburn@silicodon.net> 44615fae107Sandi */ 44771726d78SBen Coburnfunction html_revisions($first=0){ 448f3f0262cSandi global $ID; 449f3f0262cSandi global $INFO; 450f3f0262cSandi global $conf; 451f3f0262cSandi global $lang; 45271726d78SBen Coburn /* we need to get one additionally log entry to be able to 45371726d78SBen Coburn * decide if this is the last page or is there another one. 45471726d78SBen Coburn * see html_recent() 45571726d78SBen Coburn */ 45671726d78SBen Coburn $revisions = getRevisions($ID, $first, $conf['recent']+1); 45771726d78SBen Coburn if(count($revisions)==0 && $first!=0){ 45871726d78SBen Coburn $first=0; 45971726d78SBen Coburn $revisions = getRevisions($ID, $first, $conf['recent']+1);; 46071726d78SBen Coburn } 46171726d78SBen Coburn $hasNext = false; 46271726d78SBen Coburn if (count($revisions)>$conf['recent']) { 46371726d78SBen Coburn $hasNext = true; 46471726d78SBen Coburn array_pop($revisions); // remove extra log entry 46571726d78SBen Coburn } 46671726d78SBen Coburn 467f3f0262cSandi $date = @date($conf['dformat'],$INFO['lastmod']); 468f3f0262cSandi 469c112d578Sandi print p_locale_xhtml('revisions'); 470f3f0262cSandi print '<ul>'; 47171726d78SBen Coburn if($INFO['exists'] && $first==0){ 47271726d78SBen Coburn print (isset($INFO['meta']) && isset($INFO['meta']['last_change']) && $INFO['meta']['last_change']['type']==='e') ? '<li class="minor">' : '<li>'; 4730c6b58a8SAndreas Gohr print '<div class="li">'; 474f9b2fe70Sandi 475f9b2fe70Sandi print $date; 476f9b2fe70Sandi 47702e51121SAnika Henke print ' <img src="'.DOKU_BASE.'lib/images/blank.gif" width="15" height="11" alt="" /> '; 478cffcc403Sandi 479f9b2fe70Sandi print '<a class="wikilink1" href="'.wl($ID).'">'.$ID.'</a> '; 480652610a2Sandi 48141396b71SAndreas Gohr print ' – '; 482652610a2Sandi print $INFO['sum']; 48388f522e9Sandi print ' <span class="user">'; 48488f522e9Sandi print $INFO['editor']; 48588f522e9Sandi print '</span> '; 486652610a2Sandi 487652610a2Sandi print '('.$lang['current'].')'; 4880c6b58a8SAndreas Gohr print '</div>'; 489652610a2Sandi print '</li>'; 490f3f0262cSandi } 491f3f0262cSandi 492f3f0262cSandi foreach($revisions as $rev){ 493f3f0262cSandi $date = date($conf['dformat'],$rev); 494fb53bfe2SBen Coburn $info = getRevisionInfo($ID,$rev,true); 495652610a2Sandi 49671726d78SBen Coburn print ($info['type']==='e') ? '<li class="minor">' : '<li>'; 4970c6b58a8SAndreas Gohr print '<div class="li">'; 498f9b2fe70Sandi print $date; 499f9b2fe70Sandi 50041396b71SAndreas Gohr if(@file_exists(wikiFN($ID,$rev))){ 501cffcc403Sandi print ' <a href="'.wl($ID,"rev=$rev,do=diff").'">'; 502d94f4568SAndreas Gohr $p = array(); 503d94f4568SAndreas Gohr $p['src'] = DOKU_BASE.'lib/images/diff.png'; 504d94f4568SAndreas Gohr $p['width'] = 15; 505d94f4568SAndreas Gohr $p['height'] = 11; 506d94f4568SAndreas Gohr $p['title'] = $lang['diff']; 507d94f4568SAndreas Gohr $p['alt'] = $lang['diff']; 508d94f4568SAndreas Gohr $att = buildAttributes($p); 509d94f4568SAndreas Gohr print "<img $att />"; 510cffcc403Sandi print '</a> '; 511cffcc403Sandi 512f9b2fe70Sandi print '<a class="wikilink1" href="'.wl($ID,"rev=$rev").'">'.$ID.'</a>'; 51341396b71SAndreas Gohr }else{ 51441396b71SAndreas Gohr print ' <img src="'.DOKU_BASE.'lib/images/blank.gif" width="15" height="11" alt="" /> '; 51541396b71SAndreas Gohr print $ID; 51641396b71SAndreas Gohr } 517f9b2fe70Sandi 51841396b71SAndreas Gohr print ' – '; 519f243a77fSandi print htmlspecialchars($info['sum']); 52088f522e9Sandi print ' <span class="user">'; 52188f522e9Sandi if($info['user']){ 52288f522e9Sandi print $info['user']; 52388f522e9Sandi }else{ 524652610a2Sandi print $info['ip']; 52588f522e9Sandi } 52688f522e9Sandi print '</span>'; 527652610a2Sandi 5280c6b58a8SAndreas Gohr print '</div>'; 529f3f0262cSandi print '</li>'; 530f3f0262cSandi } 531f3f0262cSandi print '</ul>'; 53271726d78SBen Coburn 53371726d78SBen Coburn print '<div class="pagenav">'; 53471726d78SBen Coburn $last = $first + $conf['recent']; 53571726d78SBen Coburn if ($first > 0) { 53671726d78SBen Coburn $first -= $conf['recent']; 53771726d78SBen Coburn if ($first < 0) $first = 0; 53871726d78SBen Coburn print '<div class="pagenav-prev">'; 539eeb83e57SBen Coburn print html_btn('newer',$ID,"p",array('do' => 'revisions', 'first' => $first)); 54071726d78SBen Coburn print '</div>'; 54171726d78SBen Coburn } 54271726d78SBen Coburn if ($hasNext) { 54371726d78SBen Coburn print '<div class="pagenav-next">'; 544eeb83e57SBen Coburn print html_btn('older',$ID,"n",array('do' => 'revisions', 'first' => $last)); 54571726d78SBen Coburn print '</div>'; 54671726d78SBen Coburn } 54771726d78SBen Coburn print '</div>'; 54871726d78SBen Coburn 549f3f0262cSandi} 550f3f0262cSandi 55115fae107Sandi/** 55215fae107Sandi * display recent changes 55315fae107Sandi * 55415fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 5555749f1ceSmatthiasgrimm * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net> 55671726d78SBen Coburn * @author Ben Coburn <btcoburn@silicodon.net> 55715fae107Sandi */ 558a39955b0Smatthiasgrimmfunction html_recent($first=0){ 559f3f0262cSandi global $conf; 560cffcc403Sandi global $lang; 561dbb00abcSEsther Brunner global $ID; 5625749f1ceSmatthiasgrimm /* we need to get one additionally log entry to be able to 5635749f1ceSmatthiasgrimm * decide if this is the last page or is there another one. 5645749f1ceSmatthiasgrimm * This is the cheapest solution to get this information. 5655749f1ceSmatthiasgrimm */ 566b6912aeaSAndreas Gohr $recents = getRecents($first,$conf['recent'] + 1,getNS($ID)); 5675749f1ceSmatthiasgrimm if(count($recents) == 0 && $first != 0){ 5685749f1ceSmatthiasgrimm $first=0; 56971726d78SBen Coburn $recents = getRecents($first,$conf['recent'] + 1,getNS($ID)); 5705749f1ceSmatthiasgrimm } 57171726d78SBen Coburn $hasNext = false; 57271726d78SBen Coburn if (count($recents)>$conf['recent']) { 57371726d78SBen Coburn $hasNext = true; 57471726d78SBen Coburn array_pop($recents); // remove extra log entry 57571726d78SBen Coburn } 576f3f0262cSandi 577c112d578Sandi print p_locale_xhtml('recent'); 578f3f0262cSandi print '<ul>'; 579a39955b0Smatthiasgrimm 580d437bcc4SAndreas Gohr foreach($recents as $recent){ 581d437bcc4SAndreas Gohr $date = date($conf['dformat'],$recent['date']); 58271726d78SBen Coburn print ($recent['type']==='e') ? '<li class="minor">' : '<li>'; 5830c6b58a8SAndreas Gohr print '<div class="li">'; 584cffcc403Sandi 585f9b2fe70Sandi print $date.' '; 586f9b2fe70Sandi 587d437bcc4SAndreas Gohr print '<a href="'.wl($recent['id'],"do=diff").'">'; 588d94f4568SAndreas Gohr $p = array(); 589d94f4568SAndreas Gohr $p['src'] = DOKU_BASE.'lib/images/diff.png'; 590d94f4568SAndreas Gohr $p['width'] = 15; 591d94f4568SAndreas Gohr $p['height'] = 11; 592d94f4568SAndreas Gohr $p['title'] = $lang['diff']; 593d94f4568SAndreas Gohr $p['alt'] = $lang['diff']; 594d94f4568SAndreas Gohr $att = buildAttributes($p); 595d94f4568SAndreas Gohr print "<img $att />"; 596cffcc403Sandi print '</a> '; 597cffcc403Sandi 598d437bcc4SAndreas Gohr print '<a href="'.wl($recent['id'],"do=revisions").'">'; 599d94f4568SAndreas Gohr $p = array(); 600d94f4568SAndreas Gohr $p['src'] = DOKU_BASE.'lib/images/history.png'; 601d94f4568SAndreas Gohr $p['width'] = 12; 602d94f4568SAndreas Gohr $p['height'] = 14; 603d94f4568SAndreas Gohr $p['title'] = $lang['btn_revs']; 604d94f4568SAndreas Gohr $p['alt'] = $lang['btn_revs']; 605d94f4568SAndreas Gohr $att = buildAttributes($p); 606d94f4568SAndreas Gohr print "<img $att />"; 607cffcc403Sandi print '</a> '; 608cffcc403Sandi 609d437bcc4SAndreas Gohr print html_wikilink(':'.$recent['id'],$conf['useheading']?NULL:$recent['id']); 61041396b71SAndreas Gohr print ' – '.htmlspecialchars($recent['sum']); 611b6912aeaSAndreas Gohr 61288f522e9Sandi print ' <span class="user">'; 613d437bcc4SAndreas Gohr if($recent['user']){ 614d437bcc4SAndreas Gohr print $recent['user']; 61588f522e9Sandi }else{ 616d437bcc4SAndreas Gohr print $recent['ip']; 61788f522e9Sandi } 61888f522e9Sandi print '</span>'; 619cffcc403Sandi 6200c6b58a8SAndreas Gohr print '</div>'; 621f3f0262cSandi print '</li>'; 622f3f0262cSandi } 623f3f0262cSandi print '</ul>'; 624a39955b0Smatthiasgrimm 625a39955b0Smatthiasgrimm print '<div class="pagenav">'; 6265749f1ceSmatthiasgrimm $last = $first + $conf['recent']; 627a39955b0Smatthiasgrimm if ($first > 0) { 628a39955b0Smatthiasgrimm $first -= $conf['recent']; 629a39955b0Smatthiasgrimm if ($first < 0) $first = 0; 630a39955b0Smatthiasgrimm print '<div class="pagenav-prev">'; 6315749f1ceSmatthiasgrimm print html_btn('newer','',"p",array('do' => 'recent', 'first' => $first)); 632a39955b0Smatthiasgrimm print '</div>'; 633a39955b0Smatthiasgrimm } 63471726d78SBen Coburn if ($hasNext) { 635a39955b0Smatthiasgrimm print '<div class="pagenav-next">'; 6365749f1ceSmatthiasgrimm print html_btn('older','',"n",array('do' => 'recent', 'first' => $last)); 637a39955b0Smatthiasgrimm print '</div>'; 638a39955b0Smatthiasgrimm } 639a39955b0Smatthiasgrimm print '</div>'; 640f3f0262cSandi} 641f3f0262cSandi 64215fae107Sandi/** 64315fae107Sandi * Display page index 64415fae107Sandi * 64515fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 64615fae107Sandi */ 647f3f0262cSandifunction html_index($ns){ 648ed7b5f09Sandi require_once(DOKU_INC.'inc/search.php'); 649f3f0262cSandi global $conf; 650f3f0262cSandi global $ID; 651f3f0262cSandi $dir = $conf['datadir']; 652f3f0262cSandi $ns = cleanID($ns); 65330f1737dSandi #fixme use appropriate function 654f3f0262cSandi if(empty($ns)){ 655f3f0262cSandi $ns = dirname(str_replace(':','/',$ID)); 656f3f0262cSandi if($ns == '.') $ns =''; 657f3f0262cSandi } 65888d3a917Sandi $ns = utf8_encodeFN(str_replace(':','/',$ns)); 659f3f0262cSandi 660c112d578Sandi print p_locale_xhtml('index'); 661f3f0262cSandi 662f3f0262cSandi $data = array(); 663f3f0262cSandi search($data,$conf['datadir'],'search_index',array('ns' => $ns)); 664cb70c441Sandi print html_buildlist($data,'idx','html_list_index','html_li_index'); 665f3f0262cSandi} 666f3f0262cSandi 667f3f0262cSandi/** 66815fae107Sandi * Index item formatter 66915fae107Sandi * 670f3f0262cSandi * User function for html_buildlist() 67115fae107Sandi * 67215fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 673f3f0262cSandi */ 674f3f0262cSandifunction html_list_index($item){ 675d98d4540SBen Coburn global $ID; 676f3f0262cSandi $ret = ''; 677f3f0262cSandi $base = ':'.$item['id']; 678f3f0262cSandi $base = substr($base,strrpos($base,':')+1); 679f3f0262cSandi if($item['type']=='d'){ 680f3f0262cSandi $ret .= '<a href="'.wl($ID,'idx='.$item['id']).'" class="idx_dir">'; 681f3f0262cSandi $ret .= $base; 682f3f0262cSandi $ret .= '</a>'; 683f3f0262cSandi }else{ 684f3f0262cSandi $ret .= html_wikilink(':'.$item['id']); 685f3f0262cSandi } 686f3f0262cSandi return $ret; 687f3f0262cSandi} 688f3f0262cSandi 689f3f0262cSandi/** 690cb70c441Sandi * Index List item 691cb70c441Sandi * 692cb70c441Sandi * This user function is used in html_build_lidt to build the 693cb70c441Sandi * <li> tags for namespaces when displaying the page index 694cb70c441Sandi * it gives different classes to opened or closed "folders" 695cb70c441Sandi * 696cb70c441Sandi * @author Andreas Gohr <andi@splitbrain.org> 697cb70c441Sandi */ 698cb70c441Sandifunction html_li_index($item){ 699cb70c441Sandi if($item['type'] == "f"){ 700cb70c441Sandi return '<li class="level'.$item['level'].'">'; 701cb70c441Sandi }elseif($item['open']){ 702cb70c441Sandi return '<li class="open">'; 703cb70c441Sandi }else{ 704cb70c441Sandi return '<li class="closed">'; 705cb70c441Sandi } 706cb70c441Sandi} 707cb70c441Sandi 708cb70c441Sandi/** 709cb70c441Sandi * Default List item 710cb70c441Sandi * 711cb70c441Sandi * @author Andreas Gohr <andi@splitbrain.org> 712cb70c441Sandi */ 713cb70c441Sandifunction html_li_default($item){ 714cb70c441Sandi return '<li class="level'.$item['level'].'">'; 715cb70c441Sandi} 716cb70c441Sandi 717cb70c441Sandi/** 71815fae107Sandi * Build an unordered list 71915fae107Sandi * 720f3f0262cSandi * Build an unordered list from the given $data array 721f3f0262cSandi * Each item in the array has to have a 'level' property 722f3f0262cSandi * the item itself gets printed by the given $func user 723cb70c441Sandi * function. The second and optional function is used to 724cb70c441Sandi * print the <li> tag. Both user function need to accept 725cb70c441Sandi * a single item. 72615fae107Sandi * 727c5a8fd96SAndreas Gohr * Both user functions can be given as array to point to 728c5a8fd96SAndreas Gohr * a member of an object. 729c5a8fd96SAndreas Gohr * 73015fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 731f3f0262cSandi */ 732cb70c441Sandifunction html_buildlist($data,$class,$func,$lifunc='html_li_default'){ 733f3f0262cSandi $level = 0; 734f3f0262cSandi $opens = 0; 735f3f0262cSandi $ret = ''; 736f3f0262cSandi 737f3f0262cSandi foreach ($data as $item){ 738f3f0262cSandi 739f3f0262cSandi if( $item['level'] > $level ){ 740f3f0262cSandi //open new list 741df52d0feSandi for($i=0; $i<($item['level'] - $level); $i++){ 742df52d0feSandi if ($i) $ret .= "<li class=\"clear\">\n"; 743f3f0262cSandi $ret .= "\n<ul class=\"$class\">\n"; 744df52d0feSandi } 745f3f0262cSandi }elseif( $item['level'] < $level ){ 746f3f0262cSandi //close last item 747f3f0262cSandi $ret .= "</li>\n"; 748f3f0262cSandi for ($i=0; $i<($level - $item['level']); $i++){ 749f3f0262cSandi //close higher lists 750f3f0262cSandi $ret .= "</ul>\n</li>\n"; 751f3f0262cSandi } 752f3f0262cSandi }else{ 753f3f0262cSandi //close last item 754f3f0262cSandi $ret .= "</li>\n"; 755f3f0262cSandi } 756f3f0262cSandi 757f3f0262cSandi //remember current level 758f3f0262cSandi $level = $item['level']; 759f3f0262cSandi 760f3f0262cSandi //print item 761c5a8fd96SAndreas Gohr if(is_array($lifunc)){ 762c5a8fd96SAndreas Gohr $ret .= $lifunc[0]->$lifunc[1]($item); //user object method 763c5a8fd96SAndreas Gohr }else{ 764cb70c441Sandi $ret .= $lifunc($item); //user function 765c5a8fd96SAndreas Gohr } 7660c6b58a8SAndreas Gohr $ret .= '<div class="li">'; 767c5a8fd96SAndreas Gohr if(is_array($func)){ 768c5a8fd96SAndreas Gohr $ret .= $func[0]->$func[1]($item); //user object method 769c5a8fd96SAndreas Gohr }else{ 770f3f0262cSandi $ret .= $func($item); //user function 771c5a8fd96SAndreas Gohr } 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{ 8264d58bd99Sandi if($REV){ 8274d58bd99Sandi $r = $REV; 8284d58bd99Sandi }else{ 8294d58bd99Sandi //use last revision if none given 83071726d78SBen Coburn $revs = getRevisions($ID, 0, 1); 8314d58bd99Sandi $r = $revs[0]; 8324d58bd99Sandi } 8334d58bd99Sandi 834e1bd90ffSAndreas Gohr if($r){ 835e1bd90ffSAndreas Gohr $df = new Diff(explode("\n",htmlspecialchars(rawWiki($ID,$r))), 836e1bd90ffSAndreas Gohr explode("\n",htmlspecialchars(rawWiki($ID,'')))); 8374d58bd99Sandi $left = '<a class="wikilink1" href="'.wl($ID,"rev=$r").'">'. 8384d58bd99Sandi $ID.' '.date($conf['dformat'],$r).'</a>'; 839e1bd90ffSAndreas Gohr }else{ 840e1bd90ffSAndreas Gohr $df = new Diff(array(''), 841e1bd90ffSAndreas Gohr explode("\n",htmlspecialchars(rawWiki($ID,'')))); 842e1bd90ffSAndreas Gohr $left = '<a class="wikilink1" href="'.wl($ID).'">'. 843e1bd90ffSAndreas Gohr $ID.'</a>'; 844e1bd90ffSAndreas Gohr } 845f3f0262cSandi $right = '<a class="wikilink1" href="'.wl($ID).'">'. 846f3f0262cSandi $ID.' '.date($conf['dformat'],@filemtime(wikiFN($ID))).'</a> '. 847f3f0262cSandi $lang['current']; 848f3f0262cSandi } 849f3f0262cSandi $tdf = new TableDiffFormatter(); 850c112d578Sandi if($intro) print p_locale_xhtml('diff'); 851f3f0262cSandi ?> 852daf4ca4eSAnika Henke <table class="diff"> 853f3f0262cSandi <tr> 854daf4ca4eSAnika Henke <th colspan="2"> 8554da078a3Smatthiasgrimm <?php echo $left?> 856daf4ca4eSAnika Henke </th> 857daf4ca4eSAnika Henke <th colspan="2"> 8584da078a3Smatthiasgrimm <?php echo $right?> 859daf4ca4eSAnika Henke </th> 860f3f0262cSandi </tr> 8614da078a3Smatthiasgrimm <?php echo $tdf->format($df)?> 862f3f0262cSandi </table> 8634da078a3Smatthiasgrimm <?php 864f3f0262cSandi} 865f3f0262cSandi 86615fae107Sandi/** 86715fae107Sandi * show warning on conflict detection 86815fae107Sandi * 86915fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 87015fae107Sandi */ 871f3f0262cSandifunction html_conflict($text,$summary){ 872f3f0262cSandi global $ID; 873f3f0262cSandi global $lang; 874f3f0262cSandi 875c112d578Sandi print p_locale_xhtml('conflict'); 876f3f0262cSandi ?> 8771dd0c202SAnika Henke <form id="dw__editform" method="post" action="<?php echo script()?>" accept-charset="<?php echo $lang['encoding']?>"> 87896331712SAnika Henke <div class="centeralign"> 8794da078a3Smatthiasgrimm <input type="hidden" name="id" value="<?php echo $ID?>" /> 8804da078a3Smatthiasgrimm <input type="hidden" name="wikitext" value="<?php echo formText($text)?>" /> 8814da078a3Smatthiasgrimm <input type="hidden" name="summary" value="<?php echo formText($summary)?>" /> 882f3f0262cSandi 88318829381SAndreas 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]" /> 88418829381SAndreas Gohr <input class="button" type="submit" name="do[cancel]" value="<?php echo $lang['btn_cancel']?>" /> 885f3f0262cSandi </div> 886f3f0262cSandi </form> 887f3f0262cSandi <br /><br /><br /><br /> 8884da078a3Smatthiasgrimm <?php 889f3f0262cSandi} 890f3f0262cSandi 891f3f0262cSandi/** 89215fae107Sandi * Prints the global message array 89315fae107Sandi * 89415fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 895f3f0262cSandi */ 896f3f0262cSandifunction html_msgarea(){ 897f3f0262cSandi global $MSG; 898f3f0262cSandi 899f3f0262cSandi if(!isset($MSG)) return; 900f3f0262cSandi 901f3f0262cSandi foreach($MSG as $msg){ 902f3f0262cSandi print '<div class="'.$msg['lvl'].'">'; 903f3f0262cSandi print $msg['msg']; 904f3f0262cSandi print '</div>'; 905f3f0262cSandi } 906f3f0262cSandi} 907f3f0262cSandi 908f3f0262cSandi/** 909f3f0262cSandi * Prints the registration form 91015fae107Sandi * 91115fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 912f3f0262cSandi */ 913f3f0262cSandifunction html_register(){ 914f3f0262cSandi global $lang; 915cab2716aSmatthias.grimm global $conf; 916f3f0262cSandi global $ID; 917f3f0262cSandi 918c112d578Sandi print p_locale_xhtml('register'); 919f3f0262cSandi?> 92096331712SAnika Henke <div class="centeralign"> 9211dd0c202SAnika Henke <form id="dw__register" method="post" action="<?php echo wl($ID)?>" accept-charset="<?php echo $lang['encoding']?>"> 92296331712SAnika Henke <fieldset> 923f3f0262cSandi <input type="hidden" name="do" value="register" /> 924f3f0262cSandi <input type="hidden" name="save" value="1" /> 92596331712SAnika Henke 9264da078a3Smatthiasgrimm <legend><?php echo $lang['register']?></legend> 927b6912aeaSAndreas Gohr <label class="block"> 9284da078a3Smatthiasgrimm <?php echo $lang['user']?> 9294da078a3Smatthiasgrimm <input type="text" name="login" class="edit" size="50" value="<?php echo formText($_POST['login'])?>" /> 930f3f0262cSandi </label><br /> 931cab2716aSmatthias.grimm 932cab2716aSmatthias.grimm <?php 933cab2716aSmatthias.grimm if (!$conf['autopasswd']) { 934cab2716aSmatthias.grimm ?> 935b6912aeaSAndreas Gohr <label class="block"> 9364da078a3Smatthiasgrimm <?php echo $lang['pass']?> 937cab2716aSmatthias.grimm <input type="password" name="pass" class="edit" size="50" /> 938cab2716aSmatthias.grimm </label><br /> 939b6912aeaSAndreas Gohr <label class="block"> 9404da078a3Smatthiasgrimm <?php echo $lang['passchk']?> 941cab2716aSmatthias.grimm <input type="password" name="passchk" class="edit" size="50" /> 942cab2716aSmatthias.grimm </label><br /> 943cab2716aSmatthias.grimm <?php 944cab2716aSmatthias.grimm } 945cab2716aSmatthias.grimm ?> 946cab2716aSmatthias.grimm 947b6912aeaSAndreas Gohr <label class="block"> 9484da078a3Smatthiasgrimm <?php echo $lang['fullname']?> 9494da078a3Smatthiasgrimm <input type="text" name="fullname" class="edit" size="50" value="<?php echo formText($_POST['fullname'])?>" /> 950f3f0262cSandi </label><br /> 951b6912aeaSAndreas Gohr <label class="block"> 9524da078a3Smatthiasgrimm <?php echo $lang['email']?> 9534da078a3Smatthiasgrimm <input type="text" name="email" class="edit" size="50" value="<?php echo formText($_POST['email'])?>" /> 954f3f0262cSandi </label><br /> 9554da078a3Smatthiasgrimm <input type="submit" class="button" value="<?php echo $lang['register']?>" /> 956f3f0262cSandi </fieldset> 957f3f0262cSandi </form> 958f3f0262cSandi </div> 9594da078a3Smatthiasgrimm<?php 960f3f0262cSandi} 961f3f0262cSandi 962f3f0262cSandi/** 9638b06d178Schris * Print the update profile form 9648b06d178Schris * 9658b06d178Schris * @author Christopher Smith <chris@jalakai.co.uk> 9668b06d178Schris * @author Andreas Gohr <andi@splitbrain.org> 9678b06d178Schris */ 9688b06d178Schrisfunction html_updateprofile(){ 9698b06d178Schris global $lang; 9708b06d178Schris global $conf; 9718b06d178Schris global $ID; 9728b06d178Schris global $INFO; 97382fd59b6SAndreas Gohr global $auth; 9748b06d178Schris 9758b06d178Schris print p_locale_xhtml('updateprofile'); 9768b06d178Schris 9778b06d178Schris if (empty($_POST['fullname'])) $_POST['fullname'] = $INFO['userinfo']['name']; 9788b06d178Schris if (empty($_POST['email'])) $_POST['email'] = $INFO['userinfo']['mail']; 9798b06d178Schris?> 98096331712SAnika Henke <div class="centeralign"> 9811dd0c202SAnika Henke <form id="dw__register" method="post" action="<?php echo wl($ID)?>" accept-charset="<?php echo $lang['encoding']?>"> 98296331712SAnika Henke <fieldset style="width: 80%;"> 9838b06d178Schris <input type="hidden" name="do" value="profile" /> 9848b06d178Schris <input type="hidden" name="save" value="1" /> 98596331712SAnika Henke 9868b06d178Schris <legend><?php echo $lang['profile']?></legend> 9878b06d178Schris <label class="block"> 9888b06d178Schris <?php echo $lang['user']?> 9898b06d178Schris <input type="text" name="fullname" disabled="disabled" class="edit" size="50" value="<?php echo formText($_SERVER['REMOTE_USER'])?>" /> 9908b06d178Schris </label><br /> 9918b06d178Schris <label class="block"> 9928b06d178Schris <?php echo $lang['fullname']?> 99382fd59b6SAndreas Gohr <input type="text" name="fullname" <?php if(!$auth->canDo('modName')) echo 'disabled="disabled"'?> class="edit" size="50" value="<?php echo formText($_POST['fullname'])?>" /> 9948b06d178Schris </label><br /> 9958b06d178Schris <label class="block"> 9968b06d178Schris <?php echo $lang['email']?> 99782fd59b6SAndreas Gohr <input type="text" name="email" <?php if(!$auth->canDo('modName')) echo 'disabled="disabled"'?> class="edit" size="50" value="<?php echo formText($_POST['email'])?>" /> 9988b06d178Schris </label><br /><br /> 99982fd59b6SAndreas Gohr 100082fd59b6SAndreas Gohr <?php if($auth->canDo('modPass')) { ?> 10018b06d178Schris <label class="block"> 10028b06d178Schris <?php echo $lang['newpass']?> 10038b06d178Schris <input type="password" name="newpass" class="edit" size="50" /> 10048b06d178Schris </label><br /> 10058b06d178Schris <label class="block"> 10068b06d178Schris <?php echo $lang['passchk']?> 10078b06d178Schris <input type="password" name="passchk" class="edit" size="50" /> 10088b06d178Schris </label><br /> 100982fd59b6SAndreas Gohr <?php } ?> 10108b06d178Schris 10118b06d178Schris <?php if ($conf['profileconfirm']) { ?> 10128b06d178Schris <br /> 10138b06d178Schris <label class="block"> 10148b06d178Schris <?php echo $lang['oldpass']?> 10158b06d178Schris <input type="password" name="oldpass" class="edit" size="50" /> 10168b06d178Schris </label><br /> 10178b06d178Schris <?php } ?> 10188b06d178Schris 10194cb79657SMatthias Grimm <input type="submit" class="button" value="<?php echo $lang['btn_save']?>" /> 10208b06d178Schris <input type="reset" class="button" value="<?php echo $lang['btn_reset']?>" /> 10218b06d178Schris </fieldset> 10228b06d178Schris </form> 10238b06d178Schris </div> 10248b06d178Schris<?php 10258b06d178Schris} 10268b06d178Schris 10278b06d178Schris/** 1028f3f0262cSandi * This displays the edit form (lots of logic included) 102915fae107Sandi * 10307146cee2SAndreas Gohr * @fixme this is a huge lump of code and should be modularized 1031016b6153SAndreas Gohr * @triggers HTML_PAGE_FROMTEMPLATE 103215fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 1033f3f0262cSandi */ 1034f3f0262cSandifunction html_edit($text=null,$include='edit'){ //FIXME: include needed? 1035f3f0262cSandi global $ID; 1036f3f0262cSandi global $REV; 1037f3f0262cSandi global $DATE; 1038f3f0262cSandi global $RANGE; 1039f3f0262cSandi global $PRE; 1040f3f0262cSandi global $SUF; 1041f3f0262cSandi global $INFO; 1042f3f0262cSandi global $SUM; 1043f3f0262cSandi global $lang; 1044f3f0262cSandi global $conf; 1045f3f0262cSandi 1046f3f0262cSandi //set summary default 1047f3f0262cSandi if(!$SUM){ 1048f3f0262cSandi if($REV){ 1049f3f0262cSandi $SUM = $lang['restored']; 1050f3f0262cSandi }elseif(!$INFO['exists']){ 1051f3f0262cSandi $SUM = $lang['created']; 1052f3f0262cSandi } 1053f3f0262cSandi } 1054f3f0262cSandi 1055f3f0262cSandi //no text? Load it! 1056f3f0262cSandi if(!isset($text)){ 1057f3f0262cSandi $pr = false; //no preview mode 10587146cee2SAndreas Gohr if($INFO['exists']){ 1059f3f0262cSandi if($RANGE){ 1060f3f0262cSandi list($PRE,$text,$SUF) = rawWikiSlices($RANGE,$ID,$REV); 1061f3f0262cSandi }else{ 1062f3f0262cSandi $text = rawWiki($ID,$REV); 1063f3f0262cSandi } 1064f3f0262cSandi }else{ 10657146cee2SAndreas Gohr //try to load a pagetemplate 1066b7d5a5f0SAndreas Gohr $data = array($ID); 1067016b6153SAndreas Gohr $text = trigger_event('HTML_PAGE_FROMTEMPLATE',$data,'pageTemplate',true); 10687146cee2SAndreas Gohr } 10697146cee2SAndreas Gohr }else{ 1070f3f0262cSandi $pr = true; //preview mode 1071f3f0262cSandi } 1072f3f0262cSandi 1073f3f0262cSandi $wr = $INFO['writable']; 1074f3f0262cSandi if($wr){ 1075c112d578Sandi if ($REV) print p_locale_xhtml('editrev'); 1076c112d578Sandi print p_locale_xhtml($include); 1077d98d4540SBen Coburn $ro=false; 1078f3f0262cSandi }else{ 1079409d7af7SAndreas Gohr // check pseudo action 'source' 1080409d7af7SAndreas Gohr if(!actionOK('source')){ 1081409d7af7SAndreas Gohr msg('Command disabled: source',-1); 1082409d7af7SAndreas Gohr return; 1083409d7af7SAndreas Gohr } 1084c112d578Sandi print p_locale_xhtml('read'); 1085f3f0262cSandi $ro='readonly="readonly"'; 1086f3f0262cSandi } 1087f3f0262cSandi if(!$DATE) $DATE = $INFO['lastmod']; 1088dc57ef04Sandi 1089dc57ef04Sandi 1090f3f0262cSandi?> 109163afe2a6SAnika Henke <div style="width:99%;"> 109242c7abd6SAndreas Gohr 109363afe2a6SAnika Henke <div class="toolbar"> 1094bb4866bdSchris <div id="draft__status"><?php if(!empty($INFO['draft'])) echo $lang['draftdate'].' '.date($conf['dformat']);?></div> 1095409d7af7SAndreas Gohr <div id="tool__bar"><?php if(!$ro){?><a href="<?php echo DOKU_BASE?>lib/exe/mediamanager.php?ns=<?php echo $INFO['namespace']?>" 1096409d7af7SAndreas Gohr target="_blank"><?php echo $lang['mediaselect'] ?></a><?php }?></div> 109720d062caSAndreas Gohr 10984da078a3Smatthiasgrimm <?php if($wr){?> 10994beabca9SAnika Henke <script type="text/javascript" charset="utf-8"> 11004da078a3Smatthiasgrimm <?php /* sets changed to true when previewed */?> 11014da078a3Smatthiasgrimm textChanged = <?php ($pr) ? print 'true' : print 'false' ?>; 1102f3f0262cSandi </script> 110324a33b42SAndreas Gohr <span id="spell__action"></span> 110424a33b42SAndreas Gohr <div id="spell__suggest"></div> 1105ee4c4a1bSAndreas Gohr <?php } ?> 110663afe2a6SAnika Henke </div> 110724a33b42SAndreas Gohr <div id="spell__result"></div> 110863afe2a6SAnika Henke 110942c7abd6SAndreas Gohr 111042c7abd6SAndreas Gohr <form id="dw__editform" method="post" action="<?php echo script()?>" accept-charset="<?php echo $lang['encoding']?>"><div class="no"> 111142c7abd6SAndreas Gohr <input type="hidden" name="id" value="<?php echo $ID?>" /> 111242c7abd6SAndreas Gohr <input type="hidden" name="rev" value="<?php echo $REV?>" /> 111342c7abd6SAndreas Gohr <input type="hidden" name="date" value="<?php echo $DATE?>" /> 111442c7abd6SAndreas Gohr <input type="hidden" name="prefix" value="<?php echo formText($PRE)?>" /> 111542c7abd6SAndreas Gohr <input type="hidden" name="suffix" value="<?php echo formText($SUF)?>" /> 111642c7abd6SAndreas Gohr </div> 111742c7abd6SAndreas Gohr 111824a33b42SAndreas Gohr <textarea name="wikitext" id="wiki__text" <?php echo $ro?> cols="80" rows="10" class="edit" tabindex="1"><?php echo "\n".formText($text)?></textarea> 111963afe2a6SAnika Henke 1120*88e6a4f2SAndreas Gohr <?php //bad and dirty event insert hook 1121*88e6a4f2SAndreas Gohr $evdata = array('writable' => $wr); 1122*88e6a4f2SAndreas Gohr trigger_event('HTML_EDITFORM_INJECTION', $evdata); 1123*88e6a4f2SAndreas Gohr ?> 1124*88e6a4f2SAndreas Gohr 112524a33b42SAndreas Gohr <div id="wiki__editbar"> 112624a33b42SAndreas Gohr <div id="size__ctl"></div> 11274da078a3Smatthiasgrimm <?php if($wr){?> 1128fa24fadbSAnika Henke <div class="editButtons"> 112918829381SAndreas 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" /> 113018829381SAndreas 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" /> 113142c7abd6SAndreas Gohr <input class="button" type="submit" name="do[draftdel]" value="<?php echo $lang['btn_cancel']?>" tabindex="6" /> 1132fa24fadbSAnika Henke </div> 11334da078a3Smatthiasgrimm <?php } ?> 11344da078a3Smatthiasgrimm <?php if($wr){ ?> 1135fa24fadbSAnika Henke <div class="summary"> 113624a33b42SAndreas Gohr <label for="edit__summary" class="nowrap"><?php echo $lang['summary']?>:</label> 113724a33b42SAndreas Gohr <input type="text" class="edit" name="summary" id="edit__summary" size="50" value="<?php echo formText($SUM)?>" tabindex="2" /> 1138b6912aeaSAndreas Gohr <?php html_minoredit()?> 1139fa24fadbSAnika Henke </div> 11404da078a3Smatthiasgrimm <?php }?> 114163afe2a6SAnika Henke </div> 114242c7abd6SAndreas Gohr </form> 114363afe2a6SAnika Henke </div> 11444da078a3Smatthiasgrimm<?php 1145f3f0262cSandi} 1146f3f0262cSandi 1147f3f0262cSandi/** 1148b6912aeaSAndreas Gohr * Adds a checkbox for minor edits for logged in users 1149b6912aeaSAndreas Gohr * 1150b6912aeaSAndreas Gohr * @author Andrea Gohr <andi@splitbrain.org> 1151b6912aeaSAndreas Gohr */ 1152b6912aeaSAndreas Gohrfunction html_minoredit(){ 1153b6912aeaSAndreas Gohr global $conf; 1154b6912aeaSAndreas Gohr global $lang; 1155b6912aeaSAndreas Gohr // minor edits are for logged in users only 1156b6912aeaSAndreas Gohr if(!$conf['useacl'] || !$_SERVER['REMOTE_USER']){ 1157b6912aeaSAndreas Gohr return; 1158b6912aeaSAndreas Gohr } 1159b6912aeaSAndreas Gohr 1160b6912aeaSAndreas Gohr $p = array(); 1161b6912aeaSAndreas Gohr $p['name'] = 'minor'; 1162b6912aeaSAndreas Gohr $p['type'] = 'checkbox'; 1163b6912aeaSAndreas Gohr $p['id'] = 'minoredit'; 1164b6912aeaSAndreas Gohr $p['tabindex'] = 3; 1165b6912aeaSAndreas Gohr $p['value'] = '1'; 1166bb4866bdSchris if(!empty($_REQUEST['minor'])) $p['checked']='checked'; 1167b6912aeaSAndreas Gohr $att = buildAttributes($p); 1168b6912aeaSAndreas Gohr 1169fa24fadbSAnika Henke print '<span class="nowrap">'; 1170b6912aeaSAndreas Gohr print "<input $att />"; 1171b6912aeaSAndreas Gohr print '<label for="minoredit">'; 1172b6912aeaSAndreas Gohr print $lang['minoredit']; 1173b6912aeaSAndreas Gohr print '</label>'; 1174fa24fadbSAnika Henke print '</span>'; 1175b6912aeaSAndreas Gohr} 1176b6912aeaSAndreas Gohr 1177b6912aeaSAndreas Gohr/** 1178f3f0262cSandi * prints some debug info 117915fae107Sandi * 118015fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 1181f3f0262cSandi */ 1182f3f0262cSandifunction html_debug(){ 1183f3f0262cSandi global $conf; 1184d16a4edaSandi global $lang; 11855298a619SAndreas Gohr global $auth; 1186100a97e3SAndreas Gohr global $INFO; 1187100a97e3SAndreas Gohr 118828fb55ffSandi //remove sensitive data 118928fb55ffSandi $cnf = $conf; 119028fb55ffSandi $cnf['auth']='***'; 119128fb55ffSandi $cnf['notify']='***'; 11923dc3a5f1Sandi $cnf['ftp']='***'; 1193100a97e3SAndreas Gohr $nfo = $INFO; 1194100a97e3SAndreas Gohr $nfo['userinfo'] = '***'; 1195100a97e3SAndreas Gohr $ses = $_SESSION; 1196100a97e3SAndreas Gohr $ses[$conf['title']]['auth'] = '***'; 1197f3f0262cSandi 1198f3f0262cSandi print '<html><body>'; 1199f3f0262cSandi 1200f3f0262cSandi print '<p>When reporting bugs please send all the following '; 1201f3f0262cSandi print 'output as a mail to andi@splitbrain.org '; 1202f3f0262cSandi print 'The best way to do this is to save this page in your browser</p>'; 1203f3f0262cSandi 1204100a97e3SAndreas Gohr print '<b>$INFO:</b><pre>'; 1205100a97e3SAndreas Gohr print_r($nfo); 1206100a97e3SAndreas Gohr print '</pre>'; 1207100a97e3SAndreas Gohr 1208f3f0262cSandi print '<b>$_SERVER:</b><pre>'; 1209f3f0262cSandi print_r($_SERVER); 1210f3f0262cSandi print '</pre>'; 1211f3f0262cSandi 1212f3f0262cSandi print '<b>$conf:</b><pre>'; 121328fb55ffSandi print_r($cnf); 1214f3f0262cSandi print '</pre>'; 1215f3f0262cSandi 1216ed7b5f09Sandi print '<b>DOKU_BASE:</b><pre>'; 1217ed7b5f09Sandi print DOKU_BASE; 1218f3f0262cSandi print '</pre>'; 1219f3f0262cSandi 1220ed7b5f09Sandi print '<b>abs DOKU_BASE:</b><pre>'; 1221ed7b5f09Sandi print DOKU_URL; 1222ed7b5f09Sandi print '</pre>'; 1223ed7b5f09Sandi 1224ed7b5f09Sandi print '<b>rel DOKU_BASE:</b><pre>'; 1225f3f0262cSandi print dirname($_SERVER['PHP_SELF']).'/'; 1226f3f0262cSandi print '</pre>'; 1227f3f0262cSandi 1228f3f0262cSandi print '<b>PHP Version:</b><pre>'; 1229f3f0262cSandi print phpversion(); 1230f3f0262cSandi print '</pre>'; 1231f3f0262cSandi 1232f3f0262cSandi print '<b>locale:</b><pre>'; 1233f3f0262cSandi print setlocale(LC_ALL,0); 1234f3f0262cSandi print '</pre>'; 1235f3f0262cSandi 1236d16a4edaSandi print '<b>encoding:</b><pre>'; 1237d16a4edaSandi print $lang['encoding']; 1238d16a4edaSandi print '</pre>'; 1239d16a4edaSandi 12405298a619SAndreas Gohr if($auth){ 12415298a619SAndreas Gohr print '<b>Auth backend capabilities:</b><pre>'; 12425298a619SAndreas Gohr print_r($auth->cando); 12435298a619SAndreas Gohr print '</pre>'; 12445298a619SAndreas Gohr } 12455298a619SAndreas Gohr 12463aa54d7cSAndreas Gohr print '<b>$_SESSION:</b><pre>'; 1247100a97e3SAndreas Gohr print_r($ses); 12483aa54d7cSAndreas Gohr print '</pre>'; 12493aa54d7cSAndreas Gohr 1250f3f0262cSandi print '<b>Environment:</b><pre>'; 1251f3f0262cSandi print_r($_ENV); 1252f3f0262cSandi print '</pre>'; 1253f3f0262cSandi 1254f3f0262cSandi print '<b>PHP settings:</b><pre>'; 1255f3f0262cSandi $inis = ini_get_all(); 1256f3f0262cSandi print_r($inis); 1257f3f0262cSandi print '</pre>'; 1258f3f0262cSandi 1259f3f0262cSandi print '</body></html>'; 1260f3f0262cSandi} 1261f3f0262cSandi 1262c19fe9c0Sandifunction html_admin(){ 1263c19fe9c0Sandi global $ID; 1264c19fe9c0Sandi global $lang; 1265ca3a6df1SMatthias Grimm global $conf; 1266c19fe9c0Sandi 1267c112d578Sandi print p_locale_xhtml('admin'); 1268c19fe9c0Sandi 126911e2ce22Schris // build menu of admin functions from the plugins that handle them 127011e2ce22Schris $pluginlist = plugin_list('admin'); 127111e2ce22Schris $menu = array(); 127211e2ce22Schris foreach ($pluginlist as $p) { 127311e2ce22Schris if($obj =& plugin_load('admin',$p) === NULL) continue; 127411e2ce22Schris $menu[] = array('plugin' => $p, 127511e2ce22Schris 'prompt' => $obj->getMenuText($conf['lang']), 127611e2ce22Schris 'sort' => $obj->getMenuSort() 127711e2ce22Schris ); 127811e2ce22Schris } 127911e2ce22Schris 1280746855cfSBen Coburn usort($menu, 'p_sort_modes'); 128111e2ce22Schris 128211e2ce22Schris // output the menu 128311e2ce22Schris ptln('<ul>'); 128411e2ce22Schris 128511e2ce22Schris foreach ($menu as $item) { 128611e2ce22Schris if (!$item['prompt']) continue; 12870c6b58a8SAndreas Gohr ptln(' <li><div class="li"><a href="'.wl($ID, 'do=admin&page='.$item['plugin']).'">'.$item['prompt'].'</a></div></li>'); 128811e2ce22Schris } 128911e2ce22Schris 129011e2ce22Schris ptln('</ul>'); 1291ca3a6df1SMatthias Grimm} 1292c19fe9c0Sandi 12938b06d178Schris/** 12948b06d178Schris * Form to request a new password for an existing account 12958b06d178Schris * 12968b06d178Schris * @author Benoit Chesneau <benoit@bchesneau.info> 129711e2ce22Schris */ 12988b06d178Schrisfunction html_resendpwd() { 12998b06d178Schris global $lang; 13008b06d178Schris global $conf; 13018b06d178Schris global $ID; 1302c19fe9c0Sandi 13038b06d178Schris print p_locale_xhtml('resendpwd'); 13048b06d178Schris?> 130596331712SAnika Henke <div class="centeralign"> 13061dd0c202SAnika Henke <form id="dw__resendpwd" action="<?php echo wl($ID)?>" accept-charset="<?php echo $lang['encoding']?>" method="post"> 13078b06d178Schris <fieldset> 13088b06d178Schris <br /> 1309753d5abfSMatthias Grimm <legend><?php echo $lang['resendpwd']?></legend> 13108b06d178Schris <input type="hidden" name="do" value="resendpwd" /> 13118b06d178Schris <input type="hidden" name="save" value="1" /> 13128b06d178Schris <label class="block"> 13138b06d178Schris <span><?php echo $lang['user']?></span> 13148b06d178Schris <input type="text" name="login" value="<?php echo formText($_POST['login'])?>" class="edit" /><br /><br /> 13158b06d178Schris </label><br /> 13168b06d178Schris <input type="submit" value="<?php echo $lang['btn_resendpwd']?>" class="button" /> 13178b06d178Schris </fieldset> 13188b06d178Schris </form> 13198b06d178Schris </div> 13208b06d178Schris<?php 13218b06d178Schris} 1322340756e4Sandi 1323340756e4Sandi//Setup VIM: ex: et ts=2 enc=utf-8 : 1324