PluginProbe
WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards / 5.5.84
WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards v5.5.84
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 5.5.42 All 160 releases
← All changes | WPDataAccess/API/WPDA_Tree.php +11 -19 5.5.295.5.84 View file →
@@ -182,12 +182,14 @@
182 182 $dbs = $request->get_param( 'dbs' );
183 183 return $this->get_prc( $dbs );
184 184 }
185 185
186 - public function get_dbs() {
186 + public function get_dbs( $include_disabled = false ) {
187 187 // Local databases
188 188 global $wpdb;
189 + // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
189 190 $local = $wpdb->get_results( "\n\t\t\t\t\tSELECT schema_name AS dbs,\n\t\t\t\t\t\t\t'local' AS dbs_type,\n\t\t\t\t\t\t\t'false' AS pds\n\t\t\t\t\t FROM information_schema.schemata\n\t\t\t\t\t ORDER BY schema_name\n\t\t\t \t", 'ARRAY_A' );
191 + // phpcs:enable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
190 192 for ($i = 0; $i < count( $local ); $i++) {
191 193 if ( $wpdb->dbname === $local[$i]['dbs'] ) {
192 194 // WordPress database
193 195 $local[$i]['dbs_type'] = 'wp';
@@ -201,9 +203,9 @@
201 203 }
202 204 // Remote databases
203 205 $remote = array();
204 206 $pds = array();
205 - $rdb = WPDADB::get_remote_databases();
207 + $rdb = WPDADB::get_remote_databases( $include_disabled );
206 208 foreach ( $rdb as $key => $val ) {
207 209 $remote[] = array(
208 210 'dbs' => $key,
209 211 'dbs_type' => 'remote',
@@ -217,17 +219,19 @@
217 219 'roles' => $this->get_wp_roles(),
218 220 'users' => $this->get_wp_users(),
219 221 'home' => admin_url( 'admin.php' ),
220 222 'tables' => array_values( $wpdb->tables() ),
221 - 'nonce' => implode( '-', array(wp_create_nonce( 'wpda-export-' . WPDA::get_current_user_login() )) ),
222 223 'zip' => class_exists( '\\ZipArchive' ),
223 224 'upload' => @ini_get( 'upload_max_filesize' ),
224 225 ],
225 226 );
227 + if ( 'anonymous' !== WPDA::get_current_user_login() ) {
228 + $context['wp']['nonce'] = implode( '-', array(wp_create_nonce( 'wpda-export-' . WPDA::get_current_user_login() )) );
229 + }
226 230 return $this->WPDA_Rest_Response(
227 231 '',
228 232 array_merge( $local, $remote ),
229 - //phpcs:ignore - 8.1 proof
233 + // phpcs:ignore -- 8.1 proof
230 234 $context
231 235 );
232 236 }
233 237
@@ -236,13 +240,9 @@
236 240 if ( $wpdadb === null ) {
237 241 return $this->WPDA_Rest_Response( '', array() );
238 242 }
239 243 $query = $wpdadb->prepare( "\n\t\t\t\t\tselect table_name as table_name\n\t\t\t\t\t from information_schema.tables\n\t\t\t\t\t where table_schema = %s\n\t\t\t\t\t order by table_name\n\t\t\t\t", array($wpdadb->dbname) );
240 - return $this->WPDA_Rest_Response( '', array_column(
241 - $wpdadb->get_results( $query, 'ARRAY_A' ),
242 - // phpcs:ignore Standard.Category.SniffName.ErrorCode
243 - 'table_name'
244 - ) );
244 + return $this->WPDA_Rest_Response( '', array_column( $wpdadb->get_results( $query, 'ARRAY_A' ), 'table_name' ) );
245 245 }
246 246
247 247 private function get_tbl( $dbs ) {
248 248 $wpdadb = WPDADB::get_db_connection( $dbs );
@@ -257,13 +257,9 @@
257 257 'wp_tables' => array_keys( WPDA::get_wp_tables() ),
258 258 'wpda_tables' => WPDA::get_wpda_tables(),
259 259 );
260 260 }
261 - return $this->WPDA_Rest_Response( '', array_column(
262 - $wpdadb->get_results( $query, 'ARRAY_A' ),
263 - // phpcs:ignore Standard.Category.SniffName.ErrorCode
264 - 'table_name'
265 - ), $context );
261 + return $this->WPDA_Rest_Response( '', array_column( $wpdadb->get_results( $query, 'ARRAY_A' ), 'table_name' ), $context );
266 262 }
267 263
268 264 private function get_vws( $dbs ) {
269 265 $wpdadb = WPDADB::get_db_connection( $dbs );
@@ -270,13 +266,9 @@
270 266 if ( $wpdadb === null ) {
271 267 return $this->WPDA_Rest_Response( '', array() );
272 268 }
273 269 $query = $wpdadb->prepare( "\n\t\t\t\t\tselect table_name as view_name\n\t\t\t\t\t from information_schema.tables\n\t\t\t\t\t where table_schema = %s\n\t\t\t\t\t and table_type in ('VIEW', 'SYSTEM VIEW')\n\t\t\t\t\t order by table_name\n\t\t\t\t", array($wpdadb->dbname) );
274 - return $this->WPDA_Rest_Response( '', array_column(
275 - $wpdadb->get_results( $query, 'ARRAY_A' ),
276 - // phpcs:ignore Standard.Category.SniffName.ErrorCode
277 - 'view_name'
278 - ) );
270 + return $this->WPDA_Rest_Response( '', array_column( $wpdadb->get_results( $query, 'ARRAY_A' ), 'view_name' ) );
279 271 }
280 272
281 273 public function get_cls( $dbs, $tbl ) {
282 274 $wpdadb = WPDADB::get_db_connection( $dbs );