PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.7
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.7
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/models/FrmDb.php +20 -3 6.36.7 View file →
@@ -92,16 +92,16 @@
92 92 * @param string $key
93 93 * @param string|array $value
94 94 * @param string $where
95 95 * @param array $values
96 + * @return void
96 97 */
97 98 private static function interpret_array_to_sql( $key, $value, &$where, &$values ) {
98 99 $key = trim( $key );
99 100
100 101 if ( strpos( $key, 'created_at' ) !== false || strpos( $key, 'updated_at' ) !== false ) {
101 - $k = explode( ' ', $key );
102 - $where .= ' DATE_FORMAT(' . reset( $k ) . ', %s) ' . str_replace( reset( $k ), '', $key );
103 - $values[] = '%Y-%m-%d %H:%i:%s';
102 + $k = explode( ' ', $key );
103 + $where .= ' CAST(' . reset( $k ) . ' as CHAR) ' . str_replace( reset( $k ), '', $key );
104 104 } else {
105 105 $where .= ' ' . $key;
106 106 }
107 107
@@ -739,6 +739,23 @@
739 739 }
740 740
741 741 wp_cache_delete( 'cached_keys', $group );
742 742 }
743 + }
744 +
745 + /**
746 + * Checks if a DB column exists.
747 + *
748 + * @since 6.7
749 + *
750 + * @param string $table Table name without `$wpdb->prefix`.
751 + * @param string $column Column name.
752 + * @return bool
753 + */
754 + public static function db_column_exists( $table, $column ) {
755 + global $wpdb;
756 +
757 + // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
758 + $result = $wpdb->get_results( $wpdb->prepare( 'SHOW COLUMNS FROM ' . $wpdb->prefix . $table . ' LIKE %s', $column ) );
759 + return ! empty( $result );
743 760 }
744 761 }