/** * action implement */ public function actionImplement($in) { parent::actionImplement($in); if (!WBB_TAPATALK_REG_TYPE) { $this->data['sign_in'] = 0; $this->data['sso_signin'] = 0; $this->data['sso_register'] = 0; $this->data['inappreg'] = 0; $this->data['native_register'] = 0; } $isTTServerCall = false; if (isset($_SERVER['HTTP_X_TT'])) { $code = trim($_SERVER['HTTP_X_TT']); if (file_exists(WBB_TAPATALK_DIR . '/mbqFrame/3rdLib/classTTConnection.php')) { require_once WBB_TAPATALK_DIR . '/mbqFrame/3rdLib/classTTConnection.php'; } if (class_exists('classTTConnection')) { $connection = new classTTConnection(); $response = $connection->actionVerification($code, 'get_config'); if ($response) { $isTTServerCall = true; } } } if ($isTTServerCall) { if (!defined('WBB_TAPATALK_BANNER_CONTROL')) { $this->data['banner_control'] = new xmlrpcval(-1, 'string'); } else { $this->data['banner_control'] = new xmlrpcval(WBB_TAPATALK_BANNER_CONTROL, 'string'); } } }
function do_post_request($data, $pushTest = false) { $push_url = 'http://push.tapatalk.com/push.php'; require_once dirname(__FILE__) . '/lib/classTTConnection.php'; $connection = new classTTConnection(); $response = $connection->getContentFromSever($push_url, $data, 'POST'); return $response; }
function get_config_func() { global $mobiquo_config, $user_info, $modSettings, $maintenance, $mmessage; exttMbqMakeFlags(); $config_list = array('is_open' => new xmlrpcval($maintenance == 0 ? true : false, 'boolean'), 'guest_okay' => new xmlrpcval($modSettings['allow_guestAccess'] ? true : false, 'boolean'), 'push' => new xmlrpcval('1', 'string'), 'result_text' => new xmlrpcval($maintenance == 1 ? $mmessage : '', 'base64'), 'sign_in' => new xmlrpcval(ExttMbqBase::$otherParameters['exttMbqSignIn'], 'string'), 'inappreg' => new xmlrpcval(ExttMbqBase::$otherParameters['exttMbqInappreg'], 'string'), 'sso_login' => new xmlrpcval(ExttMbqBase::$otherParameters['exttMbqSsoLogin'], 'string'), 'sso_signin' => new xmlrpcval(ExttMbqBase::$otherParameters['exttMbqSsoSignin'], 'string'), 'sso_register' => new xmlrpcval(ExttMbqBase::$otherParameters['exttMbqSsoRegister'], 'string'), 'native_register' => new xmlrpcval(ExttMbqBase::$otherParameters['exttMbqNativeRegister'], 'string')); if (allowedTo('search_posts')) { $config_list['guest_search'] = new xmlrpcval('1', 'string'); } if (allowedTo('who_view')) { $config_list['guest_whosonline'] = new xmlrpcval('1', 'string'); } $isTTServerCall = false; if (isset($_SERVER['HTTP_X_TT'])) { $code = trim($_SERVER['HTTP_X_TT']); $connection = new classTTConnection(); $response = $connection->actionVerification($code, 'get_config'); if ($response) { $isTTServerCall = true; } } foreach ($mobiquo_config as $key => $value) { if (!$isTTServerCall && $key == 'version') { $config_list[$key] = new xmlrpcval(substr($mobiquo_config['version'], 0, strpos($mobiquo_config['version'], '_')), 'string'); } else { if (!in_array($key, array('is_open', 'guest_okay', 'mod_function', 'conflict_mod', 'push'))) { $config_list[$key] = new xmlrpcval($value, 'string'); } } } if ($user_info['is_guest'] && allowedTo('search_posts')) { $config_list['guest_search'] = new xmlrpcval('1', 'string'); } if ($user_info['is_guest'] && allowedTo('who_view')) { $config_list['guest_whosonline'] = new xmlrpcval('1', 'string'); } if (isset($modSettings['tp_push_key']) && !empty($modSettings['tp_push_key'])) { $config_list['api_key'] = new xmlrpcval(md5($modSettings['tp_push_key']), 'string'); } if (isset($modSettings['tp_ads_disabled']) && !empty($modSettings['tp_ads_disabled'])) { $ads_disabled_group = implode(',', array_map('intval', explode(',', $modSettings['tp_ads_disabled']))); $config_list['ads_disabled_group'] = new xmlrpcval($ads_disabled_group, 'string'); $config_list['guest_group_id'] = new xmlrpcval(-1, 'string'); } if ($isTTServerCall) { $config_list['sys_version'] = new xmlrpcval($modSettings['smfVersion'], 'string'); $config_list['php_version'] = new xmlrpcval(phpversion(), 'string'); action_get_board_stat(); $stats = array('user' => new xmlrpcval($modSettings['totalMembers'], 'int'), 'topic' => new xmlrpcval($modSettings['totalTopics'], 'int'), 'post' => new xmlrpcval($modSettings['totalMessages'], 'int')); $config_list['stats'] = new xmlrpcval($stats, 'struct'); if (!isset($modSettings['tt_banner_control'])) { $config_list['banner_control'] = new xmlrpcval(1, 'string'); } else { $config_list['banner_control'] = new xmlrpcval(intval($modSettings['tt_banner_control']), 'string'); } } $response = new xmlrpcval($config_list, 'struct'); return new xmlrpcresp($response); }
/** * action implement */ protected function actionImplement($in) { $cfg = MbqMain::$oMbqConfig->getAllCfg(); $isTTServerCall = false; if (isset($_COOKIE['X-TT'])) { $code = trim($_COOKIE['X-TT']); } else { if (isset($_SERVER['HTTP_X_TT'])) { $code = trim($_SERVER['HTTP_X_TT']); } } if (isset($code)) { if (!class_exists('classTTConnection')) { require_once MBQ_3RD_LIB_PATH . 'classTTConnection.php'; } $connection = new classTTConnection(); $response = $connection->actionVerification($code, 'get_config'); if ($response) { $isTTServerCall = true; } } if ($isTTServerCall) { $this->data['mbqframe_version'] = '1.0'; } foreach ($cfg as $moduleName => $module) { foreach ($module as $k => $v) { if ($k !== 'module_name' && $k != 'module_version' && $k != 'module_enable') { if (isset($this->data[$k])) { MbqError::alert('', "Find repeat config {$k}!"); } else { if (!$v->isAdvCfgValueType()) { if ($v->hasSetOriValue()) { if ($k == 'is_open' || $k == 'guest_okay' || $k == 'min_search_length') { $this->data[$k] = $v->oriValue; } else { if (!$isTTServerCall) { if ($k == 'version') { $v->setOriValue(substr($v->oriValue, 0, strpos($v->oriValue, '_'))); } if ($k == 'sys_version' || $k == 'stats') { continue; } } $this->data[$k] = (string) $v->oriValue; } } else { MbqError::alert('', "Need set config {$k}!"); } } } } } } }
function getInput() { $in = new stdClass(); if (MbqMain::isRawPostProtocol()) { $in->code = MbqMain::$input['code']; } include_once MBQ_3RD_LIB_PATH . 'classTTConnection.php'; $connection = new classTTConnection(); $response = $connection->actionVerification($in->code, 'reset_push_slug'); if (!$response) { MbqError::alert('', __METHOD__ . ',line:' . __LINE__ . '.' . MBQ_ERR_INFO_PARAMS_ERROR); } return $in; }
/** * action implement */ protected function actionImplement($in) { if (!MbqMain::$oMbqConfig->moduleIsEnable('user')) { MbqError::alert('', "Not support module user!", '', MBQ_ERR_NOT_SUPPORT); } $code = ''; if (isset($_COOKIE['X-TT'])) { $code = trim($_COOKIE['X-TT']); } else { if (isset($_SERVER['HTTP_X_TT'])) { $code = trim($_SERVER['HTTP_X_TT']); } } include_once MBQ_3RD_LIB_PATH . 'classTTConnection.php'; $connection = new classTTConnection(); $response = $connection->actionVerification($code, 'login'); if ($connection->success && $response !== true) { if ($response === false && empty($connection->errors)) { $this->data['result_text'] = "Unauthorized app detected."; } else { $this->data['result_text'] = "The site failed to connect to Tapatalk servers and some functions will not work properly. Please contact the forum admin to resolve this issue."; } } $oMbqRdEtUser = MbqMain::$oClk->newObj('MbqRdEtUser'); $result = $oMbqRdEtUser->login($in->login, $in->password, $in->anonymous, $in->trustCode); if ($result === true) { $this->data['result'] = true; $data1 = $oMbqRdEtUser->returnApiDataUser(MbqMain::$oCurMbqEtUser); MbqMain::$oMbqCm->mergeApiData($this->data, $data1); $oTapatalkPush = new TapatalkPush(); $oTapatalkPush->callMethod('doAfterAppLogin', MbqMain::$oCurMbqEtUser->userId->oriValue); } else { $this->data['result'] = false; if ($result == 'two-step-required') { $this->data['two_step_required'] = true; } else { $this->data['result_text'] = $result; } if (!$oMbqRdEtUser->initOMbqEtUser($in->login, array('case' => 'byLoginName'))) { $this->data['status'] = (string) 2; //!!! attention the (string) } } }
$app_banner_message = isset($modSettings['tp_app_banner_msg']) ? $modSettings['tp_app_banner_msg'] : ''; $app_banner_message = preg_replace('/\\r\\n/', '<br>', $app_banner_message); $app_location_url = get_scheme_url(); $script_to_page = array('home' => 'home', 'index' => 'home', 'topic' => 'topic', 'post' => 'post', 'forum' => 'forum'); $page_type = isset($GLOBALS['exttMbqTempPageType']) && isset($script_to_page[$GLOBALS['exttMbqTempPageType']]) ? $script_to_page[$GLOBALS['exttMbqTempPageType']] : 'others'; $is_mobile_skin = false; $app_forum_name = !empty($GLOBALS['mbname']) ? $GLOBALS['mbname'] : ''; $tapatalk_dir = 'mobiquo'; $tapatalk_dir_url = $boardurl . '/mobiquo'; $api_key = isset($modSettings['tp_push_key']) ? $modSettings['tp_push_key'] : ''; $app_banner_enable = isset($modSettings['tp_full_banner']) ? $modSettings['tp_full_banner'] : 1; $tt_banner_last_check = isset($modSettings['tt_banner_last_check']) ? intval($modSettings['tt_banner_last_check']) : null; $tt_banner_control = isset($modSettings['tt_banner_control']) ? (bool) $modSettings['tt_banner_control'] : true; $forum_root = dirname(__FILE__); require_once $forum_root . '/lib/classTTConnection.php'; $connection = new classTTConnection(); if ($connection->bannerControlAllowedByPlugin($tt_banner_control, $tt_banner_last_check, $boardurl, $api_key)) { $tt_input = array(); $tt_input['tt_banner_control'] = $tt_banner_control ? 1 : 0; $tt_input['tt_banner_last_check'] = $tt_banner_last_check; updateSettings($tt_input); } if ($tt_banner_control == false) { $app_banner_enable = 1; } $board_url = $boardurl; $twitterfacebook_card_enabled = isset($modSettings['tp_deep_link_enabled']) ? $modSettings['tp_deep_link_enabled'] : ''; $twc_title = isset($context['page_title_html_safe']) ? $context['page_title_html_safe'] : ''; $twc_description = $page_type == 'forum' && isset($board_info['description']) ? $board_info['description'] : $twc_title; if (file_exists($forum_root . '/smartbanner/head.inc.php')) { include $forum_root . '/smartbanner/head.inc.php';
function tt_do_post_request($data) { global $boardurl, $modSettings; $push_url = 'http://push.tapatalk.com/push.php'; if (!function_exists('updateSettings')) { require_once $sourcedir . '/Subs.php'; } //Initial this key in modSettings if (!isset($modSettings['push_slug'])) { updateSettings(array('push_slug' => 0)); } //Get push_slug from db $push_slug = isset($modSettings['push_slug']) ? $modSettings['push_slug'] : 0; $slug = base64_decode($push_slug); $slug = push_slug($slug, 'CHECK'); $check_res = unserialize($slug); //If it is valide(result = true) and it is not sticked, we try to send push if ($check_res['result'] && !$check_res['stick']) { //Slug is initialed or just be cleared if ($check_res['save']) { updateSettings(array('push_slug' => base64_encode($slug))); } //add general information $data['url'] = $boardurl; if (isset($modSettings['tp_push_key']) && !empty($modSettings['tp_push_key'])) { $data['key'] = $modSettings['tp_push_key']; } $data['author_ip'] = getClientIp(); $data['author_ua'] = getClienUserAgent(); $data['author_type'] = getUserType(); $data['from_app'] = getIsFromApp(); //Send push if (!defined('IN_MOBIQUO')) { define('IN_MOBIQUO', true); } require_once dirname(__FILE__) . '/lib/classTTConnection.php'; $connection = new classTTConnection(); $push_resp = $connection->getContentFromSever($push_url, $data, 'POST'); if (trim($push_resp) === 'Invalid push notification key') { $push_resp = 1; } if (!is_numeric($push_resp)) { //Sending push failed, try to update push_slug to db $slug = push_slug($slug, 'UPDATE'); $update_res = unserialize($slug); if ($update_res['result'] && $update_res['save']) { updateSettings(array('push_slug' => base64_encode($slug))); } } } }
function action_push_content_check() { global $smcFunc, $modSettings; $code = trim($_POST['code']); $format = trim($_POST['format']); $push_date = unserialize($_POST['data']); $connection = new classTTConnection(); $response = $connection->actionVerification($code, 'push_content_check'); if ($response !== TRUE) { $data = array('result' => false, 'result_text' => $response); @ob_end_clean(); echo $format == 'json' ? json_encode($data) : serialize($data); exit; } if (!isset($modSettings['tp_push_key']) || !isset($push_date['key']) || $modSettings['tp_push_key'] != $push_date['key']) { $data = array('result' => false, 'result_text' => 'incorrect api key'); @ob_end_clean(); echo $format == 'json' ? json_encode($data) : serialize($data); exit; } if (!isset($push_date['dateline']) || time() - intval($push_date['dateline']) > 86400) { $data = array('result' => false, 'result_text' => 'time out'); @ob_end_clean(); echo $format == 'json' ? json_encode($data) : serialize($data); exit; } switch ($push_date['type']) { case 'newtopic': case 'sub': case 'quote': case 'tag': $request = $smcFunc['db_query']('', ' SELECT msg.id_msg FROM {db_prefix}messages as msg WHERE msg.id_msg = {int:subid} AND msg.id_topic = {int:id} AND id_board = {int:subfid} AND id_member = {int:authorid} LIMIT 1', array('id' => isset($push_date['id']) ? intval($push_date['id']) : 0, 'subid' => isset($push_date['subid']) ? intval($push_date['subid']) : 0, 'subfid' => isset($push_date['subfid']) ? intval($push_date['subfid']) : 0, 'authorid' => isset($push_date['authorid']) ? intval($push_date['authorid']) : 0)); break; case 'pm': $request = $smcFunc['db_query']('', ' SELECT pm.id_pm FROM {db_prefix}personal_messages as pm WHERE pm.id_pm = {int:id} AND pm.id_member_from ={int:authorid} AND pm.msgtime = {int:dateline} LIMIT 1', array('id' => isset($push_date['id']) ? intval($push_date['id']) : 0, 'authorid' => isset($push_date['authorid']) ? intval($push_date['authorid']) : 0, 'dateline' => isset($push_date['dateline']) ? intval($push_date['dateline']) : 0)); break; } if (isset($request) && !empty($request) && $smcFunc['db_fetch_assoc']($request)) { $data = array('result' => true, 'result_text' => ''); } else { $data = array('result' => false, 'result_text' => 'fail'); } @ob_end_clean(); echo $format == 'json' ? json_encode($data) : serialize($data); exit; }
public function do_push_request($data, $pushTest = false) { $push_url = 'http://push.tapatalk.com/push.php'; if (!class_exists('classTTConnection')) { include_once dirname(__FILE__) . '/../3rdLib/classTTConnection.php'; } if ($pushTest) { $connection = new classTTConnection(); $connection->timeout = 5; $error = $connection->errors; return $connection->getContentFromSever($push_url, $data, 'post', false); } //Initial this key in modSettings //Get push_slug from db $push_slug = $this->childReference->get_push_slug(); $push_slug = isset($push_slug) && !empty($push_slug) ? $push_slug : 0; $slug = $push_slug; $slug = self::push_slug($slug, 'CHECK'); $check_res = unserialize($slug); //If it is valide(result = true) and it is not sticked, we try to send push if ($check_res[2] && !$check_res[5]) { //Slug is initialed or just be cleared if ($check_res[8]) { $this->childReference->set_push_slug($slug); } //Send push $connection = new classTTConnection(); $connection->timeout = 5; $push_resp = $connection->getContentFromSever($push_url, $data, 'post', false); if (trim($push_resp) === 'Invalid push notification key') { $push_resp = 1; } if ($connection->success == false || !is_numeric($push_resp)) { //Sending push failed, try to update push_slug to db $slug = self::push_slug($slug, 'UPDATE'); $update_res = unserialize($slug); $update_res[3] = $push_resp; if ($update_res[2] && $update_res[8]) { $this->childReference->set_push_slug(serialize($update_res)); } } } return true; }
function getEmailFromScription($token, $code, $key, $boardurl) { $verification_url = 'http://directory.tapatalk.com/au_reg_verify.php?token=' . $token . '&' . 'code=' . $code . '&key=' . $key . '&url=' . $boardurl; require_once MBQ_3RD_LIB_PATH . 'classTTConnection.php'; $connection = new classTTConnection(); $connection->timeout = 10; $response = $connection->getContentFromSever($verification_url, array(), 'get'); if ($response) { $result = json_decode($response, true); } if (isset($result) && isset($result['result'])) { return $result; } else { $data = array('token' => $token, 'code' => $code, 'key' => $key, 'url' => $boardurl); $response = $connection->getContentFromSever('http://directory.tapatalk.com/au_reg_verify.php', $data, 'post'); if ($response) { $result = json_decode($response, true); } if (isset($result) && isset($result['result'])) { return $result; } else { return 0; } //No connection to Tapatalk Server. } }
public function TTVerify($token, $code) { if ($token && $code) { $connection = new classTTConnection(); $verifyResult = $connection->signinVerify($token, $code, $this->forumInterface->getForumUrl(), $this->forumInterface->getAPIKey(), $this->register); // get valid response if ($connection->success && !empty($verifyResult)) { // pass verify. can register without user activate or login without password if (isset($verifyResult['result']) && $verifyResult['result'] && isset($verifyResult['email']) && $verifyResult['email']) { $this->verified = true; $this->TTEmail = strtolower($verifyResult['email']); $this->TTProfile = isset($verifyResult['profile']) ? $verifyResult['profile'] : array(); } else { if (isset($verifyResult['result_text']) && $verifyResult['result_text']) { $this->errors[] = $verifyResult['result_text']; } } } else { if ($connection->success == false) { $this->errors = $connection->errors; } $this->errors[] = 'Tapatalk authorization verify with no response'; } } else { $this->errors[] = 'Invalid Tapatalk authorization data'; } }
/** * Get content from remote server * * @param string $url NOT NULL the url of remote server, if the method is GET, the full url should include parameters; if the method is POST, the file direcotry should be given. * @param string $holdTime [default 0] the hold time for the request, if holdtime is 0, the request would be sent and despite response. * @param string $error_msg return error message * @param string $method [default GET] the method of request. * @param string $data [default array()] post data when method is POST. * * @exmaple: getContentFromRemoteServer('http://push.tapatalk.com/push.php', 0, $error_msg, 'POST', $ttp_post_data) * @return string when get content successfully|false when the parameter is invalid or connection failed. */ function getContentFromRemoteServer($url, $holdTime = 0, &$error_msg, $method = 'GET', $data = array()) { require_once dirname(__FILE__) . '/lib/classTTConnection.php'; $connection = new classTTConnection(); $connection->timeout = $holdTime; $response = $connection->getContentFromSever($url, $data, $method); $error_msg = $connection->errors; return $response; }
public function TTVerify($token, $code) { $this->verified = false; if ($token && $code) { if (!class_exists('classTTConnection')) { include_once MBQ_3RD_LIB_PATH . 'classTTConnection.php'; } $oMbqRdCommon = MbqMain::$oClk->newObj('MbqRdCommon'); $connection = new classTTConnection(); $verifyResult = $connection->signinVerify($token, $code, $oMbqRdCommon->getForumUrl(), $oMbqRdCommon->getApiKey(), $this->register); // get valid response if ($connection->success && !empty($verifyResult)) { // pass verify. can register without user activate or login without password if (isset($verifyResult['result']) && $verifyResult['result'] && isset($verifyResult['email']) && $verifyResult['email']) { $this->verified = true; $this->TTEmail = strtolower($verifyResult['email']); $this->TTProfile = isset($verifyResult['profile']) ? $verifyResult['profile'] : array(); } else { if (isset($verifyResult['result_text']) && $verifyResult['result_text']) { $this->errors[] = $verifyResult['result_text']; } } } else { if ($connection->success == false) { $this->errors = $connection->errors; } $this->errors[] = 'Tapatalk authorization verify with no response'; } } else { $this->errors[] = 'Invalid Tapatalk authorization data'; } }
<?php if (isset($_GET['welcome']) && isset($_GET['referer']) && isset($_GET['board_url'])) { $redirect_url = isset($_GET['referer']) && trim($_GET['referer']) ? trim($_GET['referer']) : ''; $board_url = isset($_GET['board_url']) && trim($_GET['board_url']) ? trim($_GET['board_url']) : ''; if (strpos($redirect_url, $_REQUEST['SERVER_NAME']) !== false && strpos($redirect_url, $_REQUEST['SERVER_NAME']) !== false || strpos($redirect_url, "/") === '0') { header('Location: ' . $redirect_url); exit; } header('Location: ' . $board_url); } if (isset($_POST['method_name']) && $_POST['method_name'] == 'verify_connection') { $type = isset($_POST['type']) ? $_POST['type'] : 'both'; $code = isset($_POST['code']) ? $_POST['code'] : ''; $connection = new classTTConnection(); @ob_clean(); echo serialize($connection->verify_connection($type, $code)); exit; } if ($_SERVER['REQUEST_METHOD'] == 'GET' && (!isset($_GET['method_name']) || isset($_GET['method_name']) && $_GET['method_name'] != 'set_api_key')) { include 'web.php'; exit; }
/** * action implement */ protected function actionImplement($in) { require_once MBQ_3RD_LIB_PATH . 'classTTConnection.php'; $ttConnection = new classTTConnection(); $this->data = $ttConnection->verify_connection($in->type, $in->code); }
* @author Sascha Greuel */ define('MBQ_IN_IT', true); /* is in mobiquo flag */ define('MBQ_REG_SHUTDOWN', true); /* register shutdown function flag */ require_once 'MbqConfig.php'; require_once '../global.php'; $mbqDebug = false; if (isset($_SERVER['HTTP_X_PHPDEBUG'])) { if (isset($_SERVER['HTTP_X_PHPDEBUGCODE'])) { $code = trim($_SERVER['HTTP_X_PHPDEBUGCODE']); if (!class_exists('classTTConnection')) { require_once MBQ_3RD_LIB_PATH . 'classTTConnection.php'; } $connection = new classTTConnection(); $response = $connection->actionVerification($code, 'PHPDEBUG'); if ($response) { $mbqDebug = $_SERVER['HTTP_X_PHPDEBUG']; } } } if ($mbqDebug == false && file_exists(MBQ_PATH . 'debug.on')) { $mbqDebug = E_ALL; } define('MBQ_DEBUG', $mbqDebug); /* is in debug mode flag */ if (MBQ_DEBUG) { ini_set('display_errors', '1'); ini_set('display_startup_errors', '1'); error_reporting($mbqDebug);