summaryrefslogtreecommitdiff
path: root/inc/html.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2009-10-20 23:23:38 +0200
committerAndreas Gohr <andi@splitbrain.org>2009-10-20 23:23:38 +0200
commitdb959ae30700e3924a73350a3a43a2c36b431de7 (patch)
treef89b3fb0609abb72cf93fa8060f7fc27f4c15f40 /inc/html.php
parent8ec3f7bdbf7a5f702a3022332a6f6cb424d0981a (diff)
downloadrpg-db959ae30700e3924a73350a3a43a2c36b431de7.tar.gz
rpg-db959ae30700e3924a73350a3a43a2c36b431de7.tar.bz2
Coding Standard Cleanup
Ignore-this: 259cb5773c3144c6c706d87298dcf674 darcs-hash:20091020212338-7ad00-6bf1c5c403491f136a1c02af5ecd9f84d7227107.gz
Diffstat (limited to 'inc/html.php')
-rw-r--r--inc/html.php2067
1 files changed, 1035 insertions, 1032 deletions
diff --git a/inc/html.php b/inc/html.php
index 0ea72c06c..1fb5b0202 100644
--- a/inc/html.php
+++ b/inc/html.php
@@ -16,13 +16,13 @@ require_once(DOKU_INC.'inc/form.php');
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
-function html_wikilink($id,$name=NULL,$search=''){
- static $xhtml_renderer = NULL;
- if(is_null($xhtml_renderer)){
- $xhtml_renderer = p_get_renderer('xhtml');
- }
+function html_wikilink($id,$name=null,$search=''){
+ static $xhtml_renderer = null;
+ if(is_null($xhtml_renderer)){
+ $xhtml_renderer = p_get_renderer('xhtml');
+ }
- return $xhtml_renderer->internallink($id,$name,$search,true,'navigation');
+ return $xhtml_renderer->internallink($id,$name,$search,true,'navigation');
}
/**
@@ -31,11 +31,11 @@ function html_wikilink($id,$name=NULL,$search=''){
* @author Andreas Gohr <andi@splitbrain.org>
*/
function html_attbuild($attributes){
- $ret = '';
- foreach ( $attributes as $key => $value ) {
- $ret .= $key.'="'.formtext($value).'" ';
- }
- return trim($ret);
+ $ret = '';
+ foreach ( $attributes as $key => $value ) {
+ $ret .= $key.'="'.formtext($value).'" ';
+ }
+ return trim($ret);
}
/**
@@ -44,40 +44,40 @@ function html_attbuild($attributes){
* @author Andreas Gohr <andi@splitbrain.org>
*/
function html_login(){
- global $lang;
- global $conf;
- global $ID;
- global $auth;
-
- print p_locale_xhtml('login');
- print '<div class="centeralign">'.NL;
- $form = new Doku_Form('dw__login');
- $form->startFieldset($lang['btn_login']);
- $form->addHidden('id', $ID);
- $form->addHidden('do', 'login');
- $form->addElement(form_makeTextField('u', ((!$_REQUEST['http_credentials']) ? $_REQUEST['u'] : ''), $lang['user'], 'focus__this', 'block'));
- $form->addElement(form_makePasswordField('p', $lang['pass'], '', 'block'));
- if($conf['rememberme']) {
- $form->addElement(form_makeCheckboxField('r', '1', $lang['remember'], 'remember__me', 'simple'));
- }
- $form->addElement(form_makeButton('submit', '', $lang['btn_login']));
- $form->endFieldset();
- html_form('login', $form);
-
- if($auth && $auth->canDo('addUser') && actionOK('register')){
- print '<p>';
- print $lang['reghere'];
- print ': <a href="'.wl($ID,'do=register').'" rel="nofollow" class="wikilink1">'.$lang['register'].'</a>';
- print '</p>';
- }
-
- if ($auth && $auth->canDo('modPass') && actionOK('resendpwd')) {
- print '<p>';
- print $lang['pwdforget'];
- print ': <a href="'.wl($ID,'do=resendpwd').'" rel="nofollow" class="wikilink1">'.$lang['btn_resendpwd'].'</a>';
- print '</p>';
- }
- print '</div>'.NL;
+ global $lang;
+ global $conf;
+ global $ID;
+ global $auth;
+
+ print p_locale_xhtml('login');
+ print '<div class="centeralign">'.NL;
+ $form = new Doku_Form('dw__login');
+ $form->startFieldset($lang['btn_login']);
+ $form->addHidden('id', $ID);
+ $form->addHidden('do', 'login');
+ $form->addElement(form_makeTextField('u', ((!$_REQUEST['http_credentials']) ? $_REQUEST['u'] : ''), $lang['user'], 'focus__this', 'block'));
+ $form->addElement(form_makePasswordField('p', $lang['pass'], '', 'block'));
+ if($conf['rememberme']) {
+ $form->addElement(form_makeCheckboxField('r', '1', $lang['remember'], 'remember__me', 'simple'));
+ }
+ $form->addElement(form_makeButton('submit', '', $lang['btn_login']));
+ $form->endFieldset();
+ html_form('login', $form);
+
+ if($auth && $auth->canDo('addUser') && actionOK('register')){
+ print '<p>';
+ print $lang['reghere'];
+ print ': <a href="'.wl($ID,'do=register').'" rel="nofollow" class="wikilink1">'.$lang['register'].'</a>';
+ print '</p>';
+ }
+
+ if ($auth && $auth->canDo('modPass') && actionOK('resendpwd')) {
+ print '<p>';
+ print $lang['pwdforget'];
+ print ': <a href="'.wl($ID,'do=resendpwd').'" rel="nofollow" class="wikilink1">'.$lang['btn_resendpwd'].'</a>';
+ print '</p>';
+ }
+ print '</div>'.NL;
}
/**
@@ -87,21 +87,21 @@ function html_login(){
* @author Andreas Gohr <andi@splitbrain.org>
*/
function html_secedit_button($matches){
- global $ID;
- global $INFO;
-
- $section = $matches[2];
- $name = $matches[1];
-
- $secedit = '';
- $secedit .= '<div class="secedit">';
- $secedit .= html_btn('secedit',$ID,'',
- array('do' => 'edit',
- 'lines' => "$section",
- 'rev' => $INFO['lastmod']),
- 'post', $name);
- $secedit .= '</div>';
- return $secedit;
+ global $ID;
+ global $INFO;
+
+ $section = $matches[2];
+ $name = $matches[1];
+
+ $secedit = '';
+ $secedit .= '<div class="secedit">';
+ $secedit .= html_btn('secedit',$ID,'',
+ array('do' => 'edit',
+ 'lines' => "$section",
+ 'rev' => $INFO['lastmod']),
+ 'post', $name);
+ $secedit .= '</div>';
+ return $secedit;
}
/**
@@ -110,16 +110,16 @@ function html_secedit_button($matches){
* @author Andreas Gohr <andi@splitbrain.org>
*/
function html_secedit($text,$show=true){
- global $INFO;
+ global $INFO;
- if($INFO['writable'] && $show && !$INFO['rev']){
- $text = preg_replace_callback('#<!-- SECTION "(.*?)" \[(\d+-\d*)\] -->#',
- 'html_secedit_button', $text);
- }else{
- $text = preg_replace('#<!-- SECTION "(.*?)" \[(\d+-\d*)\] -->#','',$text);
- }
+ if($INFO['writable'] && $show && !$INFO['rev']){
+ $text = preg_replace_callback('#<!-- SECTION "(.*?)" \[(\d+-\d*)\] -->#',
+ 'html_secedit_button', $text);
+ }else{
+ $text = preg_replace('#<!-- SECTION "(.*?)" \[(\d+-\d*)\] -->#','',$text);
+ }
- return $text;
+ return $text;
}
/**
@@ -128,12 +128,12 @@ function html_secedit($text,$show=true){
* @author Andreas Gohr <andi@splitbrain.org>
*/
function html_topbtn(){
- global $lang;
+ global $lang;
- $ret = '';
- $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>';
+ $ret = '';
+ $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>';
- return $ret;
+ return $ret;
}
/**
@@ -143,53 +143,53 @@ function html_topbtn(){
* @author Andreas Gohr <andi@splitbrain.org>
*/
function html_btn($name,$id,$akey,$params,$method='get',$tooltip=''){
- global $conf;
- global $lang;
-
- $label = $lang['btn_'.$name];
-
- $ret = '';
- $tip = '';
-
- //filter id (without urlencoding)
- $id = idfilter($id,false);
-
- //make nice URLs even for buttons
- if($conf['userewrite'] == 2){
- $script = DOKU_BASE.DOKU_SCRIPT.'/'.$id;
- }elseif($conf['userewrite']){
- $script = DOKU_BASE.$id;
- }else{
- $script = DOKU_BASE.DOKU_SCRIPT;
- $params['id'] = $id;
- }
-
- $ret .= '<form class="button btn_'.$name.'" method="'.$method.'" action="'.$script.'"><div class="no">';
-
- if(is_array($params)){
- reset($params);
- while (list($key, $val) = each($params)) {
- $ret .= '<input type="hidden" name="'.$key.'" ';
- $ret .= 'value="'.htmlspecialchars($val).'" />';
+ global $conf;
+ global $lang;
+
+ $label = $lang['btn_'.$name];
+
+ $ret = '';
+ $tip = '';
+
+ //filter id (without urlencoding)
+ $id = idfilter($id,false);
+
+ //make nice URLs even for buttons
+ if($conf['userewrite'] == 2){
+ $script = DOKU_BASE.DOKU_SCRIPT.'/'.$id;
+ }elseif($conf['userewrite']){
+ $script = DOKU_BASE.$id;
+ }else{
+ $script = DOKU_BASE.DOKU_SCRIPT;
+ $params['id'] = $id;
+ }
+
+ $ret .= '<form class="button btn_'.$name.'" method="'.$method.'" action="'.$script.'"><div class="no">';
+
+ if(is_array($params)){
+ reset($params);
+ while (list($key, $val) = each($params)) {
+ $ret .= '<input type="hidden" name="'.$key.'" ';
+ $ret .= 'value="'.htmlspecialchars($val).'" />';
+ }
+ }
+
+ if ($tooltip!='') {
+ $tip = htmlspecialchars($tooltip);
+ }else{
+ $tip = htmlspecialchars($label);
}
- }
-
- if ($tooltip!='') {
- $tip = htmlspecialchars($tooltip);
- }else{
- $tip = htmlspecialchars($label);
- }
-
- $ret .= '<input type="submit" value="'.htmlspecialchars($label).'" class="button" ';
- if($akey){
- $tip .= ' ['.strtoupper($akey).']';
- $ret .= 'accesskey="'.$akey.'" ';
- }
- $ret .= 'title="'.$tip.'" ';
- $ret .= '/>';
- $ret .= '</div></form>';
-
- return $ret;
+
+ $ret .= '<input type="submit" value="'.htmlspecialchars($label).'" class="button" ';
+ if($akey){
+ $tip .= ' ['.strtoupper($akey).']';
+ $ret .= 'accesskey="'.$akey.'" ';
+ }
+ $ret .= 'title="'.$tip.'" ';
+ $ret .= '/>';
+ $ret .= '</div></form>';
+
+ return $ret;
}
/**
@@ -198,36 +198,36 @@ function html_btn($name,$id,$akey,$params,$method='get',$tooltip=''){
* @author Andreas Gohr <andi@splitbrain.org>
*/
function html_show($txt=''){
- global $ID;
- global $REV;
- global $HIGH;
- global $INFO;
- //disable section editing for old revisions or in preview
- if($txt || $REV){
- $secedit = false;
- }else{
- $secedit = true;
- }
-
- if ($txt){
- //PreviewHeader
- echo '<br id="scroll__here" />';
- echo p_locale_xhtml('preview');
- echo '<div class="preview">';
- $html = html_secedit(p_render('xhtml',p_get_instructions($txt),$info),$secedit);
- if($INFO['prependTOC']) $html = tpl_toc(true).$html;
- echo $html;
- echo '<div class="clearer"></div>';
- echo '</div>';
+ global $ID;
+ global $REV;
+ global $HIGH;
+ global $INFO;
+ //disable section editing for old revisions or in preview
+ if($txt || $REV){
+ $secedit = false;
+ }else{
+ $secedit = true;
+ }
+
+ if ($txt){
+ //PreviewHeader
+ echo '<br id="scroll__here" />';
+ echo p_locale_xhtml('preview');
+ echo '<div class="preview">';
+ $html = html_secedit(p_render('xhtml',p_get_instructions($txt),$info),$secedit);
+ if($INFO['prependTOC']) $html = tpl_toc(true).$html;
+ echo $html;
+ echo '<div class="clearer"></div>';
+ echo '</div>';
- }else{
- if ($REV) print p_locale_xhtml('showrev');
- $html = p_wiki_xhtml($ID,$REV,true);
- $html = html_secedit($html,$secedit);
- if($INFO['prependTOC']) $html = tpl_toc(true).$html;
- $html = html_hilight($html,$HIGH);
- echo $html;
- }
+ }else{
+ if ($REV) print p_locale_xhtml('showrev');
+ $html = p_wiki_xhtml($ID,$REV,true);
+ $html = html_secedit($html,$secedit);
+ if($INFO['prependTOC']) $html = tpl_toc(true).$html;
+ $html = html_hilight($html,$HIGH);
+ echo $html;
+ }
}
/**
@@ -236,25 +236,25 @@ function html_show($txt=''){
* @author Andreas Gohr <andi@splitbrain.org>
*/
function html_draft(){
- global $INFO;
- global $ID;
- global $lang;
- global $conf;
- $draft = unserialize(io_readFile($INFO['draft'],false));
- $text = cleanText(con($draft['prefix'],$draft['text'],$draft['suffix'],true));
-
- print p_locale_xhtml('draft');
- $form = new Doku_Form('dw__editform');
- $form->addHidden('id', $ID);
- $form->addHidden('date', $draft['date']);
- $form->addElement(form_makeWikiText($text, array('readonly'=>'readonly')));
- $form->addElement(form_makeOpenTag('div', array('id'=>'draft__status')));
- $form->addElement($lang['draftdate'].' '. dformat(filemtime($INFO['draft'])));
- $form->addElement(form_makeCloseTag('div'));
- $form->addElement(form_makeButton('submit', 'recover', $lang['btn_recover'], array('tabindex'=>'1')));
- $form->addElement(form_makeButton('submit', 'draftdel', $lang['btn_draftdel'], array('tabindex'=>'2')));
- $form->addElement(form_makeButton('submit', 'show', $lang['btn_cancel'], array('tabindex'=>'3')));
- html_form('draft', $form);
+ global $INFO;
+ global $ID;
+ global $lang;
+ global $conf;
+ $draft = unserialize(io_readFile($INFO['draft'],false));
+ $text = cleanText(con($draft['prefix'],$draft['text'],$draft['suffix'],true));
+
+ print p_locale_xhtml('draft');
+ $form = new Doku_Form('dw__editform');
+ $form->addHidden('id', $ID);
+ $form->addHidden('date', $draft['date']);
+ $form->addElement(form_makeWikiText($text, array('readonly'=>'readonly')));
+ $form->addElement(form_makeOpenTag('div', array('id'=>'draft__status')));
+ $form->addElement($lang['draftdate'].' '. dformat(filemtime($INFO['draft'])));
+ $form->addElement(form_makeCloseTag('div'));
+ $form->addElement(form_makeButton('submit', 'recover', $lang['btn_recover'], array('tabindex'=>'1')));
+ $form->addElement(form_makeButton('submit', 'draftdel', $lang['btn_draftdel'], array('tabindex'=>'2')));
+ $form->addElement(form_makeButton('submit', 'show', $lang['btn_cancel'], array('tabindex'=>'3')));
+ html_form('draft', $form);
}
/**
@@ -264,12 +264,12 @@ function html_draft(){
* @author Harry Fuecks <hfuecks@gmail.com>
*/
function html_hilight($html,$phrases){
- $phrases = array_filter((array) $phrases);
- $regex = join('|',array_map('preg_quote_cb',$phrases));
+ $phrases = array_filter((array) $phrases);
+ $regex = join('|',array_map('preg_quote_cb',$phrases));
- if ($regex === '') return $html;
- $html = preg_replace_callback("/((<[^>]*)|$regex)/ui",'html_hilight_callback',$html);
- return $html;
+ if ($regex === '') return $html;
+ $html = preg_replace_callback("/((<[^>]*)|$regex)/ui",'html_hilight_callback',$html);
+ return $html;
}
/**
@@ -278,11 +278,11 @@ function html_hilight($html,$phrases){
* @author Harry Fuecks <hfuecks@gmail.com>
*/
function html_hilight_callback($m) {
- $hlight = unslash($m[0]);
- if ( !isset($m[2])) {
- $hlight = '<span class="search_hit">'.$hlight.'</span>';
- }
- return $hlight;
+ $hlight = unslash($m[0]);
+ if ( !isset($m[2])) {
+ $hlight = '<span class="search_hit">'.$hlight.'</span>';
+ }
+ return $hlight;
}
/**
@@ -291,83 +291,83 @@ function html_hilight_callback($m) {
* @author Andreas Gohr <andi@splitbrain.org>
*/
function html_search(){
- require_once(DOKU_INC.'inc/search.php');
- require_once(DOKU_INC.'inc/fulltext.php');
- global $conf;
- global $QUERY;
- global $ID;
- global $lang;
-
- print p_locale_xhtml('searchpage');
- flush();
-
- //check if search is restricted to namespace
- if(preg_match('/@([^@]*)/',$QUERY,$match)) {
- $id = cleanID($match[1]);
- } else {
- $id = cleanID($QUERY);
- }
-
- //show progressbar
- print '<div class="centeralign" id="dw__loading">'.NL;
- print '<script type="text/javascript" charset="utf-8"><!--//--><![CDATA[//><!--'.NL;
- print 'showLoadBar();'.NL;
- print '//--><!]]></script>'.NL;
- print '<br /></div>'.NL;
- flush();
-
- //do quick pagesearch
- $data = array();
-
- if($id) $data = ft_pageLookup($id);
- if(count($data)){
- print '<div class="search_quickresult">';
- print '<h3>'.$lang['quickhits'].':</h3>';
- print '<ul class="search_quickhits">';
- foreach($data as $id){
- print '<li> ';
- $ns = getNS($id);
- if($ns){
- $name = shorten(noNS($id), ' ('.$ns.')',30);
- }else{
- $name = $id;
- }
- print html_wikilink(':'.$id,$name);
- print '</li> ';
+ require_once(DOKU_INC.'inc/search.php');
+ require_once(DOKU_INC.'inc/fulltext.php');
+ global $conf;
+ global $QUERY;
+ global $ID;
+ global $lang;
+
+ print p_locale_xhtml('searchpage');
+ flush();
+
+ //check if search is restricted to namespace
+ if(preg_match('/@([^@]*)/',$QUERY,$match)) {
+ $id = cleanID($match[1]);
+ } else {
+ $id = cleanID($QUERY);
}
- print '</ul> ';
- //clear float (see http://www.complexspiral.com/publications/containing-floats/)
- print '<div class="clearer">&nbsp;</div>';
- print '</div>';
- }
- flush();
-
- //do fulltext search
- $data = ft_pageSearch($QUERY,$regex);
- if(count($data)){
- $num = 1;
- foreach($data as $id => $cnt){
- print '<div class="search_result">';
- print html_wikilink(':'.$id,useHeading('navigation')?NULL:$id,$regex);
- if($cnt !== 0){
- print ': <span class="search_cnt">'.$cnt.' '.$lang['hits'].'</span><br />';
- if($num < 15){ // create snippets for the first number of matches only #FIXME add to conf ?
- print '<div class="search_snippet">'.ft_snippet($id,$regex).'</div>';
+
+ //show progressbar
+ print '<div class="centeralign" id="dw__loading">'.NL;
+ print '<script type="text/javascript" charset="utf-8"><!--//--><![CDATA[//><!--'.NL;
+ print 'showLoadBar();'.NL;
+ print '//--><!]]></script>'.NL;
+ print '<br /></div>'.NL;
+ flush();
+
+ //do quick pagesearch
+ $data = array();
+
+ if($id) $data = ft_pageLookup($id);
+ if(count($data)){
+ print '<div class="search_quickresult">';
+ print '<h3>'.$lang['quickhits'].':</h3>';
+ print '<ul class="search_quickhits">';
+ foreach($data as $id){
+ print '<li> ';
+ $ns = getNS($id);
+ if($ns){
+ $name = shorten(noNS($id), ' ('.$ns.')',30);
+ }else{
+ $name = $id;
+ }
+ print html_wikilink(':'.$id,$name);
+ print '</li> ';
}
- $num++;
- }
- print '</div>';
- flush();
+ print '</ul> ';
+ //clear float (see http://www.complexspiral.com/publications/containing-floats/)
+ print '<div class="clearer">&nbsp;</div>';
+ print '</div>';
}
- }else{
- print '<div class="nothing">'.$lang['nothingfound'].'</div>';
- }
-
- //hide progressbar
- print '<script type="text/javascript" charset="utf-8"><!--//--><![CDATA[//><!--'.NL;
- print 'hideLoadBar("dw__loading");'.NL;
- print '//--><!]]></script>'.NL;
- flush();
+ flush();
+
+ //do fulltext search
+ $data = ft_pageSearch($QUERY,$regex);
+ if(count($data)){
+ $num = 1;
+ foreach($data as $id => $cnt){
+ print '<div class="search_result">';
+ print html_wikilink(':'.$id,useHeading('navigation')?null:$id,$regex);
+ if($cnt !== 0){
+ print ': <span class="search_cnt">'.$cnt.' '.$lang['hits'].'</span><br />';
+ if($num < 15){ // create snippets for the first number of matches only #FIXME add to conf ?
+ print '<div class="search_snippet">'.ft_snippet($id,$regex).'</div>';
+ }
+ $num++;
+ }
+ print '</div>';
+ flush();
+ }
+ }else{
+ print '<div class="nothing">'.$lang['nothingfound'].'</div>';
+ }
+
+ //hide progressbar
+ print '<script type="text/javascript" charset="utf-8"><!--//--><![CDATA[//><!--'.NL;
+ print 'hideLoadBar("dw__loading");'.NL;
+ print '//--><!]]></script>'.NL;
+ flush();
}
/**
@@ -376,20 +376,20 @@ function html_search(){
* @author Andreas Gohr <andi@splitbrain.org>
*/
function html_locked(){
- global $ID;
- global $conf;
- global $lang;
- global $INFO;
-
- $locktime = filemtime(wikiLockFN($ID));
- $expire = dformat($locktime + $conf['locktime']);
- $min = round(($conf['locktime'] - (time() - $locktime) )/60);
-
- print p_locale_xhtml('locked');
- print '<ul>';
- print '<li><div class="li"><strong>'.$lang['lockedby'].':</strong> '.editorinfo($INFO['locked']).'</div></li>';
- print '<li><div class="li"><strong>'.$lang['lockexpire'].':</strong> '.$expire.' ('.$min.' min)</div></li>';
- print '</ul>';
+ global $ID;
+ global $conf;
+ global $lang;
+ global $INFO;
+
+ $locktime = filemtime(wikiLockFN($ID));
+ $expire = dformat($locktime + $conf['locktime']);
+ $min = round(($conf['locktime'] - (time() - $locktime) )/60);
+
+ print p_locale_xhtml('locked');
+ print '<ul>';
+ print '<li><div class="li"><strong>'.$lang['lockedby'].':</strong> '.editorinfo($INFO['locked']).'</div></li>';
+ print '<li><div class="li"><strong>'.$lang['lockexpire'].':</strong> '.$expire.' ('.$min.' min)</div></li>';
+ print '</ul>';
}
/**
@@ -399,159 +399,159 @@ function html_locked(){
* @author Ben Coburn <btcoburn@silicodon.net>
*/
function html_revisions($first=0){
- global $ID;
- global $INFO;
- global $conf;
- global $lang;
- /* we need to get one additionally log entry to be able to
- * decide if this is the last page or is there another one.
- * see html_recent()
- */
- $revisions = getRevisions($ID, $first, $conf['recent']+1);
- if(count($revisions)==0 && $first!=0){
- $first=0;
- $revisions = getRevisions($ID, $first, $conf['recent']+1);;
- }
- $hasNext = false;
- if (count($revisions)>$conf['recent']) {
- $hasNext = true;
- array_pop($revisions); // remove extra log entry
- }
-
- $date = dformat($INFO['lastmod']);
-
- print p_locale_xhtml('revisions');
-
- $form = new Doku_Form('page__revisions', wl($ID));
- $form->addElement(form_makeOpenTag('ul'));
- if($INFO['exists'] && $first==0){
- if (isset($INFO['meta']) && isset($INFO['meta']['last_change']) && $INFO['meta']['last_change']['type']===DOKU_CHANGE_TYPE_MINOR_EDIT)
- $form->addElement(form_makeOpenTag('li', array('class' => 'minor')));
- else
- $form->addElement(form_makeOpenTag('li'));
- $form->addElement(form_makeOpenTag('div', array('class' => 'li')));
- $form->addElement(form_makeTag('input', array(
- 'type' => 'checkbox',
- 'name' => 'rev2[]',
- 'value' => 'current')));
-
- $form->addElement(form_makeOpenTag('span', array('class' => 'date')));
- $form->addElement($date);
- $form->addElement(form_makeCloseTag('span'));
-
- $form->addElement(form_makeTag('img', array(
- 'src' => DOKU_BASE.'lib/images/blank.gif',
- 'width' => '15',
- 'height' => '11',
- 'alt' => '')));
-
- $form->addElement(form_makeOpenTag('a', array(
- 'class' => 'wikilink1',
- 'href' => wl($ID))));
- $form->addElement($ID);
- $form->addElement(form_makeCloseTag('a'));
-
- $form->addElement(form_makeOpenTag('span', array('class' => 'sum')));
- $form->addElement(' &ndash; ');
- $form->addElement(htmlspecialchars($INFO['sum']));
- $form->addElement(form_makeCloseTag('span'));
-
- $form->addElement(form_makeOpenTag('span', array('class' => 'user')));
- $form->addElement((empty($INFO['editor']))?('('.$lang['external_edit'].')'):editorinfo($INFO['editor']));
- $form->addElement(form_makeCloseTag('span'));
-
- $form->addElement('('.$lang['current'].')');
- $form->addElement(form_makeCloseTag('div'));
- $form->addElement(form_makeCloseTag('li'));
- }
-
- foreach($revisions as $rev){
- $date = dformat($rev);
- $info = getRevisionInfo($ID,$rev,true);
- $exists = page_exists($ID,$rev);
-
- if ($info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT)
- $form->addElement(form_makeOpenTag('li', array('class' => 'minor')));
- else
- $form->addElement(form_makeOpenTag('li'));
- $form->addElement(form_makeOpenTag('div', array('class' => 'li')));
- if($exists){
- $form->addElement(form_makeTag('input', array(
- 'type' => 'checkbox',
- 'name' => 'rev2[]',
- 'value' => $rev)));
- }else{
- $form->addElement(form_makeTag('img', array(
- 'src' => DOKU_BASE.'lib/images/blank.gif',
- 'width' => 14,
- 'height' => 11,
- 'alt' => '')));
+ global $ID;
+ global $INFO;
+ global $conf;
+ global $lang;
+ /* we need to get one additionally log entry to be able to
+ * decide if this is the last page or is there another one.
+ * see html_recent()
+ */
+ $revisions = getRevisions($ID, $first, $conf['recent']+1);
+ if(count($revisions)==0 && $first!=0){
+ $first=0;
+ $revisions = getRevisions($ID, $first, $conf['recent']+1);;
}
-
- $form->addElement(form_makeOpenTag('span', array('class' => 'date')));
- $form->addElement($date);
- $form->addElement(form_makeCloseTag('span'));
-
- if($exists){
- $form->addElement(form_makeOpenTag('a', array('href' => wl($ID,"rev=$rev,do=diff", false, '&'), 'class' => 'diff_link')));
- $form->addElement(form_makeTag('img', array(
- 'src' => DOKU_BASE.'lib/images/diff.png',
- 'width' => 15,
- 'height' => 11,
- 'title' => $lang['diff'],
- 'alt' => $lang['diff'])));
- $form->addElement(form_makeCloseTag('a'));
-
- $form->addElement(form_makeOpenTag('a', array('href' => wl($ID,"rev=$rev",false,'&'), 'class' => 'wikilink1')));
- $form->addElement($ID);
- $form->addElement(form_makeCloseTag('a'));
- }else{
- $form->addElement(form_makeTag('img', array(
- 'src' => DOKU_BASE.'lib/images/blank.gif',
- 'width' => '15',
- 'height' => '11',
- 'alt' => '')));
- $form->addElement($ID);
+ $hasNext = false;
+ if (count($revisions)>$conf['recent']) {
+ $hasNext = true;
+ array_pop($revisions); // remove extra log entry
}
- $form->addElement(form_makeOpenTag('span', array('class' => 'sum')));
- $form->addElement(' &ndash; ');
- $form->addElement(htmlspecialchars($info['sum']));
- $form->addElement(form_makeCloseTag('span'));
-
- $form->addElement(form_makeOpenTag('span', array('class' => 'user')));
- if($info['user']){
- $form->addElement(editorinfo($info['user']));
- if(auth_ismanager()){
- $form->addElement(' ('.$info['ip'].')');
- }
- }else{
- $form->addElement($info['ip']);
+ $date = dformat($INFO['lastmod']);
+
+ print p_locale_xhtml('revisions');
+
+ $form = new Doku_Form('page__revisions', wl($ID));
+ $form->addElement(form_makeOpenTag('ul'));
+ if($INFO['exists'] && $first==0){
+ if (isset($INFO['meta']) && isset($INFO['meta']['last_change']) && $INFO['meta']['last_change']['type']===DOKU_CHANGE_TYPE_MINOR_EDIT)
+ $form->addElement(form_makeOpenTag('li', array('class' => 'minor')));
+ else
+ $form->addElement(form_makeOpenTag('li'));
+ $form->addElement(form_makeOpenTag('div', array('class' => 'li')));
+ $form->addElement(form_makeTag('input', array(
+ 'type' => 'checkbox',
+ 'name' => 'rev2[]',
+ 'value' => 'current')));
+
+ $form->addElement(form_makeOpenTag('span', array('class' => 'date')));
+ $form->addElement($date);
+ $form->addElement(form_makeCloseTag('span'));
+
+ $form->addElement(form_makeTag('img', array(
+ 'src' => DOKU_BASE.'lib/images/blank.gif',
+ 'width' => '15',
+ 'height' => '11',
+ 'alt' => '')));
+
+ $form->addElement(form_makeOpenTag('a', array(
+ 'class' => 'wikilink1',
+ 'href' => wl($ID))));
+ $form->addElement($ID);
+ $form->addElement(form_makeCloseTag('a'));
+
+ $form->addElement(form_makeOpenTag('span', array('class' => 'sum')));
+ $form->addElement(' &ndash; ');
+ $form->addElement(htmlspecialchars($INFO['sum']));
+ $form->addElement(form_makeCloseTag('span'));
+
+ $form->addElement(form_makeOpenTag('span', array('class' => 'user')));
+ $form->addElement((empty($INFO['editor']))?('('.$lang['external_edit'].')'):editorinfo($INFO['editor']));
+ $form->addElement(form_makeCloseTag('span'));
+
+ $form->addElement('('.$lang['current'].')');
+ $form->addElement(form_makeCloseTag('div'));
+ $form->addElement(form_makeCloseTag('li'));
}
- $form->addElement(form_makeCloseTag('span'));
- $form->addElement(form_makeCloseTag('div'));
- $form->addElement(form_makeCloseTag('li'));
- }
- $form->addElement(form_makeCloseTag('ul'));
- $form->addElement(form_makeButton('submit', 'diff', $lang['diff2']));
- html_form('revisions', $form);
-
- print '<div class="pagenav">';
- $last = $first + $conf['recent'];
- if ($first > 0) {
- $first -= $conf['recent'];
- if ($first < 0) $first = 0;
- print '<div class="pagenav-prev">';
- print html_btn('newer',$ID,"p",array('do' => 'revisions', 'first' => $first));
- print '</div>';
- }
- if ($hasNext) {
- print '<div class="pagenav-next">';
- print html_btn('older',$ID,"n",array('do' => 'revisions', 'first' => $last));
+ foreach($revisions as $rev){
+ $date = dformat($rev);
+ $info = getRevisionInfo($ID,$rev,true);
+ $exists = page_exists($ID,$rev);
+
+ if ($info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT)
+ $form->addElement(form_makeOpenTag('li', array('class' => 'minor')));
+ else
+ $form->addElement(form_makeOpenTag('li'));
+ $form->addElement(form_makeOpenTag('div', array('class' => 'li')));
+ if($exists){
+ $form->addElement(form_makeTag('input', array(
+ 'type' => 'checkbox',
+ 'name' => 'rev2[]',
+ 'value' => $rev)));
+ }else{
+ $form->addElement(form_makeTag('img', array(
+ 'src' => DOKU_BASE.'lib/images/blank.gif',
+ 'width' => 14,
+ 'height' => 11,
+ 'alt' => '')));
+ }
+
+ $form->addElement(form_makeOpenTag('span', array('class' => 'date')));
+ $form->addElement($date);
+ $form->addElement(form_makeCloseTag('span'));
+
+ if($exists){
+ $form->addElement(form_makeOpenTag('a', array('href' => wl($ID,"rev=$rev,do=diff", false, '&'), 'class' => 'diff_link')));
+ $form->addElement(form_makeTag('img', array(
+ 'src' => DOKU_BASE.'lib/images/diff.png',
+ 'width' => 15,
+ 'height' => 11,
+ 'title' => $lang['diff'],
+ 'alt' => $lang['diff'])));
+ $form->addElement(form_makeCloseTag('a'));
+
+ $form->addElement(form_makeOpenTag('a', array('href' => wl($ID,"rev=$rev",false,'&'), 'class' => 'wikilink1')));
+ $form->addElement($ID);
+ $form->addElement(form_makeCloseTag('a'));
+ }else{
+ $form->addElement(form_makeTag('img', array(
+ 'src' => DOKU_BASE.'lib/images/blank.gif',
+ 'width' => '15',
+ 'height' => '11',
+ 'alt' => '')));
+ $form->addElement($ID);
+ }
+
+ $form->addElement(form_makeOpenTag('span', array('class' => 'sum')));
+ $form->addElement(' &ndash; ');
+ $form->addElement(htmlspecialchars($info['sum']));
+ $form->addElement(form_makeCloseTag('span'));
+
+ $form->addElement(form_makeOpenTag('span', array('class' => 'user')));
+ if($info['user']){
+ $form->addElement(editorinfo($info['user']));
+ if(auth_ismanager()){
+ $form->addElement(' ('.$info['ip'].')');
+ }
+ }else{
+ $form->addElement($info['ip']);
+ }
+ $form->addElement(form_makeCloseTag('span'));
+
+ $form->addElement(form_makeCloseTag('div'));
+ $form->addElement(form_makeCloseTag('li'));
+ }
+ $form->addElement(form_makeCloseTag('ul'));
+ $form->addElement(form_makeButton('submit', 'diff', $lang['diff2']));
+ html_form('revisions', $form);
+
+ print '<div class="pagenav">';
+ $last = $first + $conf['recent'];
+ if ($first > 0) {
+ $first -= $conf['recent'];
+ if ($first < 0) $first = 0;
+ print '<div class="pagenav-prev">';
+ print html_btn('newer',$ID,"p",array('do' => 'revisions', 'first' => $first));
+ print '</div>';
+ }
+ if ($hasNext) {
+ print '<div class="pagenav-next">';
+ print html_btn('older',$ID,"n",array('do' => 'revisions', 'first' => $last));
+ print '</div>';
+ }
print '</div>';
- }
- print '</div>';
}
@@ -563,120 +563,120 @@ function html_revisions($first=0){
* @author Ben Coburn <btcoburn@silicodon.net>
*/
function html_recent($first=0){
- global $conf;
- global $lang;
- global $ID;
- /* we need to get one additionally log entry to be able to
- * decide if this is the last page or is there another one.
- * This is the cheapest solution to get this information.
- */
- $recents = getRecents($first,$conf['recent'] + 1,getNS($ID));
- if(count($recents) == 0 && $first != 0){
- $first=0;
+ global $conf;
+ global $lang;
+ global $ID;
+ /* we need to get one additionally log entry to be able to
+ * decide if this is the last page or is there another one.
+ * This is the cheapest solution to get this information.
+ */
$recents = getRecents($first,$conf['recent'] + 1,getNS($ID));
- }
- $hasNext = false;
- if (count($recents)>$conf['recent']) {
- $hasNext = true;
- array_pop($recents); // remove extra log entry
- }
-
- print p_locale_xhtml('recent');
-
- if (getNS($ID) != '')
- print '<div class="level1"><p>' . sprintf($lang['recent_global'], getNS($ID), wl('', 'do=recent')) . '</p></div>';
-
- $form = new Doku_Form('dw__recent', script(), 'get');
- $form->addHidden('sectok', null);
- $form->addHidden('do', 'recent');
- $form->addHidden('id', $ID);
- $form->addElement(form_makeOpenTag('ul'));
-
- foreach($recents as $recent){
- $date = dformat($recent['date']);
- if ($recent['type']===DOKU_CHANGE_TYPE_MINOR_EDIT)
- $form->addElement(form_makeOpenTag('li', array('class' => 'minor')));
- else
- $form->addElement(form_makeOpenTag('li'));
-
- $form->addElement(form_makeOpenTag('div', array('class' => 'li')));
-
- $form->addElement(form_makeOpenTag('span', array('class' => 'date')));
- $form->addElement($date);
- $form->addElement(form_makeCloseTag('span'));
-
- $form->addElement(form_makeOpenTag('a', array('class' => 'diff_link', 'href' => wl($recent['id'],"do=diff", false, '&'))));
- $form->addElement(form_makeTag('img', array(
- 'src' => DOKU_BASE.'lib/images/diff.png',
- 'width' => 15,
- 'height'=> 11,
- 'title' => $lang['diff'],
- 'alt' => $lang['diff']
- )));
- $form->addElement(form_makeCloseTag('a'));
-
- $form->addElement(form_makeOpenTag('a', array('class' => 'revisions_link', 'href' => wl($recent['id'],"do=revisions",false,'&'))));
- $form->addElement(form_makeTag('img', array(
- 'src' => DOKU_BASE.'lib/images/history.png',
- 'width' => 12,
- 'height'=> 14,
- 'title' => $lang['btn_revs'],
- 'alt' => $lang['btn_revs']
- )));
- $form->addElement(form_makeCloseTag('a'));
-
- $form->addElement(html_wikilink(':'.$recent['id'],useHeading('navigation')?NULL:$recent['id']));
-
- $form->addElement(form_makeOpenTag('span', array('class' => 'sum')));
- $form->addElement(' &ndash; '.htmlspecialchars($recent['sum']));
- $form->addElement(form_makeCloseTag('span'));
-
- $form->addElement(form_makeOpenTag('span', array('class' => 'user')));
- if($recent['user']){
- $form->addElement(editorinfo($recent['user']));
- if(auth_ismanager()){
- $form->addElement(' ('.$recent['ip'].')');
- }
- }else{
- $form->addElement($recent['ip']);
+ if(count($recents) == 0 && $first != 0){
+ $first=0;
+ $recents = getRecents($first,$conf['recent'] + 1,getNS($ID));
+ }
+ $hasNext = false;
+ if (count($recents)>$conf['recent']) {
+ $hasNext = true;
+ array_pop($recents); // remove extra log entry
}
- $form->addElement(form_makeCloseTag('span'));
+ print p_locale_xhtml('recent');
+
+ if (getNS($ID) != '')
+ print '<div class="level1"><p>' . sprintf($lang['recent_global'], getNS($ID), wl('', 'do=recent')) . '</p></div>';
+
+ $form = new Doku_Form('dw__recent', script(), 'get');
+ $form->addHidden('sectok', null);
+ $form->addHidden('do', 'recent');
+ $form->addHidden('id', $ID);
+ $form->addElement(form_makeOpenTag('ul'));
+
+ foreach($recents as $recent){
+ $date = dformat($recent['date']);
+ if ($recent['type']===DOKU_CHANGE_TYPE_MINOR_EDIT)
+ $form->addElement(form_makeOpenTag('li', array('class' => 'minor')));
+ else
+ $form->addElement(form_makeOpenTag('li'));
+
+ $form->addElement(form_makeOpenTag('div', array('class' => 'li')));
+
+ $form->addElement(form_makeOpenTag('span', array('class' => 'date')));
+ $form->addElement($date);
+ $form->addElement(form_makeCloseTag('span'));
+
+ $form->addElement(form_makeOpenTag('a', array('class' => 'diff_link', 'href' => wl($recent['id'],"do=diff", false, '&'))));
+ $form->addElement(form_makeTag('img', array(
+ 'src' => DOKU_BASE.'lib/images/diff.png',
+ 'width' => 15,
+ 'height'=> 11,
+ 'title' => $lang['diff'],
+ 'alt' => $lang['diff']
+ )));
+ $form->addElement(form_makeCloseTag('a'));
+
+ $form->addElement(form_makeOpenTag('a', array('class' => 'revisions_link', 'href' => wl($recent['id'],"do=revisions",false,'&'))));
+ $form->addElement(form_makeTag('img', array(
+ 'src' => DOKU_BASE.'lib/images/history.png',
+ 'width' => 12,
+ 'height'=> 14,
+ 'title' => $lang['btn_revs'],
+ 'alt' => $lang['btn_revs']
+ )));
+ $form->addElement(form_makeCloseTag('a'));
+
+ $form->addElement(html_wikilink(':'.$recent['id'],useHeading('navigation')?null:$recent['id']));
+
+ $form->addElement(form_makeOpenTag('span', array('class' => 'sum')));
+ $form->addElement(' &ndash; '.htmlspecialchars($recent['sum']));
+ $form->addElement(form_makeCloseTag('span'));
+
+ $form->addElement(form_makeOpenTag('span', array('class' => 'user')));
+ if($recent['user']){
+ $form->addElement(editorinfo($recent['user']));
+ if(auth_ismanager()){
+ $form->addElement(' ('.$recent['ip'].')');
+ }
+ }else{
+ $form->addElement($recent['ip']);
+ }
+ $form->addElement(form_makeCloseTag('span'));
+
+ $form->addElement(form_makeCloseTag('div'));
+ $form->addElement(form_makeCloseTag('li'));
+ }
+ $form->addElement(form_makeCloseTag('ul'));
+
+ $form->addElement(form_makeOpenTag('div', array('class' => 'pagenav')));
+ $last = $first + $conf['recent'];
+ if ($first > 0) {
+ $first -= $conf['recent'];
+ if ($first < 0) $first = 0;
+ $form->addElement(form_makeOpenTag('div', array('class' => 'pagenav-prev')));
+ $form->addElement(form_makeTag('input', array(
+ 'type' => 'submit',
+ 'name' => 'first['.$first.']',
+ 'value' => $lang['btn_newer'],
+ 'accesskey' => 'n',
+ 'title' => $lang['btn_newer'].' [N]',
+ 'class' => 'button'
+ )));
+ $form->addElement(form_makeCloseTag('div'));
+ }
+ if ($hasNext) {
+ $form->addElement(form_makeOpenTag('div', array('class' => 'pagenav-next')));
+ $form->addElement(form_makeTag('input', array(
+ 'type' => 'submit',
+ 'name' => 'first['.$last.']',
+ 'value' => $lang['btn_older'],
+ 'accesskey' => 'p',
+ 'title' => $lang['btn_older'].' [P]',
+ 'class' => 'button'
+ )));
+ $form->addElement(form_makeCloseTag('div'));
+ }
$form->addElement(form_makeCloseTag('div'));
- $form->addElement(form_makeCloseTag('li'));
- }
- $form->addElement(form_makeCloseTag('ul'));
-
- $form->addElement(form_makeOpenTag('div', array('class' => 'pagenav')));
- $last = $first + $conf['recent'];
- if ($first > 0) {
- $first -= $conf['recent'];
- if ($first < 0) $first = 0;
- $form->addElement(form_makeOpenTag('div', array('class' => 'pagenav-prev')));
- $form->addElement(form_makeTag('input', array(
- 'type' => 'submit',
- 'name' => 'first['.$first.']',
- 'value' => $lang['btn_newer'],
- 'accesskey' => 'n',
- 'title' => $lang['btn_newer'].' [N]',
- 'class' => 'button'
- )));
- $form->addElement(form_makeCloseTag('div'));
- }
- if ($hasNext) {
- $form->addElement(form_makeOpenTag('div', array('class' => 'pagenav-next')));
- $form->addElement(form_makeTag('input', array(
- 'type' => 'submit',
- 'name' => 'first['.$last.']',
- 'value' => $lang['btn_older'],
- 'accesskey' => 'p',
- 'title' => $lang['btn_older'].' [P]',
- 'class' => 'button'
- )));
- $form->addElement(form_makeCloseTag('div'));
- }
- $form->addElement(form_makeCloseTag('div'));
- html_form('recent', $form);
+ html_form('recent', $form);
}
/**
@@ -685,26 +685,26 @@ function html_recent($first=0){
* @author Andreas Gohr <andi@splitbrain.org>
*/
function html_index($ns){
- require_once(DOKU_INC.'inc/search.php');
- global $conf;
- global $ID;
- $dir = $conf['datadir'];
- $ns = cleanID($ns);
- #fixme use appropriate function
- if(empty($ns)){
- $ns = dirname(str_replace(':','/',$ID));
- if($ns == '.') $ns ='';
- }
- $ns = utf8_encodeFN(str_replace(':','/',$ns));
-
- echo p_locale_xhtml('index');
- echo '<div id="index__tree">';
-
- $data = array();
- search($data,$conf['datadir'],'search_index',array('ns' => $ns));
- echo html_buildlist($data,'idx','html_list_index','html_li_index');
-
- echo '</div>';
+ require_once(DOKU_INC.'inc/search.php');
+ global $conf;
+ global $ID;
+ $dir = $conf['datadir'];
+ $ns = cleanID($ns);
+ #fixme use appropriate function
+ if(empty($ns)){
+ $ns = dirname(str_replace(':','/',$ID));
+ if($ns == '.') $ns ='';
+ }
+ $ns = utf8_encodeFN(str_replace(':','/',$ns));
+
+ echo p_locale_xhtml('index');
+ echo '<div id="index__tree">';
+
+ $data = array();
+ search($data,$conf['datadir'],'search_index',array('ns' => $ns));
+ echo html_buildlist($data,'idx','html_list_index','html_li_index');
+
+ echo '</div>';
}
/**
@@ -715,18 +715,18 @@ function html_index($ns){
* @author Andreas Gohr <andi@splitbrain.org>
*/
function html_list_index($item){
- global $ID;
- $ret = '';
- $base = ':'.$item['id'];
- $base = substr($base,strrpos($base,':')+1);
- if($item['type']=='d'){
- $ret .= '<a href="'.wl($ID,'idx='.rawurlencode($item['id'])).'" class="idx_dir"><strong>';
- $ret .= $base;
- $ret .= '</strong></a>';
- }else{
- $ret .= html_wikilink(':'.$item['id']);
- }
- return $ret;
+ global $ID;
+ $ret = '';
+ $base = ':'.$item['id'];
+ $base = substr($base,strrpos($base,':')+1);
+ if($item['type']=='d'){
+ $ret .= '<a href="'.wl($ID,'idx='.rawurlencode($item['id'])).'" class="idx_dir"><strong>';
+ $ret .= $base;
+ $ret .= '</strong></a>';
+ }else{
+ $ret .= html_wikilink(':'.$item['id']);
+ }
+ return $ret;
}
/**
@@ -739,13 +739,13 @@ function html_list_index($item){
* @author Andreas Gohr <andi@splitbrain.org>
*/
function html_li_index($item){
- if($item['type'] == "f"){
- return '<li class="level'.$item['level'].'">';
- }elseif($item['open']){
- return '<li class="open">';
- }else{
- return '<li class="closed">';
- }
+ if($item['type'] == "f"){
+ return '<li class="level'.$item['level'].'">';
+ }elseif($item['open']){
+ return '<li class="open">';
+ }else{
+ return '<li class="closed">';
+ }
}
/**
@@ -754,7 +754,7 @@ function html_li_index($item){
* @author Andreas Gohr <andi@splitbrain.org>
*/
function html_li_default($item){
- return '<li class="level'.$item['level'].'">';
+ return '<li class="level'.$item['level'].'">';
}
/**
@@ -773,47 +773,47 @@ function html_li_default($item){
* @author Andreas Gohr <andi@splitbrain.org>
*/
function html_buildlist($data,$class,$func,$lifunc='html_li_default'){
- $level = 0;
- $opens = 0;
- $ret = '';
-
- foreach ($data as $item){
-
- if( $item['level'] > $level ){
- //open new list
- for($i=0; $i<($item['level'] - $level); $i++){
- if ($i) $ret .= "<li class=\"clear\">\n";
- $ret .= "\n<ul class=\"$class\">\n";
- }
- }elseif( $item['level'] < $level ){
- //close last item
- $ret .= "</li>\n";
- for ($i=0; $i<($level - $item['level']); $i++){
- //close higher lists
- $ret .= "</ul>\n</li>\n";
- }
- }else{
- //close last item
- $ret .= "</li>\n";
- }
+ $level = 0;
+ $opens = 0;
+ $ret = '';
+
+ foreach ($data as $item){
+
+ if( $item['level'] > $level ){
+ //open new list
+ for($i=0; $i<($item['level'] - $level); $i++){
+ if ($i) $ret .= "<li class=\"clear\">\n";
+ $ret .= "\n<ul class=\"$class\">\n";
+ }
+ }elseif( $item['level'] < $level ){
+ //close last item
+ $ret .= "</li>\n";
+ for ($i=0; $i<($level - $item['level']); $i++){
+ //close higher lists
+ $ret .= "</ul>\n</li>\n";
+ }
+ }else{
+ //close last item
+ $ret .= "</li>\n";
+ }
- //remember current level
- $level = $item['level'];
+ //remember current level
+ $level = $item['level'];
- //print item
- $ret .= call_user_func($lifunc,$item);
- $ret .= '<div class="li">';
+ //print item
+ $ret .= call_user_func($lifunc,$item);
+ $ret .= '<div class="li">';
- $ret .= call_user_func($func,$item);
- $ret .= '</div>';
- }
+ $ret .= call_user_func($func,$item);
+ $ret .= '</div>';
+ }
- //close remaining items and lists
- for ($i=0; $i < $level; $i++){
- $ret .= "</li></ul>\n";
- }
+ //close remaining items and lists
+ for ($i=0; $i < $level; $i++){
+ $ret .= "</li></ul>\n";
+ }
- return $ret;
+ return $ret;
}
/**
@@ -823,26 +823,26 @@ function html_buildlist($data,$class,$func,$lifunc='html_li_default'){
* @author Michael Klier <chi@chimeric.de>
*/
function html_backlinks(){
- require_once(DOKU_INC.'inc/fulltext.php');
- global $ID;
- global $conf;
- global $lang;
-
- print p_locale_xhtml('backlinks');
-
- $data = ft_backlinks($ID);
-
- if(!empty($data)) {
- print '<ul class="idx">';
- foreach($data as $blink){
- print '<li><div class="li">';
- print html_wikilink(':'.$blink,useHeading('navigation')?NULL:$blink);
- print '</div></li>';
- }
- print '</ul>';
- } else {
- print '<div class="level1"><p>' . $lang['nothingfound'] . '</p></div>';
- }
+ require_once(DOKU_INC.'inc/fulltext.php');
+ global $ID;
+ global $conf;
+ global $lang;
+
+ print p_locale_xhtml('backlinks');
+
+ $data = ft_backlinks($ID);
+
+ if(!empty($data)) {
+ print '<ul class="idx">';
+ foreach($data as $blink){
+ print '<li><div class="li">';
+ print html_wikilink(':'.$blink,useHeading('navigation')?null:$blink);
+ print '</div></li>';
+ }
+ print '</ul>';
+ } else {
+ print '<div class="level1"><p>' . $lang['nothingfound'] . '</p></div>';
+ }
}
/**
@@ -851,132 +851,140 @@ function html_backlinks(){
* @author Andreas Gohr <andi@splitbrain.org>
*/
function html_diff($text='',$intro=true){
- require_once(DOKU_INC.'inc/DifferenceEngine.php');
- global $ID;
- global $REV;
- global $lang;
- global $conf;
-
- // we're trying to be clever here, revisions to compare can be either
- // given as rev and rev2 parameters, with rev2 being optional. Or in an
- // array in rev2.
- $rev1 = $REV;
-
- if(is_array($_REQUEST['rev2'])){
- $rev1 = (int) $_REQUEST['rev2'][0];
- $rev2 = (int) $_REQUEST['rev2'][1];
-
- if(!$rev1){
- $rev1 = $rev2;
- unset($rev2);
- }
- }else{
- $rev2 = (int) $_REQUEST['rev2'];
- }
-
- if($text){ // compare text to the most current revision
- $l_rev = '';
- $l_text = rawWiki($ID,'');
- $l_head = '<a class="wikilink1" href="'.wl($ID).'">'.
- $ID.' '.dformat((int) @filemtime(wikiFN($ID))).'</a> '.
- $lang['current'];
-
- $r_rev = '';
- $r_text = cleanText($text);
- $r_head = $lang['yours'];
- }else{
- if($rev1 && $rev2){ // two specific revisions wanted
- // make sure order is correct (older on the left)
- if($rev1 < $rev2){
- $l_rev = $rev1;
- $r_rev = $rev2;
- }else{
- $l_rev = $rev2;
- $r_rev = $rev1;
- }
- }elseif($rev1){ // single revision given, compare to current
- $r_rev = '';
- $l_rev = $rev1;
- }else{ // no revision was given, compare previous to current
- $r_rev = '';
- $revs = getRevisions($ID, 0, 1);
- $l_rev = $revs[0];
- $REV = $l_rev; // store revision back in $REV
- }
+ require_once(DOKU_INC.'inc/DifferenceEngine.php');
+ global $ID;
+ global $REV;
+ global $lang;
+ global $conf;
- // when both revisions are empty then the page was created just now
- if(!$l_rev && !$r_rev){
- $l_text = '';
- }else{
- $l_text = rawWiki($ID,$l_rev);
- }
- $r_text = rawWiki($ID,$r_rev);
+ // we're trying to be clever here, revisions to compare can be either
+ // given as rev and rev2 parameters, with rev2 being optional. Or in an
+ // array in rev2.
+ $rev1 = $REV;
+ if(is_array($_REQUEST['rev2'])){
+ $rev1 = (int) $_REQUEST['rev2'][0];
+ $rev2 = (int) $_REQUEST['rev2'][1];
- if(!$l_rev){
- $l_head = '&mdash;';
+ if(!$rev1){
+ $rev1 = $rev2;
+ unset($rev2);
+ }
}else{
- $l_info = getRevisionInfo($ID,$l_rev,true);
- if($l_info['user']){ $l_user = editorinfo($l_info['user']);
- if(auth_ismanager()) $l_user .= ' ('.$l_info['ip'].')';
- } else { $l_user = $l_info['ip']; }
- $l_user = '<span class="user">'.$l_user.'</span>';
- $l_sum = ($l_info['sum']) ? '<span class="sum">'.hsc($l_info['sum']).'</span>' : '';
- if ($l_info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) $l_minor = 'class="minor"';
-
- $l_head = '<a class="wikilink1" href="'.wl($ID,"rev=$l_rev").'">'.
- $ID.' ['.dformat($l_rev).']</a>'.
- '<br />'.$l_user.' '.$l_sum;
+ $rev2 = (int) $_REQUEST['rev2'];
}
- if($r_rev){
- $r_info = getRevisionInfo($ID,$r_rev,true);
- if($r_info['user']){ $r_user = editorinfo($r_info['user']);
- if(auth_ismanager()) $r_user .= ' ('.$r_info['ip'].')';
- } else { $r_user = $r_info['ip']; }
- $r_user = '<span class="user">'.$r_user.'</span>';
- $r_sum = ($r_info['sum']) ? '<span class="sum">'.hsc($r_info['sum']).'</span>' : '';
- if ($r_info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) $r_minor = 'class="minor"';
-
- $r_head = '<a class="wikilink1" href="'.wl($ID,"rev=$r_rev").'">'.
- $ID.' ['.dformat($r_rev).']</a>'.
- '<br />'.$r_user.' '.$r_sum;
- }elseif($_rev = @filemtime(wikiFN($ID))){
- $_info = getRevisionInfo($ID,$_rev,true);
- if($_info['user']){ $_user = editorinfo($_info['user']);
- if(auth_ismanager()) $_user .= ' ('.$_info['ip'].')';
- } else { $_user = $_info['ip']; }
- $_user = '<span class="user">'.$_user.'</span>';
- $_sum = ($_info['sum']) ? '<span class="sum">'.hsc($_info['sum']).'</span>' : '';
- if ($_info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) $r_minor = 'class="minor"';
-
- $r_head = '<a class="wikilink1" href="'.wl($ID).'">'.
- $ID.' ['.dformat($_rev).']</a> '.
- '('.$lang['current'].')'.
- '<br />'.$_user.' '.$_sum;
+ if($text){ // compare text to the most current revision
+ $l_rev = '';
+ $l_text = rawWiki($ID,'');
+ $l_head = '<a class="wikilink1" href="'.wl($ID).'">'.
+ $ID.' '.dformat((int) @filemtime(wikiFN($ID))).'</a> '.
+ $lang['current'];
+
+ $r_rev = '';
+ $r_text = cleanText($text);
+ $r_head = $lang['yours'];
}else{
- $r_head = '&mdash; ('.$lang['current'].')';
+ if($rev1 && $rev2){ // two specific revisions wanted
+ // make sure order is correct (older on the left)
+ if($rev1 < $rev2){
+ $l_rev = $rev1;
+ $r_rev = $rev2;
+ }else{
+ $l_rev = $rev2;
+ $r_rev = $rev1;
+ }
+ }elseif($rev1){ // single revision given, compare to current
+ $r_rev = '';
+ $l_rev = $rev1;
+ }else{ // no revision was given, compare previous to current
+ $r_rev = '';
+ $revs = getRevisions($ID, 0, 1);
+ $l_rev = $revs[0];
+ $REV = $l_rev; // store revision back in $REV
+ }
+
+ // when both revisions are empty then the page was created just now
+ if(!$l_rev && !$r_rev){
+ $l_text = '';
+ }else{
+ $l_text = rawWiki($ID,$l_rev);
+ }
+ $r_text = rawWiki($ID,$r_rev);
+
+ if(!$l_rev){
+ $l_head = '&mdash;';
+ }else{
+ $l_info = getRevisionInfo($ID,$l_rev,true);
+ if($l_info['user']){
+ $l_user = editorinfo($l_info['user']);
+ if(auth_ismanager()) $l_user .= ' ('.$l_info['ip'].')';
+ } else {
+ $l_user = $l_info['ip'];
+ }
+ $l_user = '<span class="user">'.$l_user.'</span>';
+ $l_sum = ($l_info['sum']) ? '<span class="sum">'.hsc($l_info['sum']).'</span>' : '';
+ if ($l_info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) $l_minor = 'class="minor"';
+
+ $l_head = '<a class="wikilink1" href="'.wl($ID,"rev=$l_rev").'">'.
+ $ID.' ['.dformat($l_rev).']</a>'.
+ '<br />'.$l_user.' '.$l_sum;
+ }
+
+ if($r_rev){
+ $r_info = getRevisionInfo($ID,$r_rev,true);
+ if($r_info['user']){
+ $r_user = editorinfo($r_info['user']);
+ if(auth_ismanager()) $r_user .= ' ('.$r_info['ip'].')';
+ } else {
+ $r_user = $r_info['ip'];
+ }
+ $r_user = '<span class="user">'.$r_user.'</span>';
+ $r_sum = ($r_info['sum']) ? '<span class="sum">'.hsc($r_info['sum']).'</span>' : '';
+ if ($r_info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) $r_minor = 'class="minor"';
+
+ $r_head = '<a class="wikilink1" href="'.wl($ID,"rev=$r_rev").'">'.
+ $ID.' ['.dformat($r_rev).']</a>'.
+ '<br />'.$r_user.' '.$r_sum;
+ }elseif($_rev = @filemtime(wikiFN($ID))){
+ $_info = getRevisionInfo($ID,$_rev,true);
+ if($_info['user']){
+ $_user = editorinfo($_info['user']);
+ if(auth_ismanager()) $_user .= ' ('.$_info['ip'].')';
+ } else {
+ $_user = $_info['ip'];
+ }
+ $_user = '<span class="user">'.$_user.'</span>';
+ $_sum = ($_info['sum']) ? '<span class="sum">'.hsc($_info['sum']).'</span>' : '';
+ if ($_info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) $r_minor = 'class="minor"';
+
+ $r_head = '<a class="wikilink1" href="'.wl($ID).'">'.
+ $ID.' ['.dformat($_rev).']</a> '.
+ '('.$lang['current'].')'.
+ '<br />'.$_user.' '.$_sum;
+ }else{
+ $r_head = '&mdash; ('.$lang['current'].')';
+ }
}
- }
- $df = new Diff(explode("\n",htmlspecialchars($l_text)),
- explode("\n",htmlspecialchars($r_text)));
+ $df = new Diff(explode("\n",htmlspecialchars($l_text)),
+ explode("\n",htmlspecialchars($r_text)));
- $tdf = new TableDiffFormatter();
- if($intro) print p_locale_xhtml('diff');
- ?>
+ $tdf = new TableDiffFormatter();
+ if($intro) print p_locale_xhtml('diff');
+ ?>
<table class="diff">
- <tr>
- <th colspan="2" <?php echo $l_minor?>>
- <?php echo $l_head?>
- </th>
- <th colspan="2" <?php echo $r_minor?>>
- <?php echo $r_head?>
- </th>
- </tr>
- <?php echo $tdf->format($df)?>
+ <tr>
+ <th colspan="2" <?php echo $l_minor?>>
+ <?php echo $l_head?>
+ </th>
+ <th colspan="2" <?php echo $r_minor?>>
+ <?php echo $r_head?>
+ </th>
+ </tr>
+ <?php echo $tdf->format($df)?>
</table>
- <?php
+ <?php
}
/**
@@ -985,18 +993,18 @@ function html_diff($text='',$intro=true){
* @author Andreas Gohr <andi@splitbrain.org>
*/
function html_conflict($text,$summary){
- global $ID;
- global $lang;
-
- print p_locale_xhtml('conflict');
- $form = new Doku_Form('dw__editform');
- $form->addHidden('id', $ID);
- $form->addHidden('wikitext', $text);
- $form->addHidden('summary', $summary);
- $form->addElement(form_makeButton('submit', 'save', $lang['btn_save'], array('accesskey'=>'s')));
- $form->addElement(form_makeButton('submit', 'cancel', $lang['btn_cancel']));
- html_form('conflict', $form);
- print '<br /><br /><br /><br />'.NL;
+ global $ID;
+ global $lang;
+
+ print p_locale_xhtml('conflict');
+ $form = new Doku_Form('dw__editform');
+ $form->addHidden('id', $ID);
+ $form->addHidden('wikitext', $text);
+ $form->addHidden('summary', $summary);
+ $form->addElement(form_makeButton('submit', 'save', $lang['btn_save'], array('accesskey'=>'s')));
+ $form->addElement(form_makeButton('submit', 'cancel', $lang['btn_cancel']));
+ html_form('conflict', $form);
+ print '<br /><br /><br /><br />'.NL;
}
/**
@@ -1025,28 +1033,28 @@ function html_msgarea(){
* @author Andreas Gohr <andi@splitbrain.org>
*/
function html_register(){
- global $lang;
- global $conf;
- global $ID;
-
- print p_locale_xhtml('register');
- print '<div class="centeralign">'.NL;
- $form = new Doku_Form('dw__register', wl($ID));
- $form->startFieldset($lang['register']);
- $form->addHidden('do', 'register');
- $form->addHidden('save', '1');
- $form->addElement(form_makeTextField('login', $_POST['login'], $lang['user'], null, 'block', array('size'=>'50')));
- if (!$conf['autopasswd']) {
- $form->addElement(form_makePasswordField('pass', $lang['pass'], '', 'block', array('size'=>'50')));
- $form->addElement(form_makePasswordField('passchk', $lang['passchk'], '', 'block', array('size'=>'50')));
- }
- $form->addElement(form_makeTextField('fullname', $_POST['fullname'], $lang['fullname'], '', 'block', array('size'=>'50')));
- $form->addElement(form_makeTextField('email', $_POST['email'], $lang['email'], '', 'block', array('size'=>'50')));
- $form->addElement(form_makeButton('submit', '', $lang['register']));
- $form->endFieldset();
- html_form('register', $form);
-
- print '</div>'.NL;
+ global $lang;
+ global $conf;
+ global $ID;
+
+ print p_locale_xhtml('register');
+ print '<div class="centeralign">'.NL;
+ $form = new Doku_Form('dw__register', wl($ID));
+ $form->startFieldset($lang['register']);
+ $form->addHidden('do', 'register');
+ $form->addHidden('save', '1');
+ $form->addElement(form_makeTextField('login', $_POST['login'], $lang['user'], null, 'block', array('size'=>'50')));
+ if (!$conf['autopasswd']) {
+ $form->addElement(form_makePasswordField('pass', $lang['pass'], '', 'block', array('size'=>'50')));
+ $form->addElement(form_makePasswordField('passchk', $lang['passchk'], '', 'block', array('size'=>'50')));
+ }
+ $form->addElement(form_makeTextField('fullname', $_POST['fullname'], $lang['fullname'], '', 'block', array('size'=>'50')));
+ $form->addElement(form_makeTextField('email', $_POST['email'], $lang['email'], '', 'block', array('size'=>'50')));
+ $form->addElement(form_makeButton('submit', '', $lang['register']));
+ $form->endFieldset();
+ html_form('register', $form);
+
+ print '</div>'.NL;
}
/**
@@ -1056,42 +1064,42 @@ function html_register(){
* @author Andreas Gohr <andi@splitbrain.org>
*/
function html_updateprofile(){
- global $lang;
- global $conf;
- global $ID;
- global $INFO;
- global $auth;
-
- print p_locale_xhtml('updateprofile');
-
- if (empty($_POST['fullname'])) $_POST['fullname'] = $INFO['userinfo']['name'];
- if (empty($_POST['email'])) $_POST['email'] = $INFO['userinfo']['mail'];
- print '<div class="centeralign">'.NL;
- $form = new Doku_Form('dw__register', wl($ID));
- $form->startFieldset($lang['profile']);
- $form->addHidden('do', 'profile');
- $form->addHidden('save', '1');
- $form->addElement(form_makeTextField('fullname', $_SERVER['REMOTE_USER'], $lang['user'], '', 'block', array('size'=>'50', 'disabled'=>'disabled')));
- $attr = array('size'=>'50');
- if (!$auth->canDo('modName')) $attr['disabled'] = 'disabled';
- $form->addElement(form_makeTextField('fullname', $_POST['fullname'], $lang['fullname'], '', 'block', $attr));
- $attr = array('size'=>'50');
- if (!$auth->canDo('modMail')) $attr['disabled'] = 'disabled';
- $form->addElement(form_makeTextField('email', $_POST['email'], $lang['email'], '', 'block', $attr));
- $form->addElement(form_makeTag('br'));
- if ($auth->canDo('modPass')) {
- $form->addElement(form_makePasswordField('newpass', $lang['newpass'], '', 'block', array('size'=>'50')));
- $form->addElement(form_makePasswordField('passchk', $lang['passchk'], '', 'block', array('size'=>'50')));
- }
- if ($conf['profileconfirm']) {
+ global $lang;
+ global $conf;
+ global $ID;
+ global $INFO;
+ global $auth;
+
+ print p_locale_xhtml('updateprofile');
+
+ if (empty($_POST['fullname'])) $_POST['fullname'] = $INFO['userinfo']['name'];
+ if (empty($_POST['email'])) $_POST['email'] = $INFO['userinfo']['mail'];
+ print '<div class="centeralign">'.NL;
+ $form = new Doku_Form('dw__register', wl($ID));
+ $form->startFieldset($lang['profile']);
+ $form->addHidden('do', 'profile');
+ $form->addHidden('save', '1');
+ $form->addElement(form_makeTextField('fullname', $_SERVER['REMOTE_USER'], $lang['user'], '', 'block', array('size'=>'50', 'disabled'=>'disabled')));
+ $attr = array('size'=>'50');
+ if (!$auth->canDo('modName')) $attr['disabled'] = 'disabled';
+ $form->addElement(form_makeTextField('fullname', $_POST['fullname'], $lang['fullname'], '', 'block', $attr));
+ $attr = array('size'=>'50');
+ if (!$auth->canDo('modMail')) $attr['disabled'] = 'disabled';
+ $form->addElement(form_makeTextField('email', $_POST['email'], $lang['email'], '', 'block', $attr));
$form->addElement(form_makeTag('br'));
- $form->addElement(form_makePasswordField('oldpass', $lang['oldpass'], '', 'block', array('size'=>'50')));
- }
- $form->addElement(form_makeButton('submit', '', $lang['btn_save']));
- $form->addElement(form_makeButton('reset', '', $lang['btn_reset']));
- $form->endFieldset();
- html_form('updateprofile', $form);
- print '</div>'.NL;
+ if ($auth->canDo('modPass')) {
+ $form->addElement(form_makePasswordField('newpass', $lang['newpass'], '', 'block', array('size'=>'50')));
+ $form->addElement(form_makePasswordField('passchk', $lang['passchk'], '', 'block', array('size'=>'50')));
+ }
+ if ($conf['profileconfirm']) {
+ $form->addElement(form_makeTag('br'));
+ $form->addElement(form_makePasswordField('oldpass', $lang['oldpass'], '', 'block', array('size'=>'50')));
+ }
+ $form->addElement(form_makeButton('submit', '', $lang['btn_save']));
+ $form->addElement(form_makeButton('reset', '', $lang['btn_reset']));
+ $form->endFieldset();
+ html_form('updateprofile', $form);
+ print '</div>'.NL;
}
/**
@@ -1103,128 +1111,124 @@ function html_updateprofile(){
* @author Andreas Gohr <andi@splitbrain.org>
*/
function html_edit($text=null,$include='edit'){ //FIXME: include needed?
- global $ID;
- global $REV;
- global $DATE;
- global $RANGE;
- global $PRE;
- global $SUF;
- global $INFO;
- global $SUM;
- global $lang;
- global $conf;
- global $license;
-
- //set summary default
- if(!$SUM){
- if($REV){
- $SUM = $lang['restored'];
- }elseif(!$INFO['exists']){
- $SUM = $lang['created'];
+ global $ID;
+ global $REV;
+ global $DATE;
+ global $RANGE;
+ global $PRE;
+ global $SUF;
+ global $INFO;
+ global $SUM;
+ global $lang;
+ global $conf;
+ global $license;
+
+ //set summary default
+ if(!$SUM){
+ if($REV){
+ $SUM = $lang['restored'];
+ }elseif(!$INFO['exists']){
+ $SUM = $lang['created'];
+ }
}
- }
-
- //no text? Load it!
- if(!isset($text)){
- $pr = false; //no preview mode
- if($INFO['exists']){
- if($RANGE){
- list($PRE,$text,$SUF) = rawWikiSlices($RANGE,$ID,$REV);
- }else{
- $text = rawWiki($ID,$REV);
- }
- $check = md5($text);
- $mod = false;
+
+ //no text? Load it!
+ if(!isset($text)){
+ $pr = false; //no preview mode
+ if($INFO['exists']){
+ if($RANGE){
+ list($PRE,$text,$SUF) = rawWikiSlices($RANGE,$ID,$REV);
+ }else{
+ $text = rawWiki($ID,$REV);
+ }
+ $check = md5($text);
+ $mod = false;
+ }else{
+ //try to load a pagetemplate
+ $data = array($ID);
+ $text = trigger_event('HTML_PAGE_FROMTEMPLATE',$data,'pageTemplate',true);
+ $check = md5('');
+ $mod = $text!=='';
+ }
}else{
- //try to load a pagetemplate
- $data = array($ID);
- $text = trigger_event('HTML_PAGE_FROMTEMPLATE',$data,'pageTemplate',true);
- $check = md5('');
- $mod = $text!=='';
- }
- }else{
- $pr = true; //preview mode
- if (isset($_REQUEST['changecheck'])) {
- $check = $_REQUEST['changecheck'];
- $mod = md5($text)!==$check;
- } else {
- // Why? Assume default text is unmodified.
- $check = md5($text);
- $mod = false;
+ $pr = true; //preview mode
+ if (isset($_REQUEST['changecheck'])) {
+ $check = $_REQUEST['changecheck'];
+ $mod = md5($text)!==$check;
+ } else {
+ // Why? Assume default text is unmodified.
+ $check = md5($text);
+ $mod = false;
+ }
}
- }
-
- $wr = $INFO['writable'] && !$INFO['locked'];
- if($wr){
- if ($REV) print p_locale_xhtml('editrev');
- print p_locale_xhtml($include);
- }else{
- // check pseudo action 'source'
- if(!actionOK('source')){
- msg('Command disabled: source',-1);
- return;
+
+ $wr = $INFO['writable'] && !$INFO['locked'];
+ if($wr){
+ if ($REV) print p_locale_xhtml('editrev');
+ print p_locale_xhtml($include);
+ }else{
+ // check pseudo action 'source'
+ if(!actionOK('source')){
+ msg('Command disabled: source',-1);
+ return;
+ }
+ print p_locale_xhtml('read');
}
- print p_locale_xhtml('read');
- }
- if(!$DATE) $DATE = $INFO['lastmod'];
-
-
-?>
- <div style="width:99%;">
-
- <div class="toolbar">
- <div id="draft__status"><?php if(!empty($INFO['draft'])) echo $lang['draftdate'].' '.dformat();?></div>
- <div id="tool__bar"><?php if($wr){?><a href="<?php echo DOKU_BASE?>lib/exe/mediamanager.php?ns=<?php echo $INFO['namespace']?>"
- target="_blank"><?php echo $lang['mediaselect'] ?></a><?php }?></div>
-
- <?php if($wr){?>
- <script type="text/javascript" charset="utf-8"><!--//--><![CDATA[//><!--
- <?php /* sets changed to true when previewed */?>
- textChanged = <?php ($mod) ? print 'true' : print 'false' ?>;
- //--><!]]></script>
- <span id="spell__action"></span>
- <div id="spell__suggest"></div>
- <?php } ?>
- </div>
- <div id="spell__result"></div>
-<?php
- $form = new Doku_Form('dw__editform');
- $form->addHidden('id', $ID);
- $form->addHidden('rev', $REV);
- $form->addHidden('date', $DATE);
- $form->addHidden('prefix', $PRE);
- $form->addHidden('suffix', $SUF);
- $form->addHidden('changecheck', $check);
- $attr = array('tabindex'=>'1');
- if (!$wr) $attr['readonly'] = 'readonly';
- $form->addElement(form_makeWikiText($text, $attr));
- $form->addElement(form_makeOpenTag('div', array('id'=>'wiki__editbar')));
- $form->addElement(form_makeOpenTag('div', array('id'=>'size__ctl')));
- $form->addElement(form_makeCloseTag('div'));
- if ($wr) {
- $form->addElement(form_makeOpenTag('div', array('class'=>'editButtons')));
- $form->addElement(form_makeButton('submit', 'save', $lang['btn_save'], array('id'=>'edbtn__save', 'accesskey'=>'s', 'tabindex'=>'4')));
- $form->addElement(form_makeButton('submit', 'preview', $lang['btn_preview'], array('id'=>'edbtn__preview', 'accesskey'=>'p', 'tabindex'=>'5')));
- $form->addElement(form_makeButton('submit', 'draftdel', $lang['btn_cancel'], array('tabindex'=>'6')));
- $form->addElement(form_makeCloseTag('div'));
- $form->addElement(form_makeOpenTag('div', array('class'=>'summary')));
- $form->addElement(form_makeTextField('summary', $SUM, $lang['summary'], 'edit__summary', 'nowrap', array('size'=>'50', 'tabindex'=>'2')));
- $elem = html_minoredit();
- if ($elem) $form->addElement($elem);
- $form->addElement(form_makeCloseTag('div'));
- }
- $form->addElement(form_makeCloseTag('div'));
- if($conf['license']){
- $form->addElement(form_makeOpenTag('div', array('class'=>'license')));
- $out = $lang['licenseok'];
- $out .= '<a href="'.$license[$conf['license']]['url'].'" rel="license" class="urlextern"';
- if($conf['target']['external']) $out .= ' target="'.$conf['target']['external'].'"';
- $out .= '> '.$license[$conf['license']]['name'].'</a>';
- $form->addElement($out);
- $form->addElement(form_makeCloseTag('div'));
- }
- html_form('edit', $form);
- print '</div>'.NL;
+ if(!$DATE) $DATE = $INFO['lastmod'];
+ ?>
+ <div style="width:99%;">
+
+ <div class="toolbar">
+ <div id="draft__status"><?php if(!empty($INFO['draft'])) echo $lang['draftdate'].' '.dformat();?></div>
+ <div id="tool__bar"><?php if($wr){?><a href="<?php echo DOKU_BASE?>lib/exe/mediamanager.php?ns=<?php echo $INFO['namespace']?>"
+ target="_blank"><?php echo $lang['mediaselect'] ?></a><?php }?></div>
+
+ <?php if($wr){?>
+ <script type="text/javascript" charset="utf-8"><!--//--><![CDATA[//><!--
+ <?php /* sets changed to true when previewed */?>
+ textChanged = <?php ($mod) ? print 'true' : print 'false' ?>;
+ //--><!]]></script>
+ <span id="spell__action"></span>
+ <?php } ?>
+ </div>
+ <?php
+ $form = new Doku_Form('dw__editform');
+ $form->addHidden('id', $ID);
+ $form->addHidden('rev', $REV);
+ $form->addHidden('date', $DATE);
+ $form->addHidden('prefix', $PRE);
+ $form->addHidden('suffix', $SUF);
+ $form->addHidden('changecheck', $check);
+ $attr = array('tabindex'=>'1');
+ if (!$wr) $attr['readonly'] = 'readonly';
+ $form->addElement(form_makeWikiText($text, $attr));
+ $form->addElement(form_makeOpenTag('div', array('id'=>'wiki__editbar')));
+ $form->addElement(form_makeOpenTag('div', array('id'=>'size__ctl')));
+ $form->addElement(form_makeCloseTag('div'));
+ if ($wr) {
+ $form->addElement(form_makeOpenTag('div', array('class'=>'editButtons')));
+ $form->addElement(form_makeButton('submit', 'save', $lang['btn_save'], array('id'=>'edbtn__save', 'accesskey'=>'s', 'tabindex'=>'4')));
+ $form->addElement(form_makeButton('submit', 'preview', $lang['btn_preview'], array('id'=>'edbtn__preview', 'accesskey'=>'p', 'tabindex'=>'5')));
+ $form->addElement(form_makeButton('submit', 'draftdel', $lang['btn_cancel'], array('tabindex'=>'6')));
+ $form->addElement(form_makeCloseTag('div'));
+ $form->addElement(form_makeOpenTag('div', array('class'=>'summary')));
+ $form->addElement(form_makeTextField('summary', $SUM, $lang['summary'], 'edit__summary', 'nowrap', array('size'=>'50', 'tabindex'=>'2')));
+ $elem = html_minoredit();
+ if ($elem) $form->addElement($elem);
+ $form->addElement(form_makeCloseTag('div'));
+ }
+ $form->addElement(form_makeCloseTag('div'));
+ if($conf['license']){
+ $form->addElement(form_makeOpenTag('div', array('class'=>'license')));
+ $out = $lang['licenseok'];
+ $out .= '<a href="'.$license[$conf['license']]['url'].'" rel="license" class="urlextern"';
+ if($conf['target']['external']) $out .= ' target="'.$conf['target']['external'].'"';
+ $out .= '> '.$license[$conf['license']]['name'].'</a>';
+ $form->addElement($out);
+ $form->addElement(form_makeCloseTag('div'));
+ }
+ html_form('edit', $form);
+ print '</div>'.NL;
}
/**
@@ -1233,17 +1237,17 @@ function html_edit($text=null,$include='edit'){ //FIXME: include needed?
* @author Andrea Gohr <andi@splitbrain.org>
*/
function html_minoredit(){
- global $conf;
- global $lang;
- // minor edits are for logged in users only
- if(!$conf['useacl'] || !$_SERVER['REMOTE_USER']){
- return false;
- }
-
- $p = array();
- $p['tabindex'] = 3;
- if(!empty($_REQUEST['minor'])) $p['checked']='checked';
- return form_makeCheckboxField('minor', '1', $lang['minoredit'], 'minoredit', 'nowrap', $p);
+ global $conf;
+ global $lang;
+ // minor edits are for logged in users only
+ if(!$conf['useacl'] || !$_SERVER['REMOTE_USER']){
+ return false;
+ }
+
+ $p = array();
+ $p['tabindex'] = 3;
+ if(!empty($_REQUEST['minor'])) $p['checked']='checked';
+ return form_makeCheckboxField('minor', '1', $lang['minoredit'], 'minoredit', 'nowrap', $p);
}
/**
@@ -1252,81 +1256,81 @@ function html_minoredit(){
* @author Andreas Gohr <andi@splitbrain.org>
*/
function html_debug(){
- global $conf;
- global $lang;
- global $auth;
- global $INFO;
-
- //remove sensitive data
- $cnf = $conf;
- debug_guard($cnf);
- $nfo = $INFO;
- debug_guard($nfo);
- $ses = $_SESSION;
- debug_guard($ses);
-
- print '<html><body>';
-
- print '<p>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</p>';
-
- print '<b>$INFO:</b><pre>';
- print_r($nfo);
- print '</pre>';
-
- print '<b>$_SERVER:</b><pre>';
- print_r($_SERVER);
- print '</pre>';
-
- print '<b>$conf:</b><pre>';
- print_r($cnf);
- print '</pre>';
-
- print '<b>DOKU_BASE:</b><pre>';
- print DOKU_BASE;
- print '</pre>';
-
- print '<b>abs DOKU_BASE:</b><pre>';
- print DOKU_URL;
- print '</pre>';
-
- print '<b>rel DOKU_BASE:</b><pre>';
- print dirname($_SERVER['PHP_SELF']).'/';
- print '</pre>';
-
- print '<b>PHP Version:</b><pre>';
- print phpversion();
- print '</pre>';
-
- print '<b>locale:</b><pre>';
- print setlocale(LC_ALL,0);
- print '</pre>';
-
- print '<b>encoding:</b><pre>';
- print $lang['encoding'];
- print '</pre>';
-
- if($auth){
- print '<b>Auth backend capabilities:</b><pre>';
- print_r($auth->cando);
+ global $conf;
+ global $lang;
+ global $auth;
+ global $INFO;
+
+ //remove sensitive data
+ $cnf = $conf;
+ debug_guard($cnf);
+ $nfo = $INFO;
+ debug_guard($nfo);
+ $ses = $_SESSION;
+ debug_guard($ses);
+
+ print '<html><body>';
+
+ print '<p>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</p>';
+
+ print '<b>$INFO:</b><pre>';
+ print_r($nfo);
+ print '</pre>';
+
+ print '<b>$_SERVER:</b><pre>';
+ print_r($_SERVER);
+ print '</pre>';
+
+ print '<b>$conf:</b><pre>';
+ print_r($cnf);
+ print '</pre>';
+
+ print '<b>DOKU_BASE:</b><pre>';
+ print DOKU_BASE;
+ print '</pre>';
+
+ print '<b>abs DOKU_BASE:</b><pre>';
+ print DOKU_URL;
+ print '</pre>';
+
+ print '<b>rel DOKU_BASE:</b><pre>';
+ print dirname($_SERVER['PHP_SELF']).'/';
print '</pre>';
- }
- print '<b>$_SESSION:</b><pre>';
- print_r($ses);
- print '</pre>';
+ print '<b>PHP Version:</b><pre>';
+ print phpversion();
+ print '</pre>';
+
+ print '<b>locale:</b><pre>';
+ print setlocale(LC_ALL,0);
+ print '</pre>';
+
+ print '<b>encoding:</b><pre>';
+ print $lang['encoding'];
+ print '</pre>';
+
+ if($auth){
+ print '<b>Auth backend capabilities:</b><pre>';
+ print_r($auth->cando);
+ print '</pre>';
+ }
+
+ print '<b>$_SESSION:</b><pre>';
+ print_r($ses);
+ print '</pre>';
- print '<b>Environment:</b><pre>';
- print_r($_ENV);
- print '</pre>';
+ print '<b>Environment:</b><pre>';
+ print_r($_ENV);
+ print '</pre>';
- print '<b>PHP settings:</b><pre>';
- $inis = ini_get_all();
- print_r($inis);
- print '</pre>';
+ print '<b>PHP settings:</b><pre>';
+ $inis = ini_get_all();
+ print_r($inis);
+ print '</pre>';
- print '</body></html>';
+ print '</body></html>';
}
/**
@@ -1346,15 +1350,15 @@ function html_admin(){
$pluginlist = plugin_list('admin');
$menu = array();
foreach ($pluginlist as $p) {
- if($obj =& plugin_load('admin',$p) === NULL) continue;
+ if($obj =& plugin_load('admin',$p) === null) continue;
// check permissions
if($obj->forAdminOnly() && !$INFO['isadmin']) continue;
$menu[$p] = array('plugin' => $p,
- 'prompt' => $obj->getMenuText($conf['lang']),
- 'sort' => $obj->getMenuSort()
- );
+ 'prompt' => $obj->getMenuText($conf['lang']),
+ 'sort' => $obj->getMenuSort()
+ );
}
print p_locale_xhtml('admin');
@@ -1412,7 +1416,6 @@ function html_admin(){
ptln('</ul>');
-
// print the rest as sorted list
if(count($menu)){
usort($menu, 'p_sort_modes');
@@ -1434,24 +1437,24 @@ function html_admin(){
* @author Benoit Chesneau <benoit@bchesneau.info>
*/
function html_resendpwd() {
- global $lang;
- global $conf;
- global $ID;
-
- print p_locale_xhtml('resendpwd');
- print '<div class="centeralign">'.NL;
- $form = new Doku_Form('dw__resendpwd', wl($ID));
- $form->startFieldset($lang['resendpwd']);
- $form->addHidden('do', 'resendpwd');
- $form->addHidden('save', '1');
- $form->addElement(form_makeTag('br'));
- $form->addElement(form_makeTextField('login', $_POST['login'], $lang['user'], '', 'block'));
- $form->addElement(form_makeTag('br'));
- $form->addElement(form_makeTag('br'));
- $form->addElement(form_makeButton('submit', '', $lang['btn_resendpwd']));
- $form->endFieldset();
- html_form('resendpwd', $form);
- print '</div>'.NL;
+ global $lang;
+ global $conf;
+ global $ID;
+
+ print p_locale_xhtml('resendpwd');
+ print '<div class="centeralign">'.NL;
+ $form = new Doku_Form('dw__resendpwd', wl($ID));
+ $form->startFieldset($lang['resendpwd']);
+ $form->addHidden('do', 'resendpwd');
+ $form->addHidden('save', '1');
+ $form->addElement(form_makeTag('br'));
+ $form->addElement(form_makeTextField('login', $_POST['login'], $lang['user'], '', 'block'));
+ $form->addElement(form_makeTag('br'));
+ $form->addElement(form_makeTag('br'));
+ $form->addElement(form_makeButton('submit', '', $lang['btn_resendpwd']));
+ $form->endFieldset();
+ html_form('resendpwd', $form);
+ print '</div>'.NL;
}
/**
@@ -1471,7 +1474,8 @@ function html_TOC($toc){
$out .= html_buildlist($toc,'toc','html_list_toc');
$out .= '</div>'.DOKU_LF.'</div>'.DOKU_LF;
$out .= '<!-- TOC END -->'.DOKU_LF;
- return $out; }
+ return $out;
+}
/**
* Callback for html_buildlist
@@ -1484,7 +1488,7 @@ function html_list_toc($item){
}
return '<span class="li"><a href="'.$link.'" class="toc">'.
- hsc($item['title']).'</a></span>';
+ hsc($item['title']).'</a></span>';
}
/**
@@ -1500,9 +1504,9 @@ function html_list_toc($item){
function html_mktocitem($link, $text, $level, $hash='#'){
global $conf;
return array( 'link' => $hash.$link,
- 'title' => $text,
- 'type' => 'ul',
- 'level' => $level);
+ 'title' => $text,
+ 'type' => 'ul',
+ 'level' => $level);
}
/**
@@ -1512,9 +1516,9 @@ function html_mktocitem($link, $text, $level, $hash='#'){
* @author Tom N Harris <tnharris@whoopdedo.org>
*/
function html_form($name, &$form) {
- // Safety check in case the caller forgets.
- $form->endFieldset();
- trigger_event('HTML_'.strtoupper($name).'FORM_OUTPUT', $form, 'html_form_output', false);
+ // Safety check in case the caller forgets.
+ $form->endFieldset();
+ trigger_event('HTML_'.strtoupper($name).'FORM_OUTPUT', $form, 'html_form_output', false);
}
/**
@@ -1522,7 +1526,7 @@ function html_form($name, &$form) {
* Just calls printForm() on the data object.
*/
function html_form_output($data) {
- $data->printForm();
+ $data->printForm();
}
/**
@@ -1602,4 +1606,3 @@ function html_flashobject($swf,$width,$height,$params=null,$flashvars=null,$atts
return $out;
}
-//Setup VIM: ex: et ts=2 enc=utf-8 :