/** * Insert * * @access public * @param array $input * @return mixed */ public function insert($input = array()) { return parent::insert(array( 'name' => $input['name'], 'data' => $input['data'] )); }
function insert($data) { if (empty($data['agency_id'])) { $data['agency_id'] = rand(0, 99999); } return parent::insert($data); }
public function add($type = '', $data = array()) { // Attempt to get description text for this type of event $description = $this->_get_description($type, $data); // Data to insert into database for this entry $entry = array('al_pct_id' => 0, 'al_u_id' => $this->session->userdata('u_id'), 'al_type' => $type, 'al_area' => element('area', $data), 'al_uri' => $this->uri->uri_string(), 'al_description' => $description, 'al_datetime' => date('Y-m-d H:i:s'), 'al_ua' => $this->agent->agent_string(), 'al_browser' => $this->agent->browser() . ' ' . $this->agent->version(), 'al_ip' => $this->input->ip_address()); return parent::insert($entry); }
/** * Insert a new gallery into the database * * @author PyroCMS Dev Team * @access public * @param array $input The data to insert (a copy of $_POST) * @return bool */ public function insert_gallery($input, $skip_validation = false) { if (is_array($input['folder_id'])) { $folder = $input['folder_id']; $input['folder_id'] = $this->file_folders_m->insert(array('name' => $folder['name'], 'parent_id' => 0, 'slug' => $folder['slug'], 'date_added' => now())); } return (int) parent::insert(array('title' => $input['title'], 'slug' => $input['slug'], 'folder_id' => $input['folder_id'], 'thumbnail_id' => !empty($input['gallery_thumbnail']) ? (int) $input['gallery_thumbnail'] : NULL, 'description' => $input['description'], 'enable_comments' => $input['enable_comments'], 'published' => $input['published'], 'updated_on' => time(), 'css' => $input['css'], 'js' => $input['js'])); }
/** * Insert new media */ public function insert($path) { if (!file_exists($path)) { return false; } $res = \Cloudinary\Uploader::upload($path); $this->public_id = $res['public_id']; return parent::insert(); }
/** * Prepare the text fields and save them * * @param int $id * @return bool|int */ public function save($data = '') { if (!empty($data[$this->pkey])) { $this->delete($data[$this->pkey]); } $data['full'] = prepare_text($data['original']); $data['short'] = mb_strcut($data['full'], 0, 250); // @todo: 250 should be in CONFIG return parent::insert($data); }
/** * Insert a new category into the database via ajax * @access public * @param array $input The data to insert * @return int */ public function insert_ajax($input = array()) { $this->load->helper('text'); return parent::insert(array( 'title'=>$input['title'], //is something wrong with convert_accented_characters? //'slug'=>url_title(strtolower(convert_accented_characters($input['title']))) 'slug' => url_title(strtolower($input['title'])) )); }
/** * Update resource details * * @access public * @param int $resource_id * @param array $attributes * @return void */ function update($resource_id = 0, $attributes = array()) { if ($resource_id > 0 && !$this->get_by_name($attributes['name'], $resource_id)) { // Update return parent::update($resource_id, $attributes); } elseif (!$this->get_by_name($attributes['name'])) { // Insert return parent::insert($attributes); } else { return FALSE; } }
/** * Insert a new gallery into the database * * @author Yorick Peterse - PyroCMS Dev Team * @access public * @param array $input The data to insert (a copy of $_POST) * @return bool */ public function insert_gallery($input) { // Get rid of everything we don't need $to_insert = array('title' => $input['title'], 'slug' => $this->generate_slug($input['title']), 'parent' => !empty($input['parent_id']) ? (int) $input['parent_id'] : 0, 'description' => $input['description'], 'enable_comments' => $input['enable_comments'], 'published' => $input['published'], 'updated_on' => time()); // First we create the directories (so that we can delete them in case something goes wrong) if ($this->create_folders($input['title']) === TRUE) { // Insert the data into the database $insert_id = parent::insert($to_insert); // Everything ok? return $insert_id >= 0; } return FALSE; }
function insert($image = array(), $album_id = '', $description) { $this->load->helper('date'); $filename = $image['file_name']; $image_cfg['image_library'] = 'GD2'; $image_cfg['source_image'] = APPPATH . 'assets/img/photos/' . $album_id . '/' . $filename; $image_cfg['create_thumb'] = TRUE; $image_cfg['maintain_ratio'] = TRUE; $image_cfg['width'] = '150'; $image_cfg['height'] = '125'; $this->load->library('image_lib', $image_cfg); $this->image_lib->resize(); return parent::insert(array('filename' => $filename, 'album_id' => $album_id, 'description' => $description, 'updated_on' => now())); }
/** * Updates (unique) site view. Works by checking * if visitor's IP or user ID is already in the database, * if it's not then inserts a view into the database * @param int $userID User ID * @return object */ public function update_site_views($userID = NULL) { // Set MY_Model table $this->_table = 'site_views'; // Get IP and convert it to int $ip = ip2long($_SERVER['REMOTE_ADDR']); // Set date $date = date('Y-m-d H:i:m'); // Check for unique view if (!$this->has_viewed($ip, $userID)) { $data = array('ip' => $ip, 'user' => $userID, 'date' => $date); parent::insert($data); } }
public function save_activity($uid, $activity_type, $link = null, $descr = null) { $activity = ['user_id' => $uid, 'activity' => $activity_type]; if ($link != null) { $activity['link'] = $link; } if ($descr != null) { $activity['description'] = $descr; } if (parent::insert($activity)) { return true; } else { return false; } }
public function insert($story, $user_id) { $this->form_validation->set_rules('headline', 'Headline', 'trim|required|min_length[3]|max_length[100]|xss_clean'); $this->form_validation->set_rules('story', 'News Content', 'trim|required|xss_clean'); if ($this->form_validation->run()) { $story['user_id'] = $user_id; if ($id = parent::insert($story)) { return isset($id) ? $id : true; } else { return false; } } else { return false; } }
function add($input = array()) { $this->load->helper('date'); return parent::insert(array( 'email' => $input->email, 'password' => $input->password, 'salt' => $input->salt, 'first_name' => ucwords(strtolower($input->first_name)), 'last_name' => ucwords(strtolower($input->last_name)), 'role' => empty($input->role) ? 'user' : $input->role, 'is_active' => 0, 'lang' => $this->config->item('default_language'), 'activation_code' => $input->activation_code, 'created_on' => now(), 'last_login' => now(), 'ip' => $this->input->ip_address() )); }
public function insert($data=array()) { list($password, $salt) = $this->hash_password($data['password']); unset($data['password'], $data['pass_confirm'], $data['submit']); $data['password_hash'] = $password; $data['salt'] = $salt; $data['zipcode'] = isset($data['zipcode']) ? (int)$data['zipcode'] : null; $data['zip_extra'] = isset($data['zip_extra']) ? (int)$data['zip_extra'] : null; // What's the default role? if (!isset($data['role_id'])) { $data['role_id'] = $this->role_model->default_role_id(); } return parent::insert($data); }
/** * Insert a new gallery into the database * * @author Yorick Peterse - PyroCMS Dev Team * @access public * @param array $input The data to insert (a copy of $_POST) * @return bool */ public function insert_gallery($input) { // Get rid of everything we don't need $to_insert = array('title' => $input['title'], 'slug' => $this->generate_slug($input['title']), 'description' => $input['description'], 'enable_comments' => $input['enable_comments'], 'published' => $input['published'], 'updated_on' => time()); // Determine the gallery parent if ($input['parent'] !== 'NONE') { $to_insert['parent'] = $input['parent']; } // First we create the directories (so that we can delete them in case something goes wrong) if ($this->create_folders($input['title']) === TRUE) { // Insert the data into the database $insert_id = parent::insert($to_insert); // Everything ok? if ($insert_id >= 0) { return TRUE; } else { return FALSE; } } else { return FALSE; } }
/** * Add a group * * * @param array $input The data to insert * @return array */ public function insert($input = array(), $skip_validation = false) { return parent::insert(array('name' => $input['name'], 'description' => $input['description'])); }
public function insert($data = array()) { if (parent::insert($data)) { $id_places = $this->db->insert_id(); return $id_places; } return FALSE; }
function insert($input = array()) { $input['signup_date'] = date('Y-m-d H:i:s'); return parent::insert($input); }
/** * Upload an image to the server and add it to the DB * * @author Yorick Peterse - PyroCMS Dev Team * @access public * @param array $input The data sent by the form * @return bool */ public function upload_image($input) { // Get the name of the gallery we're uploading the image to $gallery = $this->db->select('slug')->from('galleries')->where('id', $input['gallery_id'])->get()->row(); $gallery_slug = $gallery->slug; // First we need to upload the image to the server $upload_conf['upload_path'] = 'uploads/galleries/' . $gallery_slug . '/full'; $upload_conf['allowed_types'] = $this->config->item('image_allowed_filetypes'); $this->upload->initialize($upload_conf); // Let's see if we can upload the file if ($this->upload->do_upload()) { $uploaded_data = $this->upload->data(); // Set the data for creating a thumbnail $source = 'uploads/galleries/' . $gallery_slug . '/full/' . $uploaded_data['file_name']; $destination = 'uploads/galleries/' . $gallery_slug . '/thumbs'; $options = array(); // Is the current size larger? If so, resize to a width/height of X pixels (determined by the config file) if ($uploaded_data['image_width'] > $this->config->item('image_thumb_width')) { $options['width'] = $this->config->item('image_thumb_width'); } if ($uploaded_data['image_height'] > $this->config->item('image_thumb_height')) { $options['height'] = $this->config->item('image_thumb_height'); } // Great, time to create a thumbnail if ($this->resize('resize', $source, $destination, $options) === TRUE) { // Image has been uploaded, thumbnail has been created, time to add it to the DB! $to_insert['gallery_id'] = $input['gallery_id']; $to_insert['filename'] = $uploaded_data['raw_name']; $to_insert['extension'] = $uploaded_data['file_ext']; $to_insert['title'] = $input['title']; $to_insert['description'] = $input['description']; $to_insert['uploaded_on'] = time(); $to_insert['updated_on'] = time(); // Insert it if (is_int(parent::insert($to_insert))) { return TRUE; } else { return FALSE; } } } }
/** * Insert a new comment * * @access public * @param array $input The data to insert * @return void */ public function insert($input) { $this->load->helper('date'); return parent::insert(array('user_id' => isset($input['user_id']) ? $input['user_id'] : 0, 'is_active' => !empty($input['is_active']) ? 1 : 0, 'name' => isset($input['name']) ? ucwords(strtolower(strip_tags($input['name']))) : '', 'email' => isset($input['email']) ? strtolower($input['email']) : '', 'website' => isset($input['website']) ? prep_url(strip_tags($input['website'])) : '', 'comment' => htmlspecialchars($input['comment'], NULL, FALSE), 'parsed' => parse_markdown(htmlspecialchars($input['comment'], NULL, FALSE)), 'module' => $input['module'], 'module_id' => $input['module_id'], 'created_on' => now(), 'ip_address' => $this->input->ip_address())); }
function insert($input = array()) { $this->load->helper('date'); $input['updated_on'] = now(); return parent::insert($input); }
/** * Insert a new comment * * @access public * @param array $input The data to insert * @return void */ public function insert($input) { $this->load->helper('date'); return parent::insert(array('user_id' => isset($input['user_id']) ? $input['user_id'] : 0, 'is_active' => isset($input['is_active']) ? $input['is_active'] : 0, 'name' => isset($input['name']) ? ucwords(strtolower($input['name'])) : '', 'email' => isset($input['email']) ? strtolower($input['email']) : '', 'website' => isset($input['website']) ? prep_url($input['website']) : '', 'comment' => strip_tags($input['comment']), 'module' => $input['module'], 'module_id' => $input['module_id'], 'created_on' => now(), 'ip_address' => $this->input->ip_address())); }
function insert_attendance($array) { $error = parent::insert($array); return TRUE; }
/** * Insert a new category into the database via ajax * * @param array $input The data to insert * * @return int */ public function insert_ajax($input = array()) { return parent::insert(array('title' => $input['title'], 'slug' => url_title(strtolower($input['title'])))); }
/** * Inserts the current user on database. * * @return boolean */ public function insert() { if ($this->email_exists($this->email)) { return false; } $this->dateadd = gmdate("Y-m-d H:i:s"); $this->dateupdate = gmdate("Y-m-d H:i:s"); $res = parent::insert(); return $res; }
function insert_automation_rec($array) { $error = parent::insert($array); return TRUE; }
/** * Insert a new comment * * @param array $input The data to insert * @return bool */ public function insert($input, $skip_validation = false) { return parent::insert(array('user_id' => isset($input['user_id']) ? $input['user_id'] : 0, 'user_name' => isset($input['user_name']) && !isset($input['user_id']) ? ucwords(strtolower(strip_tags($input['user_name']))) : '', 'user_email' => isset($input['user_email']) && !isset($input['user_id']) ? strtolower($input['user_email']) : '', 'user_website' => isset($input['user_website']) ? prep_url(strip_tags($input['user_website'])) : '', 'is_active' => !empty($input['is_active']), 'comment' => htmlspecialchars($input['comment'], null, false), 'parsed' => parse_markdown(htmlspecialchars($input['comment'], null, false)), 'module' => $input['module'], 'entry_id' => $input['entry_id'], 'entry_title' => $input['entry_title'], 'entry_key' => $input['entry_key'], 'entry_plural' => $input['entry_plural'], 'uri' => !empty($input['uri']) ? $input['uri'] : null, 'cp_uri' => !empty($input['cp_uri']) ? $input['cp_uri'] : null, 'created_on' => now(), 'ip_address' => $this->input->ip_address())); }
function insert_alert($array) { $error = parent::insert($array); return TRUE; }
function insert_reply_msg($array) { $error = parent::insert($array); return TRUE; }