function update_push() { global $user_info, $db_prefix; if ($user_info['id'] && mobi_table_exist('tapatalk_users')) { db_query("INSERT IGNORE INTO {$db_prefix}tapatalk_users (uid) VALUES ({$user_info[id]})", __FILE__, __LINE__); if (db_affected_rows() == 0) { db_query("\n UPDATE {$db_prefix}tapatalk_users\n SET updated = CURRENT_TIMESTAMP\n WHERE uid = {$user_info[id]}", __FILE__, __LINE__); } } }
} if (isset($_GET['checkip'])) { print do_post_request(array('ip' => 1), true); } else { // print_r($GLOBALS); $output = 'Tapatalk Push Notification Status Monitor<br><br>'; $output .= 'Push notification test: <b>'; require_once dirname(dirname(__FILE__)) . '/SSI.php'; $return_status = do_post_request(array('test' => 1, 'url' => $boardurl), true); if ($return_status === '1') { $output .= 'Success</b>'; } else { $output .= 'Failed</b><br />' . $return_status; } $ip = do_post_request(array('ip' => 1), true); $table_exist = mobi_table_exist('tapatalk_users') ? 'Yes' : 'No'; $output .= "<br>Current forum url: " . $boardurl . "<br>"; $output .= "Current server IP: " . $ip . "<br>"; $output .= "Tapatalk user table existence:" . $table_exist . "<br>"; if (isset($modSettings['push_slug'])) { $push_slug = unserialize(base64_decode($modSettings['push_slug'])); if (!empty($push_slug) && is_array($push_slug)) { $output .= 'Push Slug Status : ' . ($push_slug['stick'] == 1 ? 'Stick' : 'Free') . '<br />'; } if (isset($_GET['slug'])) { $output .= 'Push Slug Value: ' . $modSettings['push_slug'] . "<br /><br />"; } } $output .= "<br>\n<a href=\"https://tapatalk.com/api.php\" target=\"_blank\">Tapatalk API for Universal Forum Access</a><br>\nFor more details, please visit <a href=\"https://tapatalk.com\" target=\"_blank\">https://tapatalk.com</a>"; echo $output; }
function update_push() { global $smcFunc, $user_info, $db_prefix; if ($user_info['id'] && mobi_table_exist('tapatalk_users')) { $request = $smcFunc['db_query']('', 'SELECT * FROM {db_prefix}tapatalk_users WHERE userid = {int:user_id}', array('user_id' => $user_info['id'])); if ($smcFunc['db_num_rows']($request) == 0) { $request = $smcFunc['db_insert']('ignore', '{db_prefix}tapatalk_users', array('userid' => 'int', 'updated' => 'int'), array($user_info['id'], time()), array('userid')); } else { $smcFunc['db_query']('', ' UPDATE {db_prefix}tapatalk_users SET updated = ' . time() . ' WHERE userid = {int:user_id}', array('user_id' => $user_info['id'])); } } }