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/sipkd_2016/application/helpers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

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

if  (  !  function_exists('get_title'))
{
  function  get_title($modul_name  =  '')
  {
    $title  =  APP_NAME;
    if  ($modul_name)  $title  .=  '  -  '.$modul_name;
    return  $title;
  }
}

if  (  !  function_exists('get_footer'))
{
  function  get_footer()
  {
    $footer  =  APP_FRAMEWORK." - ".APP_FULL_NAME;
    return  $footer;
  }
}

if  (  !  function_exists('get_logo'))
{
  function  get_logo()
  {
    $logo_file = LOCAL_APP_DIR.'/'.APP_LOGO_PATH;

    if (file_exists( $logo_file ))
    {
      return base_url().APP_LOGO_PATH;
    }

    $ci =& get_instance();
    $ci->load->database();
    $logo = $ci->db->select('logo')->where('logo is not null')->get('pemda')->row_array();
    if ( $logo ) {
      $logo_blob = $ci->db->get_blob( $logo['LOGO']);

      try {
        file_put_contents($logo_file, $logo_blob);
        return base_url().APP_LOGO_PATH;
      }
      catch(Exception $e) {
        return base_url().APP_NO_IMAGE_PATH;
      }
    }
    else return  base_url().APP_NO_IMAGE_PATH;
  }
}

if  (  !  function_exists('get_copyright'))
{
  function  get_copyright()
  {
    $footer  =  APP_COMPANY."@".date('Y');
    return  $footer;
  }
}

if  (  !  function_exists('get_ip_address'))
{
  function get_ip_address() {
    $ipaddress = '';
    if (getenv('HTTP_CLIENT_IP'))
      $ipaddress = getenv('HTTP_CLIENT_IP');
    else if(getenv('HTTP_X_FORWARDED_FOR'))
      $ipaddress = getenv('HTTP_X_FORWARDED_FOR');
    else if(getenv('HTTP_X_FORWARDED'))
      $ipaddress = getenv('HTTP_X_FORWARDED');
    else if(getenv('HTTP_FORWARDED_FOR'))
      $ipaddress = getenv('HTTP_FORWARDED_FOR');
    else if(getenv('HTTP_FORWARDED'))
      $ipaddress = getenv('HTTP_FORWARDED');
    else if(getenv('REMOTE_ADDR'))
      $ipaddress = getenv('REMOTE_ADDR');
    else
      $ipaddress = 'UNKNOWN';

    return $ipaddress;
  }
}

if  (  !  function_exists('get_pengumuman'))
{
  function  get_pengumuman()
  {
    $ci =& get_instance();
    $ci->load->database();
    $id = $ci->db->query("
        select a.pengumuman_aktif, a.pengumuman_tanggal_awal, a.pengumuman_tanggal_akhir, a.pengumuman_isi
        from pengumuman a
        where a.appid = '".$ci->app_id."'
          and a.tahun = '".$ci->tahun."'
          and a.status = '".$ci->status."'
    ")->row_array();
    return $id;
  }
}

if  (  !  function_exists('simpan_logaktivitas'))
{
  function  simpan_logaktivitas($user, $modul, $kode_skpd, $kode_kegiatan, $aksi,$keterangan)
  {
    $ci =& get_instance();
    $ci->load->database();

    date_default_timezone_set('Asia/Jakarta');
    $waktu   = date('d.m.Y.H.i.s');

    $data = array(
        'USERNAME' => $user,
        'MODUL' => $modul,
        'KODE_SKPD' => $kode_skpd,
        'KODE_KEGIATAN' => $kode_kegiatan,
        'AKSI' => $aksi,
        'KETERANGAN' => $keterangan,
        'WAKTU' => $waktu,
        'APP_ID' => $ci->app_id
      );
    $ci->db->insert('LOGAKTIVITAS', $data);
  }
}

if  (  ! function_exists('get_report'))
{
  function  get_report($fr_tiga)
  {
    $ci =& get_instance();
    $custom = isset($ci->app_config['custom']) ? $ci->app_config['custom'] : '';

    if($custom !== ''){
      if (file_exists(FCPATH.'assets/fr/fr3/Custom/'.$custom.'/'.$fr_tiga))
      {
        $report = 'Custom\\'.$custom.'\\'.$fr_tiga;
      }
      else{
        $report = $fr_tiga;
      }
    }
    else $report = $fr_tiga;

    return  $report;
  }
}

if ( ! function_exists('bulan_list'))
{
  function bulan_list($kosong = 0)
  {
    $CI =& get_instance();
    $CI->lang->load('calendar');

    if($kosong) $result[0] = 'Semua bulan';
    $result['01'] = $CI->lang->line('cal_january');
    $result['02'] = $CI->lang->line('cal_february');
    $result['03'] = $CI->lang->line('cal_march');
    $result['04'] = $CI->lang->line('cal_april');
    $result['05'] = $CI->lang->line('cal_may');
    $result['06'] = $CI->lang->line('cal_june');
    $result['07'] = $CI->lang->line('cal_july');
    $result['08'] = $CI->lang->line('cal_august');
    $result['09'] = $CI->lang->line('cal_september');
    $result['10'] = $CI->lang->line('cal_october');
    $result['11'] = $CI->lang->line('cal_november');
    $result['12'] = $CI->lang->line('cal_december');

    return $result;
  }
}

if ( ! function_exists('bln_list'))
{
  function bln_list($kosong = 0)
  {
    $CI =& get_instance();
    $CI->lang->load('calendar');

    if($kosong) $result[0] = 'Semua bulan';
    $result['01'] = $CI->lang->line('cal_jan');
    $result['02'] = $CI->lang->line('cal_feb');
    $result['03'] = $CI->lang->line('cal_mar');
    $result['04'] = $CI->lang->line('cal_apr');
    $result['05'] = $CI->lang->line('cal_may');
    $result['06'] = $CI->lang->line('cal_jun');
    $result['07'] = $CI->lang->line('cal_jul');
    $result['08'] = $CI->lang->line('cal_aug');
    $result['09'] = $CI->lang->line('cal_sep');
    $result['10'] = $CI->lang->line('cal_oct');
    $result['11'] = $CI->lang->line('cal_nov');
    $result['12'] = $CI->lang->line('cal_dec');

    return $result;
  }
}

if ( ! function_exists('nama_bulan'))
{
  function nama_bulan($bulan)
  {
    $array_bulan = bulan_list();
    if(strlen($bulan) == 1) $bulan = '0'.$bulan;
    return $array_bulan[$bulan];
  }
}

if ( ! function_exists('nama_bln'))
{
  function nama_bln($bulan)
  {
    $array_bulan = bln_list();
    if(strlen($bulan) == 1) $bulan = '0'.$bulan;
    return $array_bulan[$bulan];
  }
}

if ( ! function_exists('to_rupiah'))
{
  function to_rupiah($value)
  {
    if($value < 0)
    {
      return '( Rp '.number_format(abs($value), 0, ',', '.').' )';
    }
    else
    {
      return 'Rp '.number_format($value, 0, ',', '.').'  ';
    }
  }
}

if ( ! function_exists('format_rupiah'))
{
  function format_rupiah($value)
  {
    if($value < 0)
    {
      return '( '.number_format(abs($value), 2, ',', '.').' )';
    }
    else
    {
      return '  '.number_format($value, 2, ',', '.').'  ';
    }
  }
}

if ( ! function_exists('prepare_numeric'))
{
  function prepare_numeric($value, $default = null)
  {
    if(isset($value) && $value != '')
      return floatval(str_replace('.','',$value)) * 1;
    return $default;
  }
}

if ( ! function_exists('format_date'))
{
  function format_date($date, $style='d/m/Y')
  {
    if (isset($date))
      return date($style, strtotime( $date ) );
    return '';
  }
}

if ( ! function_exists('prepare_date'))
{
  function prepare_date($date)
  {
    if (isset($date) && $date != '')
      return implode( "-", array_reverse( explode("/", $date ) ) );
    return null;
  }
}

if ( ! function_exists('get_where_str'))
{
  function get_where_str($param, $fieldmap)
  {
    $wh = array();
    foreach($param as $key => $value){
      if (array_key_exists($key, $fieldmap))
      {
        $fld = "";
        $datatype = isset($value['search_datatype']) ? $value['search_datatype'] : null;
        $op = $value['search_op'];
        if ($datatype === 'date')
        {
          $fld = $fieldmap[ $key ];
          $str = isset($value['search_str']) ? strtoupper(prepare_date($value['search_str'])) : null;
          $str2 = isset($value['search_str2']) ? strtoupper(prepare_date($value['search_str2'])) : null;
        }
        else
        {
          if ($op === 'blank' || $op === 'nblank') $fld = "COALESCE(".$fieldmap[ $key ].", '')";
          else $fld = "UPPER(".$fieldmap[ $key ].")";
          $str = isset($value['search_str']) ? strtoupper($value['search_str']) : '';
          $str2 = isset($value['search_str2']) ? strtoupper($value['search_str2']) : '';
        }

        if ($datatype === 'numeric')
        {
          switch($op)
          {
            case "eq" : $fld .= " = "; $str = $str; $wh[ $fld ] = (double)$str; break;
            case "ne" : $fld .= " != "; $str = $str; $wh[ $fld ] = (double)$str; break;
            case "lt" : $fld .= " < "; $str = $str; $wh[ $fld ] = (double)$str; break;
            case "le" : $fld .= " <= "; $str = $str; $wh[ $fld ] = (double)$str; break;
            case "gt" : $fld .= " > "; $str = $str; $wh[ $fld ] = (double)$str; break;
            case "ge" : $fld .= " <= "; $str = $str; $wh[ $fld ] = (double)$str; break;
            case "in" : $fld .= " >= "; $fld1 = $fieldmap[ $key ]." <= "; $wh[ $fld ] = (double)$str; $wh[ $fld1 ] = (double)$str2; break;
            default : ;
          }
        }
        else if ($datatype === 'time')
            {
              switch($op)
              {
                case "cn" : $fld .= " LIKE "; $str = "%".$str."%"; $wh[ $fld ] = $str; break;
                case "ne" : $fld .= " != "; $str = $str; $wh[ $fld ] = $str; break;
                case "lt" : $fld .= " < "; $str = $str; $wh[ $fld ] = $str; break;
                case "le" : $fld .= " <= "; $str = $str; $wh[ $fld ] = $str; break;
                case "gt" : $fld .= " > "; $str = $str; $wh[ $fld ] = $str; break;
                case "ge" : $fld .= " <= "; $str = $str; $wh[ $fld ] = $str; break;
                case "in" : $fld .= " >= "; $fld1 = $fieldmap[ $key ]." <= "; $wh[ $fld ] = $str; $wh[ $fld1 ] = $str2; break;
                default : ;
              }
        }
        else if ($datatype === 'date')
        {
          switch($op)
          {
            case "eq" : $fld .= " = "; $str = $str; $wh[ $fld ] = $str; break;
            case "ne" : $fld .= " != "; $str = $str; $wh[ $fld ] = $str; break;
            case "lt" : $fld .= " < "; $str = $str; $wh[ $fld ] = $str; break;
            case "le" : $fld .= " <= "; $str = $str; $wh[ $fld ] = $str; break;
            case "gt" : $fld .= " > "; $str = $str; $wh[ $fld ] = $str; break;
            case "ge" : $fld .= " <= "; $str = $str; $wh[ $fld ] = $str; break;
            case "in" : $fld .= " >= "; $fld1 = $fieldmap[ $key ]." <= "; $wh[ $fld ] = $str; $wh[ $fld1 ] = $str2; break;
            default : ;
          }
        }
        else
        {
          switch($op)
          {
            case "eq" : $fld .= " = "; $str = $str; $wh[ $fld ] = $str;  break;
            case "ne" : $fld .= " != "; $str = $str; $wh[ $fld ] = $str; break;
            case "lt" : $fld .= " < "; $str = $str; $wh[ $fld ] = $str; break;
            case "le" : $fld .= " <= "; $str = $str; $wh[ $fld ] = $str; break;
            case "gt" : $fld .= " > "; $str = $str; $wh[ $fld ] = $str; break;
            case "ge" : $fld .= " <= "; $str = $str; $wh[ $fld ] = $str; break;
            case "bw" : $fld .= " LIKE "; $str = $str."%"; $wh[ $fld ] = $str; break;
            case "bn" : $fld .= " NOT LIKE "; $str = $str."%"; $wh[ $fld ] = $str; break;
            case "in" : $fld .= " >= "; $fld1 = "UPPER(".$fieldmap[ $key ].") <= "; $wh[ $fld ] = $str; $wh[ $fld1 ] = $str2; break;
            case "ew" : $fld .= " LIKE "; $str = "%".$str; $wh[ $fld ] = $str; break;
            case "en" : $fld .= " NOT LIKE "; $str = "%".$str; $wh[ $fld ] = $str; break;
            case "cn" : $fld .= " LIKE "; $str = "%".$str."%"; $wh[ $fld ] = $str; break;
            case "nc" : $fld .= " NOT LIKE "; $str = "%".$str."%"; $wh[ $fld ] = $str; break;
            case "nu" : $str = " NULL "; $wh[ $fld ] = $str; break;
            case "nn" : $str = " NOT NULL "; $wh[ $fld ] = $str; break;
            case "blank" : $fld .= " = "; $str = $str; $wh[ $fld ] = $str; break;
            case "nblank" : $fld .= " != "; $str = $str; $wh[ $fld ] = $str; break;
            default : ;
          }
        }
      }
    }
    return $wh;
  }
}

if ( ! function_exists('build_or_where'))
{
  function build_or_where($param)
  {
    $str = '';
    $prefix = ' OR ';
    foreach ($param as $k => $v)
    {
      if ($str !== '') $str .= $prefix;

      $str .= "(".$k." '".$v."')";
    }
    return "(".$str.")";
  }
}

if ( ! function_exists('get_order_by_str'))
{
  function get_order_by_str($param, $fieldmap)
  {
    $ob = '';
    if (array_key_exists($param, $fieldmap))
    {
      $ob = $fieldmap[ $param ];
    }
    return $ob;
  }
}

if  (  !  function_exists('get_db_version'))
{
  function get_db_version()
  {
    $CI =& get_instance();

    $db_version = $CI->session->userdata('db_version');
    if ( !$db_version )
    {
      $result = $CI->db->query("select app_versi from versi where app_id = '". $CI->app_id ."'")->row_array();
      $db_version = $result['APP_VERSI'];
    }

    return $db_version;
  }
  /*{
    $CI =& get_instance();
    $result = $CI->db->query("select app_versi from versi where app_id = '". $CI->app_id ."'")->row_array();

    return $result['APP_VERSI'];
  }*/
}

if  (  !  function_exists('get_app_version'))
{
  function get_app_version()
  {
    $versi = @file_get_contents(LOCAL_VERSION_FILE);

    return $versi;
  }
}

Youez - 2016 - github.com/yon3zu
LinuXploit