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 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 before_action_login() { global $smcFunc, $request_params, $sc; $code = ''; if (isset($_SERVER['HTTP_X_TT'])) { $code = $_SERVER['HTTP_X_TT']; } $connection = new classTTConnection(); $url = "https://tapatalk.com/plugin_verify.php"; $data['code'] = $code; $data['method'] = 'login'; $data['ip'] = $_SERVER['REMOTE_ADDR']; $response = $connection->getContentFromSever($url, $data, 'post', true); if ($response === '0') { get_error('Pirate Version Of APP'); } $_POST['hash_passwrd'] = sha1(sha1(($smcFunc['db_case_sensitive'] ? $_REQUEST['user'] : strtolower($_REQUEST['user'])) . $_REQUEST['password']) . $sc); $_REQUEST['hash_passwrd'] = $_POST['hash_passwrd']; }
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. } }
/** * 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; }