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"> 554da078a3Smatthiasgrimm <form action="<?php echo script()?>" accept-charset="<?php echo $lang['encoding']?>" method="post"> 56f3f0262cSandi <fieldset> 574da078a3Smatthiasgrimm <legend><?php echo $lang['btn_login']?></legend> 584da078a3Smatthiasgrimm <input type="hidden" name="id" value="<?php echo $ID?>" /> 59f3f0262cSandi <input type="hidden" name="do" value="login" /> 60b6912aeaSAndreas Gohr <label class="block"> 614da078a3Smatthiasgrimm <span><?php echo $lang['user']?></span> 624da078a3Smatthiasgrimm <input type="text" name="u" value="<?php echo formText($_REQUEST['u'])?>" class="edit" /> 63f3f0262cSandi </label><br /> 64b6912aeaSAndreas Gohr <label class="block"> 654da078a3Smatthiasgrimm <span><?php echo $lang['pass']?></span> 66f3f0262cSandi <input type="password" name="p" class="edit" /> 67f3f0262cSandi </label><br /> 684da078a3Smatthiasgrimm <input type="submit" value="<?php echo $lang['btn_login']?>" class="button" /> 690c1887a0SAndreas Gohr <label for="remember__me" class="simple"> 704d6f545eSAndreas Gohr <input type="checkbox" name="r" id="remember__me" value="1" /> 714da078a3Smatthiasgrimm <span><?php echo $lang['remember']?></span> 72132bdbfeSandi </label> 73f3f0262cSandi </fieldset> 74f3f0262cSandi </form> 754da078a3Smatthiasgrimm <?php 7682fd59b6SAndreas Gohr if($auth->canDo('addUser') && $conf['openregister']){ 77f3f0262cSandi print '<p>'; 78f3f0262cSandi print $lang['reghere']; 79f3f0262cSandi print ': <a href="'.wl($ID,'do=register').'" class="wikilink1">'.$lang['register'].'</a>'; 80f3f0262cSandi print '</p>'; 81f3f0262cSandi } 828b06d178Schris 8382fd59b6SAndreas Gohr if ($auth->canDo('modPass') && $conf['resendpasswd']) { 848b06d178Schris print '<p>'; 858b06d178Schris print $lang['pwdforget']; 86753d5abfSMatthias Grimm print ': <a href="'.wl($ID,'do=resendpwd').'" class="wikilink1">'.$lang['btn_resendpwd'].'</a>'; 878b06d178Schris print '</p>'; 888b06d178Schris } 89f3f0262cSandi ?> 90f3f0262cSandi </div> 914da078a3Smatthiasgrimm <?php 926bbae538Sandi/* 936bbae538Sandi FIXME provide new hook 94f3f0262cSandi if(@file_exists('includes/login.txt')){ 95f3f0262cSandi print io_cacheParse('includes/login.txt'); 96f3f0262cSandi } 976bbae538Sandi*/ 98f3f0262cSandi} 99f3f0262cSandi 100f3f0262cSandi/** 101ee4c4a1bSAndreas Gohr * shows the edit/source/show/draft button dependent on current mode 10215fae107Sandi * 10315fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 104f3f0262cSandi */ 105f3f0262cSandifunction html_editbutton(){ 106f3f0262cSandi global $ID; 107f3f0262cSandi global $REV; 108f3f0262cSandi global $ACT; 109f3f0262cSandi global $INFO; 110f3f0262cSandi 111f3f0262cSandi if($ACT == 'show' || $ACT == 'search'){ 112f3f0262cSandi if($INFO['writable']){ 113ee4c4a1bSAndreas Gohr if($INFO['draft']){ 114ee4c4a1bSAndreas Gohr $r = html_btn('draft',$ID,'e',array('do' => 'draft'),'post'); 115ee4c4a1bSAndreas Gohr }else{ 116f3f0262cSandi if($INFO['exists']){ 117f3f0262cSandi $r = html_btn('edit',$ID,'e',array('do' => 'edit','rev' => $REV),'post'); 118f3f0262cSandi }else{ 119f3f0262cSandi $r = html_btn('create',$ID,'e',array('do' => 'edit','rev' => $REV),'post'); 120f3f0262cSandi } 121ee4c4a1bSAndreas Gohr } 122f3f0262cSandi }else{ 123f3f0262cSandi $r = html_btn('source',$ID,'v',array('do' => 'edit','rev' => $REV),'post'); 124f3f0262cSandi } 125f3f0262cSandi }else{ 126f3f0262cSandi $r = html_btn('show',$ID,'v',array('do' => 'show')); 127f3f0262cSandi } 128f3f0262cSandi return $r; 129f3f0262cSandi} 130f3f0262cSandi 13115fae107Sandi/** 13215fae107Sandi * prints a section editing button 133*35dae8b0SBen Coburn * used as a callback in html_secedit 13415fae107Sandi * 13515fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 13615fae107Sandi */ 137*35dae8b0SBen Coburnfunction html_secedit_button($matches){ 138f3f0262cSandi global $ID; 139f3f0262cSandi global $lang; 140f3f0262cSandi $secedit = ''; 141f3f0262cSandi $secedit .= '<div class="secedit">'; 142f3f0262cSandi $secedit .= html_btn('secedit',$ID,'', 143f3f0262cSandi array('do' => 'edit', 144306b2c85SDenis Simakov 'lines' => "$section", 145306b2c85SDenis Simakov 'rev' => $INFO['lastmod']), 146*35dae8b0SBen Coburn 'post', $name); 147f3f0262cSandi $secedit .= '</div>'; 148f3f0262cSandi return $secedit; 149f3f0262cSandi} 150f3f0262cSandi 15115fae107Sandi/** 15215fae107Sandi * inserts section edit buttons if wanted or removes the markers 15315fae107Sandi * 15415fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 15515fae107Sandi */ 156f3f0262cSandifunction html_secedit($text,$show=true){ 157f3f0262cSandi global $INFO; 158*35dae8b0SBen Coburn 159c112d578Sandi if($INFO['writable'] && $show && !$INFO['rev']){ 160*35dae8b0SBen Coburn $text = preg_replace_callback('#<!-- SECTION "(.*?)" \[(\d+-\d*)\] -->#', 161*35dae8b0SBen Coburn 'html_secedit_button', $text); 162f3f0262cSandi }else{ 163*35dae8b0SBen Coburn $text = preg_replace('#<!-- SECTION "(.*?)" \[(\d+-\d*)\] -->#','',$text); 164f3f0262cSandi } 165*35dae8b0SBen Coburn 166f3f0262cSandi return $text; 167f3f0262cSandi} 168f3f0262cSandi 169f3f0262cSandi/** 170d6c9c552Smatthiasgrimm * Just the back to top button (in its own form) 1716b13307fSandi * 1726b13307fSandi * @author Andreas Gohr <andi@splitbrain.org> 1736b13307fSandi */ 1746b13307fSandifunction html_topbtn(){ 1756b13307fSandi global $lang; 1766b13307fSandi 1776b13307fSandi $ret = ''; 1780e99f6d7SBen Coburn $ret = '<a class="nolink" href="#dokuwiki__top"><input type="button" class="button" value="'.$lang['btn_top'].'" onclick="window.scrollTo(0, 0)" /></a>'; 179df7b6005Sandi 1806b13307fSandi return $ret; 1816b13307fSandi} 1826b13307fSandi 1836b13307fSandi/** 184d67ca2c0Smatthiasgrimm * Just the back to media window button in its own form 185d67ca2c0Smatthiasgrimm * 186d67ca2c0Smatthiasgrimm * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net> 187d67ca2c0Smatthiasgrimm */ 188d67ca2c0Smatthiasgrimmfunction html_backtomedia_button($params,$akey=''){ 189d67ca2c0Smatthiasgrimm global $conf; 190d67ca2c0Smatthiasgrimm global $lang; 191d67ca2c0Smatthiasgrimm 1923df72098SAndreas Gohr $ret = '<form class="button" method="get" action="'.DOKU_BASE.'lib/exe/mediamanager.php"><div class="no">'; 193d67ca2c0Smatthiasgrimm 194d67ca2c0Smatthiasgrimm reset($params); 195d67ca2c0Smatthiasgrimm while (list($key, $val) = each($params)) { 196d67ca2c0Smatthiasgrimm $ret .= '<input type="hidden" name="'.$key.'" '; 197d67ca2c0Smatthiasgrimm $ret .= 'value="'.htmlspecialchars($val).'" />'; 198d67ca2c0Smatthiasgrimm } 199d67ca2c0Smatthiasgrimm 200d67ca2c0Smatthiasgrimm $ret .= '<input type="submit" value="'.htmlspecialchars($lang['btn_backtomedia']).'" class="button" '; 201d67ca2c0Smatthiasgrimm if($akey){ 202d67ca2c0Smatthiasgrimm $ret .= 'title="ALT+'.strtoupper($akey).'" '; 203d67ca2c0Smatthiasgrimm $ret .= 'accesskey="'.$akey.'" '; 204d67ca2c0Smatthiasgrimm } 205d67ca2c0Smatthiasgrimm $ret .= '/>'; 2064beabca9SAnika Henke $ret .= '</div></form>'; 207d67ca2c0Smatthiasgrimm 208d67ca2c0Smatthiasgrimm return $ret; 209d67ca2c0Smatthiasgrimm} 210d67ca2c0Smatthiasgrimm 211d67ca2c0Smatthiasgrimm/** 212d67ca2c0Smatthiasgrimm * Displays a button (using its own form) 213*35dae8b0SBen Coburn * If tooltip exists, the access key tooltip is replaced. 21415fae107Sandi * 21515fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 216f3f0262cSandi */ 217*35dae8b0SBen Coburnfunction html_btn($name,$id,$akey,$params,$method='get',$tooltip=''){ 218f3f0262cSandi global $conf; 219f3f0262cSandi global $lang; 220f3f0262cSandi 221f3f0262cSandi $label = $lang['btn_'.$name]; 222f3f0262cSandi 223f3f0262cSandi $ret = ''; 224*35dae8b0SBen Coburn $tip = ''; 225f3f0262cSandi 22649c713a3Sandi //filter id (without urlencoding) 22749c713a3Sandi $id = idfilter($id,false); 228f3f0262cSandi 229f3f0262cSandi //make nice URLs even for buttons 2306c7843b5Sandi if($conf['userewrite'] == 2){ 2316c7843b5Sandi $script = DOKU_BASE.DOKU_SCRIPT.'/'.$id; 2326c7843b5Sandi }elseif($conf['userewrite']){ 2336c7843b5Sandi $script = DOKU_BASE.$id; 2346c7843b5Sandi }else{ 2358b00ebcfSandi $script = DOKU_BASE.DOKU_SCRIPT; 236f3f0262cSandi $params['id'] = $id; 237f3f0262cSandi } 238f3f0262cSandi 2394beabca9SAnika Henke $ret .= '<form class="button" method="'.$method.'" action="'.$script.'"><div class="no">'; 240f3f0262cSandi 24106a4bf8fSAndreas Gohr if(is_array($params)){ 242f3f0262cSandi reset($params); 243f3f0262cSandi while (list($key, $val) = each($params)) { 244f3f0262cSandi $ret .= '<input type="hidden" name="'.$key.'" '; 245f3f0262cSandi $ret .= 'value="'.htmlspecialchars($val).'" />'; 246f3f0262cSandi } 24706a4bf8fSAndreas Gohr } 248f3f0262cSandi 249f3f0262cSandi $ret .= '<input type="submit" value="'.htmlspecialchars($label).'" class="button" '; 250f3f0262cSandi if($akey){ 251*35dae8b0SBen Coburn $tip = '[ALT+'.strtoupper($akey).']'; 252f3f0262cSandi $ret .= 'accesskey="'.$akey.'" '; 253f3f0262cSandi } 254*35dae8b0SBen Coburn if ($tooltip!='') { 255*35dae8b0SBen Coburn $tip = htmlspecialchars($tooltip); 256*35dae8b0SBen Coburn } 257*35dae8b0SBen Coburn $ret .= 'title="'.$tip.'" '; 258f3f0262cSandi $ret .= '/>'; 2594beabca9SAnika Henke $ret .= '</div></form>'; 260f3f0262cSandi 261f3f0262cSandi return $ret; 262f3f0262cSandi} 263f3f0262cSandi 264f3f0262cSandi/** 26515fae107Sandi * show a wiki page 26615fae107Sandi * 26715fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 26815fae107Sandi */ 2696bbae538Sandifunction html_show($txt=''){ 270f3f0262cSandi global $ID; 271f3f0262cSandi global $REV; 272f3f0262cSandi global $HIGH; 273f3f0262cSandi //disable section editing for old revisions or in preview 2745400331dSandi if($txt || $REV){ 2756bbae538Sandi $secedit = false; 2766bbae538Sandi }else{ 2776bbae538Sandi $secedit = true; 278f3f0262cSandi } 279f3f0262cSandi 2806bbae538Sandi if ($txt){ 281f3f0262cSandi //PreviewHeader 28250835be7SAndreas Gohr print '<br id="scroll__here" />'; 283c112d578Sandi print p_locale_xhtml('preview'); 284f3f0262cSandi print '<div class="preview">'; 2859dc2c2afSandi print html_secedit(p_render('xhtml',p_get_instructions($txt),$info),$secedit); 28646723c19SAndreas Gohr print '<div class="clearer"></div>'; 287f3f0262cSandi print '</div>'; 2886bbae538Sandi 289f3f0262cSandi }else{ 290c112d578Sandi if ($REV) print p_locale_xhtml('showrev'); 291c112d578Sandi $html = p_wiki_xhtml($ID,$REV,true); 2926bbae538Sandi $html = html_secedit($html,$secedit); 293f3f0262cSandi print html_hilight($html,$HIGH); 294f3f0262cSandi } 295f3f0262cSandi} 296f3f0262cSandi 297f3f0262cSandi/** 298ee4c4a1bSAndreas Gohr * ask the user about how to handle an exisiting draft 299ee4c4a1bSAndreas Gohr * 300ee4c4a1bSAndreas Gohr * @author Andreas Gohr <andi@splitbrain.org> 301ee4c4a1bSAndreas Gohr */ 302ee4c4a1bSAndreas Gohrfunction html_draft(){ 303ee4c4a1bSAndreas Gohr global $INFO; 304ee4c4a1bSAndreas Gohr global $ID; 305ee4c4a1bSAndreas Gohr global $lang; 306ee4c4a1bSAndreas Gohr global $conf; 307ee4c4a1bSAndreas Gohr $draft = unserialize(io_readFile($INFO['draft'],false)); 308ee4c4a1bSAndreas Gohr $text = cleanText(con($draft['prefix'],$draft['text'],$draft['suffix'],true)); 309ee4c4a1bSAndreas Gohr 310ee4c4a1bSAndreas Gohr echo p_locale_xhtml('draft'); 311ee4c4a1bSAndreas Gohr ?> 312ee4c4a1bSAndreas Gohr <form id="dw__editform" method="post" action="<?php echo script()?>" 313ee4c4a1bSAndreas Gohr accept-charset="<?php echo $lang['encoding']?>"><div class="no"> 314ee4c4a1bSAndreas Gohr <input type="hidden" name="id" value="<?php echo $ID?>" /> 315ee4c4a1bSAndreas Gohr <input type="hidden" name="date" value="<?php echo $draft['date']?>" /></div> 316ee4c4a1bSAndreas Gohr <textarea name="wikitext" id="wiki__text" readonly="readonly" cols="80" rows="10" class="edit"><?php echo "\n".formText($text)?></textarea> 317ee4c4a1bSAndreas Gohr 318ee4c4a1bSAndreas Gohr <div id="draft__status"><?php echo $lang['draftdate'].' '.date($conf['dformat'],filemtime($INFO['draft']))?></div> 319ee4c4a1bSAndreas Gohr 320ee4c4a1bSAndreas Gohr <input class="button" type="submit" name="do" value="<?php echo $lang['btn_recover']?>" tabindex="1" /> 321ee4c4a1bSAndreas Gohr <input class="button" type="submit" name="do" value="<?php echo $lang['btn_draftdel']?>" tabindex="2" /> 322ee4c4a1bSAndreas Gohr <input class="button" type="submit" name="do" value="<?php echo $lang['btn_cancel']?>" tabindex="3" /> 323ee4c4a1bSAndreas Gohr </form> 324ee4c4a1bSAndreas Gohr <?php 325ee4c4a1bSAndreas Gohr} 326ee4c4a1bSAndreas Gohr 327ee4c4a1bSAndreas Gohr/** 328f3f0262cSandi * Highlights searchqueries in HTML code 32915fae107Sandi * 33015fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 3317209be23SAndreas Gohr * @author Harry Fuecks <hfuecks@gmail.com> 332f3f0262cSandi */ 333f3f0262cSandifunction html_hilight($html,$query){ 3347209be23SAndreas Gohr //split at common delimiters 3359d9c165eSAndreas Gohr $queries = preg_split ('/[\s\'"\\\\`()\]\[?:!\.{};,#+*<>\\/]+/',$query,-1,PREG_SPLIT_NO_EMPTY); 336f3f0262cSandi foreach ($queries as $q){ 337f3f0262cSandi $q = preg_quote($q,'/'); 3387209be23SAndreas Gohr $html = preg_replace_callback("/((<[^>]*)|$q)/i",'html_hilight_callback',$html); 339f3f0262cSandi } 340f3f0262cSandi return $html; 341f3f0262cSandi} 342f3f0262cSandi 343f3f0262cSandi/** 3447209be23SAndreas Gohr * Callback used by html_hilight() 3457209be23SAndreas Gohr * 3467209be23SAndreas Gohr * @author Harry Fuecks <hfuecks@gmail.com> 3477209be23SAndreas Gohr */ 3487209be23SAndreas Gohrfunction html_hilight_callback($m) { 3497209be23SAndreas Gohr $hlight = unslash($m[0]); 3507209be23SAndreas Gohr if ( !isset($m[2])) { 3517209be23SAndreas Gohr $hlight = '<span class="search_hit">'.$hlight.'</span>'; 3527209be23SAndreas Gohr } 3537209be23SAndreas Gohr return $hlight; 3547209be23SAndreas Gohr} 3557209be23SAndreas Gohr 3567209be23SAndreas Gohr/** 35715fae107Sandi * Run a search and display the result 35815fae107Sandi * 35915fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 360f3f0262cSandi */ 361f3f0262cSandifunction html_search(){ 362ed7b5f09Sandi require_once(DOKU_INC.'inc/search.php'); 363506fa893SAndreas Gohr require_once(DOKU_INC.'inc/fulltext.php'); 364f3f0262cSandi global $conf; 365f3f0262cSandi global $QUERY; 366f3f0262cSandi global $ID; 367f3f0262cSandi global $lang; 368f3f0262cSandi 369c112d578Sandi print p_locale_xhtml('searchpage'); 370f3f0262cSandi flush(); 371f3f0262cSandi 372d0ab54f6SMichael Klier chi@chimeric.de //check if search is restricted to namespace 373d0ab54f6SMichael Klier chi@chimeric.de if(preg_match('/([^@]*)@([^@]*)/',$QUERY,$match)) { 374d0ab54f6SMichael Klier chi@chimeric.de $id = cleanID($match[1]); 375d0ab54f6SMichael Klier chi@chimeric.de if(empty($id)) { 376d0ab54f6SMichael Klier chi@chimeric.de print '<div class="nothing">'.$lang['nothingfound'].'</div>'; 377d0ab54f6SMichael Klier chi@chimeric.de flush(); 378d0ab54f6SMichael Klier chi@chimeric.de return; 379d0ab54f6SMichael Klier chi@chimeric.de } 380d0ab54f6SMichael Klier chi@chimeric.de } else { 381d0ab54f6SMichael Klier chi@chimeric.de $id = cleanID($QUERY); 382d0ab54f6SMichael Klier chi@chimeric.de } 383d0ab54f6SMichael Klier chi@chimeric.de 3844d9ff3d5Sandi //show progressbar 3859edac8a8SAndreas Gohr print '<div class="centeralign" id="dw__loading">'; 3864d9ff3d5Sandi print '<br /></div>'; 3879edac8a8SAndreas Gohr print '<script type="text/javascript" charset="utf-8">'; 3889edac8a8SAndreas Gohr print 'showLoadBar("dw__loading");'; 3899edac8a8SAndreas Gohr print '</script>'; 3909edac8a8SAndreas Gohr flush(); 3914d9ff3d5Sandi 392f3f0262cSandi //do quick pagesearch 393f3f0262cSandi $data = array(); 394d0ab54f6SMichael Klier chi@chimeric.de 395d0ab54f6SMichael Klier chi@chimeric.de $data = ft_pageLookup($id); 396f3f0262cSandi if(count($data)){ 397f3f0262cSandi sort($data); 398f3f0262cSandi print '<div class="search_quickresult">'; 3994f732f0eSAnika Henke print '<h3>'.$lang[quickhits].':</h3>'; 4004f732f0eSAnika Henke print '<ul class="search_quickhits">'; 401140c93f3SAnika Henke foreach($data as $id){ 4024f732f0eSAnika Henke print '<li> '; 403506fa893SAndreas Gohr print html_wikilink(':'.$id,$conf['useheading']?NULL:$id); 4044f732f0eSAnika Henke print '</li> '; 405f3f0262cSandi } 406140c93f3SAnika Henke print '</ul> '; 407f3f0262cSandi //clear float (see http://www.complexspiral.com/publications/containing-floats/) 408f3f0262cSandi print '<div class="clearer"> </div>'; 409f3f0262cSandi print '</div>'; 410f3f0262cSandi } 411f3f0262cSandi flush(); 412f3f0262cSandi 413f3f0262cSandi //do fulltext search 414506fa893SAndreas Gohr $data = ft_pageSearch($QUERY,$poswords); 415f3f0262cSandi if(count($data)){ 416506fa893SAndreas Gohr $num = 1; 417506fa893SAndreas Gohr foreach($data as $id => $cnt){ 418f3f0262cSandi print '<div class="search_result">'; 419506fa893SAndreas Gohr print html_wikilink(':'.$id,$conf['useheading']?NULL:$id,$poswords); 420506fa893SAndreas Gohr print ': <span class="search_cnt">'.$cnt.' '.$lang['hits'].'</span><br />'; 421506fa893SAndreas Gohr if($num < 15){ // create snippets for the first number of matches only #FIXME add to conf ? 422506fa893SAndreas Gohr print '<div class="search_snippet">'.ft_snippet($id,$poswords).'</div>'; 423506fa893SAndreas Gohr } 424f3f0262cSandi print '</div>'; 425506fa893SAndreas Gohr flush(); 426506fa893SAndreas Gohr $num++; 427f3f0262cSandi } 428f3f0262cSandi }else{ 429820fa24bSandi print '<div class="nothing">'.$lang['nothingfound'].'</div>'; 430f3f0262cSandi } 4314d9ff3d5Sandi 4324d9ff3d5Sandi //hide progressbar 4334beabca9SAnika Henke print '<script type="text/javascript" charset="utf-8">'; 4349edac8a8SAndreas Gohr print 'hideLoadBar("dw__loading");'; 4354d9ff3d5Sandi print '</script>'; 4369edac8a8SAndreas Gohr flush(); 437f3f0262cSandi} 438f3f0262cSandi 43915fae107Sandi/** 44015fae107Sandi * Display error on locked pages 44115fae107Sandi * 44215fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 44315fae107Sandi */ 444ee20e7d1Sandifunction html_locked(){ 445f3f0262cSandi global $ID; 446f3f0262cSandi global $conf; 447f3f0262cSandi global $lang; 44888f522e9Sandi global $INFO; 449f3f0262cSandi 450f3f0262cSandi $locktime = filemtime(wikiFN($ID).'.lock'); 451f3f0262cSandi $expire = @date($conf['dformat'], $locktime + $conf['locktime'] ); 452f3f0262cSandi $min = round(($conf['locktime'] - (time() - $locktime) )/60); 453f3f0262cSandi 454c112d578Sandi print p_locale_xhtml('locked'); 455f3f0262cSandi print '<ul>'; 4560c6b58a8SAndreas Gohr print '<li><div class="li"><strong>'.$lang['lockedby'].':</strong> '.$INFO['locked'].'</li>'; 4570c6b58a8SAndreas Gohr print '<li><div class="li"><strong>'.$lang['lockexpire'].':</strong> '.$expire.' ('.$min.' min)</div></li>'; 458f3f0262cSandi print '</ul>'; 459f3f0262cSandi} 460f3f0262cSandi 46115fae107Sandi/** 46215fae107Sandi * list old revisions 46315fae107Sandi * 46415fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 46515fae107Sandi */ 466f3f0262cSandifunction html_revisions(){ 467f3f0262cSandi global $ID; 468f3f0262cSandi global $INFO; 469f3f0262cSandi global $conf; 470f3f0262cSandi global $lang; 471f3f0262cSandi $revisions = getRevisions($ID); 472f3f0262cSandi $date = @date($conf['dformat'],$INFO['lastmod']); 473f3f0262cSandi 474c112d578Sandi print p_locale_xhtml('revisions'); 475f3f0262cSandi print '<ul>'; 476f3f0262cSandi if($INFO['exists']){ 477b6912aeaSAndreas Gohr print ($INFO['minor']) ? '<li class="minor">' : '<li>'; 4780c6b58a8SAndreas Gohr print '<div class="li">'; 479f9b2fe70Sandi 480f9b2fe70Sandi print $date; 481f9b2fe70Sandi 48202e51121SAnika Henke print ' <img src="'.DOKU_BASE.'lib/images/blank.gif" width="15" height="11" alt="" /> '; 483cffcc403Sandi 484f9b2fe70Sandi print '<a class="wikilink1" href="'.wl($ID).'">'.$ID.'</a> '; 485652610a2Sandi 486652610a2Sandi print $INFO['sum']; 48788f522e9Sandi print ' <span class="user">'; 48888f522e9Sandi print $INFO['editor']; 48988f522e9Sandi print '</span> '; 490652610a2Sandi 491652610a2Sandi print '('.$lang['current'].')'; 4920c6b58a8SAndreas Gohr print '</div>'; 493652610a2Sandi print '</li>'; 494f3f0262cSandi } 495f3f0262cSandi 496f3f0262cSandi foreach($revisions as $rev){ 497f3f0262cSandi $date = date($conf['dformat'],$rev); 498fb53bfe2SBen Coburn $info = getRevisionInfo($ID,$rev,true); 499652610a2Sandi 500b6912aeaSAndreas Gohr print ($info['minor']) ? '<li class="minor">' : '<li>'; 5010c6b58a8SAndreas Gohr print '<div class="li">'; 502f9b2fe70Sandi print $date; 503f9b2fe70Sandi 504cffcc403Sandi print ' <a href="'.wl($ID,"rev=$rev,do=diff").'">'; 505d94f4568SAndreas Gohr $p = array(); 506d94f4568SAndreas Gohr $p['src'] = DOKU_BASE.'lib/images/diff.png'; 507d94f4568SAndreas Gohr $p['width'] = 15; 508d94f4568SAndreas Gohr $p['height'] = 11; 509d94f4568SAndreas Gohr $p['title'] = $lang['diff']; 510d94f4568SAndreas Gohr $p['alt'] = $lang['diff']; 511d94f4568SAndreas Gohr $att = buildAttributes($p); 512d94f4568SAndreas Gohr print "<img $att />"; 513cffcc403Sandi print '</a> '; 514cffcc403Sandi 515f9b2fe70Sandi print '<a class="wikilink1" href="'.wl($ID,"rev=$rev").'">'.$ID.'</a> '; 516f9b2fe70Sandi 517f243a77fSandi print htmlspecialchars($info['sum']); 51888f522e9Sandi print ' <span class="user">'; 51988f522e9Sandi if($info['user']){ 52088f522e9Sandi print $info['user']; 52188f522e9Sandi }else{ 522652610a2Sandi print $info['ip']; 52388f522e9Sandi } 52488f522e9Sandi print '</span>'; 525652610a2Sandi 5260c6b58a8SAndreas Gohr print '</div>'; 527f3f0262cSandi print '</li>'; 528f3f0262cSandi } 529f3f0262cSandi print '</ul>'; 530f3f0262cSandi} 531f3f0262cSandi 53215fae107Sandi/** 53315fae107Sandi * display recent changes 53415fae107Sandi * 53515fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 5365749f1ceSmatthiasgrimm * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net> 53715fae107Sandi */ 538a39955b0Smatthiasgrimmfunction html_recent($first=0){ 539f3f0262cSandi global $conf; 540cffcc403Sandi global $lang; 541dbb00abcSEsther Brunner global $ID; 5425749f1ceSmatthiasgrimm /* we need to get one additionally log entry to be able to 5435749f1ceSmatthiasgrimm * decide if this is the last page or is there another one. 5445749f1ceSmatthiasgrimm * This is the cheapest solution to get this information. 5455749f1ceSmatthiasgrimm */ 546b6912aeaSAndreas Gohr $recents = getRecents($first,$conf['recent'] + 1,getNS($ID)); 5475749f1ceSmatthiasgrimm if(count($recents) == 0 && $first != 0){ 5485749f1ceSmatthiasgrimm $first=0; 549b6912aeaSAndreas Gohr $recents = getRecents(0,$conf['recent'] + 1,getNS($ID)); 5505749f1ceSmatthiasgrimm } 5515749f1ceSmatthiasgrimm $cnt = count($recents) <= $conf['recent'] ? count($recents) : $conf['recent']; 552f3f0262cSandi 553c112d578Sandi print p_locale_xhtml('recent'); 554f3f0262cSandi print '<ul>'; 555a39955b0Smatthiasgrimm 556d437bcc4SAndreas Gohr foreach($recents as $recent){ 557d437bcc4SAndreas Gohr $date = date($conf['dformat'],$recent['date']); 558b6912aeaSAndreas Gohr print ($recent['minor']) ? '<li class="minor">' : '<li>'; 5590c6b58a8SAndreas Gohr print '<div class="li">'; 560cffcc403Sandi 561f9b2fe70Sandi print $date.' '; 562f9b2fe70Sandi 563d437bcc4SAndreas Gohr print '<a href="'.wl($recent['id'],"do=diff").'">'; 564d94f4568SAndreas Gohr $p = array(); 565d94f4568SAndreas Gohr $p['src'] = DOKU_BASE.'lib/images/diff.png'; 566d94f4568SAndreas Gohr $p['width'] = 15; 567d94f4568SAndreas Gohr $p['height'] = 11; 568d94f4568SAndreas Gohr $p['title'] = $lang['diff']; 569d94f4568SAndreas Gohr $p['alt'] = $lang['diff']; 570d94f4568SAndreas Gohr $att = buildAttributes($p); 571d94f4568SAndreas Gohr print "<img $att />"; 572cffcc403Sandi print '</a> '; 573cffcc403Sandi 574d437bcc4SAndreas Gohr print '<a href="'.wl($recent['id'],"do=revisions").'">'; 575d94f4568SAndreas Gohr $p = array(); 576d94f4568SAndreas Gohr $p['src'] = DOKU_BASE.'lib/images/history.png'; 577d94f4568SAndreas Gohr $p['width'] = 12; 578d94f4568SAndreas Gohr $p['height'] = 14; 579d94f4568SAndreas Gohr $p['title'] = $lang['btn_revs']; 580d94f4568SAndreas Gohr $p['alt'] = $lang['btn_revs']; 581d94f4568SAndreas Gohr $att = buildAttributes($p); 582d94f4568SAndreas Gohr print "<img $att />"; 583cffcc403Sandi print '</a> '; 584cffcc403Sandi 585d437bcc4SAndreas Gohr print html_wikilink(':'.$recent['id'],$conf['useheading']?NULL:$recent['id']); 586d437bcc4SAndreas Gohr print ' '.htmlspecialchars($recent['sum']); 587b6912aeaSAndreas Gohr 58888f522e9Sandi print ' <span class="user">'; 589d437bcc4SAndreas Gohr if($recent['user']){ 590d437bcc4SAndreas Gohr print $recent['user']; 59188f522e9Sandi }else{ 592d437bcc4SAndreas Gohr print $recent['ip']; 59388f522e9Sandi } 59488f522e9Sandi print '</span>'; 595cffcc403Sandi 5960c6b58a8SAndreas Gohr print '</div>'; 597f3f0262cSandi print '</li>'; 598f3f0262cSandi } 599f3f0262cSandi print '</ul>'; 600a39955b0Smatthiasgrimm 601a39955b0Smatthiasgrimm print '<div class="pagenav">'; 6025749f1ceSmatthiasgrimm $last = $first + $conf['recent']; 603a39955b0Smatthiasgrimm if ($first > 0) { 604a39955b0Smatthiasgrimm $first -= $conf['recent']; 605a39955b0Smatthiasgrimm if ($first < 0) $first = 0; 606a39955b0Smatthiasgrimm print '<div class="pagenav-prev">'; 6075749f1ceSmatthiasgrimm print html_btn('newer','',"p",array('do' => 'recent', 'first' => $first)); 608a39955b0Smatthiasgrimm print '</div>'; 609a39955b0Smatthiasgrimm } 6105749f1ceSmatthiasgrimm if ($conf['recent'] < count($recents)) { 611a39955b0Smatthiasgrimm print '<div class="pagenav-next">'; 6125749f1ceSmatthiasgrimm print html_btn('older','',"n",array('do' => 'recent', 'first' => $last)); 613a39955b0Smatthiasgrimm print '</div>'; 614a39955b0Smatthiasgrimm } 615a39955b0Smatthiasgrimm print '</div>'; 616f3f0262cSandi} 617f3f0262cSandi 61815fae107Sandi/** 61915fae107Sandi * Display page index 62015fae107Sandi * 62115fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 62215fae107Sandi */ 623f3f0262cSandifunction html_index($ns){ 624ed7b5f09Sandi require_once(DOKU_INC.'inc/search.php'); 625f3f0262cSandi global $conf; 626f3f0262cSandi global $ID; 627f3f0262cSandi $dir = $conf['datadir']; 628f3f0262cSandi $ns = cleanID($ns); 62930f1737dSandi #fixme use appropriate function 630f3f0262cSandi if(empty($ns)){ 631f3f0262cSandi $ns = dirname(str_replace(':','/',$ID)); 632f3f0262cSandi if($ns == '.') $ns =''; 633f3f0262cSandi } 63488d3a917Sandi $ns = utf8_encodeFN(str_replace(':','/',$ns)); 635f3f0262cSandi 636c112d578Sandi print p_locale_xhtml('index'); 637f3f0262cSandi 638f3f0262cSandi $data = array(); 639f3f0262cSandi search($data,$conf['datadir'],'search_index',array('ns' => $ns)); 640cb70c441Sandi print html_buildlist($data,'idx','html_list_index','html_li_index'); 641f3f0262cSandi} 642f3f0262cSandi 643f3f0262cSandi/** 64415fae107Sandi * Index item formatter 64515fae107Sandi * 646f3f0262cSandi * User function for html_buildlist() 64715fae107Sandi * 64815fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 649f3f0262cSandi */ 650f3f0262cSandifunction html_list_index($item){ 651f3f0262cSandi $ret = ''; 652f3f0262cSandi $base = ':'.$item['id']; 653f3f0262cSandi $base = substr($base,strrpos($base,':')+1); 654f3f0262cSandi if($item['type']=='d'){ 655f3f0262cSandi $ret .= '<a href="'.wl($ID,'idx='.$item['id']).'" class="idx_dir">'; 656f3f0262cSandi $ret .= $base; 657f3f0262cSandi $ret .= '</a>'; 658f3f0262cSandi }else{ 659f3f0262cSandi $ret .= html_wikilink(':'.$item['id']); 660f3f0262cSandi } 661f3f0262cSandi return $ret; 662f3f0262cSandi} 663f3f0262cSandi 664f3f0262cSandi/** 665cb70c441Sandi * Index List item 666cb70c441Sandi * 667cb70c441Sandi * This user function is used in html_build_lidt to build the 668cb70c441Sandi * <li> tags for namespaces when displaying the page index 669cb70c441Sandi * it gives different classes to opened or closed "folders" 670cb70c441Sandi * 671cb70c441Sandi * @author Andreas Gohr <andi@splitbrain.org> 672cb70c441Sandi */ 673cb70c441Sandifunction html_li_index($item){ 674cb70c441Sandi if($item['type'] == "f"){ 675cb70c441Sandi return '<li class="level'.$item['level'].'">'; 676cb70c441Sandi }elseif($item['open']){ 677cb70c441Sandi return '<li class="open">'; 678cb70c441Sandi }else{ 679cb70c441Sandi return '<li class="closed">'; 680cb70c441Sandi } 681cb70c441Sandi} 682cb70c441Sandi 683cb70c441Sandi/** 684cb70c441Sandi * Default List item 685cb70c441Sandi * 686cb70c441Sandi * @author Andreas Gohr <andi@splitbrain.org> 687cb70c441Sandi */ 688cb70c441Sandifunction html_li_default($item){ 689cb70c441Sandi return '<li class="level'.$item['level'].'">'; 690cb70c441Sandi} 691cb70c441Sandi 692cb70c441Sandi/** 69315fae107Sandi * Build an unordered list 69415fae107Sandi * 695f3f0262cSandi * Build an unordered list from the given $data array 696f3f0262cSandi * Each item in the array has to have a 'level' property 697f3f0262cSandi * the item itself gets printed by the given $func user 698cb70c441Sandi * function. The second and optional function is used to 699cb70c441Sandi * print the <li> tag. Both user function need to accept 700cb70c441Sandi * a single item. 70115fae107Sandi * 702c5a8fd96SAndreas Gohr * Both user functions can be given as array to point to 703c5a8fd96SAndreas Gohr * a member of an object. 704c5a8fd96SAndreas Gohr * 70515fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 706f3f0262cSandi */ 707cb70c441Sandifunction html_buildlist($data,$class,$func,$lifunc='html_li_default'){ 708f3f0262cSandi $level = 0; 709f3f0262cSandi $opens = 0; 710f3f0262cSandi $ret = ''; 711f3f0262cSandi 712f3f0262cSandi foreach ($data as $item){ 713f3f0262cSandi 714f3f0262cSandi if( $item['level'] > $level ){ 715f3f0262cSandi //open new list 716df52d0feSandi for($i=0; $i<($item['level'] - $level); $i++){ 717df52d0feSandi if ($i) $ret .= "<li class=\"clear\">\n"; 718f3f0262cSandi $ret .= "\n<ul class=\"$class\">\n"; 719df52d0feSandi } 720f3f0262cSandi }elseif( $item['level'] < $level ){ 721f3f0262cSandi //close last item 722f3f0262cSandi $ret .= "</li>\n"; 723f3f0262cSandi for ($i=0; $i<($level - $item['level']); $i++){ 724f3f0262cSandi //close higher lists 725f3f0262cSandi $ret .= "</ul>\n</li>\n"; 726f3f0262cSandi } 727f3f0262cSandi }else{ 728f3f0262cSandi //close last item 729f3f0262cSandi $ret .= "</li>\n"; 730f3f0262cSandi } 731f3f0262cSandi 732f3f0262cSandi //remember current level 733f3f0262cSandi $level = $item['level']; 734f3f0262cSandi 735f3f0262cSandi //print item 736c5a8fd96SAndreas Gohr if(is_array($lifunc)){ 737c5a8fd96SAndreas Gohr $ret .= $lifunc[0]->$lifunc[1]($item); //user object method 738c5a8fd96SAndreas Gohr }else{ 739cb70c441Sandi $ret .= $lifunc($item); //user function 740c5a8fd96SAndreas Gohr } 7410c6b58a8SAndreas Gohr $ret .= '<div class="li">'; 742c5a8fd96SAndreas Gohr if(is_array($func)){ 743c5a8fd96SAndreas Gohr $ret .= $func[0]->$func[1]($item); //user object method 744c5a8fd96SAndreas Gohr }else{ 745f3f0262cSandi $ret .= $func($item); //user function 746c5a8fd96SAndreas Gohr } 7470c6b58a8SAndreas Gohr $ret .= '</div>'; 748f3f0262cSandi } 749f3f0262cSandi 750f3f0262cSandi //close remaining items and lists 751f3f0262cSandi for ($i=0; $i < $level; $i++){ 752f3f0262cSandi $ret .= "</li></ul>\n"; 753f3f0262cSandi } 754f3f0262cSandi 755f3f0262cSandi return $ret; 756f3f0262cSandi} 757f3f0262cSandi 75815fae107Sandi/** 75915fae107Sandi * display backlinks 76015fae107Sandi * 76115fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 76215fae107Sandi */ 763f3f0262cSandifunction html_backlinks(){ 76454f4c056SAndreas Gohr require_once(DOKU_INC.'inc/fulltext.php'); 765f3f0262cSandi global $ID; 766f3f0262cSandi global $conf; 767f3f0262cSandi 768c112d578Sandi print p_locale_xhtml('backlinks'); 769f3f0262cSandi 77054f4c056SAndreas Gohr $data = ft_backlinks($ID); 771f3f0262cSandi 772f3f0262cSandi print '<ul class="idx">'; 77354f4c056SAndreas Gohr foreach($data as $blink){ 7740c6b58a8SAndreas Gohr print '<li><div class="li">'; 77554f4c056SAndreas Gohr print html_wikilink(':'.$blink,$conf['useheading']?NULL:$blink); 7760c6b58a8SAndreas Gohr print '</div></li>'; 777f3f0262cSandi } 778f3f0262cSandi print '</ul>'; 779f3f0262cSandi} 780f3f0262cSandi 78115fae107Sandi/** 78215fae107Sandi * show diff 78315fae107Sandi * 78415fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 78515fae107Sandi */ 786f3f0262cSandifunction html_diff($text='',$intro=true){ 787ed7b5f09Sandi require_once(DOKU_INC.'inc/DifferenceEngine.php'); 788f3f0262cSandi global $ID; 789f3f0262cSandi global $REV; 790f3f0262cSandi global $lang; 791f3f0262cSandi global $conf; 792f3f0262cSandi if($text){ 793f3f0262cSandi $df = new Diff(split("\n",htmlspecialchars(rawWiki($ID,''))), 794f3f0262cSandi split("\n",htmlspecialchars(cleanText($text)))); 795f3f0262cSandi $left = '<a class="wikilink1" href="'.wl($ID).'">'. 796f3f0262cSandi $ID.' '.date($conf['dformat'],@filemtime(wikiFN($ID))).'</a>'. 797f3f0262cSandi $lang['current']; 798f3f0262cSandi $right = $lang['yours']; 799f3f0262cSandi }else{ 8004d58bd99Sandi if($REV){ 8014d58bd99Sandi $r = $REV; 8024d58bd99Sandi }else{ 8034d58bd99Sandi //use last revision if none given 8044d58bd99Sandi $revs = getRevisions($ID); 8054d58bd99Sandi $r = $revs[0]; 8064d58bd99Sandi } 8074d58bd99Sandi 8084d58bd99Sandi $df = new Diff(split("\n",htmlspecialchars(rawWiki($ID,$r))), 809f3f0262cSandi split("\n",htmlspecialchars(rawWiki($ID,'')))); 8104d58bd99Sandi $left = '<a class="wikilink1" href="'.wl($ID,"rev=$r").'">'. 8114d58bd99Sandi $ID.' '.date($conf['dformat'],$r).'</a>'; 812f3f0262cSandi $right = '<a class="wikilink1" href="'.wl($ID).'">'. 813f3f0262cSandi $ID.' '.date($conf['dformat'],@filemtime(wikiFN($ID))).'</a> '. 814f3f0262cSandi $lang['current']; 815f3f0262cSandi } 816f3f0262cSandi $tdf = new TableDiffFormatter(); 817c112d578Sandi if($intro) print p_locale_xhtml('diff'); 818f3f0262cSandi ?> 819daf4ca4eSAnika Henke <table class="diff"> 820f3f0262cSandi <tr> 821daf4ca4eSAnika Henke <th colspan="2"> 8224da078a3Smatthiasgrimm <?php echo $left?> 823daf4ca4eSAnika Henke </th> 824daf4ca4eSAnika Henke <th colspan="2"> 8254da078a3Smatthiasgrimm <?php echo $right?> 826daf4ca4eSAnika Henke </th> 827f3f0262cSandi </tr> 8284da078a3Smatthiasgrimm <?php echo $tdf->format($df)?> 829f3f0262cSandi </table> 8304da078a3Smatthiasgrimm <?php 831f3f0262cSandi} 832f3f0262cSandi 83315fae107Sandi/** 83415fae107Sandi * show warning on conflict detection 83515fae107Sandi * 83615fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 83715fae107Sandi */ 838f3f0262cSandifunction html_conflict($text,$summary){ 839f3f0262cSandi global $ID; 840f3f0262cSandi global $lang; 841f3f0262cSandi 842c112d578Sandi print p_locale_xhtml('conflict'); 843f3f0262cSandi ?> 8441dd0c202SAnika Henke <form id="dw__editform" method="post" action="<?php echo script()?>" accept-charset="<?php echo $lang['encoding']?>"> 84596331712SAnika Henke <div class="centeralign"> 8464da078a3Smatthiasgrimm <input type="hidden" name="id" value="<?php echo $ID?>" /> 8474da078a3Smatthiasgrimm <input type="hidden" name="wikitext" value="<?php echo formText($text)?>" /> 8484da078a3Smatthiasgrimm <input type="hidden" name="summary" value="<?php echo formText($summary)?>" /> 849f3f0262cSandi 8504da078a3Smatthiasgrimm <input class="button" type="submit" name="do" value="<?php echo $lang['btn_save']?>" accesskey="s" title="[ALT+S]" /> 8514da078a3Smatthiasgrimm <input class="button" type="submit" name="do" value="<?php echo $lang['btn_cancel']?>" /> 852f3f0262cSandi </div> 853f3f0262cSandi </form> 854f3f0262cSandi <br /><br /><br /><br /> 8554da078a3Smatthiasgrimm <?php 856f3f0262cSandi} 857f3f0262cSandi 858f3f0262cSandi/** 85915fae107Sandi * Prints the global message array 86015fae107Sandi * 86115fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 862f3f0262cSandi */ 863f3f0262cSandifunction html_msgarea(){ 864f3f0262cSandi global $MSG; 865f3f0262cSandi 866f3f0262cSandi if(!isset($MSG)) return; 867f3f0262cSandi 868f3f0262cSandi foreach($MSG as $msg){ 869f3f0262cSandi print '<div class="'.$msg['lvl'].'">'; 870f3f0262cSandi print $msg['msg']; 871f3f0262cSandi print '</div>'; 872f3f0262cSandi } 873f3f0262cSandi} 874f3f0262cSandi 875f3f0262cSandi/** 876f3f0262cSandi * Prints the registration form 87715fae107Sandi * 87815fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 879f3f0262cSandi */ 880f3f0262cSandifunction html_register(){ 881f3f0262cSandi global $lang; 882cab2716aSmatthias.grimm global $conf; 883f3f0262cSandi global $ID; 884f3f0262cSandi 885c112d578Sandi print p_locale_xhtml('register'); 886f3f0262cSandi?> 88796331712SAnika Henke <div class="centeralign"> 8881dd0c202SAnika Henke <form id="dw__register" method="post" action="<?php echo wl($ID)?>" accept-charset="<?php echo $lang['encoding']?>"> 88996331712SAnika Henke <fieldset> 890f3f0262cSandi <input type="hidden" name="do" value="register" /> 891f3f0262cSandi <input type="hidden" name="save" value="1" /> 89296331712SAnika Henke 8934da078a3Smatthiasgrimm <legend><?php echo $lang['register']?></legend> 894b6912aeaSAndreas Gohr <label class="block"> 8954da078a3Smatthiasgrimm <?php echo $lang['user']?> 8964da078a3Smatthiasgrimm <input type="text" name="login" class="edit" size="50" value="<?php echo formText($_POST['login'])?>" /> 897f3f0262cSandi </label><br /> 898cab2716aSmatthias.grimm 899cab2716aSmatthias.grimm <?php 900cab2716aSmatthias.grimm if (!$conf['autopasswd']) { 901cab2716aSmatthias.grimm ?> 902b6912aeaSAndreas Gohr <label class="block"> 9034da078a3Smatthiasgrimm <?php echo $lang['pass']?> 904cab2716aSmatthias.grimm <input type="password" name="pass" class="edit" size="50" /> 905cab2716aSmatthias.grimm </label><br /> 906b6912aeaSAndreas Gohr <label class="block"> 9074da078a3Smatthiasgrimm <?php echo $lang['passchk']?> 908cab2716aSmatthias.grimm <input type="password" name="passchk" class="edit" size="50" /> 909cab2716aSmatthias.grimm </label><br /> 910cab2716aSmatthias.grimm <?php 911cab2716aSmatthias.grimm } 912cab2716aSmatthias.grimm ?> 913cab2716aSmatthias.grimm 914b6912aeaSAndreas Gohr <label class="block"> 9154da078a3Smatthiasgrimm <?php echo $lang['fullname']?> 9164da078a3Smatthiasgrimm <input type="text" name="fullname" class="edit" size="50" value="<?php echo formText($_POST['fullname'])?>" /> 917f3f0262cSandi </label><br /> 918b6912aeaSAndreas Gohr <label class="block"> 9194da078a3Smatthiasgrimm <?php echo $lang['email']?> 9204da078a3Smatthiasgrimm <input type="text" name="email" class="edit" size="50" value="<?php echo formText($_POST['email'])?>" /> 921f3f0262cSandi </label><br /> 9224da078a3Smatthiasgrimm <input type="submit" class="button" value="<?php echo $lang['register']?>" /> 923f3f0262cSandi </fieldset> 924f3f0262cSandi </form> 925f3f0262cSandi </div> 9264da078a3Smatthiasgrimm<?php 927f3f0262cSandi} 928f3f0262cSandi 929f3f0262cSandi/** 9308b06d178Schris * Print the update profile form 9318b06d178Schris * 9328b06d178Schris * @author Christopher Smith <chris@jalakai.co.uk> 9338b06d178Schris * @author Andreas Gohr <andi@splitbrain.org> 9348b06d178Schris */ 9358b06d178Schrisfunction html_updateprofile(){ 9368b06d178Schris global $lang; 9378b06d178Schris global $conf; 9388b06d178Schris global $ID; 9398b06d178Schris global $INFO; 94082fd59b6SAndreas Gohr global $auth; 9418b06d178Schris 9428b06d178Schris print p_locale_xhtml('updateprofile'); 9438b06d178Schris 9448b06d178Schris if (empty($_POST['fullname'])) $_POST['fullname'] = $INFO['userinfo']['name']; 9458b06d178Schris if (empty($_POST['email'])) $_POST['email'] = $INFO['userinfo']['mail']; 9468b06d178Schris?> 94796331712SAnika Henke <div class="centeralign"> 9481dd0c202SAnika Henke <form id="dw__register" method="post" action="<?php echo wl($ID)?>" accept-charset="<?php echo $lang['encoding']?>"> 94996331712SAnika Henke <fieldset style="width: 80%;"> 9508b06d178Schris <input type="hidden" name="do" value="profile" /> 9518b06d178Schris <input type="hidden" name="save" value="1" /> 95296331712SAnika Henke 9538b06d178Schris <legend><?php echo $lang['profile']?></legend> 9548b06d178Schris <label class="block"> 9558b06d178Schris <?php echo $lang['user']?> 9568b06d178Schris <input type="text" name="fullname" disabled="disabled" class="edit" size="50" value="<?php echo formText($_SERVER['REMOTE_USER'])?>" /> 9578b06d178Schris </label><br /> 9588b06d178Schris <label class="block"> 9598b06d178Schris <?php echo $lang['fullname']?> 96082fd59b6SAndreas Gohr <input type="text" name="fullname" <?php if(!$auth->canDo('modName')) echo 'disabled="disabled"'?> class="edit" size="50" value="<?php echo formText($_POST['fullname'])?>" /> 9618b06d178Schris </label><br /> 9628b06d178Schris <label class="block"> 9638b06d178Schris <?php echo $lang['email']?> 96482fd59b6SAndreas Gohr <input type="text" name="email" <?php if(!$auth->canDo('modName')) echo 'disabled="disabled"'?> class="edit" size="50" value="<?php echo formText($_POST['email'])?>" /> 9658b06d178Schris </label><br /><br /> 96682fd59b6SAndreas Gohr 96782fd59b6SAndreas Gohr <?php if($auth->canDo('modPass')) { ?> 9688b06d178Schris <label class="block"> 9698b06d178Schris <?php echo $lang['newpass']?> 9708b06d178Schris <input type="password" name="newpass" class="edit" size="50" /> 9718b06d178Schris </label><br /> 9728b06d178Schris <label class="block"> 9738b06d178Schris <?php echo $lang['passchk']?> 9748b06d178Schris <input type="password" name="passchk" class="edit" size="50" /> 9758b06d178Schris </label><br /> 97682fd59b6SAndreas Gohr <?php } ?> 9778b06d178Schris 9788b06d178Schris <?php if ($conf['profileconfirm']) { ?> 9798b06d178Schris <br /> 9808b06d178Schris <label class="block"> 9818b06d178Schris <?php echo $lang['oldpass']?> 9828b06d178Schris <input type="password" name="oldpass" class="edit" size="50" /> 9838b06d178Schris </label><br /> 9848b06d178Schris <?php } ?> 9858b06d178Schris 9864cb79657SMatthias Grimm <input type="submit" class="button" value="<?php echo $lang['btn_save']?>" /> 9878b06d178Schris <input type="reset" class="button" value="<?php echo $lang['btn_reset']?>" /> 9888b06d178Schris </fieldset> 9898b06d178Schris </form> 9908b06d178Schris </div> 9918b06d178Schris<?php 9928b06d178Schris} 9938b06d178Schris 9948b06d178Schris/** 995f3f0262cSandi * This displays the edit form (lots of logic included) 99615fae107Sandi * 9977146cee2SAndreas Gohr * @fixme this is a huge lump of code and should be modularized 99815fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 999f3f0262cSandi */ 1000f3f0262cSandifunction html_edit($text=null,$include='edit'){ //FIXME: include needed? 1001f3f0262cSandi global $ID; 1002f3f0262cSandi global $REV; 1003f3f0262cSandi global $DATE; 1004f3f0262cSandi global $RANGE; 1005f3f0262cSandi global $PRE; 1006f3f0262cSandi global $SUF; 1007f3f0262cSandi global $INFO; 1008f3f0262cSandi global $SUM; 1009f3f0262cSandi global $lang; 1010f3f0262cSandi global $conf; 1011f3f0262cSandi 1012f3f0262cSandi //set summary default 1013f3f0262cSandi if(!$SUM){ 1014f3f0262cSandi if($REV){ 1015f3f0262cSandi $SUM = $lang['restored']; 1016f3f0262cSandi }elseif(!$INFO['exists']){ 1017f3f0262cSandi $SUM = $lang['created']; 1018f3f0262cSandi } 1019f3f0262cSandi } 1020f3f0262cSandi 1021f3f0262cSandi //no text? Load it! 1022f3f0262cSandi if(!isset($text)){ 1023f3f0262cSandi $pr = false; //no preview mode 10247146cee2SAndreas Gohr if($INFO['exists']){ 1025f3f0262cSandi if($RANGE){ 1026f3f0262cSandi list($PRE,$text,$SUF) = rawWikiSlices($RANGE,$ID,$REV); 1027f3f0262cSandi }else{ 1028f3f0262cSandi $text = rawWiki($ID,$REV); 1029f3f0262cSandi } 1030f3f0262cSandi }else{ 10317146cee2SAndreas Gohr //try to load a pagetemplate 10327146cee2SAndreas Gohr $text = pageTemplate($ID); 10337146cee2SAndreas Gohr } 10347146cee2SAndreas Gohr }else{ 1035f3f0262cSandi $pr = true; //preview mode 1036f3f0262cSandi } 1037f3f0262cSandi 1038f3f0262cSandi $wr = $INFO['writable']; 1039f3f0262cSandi if($wr){ 1040c112d578Sandi if ($REV) print p_locale_xhtml('editrev'); 1041c112d578Sandi print p_locale_xhtml($include); 1042f3f0262cSandi }else{ 1043c112d578Sandi print p_locale_xhtml('read'); 1044f3f0262cSandi $ro='readonly="readonly"'; 1045f3f0262cSandi } 1046f3f0262cSandi if(!$DATE) $DATE = $INFO['lastmod']; 1047dc57ef04Sandi 1048dc57ef04Sandi 1049f3f0262cSandi?> 105063afe2a6SAnika Henke <div style="width:99%;"> 105142c7abd6SAndreas Gohr 105263afe2a6SAnika Henke <div class="toolbar"> 1053ee4c4a1bSAndreas Gohr <div id="draft__status"><?php if($INFO['draft']) echo $lang['draftdate'].' '.date($conf['dformat']);?></div> 1054ee379fa4SAndreas Gohr <div id="tool__bar"><a href="<?php echo DOKU_BASE?>lib/exe/mediamanager.php?ns=<?php echo $INFO['namespace']?>" 105572f0e11fSAndreas Gohr target="_blank"><?php echo $lang['mediaselect'] ?></a></div> 105620d062caSAndreas Gohr 10574da078a3Smatthiasgrimm <?php if($wr){?> 10584beabca9SAnika Henke <script type="text/javascript" charset="utf-8"> 10594da078a3Smatthiasgrimm <?php /* sets changed to true when previewed */?> 10604da078a3Smatthiasgrimm textChanged = <?php ($pr) ? print 'true' : print 'false' ?>; 1061f3f0262cSandi </script> 106224a33b42SAndreas Gohr <span id="spell__action"></span> 106324a33b42SAndreas Gohr <div id="spell__suggest"></div> 1064ee4c4a1bSAndreas Gohr <?php } ?> 106563afe2a6SAnika Henke </div> 106624a33b42SAndreas Gohr <div id="spell__result"></div> 106763afe2a6SAnika Henke 106842c7abd6SAndreas Gohr 106942c7abd6SAndreas Gohr <form id="dw__editform" method="post" action="<?php echo script()?>" accept-charset="<?php echo $lang['encoding']?>"><div class="no"> 107042c7abd6SAndreas Gohr <input type="hidden" name="id" value="<?php echo $ID?>" /> 107142c7abd6SAndreas Gohr <input type="hidden" name="rev" value="<?php echo $REV?>" /> 107242c7abd6SAndreas Gohr <input type="hidden" name="date" value="<?php echo $DATE?>" /> 107342c7abd6SAndreas Gohr <input type="hidden" name="prefix" value="<?php echo formText($PRE)?>" /> 107442c7abd6SAndreas Gohr <input type="hidden" name="suffix" value="<?php echo formText($SUF)?>" /> 107542c7abd6SAndreas Gohr </div> 107642c7abd6SAndreas Gohr 107724a33b42SAndreas Gohr <textarea name="wikitext" id="wiki__text" <?php echo $ro?> cols="80" rows="10" class="edit" tabindex="1"><?php echo "\n".formText($text)?></textarea> 107863afe2a6SAnika Henke 107924a33b42SAndreas Gohr <div id="wiki__editbar"> 108024a33b42SAndreas Gohr <div id="size__ctl"></div> 10814da078a3Smatthiasgrimm <?php if($wr){?> 1082fa24fadbSAnika Henke <div class="editButtons"> 108324a33b42SAndreas Gohr <input class="button" id="edbtn__save" type="submit" name="do" value="<?php echo $lang['btn_save']?>" accesskey="s" title="[ALT+S]" tabindex="4" /> 108424a33b42SAndreas Gohr <input class="button" id="edbtn__preview" type="submit" name="do" value="<?php echo $lang['btn_preview']?>" accesskey="p" title="[ALT+P]" tabindex="5" /> 108542c7abd6SAndreas Gohr <input class="button" type="submit" name="do[draftdel]" value="<?php echo $lang['btn_cancel']?>" tabindex="6" /> 1086fa24fadbSAnika Henke </div> 10874da078a3Smatthiasgrimm <?php } ?> 10884da078a3Smatthiasgrimm <?php if($wr){ ?> 1089fa24fadbSAnika Henke <div class="summary"> 109024a33b42SAndreas Gohr <label for="edit__summary" class="nowrap"><?php echo $lang['summary']?>:</label> 109124a33b42SAndreas Gohr <input type="text" class="edit" name="summary" id="edit__summary" size="50" value="<?php echo formText($SUM)?>" tabindex="2" /> 1092b6912aeaSAndreas Gohr <?php html_minoredit()?> 1093fa24fadbSAnika Henke </div> 10944da078a3Smatthiasgrimm <?php }?> 109563afe2a6SAnika Henke </div> 109642c7abd6SAndreas Gohr </form> 109763afe2a6SAnika Henke </div> 10984da078a3Smatthiasgrimm<?php 1099f3f0262cSandi} 1100f3f0262cSandi 1101f3f0262cSandi/** 1102b6912aeaSAndreas Gohr * Adds a checkbox for minor edits for logged in users 1103b6912aeaSAndreas Gohr * 1104b6912aeaSAndreas Gohr * @author Andrea Gohr <andi@splitbrain.org> 1105b6912aeaSAndreas Gohr */ 1106b6912aeaSAndreas Gohrfunction html_minoredit(){ 1107b6912aeaSAndreas Gohr global $conf; 1108b6912aeaSAndreas Gohr global $lang; 1109b6912aeaSAndreas Gohr // minor edits are for logged in users only 1110b6912aeaSAndreas Gohr if(!$conf['useacl'] || !$_SERVER['REMOTE_USER']){ 1111b6912aeaSAndreas Gohr return; 1112b6912aeaSAndreas Gohr } 1113b6912aeaSAndreas Gohr 1114b6912aeaSAndreas Gohr $p = array(); 1115b6912aeaSAndreas Gohr $p['name'] = 'minor'; 1116b6912aeaSAndreas Gohr $p['type'] = 'checkbox'; 1117b6912aeaSAndreas Gohr $p['id'] = 'minoredit'; 1118b6912aeaSAndreas Gohr $p['tabindex'] = 3; 1119b6912aeaSAndreas Gohr $p['value'] = '1'; 1120b6912aeaSAndreas Gohr if($_REQUEST['minor']) $p['checked']='checked'; 1121b6912aeaSAndreas Gohr $att = buildAttributes($p); 1122b6912aeaSAndreas Gohr 1123fa24fadbSAnika Henke print '<span class="nowrap">'; 1124b6912aeaSAndreas Gohr print "<input $att />"; 1125b6912aeaSAndreas Gohr print '<label for="minoredit">'; 1126b6912aeaSAndreas Gohr print $lang['minoredit']; 1127b6912aeaSAndreas Gohr print '</label>'; 1128fa24fadbSAnika Henke print '</span>'; 1129b6912aeaSAndreas Gohr} 1130b6912aeaSAndreas Gohr 1131b6912aeaSAndreas Gohr/** 1132f3f0262cSandi * prints some debug info 113315fae107Sandi * 113415fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 1135f3f0262cSandi */ 1136f3f0262cSandifunction html_debug(){ 1137f3f0262cSandi global $conf; 1138d16a4edaSandi global $lang; 11395298a619SAndreas Gohr global $auth; 114028fb55ffSandi //remove sensitive data 114128fb55ffSandi $cnf = $conf; 114228fb55ffSandi $cnf['auth']='***'; 114328fb55ffSandi $cnf['notify']='***'; 11443dc3a5f1Sandi $cnf['ftp']='***'; 1145f3f0262cSandi 1146f3f0262cSandi print '<html><body>'; 1147f3f0262cSandi 1148f3f0262cSandi print '<p>When reporting bugs please send all the following '; 1149f3f0262cSandi print 'output as a mail to andi@splitbrain.org '; 1150f3f0262cSandi print 'The best way to do this is to save this page in your browser</p>'; 1151f3f0262cSandi 1152f3f0262cSandi print '<b>$_SERVER:</b><pre>'; 1153f3f0262cSandi print_r($_SERVER); 1154f3f0262cSandi print '</pre>'; 1155f3f0262cSandi 1156f3f0262cSandi print '<b>$conf:</b><pre>'; 115728fb55ffSandi print_r($cnf); 1158f3f0262cSandi print '</pre>'; 1159f3f0262cSandi 1160ed7b5f09Sandi print '<b>DOKU_BASE:</b><pre>'; 1161ed7b5f09Sandi print DOKU_BASE; 1162f3f0262cSandi print '</pre>'; 1163f3f0262cSandi 1164ed7b5f09Sandi print '<b>abs DOKU_BASE:</b><pre>'; 1165ed7b5f09Sandi print DOKU_URL; 1166ed7b5f09Sandi print '</pre>'; 1167ed7b5f09Sandi 1168ed7b5f09Sandi print '<b>rel DOKU_BASE:</b><pre>'; 1169f3f0262cSandi print dirname($_SERVER['PHP_SELF']).'/'; 1170f3f0262cSandi print '</pre>'; 1171f3f0262cSandi 1172f3f0262cSandi print '<b>PHP Version:</b><pre>'; 1173f3f0262cSandi print phpversion(); 1174f3f0262cSandi print '</pre>'; 1175f3f0262cSandi 1176f3f0262cSandi print '<b>locale:</b><pre>'; 1177f3f0262cSandi print setlocale(LC_ALL,0); 1178f3f0262cSandi print '</pre>'; 1179f3f0262cSandi 1180d16a4edaSandi print '<b>encoding:</b><pre>'; 1181d16a4edaSandi print $lang['encoding']; 1182d16a4edaSandi print '</pre>'; 1183d16a4edaSandi 11845298a619SAndreas Gohr if($auth){ 11855298a619SAndreas Gohr print '<b>Auth backend capabilities:</b><pre>'; 11865298a619SAndreas Gohr print_r($auth->cando); 11875298a619SAndreas Gohr print '</pre>'; 11885298a619SAndreas Gohr } 11895298a619SAndreas Gohr 11903aa54d7cSAndreas Gohr print '<b>$_SESSION:</b><pre>'; 11913aa54d7cSAndreas Gohr print_r($_SESSION); 11923aa54d7cSAndreas Gohr print '</pre>'; 11933aa54d7cSAndreas Gohr 1194f3f0262cSandi print '<b>Environment:</b><pre>'; 1195f3f0262cSandi print_r($_ENV); 1196f3f0262cSandi print '</pre>'; 1197f3f0262cSandi 1198f3f0262cSandi print '<b>PHP settings:</b><pre>'; 1199f3f0262cSandi $inis = ini_get_all(); 1200f3f0262cSandi print_r($inis); 1201f3f0262cSandi print '</pre>'; 1202f3f0262cSandi 1203f3f0262cSandi print '</body></html>'; 1204f3f0262cSandi} 1205f3f0262cSandi 1206c19fe9c0Sandifunction html_admin(){ 1207c19fe9c0Sandi global $ID; 1208c19fe9c0Sandi global $lang; 1209ca3a6df1SMatthias Grimm global $conf; 1210c19fe9c0Sandi 1211c112d578Sandi print p_locale_xhtml('admin'); 1212c19fe9c0Sandi 121311e2ce22Schris // build menu of admin functions from the plugins that handle them 121411e2ce22Schris $pluginlist = plugin_list('admin'); 121511e2ce22Schris $menu = array(); 121611e2ce22Schris foreach ($pluginlist as $p) { 121711e2ce22Schris if($obj =& plugin_load('admin',$p) === NULL) continue; 121811e2ce22Schris $menu[] = array('plugin' => $p, 121911e2ce22Schris 'prompt' => $obj->getMenuText($conf['lang']), 122011e2ce22Schris 'sort' => $obj->getMenuSort() 122111e2ce22Schris ); 122211e2ce22Schris } 122311e2ce22Schris 122411e2ce22Schris usort($menu, p_sort_modes); 122511e2ce22Schris 122611e2ce22Schris // output the menu 122711e2ce22Schris ptln('<ul>'); 122811e2ce22Schris 122911e2ce22Schris foreach ($menu as $item) { 123011e2ce22Schris if (!$item['prompt']) continue; 12310c6b58a8SAndreas Gohr ptln(' <li><div class="li"><a href="'.wl($ID, 'do=admin&page='.$item['plugin']).'">'.$item['prompt'].'</a></div></li>'); 123211e2ce22Schris } 123311e2ce22Schris 123411e2ce22Schris // add in non-plugin functions 123511e2ce22Schris if (!$conf['openregister']){ 12360c6b58a8SAndreas Gohr ptln('<li><div class="li"><a href="'.wl($ID,'do=register').'">'.$lang['admin_register'].'</a></div></li>'); 123711e2ce22Schris } 123811e2ce22Schris 123911e2ce22Schris ptln('</ul>'); 1240ca3a6df1SMatthias Grimm} 1241c19fe9c0Sandi 12428b06d178Schris/** 12438b06d178Schris * Form to request a new password for an existing account 12448b06d178Schris * 12458b06d178Schris * @author Benoit Chesneau <benoit@bchesneau.info> 124611e2ce22Schris */ 12478b06d178Schrisfunction html_resendpwd() { 12488b06d178Schris global $lang; 12498b06d178Schris global $conf; 12508b06d178Schris global $ID; 1251c19fe9c0Sandi 12528b06d178Schris print p_locale_xhtml('resendpwd'); 12538b06d178Schris?> 125496331712SAnika Henke <div class="centeralign"> 12551dd0c202SAnika Henke <form id="dw__resendpwd" action="<?php echo wl($ID)?>" accept-charset="<?php echo $lang['encoding']?>" method="post"> 12568b06d178Schris <fieldset> 12578b06d178Schris <br /> 1258753d5abfSMatthias Grimm <legend><?php echo $lang['resendpwd']?></legend> 12598b06d178Schris <input type="hidden" name="do" value="resendpwd" /> 12608b06d178Schris <input type="hidden" name="save" value="1" /> 12618b06d178Schris <label class="block"> 12628b06d178Schris <span><?php echo $lang['user']?></span> 12638b06d178Schris <input type="text" name="login" value="<?php echo formText($_POST['login'])?>" class="edit" /><br /><br /> 12648b06d178Schris </label><br /> 12658b06d178Schris <input type="submit" value="<?php echo $lang['btn_resendpwd']?>" class="button" /> 12668b06d178Schris </fieldset> 12678b06d178Schris </form> 12688b06d178Schris </div> 12698b06d178Schris<?php 12708b06d178Schris} 1271340756e4Sandi 1272340756e4Sandi//Setup VIM: ex: et ts=2 enc=utf-8 : 1273