function output() { extract($GLOBALS); $_G['forum_thread']['replies'] = $_G['forum_thread']['replies'] >= 0 ? $_G['forum_thread']['replies'] : 0; if ($_G['page'] > @ceil(($_G['forum_thread']['replies'] + 1) / $_G['ppp'])) { $content = ''; } elseif ($postlist) { if (!function_exists('mobileoem_template')) { include_once DISCUZ_ROOT . './source/plugin/mobileoem/discuzcode.func.php'; } $variable = array(); foreach ($GLOBALS['aimgs'] as $pid => $aids) { foreach ($aids as $aid) { $_url = parse_url($postlist[$pid]['attachments'][$aid]['url']); $variable['imagelist'][$aid] = (!$postlist[$pid]['attachments'][$aid]['remote'] && !$_url['scheme'] ? $_G['siteurl'] : '') . $postlist[$pid]['attachments'][$aid]['url'] . $postlist[$pid]['attachments'][$aid]['attachment']; if (strexists($postlist[$pid]['message'], '[attach]' . $aid . '[/attach]')) { $postlist[$pid]['message'] = str_replace('[attach]' . $aid . '[/attach]', mobileoem_parseimg($postlist[$pid]['attachments'][$aid]['width'], 0, $variable['imagelist'][$aid]), $postlist[$pid]['message']); } else { $postlist[$pid]['message'] .= '<br /><br />' . mobileoem_parseimg($postlist[$pid]['attachments'][$aid]['width'], 0, $variable['imagelist'][$aid]); } } } foreach ($postlist as $pid => $post) { if ($post['attachlist']) { foreach ($post['attachlist'] as $aid) { $aidencode = packaids($postlist[$pid]['attachments'][$aid]); $_code = parseurl('/forum.php?mod=attachment&aid=' . $aidencode, $postlist[$pid]['attachments'][$aid]['filename'], 0); if (strexists($postlist[$pid]['message'], '[attach]' . $aid . '[/attach]')) { $postlist[$pid]['message'] = str_replace('[attach]' . $aid . '[/attach]', $_code, $postlist[$pid]['message']); } else { $postlist[$pid]['message'] .= '<br /><br />' . $_code; } } } $postlist[$pid]['message'] = preg_replace("/\\[attach\\]\\d+\\[\\/attach\\]/i", '', $postlist[$pid]['message']); } $get = $_GET; unset($get['page'], $get['debug']); $nexturl = http_build_query($get); include mobileoem_template('forum/viewthread'); if (!empty($_GET['debug'])) { exit; } $content = ob_get_contents(); ob_end_clean(); } $variable['forumname'] = $forum['name']; $variable['datatype'] = $_G['page'] == 1 ? 0 : 1; $variable['webview_page'] = $content; $variable['ppp'] = $_G['ppp']; $variable['posts'] = count($postlist); $variable['page'] = $_G['page']; if ($_G['forum_discuzcode']['passwordauthor']) { $variable['passwordpid'] = array_keys($_G['forum_discuzcode']['passwordauthor']); } mobile_core::result(mobile_core::variable($variable)); }
function discuzcode($param) { if (!defined('IN_MOBILE_API') || $param['caller'] != 'discuzcode') { return; } global $_G; if (defined('IS_WEBVIEW') && IS_WEBVIEW && in_array('mobileoem', $_G['setting']['plugins']['available'])) { include_once DISCUZ_ROOT . './source/plugin/mobileoem/discuzcode.func.php'; include_once mobileoem_template('forum/discuzcode'); $_G['discuzcodemessage'] = mobileoem_discuzcode($param['param']); } elseif ($_GET['version'] == 4) { include_once 'discuzcode.func.php'; $_G['discuzcodemessage'] = mobile_discuzcode($param['param']); } else { $_G['discuzcodemessage'] = preg_replace(array("/\\[size=(\\d{1,2}?)\\]/i", "/\\[size=(\\d{1,2}(\\.\\d{1,2}+)?(px|pt)+?)\\]/i", "/\\[\\/size]/i"), '', $_G['discuzcodemessage']); } if (in_array('soso_smilies', $_G['setting']['plugins']['available'])) { $sosoclass = DISCUZ_ROOT . './source/plugin/soso_smilies/soso.class.php'; if (file_exists($sosoclass)) { include_once $sosoclass; $soso_class = new plugin_soso_smilies(); $soso_class->discuzcode($param); } } }
function variable($variables = array()) { global $_G; if (in_array('mobileoem', $_G['setting']['plugins']['available'])) { $check = C::t('#mobileoem#mobileoem_member')->fetch($_G['uid']); } $globals = array('cookiepre' => $_G['config']['cookie']['cookiepre'], 'auth' => $_G['cookie']['auth'], 'saltkey' => $_G['cookie']['saltkey'], 'member_uid' => $_G['member']['uid'], 'member_username' => $_G['member']['username'], 'member_avatar' => avatar($_G['member']['uid'], 'big', true), 'groupid' => $_G['groupid'], 'formhash' => FORMHASH, 'ismoderator' => $_G['forum']['ismoderator'], 'readaccess' => $_G['group']['readaccess'], 'notice' => array('newpush' => $check['newpush'] ? 1 : 0, 'newpm' => dintval($_G['member']['newpm']), 'newprompt' => dintval($_G['member']['newprompt'] - $_G['member']['category_num']['mypost'] >= 0 ? $_G['member']['newprompt'] - $_G['member']['category_num']['mypost'] : 0), 'newmypost' => dintval($_G['member']['category_num']['mypost']))); $globals['member_avatar'] = str_replace("\r", '', $globals['member_avatar']); $globals['member_avatar'] = str_replace("\n", '', $globals['member_avatar']); if (!empty($_GET['submodule']) == 'checkpost') { $apifile = 'source/plugin/mobile/api/' . $_GET['version'] . '/sub_checkpost.php'; if (file_exists($apifile)) { require_once $apifile; $globals = $globals + mobile_api_sub::getvariable(); } } $pluginvariables = array(); $xml = array('Version' => $_GET['version'], 'Charset' => strtoupper($_G['charset']), 'Variables' => array_merge($globals, $variables)); if ($pluginvariables) { $xml['pluginVariables'] = $pluginvariables; } if (!empty($_G['messageparam'])) { $message_result = lang('plugin/mobile', $_G['messageparam'][0], $_G['messageparam'][2]); if ($message_result == $_G['messageparam'][0]) { $vars = explode(':', $_G['messageparam'][0]); if (count($vars) == 2) { $message_result = lang('plugin/' . $vars[0], $vars[1], $_G['messageparam'][2]); $_G['messageparam'][0] = $vars[1]; } else { $message_result = lang('message', $_G['messageparam'][0], $_G['messageparam'][2]); } } $message_result = strip_tags($message_result); if (defined('IS_WEBVIEW') && IS_WEBVIEW && in_array('mobileoem', $_G['setting']['plugins']['available'])) { include_once DISCUZ_ROOT . './source/plugin/mobileoem/discuzcode.func.php'; include mobileoem_template('common/showmessage'); if (!empty($_GET['debug'])) { exit; } $content = ob_get_contents(); ob_end_clean(); $xml['Variables']['datatype'] = -1; $xml['Variables']['webview_page'] = $content; return $xml; } if ($_G['messageparam'][4]) { $_G['messageparam'][0] = "custom"; } if ($_G['messageparam'][3]['login'] && !$_G['uid']) { $_G['messageparam'][0] .= '//' . $_G['messageparam'][3]['login']; } $xml['Message'] = array("messageval" => $_G['messageparam'][0], "messagestr" => $message_result); if ($_GET['mobilemessage']) { $return = bigapp_core::json($xml); header("HTTP/1.1 301 Moved Permanently"); header("Location:discuz://" . rawurlencode($_G['messageparam'][0]) . "//" . rawurlencode(diconv($message_result, $_G['charset'], "utf-8")) . ($return ? "//" . rawurlencode($return) : '')); exit; } } return $xml; }