/** * Prints HTML for the "incident chat" page. * * @global $_GET * * @uses current_user_can() * @uses wp_verify_nonce() * @uses get_current_user_id() * @uses WP_Buoy_Alert::add_responder() * @uses WP_Buoy_Alert::set_responder_geo() * * @return void */ public static function renderIncidentChatPage() { $alert = new WP_Buoy_Alert(urldecode($_GET[self::$prefix . '_hash'])); if (!$alert->wp_post || !current_user_can('read') || !isset($_GET[self::$prefix . '_nonce']) || !wp_verify_nonce($_GET[self::$prefix . '_nonce'], self::$prefix . '_chat')) { esc_html_e('You do not have sufficient permissions to access this page.', 'buoy'); return; } if (get_current_user_id() != $alert->wp_post->post_author) { $alert->add_responder(get_current_user_id()); // TODO: Clean this up a bit, maybe the JavaScript should send JSON data? if (!empty($_POST[self::$prefix . '_location'])) { $p = explode(',', $_POST[self::$prefix . '_location']); $geo = array('latitude' => $p[0], 'longitude' => $p[1]); $alert->set_responder_geo(get_current_user_id(), $geo); } } require_once 'pages/incident-chat.php'; }