Help.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <?php
  2. /**
  3. * This file has the important job of taking care of help messages and the help center.
  4. *
  5. * Simple Machines Forum (SMF)
  6. *
  7. * @package SMF
  8. * @author Simple Machines http://www.simplemachines.org
  9. * @copyright 2014 Simple Machines and individual contributors
  10. * @license http://www.simplemachines.org/about/smf/license.php BSD
  11. *
  12. * @version 2.1 Alpha 1
  13. */
  14. if (!defined('SMF'))
  15. die('No direct access...');
  16. /**
  17. * Redirect to the user help ;).
  18. * It loads information needed for the help section.
  19. * It is accessed by ?action=help.
  20. * @uses Help template and Manual language file.
  21. */
  22. function ShowHelp()
  23. {
  24. global $scripturl, $context, $txt;
  25. loadTemplate('Help');
  26. loadLanguage('Manual');
  27. // We need to know where our wiki is.
  28. $context['wiki_url'] = 'http://wiki.simplemachines.org/smf';
  29. // Sections were are going to link...
  30. $context['manual_sections'] = array(
  31. 'registering' => 'Registering',
  32. 'logging_in' => 'Logging_In',
  33. 'profile' => 'Profile',
  34. 'search' => 'Search',
  35. 'posting' => 'Posting',
  36. 'bbc' => 'Bulletin_board_code',
  37. 'personal_messages' => 'Personal_messages',
  38. 'memberlist' => 'Memberlist',
  39. 'calendar' => 'Calendar',
  40. 'features' => 'Features',
  41. );
  42. // Build the link tree.
  43. $context['linktree'][] = array(
  44. 'url' => $scripturl . '?action=help',
  45. 'name' => $txt['help'],
  46. );
  47. // Lastly, some minor template stuff.
  48. $context['page_title'] = $txt['manual_smf_user_help'];
  49. $context['sub_template'] = 'manual';
  50. }
  51. /**
  52. * Show some of the more detailed help to give the admin an idea...
  53. * It shows a popup for administrative or user help.
  54. * It uses the help parameter to decide what string to display and where to get
  55. * the string from. ($helptxt or $txt?)
  56. * It is accessed via ?action=helpadmin;help=?.
  57. * @uses ManagePermissions language file, if the help starts with permissionhelp.
  58. * @uses Help template, popup sub template, no layers.
  59. */
  60. function ShowAdminHelp()
  61. {
  62. global $txt, $helptxt, $context, $scripturl;
  63. if (!isset($_GET['help']) || !is_string($_GET['help']))
  64. fatal_lang_error('no_access', false);
  65. if (!isset($helptxt))
  66. $helptxt = array();
  67. // Load the admin help language file and template.
  68. loadLanguage('Help');
  69. // Permission specific help?
  70. if (isset($_GET['help']) && substr($_GET['help'], 0, 14) == 'permissionhelp')
  71. loadLanguage('ManagePermissions');
  72. loadTemplate('Help');
  73. // Allow mods to load their own language file here
  74. call_integration_hook('integrate_helpadmin');
  75. // Set the page title to something relevant.
  76. $context['page_title'] = $context['forum_name'] . ' - ' . $txt['help'];
  77. // Don't show any template layers, just the popup sub template.
  78. $context['template_layers'] = array();
  79. $context['sub_template'] = 'popup';
  80. // What help string should be used?
  81. if (isset($helptxt[$_GET['help']]))
  82. $context['help_text'] = $helptxt[$_GET['help']];
  83. elseif (isset($txt[$_GET['help']]))
  84. $context['help_text'] = $txt[$_GET['help']];
  85. else
  86. $context['help_text'] = $_GET['help'];
  87. // Does this text contain a link that we should fill in?
  88. if (preg_match('~%([0-9]+\$)?s\?~', $context['help_text'], $match))
  89. $context['help_text'] = sprintf($context['help_text'], $scripturl, $context['session_id'], $context['session_var']);
  90. }
  91. ?>