Changeset 6191 for trunk/src/includes/admin/converter.php
- Timestamp:
- 12/28/2016 04:24:52 AM (9 years ago)
- File:
-
- 1 edited
-
trunk/src/includes/admin/converter.php (modified) (23 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/admin/converter.php
r6184 r6191 664 664 KEY value_id (value_id), 665 665 KEY meta_join (meta_key({$max_index_length}), meta_value({$max_index_length})) 666 ) {$charset_collate} ;";666 ) {$charset_collate}"; 667 667 668 668 dbDelta( $sql ); … … 1016 1016 // Get some data from the old forums 1017 1017 $field_list = array_unique( $field_list ); 1018 $forum_query = 'SELECT ' . implode( ',', $field_list ) . ' FROM ' . $this->opdb->prefix . $from_tablename . ' LIMIT ' . $start . ', ' . $this->max_rows; 1018 $fields = implode( ',', $field_list ); 1019 $forum_query = "SELECT {$fields} FROM {$this->opdb->prefix}{$from_tablename} LIMIT {$start}, {$this->max_rows}"; 1019 1020 $forum_array = $this->opdb->get_results( $forum_query, ARRAY_A ); 1020 1021 … … 1254 1255 1255 1256 if ( ! empty( $this->sync_table ) ) { 1256 $query = 'SELECT value_id, meta_value FROM ' . $this->sync_table_name . ' WHERE meta_key = "_bbp_old_forum_parent_id" AND meta_value > 0 LIMIT ' . $start . ', ' . $this->max_rows;1257 $query = $this->wpdb->prepare( "SELECT value_id, meta_value FROM {$this->sync_table_name} WHERE meta_key = %s AND meta_value > 0 LIMIT {$start}, {$this->max_rows}", '_bbp_old_forum_parent_id' ); 1257 1258 } else { 1258 $query = 'SELECT post_id AS value_id, meta_value FROM ' . $this->wpdb->postmeta . ' WHERE meta_key = "_bbp_old_forum_parent_id" AND meta_value > 0 LIMIT ' . $start . ', ' . $this->max_rows;1259 $query = $this->wpdb->prepare( "SELECT post_id AS value_id, meta_value FROM {$this->wpdb->postmeta} WHERE meta_key = %s AND meta_value > 0 LIMIT {$start}, {$this->max_rows}", '_bbp_old_forum_parent_id' ); 1259 1260 } 1260 1261 … … 1265 1266 foreach ( (array) $forum_array as $row ) { 1266 1267 $parent_id = $this->callback_forumid( $row->meta_value ); 1267 $this->wpdb->query( 'UPDATE ' . $this->wpdb->posts . ' SET post_parent = "' . $parent_id . '" WHERE ID = "' . $row->value_id . '" LIMIT 1');1268 $this->wpdb->query( $this->wpdb->prepare( "UPDATE {$this->wpdb->posts} SET post_parent = %d WHERE ID = %d LIMIT 1", $parent_id, $row->value_id ) ); 1268 1269 $has_update = true; 1269 1270 } … … 1286 1287 1287 1288 if ( ! empty( $this->sync_table ) ) { 1288 $query = 'SELECT value_id, meta_value FROM ' . $this->sync_table_name . ' WHERE meta_key = "_bbp_old_sticky_status_id" AND meta_value = "sticky" LIMIT ' . $start . ', ' . $this->max_rows;1289 $query = $this->wpdb->prepare( "SELECT value_id, meta_value FROM {$this->sync_table_name} WHERE meta_key = %s AND meta_value = %s LIMIT {$start}, {$this->max_rows}", '_bbp_old_sticky_status_id', 'sticky' ); 1289 1290 } else { 1290 $query = 'SELECT post_id AS value_id, meta_value FROM ' . $this->wpdb->postmeta . ' WHERE meta_key = "_bbp_old_sticky_status_id" AND meta_value = "sticky" LIMIT ' . $start . ', ' . $this->max_rows;1291 $query = $this->wpdb->prepare( "SELECT post_id AS value_id, meta_value FROM {$this->wpdb->postmeta} WHERE meta_key = %s AND meta_value = %s LIMIT {$start}, {$this->max_rows}", '_bbp_old_sticky_status_id', 'sticky' ); 1291 1292 } 1292 1293 … … 1317 1318 1318 1319 if ( ! empty( $this->sync_table ) ) { 1319 $query = 'SELECT value_id, meta_value FROM ' . $this->sync_table_name . ' WHERE meta_key = "_bbp_old_sticky_status_id" AND meta_value = "super-sticky" LIMIT ' . $start . ', ' . $this->max_rows;1320 $query = $this->wpdb->prepare( "SELECT value_id, meta_value FROM {$this->sync_table_name} WHERE meta_key = %s AND meta_value = %s LIMIT {$start}, {$this->max_rows}", '_bbp_old_sticky_status_id', 'super-sticky' ); 1320 1321 } else { 1321 $query = 'SELECT post_id AS value_id, meta_value FROM ' . $this->wpdb->postmeta . ' WHERE meta_key = "_bbp_old_sticky_status_id" AND meta_value = "super-sticky" LIMIT ' . $start . ', ' . $this->max_rows;1322 $query = $this->wpdb->prepare( "SELECT post_id AS value_id, meta_value FROM {$this->wpdb->postmeta} WHERE meta_key = %s AND meta_value = %s LIMIT {$start}, {$this->max_rows}", '_bbp_old_sticky_status_id', 'super-sticky' ); 1322 1323 } 1323 1324 … … 1348 1349 1349 1350 if ( ! empty( $this->sync_table ) ) { 1350 $query = 'SELECT value_id, meta_value FROM ' . $this->sync_table_name . ' WHERE meta_key = "_bbp_old_closed_status_id" AND meta_value = "closed" LIMIT ' . $start . ', ' . $this->max_rows;1351 $query = $this->wpdb->prepare( "SELECT value_id, meta_value FROM {$this->sync_table_name} WHERE meta_key = %s AND meta_value = %s LIMIT {$start}, {$this->max_rows}", '_bbp_old_closed_status_id', 'closed' ); 1351 1352 } else { 1352 $query = 'SELECT post_id AS value_id, meta_value FROM ' . $this->wpdb->postmeta . ' WHERE meta_key = "_bbp_old_closed_status_id" AND meta_value = "closed" LIMIT ' . $start . ', ' . $this->max_rows;1353 $query = $this->wpdb->prepare( "SELECT post_id AS value_id, meta_value FROM {$this->wpdb->postmeta} WHERE meta_key = %s AND meta_value = %s LIMIT {$start}, {$this->max_rows}", '_bbp_old_closed_status_id', 'closed' ); 1353 1354 } 1354 1355 … … 1375 1376 1376 1377 if ( ! empty( $this->sync_table ) ) { 1377 $query = 'SELECT value_id, meta_value FROM ' . $this->sync_table_name . ' WHERE meta_key = "_bbp_old_reply_to_id" AND meta_value > 0 LIMIT ' . $start . ', ' . $this->max_rows;1378 $query = $this->wpdb->prepare( "SELECT value_id, meta_value FROM {$this->sync_table_name} WHERE meta_key = %s AND meta_value > 0 LIMIT {$start}, {$this->max_rows}", '_bbp_old_reply_to_id' ); 1378 1379 } else { 1379 $query = 'SELECT post_id AS value_id, meta_value FROM ' . $this->wpdb->postmeta . ' WHERE meta_key = "_bbp_old_reply_to_id" AND meta_value > 0 LIMIT ' . $start . ', ' . $this->max_rows;1380 $query = $this->wpdb->prepare( "SELECT post_id AS value_id, meta_value FROM {$this->wpdb->postmeta} WHERE meta_key = %s AND meta_value > 0 LIMIT {$start}, {$this->max_rows}", '_bbp_old_reply_to_id' ); 1380 1381 } 1381 1382 … … 1386 1387 foreach ( (array) $reply_to_array as $row ) { 1387 1388 $reply_to = $this->callback_reply_to( $row->meta_value ); 1388 $this->wpdb->query( 'UPDATE ' . $this->wpdb->postmeta . ' SET meta_value = "' . $reply_to . '" WHERE meta_key = "_bbp_reply_to" AND post_id = "' . $row->value_id . '" LIMIT 1');1389 $this->wpdb->query( $this->wpdb->prepare( "UPDATE {$this->wpdb->postmeta} SET meta_value = %s WHERE meta_key = %s AND post_id = %d LIMIT 1", $reply_to, '_bbp_reply_to', $row->value_id ) ); 1389 1390 $has_update = true; 1390 1391 } … … 1405 1406 1406 1407 if ( ! empty( $this->sync_table ) ) { 1407 $query = 'SELECT sync_table1.value_id AS topic_id, sync_table1.meta_value AS topic_is_anonymous, sync_table2.meta_value AS topic_author1408 FROM ' . $this->sync_table_name . 'AS sync_table11409 INNER JOIN ' . $this->sync_table_name . 'AS sync_table21408 $query = $this->wpdb->prepare( "SELECT sync_table1.value_id AS topic_id, sync_table1.meta_value AS topic_is_anonymous, sync_table2.meta_value AS topic_author 1409 FROM {$this->sync_table_name} AS sync_table1 1410 INNER JOIN {$this->sync_table_name} AS sync_table2 1410 1411 ON ( sync_table1.value_id = sync_table2.value_id ) 1411 WHERE sync_table1.meta_value = "true"1412 AND sync_table2.meta_key = "_bbp_old_topic_author_name_id"1413 LIMIT ' . $start . ', ' . $this->max_rows;1412 WHERE sync_table1.meta_value = %s 1413 AND sync_table2.meta_key = %s 1414 LIMIT {$start}, {$this->max_rows}", 'true', '_bbp_old_topic_author_name_id' ); 1414 1415 } else { 1415 $query = 'SELECT wp_postmeta1.post_id AS topic_id, wp_postmeta1.meta_value AS topic_is_anonymous, wp_postmeta2.meta_value AS topic_author1416 FROM ' . $this->wpdb->postmeta . 'AS wp_postmeta11417 INNER JOIN ' . $this->wpdb->postmeta . 'AS wp_postmeta21416 $query = $this->wpdb->prepare( "SELECT wp_postmeta1.post_id AS topic_id, wp_postmeta1.meta_value AS topic_is_anonymous, wp_postmeta2.meta_value AS topic_author 1417 FROM {$this->wpdb->postmeta} AS wp_postmeta1 1418 INNER JOIN {$this->wpdb->postmeta} AS wp_postmeta2 1418 1419 ON ( wp_postmeta1.post_id = wp_postmeta2.post_id ) 1419 WHERE wp_postmeta1.meta_value = "true"1420 AND wp_postmeta2.meta_key = "_bbp_old_topic_author_name_id"1421 LIMIT ' . $start . ', ' . $this->max_rows;1420 WHERE wp_postmeta1.meta_value = %s 1421 AND wp_postmeta2.meta_key = %s 1422 LIMIT {$start}, {$this->max_rows}", 'true', '_bbp_old_topic_author_name_id' ); 1422 1423 1423 1424 } … … 1429 1430 foreach ( (array) $anonymous_topics as $row ) { 1430 1431 $anonymous_topic_author_id = 0; 1431 $this->wpdb->query( 'UPDATE ' . $this->wpdb->posts . ' SET post_author = "' . $anonymous_topic_author_id . '" WHERE ID = "' . $row->topic_id . '" LIMIT 1');1432 $this->wpdb->query( $this->wpdb->prepare( "UPDATE {$this->wpdb->posts} SET post_author = %d WHERE ID = %d LIMIT 1", $anonymous_topic_author_id, $row->topic_id ) ); 1432 1433 1433 1434 add_post_meta( $row->topic_id, '_bbp_anonymous_name', $row->topic_author ); … … 1451 1452 1452 1453 if ( ! empty( $this->sync_table ) ) { 1453 $query = 'SELECT sync_table1.value_id AS reply_id, sync_table1.meta_value AS reply_is_anonymous, sync_table2.meta_value AS reply_author1454 FROM ' . $this->sync_table_name . 'AS sync_table11455 INNER JOIN ' . $this->sync_table_name . 'AS sync_table21454 $query = $this->wpdb->prepare( "SELECT sync_table1.value_id AS reply_id, sync_table1.meta_value AS reply_is_anonymous, sync_table2.meta_value AS reply_author 1455 FROM {$this->sync_table_name} AS sync_table1 1456 INNER JOIN {$this->sync_table_name} AS sync_table2 1456 1457 ON ( sync_table1.value_id = sync_table2.value_id ) 1457 WHERE sync_table1.meta_value = "true"1458 AND sync_table2.meta_key = "_bbp_old_reply_author_name_id"1459 LIMIT ' . $start . ', ' . $this->max_rows;1458 WHERE sync_table1.meta_value = %s 1459 AND sync_table2.meta_key = %s 1460 LIMIT {$start}, {$this->max_rows}", 'true', '_bbp_old_reply_author_name_id' ); 1460 1461 } else { 1461 $query = 'SELECT wp_postmeta1.post_id AS reply_id, wp_postmeta1.meta_value AS reply_is_anonymous, wp_postmeta2.meta_value AS reply_author1462 FROM ' . $this->wpdb->postmeta . 'AS wp_postmeta11463 INNER JOIN ' . $this->wpdb->postmeta . 'AS wp_postmeta21462 $query = $this->wpdb->prepare( "SELECT wp_postmeta1.post_id AS reply_id, wp_postmeta1.meta_value AS reply_is_anonymous, wp_postmeta2.meta_value AS reply_author 1463 FROM {$this->wpdb->postmeta} AS wp_postmeta1 1464 INNER JOIN {$this->wpdb->postmeta} AS wp_postmeta2 1464 1465 ON ( wp_postmeta1.post_id = wp_postmeta2.post_id ) 1465 WHERE wp_postmeta1.meta_value = "true"1466 AND wp_postmeta2.meta_key = "_bbp_old_reply_author_name_id"1467 LIMIT ' . $start . ', ' . $this->max_rows;1466 WHERE wp_postmeta1.meta_value = %s 1467 AND wp_postmeta2.meta_key = %s 1468 LIMIT {$start}, {$this->max_rows}", 'true', '_bbp_old_reply_author_name_id' ); 1468 1469 1469 1470 } … … 1475 1476 foreach ( (array) $anonymous_replies as $row ) { 1476 1477 $anonymous_reply_author_id = 0; 1477 $this->wpdb->query( 'UPDATE ' . $this->wpdb->posts . ' SET post_author = "' . $anonymous_reply_author_id . '" WHERE ID = "' . $row->reply_id . '" LIMIT 1');1478 $this->wpdb->query( $this->wpdb->prepare( "UPDATE {$this->wpdb->posts} SET post_author = %d WHERE ID = %d LIMIT 1", $anonymous_reply_author_id, $row->reply_id ) ); 1478 1479 1479 1480 add_post_meta( $row->reply_id, '_bbp_anonymous_name', $row->reply_author ); … … 1496 1497 1497 1498 if ( true === $this->sync_table ) { 1498 $query = 'SELECT value_id FROM ' . $this->sync_table_name . ' INNER JOIN ' . $this->wpdb->posts . ' ON(value_id = ID) WHERE meta_key LIKE "_bbp_%" AND value_type = "post" GROUP BY value_id ORDER BY value_id DESC LIMIT ' . $this->max_rows;1499 $query = $this->wpdb->prepare( "SELECT value_id FROM {$this->sync_table_name} INNER JOIN {$this->wpdb->posts} ON(value_id = ID) WHERE meta_key LIKE '_bbp_%' AND value_type = %s GROUP BY value_id ORDER BY value_id DESC LIMIT {$this->max_rows}", 'post' ); 1499 1500 } else { 1500 $query = 'SELECT post_id AS value_id FROM ' . $this->wpdb->postmeta . ' WHERE meta_key LIKE "_bbp_%" GROUP BY post_id ORDER BY post_id DESC LIMIT ' . $this->max_rows;1501 $query = $this->wpdb->prepare( "SELECT post_id AS value_id FROM {$this->wpdb->postmeta} WHERE meta_key LIKE '_bbp_%' GROUP BY post_id ORDER BY post_id DESC LIMIT {$this->max_rows}" ); 1501 1502 } 1502 1503 … … 1515 1516 1516 1517 if ( true === $this->sync_table ) { 1517 $query = 'SELECT value_id FROM ' . $this->sync_table_name . ' INNER JOIN ' . $this->wpdb->users . ' ON(value_id = ID) WHERE meta_key = "_bbp_old_user_id" AND value_type = "user" LIMIT ' . $this->max_rows;1518 $query = $this->wpdb->prepare( "SELECT value_id FROM {$this->sync_table_name} INNER JOIN {$this->wpdb->users} ON(value_id = ID) WHERE meta_key = %s AND value_type = %s LIMIT {$this->max_rows}", '_bbp_old_user_id', 'user' ); 1518 1519 } else { 1519 $query = 'SELECT user_id AS value_id FROM ' . $this->wpdb->usermeta . ' WHERE meta_key = "_bbp_old_user_id" LIMIT ' . $this->max_rows;1520 $query = $this->wpdb->prepare( "SELECT user_id AS value_id FROM {$this->wpdb->usermeta} WHERE meta_key = %s LIMIT {$this->max_rows}", '_bbp_old_user_id' ); 1520 1521 } 1521 1522 … … 1548 1549 /** Delete bbconverter passwords **************************************/ 1549 1550 1550 $query = 'SELECT user_id, meta_value FROM ' . $this->wpdb->usermeta . ' WHERE meta_key = "_bbp_password" LIMIT ' . $start . ', ' . $this->max_rows;1551 $query = $this->wpdb->prepare( "SELECT user_id, meta_value FROM {$this->wpdb->usermeta} WHERE meta_key = %s LIMIT {$start}, {$this->max_rows}", '_bbp_password' ); 1551 1552 update_option( '_bbp_converter_query', $query ); 1552 1553 … … 1557 1558 foreach ( $bbconverter as $value ) { 1558 1559 if ( is_serialized( $value['meta_value'] ) ) { 1559 $this->wpdb->query( 'UPDATE ' . $this->wpdb->users . ' ' . 'SET user_pass = "" ' . 'WHERE ID = "' . $value['user_id'] . '"');1560 } else { 1561 $this->wpdb->query( 'UPDATE ' . $this->wpdb->users . ' ' . 'SET user_pass = "' . $value['meta_value'] . '" ' . 'WHERE ID = "' . $value['user_id'] . '"');1562 $this->wpdb->query( 'DELETE FROM ' . $this->wpdb->usermeta . ' WHERE meta_key = "_bbp_password" AND user_id = "' . $value['user_id'] . '"');1560 $this->wpdb->query( $this->wpdb->prepare( "UPDATE {$this->wpdb->users} SET user_pass = '' WHERE ID = %d", $value['user_id'] ) ); 1561 } else { 1562 $this->wpdb->query( $this->wpdb->prepare( "UPDATE {$this->wpdb->users} SET user_pass = %s WHERE ID = %d", $value['meta_value'], $value['user_id'] ) ); 1563 $this->wpdb->query( $this->wpdb->prepare( "DELETE FROM {$this->wpdb->usermeta} WHERE meta_key = %s AND user_id = %d", '_bbp_password', $value['user_id'] ) ); 1563 1564 } 1564 1565 } … … 1613 1614 */ 1614 1615 public function callback_pass( $username, $password ) { 1615 $user = $this->wpdb->get_row( $this->wpdb->prepare( 'SELECT * FROM ' . $this->wpdb->users . ' WHERE user_login = "%s" AND user_pass = "" LIMIT 1', $username ) );1616 $user = $this->wpdb->get_row( $this->wpdb->prepare( "SELECT * FROM {$this->wpdb->users} WHERE user_login = %s AND user_pass = '' LIMIT 1", $username ) ); 1616 1617 if ( ! empty( $user ) ) { 1617 $usermeta = $this->wpdb->get_row( 'SELECT * FROM ' . $this->wpdb->usermeta . ' WHERE meta_key = "_bbp_password" AND user_id = "' . $user->ID . '" LIMIT 1');1618 $usermeta = $this->wpdb->get_row( $this->wpdb->prepare( "SELECT * FROM {$this->wpdb->usermeta} WHERE meta_key = %s AND user_id = %d LIMIT 1", '_bbp_password', $user->ID ) ); 1618 1619 1619 1620 if ( ! empty( $usermeta ) ) { 1620 1621 if ( $this->authenticate_pass( $password, $usermeta->meta_value ) ) { 1621 $this->wpdb->query( 'UPDATE ' . $this->wpdb->users . ' ' . 'SET user_pass = "' . wp_hash_password( $password ) . '" ' . 'WHERE ID = "' . $user->ID . '"');1622 $this->wpdb->query( 'DELETE FROM ' . $this->wpdb->usermeta . ' WHERE meta_key = "_bbp_password" AND user_id = "' . $user->ID . '"');1622 $this->wpdb->query( $this->wpdb->prepare( "UPDATE {$this->wpdb->users} SET user_pass = %s WHERE ID = %d", wp_hash_password( $password ), $user->ID ) ); 1623 $this->wpdb->query( $this->wpdb->prepare( "DELETE FROM {$this->wpdb->usermeta} WHERE meta_key = %s AND user_id = %d", '_bbp_password', $user->ID ) ); 1623 1624 } 1624 1625 } … … 1635 1636 if ( ! isset( $this->map_forumid[ $field ] ) ) { 1636 1637 if ( ! empty( $this->sync_table ) ) { 1637 $row = $this->wpdb->get_row( $this->wpdb->prepare( 'SELECT value_id, meta_value FROM ' . $this->sync_table_name . ' WHERE meta_key = "_bbp_old_forum_id" AND meta_value = "%s" LIMIT 1', $field ) );1638 $row = $this->wpdb->get_row( $this->wpdb->prepare( "SELECT value_id, meta_value FROM {$this->sync_table_name} WHERE meta_key = %s AND meta_value = %s LIMIT 1", '_bbp_old_forum_id', $field ) ); 1638 1639 } else { 1639 $row = $this->wpdb->get_row( $this->wpdb->prepare( 'SELECT post_id AS value_id FROM ' . $this->wpdb->postmeta . ' WHERE meta_key = "_bbp_old_forum_id" AND meta_value = "%s" LIMIT 1', $field ) );1640 $row = $this->wpdb->get_row( $this->wpdb->prepare( "SELECT post_id AS value_id FROM {$this->wpdb->postmeta} WHERE meta_key = %s AND meta_value = %s LIMIT 1", '_bbp_old_forum_id', $field ) ); 1640 1641 } 1641 1642 … … 1658 1659 if ( ! isset( $this->map_topicid[ $field ] ) ) { 1659 1660 if ( ! empty( $this->sync_table ) ) { 1660 $row = $this->wpdb->get_row( $this->wpdb->prepare( 'SELECT value_id, meta_value FROM ' . $this->sync_table_name . ' WHERE meta_key = "_bbp_old_topic_id" AND meta_value = "%s" LIMIT 1', $field ) );1661 $row = $this->wpdb->get_row( $this->wpdb->prepare( "SELECT value_id, meta_value FROM {$this->sync_table_name} WHERE meta_key = %s AND meta_value = %s LIMIT 1", '_bbp_old_topic_id', $field ) ); 1661 1662 } else { 1662 $row = $this->wpdb->get_row( $this->wpdb->prepare( 'SELECT post_id AS value_id FROM ' . $this->wpdb->postmeta . ' WHERE meta_key = "_bbp_old_topic_id" AND meta_value = "%s" LIMIT 1', $field ) );1663 $row = $this->wpdb->get_row( $this->wpdb->prepare( "SELECT post_id AS value_id FROM {$this->wpdb->postmeta} WHERE meta_key = %s AND meta_value = %s LIMIT 1", '_bbp_old_topic_id', $field ) ); 1663 1664 } 1664 1665 … … 1683 1684 if ( ! isset( $this->map_reply_to[ $field ] ) ) { 1684 1685 if ( ! empty( $this->sync_table ) ) { 1685 $row = $this->wpdb->get_row( $this->wpdb->prepare( 'SELECT value_id, meta_value FROM ' . $this->sync_table_name . ' WHERE meta_key = "_bbp_old_reply_id" AND meta_value = "%s" LIMIT 1', $field ) );1686 $row = $this->wpdb->get_row( $this->wpdb->prepare( "SELECT value_id, meta_value FROM {$this->sync_table_name} WHERE meta_key = %s AND meta_value = %s LIMIT 1", '_bbp_old_reply_id', $field ) ); 1686 1687 } else { 1687 $row = $this->wpdb->get_row( $this->wpdb->prepare( 'SELECT post_id AS value_id FROM ' . $this->wpdb->postmeta . ' WHERE meta_key = "_bbp_old_reply_id" AND meta_value = "%s" LIMIT 1', $field ) );1688 $row = $this->wpdb->get_row( $this->wpdb->prepare( "SELECT post_id AS value_id FROM {$this->wpdb->postmeta} WHERE meta_key = %s AND meta_value = %s LIMIT 1", '_bbp_old_reply_id', $field ) ); 1688 1689 } 1689 1690 … … 1706 1707 if ( ! isset( $this->map_userid[ $field ] ) ) { 1707 1708 if ( ! empty( $this->sync_table ) ) { 1708 $row = $this->wpdb->get_row( $this->wpdb->prepare( 'SELECT value_id, meta_value FROM ' . $this->sync_table_name . ' WHERE meta_key = "_bbp_old_user_id" AND meta_value = "%s" LIMIT 1', $field ) );1709 $row = $this->wpdb->get_row( $this->wpdb->prepare( "SELECT value_id, meta_value FROM {$this->sync_table_name} WHERE meta_key = %s AND meta_value = %s LIMIT 1", '_bbp_old_user_id', $field ) ); 1709 1710 } else { 1710 $row = $this->wpdb->get_row( $this->wpdb->prepare( 'SELECT user_id AS value_id FROM ' . $this->wpdb->usermeta . ' WHERE meta_key = "_bbp_old_user_id" AND meta_value = "%s" LIMIT 1', $field ) );1711 $row = $this->wpdb->get_row( $this->wpdb->prepare( "SELECT user_id AS value_id FROM {$this->wpdb->usermeta} WHERE meta_key = %s AND meta_value = %s LIMIT 1", '_bbp_old_user_id', $field ) ); 1711 1712 } 1712 1713 … … 1754 1755 $this->map_topicid_to_forumid[ $topicid ] = 0; 1755 1756 } elseif ( ! isset( $this->map_topicid_to_forumid[ $topicid ] ) ) { 1756 $row = $this->wpdb->get_row( 'SELECT post_parent FROM ' . $this->wpdb->posts . ' WHERE ID = "' . $topicid . '" LIMIT 1');1757 $row = $this->wpdb->get_row( $this->wpdb->prepare( "SELECT post_parent FROM {$this->wpdb->posts} WHERE ID = %d LIMIT 1", $topicid ) ); 1757 1758 1758 1759 if ( !is_null( $row ) ) {
Note: See TracChangeset
for help on using the changeset viewer.