You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
1.8 KiB

14 years ago
14 years ago
14 years ago
14 years ago
14 years ago
14 years ago
14 years ago
14 years ago
14 years ago
14 years ago
14 years ago
  1. <?php
  2. /**
  3. * Template Functions
  4. *
  5. * This file provides template specific custom functions that are
  6. * not provided by the DokuWiki core.
  7. */
  8. // must be run from within DokuWiki
  9. if (!defined('DOKU_INC')) die();
  10. /**
  11. * Create link/button to discussion page and back
  12. *
  13. * @author Anika Henke <anika@selfthinker.org>
  14. */
  15. function _tpl_discussion($discussNS='discussion',$link=0,$wrapper=0,$reverse=0) {
  16. global $ID;
  17. if ($reverse) {
  18. $discussPage = $ID.':'.$discussNS;
  19. $isDiscussPage = substr($ID,-strlen($discussNS),strlen($discussNS))==$discussNS;
  20. $backID = substr($ID,0,-strlen($discussNS));
  21. } else {
  22. $discussPage = $discussNS.':'.$ID;
  23. $isDiscussPage = substr($ID,0,strlen($discussNS))==$discussNS;
  24. $backID = strstr($ID,':');
  25. }
  26. if ($wrapper) echo "<$wrapper>";
  27. if($isDiscussPage) {
  28. if ($link)
  29. tpl_pagelink($backID,tpl_getLang('back_to_article'));
  30. else
  31. echo html_btn('back2article',$backID,'',array(),0,0,tpl_getLang('back_to_article'));
  32. } else {
  33. if ($link)
  34. tpl_pagelink($discussPage,tpl_getLang('discussion'));
  35. else
  36. echo html_btn('discussion',$discussPage,'',array(),0,0,tpl_getLang('discussion'));
  37. }
  38. if ($wrapper) echo "</$wrapper>";
  39. }
  40. /**
  41. * Create link/button to user page
  42. *
  43. * @author Anika Henke <anika@selfthinker.org>
  44. */
  45. function _tpl_userpage($userNS='user',$link=0,$wrapper=false) {
  46. if (!$_SERVER['REMOTE_USER']) return;
  47. global $conf;
  48. $userPage = $userNS.':'.$_SERVER['REMOTE_USER'].':'.$conf['start'];
  49. if ($wrapper) echo "<$wrapper>";
  50. if ($link)
  51. tpl_pagelink($userPage,tpl_getLang('userpage'));
  52. else
  53. echo html_btn('userpage',$userPage,'',array(),0,0,tpl_getLang('userpage'));
  54. if ($wrapper) echo "</$wrapper>";
  55. }