author.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php if (!defined('PmWiki')) exit();
  2. /* Copyright 2004 Patrick R. Michaud (pmichaud@pobox.com)
  3. This file is part of PmWiki; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published
  5. by the Free Software Foundation; either version 2 of the License, or
  6. (at your option) any later version. See pmwiki.php for full details.
  7. This script handles author tracking.
  8. */
  9. SDV($AuthorCookieExpires,$Now+60*60*24*30);
  10. SDV($AuthorCookieDir,'/');
  11. SDV($AuthorGroup,'Profiles');
  12. SDV($AuthorRequiredFmt,
  13. "<h3 class='wikimessage'>$[An author name is required.]</h3>");
  14. $DoubleBrackets['/{{~([[:alpha:]][-\\w\\s]*)}}/'] =
  15. "$AuthorGroup/\{\{$1}}";
  16. if (!isset($Author)) {
  17. if (isset($_POST['author'])) {
  18. $Author = htmlspecialchars(stripmagic($_POST['author']),ENT_QUOTES);
  19. setcookie('author',$Author,$AuthorCookieExpires,$AuthorCookieDir);
  20. } else {
  21. $Author = htmlspecialchars(stripmagic(@$_COOKIE['author']),ENT_QUOTES);
  22. }
  23. $Author = preg_replace('/(^[^[:alpha:]]+)|[^\\w- ]/','',$Author);
  24. }
  25. if ($k=FreeLink("{{".$Author."}}")) {
  26. SDV($AuthorPage,"$AuthorGroup/".$k['name']);
  27. SDV($AuthorLink,"$AuthorGroup/{{".$k['name']."}}");
  28. }
  29. SDV($AuthorLink,$Author);
  30. if ($EnablePostAuthorRequired && $Author==''
  31. && $action=='edit' && $_POST['post']) {
  32. unset($_POST['post']);
  33. $preview = 'y';
  34. $EditMessageFmt .= $AuthorRequiredFmt;
  35. }
  36. ?>