xref: /dokuwiki/inc/html.php (revision 6d233a0c4569a276d9bf1896713009df8b84ecff)
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
9fa8adffeSAndreas Gohrif(!defined('DOKU_INC')) die('meh.');
10e226efe1SAndreas Gohrif(!defined('NL')) define('NL',"\n");
116bbae538Sandirequire_once(DOKU_INC.'inc/parserutils.php');
12fdb8d77bSTom N Harrisrequire_once(DOKU_INC.'inc/form.php');
136bbae538Sandi
14f3f0262cSandi/**
15f3f0262cSandi * Convenience function to quickly build a wikilink
1615fae107Sandi *
1715fae107Sandi * @author Andreas Gohr <andi@splitbrain.org>
18f3f0262cSandi */
1930f1737dSandifunction html_wikilink($id,$name=NULL,$search=''){
20723d78dbSandi  static $xhtml_renderer = NULL;
21723d78dbSandi  if(is_null($xhtml_renderer)){
22fdf3dcb9SMatthias Urlichs    require_once(DOKU_INC.'inc/parser/xhtml.php');
23723d78dbSandi    $xhtml_renderer = new Doku_Renderer_xhtml();
24f3f0262cSandi  }
25f3f0262cSandi
26fe9ec250SChris Smith  return $xhtml_renderer->internallink($id,$name,$search,true,'navigation');
27f3f0262cSandi}
28f3f0262cSandi
29f3f0262cSandi/**
30c19fe9c0Sandi * Helps building long attribute lists
31c19fe9c0Sandi *
32c19fe9c0Sandi * @author Andreas Gohr <andi@splitbrain.org>
33c19fe9c0Sandi */
34c19fe9c0Sandifunction html_attbuild($attributes){
35c19fe9c0Sandi  $ret = '';
36c19fe9c0Sandi  foreach ( $attributes as $key => $value ) {
37c19fe9c0Sandi    $ret .= $key.'="'.formtext($value).'" ';
38c19fe9c0Sandi  }
39c19fe9c0Sandi  return trim($ret);
40c19fe9c0Sandi}
41c19fe9c0Sandi
42c19fe9c0Sandi/**
43f3f0262cSandi * The loginform
4415fae107Sandi *
4515fae107Sandi * @author   Andreas Gohr <andi@splitbrain.org>
46f3f0262cSandi */
47f3f0262cSandifunction html_login(){
48f3f0262cSandi  global $lang;
49f3f0262cSandi  global $conf;
50f3f0262cSandi  global $ID;
51cd52f92dSchris  global $auth;
52f3f0262cSandi
53c112d578Sandi  print p_locale_xhtml('login');
54fdb8d77bSTom N Harris  print '<div class="centeralign">'.NL;
55fdb8d77bSTom N Harris  $form = new Doku_Form('dw__login');
56fdb8d77bSTom N Harris  $form->startFieldset($lang['btn_login']);
57fdb8d77bSTom N Harris  $form->addHidden('id', $ID);
58fdb8d77bSTom N Harris  $form->addHidden('do', 'login');
59aab557e9SGina Haeussge  $form->addElement(form_makeTextField('u', ((!$_REQUEST['http_credentials']) ? $_REQUEST['u'] : ''), $lang['user'], 'focus__this', 'block'));
60fdb8d77bSTom N Harris  $form->addElement(form_makePasswordField('p', $lang['pass'], '', 'block'));
6117f89d7eSMichael Klier  if($conf['rememberme']) {
62fdb8d77bSTom N Harris      $form->addElement(form_makeCheckboxField('r', '1', $lang['remember'], 'remember__me', 'simple'));
6317f89d7eSMichael Klier  }
64fdb8d77bSTom N Harris  $form->addElement(form_makeButton('submit', '', $lang['btn_login']));
65fdb8d77bSTom N Harris  $form->endFieldset();
66fdb8d77bSTom N Harris  html_form('login', $form);
675b62573aSAndreas Gohr
686957b2eaSAndreas Gohr  if($auth && $auth->canDo('addUser') && actionOK('register')){
69f3f0262cSandi    print '<p>';
70f3f0262cSandi    print $lang['reghere'];
711d5856cfSAndreas Gohr    print ': <a href="'.wl($ID,'do=register').'" rel="nofollow" class="wikilink1">'.$lang['register'].'</a>';
72f3f0262cSandi    print '</p>';
73f3f0262cSandi  }
748b06d178Schris
756957b2eaSAndreas Gohr  if ($auth && $auth->canDo('modPass') && actionOK('resendpwd')) {
768b06d178Schris    print '<p>';
778b06d178Schris    print $lang['pwdforget'];
781d5856cfSAndreas Gohr    print ': <a href="'.wl($ID,'do=resendpwd').'" rel="nofollow" class="wikilink1">'.$lang['btn_resendpwd'].'</a>';
798b06d178Schris    print '</p>';
808b06d178Schris  }
81fdb8d77bSTom N Harris  print '</div>'.NL;
82f3f0262cSandi}
83f3f0262cSandi
84f3f0262cSandi/**
8515fae107Sandi * prints a section editing button
8635dae8b0SBen Coburn * used as a callback in html_secedit
8715fae107Sandi *
8815fae107Sandi * @author Andreas Gohr <andi@splitbrain.org>
8915fae107Sandi */
9035dae8b0SBen Coburnfunction html_secedit_button($matches){
91f3f0262cSandi  global $ID;
92041d7a86SBen Coburn  global $INFO;
93041d7a86SBen Coburn
94041d7a86SBen Coburn  $section = $matches[2];
95041d7a86SBen Coburn  $name = $matches[1];
96041d7a86SBen Coburn
97f3f0262cSandi  $secedit  = '';
98f3f0262cSandi  $secedit .= '<div class="secedit">';
99f3f0262cSandi  $secedit .= html_btn('secedit',$ID,'',
100f3f0262cSandi                        array('do'      => 'edit',
101306b2c85SDenis Simakov                              'lines'   => "$section",
102306b2c85SDenis Simakov                              'rev' => $INFO['lastmod']),
10335dae8b0SBen Coburn                              'post', $name);
104f3f0262cSandi  $secedit .= '</div>';
105f3f0262cSandi  return $secedit;
106f3f0262cSandi}
107f3f0262cSandi
10815fae107Sandi/**
10915fae107Sandi * inserts section edit buttons if wanted or removes the markers
11015fae107Sandi *
11115fae107Sandi * @author Andreas Gohr <andi@splitbrain.org>
11215fae107Sandi */
113f3f0262cSandifunction html_secedit($text,$show=true){
114f3f0262cSandi  global $INFO;
11535dae8b0SBen Coburn
116c112d578Sandi  if($INFO['writable'] && $show && !$INFO['rev']){
11735dae8b0SBen Coburn    $text = preg_replace_callback('#<!-- SECTION "(.*?)" \[(\d+-\d*)\] -->#',
11835dae8b0SBen Coburn                         'html_secedit_button', $text);
119f3f0262cSandi  }else{
12035dae8b0SBen Coburn    $text = preg_replace('#<!-- SECTION "(.*?)" \[(\d+-\d*)\] -->#','',$text);
121f3f0262cSandi  }
12235dae8b0SBen Coburn
123f3f0262cSandi  return $text;
124f3f0262cSandi}
125f3f0262cSandi
126f3f0262cSandi/**
127d6c9c552Smatthiasgrimm * Just the back to top button (in its own form)
1286b13307fSandi *
1296b13307fSandi * @author Andreas Gohr <andi@splitbrain.org>
1306b13307fSandi */
1316b13307fSandifunction html_topbtn(){
1326b13307fSandi  global $lang;
1336b13307fSandi
1346b13307fSandi  $ret  = '';
13511ea018fSAndreas Gohr  $ret  = '<a class="nolink" href="#dokuwiki__top"><input type="button" class="button" value="'.$lang['btn_top'].'" onclick="window.scrollTo(0, 0)" title="'.$lang['btn_top'].'" /></a>';
136df7b6005Sandi
1376b13307fSandi  return $ret;
1386b13307fSandi}
1396b13307fSandi
1406b13307fSandi/**
141d67ca2c0Smatthiasgrimm * Displays a button (using its own form)
14235dae8b0SBen Coburn * If tooltip exists, the access key tooltip is replaced.
14315fae107Sandi *
14415fae107Sandi * @author Andreas Gohr <andi@splitbrain.org>
145f3f0262cSandi */
14635dae8b0SBen Coburnfunction html_btn($name,$id,$akey,$params,$method='get',$tooltip=''){
147f3f0262cSandi  global $conf;
148f3f0262cSandi  global $lang;
149f3f0262cSandi
150f3f0262cSandi  $label = $lang['btn_'.$name];
151f3f0262cSandi
152f3f0262cSandi  $ret = '';
15335dae8b0SBen Coburn  $tip = '';
154f3f0262cSandi
15549c713a3Sandi  //filter id (without urlencoding)
15649c713a3Sandi  $id = idfilter($id,false);
157f3f0262cSandi
158f3f0262cSandi  //make nice URLs even for buttons
1596c7843b5Sandi  if($conf['userewrite'] == 2){
1606c7843b5Sandi    $script = DOKU_BASE.DOKU_SCRIPT.'/'.$id;
1616c7843b5Sandi  }elseif($conf['userewrite']){
1626c7843b5Sandi    $script = DOKU_BASE.$id;
1636c7843b5Sandi  }else{
1648b00ebcfSandi    $script = DOKU_BASE.DOKU_SCRIPT;
165f3f0262cSandi    $params['id'] = $id;
166f3f0262cSandi  }
167f3f0262cSandi
168b278f2deSAndreas Gohr  $ret .= '<form class="button btn_'.$name.'" method="'.$method.'" action="'.$script.'"><div class="no">';
169f3f0262cSandi
17006a4bf8fSAndreas Gohr  if(is_array($params)){
171f3f0262cSandi    reset($params);
172f3f0262cSandi    while (list($key, $val) = each($params)) {
173f3f0262cSandi      $ret .= '<input type="hidden" name="'.$key.'" ';
174f3f0262cSandi      $ret .= 'value="'.htmlspecialchars($val).'" />';
175f3f0262cSandi    }
17606a4bf8fSAndreas Gohr  }
177f3f0262cSandi
17835dae8b0SBen Coburn  if ($tooltip!='') {
17935dae8b0SBen Coburn      $tip = htmlspecialchars($tooltip);
18011ea018fSAndreas Gohr  }else{
18111ea018fSAndreas Gohr      $tip = htmlspecialchars($label);
18211ea018fSAndreas Gohr  }
18311ea018fSAndreas Gohr
18411ea018fSAndreas Gohr  $ret .= '<input type="submit" value="'.htmlspecialchars($label).'" class="button" ';
18511ea018fSAndreas Gohr  if($akey){
18607493d05SAnika Henke    $tip .= ' ['.strtoupper($akey).']';
18787cb01b7SAnika Henke    $ret .= 'accesskey="'.$akey.'" ';
18835dae8b0SBen Coburn  }
18935dae8b0SBen Coburn  $ret .= 'title="'.$tip.'" ';
190f3f0262cSandi  $ret .= '/>';
1914beabca9SAnika Henke  $ret .= '</div></form>';
192f3f0262cSandi
193f3f0262cSandi  return $ret;
194f3f0262cSandi}
195f3f0262cSandi
196f3f0262cSandi/**
19715fae107Sandi * show a wiki page
19815fae107Sandi *
19915fae107Sandi * @author Andreas Gohr <andi@splitbrain.org>
20015fae107Sandi */
2016bbae538Sandifunction html_show($txt=''){
202f3f0262cSandi  global $ID;
203f3f0262cSandi  global $REV;
204f3f0262cSandi  global $HIGH;
205b8595a66SAndreas Gohr  global $INFO;
206f3f0262cSandi  //disable section editing for old revisions or in preview
2075400331dSandi  if($txt || $REV){
2086bbae538Sandi    $secedit = false;
2096bbae538Sandi  }else{
2106bbae538Sandi    $secedit = true;
211f3f0262cSandi  }
212f3f0262cSandi
2136bbae538Sandi  if ($txt){
214f3f0262cSandi    //PreviewHeader
215b8595a66SAndreas Gohr    echo '<br id="scroll__here" />';
216b8595a66SAndreas Gohr    echo p_locale_xhtml('preview');
217b8595a66SAndreas Gohr    echo '<div class="preview">';
218b8595a66SAndreas Gohr    $html = html_secedit(p_render('xhtml',p_get_instructions($txt),$info),$secedit);
219b8595a66SAndreas Gohr    if($INFO['prependTOC']) $html = tpl_toc(true).$html;
220b8595a66SAndreas Gohr    echo $html;
221b8595a66SAndreas Gohr    echo '<div class="clearer"></div>';
222b8595a66SAndreas Gohr    echo '</div>';
2236bbae538Sandi
224f3f0262cSandi  }else{
225c112d578Sandi    if ($REV) print p_locale_xhtml('showrev');
226c112d578Sandi    $html = p_wiki_xhtml($ID,$REV,true);
2276bbae538Sandi    $html = html_secedit($html,$secedit);
228b8595a66SAndreas Gohr    if($INFO['prependTOC']) $html = tpl_toc(true).$html;
229b8595a66SAndreas Gohr    $html = html_hilight($html,$HIGH);
230b8595a66SAndreas Gohr    echo $html;
231f3f0262cSandi  }
232f3f0262cSandi}
233f3f0262cSandi
234f3f0262cSandi/**
235ee4c4a1bSAndreas Gohr * ask the user about how to handle an exisiting draft
236ee4c4a1bSAndreas Gohr *
237ee4c4a1bSAndreas Gohr * @author Andreas Gohr <andi@splitbrain.org>
238ee4c4a1bSAndreas Gohr */
239ee4c4a1bSAndreas Gohrfunction html_draft(){
240ee4c4a1bSAndreas Gohr  global $INFO;
241ee4c4a1bSAndreas Gohr  global $ID;
242ee4c4a1bSAndreas Gohr  global $lang;
243ee4c4a1bSAndreas Gohr  global $conf;
244ee4c4a1bSAndreas Gohr  $draft = unserialize(io_readFile($INFO['draft'],false));
245ee4c4a1bSAndreas Gohr  $text  = cleanText(con($draft['prefix'],$draft['text'],$draft['suffix'],true));
246ee4c4a1bSAndreas Gohr
247fdb8d77bSTom N Harris  print p_locale_xhtml('draft');
248fdb8d77bSTom N Harris  $form = new Doku_Form('dw__editform');
249fdb8d77bSTom N Harris  $form->addHidden('id', $ID);
250fdb8d77bSTom N Harris  $form->addHidden('date', $draft['date']);
251fdb8d77bSTom N Harris  $form->addElement(form_makeWikiText($text, array('readonly'=>'readonly')));
252fdb8d77bSTom N Harris  $form->addElement(form_makeOpenTag('div', array('id'=>'draft__status')));
253e656dcd4SAndreas Gohr  $form->addElement($lang['draftdate'].' '. strftime($conf['dformat'],filemtime($INFO['draft'])));
254fdb8d77bSTom N Harris  $form->addElement(form_makeCloseTag('div'));
255fdb8d77bSTom N Harris  $form->addElement(form_makeButton('submit', 'recover', $lang['btn_recover'], array('tabindex'=>'1')));
256fdb8d77bSTom N Harris  $form->addElement(form_makeButton('submit', 'draftdel', $lang['btn_draftdel'], array('tabindex'=>'2')));
257fdb8d77bSTom N Harris  $form->addElement(form_makeButton('submit', 'show', $lang['btn_cancel'], array('tabindex'=>'3')));
258fdb8d77bSTom N Harris  html_form('draft', $form);
259ee4c4a1bSAndreas Gohr}
260ee4c4a1bSAndreas Gohr
261ee4c4a1bSAndreas Gohr/**
262f3f0262cSandi * Highlights searchqueries in HTML code
26315fae107Sandi *
26415fae107Sandi * @author Andreas Gohr <andi@splitbrain.org>
2657209be23SAndreas Gohr * @author Harry Fuecks <hfuecks@gmail.com>
266f3f0262cSandi */
267546d3a99SAndreas Gohrfunction html_hilight($html,$phrases){
268808551e3SAndreas Gohr  $phrases = array_filter((array) $phrases);
269808551e3SAndreas Gohr  $regex = join('|',array_map('preg_quote_cb',$phrases));
27060c15d7dSAndreas Gohr
27160c15d7dSAndreas Gohr  if ($regex === '') return $html;
2721db218e9SAndreas Gohr  $html = preg_replace_callback("/((<[^>]*)|$regex)/ui",'html_hilight_callback',$html);
273f3f0262cSandi  return $html;
274f3f0262cSandi}
275f3f0262cSandi
276f3f0262cSandi/**
2777209be23SAndreas Gohr * Callback used by html_hilight()
2787209be23SAndreas Gohr *
2797209be23SAndreas Gohr * @author Harry Fuecks <hfuecks@gmail.com>
2807209be23SAndreas Gohr */
2817209be23SAndreas Gohrfunction html_hilight_callback($m) {
2827209be23SAndreas Gohr  $hlight = unslash($m[0]);
2837209be23SAndreas Gohr  if ( !isset($m[2])) {
284688774a0SAnika Henke    $hlight = '<span class="search_hit">'.$hlight.'</span>';
2857209be23SAndreas Gohr  }
2867209be23SAndreas Gohr  return $hlight;
2877209be23SAndreas Gohr}
2887209be23SAndreas Gohr
2897209be23SAndreas Gohr/**
29015fae107Sandi * Run a search and display the result
29115fae107Sandi *
29215fae107Sandi * @author Andreas Gohr <andi@splitbrain.org>
293f3f0262cSandi */
294f3f0262cSandifunction html_search(){
295ed7b5f09Sandi  require_once(DOKU_INC.'inc/search.php');
296506fa893SAndreas Gohr  require_once(DOKU_INC.'inc/fulltext.php');
297f3f0262cSandi  global $conf;
298f3f0262cSandi  global $QUERY;
299f3f0262cSandi  global $ID;
300f3f0262cSandi  global $lang;
301f3f0262cSandi
302c112d578Sandi  print p_locale_xhtml('searchpage');
303f3f0262cSandi  flush();
304f3f0262cSandi
305d0ab54f6SMichael Klier chi@chimeric.de  //check if search is restricted to namespace
306b42bcfe7Sdaniel.lindgren  if(preg_match('/@([^@]*)/',$QUERY,$match)) {
307d0ab54f6SMichael Klier chi@chimeric.de      $id = cleanID($match[1]);
308d0ab54f6SMichael Klier chi@chimeric.de      if(empty($id)) {
309d0ab54f6SMichael Klier chi@chimeric.de        print '<div class="nothing">'.$lang['nothingfound'].'</div>';
310d0ab54f6SMichael Klier chi@chimeric.de        flush();
311d0ab54f6SMichael Klier chi@chimeric.de        return;
312d0ab54f6SMichael Klier chi@chimeric.de      }
313d0ab54f6SMichael Klier chi@chimeric.de  } else {
314d0ab54f6SMichael Klier chi@chimeric.de      $id = cleanID($QUERY);
315d0ab54f6SMichael Klier chi@chimeric.de  }
316d0ab54f6SMichael Klier chi@chimeric.de
3174d9ff3d5Sandi  //show progressbar
318e226efe1SAndreas Gohr  print '<div class="centeralign" id="dw__loading">'.NL;
319e226efe1SAndreas Gohr  print '<script type="text/javascript" charset="utf-8"><!--//--><![CDATA[//><!--'.NL;
320e226efe1SAndreas Gohr  print 'showLoadBar();'.NL;
321e226efe1SAndreas Gohr  print '//--><!]]></script>'.NL;
322e226efe1SAndreas Gohr  print '<br /></div>'.NL;
3239edac8a8SAndreas Gohr  flush();
3244d9ff3d5Sandi
325f3f0262cSandi  //do quick pagesearch
326f3f0262cSandi  $data = array();
327d0ab54f6SMichael Klier chi@chimeric.de
328d0ab54f6SMichael Klier chi@chimeric.de  $data = ft_pageLookup($id);
329f3f0262cSandi  if(count($data)){
330f3f0262cSandi    print '<div class="search_quickresult">';
331746855cfSBen Coburn    print '<h3>'.$lang['quickhits'].':</h3>';
3324f732f0eSAnika Henke    print '<ul class="search_quickhits">';
333140c93f3SAnika Henke    foreach($data as $id){
3344f732f0eSAnika Henke      print '<li> ';
335bd2f6c2fSAndreas Gohr      $ns = getNS($id);
336bd2f6c2fSAndreas Gohr      if($ns){
337bd2f6c2fSAndreas Gohr        $name = shorten(noNS($id), ' ('.$ns.')',30);
338bd2f6c2fSAndreas Gohr      }else{
339bd2f6c2fSAndreas Gohr        $name = $id;
340bd2f6c2fSAndreas Gohr      }
341bd2f6c2fSAndreas Gohr      print html_wikilink(':'.$id,$name);
3424f732f0eSAnika Henke      print '</li> ';
343f3f0262cSandi    }
344140c93f3SAnika Henke    print '</ul> ';
345f3f0262cSandi    //clear float (see http://www.complexspiral.com/publications/containing-floats/)
346f3f0262cSandi    print '<div class="clearer">&nbsp;</div>';
347f3f0262cSandi    print '</div>';
348f3f0262cSandi  }
349f3f0262cSandi  flush();
350f3f0262cSandi
351f3f0262cSandi  //do fulltext search
35260c15d7dSAndreas Gohr  $data = ft_pageSearch($QUERY,$regex);
353f3f0262cSandi  if(count($data)){
354506fa893SAndreas Gohr    $num = 1;
355506fa893SAndreas Gohr    foreach($data as $id => $cnt){
356f3f0262cSandi      print '<div class="search_result">';
357fe9ec250SChris Smith      print html_wikilink(':'.$id,useHeading('navigation')?NULL:$id,$regex);
358506fa893SAndreas Gohr      print ': <span class="search_cnt">'.$cnt.' '.$lang['hits'].'</span><br />';
359506fa893SAndreas Gohr      if($num < 15){ // create snippets for the first number of matches only #FIXME add to conf ?
36060c15d7dSAndreas Gohr        print '<div class="search_snippet">'.ft_snippet($id,$regex).'</div>';
361506fa893SAndreas Gohr      }
362f3f0262cSandi      print '</div>';
363506fa893SAndreas Gohr      flush();
364506fa893SAndreas Gohr      $num++;
365f3f0262cSandi    }
366f3f0262cSandi  }else{
367820fa24bSandi    print '<div class="nothing">'.$lang['nothingfound'].'</div>';
368f3f0262cSandi  }
3694d9ff3d5Sandi
3704d9ff3d5Sandi  //hide progressbar
371e226efe1SAndreas Gohr  print '<script type="text/javascript" charset="utf-8"><!--//--><![CDATA[//><!--'.NL;
372e226efe1SAndreas Gohr  print 'hideLoadBar("dw__loading");'.NL;
373e226efe1SAndreas Gohr  print '//--><!]]></script>'.NL;
3749edac8a8SAndreas Gohr  flush();
375f3f0262cSandi}
376f3f0262cSandi
37715fae107Sandi/**
37815fae107Sandi * Display error on locked pages
37915fae107Sandi *
38015fae107Sandi * @author Andreas Gohr <andi@splitbrain.org>
38115fae107Sandi */
382ee20e7d1Sandifunction html_locked(){
383f3f0262cSandi  global $ID;
384f3f0262cSandi  global $conf;
385f3f0262cSandi  global $lang;
38688f522e9Sandi  global $INFO;
387f3f0262cSandi
388c9b4bd1eSBen Coburn  $locktime = filemtime(wikiLockFN($ID));
389e656dcd4SAndreas Gohr  $expire = @strftime($conf['dformat'], $locktime + $conf['locktime'] );
390f3f0262cSandi  $min    = round(($conf['locktime'] - (time() - $locktime) )/60);
391f3f0262cSandi
392c112d578Sandi  print p_locale_xhtml('locked');
393f3f0262cSandi  print '<ul>';
394*6d233a0cSAndy Webber  print '<li><div class="li"><strong>'.$lang['lockedby'].':</strong> '.editorinfo($INFO['locked']).'</div></li>';
3950c6b58a8SAndreas Gohr  print '<li><div class="li"><strong>'.$lang['lockexpire'].':</strong> '.$expire.' ('.$min.' min)</div></li>';
396f3f0262cSandi  print '</ul>';
397f3f0262cSandi}
398f3f0262cSandi
39915fae107Sandi/**
40015fae107Sandi * list old revisions
40115fae107Sandi *
40215fae107Sandi * @author Andreas Gohr <andi@splitbrain.org>
40371726d78SBen Coburn * @author Ben Coburn <btcoburn@silicodon.net>
40415fae107Sandi */
40571726d78SBen Coburnfunction html_revisions($first=0){
406f3f0262cSandi  global $ID;
407f3f0262cSandi  global $INFO;
408f3f0262cSandi  global $conf;
409f3f0262cSandi  global $lang;
41071726d78SBen Coburn  /* we need to get one additionally log entry to be able to
41171726d78SBen Coburn   * decide if this is the last page or is there another one.
41271726d78SBen Coburn   * see html_recent()
41371726d78SBen Coburn   */
41471726d78SBen Coburn  $revisions = getRevisions($ID, $first, $conf['recent']+1);
41571726d78SBen Coburn  if(count($revisions)==0 && $first!=0){
41671726d78SBen Coburn    $first=0;
41771726d78SBen Coburn    $revisions = getRevisions($ID, $first, $conf['recent']+1);;
41871726d78SBen Coburn  }
41971726d78SBen Coburn  $hasNext = false;
42071726d78SBen Coburn  if (count($revisions)>$conf['recent']) {
42171726d78SBen Coburn    $hasNext = true;
42271726d78SBen Coburn    array_pop($revisions); // remove extra log entry
42371726d78SBen Coburn  }
42471726d78SBen Coburn
425e656dcd4SAndreas Gohr  $date = @strftime($conf['dformat'],$INFO['lastmod']);
426f3f0262cSandi
427c112d578Sandi  print p_locale_xhtml('revisions');
42837a1dc12Smichael
42937a1dc12Smichael  $form = new Doku_Form('page__revisions', wl($ID));
43037a1dc12Smichael  $form->addElement(form_makeOpenTag('ul'));
43171726d78SBen Coburn  if($INFO['exists'] && $first==0){
43237a1dc12Smichael    if (isset($INFO['meta']) && isset($INFO['meta']['last_change']) && $INFO['meta']['last_change']['type']===DOKU_CHANGE_TYPE_MINOR_EDIT)
43337a1dc12Smichael      $form->addElement(form_makeOpenTag('li', array('class' => 'minor')));
43437a1dc12Smichael    else
43537a1dc12Smichael      $form->addElement(form_makeOpenTag('li'));
43637a1dc12Smichael    $form->addElement(form_makeOpenTag('div', array('class' => 'li')));
43737a1dc12Smichael    $form->addElement(form_makeTag('input', array(
43837a1dc12Smichael      'type' => 'checkbox',
43937a1dc12Smichael      'name' => 'rev2[]',
44037a1dc12Smichael      'value' => 'current')));
441f9b2fe70Sandi
44237a1dc12Smichael    $form->addElement(form_makeOpenTag('span', array('class' => 'date')));
44337a1dc12Smichael    $form->addElement($date);
44437a1dc12Smichael    $form->addElement(form_makeCloseTag('span'));
445f9b2fe70Sandi
44637a1dc12Smichael    $form->addElement(form_makeTag('img', array(
44737a1dc12Smichael      'src' =>  DOKU_BASE.'lib/images/blank.gif',
44837a1dc12Smichael      'width' => '15',
44937a1dc12Smichael      'height' => '11',
45037a1dc12Smichael      'alt'    => '')));
451cffcc403Sandi
45237a1dc12Smichael    $form->addElement(form_makeOpenTag('a', array(
45337a1dc12Smichael      'class' => 'wikilink1',
45437a1dc12Smichael      'href'  => wl($ID))));
45537a1dc12Smichael    $form->addElement($ID);
45637a1dc12Smichael    $form->addElement(form_makeCloseTag('a'));
457652610a2Sandi
45837a1dc12Smichael    $form->addElement(form_makeOpenTag('span', array('class' => 'sum')));
45937a1dc12Smichael    $form->addElement(' &ndash; ');
46037a1dc12Smichael    $form->addElement(htmlspecialchars($INFO['sum']));
46137a1dc12Smichael    $form->addElement(form_makeCloseTag('span'));
462652610a2Sandi
46337a1dc12Smichael    $form->addElement(form_makeOpenTag('span', array('class' => 'user')));
46437a1dc12Smichael    $form->addElement((empty($INFO['editor']))?('('.$lang['external_edit'].')'):editorinfo($INFO['editor']));
46537a1dc12Smichael    $form->addElement(form_makeCloseTag('span'));
46637a1dc12Smichael
46737a1dc12Smichael    $form->addElement('('.$lang['current'].')');
46837a1dc12Smichael    $form->addElement(form_makeCloseTag('div'));
46937a1dc12Smichael    $form->addElement(form_makeCloseTag('li'));
470f3f0262cSandi  }
471f3f0262cSandi
472f3f0262cSandi  foreach($revisions as $rev){
473e656dcd4SAndreas Gohr    $date   = strftime($conf['dformat'],$rev);
474fb53bfe2SBen Coburn    $info   = getRevisionInfo($ID,$rev,true);
475103c256aSChris Smith    $exists = page_exists($ID,$rev);
476652610a2Sandi
47737a1dc12Smichael    if ($info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT)
47837a1dc12Smichael      $form->addElement(form_makeOpenTag('li', array('class' => 'minor')));
47937a1dc12Smichael    else
48037a1dc12Smichael      $form->addElement(form_makeOpenTag('li'));
48137a1dc12Smichael    $form->addElement(form_makeOpenTag('div', array('class' => 'li')));
48277707b04SAndreas Gohr    if($exists){
48337a1dc12Smichael      $form->addElement(form_makeTag('input', array(
48437a1dc12Smichael        'type' => 'checkbox',
48537a1dc12Smichael        'name' => 'rev2[]',
48637a1dc12Smichael        'value' => $rev)));
48777707b04SAndreas Gohr    }else{
48837a1dc12Smichael      $form->addElement(form_makeTag('img', array(
48937a1dc12Smichael        'src' => DOKU_BASE.'lib/images/blank.gif',
49037a1dc12Smichael        'width' => 14,
49137a1dc12Smichael        'height' => 11,
49237a1dc12Smichael        'alt' => '')));
49341396b71SAndreas Gohr    }
494f9b2fe70Sandi
49537a1dc12Smichael    $form->addElement(form_makeOpenTag('span', array('class' => 'date')));
49637a1dc12Smichael    $form->addElement($date);
49737a1dc12Smichael    $form->addElement(form_makeCloseTag('span'));
49837a1dc12Smichael
49937a1dc12Smichael    if($exists){
50037a1dc12Smichael      $form->addElement(form_makeOpenTag('a', array('href' => wl($ID,"rev=$rev,do=diff", false, '&'), 'class' => 'diff_link')));
50137a1dc12Smichael      $form->addElement(form_makeTag('img', array(
50237a1dc12Smichael        'src'    => DOKU_BASE.'lib/images/diff.png',
50337a1dc12Smichael        'width'  => 15,
50437a1dc12Smichael        'height' => 11,
50537a1dc12Smichael        'title'  => $lang['diff'],
50637a1dc12Smichael        'alt'    => $lang['diff'])));
50737a1dc12Smichael      $form->addElement(form_makeCloseTag('a'));
50837a1dc12Smichael
50937a1dc12Smichael      $form->addElement(form_makeOpenTag('a', array('href' => wl($ID,"rev=$rev",false,'&'), 'class' => 'wikilink1')));
51037a1dc12Smichael      $form->addElement($ID);
51137a1dc12Smichael      $form->addElement(form_makeCloseTag('a'));
51237a1dc12Smichael    }else{
51337a1dc12Smichael      $form->addElement(form_makeTag('img', array(
51437a1dc12Smichael        'src' => DOKU_BASE.'lib/images/blank.gif',
51537a1dc12Smichael        'width' => '15',
51637a1dc12Smichael        'height' => '11',
51737a1dc12Smichael        'alt'   => '')));
51837a1dc12Smichael      $form->addElement($ID);
51937a1dc12Smichael    }
52037a1dc12Smichael
52137a1dc12Smichael    $form->addElement(form_makeOpenTag('span', array('class' => 'sum')));
52237a1dc12Smichael    $form->addElement(' &ndash; ');
52337a1dc12Smichael    $form->addElement(htmlspecialchars($info['sum']));
52437a1dc12Smichael    $form->addElement(form_makeCloseTag('span'));
52537a1dc12Smichael
52637a1dc12Smichael    $form->addElement(form_makeOpenTag('span', array('class' => 'user')));
52788f522e9Sandi    if($info['user']){
52837a1dc12Smichael      $form->addElement(editorinfo($info['user']));
529433efb25SAndreas Gohr      if(auth_ismanager()){
530433efb25SAndreas Gohr        $form->addElement(' ('.$info['ip'].')');
531433efb25SAndreas Gohr      }
53288f522e9Sandi    }else{
53337a1dc12Smichael      $form->addElement($info['ip']);
53488f522e9Sandi    }
53537a1dc12Smichael    $form->addElement(form_makeCloseTag('span'));
536652610a2Sandi
53737a1dc12Smichael    $form->addElement(form_makeCloseTag('div'));
53837a1dc12Smichael    $form->addElement(form_makeCloseTag('li'));
539f3f0262cSandi  }
54037a1dc12Smichael  $form->addElement(form_makeCloseTag('ul'));
54137a1dc12Smichael  $form->addElement(form_makeButton('submit', 'diff', $lang['diff2']));
54237a1dc12Smichael  html_form('revisions', $form);
54371726d78SBen Coburn
54471726d78SBen Coburn  print '<div class="pagenav">';
54571726d78SBen Coburn  $last = $first + $conf['recent'];
54671726d78SBen Coburn  if ($first > 0) {
54771726d78SBen Coburn    $first -= $conf['recent'];
54871726d78SBen Coburn    if ($first < 0) $first = 0;
54971726d78SBen Coburn    print '<div class="pagenav-prev">';
550eeb83e57SBen Coburn    print html_btn('newer',$ID,"p",array('do' => 'revisions', 'first' => $first));
55171726d78SBen Coburn    print '</div>';
55271726d78SBen Coburn  }
55371726d78SBen Coburn  if ($hasNext) {
55471726d78SBen Coburn    print '<div class="pagenav-next">';
555eeb83e57SBen Coburn    print html_btn('older',$ID,"n",array('do' => 'revisions', 'first' => $last));
55671726d78SBen Coburn    print '</div>';
55771726d78SBen Coburn  }
55871726d78SBen Coburn  print '</div>';
55971726d78SBen Coburn
560f3f0262cSandi}
561f3f0262cSandi
56215fae107Sandi/**
56315fae107Sandi * display recent changes
56415fae107Sandi *
56515fae107Sandi * @author Andreas Gohr <andi@splitbrain.org>
5665749f1ceSmatthiasgrimm * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
56771726d78SBen Coburn * @author Ben Coburn <btcoburn@silicodon.net>
56815fae107Sandi */
569a39955b0Smatthiasgrimmfunction html_recent($first=0){
570f3f0262cSandi  global $conf;
571cffcc403Sandi  global $lang;
572dbb00abcSEsther Brunner  global $ID;
5735749f1ceSmatthiasgrimm  /* we need to get one additionally log entry to be able to
5745749f1ceSmatthiasgrimm   * decide if this is the last page or is there another one.
5755749f1ceSmatthiasgrimm   * This is the cheapest solution to get this information.
5765749f1ceSmatthiasgrimm   */
577b6912aeaSAndreas Gohr  $recents = getRecents($first,$conf['recent'] + 1,getNS($ID));
5785749f1ceSmatthiasgrimm  if(count($recents) == 0 && $first != 0){
5795749f1ceSmatthiasgrimm    $first=0;
58071726d78SBen Coburn    $recents = getRecents($first,$conf['recent'] + 1,getNS($ID));
5815749f1ceSmatthiasgrimm  }
58271726d78SBen Coburn  $hasNext = false;
58371726d78SBen Coburn  if (count($recents)>$conf['recent']) {
58471726d78SBen Coburn    $hasNext = true;
58571726d78SBen Coburn    array_pop($recents); // remove extra log entry
58671726d78SBen Coburn  }
587f3f0262cSandi
588c112d578Sandi  print p_locale_xhtml('recent');
589e83cef14SGina Haeussge
590e83cef14SGina Haeussge  if (getNS($ID) != '')
5919e561443SAndreas Gohr    print '<div class="level1"><p>' . sprintf($lang['recent_global'], getNS($ID), wl('', 'do=recent')) . '</p></div>';
592e83cef14SGina Haeussge
593abdcc39fSmichael  $form = new Doku_Form('dw__recent', script(), 'get');
594abdcc39fSmichael  $form->addHidden('sectok', null);
595abdcc39fSmichael  $form->addHidden('do', 'recent');
596abdcc39fSmichael  $form->addHidden('id', $ID);
597abdcc39fSmichael  $form->addElement(form_makeOpenTag('ul'));
598a39955b0Smatthiasgrimm
599d437bcc4SAndreas Gohr  foreach($recents as $recent){
600e656dcd4SAndreas Gohr    $date = strftime($conf['dformat'],$recent['date']);
601abdcc39fSmichael    if ($recent['type']===DOKU_CHANGE_TYPE_MINOR_EDIT)
602abdcc39fSmichael      $form->addElement(form_makeOpenTag('li', array('class' => 'minor')));
603abdcc39fSmichael    else
604abdcc39fSmichael      $form->addElement(form_makeOpenTag('li'));
605cffcc403Sandi
606abdcc39fSmichael    $form->addElement(form_makeOpenTag('div', array('class' => 'li')));
607f9b2fe70Sandi
608abdcc39fSmichael    $form->addElement(form_makeOpenTag('span', array('class' => 'date')));
609abdcc39fSmichael    $form->addElement($date);
610abdcc39fSmichael    $form->addElement(form_makeCloseTag('span'));
611cffcc403Sandi
612cddd152cSmichael    $form->addElement(form_makeOpenTag('a', array('class' => 'diff_link', 'href' => wl($recent['id'],"do=diff", false, '&'))));
613abdcc39fSmichael    $form->addElement(form_makeTag('img', array(
614abdcc39fSmichael      'src'   => DOKU_BASE.'lib/images/diff.png',
615abdcc39fSmichael      'width' => 15,
616abdcc39fSmichael      'height'=> 11,
617abdcc39fSmichael      'title' => $lang['diff'],
618abdcc39fSmichael      'alt'   => $lang['diff']
619abdcc39fSmichael    )));
620abdcc39fSmichael    $form->addElement(form_makeCloseTag('a'));
621cffcc403Sandi
622cddd152cSmichael    $form->addElement(form_makeOpenTag('a', array('class' => 'revisions_link', 'href' => wl($recent['id'],"do=revisions",false,'&'))));
623abdcc39fSmichael    $form->addElement(form_makeTag('img', array(
624abdcc39fSmichael      'src'   => DOKU_BASE.'lib/images/history.png',
625abdcc39fSmichael      'width' => 12,
626abdcc39fSmichael      'height'=> 14,
627abdcc39fSmichael      'title' => $lang['btn_revs'],
628abdcc39fSmichael      'alt'   => $lang['btn_revs']
629abdcc39fSmichael    )));
630abdcc39fSmichael    $form->addElement(form_makeCloseTag('a'));
631b6912aeaSAndreas Gohr
632fe9ec250SChris Smith    $form->addElement(html_wikilink(':'.$recent['id'],useHeading('navigation')?NULL:$recent['id']));
633abdcc39fSmichael
634abdcc39fSmichael    $form->addElement(form_makeOpenTag('span', array('class' => 'sum')));
635abdcc39fSmichael    $form->addElement(' &ndash; '.htmlspecialchars($recent['sum']));
636abdcc39fSmichael    $form->addElement(form_makeCloseTag('span'));
637abdcc39fSmichael
638abdcc39fSmichael    $form->addElement(form_makeOpenTag('span', array('class' => 'user')));
639d437bcc4SAndreas Gohr    if($recent['user']){
640abdcc39fSmichael      $form->addElement(editorinfo($recent['user']));
641433efb25SAndreas Gohr      if(auth_ismanager()){
642433efb25SAndreas Gohr        $form->addElement(' ('.$recent['ip'].')');
643433efb25SAndreas Gohr      }
64488f522e9Sandi    }else{
645abdcc39fSmichael      $form->addElement($recent['ip']);
64688f522e9Sandi    }
647abdcc39fSmichael    $form->addElement(form_makeCloseTag('span'));
648cffcc403Sandi
649abdcc39fSmichael    $form->addElement(form_makeCloseTag('div'));
650abdcc39fSmichael    $form->addElement(form_makeCloseTag('li'));
651f3f0262cSandi  }
652abdcc39fSmichael  $form->addElement(form_makeCloseTag('ul'));
653a39955b0Smatthiasgrimm
654abdcc39fSmichael  $form->addElement(form_makeOpenTag('div', array('class' => 'pagenav')));
6555749f1ceSmatthiasgrimm  $last = $first + $conf['recent'];
656a39955b0Smatthiasgrimm  if ($first > 0) {
657a39955b0Smatthiasgrimm    $first -= $conf['recent'];
658a39955b0Smatthiasgrimm    if ($first < 0) $first = 0;
659abdcc39fSmichael    $form->addElement(form_makeOpenTag('div', array('class' => 'pagenav-prev')));
660abdcc39fSmichael    $form->addElement(form_makeTag('input', array(
661abdcc39fSmichael      'type'  => 'submit',
662abdcc39fSmichael      'name'  => 'first['.$first.']',
663cddd152cSmichael      'value' => $lang['btn_newer'],
664cddd152cSmichael      'accesskey' => 'n',
665f948eeabSMichael Klier      'title' => $lang['btn_newer'].' [N]',
66618d107cbSMichael Klier      'class' => 'button'
667abdcc39fSmichael    )));
668abdcc39fSmichael    $form->addElement(form_makeCloseTag('div'));
669a39955b0Smatthiasgrimm  }
67071726d78SBen Coburn  if ($hasNext) {
671abdcc39fSmichael    $form->addElement(form_makeOpenTag('div', array('class' => 'pagenav-next')));
672abdcc39fSmichael    $form->addElement(form_makeTag('input', array(
673abdcc39fSmichael      'type'  => 'submit',
674abdcc39fSmichael      'name'  => 'first['.$last.']',
675cddd152cSmichael      'value' => $lang['btn_older'],
676cddd152cSmichael      'accesskey' => 'p',
677f948eeabSMichael Klier      'title' => $lang['btn_older'].' [P]',
67818d107cbSMichael Klier      'class' => 'button'
679abdcc39fSmichael    )));
680abdcc39fSmichael    $form->addElement(form_makeCloseTag('div'));
681a39955b0Smatthiasgrimm  }
682abdcc39fSmichael  $form->addElement(form_makeCloseTag('div'));
683abdcc39fSmichael  html_form('recent', $form);
684f3f0262cSandi}
685f3f0262cSandi
68615fae107Sandi/**
68715fae107Sandi * Display page index
68815fae107Sandi *
68915fae107Sandi * @author Andreas Gohr <andi@splitbrain.org>
69015fae107Sandi */
691f3f0262cSandifunction html_index($ns){
692ed7b5f09Sandi  require_once(DOKU_INC.'inc/search.php');
693f3f0262cSandi  global $conf;
694f3f0262cSandi  global $ID;
695f3f0262cSandi  $dir = $conf['datadir'];
696f3f0262cSandi  $ns  = cleanID($ns);
69730f1737dSandi  #fixme use appropriate function
698f3f0262cSandi  if(empty($ns)){
699f3f0262cSandi    $ns = dirname(str_replace(':','/',$ID));
700f3f0262cSandi    if($ns == '.') $ns ='';
701f3f0262cSandi  }
70288d3a917Sandi  $ns  = utf8_encodeFN(str_replace(':','/',$ns));
703f3f0262cSandi
704a06884abSAndreas Gohr  echo p_locale_xhtml('index');
705a06884abSAndreas Gohr  echo '<div id="index__tree">';
706f3f0262cSandi
707f3f0262cSandi  $data = array();
708f3f0262cSandi  search($data,$conf['datadir'],'search_index',array('ns' => $ns));
709a06884abSAndreas Gohr  echo html_buildlist($data,'idx','html_list_index','html_li_index');
710a06884abSAndreas Gohr
711a06884abSAndreas Gohr  echo '</div>';
712f3f0262cSandi}
713f3f0262cSandi
714f3f0262cSandi/**
71515fae107Sandi * Index item formatter
71615fae107Sandi *
717f3f0262cSandi * User function for html_buildlist()
71815fae107Sandi *
71915fae107Sandi * @author Andreas Gohr <andi@splitbrain.org>
720f3f0262cSandi */
721f3f0262cSandifunction html_list_index($item){
722d98d4540SBen Coburn  global $ID;
723f3f0262cSandi  $ret = '';
724f3f0262cSandi  $base = ':'.$item['id'];
725f3f0262cSandi  $base = substr($base,strrpos($base,':')+1);
726f3f0262cSandi  if($item['type']=='d'){
7274a119027SAndreas Gohr    $ret .= '<a href="'.wl($ID,'idx='.rawurlencode($item['id'])).'" class="idx_dir"><strong>';
728f3f0262cSandi    $ret .= $base;
729ed7ecb79SAnika Henke    $ret .= '</strong></a>';
730f3f0262cSandi  }else{
731f3f0262cSandi    $ret .= html_wikilink(':'.$item['id']);
732f3f0262cSandi  }
733f3f0262cSandi  return $ret;
734f3f0262cSandi}
735f3f0262cSandi
736f3f0262cSandi/**
737cb70c441Sandi * Index List item
738cb70c441Sandi *
739cb70c441Sandi * This user function is used in html_build_lidt to build the
740cb70c441Sandi * <li> tags for namespaces when displaying the page index
741cb70c441Sandi * it gives different classes to opened or closed "folders"
742cb70c441Sandi *
743cb70c441Sandi * @author Andreas Gohr <andi@splitbrain.org>
744cb70c441Sandi */
745cb70c441Sandifunction html_li_index($item){
746cb70c441Sandi  if($item['type'] == "f"){
747cb70c441Sandi    return '<li class="level'.$item['level'].'">';
748cb70c441Sandi  }elseif($item['open']){
749cb70c441Sandi    return '<li class="open">';
750cb70c441Sandi  }else{
751cb70c441Sandi    return '<li class="closed">';
752cb70c441Sandi  }
753cb70c441Sandi}
754cb70c441Sandi
755cb70c441Sandi/**
756cb70c441Sandi * Default List item
757cb70c441Sandi *
758cb70c441Sandi * @author Andreas Gohr <andi@splitbrain.org>
759cb70c441Sandi */
760cb70c441Sandifunction html_li_default($item){
761cb70c441Sandi  return '<li class="level'.$item['level'].'">';
762cb70c441Sandi}
763cb70c441Sandi
764cb70c441Sandi/**
76515fae107Sandi * Build an unordered list
76615fae107Sandi *
767f3f0262cSandi * Build an unordered list from the given $data array
768f3f0262cSandi * Each item in the array has to have a 'level' property
769f3f0262cSandi * the item itself gets printed by the given $func user
770cb70c441Sandi * function. The second and optional function is used to
771cb70c441Sandi * print the <li> tag. Both user function need to accept
772cb70c441Sandi * a single item.
77315fae107Sandi *
774c5a8fd96SAndreas Gohr * Both user functions can be given as array to point to
775c5a8fd96SAndreas Gohr * a member of an object.
776c5a8fd96SAndreas Gohr *
77715fae107Sandi * @author Andreas Gohr <andi@splitbrain.org>
778f3f0262cSandi */
779cb70c441Sandifunction html_buildlist($data,$class,$func,$lifunc='html_li_default'){
780f3f0262cSandi  $level = 0;
781f3f0262cSandi  $opens = 0;
782f3f0262cSandi  $ret   = '';
783f3f0262cSandi
784f3f0262cSandi  foreach ($data as $item){
785f3f0262cSandi
786f3f0262cSandi    if( $item['level'] > $level ){
787f3f0262cSandi      //open new list
788df52d0feSandi      for($i=0; $i<($item['level'] - $level); $i++){
789df52d0feSandi        if ($i) $ret .= "<li class=\"clear\">\n";
790f3f0262cSandi        $ret .= "\n<ul class=\"$class\">\n";
791df52d0feSandi      }
792f3f0262cSandi    }elseif( $item['level'] < $level ){
793f3f0262cSandi      //close last item
794f3f0262cSandi      $ret .= "</li>\n";
795f3f0262cSandi      for ($i=0; $i<($level - $item['level']); $i++){
796f3f0262cSandi        //close higher lists
797f3f0262cSandi        $ret .= "</ul>\n</li>\n";
798f3f0262cSandi      }
799f3f0262cSandi    }else{
800f3f0262cSandi      //close last item
801f3f0262cSandi      $ret .= "</li>\n";
802f3f0262cSandi    }
803f3f0262cSandi
804f3f0262cSandi    //remember current level
805f3f0262cSandi    $level = $item['level'];
806f3f0262cSandi
807f3f0262cSandi    //print item
80834dbe711Schris    $ret .= call_user_func($lifunc,$item);
8090c6b58a8SAndreas Gohr    $ret .= '<div class="li">';
81034dbe711Schris
81134dbe711Schris    $ret .= call_user_func($func,$item);
8120c6b58a8SAndreas Gohr    $ret .= '</div>';
813f3f0262cSandi  }
814f3f0262cSandi
815f3f0262cSandi  //close remaining items and lists
816f3f0262cSandi  for ($i=0; $i < $level; $i++){
817f3f0262cSandi    $ret .= "</li></ul>\n";
818f3f0262cSandi  }
819f3f0262cSandi
820f3f0262cSandi  return $ret;
821f3f0262cSandi}
822f3f0262cSandi
82315fae107Sandi/**
82415fae107Sandi * display backlinks
82515fae107Sandi *
82615fae107Sandi * @author Andreas Gohr <andi@splitbrain.org>
82711df47ecSMichael Klier * @author Michael Klier <chi@chimeric.de>
82815fae107Sandi */
829f3f0262cSandifunction html_backlinks(){
83054f4c056SAndreas Gohr  require_once(DOKU_INC.'inc/fulltext.php');
831f3f0262cSandi  global $ID;
832f3f0262cSandi  global $conf;
83311df47ecSMichael Klier  global $lang;
834f3f0262cSandi
835c112d578Sandi  print p_locale_xhtml('backlinks');
836f3f0262cSandi
83754f4c056SAndreas Gohr  $data = ft_backlinks($ID);
838f3f0262cSandi
83911df47ecSMichael Klier  if(!empty($data)) {
840f3f0262cSandi      print '<ul class="idx">';
84154f4c056SAndreas Gohr      foreach($data as $blink){
8420c6b58a8SAndreas Gohr        print '<li><div class="li">';
843fe9ec250SChris Smith        print html_wikilink(':'.$blink,useHeading('navigation')?NULL:$blink);
8440c6b58a8SAndreas Gohr        print '</div></li>';
845f3f0262cSandi      }
846f3f0262cSandi      print '</ul>';
84711df47ecSMichael Klier  } else {
84811df47ecSMichael Klier      print '<div class="level1"><p>' . $lang['nothingfound'] . '</p></div>';
84911df47ecSMichael Klier  }
850f3f0262cSandi}
851f3f0262cSandi
85215fae107Sandi/**
85315fae107Sandi * show diff
85415fae107Sandi *
85515fae107Sandi * @author Andreas Gohr <andi@splitbrain.org>
85615fae107Sandi */
857f3f0262cSandifunction html_diff($text='',$intro=true){
858ed7b5f09Sandi  require_once(DOKU_INC.'inc/DifferenceEngine.php');
859f3f0262cSandi  global $ID;
860f3f0262cSandi  global $REV;
861f3f0262cSandi  global $lang;
862f3f0262cSandi  global $conf;
863e1bd90ffSAndreas Gohr
86477707b04SAndreas Gohr  // we're trying to be clever here, revisions to compare can be either
86577707b04SAndreas Gohr  // given as rev and rev2 parameters, with rev2 being optional. Or in an
86677707b04SAndreas Gohr  // array in rev2.
86777707b04SAndreas Gohr  $rev1 = $REV;
8687b3f8b16SAndreas Gohr
86977707b04SAndreas Gohr  if(is_array($_REQUEST['rev2'])){
87077707b04SAndreas Gohr    $rev1 = (int) $_REQUEST['rev2'][0];
87177707b04SAndreas Gohr    $rev2 = (int) $_REQUEST['rev2'][1];
87254041c77SAndreas Gohr
87354041c77SAndreas Gohr    if(!$rev1){
87454041c77SAndreas Gohr        $rev1 = $rev2;
87554041c77SAndreas Gohr        unset($rev2);
87654041c77SAndreas Gohr    }
877f3f0262cSandi  }else{
87877707b04SAndreas Gohr    $rev2 = (int) $_REQUEST['rev2'];
8794d58bd99Sandi  }
8804d58bd99Sandi
88177707b04SAndreas Gohr  if($text){                      // compare text to the most current revision
88277707b04SAndreas Gohr    $l_rev   = '';
88377707b04SAndreas Gohr    $l_text  = rawWiki($ID,'');
88477707b04SAndreas Gohr    $l_head  = '<a class="wikilink1" href="'.wl($ID).'">'.
885e656dcd4SAndreas Gohr               $ID.' '.strftime($conf['dformat'],@filemtime(wikiFN($ID))).'</a> '.
88677707b04SAndreas Gohr               $lang['current'];
88777707b04SAndreas Gohr
88877707b04SAndreas Gohr    $r_rev   = '';
88977707b04SAndreas Gohr    $r_text  = cleanText($text);
89077707b04SAndreas Gohr    $r_head  = $lang['yours'];
891e1bd90ffSAndreas Gohr  }else{
89277707b04SAndreas Gohr    if($rev1 && $rev2){            // two specific revisions wanted
89354041c77SAndreas Gohr      // make sure order is correct (older on the left)
89477707b04SAndreas Gohr      if($rev1 < $rev2){
89577707b04SAndreas Gohr        $l_rev = $rev1;
89677707b04SAndreas Gohr        $r_rev = $rev2;
89777707b04SAndreas Gohr      }else{
89877707b04SAndreas Gohr        $l_rev = $rev2;
89977707b04SAndreas Gohr        $r_rev = $rev1;
900e1bd90ffSAndreas Gohr      }
90177707b04SAndreas Gohr    }elseif($rev1){                // single revision given, compare to current
90277707b04SAndreas Gohr      $r_rev = '';
90377707b04SAndreas Gohr      $l_rev = $rev1;
90477707b04SAndreas Gohr    }else{                        // no revision was given, compare previous to current
90577707b04SAndreas Gohr      $r_rev = '';
90677707b04SAndreas Gohr      $revs = getRevisions($ID, 0, 1);
90777707b04SAndreas Gohr      $l_rev = $revs[0];
90877707b04SAndreas Gohr    }
90977707b04SAndreas Gohr
9107b3f8b16SAndreas Gohr    // when both revisions are empty then the page was created just now
9117b3f8b16SAndreas Gohr    if(!$l_rev && !$r_rev){
9127b3f8b16SAndreas Gohr      $l_text = '';
9137b3f8b16SAndreas Gohr    }else{
91477707b04SAndreas Gohr      $l_text = rawWiki($ID,$l_rev);
9157b3f8b16SAndreas Gohr    }
91677707b04SAndreas Gohr    $r_text = rawWiki($ID,$r_rev);
91777707b04SAndreas Gohr
9187b3f8b16SAndreas Gohr
9197b3f8b16SAndreas Gohr    if(!$l_rev){
9207b3f8b16SAndreas Gohr      $l_head = '&mdash;';
9217b3f8b16SAndreas Gohr    }else{
922e5e61eb0SAnika Henke      $l_info   = getRevisionInfo($ID,$l_rev,true);
923e5e61eb0SAnika Henke      if($l_info['user']){ $l_user = editorinfo($l_info['user']);
924e5e61eb0SAnika Henke        if(auth_ismanager()) $l_user .= ' ('.$l_info['ip'].')';
925e5e61eb0SAnika Henke      } else { $l_user = $l_info['ip']; }
926e5e61eb0SAnika Henke      $l_user  = '<span class="user">'.$l_user.'</span>';
927e5e61eb0SAnika Henke      $l_sum   = ($l_info['sum']) ? '<span class="sum">'.hsc($l_info['sum']).'</span>' : '';
928e5e61eb0SAnika Henke      if ($l_info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) $l_minor = 'class="minor"';
929e5e61eb0SAnika Henke
93077707b04SAndreas Gohr      $l_head = '<a class="wikilink1" href="'.wl($ID,"rev=$l_rev").'">'.
931658b1aa0SAnika Henke                $ID.' ['.strftime($conf['dformat'],$l_rev).']</a>'.
932e5e61eb0SAnika Henke                '<br />'.$l_user.' '.$l_sum;
9337b3f8b16SAndreas Gohr    }
93477707b04SAndreas Gohr
93577707b04SAndreas Gohr    if($r_rev){
936e5e61eb0SAnika Henke      $r_info   = getRevisionInfo($ID,$r_rev,true);
937e5e61eb0SAnika Henke      if($r_info['user']){ $r_user = editorinfo($r_info['user']);
938e5e61eb0SAnika Henke        if(auth_ismanager()) $r_user .= ' ('.$r_info['ip'].')';
939e5e61eb0SAnika Henke      } else { $r_user = $r_info['ip']; }
940e5e61eb0SAnika Henke      $r_user = '<span class="user">'.$r_user.'</span>';
941e5e61eb0SAnika Henke      $r_sum  = ($r_info['sum']) ? '<span class="sum">'.hsc($r_info['sum']).'</span>' : '';
942e5e61eb0SAnika Henke      if ($r_info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) $r_minor = 'class="minor"';
943e5e61eb0SAnika Henke
94477707b04SAndreas Gohr      $r_head = '<a class="wikilink1" href="'.wl($ID,"rev=$r_rev").'">'.
945658b1aa0SAnika Henke                $ID.' ['.strftime($conf['dformat'],$r_rev).']</a>'.
946e5e61eb0SAnika Henke                '<br />'.$r_user.' '.$r_sum;
9477b3f8b16SAndreas Gohr    }elseif($_rev = @filemtime(wikiFN($ID))){
948e5e61eb0SAnika Henke      $_info   = getRevisionInfo($ID,$_rev,true);
949e5e61eb0SAnika Henke      if($_info['user']){ $_user = editorinfo($_info['user']);
950e5e61eb0SAnika Henke        if(auth_ismanager()) $_user .= ' ('.$_info['ip'].')';
951e5e61eb0SAnika Henke      } else { $_user = $_info['ip']; }
952e5e61eb0SAnika Henke      $_user = '<span class="user">'.$_user.'</span>';
953e5e61eb0SAnika Henke      $_sum  = ($_info['sum']) ? '<span class="sum">'.hsc($_info['sum']).'</span>' : '';
954e5e61eb0SAnika Henke      if ($_info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) $r_minor = 'class="minor"';
955e5e61eb0SAnika Henke
95677707b04SAndreas Gohr      $r_head  = '<a class="wikilink1" href="'.wl($ID).'">'.
957658b1aa0SAnika Henke               $ID.' ['.strftime($conf['dformat'],$_rev).']</a> '.
958658b1aa0SAnika Henke               '('.$lang['current'].')'.
959e5e61eb0SAnika Henke                '<br />'.$_user.' '.$_sum;
9607b3f8b16SAndreas Gohr    }else{
961658b1aa0SAnika Henke      $r_head = '&mdash; ('.$lang['current'].')';
962f3f0262cSandi    }
96377707b04SAndreas Gohr  }
96477707b04SAndreas Gohr
96577707b04SAndreas Gohr  $df = new Diff(explode("\n",htmlspecialchars($l_text)),
96677707b04SAndreas Gohr                 explode("\n",htmlspecialchars($r_text)));
96777707b04SAndreas Gohr
968f3f0262cSandi  $tdf = new TableDiffFormatter();
969c112d578Sandi  if($intro) print p_locale_xhtml('diff');
970f3f0262cSandi  ?>
971daf4ca4eSAnika Henke    <table class="diff">
972f3f0262cSandi      <tr>
973e5e61eb0SAnika Henke        <th colspan="2" <?php echo $l_minor?>>
97477707b04SAndreas Gohr          <?php echo $l_head?>
975daf4ca4eSAnika Henke        </th>
976e5e61eb0SAnika Henke        <th colspan="2" <?php echo $r_minor?>>
97777707b04SAndreas Gohr          <?php echo $r_head?>
978daf4ca4eSAnika Henke        </th>
979f3f0262cSandi      </tr>
9804da078a3Smatthiasgrimm      <?php echo $tdf->format($df)?>
981f3f0262cSandi    </table>
9824da078a3Smatthiasgrimm  <?php
983f3f0262cSandi}
984f3f0262cSandi
98515fae107Sandi/**
98615fae107Sandi * show warning on conflict detection
98715fae107Sandi *
98815fae107Sandi * @author Andreas Gohr <andi@splitbrain.org>
98915fae107Sandi */
990f3f0262cSandifunction html_conflict($text,$summary){
991f3f0262cSandi  global $ID;
992f3f0262cSandi  global $lang;
993f3f0262cSandi
994c112d578Sandi  print p_locale_xhtml('conflict');
995fdb8d77bSTom N Harris  $form = new Doku_Form('dw__editform');
996fdb8d77bSTom N Harris  $form->addHidden('id', $ID);
997fdb8d77bSTom N Harris  $form->addHidden('wikitext', $text);
998fdb8d77bSTom N Harris  $form->addHidden('summary', $summary);
999fdb8d77bSTom N Harris  $form->addElement(form_makeButton('submit', 'save', $lang['btn_save'], array('accesskey'=>'s')));
1000fdb8d77bSTom N Harris  $form->addElement(form_makeButton('submit', 'cancel', $lang['btn_cancel']));
1001fdb8d77bSTom N Harris  html_form('conflict', $form);
1002fdb8d77bSTom N Harris  print '<br /><br /><br /><br />'.NL;
1003f3f0262cSandi}
1004f3f0262cSandi
1005f3f0262cSandi/**
100615fae107Sandi * Prints the global message array
100715fae107Sandi *
100815fae107Sandi * @author Andreas Gohr <andi@splitbrain.org>
1009f3f0262cSandi */
1010f3f0262cSandifunction html_msgarea(){
1011f3f0262cSandi    global $MSG;
1012f3f0262cSandi    if(!isset($MSG)) return;
1013f3f0262cSandi
10144af9f0d4SAndreas Gohr    $shown = array();
1015f3f0262cSandi    foreach($MSG as $msg){
10164af9f0d4SAndreas Gohr        $hash = md5($msg['msg']);
10174af9f0d4SAndreas Gohr        if(isset($shown[$hash])) continue; // skip double messages
1018f3f0262cSandi        print '<div class="'.$msg['lvl'].'">';
1019f3f0262cSandi        print $msg['msg'];
1020f3f0262cSandi        print '</div>';
10214af9f0d4SAndreas Gohr        $shown[$hash] = 1;
1022f3f0262cSandi    }
1023f3f0262cSandi}
1024f3f0262cSandi
1025f3f0262cSandi/**
1026f3f0262cSandi * Prints the registration form
102715fae107Sandi *
102815fae107Sandi * @author Andreas Gohr <andi@splitbrain.org>
1029f3f0262cSandi */
1030f3f0262cSandifunction html_register(){
1031f3f0262cSandi  global $lang;
1032cab2716aSmatthias.grimm  global $conf;
1033f3f0262cSandi  global $ID;
1034f3f0262cSandi
1035c112d578Sandi  print p_locale_xhtml('register');
1036fdb8d77bSTom N Harris  print '<div class="centeralign">'.NL;
1037fdb8d77bSTom N Harris  $form = new Doku_Form('dw__register', wl($ID));
1038fdb8d77bSTom N Harris  $form->startFieldset($lang['register']);
1039fdb8d77bSTom N Harris  $form->addHidden('do', 'register');
1040fdb8d77bSTom N Harris  $form->addHidden('save', '1');
1041fdb8d77bSTom N Harris  $form->addElement(form_makeTextField('login', $_POST['login'], $lang['user'], null, 'block', array('size'=>'50')));
1042cab2716aSmatthias.grimm  if (!$conf['autopasswd']) {
1043fdb8d77bSTom N Harris    $form->addElement(form_makePasswordField('pass', $lang['pass'], '', 'block', array('size'=>'50')));
1044fdb8d77bSTom N Harris    $form->addElement(form_makePasswordField('passchk', $lang['passchk'], '', 'block', array('size'=>'50')));
1045cab2716aSmatthias.grimm  }
1046fdb8d77bSTom N Harris  $form->addElement(form_makeTextField('fullname', $_POST['fullname'], $lang['fullname'], '', 'block', array('size'=>'50')));
1047fdb8d77bSTom N Harris  $form->addElement(form_makeTextField('email', $_POST['email'], $lang['email'], '', 'block', array('size'=>'50')));
1048fdb8d77bSTom N Harris  $form->addElement(form_makeButton('submit', '', $lang['register']));
1049fdb8d77bSTom N Harris  $form->endFieldset();
1050fdb8d77bSTom N Harris  html_form('register', $form);
1051cab2716aSmatthias.grimm
1052fdb8d77bSTom N Harris  print '</div>'.NL;
1053f3f0262cSandi}
1054f3f0262cSandi
1055f3f0262cSandi/**
10568b06d178Schris * Print the update profile form
10578b06d178Schris *
10588b06d178Schris * @author Christopher Smith <chris@jalakai.co.uk>
10598b06d178Schris * @author Andreas Gohr <andi@splitbrain.org>
10608b06d178Schris */
10618b06d178Schrisfunction html_updateprofile(){
10628b06d178Schris  global $lang;
10638b06d178Schris  global $conf;
10648b06d178Schris  global $ID;
10658b06d178Schris  global $INFO;
106682fd59b6SAndreas Gohr  global $auth;
10678b06d178Schris
10688b06d178Schris  print p_locale_xhtml('updateprofile');
10698b06d178Schris
10708b06d178Schris  if (empty($_POST['fullname'])) $_POST['fullname'] = $INFO['userinfo']['name'];
10718b06d178Schris  if (empty($_POST['email'])) $_POST['email'] = $INFO['userinfo']['mail'];
1072fdb8d77bSTom N Harris  print '<div class="centeralign">'.NL;
1073fdb8d77bSTom N Harris  $form = new Doku_Form('dw__register', wl($ID));
1074fdb8d77bSTom N Harris  $form->startFieldset($lang['profile']);
1075fdb8d77bSTom N Harris  $form->addHidden('do', 'profile');
1076fdb8d77bSTom N Harris  $form->addHidden('save', '1');
1077fdb8d77bSTom N Harris  $form->addElement(form_makeTextField('fullname', $_SERVER['REMOTE_USER'], $lang['user'], '', 'block', array('size'=>'50', 'disabled'=>'disabled')));
1078fdb8d77bSTom N Harris  $attr = array('size'=>'50');
1079fdb8d77bSTom N Harris  if (!$auth->canDo('modName')) $attr['disabled'] = 'disabled';
1080fdb8d77bSTom N Harris  $form->addElement(form_makeTextField('fullname', $_POST['fullname'], $lang['fullname'], '', 'block', $attr));
108139ba8890SAndreas Gohr  $attr = array('size'=>'50');
108239ba8890SAndreas Gohr  if (!$auth->canDo('modMail')) $attr['disabled'] = 'disabled';
1083fdb8d77bSTom N Harris  $form->addElement(form_makeTextField('email', $_POST['email'], $lang['email'], '', 'block', $attr));
1084fdb8d77bSTom N Harris  $form->addElement(form_makeTag('br'));
1085fdb8d77bSTom N Harris  if ($auth->canDo('modPass')) {
1086fdb8d77bSTom N Harris    $form->addElement(form_makePasswordField('newpass', $lang['newpass'], '', 'block', array('size'=>'50')));
1087fdb8d77bSTom N Harris    $form->addElement(form_makePasswordField('passchk', $lang['passchk'], '', 'block', array('size'=>'50')));
1088fdb8d77bSTom N Harris  }
1089fdb8d77bSTom N Harris  if ($conf['profileconfirm']) {
1090fdb8d77bSTom N Harris    $form->addElement(form_makeTag('br'));
1091fdb8d77bSTom N Harris    $form->addElement(form_makePasswordField('oldpass', $lang['oldpass'], '', 'block', array('size'=>'50')));
1092fdb8d77bSTom N Harris  }
1093fdb8d77bSTom N Harris  $form->addElement(form_makeButton('submit', '', $lang['btn_save']));
1094fdb8d77bSTom N Harris  $form->addElement(form_makeButton('reset', '', $lang['btn_reset']));
1095fdb8d77bSTom N Harris  $form->endFieldset();
1096fdb8d77bSTom N Harris  html_form('updateprofile', $form);
1097fdb8d77bSTom N Harris  print '</div>'.NL;
10988b06d178Schris}
10998b06d178Schris
11008b06d178Schris/**
1101f3f0262cSandi * This displays the edit form (lots of logic included)
110215fae107Sandi *
11037146cee2SAndreas Gohr * @fixme    this is a huge lump of code and should be modularized
1104016b6153SAndreas Gohr * @triggers HTML_PAGE_FROMTEMPLATE
1105c9570649SAndreas Gohr * @triggers HTML_EDITFORM_INJECTION
110615fae107Sandi * @author   Andreas Gohr <andi@splitbrain.org>
1107f3f0262cSandi */
1108f3f0262cSandifunction html_edit($text=null,$include='edit'){ //FIXME: include needed?
1109f3f0262cSandi  global $ID;
1110f3f0262cSandi  global $REV;
1111f3f0262cSandi  global $DATE;
1112f3f0262cSandi  global $RANGE;
1113f3f0262cSandi  global $PRE;
1114f3f0262cSandi  global $SUF;
1115f3f0262cSandi  global $INFO;
1116f3f0262cSandi  global $SUM;
1117f3f0262cSandi  global $lang;
1118f3f0262cSandi  global $conf;
1119066fee30SAndreas Gohr  global $license;
1120f3f0262cSandi
1121f3f0262cSandi  //set summary default
1122f3f0262cSandi  if(!$SUM){
1123f3f0262cSandi    if($REV){
1124f3f0262cSandi      $SUM = $lang['restored'];
1125f3f0262cSandi    }elseif(!$INFO['exists']){
1126f3f0262cSandi      $SUM = $lang['created'];
1127f3f0262cSandi    }
1128f3f0262cSandi  }
1129f3f0262cSandi
1130f3f0262cSandi  //no text? Load it!
1131f3f0262cSandi  if(!isset($text)){
1132f3f0262cSandi    $pr = false; //no preview mode
11337146cee2SAndreas Gohr    if($INFO['exists']){
1134f3f0262cSandi      if($RANGE){
1135f3f0262cSandi        list($PRE,$text,$SUF) = rawWikiSlices($RANGE,$ID,$REV);
1136f3f0262cSandi      }else{
1137f3f0262cSandi        $text = rawWiki($ID,$REV);
1138f3f0262cSandi      }
11398fe3bb00STom N Harris      $check = md5($text);
11408fe3bb00STom N Harris      $mod = false;
1141f3f0262cSandi    }else{
11427146cee2SAndreas Gohr      //try to load a pagetemplate
1143b7d5a5f0SAndreas Gohr      $data = array($ID);
1144016b6153SAndreas Gohr      $text = trigger_event('HTML_PAGE_FROMTEMPLATE',$data,'pageTemplate',true);
11458fe3bb00STom N Harris      $check = md5('');
11468fe3bb00STom N Harris      $mod = $text!=='';
11477146cee2SAndreas Gohr    }
11487146cee2SAndreas Gohr  }else{
1149f3f0262cSandi    $pr = true; //preview mode
11508fe3bb00STom N Harris    if (isset($_REQUEST['changecheck'])) {
11518fe3bb00STom N Harris      $check = $_REQUEST['changecheck'];
11528fe3bb00STom N Harris      $mod = md5($text)!==$check;
11538fe3bb00STom N Harris    } else {
11548fe3bb00STom N Harris      // Why? Assume default text is unmodified.
11558fe3bb00STom N Harris      $check = md5($text);
11568fe3bb00STom N Harris      $mod = false;
11578fe3bb00STom N Harris    }
1158f3f0262cSandi  }
1159f3f0262cSandi
116027eb9321SAnika Henke  $wr = $INFO['writable'] && !$INFO['locked'];
1161f3f0262cSandi  if($wr){
1162c112d578Sandi    if ($REV) print p_locale_xhtml('editrev');
1163c112d578Sandi    print p_locale_xhtml($include);
1164f3f0262cSandi  }else{
1165409d7af7SAndreas Gohr    // check pseudo action 'source'
1166409d7af7SAndreas Gohr    if(!actionOK('source')){
1167409d7af7SAndreas Gohr      msg('Command disabled: source',-1);
1168409d7af7SAndreas Gohr      return;
1169409d7af7SAndreas Gohr    }
1170c112d578Sandi    print p_locale_xhtml('read');
1171f3f0262cSandi  }
1172f3f0262cSandi  if(!$DATE) $DATE = $INFO['lastmod'];
1173dc57ef04Sandi
1174dc57ef04Sandi
1175f3f0262cSandi?>
117663afe2a6SAnika Henke  <div style="width:99%;">
117742c7abd6SAndreas Gohr
117863afe2a6SAnika Henke   <div class="toolbar">
1179e656dcd4SAndreas Gohr      <div id="draft__status"><?php if(!empty($INFO['draft'])) echo $lang['draftdate'].' '.strftime($conf['dformat']);?></div>
1180fdb8d77bSTom N Harris      <div id="tool__bar"><?php if($wr){?><a href="<?php echo DOKU_BASE?>lib/exe/mediamanager.php?ns=<?php echo $INFO['namespace']?>"
1181409d7af7SAndreas Gohr      target="_blank"><?php echo $lang['mediaselect'] ?></a><?php }?></div>
118220d062caSAndreas Gohr
11834da078a3Smatthiasgrimm      <?php if($wr){?>
1184e226efe1SAndreas Gohr      <script type="text/javascript" charset="utf-8"><!--//--><![CDATA[//><!--
11854da078a3Smatthiasgrimm        <?php /* sets changed to true when previewed */?>
11868fe3bb00STom N Harris        textChanged = <?php ($mod) ? print 'true' : print 'false' ?>;
1187e226efe1SAndreas Gohr      //--><!]]></script>
118824a33b42SAndreas Gohr      <span id="spell__action"></span>
118924a33b42SAndreas Gohr      <div id="spell__suggest"></div>
1190ee4c4a1bSAndreas Gohr      <?php } ?>
119163afe2a6SAnika Henke   </div>
119224a33b42SAndreas Gohr   <div id="spell__result"></div>
11934da078a3Smatthiasgrimm<?php
1194fdb8d77bSTom N Harris  $form = new Doku_Form('dw__editform');
1195fdb8d77bSTom N Harris  $form->addHidden('id', $ID);
1196fdb8d77bSTom N Harris  $form->addHidden('rev', $REV);
1197fdb8d77bSTom N Harris  $form->addHidden('date', $DATE);
1198fdb8d77bSTom N Harris  $form->addHidden('prefix', $PRE);
1199fdb8d77bSTom N Harris  $form->addHidden('suffix', $SUF);
1200fdb8d77bSTom N Harris  $form->addHidden('changecheck', $check);
1201fdb8d77bSTom N Harris  $attr = array('tabindex'=>'1');
1202fdb8d77bSTom N Harris  if (!$wr) $attr['readonly'] = 'readonly';
1203fdb8d77bSTom N Harris  $form->addElement(form_makeWikiText($text, $attr));
1204fdb8d77bSTom N Harris  $form->addElement(form_makeOpenTag('div', array('id'=>'wiki__editbar')));
1205fdb8d77bSTom N Harris  $form->addElement(form_makeOpenTag('div', array('id'=>'size__ctl')));
1206fdb8d77bSTom N Harris  $form->addElement(form_makeCloseTag('div'));
1207fdb8d77bSTom N Harris  if ($wr) {
1208fdb8d77bSTom N Harris    $form->addElement(form_makeOpenTag('div', array('class'=>'editButtons')));
1209fdb8d77bSTom N Harris    $form->addElement(form_makeButton('submit', 'save', $lang['btn_save'], array('id'=>'edbtn__save', 'accesskey'=>'s', 'tabindex'=>'4')));
1210fdb8d77bSTom N Harris    $form->addElement(form_makeButton('submit', 'preview', $lang['btn_preview'], array('id'=>'edbtn__preview', 'accesskey'=>'p', 'tabindex'=>'5')));
1211fdb8d77bSTom N Harris    $form->addElement(form_makeButton('submit', 'draftdel', $lang['btn_cancel'], array('tabindex'=>'6')));
1212fdb8d77bSTom N Harris    $form->addElement(form_makeCloseTag('div'));
1213fdb8d77bSTom N Harris    $form->addElement(form_makeOpenTag('div', array('class'=>'summary')));
1214fdb8d77bSTom N Harris    $form->addElement(form_makeTextField('summary', $SUM, $lang['summary'], 'edit__summary', 'nowrap', array('size'=>'50', 'tabindex'=>'2')));
1215fdb8d77bSTom N Harris    $elem = html_minoredit();
1216fdb8d77bSTom N Harris    if ($elem) $form->addElement($elem);
1217fdb8d77bSTom N Harris    $form->addElement(form_makeCloseTag('div'));
1218fdb8d77bSTom N Harris  }
1219fdb8d77bSTom N Harris  $form->addElement(form_makeCloseTag('div'));
1220066fee30SAndreas Gohr  if($conf['license']){
1221066fee30SAndreas Gohr    $form->addElement(form_makeOpenTag('div', array('class'=>'license')));
1222066fee30SAndreas Gohr    $out  = $lang['licenseok'];
1223066fee30SAndreas Gohr    $out .= '<a href="'.$license[$conf['license']]['url'].'" rel="license" class="urlextern"';
1224066fee30SAndreas Gohr    if($conf['target']['external']) $out .= ' target="'.$conf['target']['external'].'"';
1225066fee30SAndreas Gohr    $out .= '> '.$license[$conf['license']]['name'].'</a>';
1226066fee30SAndreas Gohr    $form->addElement($out);
1227066fee30SAndreas Gohr    $form->addElement(form_makeCloseTag('div'));
1228066fee30SAndreas Gohr  }
1229fdb8d77bSTom N Harris  html_form('edit', $form);
1230fdb8d77bSTom N Harris  print '</div>'.NL;
1231f3f0262cSandi}
1232f3f0262cSandi
1233f3f0262cSandi/**
1234b6912aeaSAndreas Gohr * Adds a checkbox for minor edits for logged in users
1235b6912aeaSAndreas Gohr *
1236b6912aeaSAndreas Gohr * @author Andrea Gohr <andi@splitbrain.org>
1237b6912aeaSAndreas Gohr */
1238b6912aeaSAndreas Gohrfunction html_minoredit(){
1239b6912aeaSAndreas Gohr  global $conf;
1240b6912aeaSAndreas Gohr  global $lang;
1241b6912aeaSAndreas Gohr  // minor edits are for logged in users only
1242b6912aeaSAndreas Gohr  if(!$conf['useacl'] || !$_SERVER['REMOTE_USER']){
1243fdb8d77bSTom N Harris    return false;
1244b6912aeaSAndreas Gohr  }
1245b6912aeaSAndreas Gohr
1246b6912aeaSAndreas Gohr  $p = array();
1247b6912aeaSAndreas Gohr  $p['tabindex'] = 3;
1248bb4866bdSchris  if(!empty($_REQUEST['minor'])) $p['checked']='checked';
1249fdb8d77bSTom N Harris  return form_makeCheckboxField('minor', '1', $lang['minoredit'], 'minoredit', 'nowrap', $p);
1250b6912aeaSAndreas Gohr}
1251b6912aeaSAndreas Gohr
1252b6912aeaSAndreas Gohr/**
1253f3f0262cSandi * prints some debug info
125415fae107Sandi *
125515fae107Sandi * @author Andreas Gohr <andi@splitbrain.org>
1256f3f0262cSandi */
1257f3f0262cSandifunction html_debug(){
1258f3f0262cSandi  global $conf;
1259d16a4edaSandi  global $lang;
12605298a619SAndreas Gohr  global $auth;
1261100a97e3SAndreas Gohr  global $INFO;
1262100a97e3SAndreas Gohr
126328fb55ffSandi  //remove sensitive data
126428fb55ffSandi  $cnf = $conf;
126524297a69SAndreas Gohr  debug_guard($cnf);
1266100a97e3SAndreas Gohr  $nfo = $INFO;
126724297a69SAndreas Gohr  debug_guard($nfo);
1268100a97e3SAndreas Gohr  $ses = $_SESSION;
126924297a69SAndreas Gohr  debug_guard($ses);
1270f3f0262cSandi
1271f3f0262cSandi  print '<html><body>';
1272f3f0262cSandi
1273f3f0262cSandi  print '<p>When reporting bugs please send all the following ';
1274f3f0262cSandi  print 'output as a mail to andi@splitbrain.org ';
1275f3f0262cSandi  print 'The best way to do this is to save this page in your browser</p>';
1276f3f0262cSandi
1277100a97e3SAndreas Gohr  print '<b>$INFO:</b><pre>';
1278100a97e3SAndreas Gohr  print_r($nfo);
1279100a97e3SAndreas Gohr  print '</pre>';
1280100a97e3SAndreas Gohr
1281f3f0262cSandi  print '<b>$_SERVER:</b><pre>';
1282f3f0262cSandi  print_r($_SERVER);
1283f3f0262cSandi  print '</pre>';
1284f3f0262cSandi
1285f3f0262cSandi  print '<b>$conf:</b><pre>';
128628fb55ffSandi  print_r($cnf);
1287f3f0262cSandi  print '</pre>';
1288f3f0262cSandi
1289ed7b5f09Sandi  print '<b>DOKU_BASE:</b><pre>';
1290ed7b5f09Sandi  print DOKU_BASE;
1291f3f0262cSandi  print '</pre>';
1292f3f0262cSandi
1293ed7b5f09Sandi  print '<b>abs DOKU_BASE:</b><pre>';
1294ed7b5f09Sandi  print DOKU_URL;
1295ed7b5f09Sandi  print '</pre>';
1296ed7b5f09Sandi
1297ed7b5f09Sandi  print '<b>rel DOKU_BASE:</b><pre>';
1298f3f0262cSandi  print dirname($_SERVER['PHP_SELF']).'/';
1299f3f0262cSandi  print '</pre>';
1300f3f0262cSandi
1301f3f0262cSandi  print '<b>PHP Version:</b><pre>';
1302f3f0262cSandi  print phpversion();
1303f3f0262cSandi  print '</pre>';
1304f3f0262cSandi
1305f3f0262cSandi  print '<b>locale:</b><pre>';
1306f3f0262cSandi  print setlocale(LC_ALL,0);
1307f3f0262cSandi  print '</pre>';
1308f3f0262cSandi
1309d16a4edaSandi  print '<b>encoding:</b><pre>';
1310d16a4edaSandi  print $lang['encoding'];
1311d16a4edaSandi  print '</pre>';
1312d16a4edaSandi
13135298a619SAndreas Gohr  if($auth){
13145298a619SAndreas Gohr    print '<b>Auth backend capabilities:</b><pre>';
13155298a619SAndreas Gohr    print_r($auth->cando);
13165298a619SAndreas Gohr    print '</pre>';
13175298a619SAndreas Gohr  }
13185298a619SAndreas Gohr
13193aa54d7cSAndreas Gohr  print '<b>$_SESSION:</b><pre>';
1320100a97e3SAndreas Gohr  print_r($ses);
13213aa54d7cSAndreas Gohr  print '</pre>';
13223aa54d7cSAndreas Gohr
1323f3f0262cSandi  print '<b>Environment:</b><pre>';
1324f3f0262cSandi  print_r($_ENV);
1325f3f0262cSandi  print '</pre>';
1326f3f0262cSandi
1327f3f0262cSandi  print '<b>PHP settings:</b><pre>';
1328f3f0262cSandi  $inis = ini_get_all();
1329f3f0262cSandi  print_r($inis);
1330f3f0262cSandi  print '</pre>';
1331f3f0262cSandi
1332f3f0262cSandi  print '</body></html>';
1333f3f0262cSandi}
1334f3f0262cSandi
1335c19fe9c0Sandifunction html_admin(){
1336c19fe9c0Sandi  global $ID;
1337f8cc712eSAndreas Gohr  global $INFO;
1338c19fe9c0Sandi  global $lang;
1339ca3a6df1SMatthias Grimm  global $conf;
1340c19fe9c0Sandi
1341c112d578Sandi  print p_locale_xhtml('admin');
1342c19fe9c0Sandi
134311e2ce22Schris  // build menu of admin functions from the plugins that handle them
134411e2ce22Schris  $pluginlist = plugin_list('admin');
134511e2ce22Schris  $menu = array();
134611e2ce22Schris  foreach ($pluginlist as $p) {
134711e2ce22Schris    if($obj =& plugin_load('admin',$p) === NULL) continue;
1348f8cc712eSAndreas Gohr
1349f8cc712eSAndreas Gohr    // check permissions
1350f8cc712eSAndreas Gohr    if($obj->forAdminOnly() && !$INFO['isadmin']) continue;
1351f8cc712eSAndreas Gohr
135211e2ce22Schris    $menu[] = array('plugin' => $p,
135311e2ce22Schris                    'prompt' => $obj->getMenuText($conf['lang']),
135411e2ce22Schris                    'sort' => $obj->getMenuSort()
135511e2ce22Schris                   );
135611e2ce22Schris  }
135711e2ce22Schris
1358746855cfSBen Coburn  usort($menu, 'p_sort_modes');
135911e2ce22Schris
136011e2ce22Schris  // output the menu
136111e2ce22Schris  ptln('<ul>');
136211e2ce22Schris
136311e2ce22Schris  foreach ($menu as $item) {
136411e2ce22Schris    if (!$item['prompt']) continue;
13650c6b58a8SAndreas Gohr    ptln('  <li><div class="li"><a href="'.wl($ID, 'do=admin&amp;page='.$item['plugin']).'">'.$item['prompt'].'</a></div></li>');
136611e2ce22Schris  }
136711e2ce22Schris
136811e2ce22Schris  ptln('</ul>');
1369ca3a6df1SMatthias Grimm}
1370c19fe9c0Sandi
13718b06d178Schris/**
13728b06d178Schris * Form to request a new password for an existing account
13738b06d178Schris *
13748b06d178Schris * @author Benoit Chesneau <benoit@bchesneau.info>
137511e2ce22Schris */
13768b06d178Schrisfunction html_resendpwd() {
13778b06d178Schris  global $lang;
13788b06d178Schris  global $conf;
13798b06d178Schris  global $ID;
1380c19fe9c0Sandi
13818b06d178Schris  print p_locale_xhtml('resendpwd');
1382fdb8d77bSTom N Harris  print '<div class="centeralign">'.NL;
1383fdb8d77bSTom N Harris  $form = new Doku_Form('dw__resendpwd', wl($ID));
1384fdb8d77bSTom N Harris  $form->startFieldset($lang['resendpwd']);
1385fdb8d77bSTom N Harris  $form->addHidden('do', 'resendpwd');
1386fdb8d77bSTom N Harris  $form->addHidden('save', '1');
1387fdb8d77bSTom N Harris  $form->addElement(form_makeTag('br'));
1388fdb8d77bSTom N Harris  $form->addElement(form_makeTextField('login', $_POST['login'], $lang['user'], '', 'block'));
1389fdb8d77bSTom N Harris  $form->addElement(form_makeTag('br'));
1390fdb8d77bSTom N Harris  $form->addElement(form_makeTag('br'));
1391fdb8d77bSTom N Harris  $form->addElement(form_makeButton('submit', '', $lang['btn_resendpwd']));
1392fdb8d77bSTom N Harris  $form->endFieldset();
1393fdb8d77bSTom N Harris  html_form('resendpwd', $form);
1394fdb8d77bSTom N Harris  print '</div>'.NL;
1395fdb8d77bSTom N Harris}
1396fdb8d77bSTom N Harris
1397fdb8d77bSTom N Harris/**
1398b8595a66SAndreas Gohr * Return the TOC rendered to XHTML
1399b8595a66SAndreas Gohr *
1400b8595a66SAndreas Gohr * @author Andreas Gohr <andi@splitbrain.org>
1401b8595a66SAndreas Gohr */
1402b8595a66SAndreas Gohrfunction html_TOC($toc){
1403b8595a66SAndreas Gohr    if(!count($toc)) return '';
1404b8595a66SAndreas Gohr    global $lang;
1405b8595a66SAndreas Gohr    $out  = '<!-- TOC START -->'.DOKU_LF;
1406b8595a66SAndreas Gohr    $out .= '<div class="toc">'.DOKU_LF;
1407b8595a66SAndreas Gohr    $out .= '<div class="tocheader toctoggle" id="toc__header">';
1408b8595a66SAndreas Gohr    $out .= $lang['toc'];
1409b8595a66SAndreas Gohr    $out .= '</div>'.DOKU_LF;
1410b8595a66SAndreas Gohr    $out .= '<div id="toc__inside">'.DOKU_LF;
1411b8595a66SAndreas Gohr    $out .= html_buildlist($toc,'toc','html_list_toc');
1412b8595a66SAndreas Gohr    $out .= '</div>'.DOKU_LF.'</div>'.DOKU_LF;
1413b8595a66SAndreas Gohr    $out .= '<!-- TOC END -->'.DOKU_LF;
1414b8595a66SAndreas Gohr    return $out;                                                                                                }
1415b8595a66SAndreas Gohr
1416b8595a66SAndreas Gohr/**
1417b8595a66SAndreas Gohr * Callback for html_buildlist
1418b8595a66SAndreas Gohr */
1419b8595a66SAndreas Gohrfunction html_list_toc($item){
14207d91652aSAndreas Gohr    if($item['hid']){
14217d91652aSAndreas Gohr        $link = '#'.$item['hid'];
14227d91652aSAndreas Gohr    }else{
14237d91652aSAndreas Gohr        $link = $item['link'];
14247d91652aSAndreas Gohr    }
14257d91652aSAndreas Gohr
14267d91652aSAndreas Gohr    return '<span class="li"><a href="'.$link.'" class="toc">'.
1427b8595a66SAndreas Gohr           hsc($item['title']).'</a></span>';
1428b8595a66SAndreas Gohr}
1429b8595a66SAndreas Gohr
1430b8595a66SAndreas Gohr/**
1431b8595a66SAndreas Gohr * Helper function to build TOC items
1432b8595a66SAndreas Gohr *
1433b8595a66SAndreas Gohr * Returns an array ready to be added to a TOC array
1434b8595a66SAndreas Gohr *
1435b8595a66SAndreas Gohr * @param string $link  - where to link (if $hash set to '#' it's a local anchor)
1436b8595a66SAndreas Gohr * @param string $text  - what to display in the TOC
1437b8595a66SAndreas Gohr * @param int    $level - nesting level
1438b8595a66SAndreas Gohr * @param string $hash  - is prepended to the given $link, set blank if you want full links
1439b8595a66SAndreas Gohr */
1440b8595a66SAndreas Gohrfunction html_mktocitem($link, $text, $level, $hash='#'){
1441b8595a66SAndreas Gohr    global $conf;
1442b8595a66SAndreas Gohr    return  array( 'link'  => $hash.$link,
1443b8595a66SAndreas Gohr                   'title' => $text,
1444b8595a66SAndreas Gohr                   'type'  => 'ul',
14452bb0d541Schris                   'level' => $level);
1446b8595a66SAndreas Gohr}
1447b8595a66SAndreas Gohr
1448b8595a66SAndreas Gohr/**
1449fdb8d77bSTom N Harris * Output a Doku_Form object.
1450fdb8d77bSTom N Harris * Triggers an event with the form name: HTML_{$name}FORM_OUTPUT
1451fdb8d77bSTom N Harris *
1452fdb8d77bSTom N Harris * @author Tom N Harris <tnharris@whoopdedo.org>
1453fdb8d77bSTom N Harris */
1454fdb8d77bSTom N Harrisfunction html_form($name, &$form) {
1455fdb8d77bSTom N Harris  // Safety check in case the caller forgets.
1456fdb8d77bSTom N Harris  $form->endFieldset();
1457fdb8d77bSTom N Harris  trigger_event('HTML_'.strtoupper($name).'FORM_OUTPUT', $form, 'html_form_output', false);
1458fdb8d77bSTom N Harris}
1459fdb8d77bSTom N Harris
1460fdb8d77bSTom N Harris/**
1461fdb8d77bSTom N Harris * Form print function.
1462fdb8d77bSTom N Harris * Just calls printForm() on the data object.
1463fdb8d77bSTom N Harris */
1464fdb8d77bSTom N Harrisfunction html_form_output($data) {
1465fdb8d77bSTom N Harris  $data->printForm();
14668b06d178Schris}
1467340756e4Sandi
146807bf32b2SAndreas Gohr/**
146907bf32b2SAndreas Gohr * Embed a flash object in HTML
147007bf32b2SAndreas Gohr *
147107bf32b2SAndreas Gohr * This will create the needed HTML to embed a flash movie in a cross browser
147207bf32b2SAndreas Gohr * compatble way using valid XHTML
147307bf32b2SAndreas Gohr *
147407bf32b2SAndreas Gohr * The parameters $params, $flashvars and $atts need to be associative arrays.
147507bf32b2SAndreas Gohr * No escaping needs to be done for them. The alternative content *has* to be
147607bf32b2SAndreas Gohr * escaped because it is used as is. If no alternative content is given
147707bf32b2SAndreas Gohr * $lang['noflash'] is used.
147807bf32b2SAndreas Gohr *
147907bf32b2SAndreas Gohr * @author Andreas Gohr <andi@splitbrain.org>
148007bf32b2SAndreas Gohr * @link   http://latrine.dgx.cz/how-to-correctly-insert-a-flash-into-xhtml
148107bf32b2SAndreas Gohr *
148207bf32b2SAndreas Gohr * @param string $swf      - the SWF movie to embed
148307bf32b2SAndreas Gohr * @param int $width       - width of the flash movie in pixels
148407bf32b2SAndreas Gohr * @param int $height      - height of the flash movie in pixels
148507bf32b2SAndreas Gohr * @param array $params    - additional parameters (<param>)
148607bf32b2SAndreas Gohr * @param array $flashvars - parameters to be passed in the flashvar parameter
148707bf32b2SAndreas Gohr * @param array $atts      - additional attributes for the <object> tag
148807bf32b2SAndreas Gohr * @param string $alt      - alternative content (is NOT automatically escaped!)
148907bf32b2SAndreas Gohr * @returns string         - the XHTML markup
149007bf32b2SAndreas Gohr */
149107bf32b2SAndreas Gohrfunction html_flashobject($swf,$width,$height,$params=null,$flashvars=null,$atts=null,$alt=''){
149207bf32b2SAndreas Gohr    global $lang;
149307bf32b2SAndreas Gohr
149407bf32b2SAndreas Gohr    $out = '';
149507bf32b2SAndreas Gohr
149607bf32b2SAndreas Gohr    // prepare the object attributes
149707bf32b2SAndreas Gohr    if(is_null($atts)) $atts = array();
149807bf32b2SAndreas Gohr    $atts['width']  = (int) $width;
1499d4c61e61SAndreas Gohr    $atts['height'] = (int) $height;
150007bf32b2SAndreas Gohr    if(!$atts['width'])  $atts['width']  = 425;
150107bf32b2SAndreas Gohr    if(!$atts['height']) $atts['height'] = 350;
150207bf32b2SAndreas Gohr
150307bf32b2SAndreas Gohr    // add object attributes for standard compliant browsers
150407bf32b2SAndreas Gohr    $std = $atts;
150507bf32b2SAndreas Gohr    $std['type'] = 'application/x-shockwave-flash';
150607bf32b2SAndreas Gohr    $std['data'] = $swf;
150707bf32b2SAndreas Gohr
150807bf32b2SAndreas Gohr    // add object attributes for IE
150907bf32b2SAndreas Gohr    $ie  = $atts;
151007bf32b2SAndreas Gohr    $ie['classid'] = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';
151107bf32b2SAndreas Gohr
151207bf32b2SAndreas Gohr    // open object (with conditional comments)
151307bf32b2SAndreas Gohr    $out .= '<!--[if !IE]> -->'.NL;
151407bf32b2SAndreas Gohr    $out .= '<object '.buildAttributes($std).'>'.NL;
151507bf32b2SAndreas Gohr    $out .= '<!-- <![endif]-->'.NL;
151607bf32b2SAndreas Gohr    $out .= '<!--[if IE]>'.NL;
151707bf32b2SAndreas Gohr    $out .= '<object '.buildAttributes($ie).'>'.NL;
151807bf32b2SAndreas Gohr    $out .= '    <param name="movie" value="'.hsc($swf).'" />'.NL;
15199ae41cdcSAndreas Gohr    $out .= '<!--><!-- -->'.NL;
152007bf32b2SAndreas Gohr
152107bf32b2SAndreas Gohr    // print params
152207bf32b2SAndreas Gohr    if(is_array($params)) foreach($params as $key => $val){
152307bf32b2SAndreas Gohr        $out .= '  <param name="'.hsc($key).'" value="'.hsc($val).'" />'.NL;
152407bf32b2SAndreas Gohr    }
152507bf32b2SAndreas Gohr
152607bf32b2SAndreas Gohr    // add flashvars
152707bf32b2SAndreas Gohr    if(is_array($flashvars)){
1528d4c61e61SAndreas Gohr        $out .= '  <param name="FlashVars" value="'.buildURLparams($flashvars).'" />'.NL;
152907bf32b2SAndreas Gohr    }
153007bf32b2SAndreas Gohr
153107bf32b2SAndreas Gohr    // alternative content
153207bf32b2SAndreas Gohr    if($alt){
153307bf32b2SAndreas Gohr        $out .= $alt.NL;
153407bf32b2SAndreas Gohr    }else{
153507bf32b2SAndreas Gohr        $out .= $lang['noflash'].NL;
153607bf32b2SAndreas Gohr    }
153707bf32b2SAndreas Gohr
153807bf32b2SAndreas Gohr    // finish
153907bf32b2SAndreas Gohr    $out .= '</object>'.NL;
154007bf32b2SAndreas Gohr    $out .= '<!-- <![endif]-->'.NL;
154107bf32b2SAndreas Gohr
154207bf32b2SAndreas Gohr    return $out;
154307bf32b2SAndreas Gohr}
154407bf32b2SAndreas Gohr
1545340756e4Sandi//Setup VIM: ex: et ts=2 enc=utf-8 :
1546