403Webshell
Server IP : 127.0.0.1  /  Your IP : 192.168.99.1
Web Server : Apache/2.4.35 (Win64) OpenSSL/1.1.1b mod_fcgid/2.3.9
System : Windows NT WIN-JEJMB9EN0L0 10.0 build 14393 (Windows Server 2016) AMD64
User : Administrator ( 0)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /wamp/www/sipkd_2016/application/core/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /wamp/www/sipkd_2016/application/core/Base_Model.php
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/*********************************************************************************************
  SUPER CLASS dari semua Model
 *********************************************************************************************/
class Base_Model extends Core_Model{

  var $fieldmap_daftar; // variabel untuk menampung kolom-kolom yang ditampilkan di daftar
  var $fieldmap_filter; // variabel untuk menampung mapping kolom-kolom yang digunakan dalam filter
  var $id; // variabel untuk menampung primary key
  var $last_error_id;
  var $last_error_message;

  function __construct()
  {
    parent::__construct();
  }

  // mengembalikan daftar kolom yang bisa dilakukan pencarian
  function get_data_fields()
  {

  }

  function fill_data()
  {

  }

  protected function get_id($generator)
  {
    $result = $this->db->query('select gen_id('.$generator.', 1) id from rdb$database')->row_array();
    return $result['ID'];
  }

  function check_trans_status($exception)
  {
    if ($this->db->trans_status() === FALSE) {
      throw new Exception($exception);
    }
  }

  function save_data()
  {
    $this->db->trans_begin();
    try {
      $this->save_detail();
    }
    catch(Exception $e){
      //TODO : log error to file
    }

    if ($this->db->trans_status() === FALSE)
    {
      $this->id = NULL;
      $this->last_error_id = $this->db->_error_number();
      $this->last_error_message = $this->db->_error_message();
      $this->db->trans_rollback();
      return FALSE;
    }

    $this->db->trans_commit();
    return TRUE;
  }

  function delete_data($id)
  {
    $this->db->trans_begin();
    try {
      $this->build_query_hapus($id);
    }
    catch(Exception $e){
      //TODO : log error to file
    }

    if ($this->db->trans_status() === FALSE)
    {
      $this->last_error_id = $this->db->_error_number();
      $this->last_error_message = $this->db->_error_message();
      $this->db->trans_rollback();
      return FALSE;
    }

    $this->db->trans_commit();
    return TRUE;
  }

  function build_query_daftar()
  {
    // di override di modul Aktivitas
  }

  function build_query_form($id=0)
  {
    // di override di modul Aktivitas
  }

  function build_query_hapus()
  {
    // di override di modul Aktivitas
  }

  function get_data($param, $isCount=FALSE, $CompileOnly=False)
  {
    $this->build_query_daftar();

    isset($param['limit']) && $param['limit'] ? $this->db->limit($param['limit']['end'], $param['limit']['start']) : '';

    // proses parameter pencarian, jika ada
    if (isset($param['search_mode']) && $param['search_mode'] !=='' )
    {
      // proses pencarian singkat (simple search)
      if ($param['search_mode'] == 'ss')
      {
        foreach($this->fieldmap_filter as $key => $value){
          $flt[$key] = array('search_str' => $param['q'], 'search_op' => 'cn');
        }
        if (count($flt) > 0)
        {
          $swhere = get_where_str($flt, $this->fieldmap_filter);
          if ($swhere) {
            $swhere = build_or_where($swhere);
            $this->db->where($swhere);
          }
        }
      }
      // proses pencarian lanjut (advanced search)
      else if ($param['search_mode'] == 'as') {
        $fields = $this->get_data_fields();
        if (is_array($param['q']) && count($param['q']) > 0)
        {
            foreach ($param['q'] as $key=>$val) {
            $kolom = $val['c'];
            $search_str = isset($val['s']) ? $val['s'] : '';
            $search_str2 = isset($val['s2']) ? $val['s2'] : '';

            $flt[$kolom] = array(
                'search_str' => $search_str,
                'search_str2' => $search_str2,
                'search_op' => $val['o'],
                'search_datatype' => $fields[$kolom]['kategori'],
            );
          }
          if (count($flt) > 0)
          {
            $wh = get_where_str($flt, $this->fieldmap_filter);

            $this->db->where($wh);
          }
        }
      }
    }

    // proses jika ada pengurutan
    if (isset($param['sort_by']) && $param['sort_by'] != null && !$isCount && $ob = get_order_by_str($param['sort_by'], $this->fieldmap_filter))
    {
      $this->db->order_by($ob, $param['sort_direction']);
    }

    if ($isCount) {
      $result = $this->db->count_all_results();
      return $result;
    }
    else
    {
      if ($CompileOnly)
      {
        return $this->db->get_compiled_select();
      }
      else
      {
        $result = $this->db->get();
        return $result->result_array();
      }
    }
  }

  function get_data_by_id($id)
  {
    $this->build_query_form($id);
    $result = $this->db->get()->row_array();

    return $result;
  }

  function check_dependency($id)
  {
    return TRUE;
  }
}

Youez - 2016 - github.com/yon3zu
LinuXploit