From 11e598b4a611fbcc97e8576930c32ea29190779d Mon Sep 17 00:00:00 2001 From: Toto Date: Wed, 16 Aug 2023 23:22:23 +0700 Subject: [PATCH] (#438) perbaikan code --- .gitattributes | 23 +- composer.json | 8 +- composer.lock | 120 ++++++- donjo-app/Libraries/Install.php | 2 +- donjo-app/Libraries/Paging.php | 2 +- donjo-app/controllers/Analisis_grafik.php | 2 - donjo-app/controllers/Analisis_indikator.php | 2 - donjo-app/controllers/Analisis_kategori.php | 2 - .../controllers/Analisis_klasifikasi.php | 2 - donjo-app/controllers/Analisis_laporan.php | 6 +- donjo-app/controllers/Analisis_master.php | 2 +- donjo-app/controllers/Analisis_periode.php | 2 - donjo-app/controllers/Analisis_respon.php | 2 - .../Analisis_statistik_jawaban.php | 6 +- donjo-app/controllers/Data_persil.php | 2 - donjo-app/controllers/Database.php | 2 - donjo-app/controllers/Dokumen.php | 2 - donjo-app/controllers/First.php | 2 - donjo-app/controllers/Gallery.php | 2 - donjo-app/controllers/Gis.php | 4 - donjo-app/controllers/Hom_desa.php | 2 - donjo-app/controllers/Kategori.php | 2 - donjo-app/controllers/Kelompok.php | 2 - donjo-app/controllers/Kelompok_master.php | 2 - donjo-app/controllers/Keluar.php | 2 - donjo-app/controllers/Keluarga.php | 6 +- donjo-app/controllers/Komentar.php | 2 - donjo-app/controllers/Lapor.php | 2 - donjo-app/controllers/Laporan.php | 2 - donjo-app/controllers/Laporan_rentan.php | 2 - donjo-app/controllers/Main.php | 8 +- donjo-app/controllers/Man_user.php | 2 - donjo-app/controllers/Mandiri.php | 2 - donjo-app/controllers/Menu.php | 2 - donjo-app/controllers/Modul.php | 2 - donjo-app/controllers/Penduduk.php | 5 +- donjo-app/controllers/Penduduk_log.php | 1 - donjo-app/controllers/Pengurus.php | 2 - donjo-app/controllers/Plan.php | 2 - donjo-app/controllers/Program_bantuan.php | 2 - donjo-app/controllers/Rtm.php | 2 - donjo-app/controllers/Sid_core.php | 24 +- donjo-app/controllers/Sms.php | 2 - donjo-app/controllers/Sosmed.php | 3 - donjo-app/controllers/Statistik.php | 2 - donjo-app/controllers/Surat.php | 7 - donjo-app/controllers/Surat_master.php | 2 - donjo-app/controllers/User_setting.php | 8 +- donjo-app/controllers/Web.php | 2 - donjo-app/controllers/Widget.php | 2 - donjo-app/helpers/Excel_helper.php | 25 +- donjo-app/helpers/donjolib_helper.php | 31 +- donjo-app/models/AnalisisKlasifikasi.php | 4 +- donjo-app/models/Analisis_grafik_model.php | 38 +-- donjo-app/models/Analisis_import_model.php | 4 +- donjo-app/models/Analisis_indikator_model.php | 39 +-- donjo-app/models/Analisis_kategori_model.php | 20 +- .../models/Analisis_klasifikasi_model.php | 16 +- donjo-app/models/Analisis_laporan_model.php | 55 ++-- donjo-app/models/Analisis_master_model.php | 25 +- donjo-app/models/Analisis_periode_model.php | 27 +- donjo-app/models/Analisis_respon_model.php | 71 ++--- .../Analisis_statistik_jawaban_model.php | 52 ++- donjo-app/models/Config_model.php | 2 +- donjo-app/models/Data_persil_model.php | 17 +- donjo-app/models/Export_model.php | 21 +- donjo-app/models/Feed_model.php | 2 +- donjo-app/models/First_artikel_m.php | 11 +- donjo-app/models/First_keluarga_m.php | 1 - donjo-app/models/First_m.php | 1 - donjo-app/models/First_menu_m.php | 8 +- donjo-app/models/First_penduduk_m.php | 10 +- donjo-app/models/Header_model.php | 4 +- donjo-app/models/Import_model.php | 301 ++++++++---------- donjo-app/models/Kelompok_master_model.php | 25 +- donjo-app/models/Kelompok_model.php | 24 +- donjo-app/models/Keluarga_model.php | 92 +++--- donjo-app/models/Laporan_bulanan_model.php | 44 +-- donjo-app/models/Laporan_penduduk_model.php | 17 +- donjo-app/models/Mandiri_model.php | 23 +- donjo-app/models/Modul_model.php | 20 +- donjo-app/models/Pamong_model.php | 20 +- donjo-app/models/Penduduk_model.php | 165 ++++------ donjo-app/models/Plan_area_model.php | 36 +-- donjo-app/models/Plan_garis_model.php | 36 +-- donjo-app/models/Plan_line_model.php | 32 +- donjo-app/models/Plan_lokasi_model.php | 36 +-- donjo-app/models/Plan_point_model.php | 32 +- donjo-app/models/Plan_polygon_model.php | 32 +- donjo-app/models/Program_bantuan_model.php | 21 +- donjo-app/models/Rtm_model.php | 78 ++--- donjo-app/models/Sms_model.php | 197 +++++------- donjo-app/models/Surat_keluar_model.php | 19 +- donjo-app/models/Surat_master_model.php | 22 +- donjo-app/models/Surat_model.php | 12 +- donjo-app/models/User_model.php | 22 +- donjo-app/models/Web_artikel_model.php | 31 +- donjo-app/models/Web_dokumen_model.php | 23 +- donjo-app/models/Web_gallery_model.php | 35 +- donjo-app/models/Web_kategori_model.php | 36 +-- donjo-app/models/Web_komentar_model.php | 24 +- donjo-app/models/Web_menu_model.php | 19 +- donjo-app/models/Web_statis_model.php | 24 +- donjo-app/models/Wilayah_model.php | 27 +- rector.php | 21 ++ 105 files changed, 1036 insertions(+), 1295 deletions(-) create mode 100644 rector.php diff --git a/.gitattributes b/.gitattributes index 2ccb28ae1..2df9a201b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,14 +1,15 @@ -.editorconfig export-ignore -.gitattributes export-ignore -.gitignore export-ignore -.gitmodules export-ignore -.php-cs-fixer.php export-ignore +.editorconfig export-ignore +.gitattributes export-ignore +.gitignore export-ignore +.gitmodules export-ignore +.php-cs-fixer.php export-ignore code_of_conduct.md export-ignore -composer.lock export-ignore -package-lock.json export-ignore -package.json export-ignore -vite.config.js export-ignore +composer.lock export-ignore +package-lock.json export-ignore +package.json export-ignore +rector.php export-ignore +vite.config.js export-ignore -.github/ export-ignore -docs/ export-ignore +.github/ export-ignore +docs/ export-ignore resources/ export-ignore diff --git a/composer.json b/composer.json index 269610189..d1251dbe8 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,8 @@ }, "require-dev": { "codeigniter/coding-standard": "^1.1", - "mikey179/vfsstream": "1.6.*" + "mikey179/vfsstream": "1.6.*", + "rector/rector": "0.17.13" }, "autoload": { "psr-4": { @@ -26,7 +27,10 @@ "vendor-dir": "donjo-sys" }, "scripts": { - "csfix": "./donjo-sys/bin/php-cs-fixer fix", + "csfix": [ + "./donjo-sys/bin/php-cs-fixer fix", + "./donjo-sys/bin/rector process" + ], "update-resources": "git submodule update --init --remote resources" } } diff --git a/composer.lock b/composer.lock index 0f8038c3d..034162597 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c396191536664a758c7e5bbd1a85b27a", + "content-hash": "e1725c09797d05607554fa82e59e45e9", "packages": [ { "name": "codeigniter/framework", @@ -1204,6 +1204,68 @@ ], "time": "2022-11-01T15:20:57+00:00" }, + { + "name": "phpstan/phpstan", + "version": "1.10.29", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "ee5d8f2d3977fb09e55603eee6fb53bdd76ee9c1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ee5d8f2d3977fb09e55603eee6fb53bdd76ee9c1", + "reference": "ee5d8f2d3977fb09e55603eee6fb53bdd76ee9c1", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "docs": "https://phpstan.org/user-guide/getting-started", + "forum": "https://github.com/phpstan/phpstan/discussions", + "issues": "https://github.com/phpstan/phpstan/issues", + "security": "https://github.com/phpstan/phpstan/security/policy", + "source": "https://github.com/phpstan/phpstan-src" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", + "type": "tidelift" + } + ], + "time": "2023-08-14T13:24:11+00:00" + }, { "name": "psr/cache", "version": "1.0.1", @@ -1401,6 +1463,62 @@ }, "time": "2021-05-03T11:20:27+00:00" }, + { + "name": "rector/rector", + "version": "0.17.13", + "source": { + "type": "git", + "url": "https://github.com/rectorphp/rector.git", + "reference": "e2003ba7c5bda06d7bb419cf4be8dae5f8672132" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/e2003ba7c5bda06d7bb419cf4be8dae5f8672132", + "reference": "e2003ba7c5bda06d7bb419cf4be8dae5f8672132", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0", + "phpstan/phpstan": "^1.10.26" + }, + "conflict": { + "rector/rector-doctrine": "*", + "rector/rector-downgrade-php": "*", + "rector/rector-phpunit": "*", + "rector/rector-symfony": "*" + }, + "bin": [ + "bin/rector" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Instant Upgrade and Automated Refactoring of any PHP code", + "keywords": [ + "automation", + "dev", + "migration", + "refactoring" + ], + "support": { + "issues": "https://github.com/rectorphp/rector/issues", + "source": "https://github.com/rectorphp/rector/tree/0.17.13" + }, + "funding": [ + { + "url": "https://github.com/tomasvotruba", + "type": "github" + } + ], + "time": "2023-08-14T16:33:29+00:00" + }, { "name": "sebastian/diff", "version": "4.0.5", diff --git a/donjo-app/Libraries/Install.php b/donjo-app/Libraries/Install.php index c8b2b0af5..52dd2f56f 100644 --- a/donjo-app/Libraries/Install.php +++ b/donjo-app/Libraries/Install.php @@ -23,7 +23,7 @@ public function cek(): bool $query = $this->CI->db->query($sql, $db); $data = $query->result_array(); - return ! (count($data) !== 77); + return ! ((is_countable($data) ? count($data) : 0) !== 77); } /** diff --git a/donjo-app/Libraries/Paging.php b/donjo-app/Libraries/Paging.php index b8239c627..e63ad8be3 100644 --- a/donjo-app/Libraries/Paging.php +++ b/donjo-app/Libraries/Paging.php @@ -18,7 +18,7 @@ class Paging public function __construct($props = []) { - if (count($props) > 0) { + if ((is_countable($props) ? count($props) : 0) > 0) { $this->init($props); } } diff --git a/donjo-app/controllers/Analisis_grafik.php b/donjo-app/controllers/Analisis_grafik.php index 4687d8f96..9df4eaef7 100644 --- a/donjo-app/controllers/Analisis_grafik.php +++ b/donjo-app/controllers/Analisis_grafik.php @@ -7,8 +7,6 @@ class Analisis_grafik extends BaseController { public function __construct() { - parent::__construct(); - $grup = $this->user_model->sesi_grup($_SESSION['sesi']); if ($grup !== '1') { redirect('siteman'); diff --git a/donjo-app/controllers/Analisis_indikator.php b/donjo-app/controllers/Analisis_indikator.php index 255d18525..d051a1f3a 100644 --- a/donjo-app/controllers/Analisis_indikator.php +++ b/donjo-app/controllers/Analisis_indikator.php @@ -6,8 +6,6 @@ class Analisis_indikator extends BaseController { public function __construct() { - parent::__construct(); - $grup = $this->user_model->sesi_grup($_SESSION['sesi']); if ($grup !== '1') { redirect('siteman'); diff --git a/donjo-app/controllers/Analisis_kategori.php b/donjo-app/controllers/Analisis_kategori.php index 9890edb92..b14d8ac58 100644 --- a/donjo-app/controllers/Analisis_kategori.php +++ b/donjo-app/controllers/Analisis_kategori.php @@ -6,8 +6,6 @@ class Analisis_kategori extends BaseController { public function __construct() { - parent::__construct(); - $grup = $this->user_model->sesi_grup($_SESSION['sesi']); if ($grup !== '1') { redirect('siteman'); diff --git a/donjo-app/controllers/Analisis_klasifikasi.php b/donjo-app/controllers/Analisis_klasifikasi.php index cff24facc..7013e6858 100644 --- a/donjo-app/controllers/Analisis_klasifikasi.php +++ b/donjo-app/controllers/Analisis_klasifikasi.php @@ -7,8 +7,6 @@ class Analisis_klasifikasi extends BaseController { public function __construct() { - parent::__construct(); - $grup = $this->user_model->sesi_grup($_SESSION['sesi']); if ($grup !== '1') { redirect('siteman'); diff --git a/donjo-app/controllers/Analisis_laporan.php b/donjo-app/controllers/Analisis_laporan.php index c63c61bab..aad3b6591 100644 --- a/donjo-app/controllers/Analisis_laporan.php +++ b/donjo-app/controllers/Analisis_laporan.php @@ -6,8 +6,6 @@ class Analisis_laporan extends BaseController { public function __construct() { - parent::__construct(); - $grup = $this->user_model->sesi_grup($_SESSION['sesi']); if ($grup !== '1') { redirect('siteman'); @@ -158,7 +156,7 @@ public function multi_jawab_proses() $id_cb = $_POST['id_cb']; $cb = ''; - if (count($id_cb)) { + if (is_countable($id_cb) ? count($id_cb) : 0) { foreach ($id_cb as $id) { $cb .= $id . ','; } @@ -166,7 +164,7 @@ public function multi_jawab_proses() $_SESSION['jawab'] = $cb . '7777777'; $jmkf = $this->analisis_laporan_model->group_parameter(); - $_SESSION['jmkf'] = count($jmkf); + $_SESSION['jmkf'] = is_countable($jmkf) ? count($jmkf) : 0; } redirect('analisis_laporan'); } diff --git a/donjo-app/controllers/Analisis_master.php b/donjo-app/controllers/Analisis_master.php index dd684f2a1..3b597e7f6 100644 --- a/donjo-app/controllers/Analisis_master.php +++ b/donjo-app/controllers/Analisis_master.php @@ -99,7 +99,7 @@ public function panduan() public function import_analisis() { - $header = $this->header_model->get_data(); + $this->header_model->get_data(); $nav['act'] = 1; $data['form_action'] = site_url('analisis_master/import'); diff --git a/donjo-app/controllers/Analisis_periode.php b/donjo-app/controllers/Analisis_periode.php index dbf138c1b..3cca0672d 100644 --- a/donjo-app/controllers/Analisis_periode.php +++ b/donjo-app/controllers/Analisis_periode.php @@ -6,8 +6,6 @@ class Analisis_periode extends BaseController { public function __construct() { - parent::__construct(); - $grup = $this->user_model->sesi_grup($_SESSION['sesi']); if ($grup !== '1') { redirect('siteman'); diff --git a/donjo-app/controllers/Analisis_respon.php b/donjo-app/controllers/Analisis_respon.php index 514a140c8..2ab535099 100644 --- a/donjo-app/controllers/Analisis_respon.php +++ b/donjo-app/controllers/Analisis_respon.php @@ -6,8 +6,6 @@ class Analisis_respon extends BaseController { public function __construct() { - parent::__construct(); - unset($_SESSION['delik']); $grup = $this->user_model->sesi_grup($_SESSION['sesi']); if ($grup !== '1') { diff --git a/donjo-app/controllers/Analisis_statistik_jawaban.php b/donjo-app/controllers/Analisis_statistik_jawaban.php index 16e22bcb6..8a28839cf 100644 --- a/donjo-app/controllers/Analisis_statistik_jawaban.php +++ b/donjo-app/controllers/Analisis_statistik_jawaban.php @@ -6,8 +6,6 @@ class Analisis_statistik_jawaban extends BaseController { public function __construct() { - parent::__construct(); - $grup = $this->user_model->sesi_grup($_SESSION['sesi']); if ($grup !== '1') { redirect('siteman'); @@ -166,7 +164,7 @@ public function grafik_parameter($id = '') } $data['list_dusun'] = $this->analisis_statistik_jawaban_model->list_dusun(); - $ai = $this->analisis_statistik_jawaban_model->get_analisis_indikator($id); + $this->analisis_statistik_jawaban_model->get_analisis_indikator($id); // redirect('analisis_statistik_jawaban'); @@ -207,7 +205,7 @@ public function subjek_parameter($id = '', $par = '') } $data['list_dusun'] = $this->analisis_statistik_jawaban_model->list_dusun(); - $ai = $this->analisis_statistik_jawaban_model->get_analisis_indikator($id); + $this->analisis_statistik_jawaban_model->get_analisis_indikator($id); // if($ai['id_tipe']==3 OR $ai['id_tipe']==4) // redirect('analisis_statistik_jawaban'); diff --git a/donjo-app/controllers/Data_persil.php b/donjo-app/controllers/Data_persil.php index 9f3a662de..ac405bdf7 100644 --- a/donjo-app/controllers/Data_persil.php +++ b/donjo-app/controllers/Data_persil.php @@ -7,8 +7,6 @@ class Data_persil extends BaseController { public function __construct() { - parent::__construct(); - $grup = $this->user_model->sesi_grup($_SESSION['sesi']); if ($grup !== '1' && $grup !== '2') { redirect('siteman'); diff --git a/donjo-app/controllers/Database.php b/donjo-app/controllers/Database.php index e3f0e488e..5919ff692 100644 --- a/donjo-app/controllers/Database.php +++ b/donjo-app/controllers/Database.php @@ -6,8 +6,6 @@ class Database extends BaseController { public function __construct() { - parent::__construct(); - $this->load->dbforge(); $grup = $this->user_model->sesi_grup($_SESSION['sesi']); if ($grup !== '1') { diff --git a/donjo-app/controllers/Dokumen.php b/donjo-app/controllers/Dokumen.php index 9c8f600c5..4511593e4 100644 --- a/donjo-app/controllers/Dokumen.php +++ b/donjo-app/controllers/Dokumen.php @@ -6,8 +6,6 @@ class Dokumen extends BaseController { public function __construct() { - parent::__construct(); - $grup = $this->user_model->sesi_grup($_SESSION['sesi']); if ($grup !== '1' && $grup !== '2' && $grup !== '3' && $grup !== '4') { redirect('siteman'); diff --git a/donjo-app/controllers/First.php b/donjo-app/controllers/First.php index 06e8742a9..0eea09570 100644 --- a/donjo-app/controllers/First.php +++ b/donjo-app/controllers/First.php @@ -7,8 +7,6 @@ class First extends BaseController { public function __construct() { - parent::__construct(); - mandiri_timeout(); } diff --git a/donjo-app/controllers/Gallery.php b/donjo-app/controllers/Gallery.php index be1b9ac11..53a84c739 100644 --- a/donjo-app/controllers/Gallery.php +++ b/donjo-app/controllers/Gallery.php @@ -6,8 +6,6 @@ class Gallery extends BaseController { public function __construct() { - parent::__construct(); - $grup = $this->user_model->sesi_grup($_SESSION['sesi']); if ($grup !== '1' && $grup !== '2' && $grup !== '3' && $grup !== '4') { redirect('siteman'); diff --git a/donjo-app/controllers/Gis.php b/donjo-app/controllers/Gis.php index 384455c5a..cfe31b24e 100644 --- a/donjo-app/controllers/Gis.php +++ b/donjo-app/controllers/Gis.php @@ -7,8 +7,6 @@ class Gis extends BaseController { public function __construct() { - parent::__construct(); - $grup = $this->user_model->sesi_grup($_SESSION['sesi']); if ($grup !== '1') { redirect('siteman'); @@ -18,8 +16,6 @@ public function __construct() public function clear() { unset($_SESSION['log'], $_SESSION['cari'], $_SESSION['filter'], $_SESSION['sex'], $_SESSION['warganegara'], $_SESSION['fisik'], $_SESSION['mental'], $_SESSION['menahun'], $_SESSION['golongan_darah'], $_SESSION['dusun'], $_SESSION['rw'], $_SESSION['rt'], $_SESSION['agama'], $_SESSION['umur_min'], $_SESSION['umur_max'], $_SESSION['pekerjaan_id'], $_SESSION['status'], $_SESSION['pendidikan_id'], $_SESSION['status_penduduk'], $_SESSION['layer_penduduk'], $_SESSION['layer_keluarga'], $_SESSION['layer_desa'], $_SESSION['layer_wilayah'], $_SESSION['layer_area'], $_SESSION['layer_line'], $_SESSION['layer_point']); - - $_SESSION['layer_keluarga'] === 0; redirect('gis'); } diff --git a/donjo-app/controllers/Hom_desa.php b/donjo-app/controllers/Hom_desa.php index 5a8af7ef6..a17902e83 100644 --- a/donjo-app/controllers/Hom_desa.php +++ b/donjo-app/controllers/Hom_desa.php @@ -7,8 +7,6 @@ class Hom_desa extends BaseController { public function __construct() { - parent::__construct(); - $grup = $this->user_model->sesi_grup($_SESSION['sesi']); if ($grup !== '1' && $grup !== '2') { redirect('siteman'); diff --git a/donjo-app/controllers/Kategori.php b/donjo-app/controllers/Kategori.php index 85fadce6a..dfe3a2ce1 100644 --- a/donjo-app/controllers/Kategori.php +++ b/donjo-app/controllers/Kategori.php @@ -6,8 +6,6 @@ class Kategori extends BaseController { public function __construct() { - parent::__construct(); - $grup = $this->user_model->sesi_grup($_SESSION['sesi']); if ($grup !== '1' && $grup !== '2' && $grup !== '3') { redirect('siteman'); diff --git a/donjo-app/controllers/Kelompok.php b/donjo-app/controllers/Kelompok.php index db0901997..2a41c5a7f 100644 --- a/donjo-app/controllers/Kelompok.php +++ b/donjo-app/controllers/Kelompok.php @@ -6,8 +6,6 @@ class Kelompok extends BaseController { public function __construct() { - parent::__construct(); - $grup = $this->user_model->sesi_grup($_SESSION['sesi']); if ($grup !== '1') { redirect('siteman'); diff --git a/donjo-app/controllers/Kelompok_master.php b/donjo-app/controllers/Kelompok_master.php index e9e213d21..3846fdeb9 100644 --- a/donjo-app/controllers/Kelompok_master.php +++ b/donjo-app/controllers/Kelompok_master.php @@ -6,8 +6,6 @@ class Kelompok_master extends BaseController { public function __construct() { - parent::__construct(); - $grup = $this->user_model->sesi_grup($_SESSION['sesi']); if ($grup !== '1') { redirect('siteman'); diff --git a/donjo-app/controllers/Keluar.php b/donjo-app/controllers/Keluar.php index d5b47c133..80af3c3b3 100644 --- a/donjo-app/controllers/Keluar.php +++ b/donjo-app/controllers/Keluar.php @@ -6,8 +6,6 @@ class Keluar extends BaseController { public function __construct() { - parent::__construct(); - $grup = $this->user_model->sesi_grup($_SESSION['sesi']); if ($grup !== '1' && $grup !== '2' && $grup !== '3') { redirect('siteman'); diff --git a/donjo-app/controllers/Keluarga.php b/donjo-app/controllers/Keluarga.php index 77582a137..c94c8415c 100644 --- a/donjo-app/controllers/Keluarga.php +++ b/donjo-app/controllers/Keluarga.php @@ -7,8 +7,6 @@ class Keluarga extends BaseController { public function __construct() { - parent::__construct(); - $grup = $this->user_model->sesi_grup($_SESSION['sesi']); if ($grup !== '1' && $grup !== '2') { redirect('siteman'); @@ -610,7 +608,7 @@ public function insert_a() $dp = 0; $link = site_url('keluarga'); - while ($i < count($data)) { + while ($i < (is_countable($data) ? count($data) : 0)) { if ($_POST['nik'] === $data[$i]['nik']) { $dp = 1; $nk = $data[$i]['nik']; @@ -636,7 +634,7 @@ public function insert_new() $dp = 0; $link = site_url('keluarga/form/0/1'); - while ($i < count($data)) { + while ($i < (is_countable($data) ? count($data) : 0)) { if ($_POST['no_kk'] === $data[$i]['no_kk']) { $dp = 1; $nk = $data[$i]['no_kk']; diff --git a/donjo-app/controllers/Komentar.php b/donjo-app/controllers/Komentar.php index 5c850ebd5..fe509a619 100644 --- a/donjo-app/controllers/Komentar.php +++ b/donjo-app/controllers/Komentar.php @@ -6,8 +6,6 @@ class Komentar extends BaseController { public function __construct() { - parent::__construct(); - $grup = $this->user_model->sesi_grup($_SESSION['sesi']); if ($grup !== '1' && $grup !== '2' && $grup !== '3') { redirect('siteman'); diff --git a/donjo-app/controllers/Lapor.php b/donjo-app/controllers/Lapor.php index 94f948a5f..48760a335 100644 --- a/donjo-app/controllers/Lapor.php +++ b/donjo-app/controllers/Lapor.php @@ -6,8 +6,6 @@ class Lapor extends BaseController { public function __construct() { - parent::__construct(); - $grup = $this->user_model->sesi_grup($_SESSION['sesi']); if ($grup !== '1' && $grup !== '2' && $grup !== '3') { redirect('siteman'); diff --git a/donjo-app/controllers/Laporan.php b/donjo-app/controllers/Laporan.php index 9de39e823..7f62570e4 100644 --- a/donjo-app/controllers/Laporan.php +++ b/donjo-app/controllers/Laporan.php @@ -7,8 +7,6 @@ class Laporan extends BaseController { public function __construct() { - parent::__construct(); - $grup = $this->user_model->sesi_grup($_SESSION['sesi']); if ($grup !== '1' && $grup !== '2' && $grup !== '3') { redirect('siteman'); diff --git a/donjo-app/controllers/Laporan_rentan.php b/donjo-app/controllers/Laporan_rentan.php index d5e05b447..7b37ccd03 100644 --- a/donjo-app/controllers/Laporan_rentan.php +++ b/donjo-app/controllers/Laporan_rentan.php @@ -7,8 +7,6 @@ class Laporan_rentan extends BaseController { public function __construct() { - parent::__construct(); - $grup = $this->user_model->sesi_grup($_SESSION['sesi']); if ($grup !== '1' && $grup !== '2' && $grup !== '3') { redirect('siteman'); diff --git a/donjo-app/controllers/Main.php b/donjo-app/controllers/Main.php index c21c33cb9..bcb60ba47 100644 --- a/donjo-app/controllers/Main.php +++ b/donjo-app/controllers/Main.php @@ -16,15 +16,11 @@ public function index() $grup = $this->user_model->sesi_grup($_SESSION['sesi']); switch ($grup) { - case 1: redirect('hom_desa'); - break; - + case 1: case 2: redirect('hom_desa'); break; - case 3: redirect('web'); - break; - + case 3: case 4: redirect('web'); break; diff --git a/donjo-app/controllers/Man_user.php b/donjo-app/controllers/Man_user.php index 16f29e4ff..16aa842ef 100644 --- a/donjo-app/controllers/Man_user.php +++ b/donjo-app/controllers/Man_user.php @@ -6,8 +6,6 @@ class Man_user extends BaseController { public function __construct() { - parent::__construct(); - $grup = $this->user_model->sesi_grup($_SESSION['sesi']); if ($grup !== '1') { redirect('siteman'); diff --git a/donjo-app/controllers/Mandiri.php b/donjo-app/controllers/Mandiri.php index 9980b5ee9..392035aee 100644 --- a/donjo-app/controllers/Mandiri.php +++ b/donjo-app/controllers/Mandiri.php @@ -6,8 +6,6 @@ class Mandiri extends BaseController { public function __construct() { - parent::__construct(); - $grup = $this->user_model->sesi_grup($_SESSION['sesi']); if ($grup !== '1' && $grup !== '2') { redirect('siteman'); diff --git a/donjo-app/controllers/Menu.php b/donjo-app/controllers/Menu.php index 433d12ff4..7a861a164 100644 --- a/donjo-app/controllers/Menu.php +++ b/donjo-app/controllers/Menu.php @@ -6,8 +6,6 @@ class Menu extends BaseController { public function __construct() { - parent::__construct(); - $grup = $this->user_model->sesi_grup($_SESSION['sesi']); if ($grup !== '1' && $grup !== '2' && $grup !== '3') { redirect('siteman'); diff --git a/donjo-app/controllers/Modul.php b/donjo-app/controllers/Modul.php index 9a4be9d68..5116f1091 100644 --- a/donjo-app/controllers/Modul.php +++ b/donjo-app/controllers/Modul.php @@ -6,8 +6,6 @@ class Modul extends BaseController { public function __construct() { - parent::__construct(); - $grup = $this->user_model->sesi_grup($_SESSION['sesi']); if ($grup !== '1') { redirect('siteman'); diff --git a/donjo-app/controllers/Penduduk.php b/donjo-app/controllers/Penduduk.php index e4aebb6ce..9a3316e14 100644 --- a/donjo-app/controllers/Penduduk.php +++ b/donjo-app/controllers/Penduduk.php @@ -7,8 +7,6 @@ class Penduduk extends BaseController { public function __construct() { - parent::__construct(); - $grup = $this->user_model->sesi_grup($_SESSION['sesi']); if ($grup !== '1' && $grup !== '2') { redirect('siteman'); @@ -344,7 +342,7 @@ public function insert() $dp = 0; $link = site_url('penduduk/form'); - while ($i < count($data)) { + while ($i < (is_countable($data) ? count($data) : 0)) { if ($_POST['nik'] === $data[$i]['nik']) { $dp = 1; $nk = $data[$i]['nik']; @@ -545,7 +543,6 @@ public function ajax_penduduk_pindah_rt($dusun = '', $rw = '') { $dusun = str_replace('_', ' ', $dusun); $rt = $this->penduduk_model->list_rt($dusun, $rw); - $dusun = str_replace(' ', '_', $dusun); echo "RT