function tt_send_push_data($user_id, $type, $id, $sub_id, $title, $author, $is_only_alert = false) { global $config, $db, $user, $phpbb_root_path; if (!function_exists("tt_get_ignore_users")) { 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'; } $ignore_users = tt_get_ignore_users($user_id); if (in_array($user->data['user_id'], $ignore_users)) { return false; } $boardurl = generate_board_url(); $ttp_data = array('userid' => $user_id, 'type' => $type, 'id' => $id, 'subid' => $sub_id, 'title' => tt_push_clean($title), 'author' => tt_push_clean($author), 'dateline' => time()); if (push_data_table_exists()) { tt_insert_push_data($ttp_data); } if ($is_only_alert) { return; } $ttp_post_data = array('url' => $boardurl, 'data' => base64_encode(serialize(array($ttp_data)))); if (!empty($config['tapatalk_push_key'])) { $ttp_post_data['key'] = $config['tapatalk_push_key']; } $return_status = tt_do_post_request($ttp_post_data); return $return_status; }
function tapatalk_push_pm() { global $mybb, $db, $pm, $pminfo; if (!($pminfo['messagesent'] && $db->table_exists('tapatalk_users'))) { return false; } $query = $db->query("\r\n SELECT p.pmid, p.toid ,tu.pm\r\n FROM " . TABLE_PREFIX . "privatemessages p\r\n LEFT JOIN " . TABLE_PREFIX . "tapatalk_users tu ON (p.toid=tu.userid)\r\n WHERE p.fromid = '{$mybb->user['uid']}' and p.dateline = " . TIME_NOW . " AND p.folder = 1\r\n "); $ttp_push_data = array(); while ($user = $db->fetch_array($query)) { if ($user['toid'] == $mybb->user['uid']) { continue; } if (tt_check_ignored($user['toid'])) { continue; } $ttp_data[] = array('userid' => $user['toid'], 'type' => 'pm', 'id' => $user['pmid'], 'title' => tt_push_clean($pm['subject']), 'author' => tt_push_clean($mybb->user['username']), 'dateline' => TIME_NOW); tt_insert_push_data($ttp_data[count($ttp_data) - 1]); if ($user['pm'] == 1) { $ttp_push_data[] = $ttp_data[count($ttp_data) - 1]; } } if (!empty($ttp_push_data)) { $ttp_post_data = array('url' => $mybb->settings['bburl'], 'data' => base64_encode(serialize($ttp_push_data))); $return_status = tt_do_post_request($ttp_post_data); } }