PluginProbe
WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards / 5.5.85
WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards v5.5.85
5.5.85 5.5.84 5.5.83 5.5.82 5.5.81 5.5.80 5.5.79 5.5.77 5.5.76 5.5.75 5.5.73 5.5.72 5.5.22 5.5.23 5.5.29 5.5.3 5.5.31 5.5.32 5.5.34 5.5.35 5.5.36 5.5.37 5.5.4 5.5.40 5.5.41 All 161 releases
← All changes | WPDataAccess/Data_Dictionary/WPDA_Dictionary_Lists.php +59 -55 5.5.41 → 5.5.85 View file →
@@ -59,9 +59,9 @@
59 59 $wpdadb->dbname,
60 60 )
61 61 );
62 62
63 - return $wpdadb->get_results( $query, 'ARRAY_A' ); // phpcs:ignore Standard.Category.SniffName.ErrorCode
63 + return $wpdadb->get_results( $query, 'ARRAY_A' );
64 64 }
65 65
66 66 public static function get_table_row_count_ajax() {
67 67 if (
@@ -68,11 +68,11 @@
68 68 isset( $_POST['wpda_wpnonce'] ) &&
69 69 isset( $_POST['wpdaschema_name'] ) &&
70 70 isset( $_POST['wpdatable_name'] )
71 71 ) {
72 - $wpnonce = sanitize_text_field( wp_unslash( $_REQUEST['wpda_wpnonce'] ) ); // input var okay.
73 - $schema_name = sanitize_text_field( wp_unslash( $_REQUEST['wpdaschema_name'] ) ); // input var okay.
74 - $table_name = sanitize_text_field( wp_unslash( $_REQUEST['wpdatable_name'] ) ); // input var okay.
72 + $wpnonce = sanitize_text_field( wp_unslash( $_REQUEST['wpda_wpnonce'] ) ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated
73 + $schema_name = sanitize_text_field( wp_unslash( $_REQUEST['wpdaschema_name'] ) ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated
74 + $table_name = sanitize_text_field( wp_unslash( $_REQUEST['wpdatable_name'] ) ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated
75 75
76 76 if ( ! wp_verify_nonce( $wpnonce, "wpda-get-row-count-{$table_name}" ) ) {
77 77 echo json_encode( array() );
78 78 } else {
@@ -81,9 +81,9 @@
81 81 if ( $wpdadb === null ) {
82 82 echo json_encode( array() );
83 83 } else {
84 84 $query = 'select count(*) as row_count from `' . str_replace( '`', '', $table_name ) . '`';
85 - echo json_encode( $wpdadb->get_results( $query, 'ARRAY_A' ) ); // phpcs:ignore Standard.Category.SniffName.ErrorCode
85 + echo json_encode( $wpdadb->get_results( $query, 'ARRAY_A' ) );
86 86 }
87 87 }
88 88 } else {
89 89 echo json_encode( array() );
@@ -132,9 +132,9 @@
132 132 if ( false === $tables ) {
133 133 $tables = array();
134 134 }
135 135 }
136 - if ( count( $tables ) > 0 ) {//phpcs:ignore - 8.1 proof
136 + if ( count( $tables ) > 0 ) { // phpcs:ignore -- 8.1 proof
137 137 $and = " and `table_name` in ('" . implode( "','", $tables ) . "') ";
138 138 }
139 139 }
140 140
@@ -155,9 +155,9 @@
155 155 $wpdadb->dbname,
156 156 )
157 157 );
158 158
159 - echo json_encode( $wpdadb->get_results( $query, 'ARRAY_A' ) ); // phpcs:ignore Standard.Category.SniffName.ErrorCode
159 + echo json_encode( $wpdadb->get_results( $query, 'ARRAY_A' ) );
160 160 }
161 161 }
162 162 } else {
163 163 echo json_encode( array() );
@@ -198,9 +198,9 @@
198 198 $table_name,
199 199 )
200 200 );
201 201
202 - echo json_encode( $wpdadb->get_results( $query, 'ARRAY_A' ) ); // phpcs:ignore Standard.Category.SniffName.ErrorCode
202 + echo json_encode( $wpdadb->get_results( $query, 'ARRAY_A' ) );
203 203 }
204 204 }
205 205 } else {
206 206 echo json_encode( array() );
@@ -206,56 +206,60 @@
206 206 echo json_encode( array() );
207 207 }
208 208 }
209 209
210 - public static function get_table_widget_info() {
211 - $table_info = array();
210 + public static function get_table_widget_info_ajax() {
211 + $table_info = array();
212 212
213 - if ( isset( $_POST['wpdaschema_name'] ) && isset( $_POST['table_name'] ) && isset( $_POST['wpda_wpnonce'] ) ) {
214 - $wpnonce = sanitize_text_field( wp_unslash( $_POST['wpda_wpnonce'] ) ); // input var okay.
215 - if ( wp_verify_nonce( $wpnonce, 'wpda-getdata-access-' . WPDA::get_current_user_login() ) ) {
216 - $schema_name = isset( $_POST['wpdaschema_name'] ) ? sanitize_text_field( wp_unslash( $_POST['wpdaschema_name'] ) ) : ''; // input var okay.
217 - $table_name = sanitize_text_field( wp_unslash( $_POST['table_name'] ) ); // input var okay.
218 - $wpdadb = WPDADB::get_db_connection( $schema_name );
213 + if ( isset( $_POST['wpdaschema_name'] ) && isset( $_POST['table_name'] ) && isset( $_POST['wpda_wpnonce'] ) ) {
214 + $wpnonce = sanitize_text_field(wp_unslash($_POST['wpda_wpnonce'])); // input var okay.
215 + if (wp_verify_nonce($wpnonce, 'wpda-getdata-access-' . WPDA::get_current_user_login())) {
216 + $schema_name = isset($_POST['wpdaschema_name']) ? sanitize_text_field(wp_unslash($_POST['wpdaschema_name'])) : ''; // input var okay.
217 + $table_name = sanitize_text_field(wp_unslash($_POST['table_name'])); // input var okay.
218 + $table_info = self::get_table_widget_info( $schema_name, $table_name );
219 + }
220 + }
219 221
220 - if ( $wpdadb !== null ) {
221 - $query = $wpdadb->prepare(
222 - '
223 - SELECT column_name AS column_name,
224 - column_type AS column_type
225 - FROM information_schema.columns
226 - WHERE table_schema = %s
227 - AND table_name = %s
228 - ORDER BY ordinal_position
229 - ',
230 - array(
231 - $wpdadb->dbname,
232 - $table_name,
233 - )
234 - );
235 - $columns = $wpdadb->get_results( $query, 'ARRAY_A' );
222 + echo json_encode( $table_info );
223 + }
236 224
237 - $schema_name = $wpdadb->dbname;
238 - $table_name = str_replace( '`', '', $table_name );
239 - $indexes_dbs = $wpdadb->get_results(
240 - "show indexes from `{$schema_name}`.`{$table_name}`",
241 - 'ARRAY_A'
242 - );
225 + public static function get_table_widget_info( $schema_name, $table_name ) {
226 + $wpdadb = WPDADB::get_db_connection( $schema_name );
243 227
244 - $indexes = array();
245 - foreach ( $indexes_dbs as $index_dbs ) {
246 - $indexes[] = array_change_key_case( (array) $index_dbs ); //phpcs:ignore - 8.1 proof
247 - }
228 + if ( $wpdadb !== null ) {
229 + $query = $wpdadb->prepare(
230 + '
231 + SELECT column_name AS column_name,
232 + column_type AS column_type
233 + FROM information_schema.columns
234 + WHERE table_schema = %s
235 + AND table_name = %s
236 + ORDER BY ordinal_position
237 + ',
238 + array(
239 + $wpdadb->dbname,
240 + $table_name,
241 + )
242 + );
243 + $columns = $wpdadb->get_results($query, 'ARRAY_A');
248 244
249 - $table_info = array(
250 - 'columns' => $columns,
251 - 'indexes' => $indexes,
252 - );
253 - }
254 - }
255 - }
245 + $schema_name = $wpdadb->dbname;
246 + $table_name = str_replace('`', '', $table_name);
247 + $indexes_dbs = $wpdadb->get_results(
248 + "show indexes from `{$schema_name}`.`{$table_name}`",
249 + 'ARRAY_A'
250 + );
256 251
257 - echo json_encode( $table_info );
252 + $indexes = array();
253 + foreach ($indexes_dbs as $index_dbs) {
254 + $indexes[] = array_change_key_case((array)$index_dbs); // phpcs:ignore -- 8.1 proof
255 + }
256 +
257 + return array(
258 + 'columns' => $columns,
259 + 'indexes' => $indexes,
260 + );
261 + }
258 262 }
259 263
260 264 /**
261 265 * List of columns for a specific table
@@ -284,9 +288,9 @@
284 288 $table_name,
285 289 )
286 290 );
287 291
288 - return $wpdadb->get_results( $query, 'ARRAY_A' ); // phpcs:ignore Standard.Category.SniffName.ErrorCode
292 + return $wpdadb->get_results( $query, 'ARRAY_A' );
289 293 }
290 294 }
291 295
292 296 /**
@@ -299,9 +303,9 @@
299 303 * @since 1.6.0
300 304 */
301 305 public static function get_db_schemas( $incl_remote_dbs = true ) {
302 306 global $wpdb;
303 - $schemas = $wpdb->get_results(
307 + $schemas = $wpdb->get_results( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
304 308 'SELECT schema_name AS schema_name
305 309 FROM information_schema.schemata
306 310 ORDER BY schema_name',
307 311 'ARRAY_A'
@@ -314,12 +318,12 @@
314 318 $remote[] = array(
315 319 'schema_name' => $key,
316 320 );
317 321 }
318 - asort( $remote );//phpcs:ignore - 8.1 proof
322 + asort( $remote ); // phpcs:ignore -- 8.1 proof
319 323 }
320 324
321 - return array_merge( $schemas, $remote );//phpcs:ignore - 8.1 proof
325 + return array_merge( $schemas, $remote ); // phpcs:ignore -- 8.1 proof
322 326 }
323 327
324 328 /**
325 329 * List of available engines
@@ -417,9 +421,9 @@
417 421 )
418 422 ),
419 423 'ARRAY_A'
420 424 );
421 - if ( 1 === count( $row ) ) {//phpcs:ignore - 8.1 proof
425 + if ( 1 === count( $row ) ) { // phpcs:ignore -- 8.1 proof
422 426 return $row[0]['engine'];
423 427 } else {
424 428 return null;
425 429 }