function createErrorResponse($code, $append = '', $type = 'mobiquo') { global $context, $scripturl, $mobsettings; // Error not found? if (empty($mobsettings[$type . '_error'][$code])) { return createErrorResponse('server_error', '', 'xmlrpc'); } $faultString = $mobsettings[$type . '_error'][$code] . $append; // Get the faultCode... if (is_int($code) || is_numeric($code)) { $faultCode = $code; } else { $i = 0; foreach ($mobsettings[$type . '_error'] as $key => $val) { $i++; if ($key == $code) { $faultCode = $i; } } } // Now that we have figurred it out, output the XML outputRPCResponse(' <params> <param> <value><struct> <member><name>result</name> <value><boolean>0</boolean></value> </member> <member><name>result_text</name> <value><base64>' . base64_encode($faultString) . '</base64></value> </member> </struct></value> </param> </params>'); }
function outputRPCSubscribedBoards($boards) { $response = ' <params> <param> <value> <struct> <member> <name>total_forums_num</name> <value><int>' . count($boards) . '</int></value> </member> <member> <name>forums</name> <value> <array><data>'; foreach ($boards as $board) { $response .= ' <value><struct> <member> <name>forum_id</name> <value><string>' . $board['id'] . '</string></value> </member> <member> <name>forum_name</name> <value><base64>' . base64_encode(mobi_unescape_html($board['name'])) . '</base64></value> </member> <member> <name>icon_url</name> <value><string>' . process_url($board['icon']) . '</string></value> </member> <member> <name>is_protected</name> <value><boolean>0</boolean></value> </member> <member> <name>sub_only</name> <value><boolean>0</boolean></value> </member> <member> <name>new_post</name> <value><boolean>' . (empty($board['new']) ? '0' : '1') . '</boolean></value> </member> </struct></value>'; } $response .= ' </data></array> </value> </member> </struct> </value> </param> </params>'; outputRPCResponse($response); }
function method_get_quote_pm() { global $context, $mobdb, $user_info, $sourcedir, $txt, $modSettings, $func, $language; if ($user_info['is_guest']) { outputRPCResult(false, $txt[1]); } if (!allowedTo('pm_read')) { outputRPCResult(false, $txt['cannot_pm_read']); } if (!allowedTo('pm_send')) { outputRPCResult(false, $txt['cannot_pm_send']); } require_once $sourcedir . '/PersonalMessage.php'; // Get the message ID if (!isset($context['mob_request']['params'][0])) { outputRPCResult(false, $txt['smf272']); } $id_pm = $context['mob_request']['params'][0][0]; // Load this message... $mobdb->query(' SELECT pm.ID_PM AS id_pm, pm.subject, pm.body, pm.msgtime, pm.ID_MEMBER_FROM AS id_member_from, mem_from.realName FROM {db_prefix}personal_messages AS pm LEFT JOIN {db_prefix}pm_recipients AS pr ON (pm.ID_PM = pr.ID_PM) LEFT JOIN {db_prefix}members AS mem_from ON (mem_from.ID_MEMBER = pm.ID_MEMBER_FROM) WHERE pm.ID_PM = {int:pm} AND (pm.ID_MEMBER_FROM = {int:member} OR pr.ID_MEMBER = {int:member})', array('pm' => $id_pm, 'member' => $user_info['id'])); if ($mobdb->num_rows() == 0) { outputRPCResult(false, $txt['pm_not_yours']); } $pm = $mobdb->fetch_assoc(); $mobdb->free_result(); censorText($pm['subject']); censorText($pm['body']); // Add 'Re: ' to it.... if (!isset($context['response_prefix']) && !($context['response_prefix'] = cache_get_data('response_prefix'))) { if ($language === $user_info['language']) { $context['response_prefix'] = $txt['response_prefix']; } else { loadLanguage('index', $language, false); $context['response_prefix'] = $txt['response_prefix']; loadLanguage('index'); } cache_put_data('response_prefix', $context['response_prefix'], 600); } $form_subject = $pm['subject']; if (trim($context['response_prefix']) != '' && $func['strpos']($form_subject, trim($context['response_prefix'])) !== 0) { $form_subject = $context['response_prefix'] . $form_subject; } // Remove any nested quotes and <br />... $form_message = preg_replace('~<br( /)?' . '>~i', "\n", $pm['body']); if (!empty($modSettings['removeNestedQuotes'])) { $form_message = preg_replace(array('~\\n?\\[quote.*?\\].+?\\[/quote\\]\\n?~is', '~^\\n~', '~\\[/quote\\]~'), '', $form_message); } $form_message = processBody($form_message); if (empty($pm['id_member_from'])) { $form_message = '[quote author="' . $pm['realName'] . ""]\n" . $form_message . "\n[/quote]"; } else { $form_message = '[quote author=' . $pm['realName'] . ' link=action=profile;u=' . $pm['id_member_from'] . ' date=' . $pm['msgtime'] . "]\n" . $form_message . "\n[/quote]"; } outputRPCResponse(' <params> <param> <value> <struct> <member> <name>msg_id</name> <value><string>' . $id_pm . '</string></value> </member> <member> <name>msg_subject</name> <value><base64>' . base64_encode(mobi_unescape_html(processSubject($form_subject))) . '</base64></value> </member> <member> <name>text_body</name> <value><base64>' . base64_encode(mobi_unescape_html($form_message)) . '</base64></value> </member> </struct> </value> </param> </params>'); }