comparison forum/Sources/Xml.php @ 76:e3e11437ecea website

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