From aa35e02695e0059e3c9d1733e5f14075c601fe4d Mon Sep 17 00:00:00 2001 From: Robby Beyer Date: Tue, 27 Dec 2022 07:20:19 +0100 Subject: [PATCH] Id will be passed to yourls_table_edit_row resulting in the correct line in the table to be updated. Also the nonce will be calculated correctly now for this line. --- admin/admin-ajax.php | 2 +- includes/functions-html.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/admin/admin-ajax.php b/admin/admin-ajax.php index 4045f8567..88de236b2 100644 --- a/admin/admin-ajax.php +++ b/admin/admin-ajax.php @@ -24,7 +24,7 @@ case 'edit_display': yourls_verify_nonce( 'edit-link_'.$_REQUEST['id'], $_REQUEST['nonce'], false, 'omg error' ); - $row = yourls_table_edit_row ( $_REQUEST['keyword'] ); + $row = yourls_table_edit_row ( $_REQUEST['keyword'], $_REQUEST['id'] ); echo json_encode( array('html' => $row) ); break; diff --git a/includes/functions-html.php b/includes/functions-html.php index 427e28eb8..53e102081 100644 --- a/includes/functions-html.php +++ b/includes/functions-html.php @@ -503,11 +503,11 @@ function yourls_die( $message = '', $title = '', $header_code = 200 ) { * Return an "Edit" row for the main table * * @param string $keyword Keyword to edit + * @param string $id * @return string HTML of the edit row */ -function yourls_table_edit_row( $keyword ) { +function yourls_table_edit_row( $keyword, $id ) { $keyword = yourls_sanitize_keyword($keyword); - $id = yourls_unique_element_id(); $url = yourls_get_keyword_longurl( $keyword ); $title = htmlspecialchars( yourls_get_keyword_title( $keyword ) ); $safe_url = yourls_esc_attr( $url );