public function __construct()
 {
     parent::__construct();
     ci()->load->model(['dropdown_models/dropdown_parent_model', 'dropdown_models/dropdown_item_model']);
     $this->dropdown_parent_model =& ci()->dropdown_parent_model;
     $this->dropdown_item_model =& ci()->dropdown_item_model;
 }
 public function __construct()
 {
     parent::__construct();
     if (setting('email-templates.required') == 'plain') {
         $this->rules['plain']['rules'] = 'required|' . $this->rules['plain']['rules'];
     }
     if (setting('email-templates.required') == 'html') {
         $this->rules['html']['rules'] = 'required|' . $this->rules['html']['rules'];
     }
     if (setting('email-templates.required') == 'plain & html') {
         $this->rules['plain']['rules'] = 'required|' . $this->rules['plain']['rules'];
         $this->rules['html']['rules'] = 'required|' . $this->rules['html']['rules'];
     }
     /* listen for update or insert and switch up the date/times */
     ci()->event->register('database.addon_email_templates.before.update', function (&$method, &$primary_value, &$data, &$skip_validation) {
         if (!empty($data['active_from']) || !empty($data['active_to'])) {
             $data['active_from'] = date('Y-m-d H:i:s', strtotime($data['active_from']));
             $data['active_to'] = date('Y-m-d H:i:s', strtotime($data['active_to']));
         }
     });
     ci()->event->register('database.addon_email_templates.before.insert', function (&$method, &$primary_value, &$data, &$skip_validation) {
         if (!empty($data['active_from']) || !empty($data['active_to'])) {
             $data['active_from'] = date('Y-m-d H:i:s', strtotime($data['active_from']));
             $data['active_to'] = date('Y-m-d H:i:s', strtotime($data['active_to']));
         }
     });
 }
 public function __construct()
 {
     parent::__construct();
     ci()->validate->attach('must_be_1', function ($field_data, $field, $param, $validate_obj) {
         $validate_obj->set_message('must_be_1', 'The Trigger time format is not valid.');
         return (int) $field_data['trigger_valid'] == 1;
     });
 }
 public function insert($data, $skip_validation = false)
 {
     $key = $this->config->item('encryption_key');
     $data['created_on'] = date('Y-m-d H:i:s');
     $data['register_key'] = substr(md5(rand() . microtime() . $key) . md5($key . microtime() . rand()), 3, 47);
     $data['timeout'] = date('Y-m-d H:i:s', strtotime('+' . setting('Register.Email Activation Expire') . ' minutes'));
     parent::insert($data, 'insert');
     return $data['register_key'];
 }
 public function __construct()
 {
     parent::__construct();
     /* used to flatten out the multi select array */
     ci()->validate->attach('category_join', function (&$_field_data, &$field, &$param, &$validation) {
         if (is_array($field)) {
             $field = ' ' . implode(' ', $field) . ' ';
         }
     });
 }
Exemple #6
0
 public function update($primary_value, $data, $skip_validation = false)
 {
     $this->flush_caches();
     /* return FALSE on failure data validated & filtered */
     $data = $this->validate($data, $skip_validation);
     $groups = $data['access'];
     if ($data !== FALSE) {
         unset($data['access']);
         /* passed by ref */
         parent::protect_attributes($data);
         $result = $this->_database->where($this->primary_key, $primary_value)->set($data)->update($this->table);
         $this->log_last_query();
         /* ok now update the groups - if any */
         $this->o_role_access_model->save($primary_value, $groups);
         return $result;
     }
     return FALSE;
 }
 public function __construct()
 {
     parent::__construct();
     ci()->validate->attach('save_as_file', function (&$_field_data, &$field, &$param, $validate) {
         $folder = __DIR__ . '/../saved';
         if ($_field_data['is_file'] == 1) {
             if (is_writable(__DIR__ . '/..')) {
                 @mkdir($folder, 0777);
                 file_put_contents($folder . '/' . $_field_data['name'] . '.tmpl', $field);
             }
         } else {
             @unlink($folder . '/' . $_field_data['name'] . '.tmpl');
         }
     });
     ci()->event->register('database.cms_templates.after.get', function (&$method, &$result) {
         $filename = __DIR__ . '/../saved/' . $result->name . '.tmpl';
         if ($result->is_file && file_exists($filename)) {
             $result->content = file_get_contents($filename);
         }
     });
 }
Exemple #8
0
 public function delete($id = null)
 {
     $this->update($id, ['is_active' => 0], true);
     /* soft delete */
     return parent::delete($id);
 }
 public function delete($id = null)
 {
     $this->o_role_access_model->delete_by_access_id($id);
     return parent::delete($id);
 }
 public function update($primary_value, $data, $skip_validation = false)
 {
     $return = parent::update($primary_value, $data, $skip_validation);
     $this->recalculate_urls();
     return $return;
 }
 public function update($primary_value, $data, $skip_validation = false)
 {
     $data['match'] = str_replace('/redirect/', '', $data['match']);
     $data['url'] = ltrim($data['url'], '/');
     return parent::update($primary_value, $data, $skip_validation);
 }