1<?php
2/**
3 * DokuWiki template scanlines functions
4 *
5 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
6 * @author  Michael Klier <chi@chimeric.de>
7 * @author  Johannes Winkler <johannes@rocking-minds.org>
8 */
9
10// must be run from within DokuWiki
11if (!defined('DOKU_INC')) die();
12if (!defined('DOKU_LF')) define('DOKU_LF',"\n");
13
14// load language files
15require_once(DOKU_TPLINC.'lang/en/lang.php');
16if(@file_exists(DOKU_TPLINC.'lang/'.$conf['lang'].'/lang.php')) {
17    require_once(DOKU_TPLINC.'lang/'.$conf['lang'].'/lang.php');
18}
19
20// load sidebar contents
21$sbl   = explode(',',tpl_getConf('left_sidebar_content'));
22$sbr   = explode(',',tpl_getConf('right_sidebar_content'));
23$sbpos = tpl_getConf('sidebar');
24
25// set notoc option and toolbar regarding the sitebar setup
26switch($sbpos) {
27  case 'left':
28    $notoc = (in_array('toc',$sbl)) ? true : false;
29    $toolb = (in_array('toolbox',$sbl)) ? true : false;
30    break;
31  case 'right':
32    $notoc = (in_array('toc',$sbr)) ? true : false;
33    $toolb = (in_array('toolbox',$sbr)) ? true : false;
34    break;
35  case 'none':
36    $notoc = false;
37    $toolb = false;
38    break;
39}
40
41/**
42 * Prints the sidebars
43 *
44 * @author Michael Klier <chi@chimeric.de>
45 */
46function tpl_sidebar($pos) {
47
48    $sb_order   = ($pos == 'left') ? explode(',', tpl_getConf('left_sidebar_order'))   : explode(',', tpl_getConf('right_sidebar_order'));
49    $sb_content = ($pos == 'left') ? explode(',', tpl_getConf('left_sidebar_content')) : explode(',', tpl_getConf('right_sidebar_content'));
50
51    // process contents by given order
52    foreach($sb_order as $sb) {
53        if(in_array($sb,$sb_content)) {
54            $key = array_search($sb,$sb_content);
55            unset($sb_content[$key]);
56            tpl_sidebar_dispatch($sb,$pos);
57        }
58    }
59
60    // check for left content not specified by order
61    if(is_array($sb_content) && !empty($sb_content) > 0) {
62        foreach($sb_content as $sb) {
63            tpl_sidebar_dispatch($sb,$pos);
64        }
65    }
66}
67
68/**
69 * Dispatches the given sidebar type to return the right content
70 *
71 * @author Michael Klier <chi@chimeric.de>
72 */
73function tpl_sidebar_dispatch($sb,$pos) {
74    global $lang;
75    global $conf;
76    global $ID;
77    global $REV;
78    global $INFO;
79    global $TOC;
80
81    $svID  = $ID;   // save current ID
82    $svREV = $REV;  // save current REV
83    $svTOC = $TOC;  // save current TOC
84
85    $pname = tpl_getConf('pagename');
86
87    switch($sb) {
88
89        case 'main':
90       		if(tpl_getConf('closedwiki1') && !isset($_SERVER['REMOTE_USER'])) return;
91            if(tpl_getConf('closedwiki2') && !isset($_SERVER['REMOTE_USER'])) return;
92            $main_sb = $pname;
93            if(@page_exists($main_sb) && auth_quickaclcheck($main_sb) >= AUTH_READ) {
94                $always = tpl_getConf('main_sidebar_always');
95                if($always or (!$always && !getNS($ID))) {
96                    print '<div class="sidebar_single">' . DOKU_LF;
97                    print '	<div class="sidebar_title">' . $main_sb . '</div>' . DOKU_LF;
98                    print '	<div class="sidebar_content">' . DOKU_LF;
99                    print 			p_sidebar_xhtml($main_sb,$pos) . DOKU_LF;
100                    print '</div>' . DOKU_LF;
101                    print '</div>' . DOKU_LF;
102                }
103            } elseif(!@page_exists($main_sb) && auth_quickaclcheck($main_sb) >= AUTH_CREATE) {
104                if(@file_exists(DOKU_TPLINC.'lang/'. $conf['lang'].'/nonidebar.txt')) {
105                    $out = p_render('xhtml', p_get_instructions(io_readFile(DOKU_TPLINC.'lang/'.$conf['lang'].'/nosidebar.txt')), $info);
106                } else {
107                    $out = p_render('xhtml', p_get_instructions(io_readFile(DOKU_TPLINC.'lang/en/nosidebar.txt')), $info);
108                }
109                $link = '<a href="' . wl($pname) . '" class="wikilink2">' . $pname . '</a>' . DOKU_LF;
110                print '<div class="sidebar_single">' . DOKU_LF;
111                print '	<div class="sidebar_title">' . $main_sb . '</div>' . DOKU_LF;
112                print '		<div class="sidebar_content">' . DOKU_LF;
113                print 			str_replace('LINK', $link, $out);
114                print '</div>' . DOKU_LF;
115                print '</div>' . DOKU_LF;
116            }
117            break;
118
119
120
121
122        case 'namespace':
123        		if(tpl_getConf('closedwiki1') && !isset($_SERVER['REMOTE_USER'])) return;
124            if(tpl_getConf('closedwiki2') && !isset($_SERVER['REMOTE_USER'])) return;
125            $user_ns  = tpl_getConf('user_sidebar_namespace');
126            $group_ns = tpl_getConf('group_sidebar_namespace');
127            if(!preg_match("/^".$user_ns.":.*?$|^".$group_ns.":.*?$/", $svID)) { // skip group/user sidebars and current ID
128                $ns_sb = _getNsSb($svID);
129                if($ns_sb && auth_quickaclcheck($ns_sb) >= AUTH_READ) {
130                	print '<div class="sidebar_single">' . DOKU_LF;
131               	print '	<div class="sidebar_title">' . $lang['namespace'] . '</div>' . DOKU_LF;
132                	print '	<div class="sidebar_content">' . DOKU_LF;
133                  print 		p_sidebar_xhtml($ns_sb,$pos) . DOKU_LF;
134                  print '	</div>' . DOKU_LF;
135                  print '</div>' . DOKU_LF;
136                }
137            }
138            break;
139
140        case 'user':
141        		if(tpl_getConf('closedwiki1') && !isset($_SERVER['REMOTE_USER'])) return;
142            if(tpl_getConf('closedwiki2') && !isset($_SERVER['REMOTE_USER'])) return;
143            $user_ns = tpl_getConf('user_sidebar_namespace');
144            if(isset($INFO['userinfo']['name'])) {
145                $user = $_SERVER['REMOTE_USER'];
146                $user_sb = $user_ns . ':' . $user . ':' . $pname;
147                if(@page_exists($user_sb)) {
148                    $subst = array('pattern' => array('/@USER@/'), 'replace' => array($user));
149                	  print '<div class="sidebar_single">' . DOKU_LF;
150               	  print '	<div class="sidebar_title">' . DOKU_LF;
151               	  					if($user_ns) {print $user_ns;
152               	  					} else {print $lang['user'] . DOKU_LF;}
153               	  print '	</div>' . DOKU_LF;
154               	  print '	<div class="sidebar_content">' . DOKU_LF;
155                    print 			p_sidebar_xhtml($user_sb,$pos,$subst) . DOKU_LF;
156                    print '	</div>' . DOKU_LF;
157            		  print '</div>' . DOKU_LF;
158                }
159                // check for namespace sidebars in user namespace too
160                if(preg_match('/'.$user_ns.':'.$user.':.*/', $svID)) {
161                    $ns_sb = _getNsSb($svID);
162                    if($ns_sb && $ns_sb != $user_sb && auth_quickaclcheck($ns_sb) >= AUTH_READ) {
163                    	   print '<div class="sidebar_single">' . DOKU_LF;
164               	  		print '	<div class="sidebar_title">' . DOKU_LF;
165               	  						if($user_ns) {print $user_ns;
166               	  						} else {print $lang['user'] . DOKU_LF;}
167               	  		print '	</div>' . DOKU_LF;
168               	      print '	<div class="sidebar_content">' . DOKU_LF;
169                        print 		p_sidebar_xhtml($ns_sb,$pos) . DOKU_LF;
170                        print '	</div>' . DOKU_LF;
171            				print '</div>' . DOKU_LF;
172                    }
173                }
174
175            }
176            break;
177
178        case 'group':
179        		if(tpl_getConf('closedwiki1') && !isset($_SERVER['REMOTE_USER'])) return;
180            if(tpl_getConf('closedwiki2') && !isset($_SERVER['REMOTE_USER'])) return;
181            $group_ns = tpl_getConf('group_sidebar_namespace');
182            if(isset($INFO['userinfo']['name'], $INFO['userinfo']['grps'])) {
183                foreach($INFO['userinfo']['grps'] as $grp) {
184                    $group_sb = $group_ns.':'.$grp.':'.$pname;
185                    if(@page_exists($group_sb) && auth_quickaclcheck(cleanID($group_sb)) >= AUTH_READ) {
186                        $subst = array('pattern' => array('/@GROUP@/'), 'replace' => array($grp));
187                        print '<div class="sidebar_single">' . DOKU_LF;
188               	  		print '	<div class="sidebar_title">' . DOKU_LF;
189               	  						if($group_ns) {print $group_ns;
190               	  						} else {print $lang['group'] . DOKU_LF;}
191               	  		print '	</div>' . DOKU_LF;
192               	      print '	<div class="sidebar_content">' . DOKU_LF;
193                        print 		p_sidebar_xhtml($group_sb,$pos,$subst) . DOKU_LF;
194                        print '	</div>' . DOKU_LF;
195                        print '</div>' . DOKU_LF;
196                    }
197                }
198            }
199            break;
200
201        case 'index':
202        		if(tpl_getConf('closedwiki1') && !isset($_SERVER['REMOTE_USER'])) return;
203            if(tpl_getConf('closedwiki2') && !isset($_SERVER['REMOTE_USER'])) return;
204            print '<div class="sidebar_single">' . DOKU_LF;
205            print '	<div class="sidebar_title">' . $lang['index'] . '</div>' . DOKU_LF;
206            print '	<div class="sidebar_content">' . DOKU_LF;
207            print 		'  ' . p_index_xhtml($svID,$pos) . DOKU_LF;
208            print '		</div>' . DOKU_LF;
209            print '</div>' . DOKU_LF;
210            break;
211
212        case 'toc':
213        		if(tpl_getConf('closedwiki1') && !isset($_SERVER['REMOTE_USER'])) return;
214				if (auth_quickaclcheck($svID) >= AUTH_READ) {
215           		$toc = tpl_toc(true);
216           	   if(!empty($toc)) {
217						print tpl_toc(true);
218					}
219            }
220            break;
221
222        case 'toolbox':
223				if(tpl_getConf('closedwiki1') && !isset($_SERVER['REMOTE_USER'])) return;
224            if(tpl_getConf('hideactions') && !isset($_SERVER['REMOTE_USER'])) return;
225
226            if(tpl_getConf('closedwiki2') && !isset($_SERVER['REMOTE_USER'])) {
227
228            	 print '<div class="sidebar_single">' . DOKU_LF;
229                print '	<div class="sidebar_title">' . $lang['toolbox'] . '</div>' . DOKU_LF;
230                print '	<div class="sidebar_content">' . DOKU_LF;
231                print '		<div class="li_toolbox">' . DOKU_LF;
232                print ' 		<ul>' . DOKU_LF;
233                print '				<li>';
234                							tpl_actionlink('login');
235                print '      		</li>' . DOKU_LF;
236                print '    	</ul>' . DOKU_LF;
237                print '		</div>' . DOKU_LF;
238                print '	</div>' . DOKU_LF;
239                print '</div>' . DOKU_LF;
240
241            } else {
242                $actions = array('admin',
243                                 'revert',
244                                 'edit',
245                                 'history',
246                                 'recent',
247                                 'backlink',
248                                 'subscription',
249                                 'index',
250                                 'login',
251                                 'profile',
252                                 'top');
253
254            	 print '<div class="sidebar_single">' . DOKU_LF;
255                print '	<div class="sidebar_title">' . $lang['toolbox'] . '</div>' . DOKU_LF;
256                print '	<div class="sidebar_content">' . DOKU_LF;
257                print '		<div class="li_toolbox">' . DOKU_LF;
258                print '    	<ul>' . DOKU_LF;
259
260                foreach($actions as $action) {
261                    if(!actionOK($action)) continue;
262                    // start output buffering
263                    if($action == 'edit') {
264                        // check if new page button plugin is available
265                        if(!plugin_isdisabled('npd') && ($npd =& plugin_load('helper', 'npd'))) {
266                            $npb = $npd->html_new_page_button(true);
267                            if($npb) {
268                              	print '<li>';
269                                 print $npb;
270                                 print '</li>' . DOKU_LF;
271                            }
272                        }
273                    }
274                    ob_start();
275                    print '<li>';
276                    if(tpl_actionlink($action)) {
277                        print '</li>' . DOKU_LF;
278                        ob_end_flush();
279                    } else {
280                        ob_end_clean();
281                    }
282                }
283
284                print '    	</ul>' . DOKU_LF;
285                print '  	</div>' . DOKU_LF;
286                print '  </div>' . DOKU_LF;
287                print '</div>' . DOKU_LF;
288            }
289
290            break;
291
292        case 'trace':
293        		if(tpl_getConf('closedwiki1') && !isset($_SERVER['REMOTE_USER'])) return;
294            if(tpl_getConf('closedwiki2') && !isset($_SERVER['REMOTE_USER'])) return;
295            print '<div class="sidebar_single">' . DOKU_LF;
296            print '	<div class="sidebar_title">'. $lang['breadcrumb'].'</div>' . DOKU_LF;
297            print '	<div class="sidebar_content">' . DOKU_LF;
298              				($conf['youarehere'] != 1) ? tpl_breadcrumbs() : tpl_youarehere();
299            print '  </div>' . DOKU_LF;
300            print '</div>' . DOKU_LF;
301            break;
302
303        case 'extra':
304        		if(tpl_getConf('closedwiki1') && !isset($_SERVER['REMOTE_USER'])) return;
305            if(tpl_getConf('closedwiki2') && !isset($_SERVER['REMOTE_USER'])) return;
306            print '<div class="sidebar_single">' . DOKU_LF;
307            print '	<div class="sidebar_content">';
308            				@include(dirname(__FILE__).'/' . $pos .'_sidebar.html');
309            				 tpl_userinfo();
310            print '	</div>' . DOKU_LF;
311            print '</div>' . DOKU_LF;
312            break;
313
314
315
316        default:
317        		if(tpl_getConf('closedwiki1') && !isset($_SERVER['REMOTE_USER'])) return;
318            if(tpl_getConf('closedwiki2') && !isset($_SERVER['REMOTE_USER'])) return;
319            // check for user defined sidebars
320            if(@file_exists(DOKU_TPLINC.'sidebars/'.$sb.'/sidebar.php')) {
321            	print '<div class="sidebar_single">' . DOKU_LF;
322               print '	<div class="sidebar_title">' . $sb . '</div>' . DOKU_LF;
323					print '	<div class="sidebar_content">' . DOKU_LF;
324                   			@require_once(DOKU_TPLINC.'sidebars/'.$sb.'/sidebar.php');
325            	print '	</div>' . DOKU_LF;
326            	print '</div>' . DOKU_LF;
327            }
328            break;
329    }
330
331    // restore ID, REV and TOC
332    $ID  = $svID;
333    $REV = $svREV;
334    $TOC = $svTOC;
335}
336
337/**
338 * Removes the TOC of the sidebar pages and
339 * shows a edit button if the user has enough rights
340 *
341 * TODO sidebar caching
342 *
343 * @author Michael Klier <chi@chimeric.de>
344 */
345function p_sidebar_xhtml($sb,$pos,$subst=array()) {
346    $data = p_wiki_xhtml($sb,'',false);
347    if(!empty($subst)) {
348        $data = preg_replace($subst['pattern'], $subst['replace'], $data);
349    }
350    if(auth_quickaclcheck($sb) >= AUTH_EDIT) {
351        $data .= '<div class="secedit">'.html_btn('secedit',$sb,'',array('do'=>'edit','rev'=>'','post')).'</div>';
352    }
353    // strip TOC
354    $data = preg_replace('/<div class="toc">.*?(<\/div>\n<\/div>)/s', '', $data);
355    // replace headline ids for XHTML compliance
356    $data = preg_replace('/(<h.*?><a.*?name=")(.*?)(".*?id=")(.*?)(">.*?<\/a><\/h.*?>)/','\1sb_'.$pos.'_\2\3sb_'.$pos.'_\4\5', $data);
357    return ($data);
358}
359
360/**
361 * Renders the Index
362 *
363 * copy of html_index located in /inc/html.php
364 *
365 * TODO update to new AJAX index possible?
366 *
367 * @author Andreas Gohr <andi@splitbrain.org>
368 * @author Michael Klier <chi@chimeric.de>
369 */
370function p_index_xhtml($ns,$pos) {
371  require_once(DOKU_INC.'inc/search.php');
372  global $conf;
373  global $ID;
374  $dir = $conf['datadir'];
375  $ns  = cleanID($ns);
376  #fixme use appropriate function
377  if(empty($ns)){
378    $ns = dirname(str_replace(':','/',$ID));
379    if($ns == '.') $ns ='';
380  }
381  $ns  = utf8_encodeFN(str_replace(':','/',$ns));
382
383  // extract only the headline
384  preg_match('/<h1>.*?<\/h1>/', p_locale_xhtml('index'), $match);
385  print preg_replace('#<h1(.*?id=")(.*?)(".*?)h1>#', '<h1\1sidebar_'.$pos.'_\2\3h1>', $match[0]);
386
387  $data = array();
388  search($data,$conf['datadir'],'search_index',array('ns' => $ns));
389
390  print '<div id="' . $pos . '__index__tree">' . DOKU_LF;
391  print html_buildlist($data,'idx','html_list_index','html_li_index');
392  print '</div>' . DOKU_LF;
393}
394
395/**
396 * searches for namespace sidebars
397 *
398 * @author Michael Klier <chi@chimeric.de>
399 */
400function _getNsSb($id) {
401    $pname = tpl_getConf('pagename');
402    $ns_sb = '';
403    $path  = explode(':', $id);
404    $found = false;
405
406    while(count($path) > 0) {
407        $ns_sb = implode(':', $path).':'.$pname;
408        if(@page_exists($ns_sb)) return $ns_sb;
409        array_pop($path);
410    }
411
412    // nothing found
413    return false;
414}
415
416/**
417 * Checks wether the sidebar should be hidden or not
418 *
419 * @author Michael Klier <chi@chimeric.de>
420 */
421function tpl_sidebar_hide() {
422    global $ACT;
423    $act_hide = array( 'edit', 'preview', 'admin', 'conflict', 'draft', 'recover');
424    if(in_array($ACT, $act_hide)) {
425        return true;
426    } else {
427        return false;
428    }
429}
430
431function tpl_userbar() {
432	if(tpl_getConf('userbar')) {
433
434		if(!tpl_getConf('closedwiki2') || (tpl_getConf('closedwiki2') && isset($_SERVER['REMOTE_USER']))) {
435
436      	// check if new page button plugin is available
437        	if(!plugin_isdisabled('npd') && ($npd =& plugin_load('helper', 'npd'))) {
438        		$npd->html_new_page_button();
439        }
440
441      }
442   	if(!tpl_getConf('closedwiki2') || (tpl_getConf('closedwiki2') && isset($_SERVER['REMOTE_USER']))) {
443   	  	tpl_actionlink('admin');
444   	 	tpl_actionlink('profile');
445   	 	tpl_actionlink('login');
446
447   	} else {
448   	 	tpl_actionlink('login');
449   	}
450	}
451}
452
453function tpl_sitemap() {
454	if(tpl_getConf('sitemap')) {
455		tpl_button('index')  . DOKU_LF;
456	}
457}
458
459function tpl_closedwiki1() {
460	if(tpl_getConf('closedwiki1') && !isset($_SERVER['REMOTE_USER'])) {
461		print '<div class="page">' . DOKU_LF;
462		print '	<div class="page_title">' . DOKU_LF;
463						tpl_link(wl($ID,'do=backlink'),tpl_pagetitle($ID,true),'title="'.$lang['btn_backlink'].'"');
464		print '	</div>' . DOKU_LF;
465		print '	<div class="page_content">' . DOKU_LF;
466	   				// wikipage start
467	   print '		<div class="toc_none_sidebar">' . DOKU_LF;
468	   					tpl_toc();
469	   print '		</div>' . DOKU_LF;
470	   				tpl_content(false);
471	   				// wikipage stop
472	   print '	</div>' . DOKU_LF;
473	   print '</div>' . DOKU_LF;
474
475				// Pageinfo.
476		print '<div class="bar_bottom" id="bar__bottom">' . DOKU_LF;
477		print '	<div class="bar-left" id="bar__bottomleft">' . DOKU_LF;
478						tpl_pageinfo();
479		print '	</div>' . DOKU_LF;
480		print '	<div class="bar-right" id="bar__bottomright">' . DOKU_LF;
481			 			tpl_button('edit');
482			 			tpl_button('history');
483						tpl_button('revert');
484		print '	</div>' . DOKU_LF;
485		print '</div>' . DOKU_LF;
486
487
488	}
489}
490
491/* thanks to dokubook-template */
492function tpl_logo() {
493	global $conf;
494	$out = '';
495
496	switch(tpl_getConf('logo')) {
497		case 'text':
498			 $out .= '<h1>' . DOKU_LF;
499   		 $out .= '<a href="' . DOKU_BASE . '">' . $conf['title'] . '</a>' . DOKU_LF;
500   		 $out .= '</h1>' . DOKU_LF;
501			 $out .= '<h2>' . DOKU_LF;
502			 $out .= '	<span style="border-bottom: 2px dotted #ada899;">' . DOKU_LF;
503
504								if(tpl_getConf('logo_yourdefinition')) {
505									$out .= tpl_getConf('logo_yourdefinition')  . DOKU_LF;
506								}
507
508								$out .= '<br />' . DOKU_LF;
509
510								if(tpl_getConf('logo_yourname')) {
511									$out .= tpl_getConf('logo_yourname')  . DOKU_LF;
512								}
513
514			 $out .= '	</span>' . DOKU_LF;
515			 $out .= '</h2>' . DOKU_LF;
516			 break;
517
518		case 'image':
519    		switch(true) {
520        		case(tpl_getConf('logo_image')):
521         		$logo = tpl_getConf('logo_image');
522         	   break;
523
524      	   case(@file_exists(DOKU_TPLINC.'user/logo.jpg')):
525     	    	   $logo = DOKU_TPL.'user/logo.jpg';
526     	    	   break;
527			   case(@file_exists(DOKU_TPLINC.'user/logo.jpeg')):
528     	    	   $logo = DOKU_TPL.'user/logo.jpeg';
529     	    	   break;
530 			   case(@file_exists(DOKU_TPLINC.'user/logo.png')):
531     	    	   $logo = DOKU_TPL.'user/logo.png';
532     	    	   break;
533
534   	   	case(@file_exists(DOKU_TPLINC.'images/logo.jpg')):
535     	    	   $logo = DOKU_TPL.'images/logo.jpg';
536     	    	   break;
537			   case(@file_exists(DOKU_TPLINC.'images/logo.jpeg')):
538     	    	   $logo = DOKU_TPL.'images/logo.jpeg';
539     	    	   break;
540     	      case(@file_exists(DOKU_TPLINC.'images/logo.png')):
541     	    	   $logo = DOKU_TPL.'images/logo.png';
542     	    	   break;
543
544     	      default:
545     	    	   $logo = DOKU_TPL.'user/logo.png';
546     	    	   break;
547    	}
548
549    	$out .= '<a href="' . DOKU_BASE . '">';
550    	$out .= '  <img class="logo" src="' . $logo . '" alt="' . $conf['title'] . '" /></a>' . DOKU_LF;
551    	break;
552	}
553	print $out;
554}
555
556function tpl_navi() {
557	// nb = navibutton
558	print '<ul>' . DOKU_LF;
559
560				for ($i = 1; $i <= 6; $i++){
561					$nb = tpl_getConf('navibutton' . $i);
562					$nb_without_bracket = substr($nb, 2, -2);
563					$nb_explode = explode('|', $nb_without_bracket);
564					$nb_cleaned = array();
565					if (count($nb_explode) > 0) {
566	   				foreach ($nb_explode as $nb_foreach) {
567	     					if ($nb_foreach) {
568	      					$nb_cleaned[] = $nb_foreach;
569	     					}
570	   				}
571					}
572
573					if(!empty($nb_cleaned)) {
574						print '<li>' . DOKU_LF;
575						if((substr($nb_cleaned[0],0,7) == 'http://') || (substr($nb_cleaned[0],0,8) == 'https://')) {
576							print '<a href="' . $nb_cleaned[0] . '" >' . $nb_cleaned[1] . '</a>';
577						} else {tpl_link(wl($nb_cleaned[0]),$nb_cleaned[1]); }
578						print '<div class="border"></div></li>' . DOKU_LF;
579
580					}
581				}
582	print '</ul>' . DOKU_LF;
583}
584
585function tpl_top_link() {
586	if(tpl_getConf('top_link')) {
587   	print '<a href="#header" title="Back to top" rel="nofollow" accesskey="x" id="top_link"></a>' . DOKU_LF;
588	}
589}s
590
591?>
592