PluginProbe
WP Directory Kit / 1.5.9
WP Directory Kit v1.5.9
1.5.9 1.5.7 1.5.6 1.5.5 1.5.4 1.5.3 trunk 1.1.0 1.1.6 1.1.8 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.8 All 37 releases
← All changes | application/controllers/Wdk_category.php +20 -4 1.1.8 → 1.5.9 View file →
@@ -36,10 +36,14 @@
36 36 {
37 37 $id = (int) $this->input->post_get('id');
38 38 $paged = (int) $this->input->post_get('paged');
39 39
40 + // Check _wpnonce
41 + check_admin_referer( 'wdk-category-delete_'.$id, '_wpnonce' );
42 +
40 43 $this->load->model('category_m');
41 -
44 + wdk_access_check('category_m', $id);
45 +
42 46 $this->category_m->delete($id);
43 47
44 48 wp_redirect(admin_url("admin.php?page=wdk_category&paged=$paged"));
45 49 }
@@ -45,11 +49,15 @@
45 49 }
46 50
47 51 public function bulk_delete($posts_selected)
48 52 {
53 + // Check _wpnonce
54 + check_admin_referer( 'wdk-category-bulk', '_wpnonce');
55 +
49 56 $this->load->model('category_m');
50 57 foreach($posts_selected as $id)
51 58 {
59 + wdk_access_check('category_m', $id);
52 60 $this->category_m->delete($id);
53 61 }
54 62
55 63 wp_redirect(admin_url("admin.php?page=wdk_category&is_updated=true&custom_message=".urlencode(esc_html__('Selected Categories removed', 'wpdirectorykit'))));
@@ -59,9 +67,9 @@
59 67 public function edit()
60 68 {
61 69 $this->load->model('category_m');
62 70
63 - $id = $this->input->post_get('id');
71 + $id = (int) $this->input->post_get('id');
64 72 wdk_access_check('category_m', $id);
65 73 $this->data['db_data'] = NULL;
66 74
67 75 $this->data['form'] = &$this->form;
@@ -110,20 +118,28 @@
110 118 'field' => 'category_color',
111 119 'label' => __('Color', 'wpdirectorykit'),
112 120 'rules' => ''
113 121 ),
122 + array(
123 + 'field' => 'titles_for_search',
124 + 'label' => __('Alternative titles for search', 'wpdirectorykit'),
125 + 'rules' => ''
126 + ),
114 127 );
115 128
116 129 if($this->form->run($rules))
117 130 {
131 + // Check _wpnonce
132 + check_admin_referer( 'wdk-category-edit_'.$id, '_wpnonce' );
133 +
118 134 // Save procedure for basic data
119 - $data = $this->category_m->prepare_data($this->input->post(), $rules);
135 + $data = $this->category_m->prepare_data(wdk_get_post(), $rules);
120 136
121 137 if(empty($id) && strpos($data['category_title'], ',') !== FALSE) {
122 138
123 139 foreach (explode(',', $data['category_title']) as $title) {
124 140 // Save standard wp post
125 - $insert_id = $this->category_m->insert(array_merge($data, array('category_title' => $title)), NULL);
141 + $insert_id = $this->category_m->insert(array_merge($data, array('category_title' => trim($title))), NULL);
126 142 }
127 143 wp_redirect(admin_url("admin.php?page=wdk_category&is_updated=true&custom_message=".urlencode(esc_html__('Bulk Categories added', 'wpdirectorykit'))));
128 144 exit;
129 145 } else {