function update_push_status_func($xmlrpc_params)
{
    global $db, $lang, $theme, $plugins, $mybb, $session, $settings, $cache, $time, $mybbgroups, $mobiquo_config;
    $lang->load("member");
    $input = Tapatalk_Input::filterXmlInput(array('settings' => Tapatalk_Input::RAW, 'username' => Tapatalk_Input::STRING, 'password' => Tapatalk_Input::STRING), $xmlrpc_params);
    $userid = $mybb->user['uid'];
    $status = true;
    if ($userid) {
        $data = array('url' => $mybb->settings['bburl'], 'key' => !empty($mybb->settings['tapatalk_push_key']) ? $mybb->settings['tapatalk_push_key'] : '', 'uid' => $userid, 'data' => base64_encode(serialize($input['settings'])));
        $url = 'https://directory.tapatalk.com/au_update_push_setting.php';
        getContentFromRemoteServer($url, 0, $error_msg, 'POST', $data);
    }
    return new xmlrpcresp(new xmlrpcval(array('result' => new xmlrpcval($status, 'boolean')), 'struct'));
}
示例#2
0
function loadAPIKey()
{
    global $mybb;
    $mobi_api_key = $mybb->settings['tapatalk_push_key'];
    if (empty($mobi_api_key)) {
        $boardurl = $mybb->settings['bburl'];
        $boardurl = urlencode($boardurl);
        $response = getContentFromRemoteServer("http://directory.tapatalk.com/au_reg_verify.php?url={$boardurl}", 10, $error);
        if ($response) {
            $result = json_decode($response, true);
            if (isset($result) && isset($result['result'])) {
                $mobi_api_key = $result['api_key'];
                return $mobi_api_key;
            }
        }
        return false;
    }
    return $mobi_api_key;
}
示例#3
0
function TapatalkSsoVerification($token, $code, $key = '')
{
    global $boardurl;
    $verification_url = 'http://directory.tapatalk.com/au_reg_verify.php?token=' . $token . '&' . 'code=' . $code . '&key=' . $key . '&url=' . $boardurl;
    $response = getContentFromRemoteServer($verification_url, 10, $error);
    if ($response) {
        $result = @json_decode($response);
    }
    if (isset($result) && isset($result->result)) {
        return $result;
    } else {
        $data = array('token' => $token, 'code' => $code, 'key' => $key, 'url' => $boardurl);
        $response = getContentFromRemoteServer('http://directory.tapatalk.com/au_reg_verify.php', 10, $error, 'POST', $data);
        if ($response) {
            $result = @json_decode($response);
        }
        if (isset($result) && isset($result->result)) {
            return $result;
        } else {
            return 0;
        }
        //No connection to Tapatalk Server.
    }
}
示例#4
0
function update_push_status_func()
{
    global $user_info, $smcFunc, $boardurl, $modSettings, $request_params;
    $status = false;
    if ($user_info['id']) {
        $data = array('url' => $boardurl, 'key' => isset($modSettings['tp_push_key']) && !empty($modSettings['tp_push_key']) ? $modSettings['tp_push_key'] : '', 'uid' => $user_info['id'], 'data' => base64_encode(serialize($request_params[0])));
        $url = 'https://directory.tapatalk.com/au_update_push_setting.php';
        getContentFromRemoteServer($url, 0, $error_msg, 'POST', $data);
        $status = true;
    }
    $result = new xmlrpcval(array('result' => new xmlrpcval($status, 'boolean')), 'struct');
    return new xmlrpcresp($result);
}
示例#5
0
function tt_register_verify($tt_token, $tt_code)
{
    global $mybb;
    if (empty($mybb->settings['tapatalk_push_key'])) {
        $mybb->settings['tapatalk_push_key'] = '';
    }
    $url = "http://directory.tapatalk.com/au_reg_verify.php";
    $data = array('token' => $tt_token, 'code' => $tt_code, 'key' => $mybb->settings['tapatalk_push_key'], 'url' => $mybb->settings['bburl']);
    $error_msg = '';
    $response = getContentFromRemoteServer($url, 10, $error_msg, 'POST', $data);
    if (!empty($error_msg)) {
        $response = '{"result":false,"result_text":"' . $error_msg . '"}';
    }
    if (empty($response)) {
        $response = '{"result":false,"result_text":"Connect timeout , please try again"}';
    }
    include_once TT_ROOT . "lib/classTTJson.php";
    $result = json_decode($response);
    return $result;
}
示例#6
0
function tt_do_post_request($data, $is_test = false)
{
    global $config, $phpbb_root_path, $cache;
    $push_url = 'http://push.tapatalk.com/push.php';
    if (!isset($config['tapatalk_push_slug'])) {
        set_config('tapatalk_push_slug', 0);
    }
    //Get push_slug from db
    $push_slug = !empty($config['tapatalk_push_slug']) ? $config['tapatalk_push_slug'] : 0;
    $slug = $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[2] && !$check_res[5]) {
        //Slug is initialed or just be cleared
        if ($check_res[8]) {
            set_config('tapatalk_push_slug', $slug);
        }
        if (!function_exists("getContentFromRemoteServer")) {
            if (!defined("IN_MOBIQUO")) {
                define('IN_MOBIQUO', true);
            }
            if (!isset($config['tapatalkdir'])) {
                $config['tapatalkdir'] = 'mobiquo';
            }
            require_once $phpbb_root_path . $config['tapatalkdir'] . '/mobiquo_common.php';
        }
        if (isset($data['ip']) || isset($data['test'])) {
            $hold_time = 10;
        } else {
            $hold_time = 0;
        }
        //Send push
        $error_msg = '';
        $push_resp = getContentFromRemoteServer($push_url, $hold_time, $error_msg, 'POST', $data);
        if (trim($push_resp) === 'Invalid push notification key' && !$is_test) {
            $push_resp = 1;
        }
        if (!is_numeric($push_resp) && !$is_test) {
            //Sending push failed, try to update push_slug to db
            $slug = push_slug($slug, 'UPDATE');
            $update_res = unserialize($slug);
            if ($update_res[2] && $update_res[8]) {
                set_config('tapatalk_push_slug', $slug);
            }
        }
        return $push_resp;
    }
    return 1;
}
示例#7
0
function before_action_admin_invite()
{
    global $boardurl, $sourcedir, $smcFunc;
    require_once 'include/PHPMailer/class.phpmailer.php';
    require_once $sourcedir . '/Subs-Post.php';
    $exttMbqBoardUrl = preg_replace('/(.*?)\\/mobiquo/i', '$1', $boardurl);
    //refer vb40 invitation.php
    error_reporting(0);
    ini_set('max_execution_time', '120');
    $invite_response['result'] = false;
    if (!empty($_POST['session']) && !empty($_POST['api_key']) && !empty($_POST['subject']) && !empty($_POST['body'])) {
        $push_url = "http://tapatalk.com/forum_owner_invite.php?PHPSESSID={$_POST['session']}&api_key={$_POST['api_key']}&url=" . urlencode($exttMbqBoardUrl) . "&action=verify";
        //$response = getContentFromRemoteServer($push_url, 10, $error, 'POST');
        $response = getContentFromRemoteServer($push_url, 10, $error, 'GET');
        //$_POST['subject'] = mobiquo_encode($_POST['subject'],'to_local');
        //$_POST['body'] = mobiquo_encode($_POST['body'],'to_local');
        if ($response) {
            $result = @json_decode($response, true);
        }
        if (empty($result) || empty($result['result'])) {
            if (preg_match('/\\{"result":true/', $response)) {
                $result = array('result' => true);
            }
        }
        if (isset($result) && isset($result['result']) && $result['result']) {
            if (isset($_POST['username'])) {
                //send email to someone
                if (!empty($_POST['username'])) {
                    if ($user = get_user_by_name_or_email($_POST['username'])) {
                    } else {
                        $user = get_user_by_name_or_email($_POST['username'], true);
                    }
                    if ($user && $user['is_activated'] == 1 && $user['email_address']) {
                        $invite_response['result'] = exttmbq_sendmail($user['email_address'], $_POST['subject'], $_POST['body']) ? true : false;
                        $invite_response['result_text'] = "Sent successfully for {$_POST['username']}";
                    } else {
                        //$invite_response['result_text'] = 'Username does not exist or user don\'t allow admin emails!';
                        $invite_response['result_text'] = 'Username does not exist or is not valid.';
                    }
                } else {
                    $invite_response['result_text'] = 'Username does not exist!';
                }
            } else {
                //send email to all
                $request = $smcFunc['db_query']('', "\n                    SELECT \n                        *\n                    FROM {db_prefix}members AS m\n                    WHERE\n                        m.is_activated = 1 AND m.email_address <> ''");
                $number = 0;
                while ($r = $smcFunc['db_fetch_assoc']($request)) {
                    if (exttmbq_sendmail($r['email_address'], $_POST['subject'], $_POST['body'])) {
                        $number++;
                    }
                }
                $smcFunc['db_free_result']($request);
                $invite_response['result'] = $number ? true : false;
                $invite_response['number'] = $number;
                $invite_response['result_text'] = "Sent email to {$number} users";
            }
        } else {
            $invite_response['result_text'] = $error ? $error : 'Verify failed.';
        }
    } else {
        if (!empty($_POST['email_target'])) {
            $request = $smcFunc['db_query']('', "\n            SELECT \n                COUNT(*) as c\n            FROM {db_prefix}members AS m\n            WHERE\n                m.is_activated = 1 AND m.email_address <> ''");
            $r = $smcFunc['db_fetch_assoc']($request);
            $smcFunc['db_free_result']($request);
            $user_count = $r['c'];
            echo $user_count;
            exit;
        }
    }
    header('Content-type: application/json');
    echo @json_encode($invite_response);
    exit;
}
示例#8
0
function tt_is_spam()
{
    global $mybb, $session;
    if (isset($mybb->settings['tapatalk_spam_status'])) {
        $spam_status = $mybb->settings['tapatalk_spam_status'];
        if ($spam_status == '0') {
            return;
        }
        if ($spam_status == '1' && !strstr($_SERVER['PHP_SELF'], 'mobiquo.php')) {
            return;
        }
        if ($spam_status == '2' && strstr($_SERVER['PHP_SELF'], 'mobiquo.php')) {
            return;
        }
    } else {
        return;
    }
    $email = $mybb->input['email'];
    $ip = $session->ipaddress;
    $params = '';
    if ($email || $ip) {
        $email = @urlencode($email);
        if ($email) {
            $params = "&email={$email}";
        }
        if ($ip) {
            $params .= "&ip={$ip}";
        }
        if (!function_exists("getContentFromRemoteServer")) {
            define('IN_MOBIQUO', true);
            require_once MYBB_ROOT . $mybb->settings['tapatalk_directory'] . '/mobiquo_common.php';
        }
        $resp = @getContentFromRemoteServer("http://www.stopforumspam.com/api?f=serial" . $params, 3);
        $resp = @unserialize($resp);
        if (isset($resp['email']['confidence']) && $resp['email']['confidence'] > 50 || isset($resp['ip']['confidence']) && $resp['ip']['confidence'] > 60) {
            error('Your email or IP address matches that of a known spammer and therefore you cannot register here. If you feel this is an error, please contact the administrator or try again later.');
        }
    }
}
function tt_register_verify($tt_token, $tt_code)
{
    global $config;
    $key = isset($config['tapatalk_push_key']) ? $config['tapatalk_push_key'] : '';
    $board_url = generate_board_url();
    $url = "http://directory.tapatalk.com/au_reg_verify.php";
    $data = array('token' => $tt_token, 'code' => $tt_code, 'key' => $key, 'url' => $board_url);
    $error_msg = '';
    $response = getContentFromRemoteServer($url, 10, $error_msg, 'POST', $data);
    if (!empty($error_msg)) {
        $response = '{"result":false,"result_text":"' . $error_msg . '"}';
    }
    if (empty($response)) {
        $response = '{"result":false,"result_text":"Contect timeout , please try again"}';
    }
    $result = json_decode($response);
    return $result;
}
示例#10
0
error_reporting(E_ERROR);
require_once MYBB_ROOT . "/inc/functions_massmail.php";
include_once TT_ROOT . "lib/classTTJson.php";
if (function_exists('set_magic_quotes_runtime')) {
    @set_magic_quotes_runtime(0);
}
@ini_set('max_execution_time', '120');
$lang->set_language($mybb->settings['cplanguage'], "admin");
$lang->load("global");
$lang->load("user_mass_mail");
$invite_response['result'] = false;
$furl = $mybb->settings['bburl'];
if (!empty($_POST['session']) && !empty($_POST['api_key']) && !empty($_POST['subject']) && !empty($_POST['body'])) {
    $error = '';
    $push_url = "http://tapatalk.com/forum_owner_invite.php?PHPSESSID={$_POST['session']}&api_key={$_POST['api_key']}&url=" . urlencode($furl) . "&action=verify";
    $response = getContentFromRemoteServer($push_url, 10, $error, 'GET');
    if ($response) {
        $result = @json_decode($response, true);
    }
    if (empty($result) || empty($result['result'])) {
        if (preg_match('/\\{"result":true/', $response)) {
            $result = array('result' => true);
        }
    }
    $_POST['username'] = isset($_POST['username']) ? trim($_POST['username']) : '';
    if (isset($result) && isset($result['result']) && $result['result']) {
        if (!empty($_POST['username'])) {
            $userinfo = tt_get_user_id_by_name($_POST['username']);
            if (empty($userinfo)) {
                $invite_response['result_text'] = $lang->error_no_users;
            } else {