Xml.php 1.7 KB

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