'edit','rev' => $REV),'post'); }else{ $r = html_btn('create',$ID,'e',array('do' => 'edit','rev' => $REV),'post'); } }else{ $r = html_btn('source',$ID,'v',array('do' => 'edit','rev' => $REV),'post'); } }else{ $r = html_btn('show',$ID,'v',array('do' => 'show')); } return $r; } function html_secedit_button($section,$p){ global $ID; global $lang; $secedit = ''; if($p) $secedit .= "

\n"; $secedit .= '
'; $secedit .= html_btn('secedit',$ID,'', array('do' => 'edit', 'lines' => "$section"), 'post'); $secedit .= '
'; if($p) $secedit .= "\n

"; return $secedit; } function html_secedit($text,$show=true){ global $INFO; if($INFO['writable'] && $show){ $text = preg_replace('##e', "html_secedit_button('\\1',true)", $text); $text = preg_replace('##e', "html_secedit_button('\\1',false)", $text); }else{ $text = preg_replace('##e','',$text); } return $text; } /** * displays the breadcrumbs trace */ function html_breadcrumbs(){ global $lang; $crumbs = breadcrumbs(); //setup crumb trace print '

'; } /** * display the HTML head and metadata */ function html_head(){ global $ID; global $ACT; global $INFO; global $conf; global $lang; print '<'.'?xml version="1.0"?'.">\n"; print ''; print "\n"; ?> <?=$ID?> [<?=$conf['title']?>] '."\n"; print ' '."\n"; }else{ print ' '."\n"; } }else{ print ' '."\n"; } ?> '; reset($params); while (list($key, $val) = each($params)) { $ret .= ''; } $ret .= '= $perm) return true; print parsedLocale('denied'); return false; } /** * Displays the page header and calls html_head() */ function html_header(){ global $ID; global $REV; global $lang; global $conf; html_head(); ?>
[[]]
'revisions'))?>
'recent'))?>
'; print $lang['loggedinas'].': '.$_SERVER['REMOTE_USER']; print '
'; } print '   '; if($INFO['exists']){ print $fn; print ' · '; print $lang['lastmod']; print ': '; print $date; if($INFO['locked']){ print ' · '; print $lang['lockedby']; print ': '; print $INFO['locked']; } } ?> '; $ret .= ''.$lang['toc']; $ret .= ' '; $ret .= ''; $ret .= ''; foreach($toc as $t){ $ret .= '
'; $ret .= '·'; $ret .= $t['name']; $ret .= '
'; } $ret .= ''; $ret .= ''; return $ret; } function html_show($text=''){ global $ID; global $REV; global $HIGH; //disable section editing for old revisions or in preview if($text || $REV){ global $parser; $parser['secedit'] = false; } if ($text){ //PreviewHeader print parsedLocale('preview'); print '
'; print html_secedit(parse($text),false); print '
'; }else{ if ($REV) print parsedLocale('showrev'); $html = parsedWiki($ID,$REV,true); $html = html_secedit($html); print html_hilight($html,$HIGH); } } /** * Highlights searchqueries in HTML code */ function html_hilight($html,$query){ $queries = preg_split ("/\s/",$query,-1,PREG_SPLIT_NO_EMPTY); foreach ($queries as $q){ $q = preg_quote($q,'/'); $html = preg_replace("/((<[^>]*)|$q)/ie", '"\2"=="\1"? "\1":"\1"', $html); } return $html; } function html_search(){ require_once("inc/search.php"); global $conf; global $QUERY; global $ID; global $lang; print parsedLocale('searchpage'); flush(); //do quick pagesearch $data = array(); search($data,$conf['datadir'],'search_pagename',array(query => $QUERY)); if(count($data)){ sort($data); print '
'; print ''.$lang[quickhits].':
'; foreach($data as $row){ print '- '; print html_wikilink(':'.$row['id'],$row['id']); print ' '; } print '
'; } flush(); //do fulltext search $data = array(); search($data,$conf['datadir'],'search_fulltext',array(query => $QUERY)); if(count($data)){ usort($data,'sort_search_fulltext'); foreach($data as $row){ print '
'; print html_wikilink(':'.$row['id'],$row['id'],$ID); print ': '.$row['count'].' '.$lang['hits'].'
'; print '
'.$row['snippet'].'
'; print '
'; } }else{ print '
'.$lang['nothingfound'].'
'; } } function html_locked($ip){ global $ID; global $conf; global $lang; $locktime = filemtime(wikiFN($ID).'.lock'); $expire = @date($conf['dformat'], $locktime + $conf['locktime'] ); $min = round(($conf['locktime'] - (time() - $locktime) )/60); print parsedLocale('locked'); print ''; } function html_revisions(){ global $ID; global $INFO; global $conf; global $lang; $revisions = getRevisions($ID); $date = @date($conf['dformat'],$INFO['lastmod']); print parsedLocale('revisions'); print ''; } function html_recent(){ global $conf; $recents = getRecents(0,true); print parsedLocale('recent'); print ''; } function html_index($ns){ require_once("inc/search.php"); global $conf; global $ID; $dir = $conf['datadir']; $ns = cleanID($ns); if(empty($ns)){ $ns = dirname(str_replace(':','/',$ID)); if($ns == '.') $ns =''; } $ns = str_replace(':','/',$ns); print parsedLocale('index'); $data = array(); search($data,$conf['datadir'],'search_index',array('ns' => $ns)); print html_buildlist($data,'idx',html_list_index); } /** * User function for html_buildlist() */ function html_list_index($item){ $ret = ''; if($item['type']=='d'){ $ret .= ''; $ret .= $item['id']; $ret .= ''; }else{ $ret .= html_wikilink(':'.$item['id'],$item['id']); } return $ret; } /** * Build an unordered list from the given $data array * Each item in the array has to have a 'level' property * the item itself gets printed by the given $func user * function */ function html_buildlist($data,$class,$func){ $level = 0; $opens = 0; $ret = ''; foreach ($data as $item){ if( $item['level'] > $level ){ //open new list $ret .= "\n\n\n"; } }else{ //close last item $ret .= "\n"; } //remember current level $level = $item['level']; //print item $ret .= '
  • '; $ret .= ''; $ret .= $func($item); //user function $ret .= ''; } //close remaining items and lists for ($i=0; $i < $level; $i++){ $ret .= "
  • \n"; } return $ret; } function html_backlinks(){ require_once("inc/search.php"); global $ID; global $conf; if(preg_match('#^(.*):(.*)$#',$ID,$matches)){ $opts['ns'] = $matches[1]; $opts['name'] = $matches[2]; }else{ $opts['ns'] = ''; $opts['name'] = $ID; } print parsedLocale('backlinks'); $data = array(); search($data,$conf['datadir'],'search_backlinks',$opts); sort($data); print ''; } function html_diff($text='',$intro=true){ require_once("inc/DifferenceEngine.php"); global $ID; global $REV; global $lang; global $conf; if($text){ $df = new Diff(split("\n",htmlspecialchars(rawWiki($ID,''))), split("\n",htmlspecialchars(cleanText($text)))); $left = ''. $ID.' '.date($conf['dformat'],@filemtime(wikiFN($ID))).''. $lang['current']; $right = $lang['yours']; }else{ $df = new Diff(split("\n",htmlspecialchars(rawWiki($ID,$REV))), split("\n",htmlspecialchars(rawWiki($ID,'')))); $left = ''. $ID.' '.date($conf['dformat'],$REV).''; $right = ''. $ID.' '.date($conf['dformat'],@filemtime(wikiFN($ID))).' '. $lang['current']; } $tdf = new TableDiffFormatter(); if($intro) print parsedLocale('diff'); ?> format($df)?>




    :
    '; print '

    When reporting bugs please send all the following '; print 'output as a mail to andi@splitbrain.org '; print 'The best way to do this is to save this page in your browser

    '; print '$_SERVER:
    ';
      print_r($_SERVER);
      print '
    '; print '$conf:
    ';
      print_r($conf);
      print '
    '; print 'abs baseURL:
    ';
      print getBaseURL(true);
      print '
    '; print 'rel baseURL:
    ';
      print dirname($_SERVER['PHP_SELF']).'/';
      print '
    '; print 'PHP Version:
    ';
      print phpversion();
      print '
    '; print 'locale:
    ';
      print setlocale(LC_ALL,0);
      print '
    '; print 'Environment:
    ';
      print_r($_ENV);
      print '
    '; print 'PHP settings:
    ';
      $inis = ini_get_all();
      print_r($inis);
      print '
    '; print ''; } ?>