From aca2c6fa783871486def4e214bb43290417247d5 Mon Sep 17 00:00:00 2001 From: siayi Date: Thu, 3 May 2018 14:54:19 +0700 Subject: [PATCH 1/5] perbaiki Konfigurasi WPSID Database gagal terhubung dan Folder SID salah --- ci-bootstrap.php | 14 +++++++------- classes/class-ci-model.php | 2 +- init.php | 2 +- readme.txt | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ci-bootstrap.php b/ci-bootstrap.php index 9266d9a..eae67a0 100644 --- a/ci-bootstrap.php +++ b/ci-bootstrap.php @@ -1,9 +1,9 @@ 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; } diff --git a/init.php b/init.php index a08f2cb..c53f5da 100644 --- a/init.php +++ b/init.php @@ -42,7 +42,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' ) ) diff --git a/readme.txt b/readme.txt index 5d730a6..1d565b0 100644 --- a/readme.txt +++ b/readme.txt @@ -28,7 +28,7 @@ If you find this useful, [**please consider donating**](http://www.siini.com/wor Resulted dirs will be: './opensid' './opensid/donjo-app/' - './opensid/donjo-sys/' + './opensid/system/' './opensid/....' './wp-admin' './wp-content' From 73a370797522a24048e9b435ebf8179fa2be801b Mon Sep 17 00:00:00 2001 From: siayi Date: Fri, 11 May 2018 16:42:53 +0700 Subject: [PATCH 2/5] fix utk menyesuaikan dengan OpenSID v2.12 pada commit Ubah nama file models mulai huruf besar https://github.com/OpenSID/OpenSID/commit/0e7246d393fe08cebc3b04feb4d48c6145c86b18 --- classes/class-opensid.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/class-opensid.php b/classes/class-opensid.php index 89b2928..e78e768 100644 --- a/classes/class-opensid.php +++ b/classes/class-opensid.php @@ -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(); From cb68fb160cb102157021ad5c09265543937dbf8d Mon Sep 17 00:00:00 2001 From: "greysoftwareman@gmail.com" Date: Fri, 26 Oct 2018 21:17:50 +0700 Subject: [PATCH 3/5] menyesuaikan dengan versi opensid 18.10 dijalankan di php versi 7.2.2 --- ci-bootstrap.php | 21 ++++++++------- classes/class-ci-model.php | 2 +- controllers/controller-frontend.php | 42 +++++++++++++++-------------- init.php | 3 ++- 4 files changed, 36 insertions(+), 32 deletions(-) diff --git a/ci-bootstrap.php b/ci-bootstrap.php index 9266d9a..e80564e 100644 --- a/ci-bootstrap.php +++ b/ci-bootstrap.php @@ -1,9 +1,9 @@ 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; } diff --git a/controllers/controller-frontend.php b/controllers/controller-frontend.php index 1c30921..32ced60 100644 --- a/controllers/controller-frontend.php +++ b/controllers/controller-frontend.php @@ -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' ); } diff --git a/init.php b/init.php index a08f2cb..a8ece85 100644 --- a/init.php +++ b/init.php @@ -1,4 +1,5 @@ Date: Sun, 28 Oct 2018 20:16:12 +0700 Subject: [PATCH 4/5] menambahkan perbandingan strict data['statistik'], 0 masih dianggap null --- shortcodes/shortcode-data_statistik.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shortcodes/shortcode-data_statistik.php b/shortcodes/shortcode-data_statistik.php index bf4c710..29dc336 100644 --- a/shortcodes/shortcode-data_statistik.php +++ b/shortcodes/shortcode-data_statistik.php @@ -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 ); From 581ef3e95df75b8773acf4279ce0eed9278f0ebc Mon Sep 17 00:00:00 2001 From: "greysoftwareman@gmail.com" <=> Date: Sun, 28 Oct 2018 21:22:34 +0700 Subject: [PATCH 5/5] menambahkan function umur untuk layanan mandiri --- ci-bootstrap.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ci-bootstrap.php b/ci-bootstrap.php index e80564e..4ee6241 100644 --- a/ci-bootstrap.php +++ b/ci-bootstrap.php @@ -98,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; + }