Friendica Communications Platform (please note that this is a clone of the repository at github, issues are handled there)
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.

help.php 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. require_once('library/markdown.php');
  3. if (!function_exists('load_doc_file')) {
  4. function load_doc_file($s) {
  5. global $lang;
  6. if (!isset($lang))
  7. $lang = 'en';
  8. $b = basename($s);
  9. $d = dirname($s);
  10. if (file_exists("$d/$lang/$b"))
  11. return file_get_contents("$d/$lang/$b");
  12. if (file_exists($s))
  13. return file_get_contents($s);
  14. return '';
  15. }
  16. }
  17. function help_content(&$a) {
  18. nav_set_selected('help');
  19. global $lang;
  20. $text = '';
  21. if ($a->argc > 1) {
  22. $text = load_doc_file('doc/' . $a->argv[1] . '.md');
  23. $a->page['title'] = t('Help:') . ' ' . str_replace('-', ' ', notags($a->argv[1]));
  24. }
  25. $home = load_doc_file('doc/Home.md');
  26. if (!$text) {
  27. $text = $home;
  28. $a->page['title'] = t('Help');
  29. } else {
  30. $a->page['aside'] = Markdown($home);
  31. }
  32. if (!strlen($text)) {
  33. header($_SERVER["SERVER_PROTOCOL"] . ' 404 ' . t('Not Found'));
  34. $tpl = get_markup_template("404.tpl");
  35. return replace_macros($tpl, array(
  36. '$message' => t('Page not found.')
  37. ));
  38. }
  39. $html = Markdown($text);
  40. $html = "<style>.md_warning { padding: 1em; border: #ff0000 solid 2px; background-color: #f9a3a3; color: #ffffff;</style>".$html;
  41. return $html;
  42. }