Xml.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. /**
  3. * Simple Machines Forum (SMF)
  4. *
  5. * @package SMF
  6. * @author Simple Machines http://www.simplemachines.org
  7. * @copyright 2011 Simple Machines
  8. * @license http://www.simplemachines.org/about/smf/license.php BSD
  9. *
  10. * @version 2.0
  11. */
  12. if (!defined('SMF'))
  13. die('Hacking attempt...');
  14. /* This file maintains all XML-based interaction (mainly XMLhttp).
  15. void GetJumpTo()
  16. */
  17. function XMLhttpMain()
  18. {
  19. loadTemplate('Xml');
  20. $sub_actions = array(
  21. 'jumpto' => array(
  22. 'function' => 'GetJumpTo',
  23. ),
  24. 'messageicons' => array(
  25. 'function' => 'ListMessageIcons',
  26. ),
  27. );
  28. if (!isset($_REQUEST['sa'], $sub_actions[$_REQUEST['sa']]))
  29. fatal_lang_error('no_access', false);
  30. $sub_actions[$_REQUEST['sa']]['function']();
  31. }
  32. // Get a list of boards and categories used for the jumpto dropdown.
  33. function GetJumpTo()
  34. {
  35. global $user_info, $context, $smcFunc, $sourcedir;
  36. // Find the boards/cateogories they can see.
  37. require_once($sourcedir . '/Subs-MessageIndex.php');
  38. $boardListOptions = array(
  39. 'use_permissions' => true,
  40. 'selected_board' => isset($context['current_board']) ? $context['current_board'] : 0,
  41. );
  42. $context['jump_to'] = getBoardList($boardListOptions);
  43. // Make the board safe for display.
  44. foreach ($context['jump_to'] as $id_cat => $cat)
  45. {
  46. $context['jump_to'][$id_cat]['name'] = un_htmlspecialchars(strip_tags($cat['name']));
  47. foreach ($cat['boards'] as $id_board => $board)
  48. $context['jump_to'][$id_cat]['boards'][$id_board]['name'] = un_htmlspecialchars(strip_tags($board['name']));
  49. }
  50. $context['sub_template'] = 'jump_to';
  51. }
  52. function ListMessageIcons()
  53. {
  54. global $context, $sourcedir, $board;
  55. require_once($sourcedir . '/Subs-Editor.php');
  56. $context['icons'] = getMessageIcons($board);
  57. $context['sub_template'] = 'message_icons';
  58. }
  59. ?>