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 :  D:/wamp/www/simbada_2019/application/modules/setting/models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : D:/wamp/www/simbada_2019/application/modules/setting/models/setting_model_.php
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Setting_model extends Base_Model {

  var $config_file;
  var $tahun;
  var $status;
  var $ppkd;

  function __construct()
  {
    // Call the Model constructor
    parent::__construct();

    $this->config_file = APPPATH.'config/appconfig.php';
  }

  function fill_data()
  {
    $this->tahun = $this->input->post('tahun') ? $this->input->post('tahun') : 0;
    $this->status = $this->input->post('status') ? $this->input->post('status') : '';
    $this->ppkd = $this->input->post('ppkd') ? $this->input->post('ppkd') : 0;
  }

  function get_setting()
  {
    /* tahun dan status anggaran disimpan di appconfig.php */
    $this->load->config('appconfig');

    /* skpd sebagai ppkd ada di tabel konfigurasi */
    $this->db->select('first 1 a.id_skpd, b.kode_skpd_lkp, b.nama_skpd')
          ->from('skpd a')
          ->join('v_skpd b', 'b.id_skpd = a.id_skpd')
          ->where('a.is_ppkd <>', '0');
    $result = $this->db->get()->row_array();

    return array(
      'tahun' => $this->config->item('tahun'),
      'status' => $this->config->item('status'),
      'ppkd' => isset($result['ID_SKPD']) ? $result['ID_SKPD'] : 0,
      'kd_skpd' => isset($result['KODE_SKPD_LKP']) ? $result['KODE_SKPD_LKP'] : 0,
      'nm_skpd' => isset($result['NAMA_SKPD']) ? $result['NAMA_SKPD'] : 0,
    );
  }

  function save_setting()
  {
    $this->db->trans_begin();
    try {
      // update ppkd skpd
      $this->db->set('is_ppkd', '0')->where('is_ppkd <>',  '0')->update('skpd');
      $this->db->set('is_ppkd', '1')->where('id_skpd', $this->ppkd)->update('skpd');
      $this->check_trans_status('update ppkd skpd failed');

      // update status aktif
      $this->db->set('status_kini', $this->status)->where('tahun', $this->tahun)->update('tahun_anggaran');
      $this->check_trans_status('update status_kini failed');
    }
    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->save_config();

    return TRUE;
  }


  function save_config()
  {
    $config_file = @file_get_contents($this->config_file);

    $config = array(
      'tahun' => $this->tahun,
      'status' => $this->status
    );
    foreach($config as $key => $val)
    {
      $val = '\''.$val.'\'';
      $pattern = '%(config\[\''.$key.'\'\] = )(\'?.*\'?)(;)%';
      $config_file = preg_replace($pattern, '${1}'.$val. '${3}', $config_file );
    }
    $ret = @file_put_contents($this->config_file, $config_file);
    if ( !$ret)
    {
      return FALSE;
    }
    return TRUE;
  }

}

Youez - 2016 - github.com/yon3zu
LinuXploit