= 0 && ! isset( $_GET['done'] ) ) ? Notes::their_prompt( $target, $pidx ) : null; // phpcs:ignore WordPress.Security.NonceVerification.Recommended if ( 'accept' === $do && '' === $invite ) { $do = 'follow'; } $host = $target ? (string) wp_parse_url( $target, PHP_URL_HOST ) : ''; ?>
403 ) ); } check_admin_referer( 'stubli_act' ); // phpcs:disable WordPress.Security.NonceVerification.Missing -- checked above. $do = isset( $_POST['do'] ) ? sanitize_key( wp_unslash( $_POST['do'] ) ) : ''; $target = self::target( isset( $_POST['url'] ) ? esc_url_raw( wp_unslash( $_POST['url'] ) ) : '' ); $text = isset( $_POST['text'] ) ? sanitize_textarea_field( wp_unslash( $_POST['text'] ) ) : ''; $invite = isset( $_POST['invite'] ) ? preg_replace( '/[^A-Za-z0-9]/', '', sanitize_text_field( wp_unslash( $_POST['invite'] ) ) ) : ''; // phpcs:enable $back = array( 'page' => self::PAGE, 'do' => $do, 'url' => rawurlencode( $target ), ); $from_app = ! empty( $_POST['from'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing -- checked above. $base = $from_app ? home_url( '/app/' ) : admin_url( 'admin.php' ); if ( $from_app ) { unset( $back['page'] ); $back = array( 'act' => '1' ) + $back; } if ( ! $target ) { wp_safe_redirect( add_query_arg( $back, $base ) ); exit; } if ( 'accept' === $do && '' !== $invite ) { $back['invite'] = $invite; $result = Invites::accept_here( $target, $invite ); } elseif ( 'follow' === $do ) { $result = Follows::add( $target ); } elseif ( 'note' === $do ) { $result = Notes::send( $target, $text, isset( $_POST['p'] ) ? (int) $_POST['p'] : -1 ); // phpcs:ignore WordPress.Security.NonceVerification.Missing -- checked above. } elseif ( '' === trim( $text ) ) { $result = new \WP_Error( 'stubli_empty', __( 'Write something first.', 'stubli' ) ); } else { $result = Replies::comment_on_url( $target, $text ); } if ( is_wp_error( $result ) ) { $back['error'] = rawurlencode( $result->get_error_message() ); } else { $back['done'] = ( is_array( $result ) && isset( $result['status'] ) && 'paused' === $result['status'] ) ? 'paused' : '1'; if ( 'accept' === $do ) { $back['done'] = ! empty( $result['followed_back'] ) ? 'both' : 'one'; } } wp_safe_redirect( add_query_arg( $back, $base ) ); exit; } }