function mob_get_participated_forum() { global $mobdb, $context, $scripturl, $settings, $user_info; if ($user_info['is_guest']) { mob_error('guests not allowed'); } $request = $mobdb->query(' SELECT b.name, b.ID_BOARD AS id_board' . ($user_info['is_guest'] ? ", 1 AS is_read, 0 AS new_from" : ", (IFNULL(lb.ID_MSG, 0) >= b.ID_MSG_UPDATED) AS is_read, IFNULL(ln.sent, -1) AS is_notify") . ' FROM {db_prefix}messages AS m INNER JOIN {db_prefix}boards AS b ON (m.ID_BOARD = b.ID_BOARD)' . (!$user_info['is_guest'] ? "\n LEFT JOIN {db_prefix}log_boards AS lb ON (lb.ID_BOARD = b.ID_BOARD AND lb.ID_MEMBER = {int:member})\n LEFT JOIN {db_prefix}log_notify AS ln ON (ln.ID_BOARD = b.ID_BOARD AND ln.ID_MEMBER = {int:member})" : '') . ' WHERE m.ID_MEMBER = {int:member} AND {query_see_board} GROUP BY b.ID_BOARD ORDER BY m.posterTime DESC', array('member' => $user_info['id'])); $boards = array(); while ($row = $mobdb->fetch_assoc($request)) { $boards[] = new xmlrpcval(array('forum_id' => new xmlrpcval($row['id_board'], 'string'), 'forum_name' => new xmlrpcval(processSubject($row['name']), 'base64'), 'new_post' => new xmlrpcval($row['is_read'], 'boolean'), 'icon_url' => new xmlrpcval(get_board_icon($row['id_board'], $row['is_read'], false), 'string')), 'struct'); } $mobdb->free_result($request); return new xmlrpcresp(new xmlrpcval(array('total_forums_num' => new xmlrpcval(count($boards), 'int'), 'forums' => new xmlrpcval($boards, 'array')), 'struct')); }
function method_get_subscribed_forum() { global $txt, $user_info, $mobdb; // Permissions are an important part of anything ;). if ($user_info['is_guest']) { outputRPCResult(false, $txt[1]); } // All the boards with notification on.. $mobdb->query("\n SELECT b.ID_BOARD, b.name, IFNULL(lb.ID_MSG, 0) AS boardRead, b.ID_MSG_UPDATED\n FROM ({db_prefix}log_notify AS ln, {db_prefix}boards AS b)\n LEFT JOIN {db_prefix}log_boards AS lb ON (lb.ID_BOARD = b.ID_BOARD AND lb.ID_MEMBER = {int:member})\n WHERE {query_see_board} AND ln.ID_MEMBER = {int:member}\n AND b.ID_BOARD = ln.ID_BOARD\n ORDER BY b.boardOrder", array('member' => $user_info['id'])); $boards = array(); while ($row = $mobdb->fetch_assoc()) { $boards[] = array('id' => $row['ID_BOARD'], 'name' => $row['name'], 'new' => $row['boardRead'] < $row['ID_MSG_UPDATED'], 'icon' => get_board_icon($row['ID_BOARD'])); } $mobdb->free_result(); outputRPCSubscribedBoards($boards); }