| @@ -3,13 +3,20 @@ | ||
| 3 | 3 | |
| 4 | 4 | class Wdk_fields extends Winter_MVC_Controller { |
| 5 | 5 | |
| 6 | 6 | public function __construct(){ |
| 7 | + | |
| 8 | + if ( ! current_user_can('administrator') ) { | |
| 9 | + wp_die( esc_html__('You do not have sufficient permissions to access this page.','wpdirectorykit') ); | |
| 10 | + } | |
| 11 | + | |
| 7 | 12 | parent::__construct(); |
| 8 | 13 | } |
| 9 | 14 | |
| 10 | 15 | public function index() |
| 11 | 16 | { |
| 17 | + | |
| 18 | + | |
| 12 | 19 | $this->load->model('field_m'); |
| 13 | 20 | |
| 14 | 21 | $this->data['fields'] = $this->field_m->get(); |
| 15 | 22 | |
| @@ -207,14 +214,14 @@ | ||
| 207 | 214 | foreach( $this->data['fields_tree'] as $key_section => $section) |
| 208 | 215 | { |
| 209 | 216 | if(empty($key_section)) continue; |
| 210 | 217 | |
| 211 | - $values[] = array('order_index' => $order_index, 'idfield' => $key_section); | |
| 218 | + $values[] = array('order_index' => $order_index, 'idfield' => (int) $key_section); | |
| 212 | 219 | $order_index++; |
| 213 | 220 | if(is_array($section)) |
| 214 | 221 | foreach($section as $key_field => $field) |
| 215 | 222 | { |
| 216 | - $values[] = array('order_index' => $order_index, 'idfield' => $key_field); | |
| 223 | + $values[] = array('order_index' => $order_index, 'idfield' => (int) $key_field); | |
| 217 | 224 | $order_index++; |
| 218 | 225 | } |
| 219 | 226 | } |
| 220 | 227 | $this->db->updateBatch( $this->field_m->_table_name, $values, 'idfield'); |