示例#1
0
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)));
        }
        //Send push
        $push_resp = getPushContentFromRemoteServer($push_url, 0, $error, 'POST', $data);
        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)));
            }
        }
    }
}
示例#2
0
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)));
            }
        }
    }
}
示例#3
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;
}
示例#4
0
function tt_do_post_request($data, $is_test = false)
{
    global $mybb;
    if (empty($data['data']) && !isset($data['ip']) && !isset($data['test'])) {
        return false;
    }
    if (!empty($mybb->settings['tapatalk_push_key'])) {
        $data['key'] = $mybb->settings['tapatalk_push_key'];
    }
    $push_url = 'http://push.tapatalk.com/push.php';
    //Get push_slug from db
    $push_slug = !empty($mybb->settings['tapatalk_push_slug']) ? $mybb->settings['tapatalk_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']) {
            tt_update_settings(array('name' => 'tapatalk_push_slug', 'value' => base64_encode($slug)));
        }
        if (!function_exists("getContentFromRemoteServer")) {
            define('IN_MOBIQUO', true);
            require_once MYBB_ROOT . $mybb->settings['tapatalk_directory'] . '/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['result'] && $update_res['save']) {
                tt_update_settings(array('name' => 'tapatalk_push_slug', 'value' => base64_encode($slug)));
            }
        }
        return $push_resp;
    } else {
        return 'stick ' . $check_res['stick'] . ' | result ' . $check_res['result'];
    }
}