PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.9
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.9
4.4.9 4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 All 140 releases
← All changes | inc/Databases/DataBase.php +14 -6 4.3.7 → 4.4.9 View file →
@@ -11,9 +11,9 @@
11 11 /**
12 12 * Class DataBase
13 13 *
14 14 * @since 4.2.9.3
15 - * @version 1.0.0
15 + * @version 1.0.1
16 16 */
17 17 class DataBase {
18 18 private static $_instance;
19 19 public $wpdb, $tb_users;
@@ -29,9 +29,11 @@
29 29 public $tb_lp_question_answermeta;
30 30 public $tb_lp_upgrade_db;
31 31 public $tb_lp_sessions;
32 32 public $tb_lp_files;
33 + public $tb_lp_webhooks;
33 34 public $tb_thim_cache;
35 + public $tb_lp_mcp_api_keys;
34 36 private $collate = '';
35 37 public $max_index_length = '191';
36 38
37 39 protected function __construct() {
@@ -62,9 +64,11 @@
62 64 $this->tb_lp_question_answermeta = $prefix . 'learnpress_question_answermeta';
63 65 $this->tb_lp_upgrade_db = $prefix . 'learnpress_upgrade_db';
64 66 $this->tb_lp_sessions = $prefix . 'learnpress_sessions';
65 67 $this->tb_lp_files = $prefix . 'learnpress_files';
68 + $this->tb_lp_webhooks = $prefix . 'learnpress_webhooks';
66 69 $this->tb_thim_cache = $prefix . 'thim_cache';
70 + $this->tb_lp_mcp_api_keys = $prefix . 'learnpress_mcp_api_keys';
67 71 $this->wpdb->hide_errors();
68 72 $this->set_collate();
69 73 }
70 74
@@ -106,11 +110,16 @@
106 110 *
107 111 * @param string $name_table
108 112 *
109 113 * @return bool|int
114 + * @throws Exception
110 115 */
111 116 public function check_table_exists( string $name_table ) {
112 - return $this->wpdb->query( $this->wpdb->prepare( "SHOW TABLES LIKE '%s'", $name_table ) );
117 + return $this->wpdb->query(
118 + $this->wpdb->prepare(
119 + "SHOW TABLES LIKE '%s'", $name_table
120 + )
121 + );
113 122 }
114 123
115 124 /**
116 125 * Clone table
@@ -152,8 +161,9 @@
152 161 * @return bool|int
153 162 */
154 163 public function check_col_table( string $name_table = '', string $name_col = '' ) {
155 164 $query = $this->wpdb->prepare( "SHOW COLUMNS FROM $name_table LIKE '%s'", $name_col );
165 + //$query = $this->wpdb->prepare( "SHOW COLUMNS FROM $name_table WHERE Field = '%s'", $name_col );
156 166
157 167 return $this->wpdb->query( $query );
158 168 }
159 169
@@ -196,9 +206,9 @@
196 206 * @throws Exception
197 207 */
198 208 public function add_col_table( string $name_table, string $name_col, string $type, string $after_col = '' ) {
199 209 if ( ! current_user_can( ADMIN_ROLE ) ) {
200 - throw new Exception( 'You don\'t have permission' );
210 + return false;
201 211 }
202 212
203 213 $query_add = '';
204 214
@@ -787,9 +797,8 @@
787 797 $data = $args['data'] ?? [];
788 798 $filter = $args['filter'] ?? null;
789 799 $table_name = $args['table_name'] ?? '';
790 800 $key_auto_increment = $args['key_auto_increment'] ?? '';
791 - $key_auto_increment = sanitize_key( $key_auto_increment );
792 801
793 802 if ( empty( $data ) || ! is_array( $data ) ) {
794 803 throw new Exception( __( 'Data must be an array!', 'learnpress' ) . ' | ' . __FUNCTION__ );
795 804 }
@@ -834,9 +843,9 @@
834 843 * @return bool
835 844 *
836 845 * @throws Exception
837 846 * @since 4.2.9
838 - * @version 1.0.1
847 + * @version 1.0.2
839 848 */
840 849 public function update_data( array $args ): bool {
841 850 $data = $args['data'] ?? [];
842 851 $filter = $args['filter'] ?? null;
@@ -841,9 +850,8 @@
841 850 $data = $args['data'] ?? [];
842 851 $filter = $args['filter'] ?? null;
843 852 $table_name = $args['table_name'] ?? '';
844 853 $where_key = $args['where_key'] ?? '';
845 - $where_key = sanitize_key( $where_key );
846 854
847 855 /*if ( ! $filter instanceof FilterBase ) {
848 856 throw new Exception( __( 'Invalid filter!', 'learnpress' ) . ' | ' . __FUNCTION__ );
849 857 }*/