Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 27 additions & 10 deletions ci-bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
defined( 'ABSPATH' ) || die( 'No direct script access allowed!' );
$application_folder = OPENSID_APPPATH . '/donjo-app';
$system_path = OPENSID_APPPATH . '/donjo-sys/';
$system_path = OPENSID_APPPATH . '/system/';
if ( ! defined( 'BASEPATH' ) )
define( 'BASEPATH', str_replace( "\\", "/", OPENSID_APPPATH . '/donjo-sys/' ) );
define( 'BASEPATH', str_replace( "\\", "/", OPENSID_APPPATH . '/system/' ) );
if ( ! defined( 'APPPATH' ) ) {
if ( is_dir( $application_folder ) ) {
define( 'APPPATH', $application_folder . '/' );
Expand All @@ -14,8 +14,8 @@
define( 'APPPATH', BASEPATH . $application_folder . '/' );
}
}
include_once OPENSID_APPPATH . '/donjo-sys/core/Common.php';
include_once OPENSID_APPPATH . '/donjo-sys/database/DB.php';
include_once OPENSID_APPPATH . '/system/core/Common.php';
include_once OPENSID_APPPATH . '/system/database/DB.php';
function &opensid_ci_load_database($active_record_override = true) {
$database =& DB( OPENSID_CONNECT, $active_record_override );
return $database;
Expand All @@ -26,12 +26,13 @@ function model() {
}
}
global $SEC, $CFG, $UNI;
include OPENSID_APPPATH . '/donjo-sys/core/Security.php';
include OPENSID_APPPATH . '/donjo-sys/core/Config.php';
include OPENSID_APPPATH . '/donjo-sys/core/Utf8.php';
$SEC =& new CI_Security;
$CFG =& new CI_Config;
$UNI =& new CI_Utf8;
include OPENSID_APPPATH . '/system/core/Security.php';
include OPENSID_APPPATH . '/system/core/Config.php';
include OPENSID_APPPATH . '/system/core/Utf8.php';

$SEC =new CI_Security;
$CFG =new CI_Config;
$UNI =new CI_Utf8;
function hash_pin($pin=""){
$pin = strrev($pin);
$pin = $pin*77;
Expand Down Expand Up @@ -97,3 +98,19 @@ function getBulan($bln){
break;
}
}

/*
* @return - null, kalau tgl_lahir bukan string tanggal
*/
function umur($tgl_lahir)
{
try {
$date = new DateTime($tgl_lahir);
}
catch (Exception $e) {
return null;
}
$now = new DateTime();
$interval = $now->diff($date);
return $interval->y;
}
2 changes: 1 addition & 1 deletion classes/class-ci-model.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class CI_Model {
public function __construct(){
$this->db =& opensid_ci_load_database();
$this->load = new OPENSID___FAKE_LOAD;
include_once OPENSID_APPPATH . '/donjo-sys/core/Input.php';
include_once OPENSID_APPPATH . '/system/core/Input.php';
$this->input = new CI_Input;
}

Expand Down
2 changes: 1 addition & 1 deletion classes/class-opensid.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static function load_ci_model( $ci_model, array $data = array() ) {
$suffix = (strtolower($ci_model) == 'first') ? '_M' : '_Model';
$ci_model = ( !empty($data['__model_class_name__']) ) ? $data['__model_class_name__'] : $ci_model . $suffix;

$lwrci_model = strtolower( $ci_model );
$lwrci_model = ucfirst(strtolower( $ci_model ));
$file = ( !empty($data['__model_class_file__']) ) ? $data['__model_class_file__'] : OPENSID_APPPATH . '/donjo-app/models/' . $lwrci_model . '.php';
require_once $file;
$the_class = new $ci_model();
Expand Down
42 changes: 22 additions & 20 deletions controllers/controller-frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,38 +28,40 @@ function opensid_handle_redirects() {
}
}
}
private static function opensid_shortcode($this, $shortcode, $function = '', $remove_old = false) {
private function opensid_shortcode($shortcode, $function = '', $remove_old = false) {
if ( empty( $function ) )
$function = $shortcode;
$shortcode = 'wpsid_' . $shortcode;
if ( $remove_old )
remove_shortcode( $shortcode );
add_shortcode( $shortcode, array($this, $function) );
add_shortcode( $shortcode, array($this,$function) );
}
public function init_shortcodes() {
self::opensid_shortcode( $this, 'version' );
self::opensid_shortcode( $this, 'data_wilayah' );
self::opensid_shortcode( $this, 'data_pendidikan' );
self::opensid_shortcode( $this, 'data_pekerjaan' );
self::opensid_shortcode( $this, 'data_perkawinan' );
self::opensid_shortcode( $this, 'data_agama' );
self::opensid_shortcode( $this, 'data_jenis_kelamin' );
self::opensid_shortcode( $this, 'data_warga_negara' );
self::opensid_shortcode( $this, 'data_status_penduduk' );
self::opensid_shortcode( $this, 'data_golongan_darah' );
self::opensid_shortcode( $this, 'data_cacat' );
self::opensid_shortcode( $this, 'data_menahun' );
self::opensid_shortcode( $this, 'data_umur' );
self::opensid_shortcode( $this, 'data_pendidikan_sedang_ditempuh' );
self::opensid_shortcode( $this, 'data_cara_kb' );
self::opensid_shortcode( $this, 'data_akta_kelahiran' );
self::opensid_shortcode( $this, 'layanan_mandiri_widget' );
self::opensid_shortcode( $this, 'layanan_mandiri_detail' );
$this->opensid_shortcode('version');
$this->opensid_shortcode( 'data_wilayah' );
$this->opensid_shortcode( 'data_pendidikan' );
$this->opensid_shortcode( 'data_pekerjaan' );
$this->opensid_shortcode( 'data_perkawinan' );
$this->opensid_shortcode( 'data_agama' );
$this->opensid_shortcode( 'data_jenis_kelamin' );
$this->opensid_shortcode( 'data_warga_negara' );
$this->opensid_shortcode( 'data_status_penduduk' );
$this->opensid_shortcode( 'data_golongan_darah' );
$this->opensid_shortcode( 'data_cacat' );
$this->opensid_shortcode( 'data_menahun' );
$this->opensid_shortcode( 'data_umur' );
$this->opensid_shortcode( 'data_pendidikan_sedang_ditempuh' );
$this->opensid_shortcode( 'data_cara_kb' );
$this->opensid_shortcode( 'data_akta_kelahiran' );
$this->opensid_shortcode( 'layanan_mandiri_widget' );
$this->opensid_shortcode( 'layanan_mandiri_detail' );

}
public function version($atts, $content = null) {
$shortcode_atts = shortcode_atts( array(
'type' => 'plain', //default: plain
), $atts );

return OpenSID::load_shortcode( 'version', $shortcode_atts );
}
public function data_wilayah() { return OpenSID::load_shortcode( 'data_wilayah' ); }
Expand Down
3 changes: 2 additions & 1 deletion init.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
error_reporting(E_ALL||E_WARNING);
defined( 'ABSPATH' ) || die( 'No direct script access allowed!' );
define( 'OPENSID_OPTION_KEY', 'wpsid_config' );
if(strpos($_SERVER['HTTP_HOST'], '.demo.siini.com') !== false || strpos($_SERVER['HTTP_HOST'], '.devhost') !== false)
Expand Down Expand Up @@ -42,7 +43,7 @@ function opensid_get_option($key) {
defined( 'OPENSID_HOMEURL' ) or define( 'OPENSID_HOMEURL', opensid_get_option( 'sid_home' ) );
define( 'OPENSID_CONNECT', 'mysqli://' . OPENSID_DB_USER . ':' . OPENSID_DB_PASS . '@' . OPENSID_DB_HOST . '/' . OPENSID_DB_NAME );
function opensid_check_sid_path() {
return is_dir( opensid_get_option( 'sid_path' ) . '/donjo-sys' );
return is_dir( opensid_get_option( 'sid_path' ) . '/system' );
}
function opensid_check_database_connection() {
if ( ! function_exists( 'opensid_ci_load_database' ) )
Expand Down
2 changes: 1 addition & 1 deletion shortcodes/shortcode-data_statistik.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function setup($action, array $data) {
break;
}
ob_start();
if ( $data['statistik'] == null ) {
if ( $data['statistik'] === null ) {
echo 'Anda menggunakan ' . OPENSID_APP_TYPE . ', shortcode ini hanya dapat digunakan bersama OpenSID.';
} else {
echo self::render( $data );
Expand Down
4 changes: 2 additions & 2 deletions shortcodes/shortcode-layanan_mandiri_detail.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ public function __construct() {
public function setup($action, array $data) {
parent::setup($action, $data);
if( isset($_POST['mandiri']) && $_POST['mandiri'] == 'login' )
OpenSID::load_ci_model('first')->siteman();
OpenSID::load_ci_model('First')->siteman();
if( isset($_REQUEST['mandiri']) && $_REQUEST['mandiri'] == 'logoff' )
OpenSID::load_ci_model('first')->logout();
OpenSID::load_ci_model('First')->logout();
if( !self::_is_logged() ) {
echo do_shortcode('[wpsid_layanan_mandiri_widget]');
} else {
Expand Down