-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fe644bf
commit 5bd1a69
Showing
410 changed files
with
100,629 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
<?php | ||
/** | ||
* Created by IntelliJ IDEA. | ||
* User: AbangAzmi | ||
* Date: 04/05/2021 | ||
* Time: 20:40 | ||
*/ | ||
|
||
class Basecontroller extends CI_Controller { | ||
|
||
//status | ||
public $statusOK = true; | ||
public $statusNotOK = false; | ||
|
||
//code | ||
public $granted = '1'; | ||
public $denied = '2'; | ||
public $cancelled = '3'; | ||
public $needLogin = '4'; | ||
public $errorLogin = '5'; | ||
public $wrongMethod = '6'; | ||
public $userNotExist = '7'; | ||
|
||
//global variables | ||
public $setting; | ||
public $tp; | ||
public $smt; | ||
public $data = []; | ||
|
||
public function __construct(){ | ||
parent::__construct(); | ||
$this->load->database(); | ||
|
||
$this->load->helper(['url', 'language']); | ||
$this->load->library('form_validation'); | ||
$this->lang->load('auth'); | ||
$this->load->model('Apimodel', 'api'); | ||
$this->load->model('Log_model', 'logging'); | ||
|
||
$this->load->model('DAOFactory', 'dao'); | ||
$this->dao->load('users_groups'); | ||
$this->dao->load('users'); | ||
} | ||
|
||
protected function output_json($data){ | ||
$this->output->set_content_type('application/json')->set_output(json_encode($data)); | ||
} | ||
|
||
protected function userTerdaftar($idUser) { | ||
//$this->dao->load('users'); | ||
$user = $this->dao->getUsersDAO()->load($idUser); | ||
return $user != null; | ||
} | ||
|
||
protected function validate($idUser, $token, $method) { | ||
if($this->input->method(true) != $method){ | ||
$this->result($this->statusNotOK, $this->wrongMethod); | ||
return; | ||
} | ||
|
||
if (!$this->isTokenValid($idUser, $token)) { | ||
$this->result($this->statusNotOK, $this->denied); | ||
return; | ||
} | ||
|
||
if (!$this->userTerdaftar($idUser)) { | ||
$this->result($this->statusNotOK, $this->userNotExist); | ||
return; | ||
} | ||
} | ||
|
||
protected function isAdmin($idUser){ | ||
//$this->dao->load('users_groups'); | ||
$userGroup = $this->dao->getUsersGroupsDAO()->queryByUserId($idUser, true); | ||
return $userGroup->group_id == '1'; | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
protected function isGuru($idUser){ | ||
//$this->dao->load('users_groups'); | ||
$userGroup = $this->dao->getUsersGroupsDAO()->queryByUserId($idUser, true); | ||
return $userGroup->group_id == '2'; | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
protected function isSiswa($idUser){ | ||
$this->dao->load('users_groups'); | ||
$userGroup = $this->dao->getUsersGroupsDAO()->queryByUserId($idUser, true); | ||
return $userGroup->group_id == '3'; | ||
} | ||
|
||
protected function result($status, $code) { | ||
$message = 'Tidak diketahui'; | ||
switch ($code) { | ||
case $this->needLogin : | ||
$message = 'Anda harus login terlebih dulu'; | ||
break; | ||
case $this->granted : | ||
$message = 'access ok'; | ||
break; | ||
case $this->denied : | ||
$message = 'access denied'; | ||
break; | ||
case $this->cancelled : | ||
$message = 'cancelled'; | ||
break; | ||
case $this->errorLogin : | ||
$message = 'Username atau Password salah'; | ||
break; | ||
case $this->wrongMethod : | ||
$message = 'Salah metode'; | ||
break; | ||
case $this->userNotExist : | ||
$message = 'Akun belum aktif, hubungi Admin.'; | ||
break; | ||
} | ||
|
||
$this->data['success'] = $status; | ||
$this->data['message'] = $message; | ||
$this->data['code'] = $code; | ||
$this->output_json($this->data); | ||
} | ||
|
||
/* | ||
protected function cekSession($idUser, $token) { | ||
if($this->input->method(true) != 'POST'){ | ||
$this->result($this->statusNotOK, $this->wrongMethod); | ||
return false; | ||
} else { | ||
$valid = $this->isTokenValid($idUser, $token); | ||
if (!$valid) { | ||
$this->data['errcode'] = 'Token invalid'; | ||
$this->result($this->statusNotOK, $this->denied); | ||
return false; | ||
} else { | ||
return true; | ||
} | ||
} | ||
} | ||
*/ | ||
|
||
protected function isTokenValid($id_user, $token) { | ||
$this->dao->load('api_token'); | ||
$api = $this->dao->getApiTokenDAO()->queryByIdUser($id_user, true); | ||
$last = new DateTime($api->timestamp); | ||
$last->add(new DateInterval('PT12H')); | ||
$now = new DateTime(); | ||
//$this->data['tkndb'] = $api->token; | ||
//$this->data['tknpost'] = $token; | ||
$valid = $now < $last; | ||
if ($token == $api->token && $valid) { | ||
return true; | ||
} else return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
/** | ||
* Created by IntelliJ IDEA. | ||
* User: AbangAzmi | ||
* Date: 04/05/2021 | ||
* Time: 20:40 | ||
*/ | ||
|
||
class Main_Controller extends CI_Controller { | ||
|
||
public function __construct(){ | ||
parent::__construct(); | ||
$this->load->database(); | ||
//$this->load->library('database'); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | ||
|
||
/** | ||
* UUID Class | ||
* | ||
* This implements the abilities to create UUID's for CodeIgniter. | ||
* Code has been borrowed from the followinf comments on php.net | ||
* and has been optimized for CodeIgniter use. | ||
* http://www.php.net/manual/en/function.uniqid.php#94959 | ||
* | ||
* @category Libraries | ||
* @author Dan Storm | ||
* @link http://catalystcode.net/ | ||
* @license GNU LPGL | ||
* @version 2.1 | ||
*/ | ||
|
||
|
||
class Uuid | ||
{ | ||
|
||
public function v3($name, $namespace = null) | ||
{ | ||
if(is_null($namespace)) | ||
$namespace = $this->v4(); | ||
|
||
if(empty($name)) | ||
return FALSE; | ||
|
||
if( ! $this->is_valid($namespace)) | ||
return FALSE; | ||
|
||
// Get hexadecimal components of namespace | ||
$nhex = str_replace(array('-','{','}'), '', $namespace); | ||
|
||
// Binary Value | ||
$nstr = ''; | ||
|
||
// Convert Namespace UUID to bits | ||
for($i = 0; $i < strlen($nhex); $i+=2) | ||
{ | ||
$nstr .= chr(hexdec($nhex[$i].$nhex[$i+1])); | ||
} | ||
|
||
// Calculate hash value | ||
$hash = md5($nstr . $name); | ||
|
||
return sprintf('%08s-%04s-%04x-%04x-%12s', | ||
|
||
// 32 bits for "time_low" | ||
substr($hash, 0, 8), | ||
|
||
// 16 bits for "time_mid" | ||
substr($hash, 8, 4), | ||
|
||
// 16 bits for "time_hi_and_version", | ||
// four most significant bits holds version number 3 | ||
(hexdec(substr($hash, 12, 4)) & 0x0fff) | 0x3000, | ||
|
||
// 16 bits, 8 bits for "clk_seq_hi_res", | ||
// 8 bits for "clk_seq_low", | ||
// two most significant bits holds zero and one for variant DCE1.1 | ||
(hexdec(substr($hash, 16, 4)) & 0x3fff) | 0x8000, | ||
|
||
// 48 bits for "node" | ||
substr($hash, 20, 12) | ||
); | ||
} | ||
|
||
public function v4($trim = false) | ||
{ | ||
|
||
$format = ($trim == false) ? '%04x%04x-%04x-%04x-%04x-%04x%04x%04x' : '%04x%04x%04x%04x%04x%04x%04x%04x'; | ||
|
||
return sprintf($format, | ||
|
||
// 32 bits for "time_low" | ||
mt_rand(0, 0xffff), mt_rand(0, 0xffff), | ||
|
||
// 16 bits for "time_mid" | ||
mt_rand(0, 0xffff), | ||
|
||
// 16 bits for "time_hi_and_version", | ||
// four most significant bits holds version number 4 | ||
mt_rand(0, 0x0fff) | 0x4000, | ||
|
||
// 16 bits, 8 bits for "clk_seq_hi_res", | ||
// 8 bits for "clk_seq_low", | ||
// two most significant bits holds zero and one for variant DCE1.1 | ||
mt_rand(0, 0x3fff) | 0x8000, | ||
|
||
// 48 bits for "node" | ||
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff) | ||
); | ||
} | ||
|
||
public function v5($name, $namespace = null) | ||
{ | ||
if(is_null($namespace)) | ||
$namespace = $this->v4(); | ||
|
||
if(empty($name)) | ||
return FALSE; | ||
|
||
if( ! $this->is_valid($namespace)) | ||
return FALSE; | ||
|
||
// Get hexadecimal components of namespace | ||
$nhex = str_replace(array('-','{','}'), '', $namespace); | ||
|
||
// Binary Value | ||
$nstr = ''; | ||
|
||
// Convert Namespace UUID to bits | ||
for($i = 0; $i < strlen($nhex); $i+=2) | ||
{ | ||
$nstr .= chr(hexdec($nhex[$i].$nhex[$i+1])); | ||
} | ||
|
||
// Calculate hash value | ||
$hash = sha1($nstr . $name); | ||
|
||
return sprintf('%08s-%04s-%04x-%04x-%12s', | ||
|
||
// 32 bits for "time_low" | ||
substr($hash, 0, 8), | ||
|
||
// 16 bits for "time_mid" | ||
substr($hash, 8, 4), | ||
|
||
// 16 bits for "time_hi_and_version", | ||
// four most significant bits holds version number 5 | ||
(hexdec(substr($hash, 12, 4)) & 0x0fff) | 0x5000, | ||
|
||
// 16 bits, 8 bits for "clk_seq_hi_res", | ||
// 8 bits for "clk_seq_low", | ||
// two most significant bits holds zero and one for variant DCE1.1 | ||
(hexdec(substr($hash, 16, 4)) & 0x3fff) | 0x8000, | ||
|
||
// 48 bits for "node" | ||
substr($hash, 20, 12) | ||
); | ||
} | ||
|
||
public function is_valid($uuid) | ||
{ | ||
return preg_match('/^\{?[0-9a-f]{8}\-?[0-9a-f]{4}\-?[0-9a-f]{4}\-?[0-9a-f]{4}\-?[0-9a-f]{12}\}?$/i', $uuid) === 1; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<!-- Simple HttpErrorPages | MIT License | https://github.com/AndiDittrich/HttpErrorPages --> | ||
<meta charset="utf-8" /><meta http-equiv="X-UA-Compatible" content="IE=edge" /><meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<title>404 - Resource not found</title> | ||
<style type="text/css">/*! normalize.css v5.0.0 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;line-height:1.15;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,footer,header,nav,section{display:block}h1{font-size:2em;margin:.67em 0}figcaption,figure,main{display:block}figure{margin:1em 40px}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent;-webkit-text-decoration-skip:objects}a:active,a:hover{outline-width:0}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:inherit}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}dfn{font-style:italic}mark{background-color:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}audio,video{display:inline-block}audio:not([controls]){display:none;height:0}img{border-style:none}svg:not(:root){overflow:hidden}button,input,optgroup,select,textarea{font-family:sans-serif;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type=reset],[type=submit],button,html [type=button]{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{display:inline-block;vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details,menu{display:block}summary{display:list-item}canvas{display:inline-block}template{display:none}[hidden]{display:none}/*! Simple HttpErrorPages | MIT X11 License | https://github.com/AndiDittrich/HttpErrorPages */body,html{width:100%;height:100%;background-color:#21232a}body{color:#fff;text-align:center;text-shadow:0 2px 4px rgba(0,0,0,.5);padding:0;min-height:100%;-webkit-box-shadow:inset 0 0 100px rgba(0,0,0,.8);box-shadow:inset 0 0 100px rgba(0,0,0,.8);display:table;font-family:"Open Sans",Arial,sans-serif}h1{font-family:inherit;font-weight:500;line-height:1.1;color:inherit;font-size:36px}h1 small{font-size:68%;font-weight:400;line-height:1;color:#777}a{text-decoration:none;color:#fff;font-size:inherit;border-bottom:dotted 1px #707070}.lead{color:silver;font-size:21px;line-height:1.4}.cover{display:table-cell;vertical-align:middle;padding:0 20px}footer{position:fixed;width:100%;height:40px;left:0;bottom:0;color:#a0a0a0;font-size:14px}</style> | ||
</head> | ||
<body> | ||
<div class="cover"><h1>WAK WAWWWW !!!</h1> | ||
<p class="lead">"Ketika kita sakit hati atas perbuatan orang lain, pada saat yang sama kita belajar untuk menjaga perasaan orang lain"</p> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<!-- Simple HttpErrorPages | MIT License | https://github.com/AndiDittrich/HttpErrorPages --> | ||
<meta charset="utf-8" /><meta http-equiv="X-UA-Compatible" content="IE=edge" /><meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<title>404 - Resource not found</title> | ||
<style type="text/css">/*! normalize.css v5.0.0 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;line-height:1.15;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,footer,header,nav,section{display:block}h1{font-size:2em;margin:.67em 0}figcaption,figure,main{display:block}figure{margin:1em 40px}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent;-webkit-text-decoration-skip:objects}a:active,a:hover{outline-width:0}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:inherit}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}dfn{font-style:italic}mark{background-color:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}audio,video{display:inline-block}audio:not([controls]){display:none;height:0}img{border-style:none}svg:not(:root){overflow:hidden}button,input,optgroup,select,textarea{font-family:sans-serif;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type=reset],[type=submit],button,html [type=button]{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{display:inline-block;vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details,menu{display:block}summary{display:list-item}canvas{display:inline-block}template{display:none}[hidden]{display:none}/*! Simple HttpErrorPages | MIT X11 License | https://github.com/AndiDittrich/HttpErrorPages */body,html{width:100%;height:100%;background-color:#21232a}body{color:#fff;text-align:center;text-shadow:0 2px 4px rgba(0,0,0,.5);padding:0;min-height:100%;-webkit-box-shadow:inset 0 0 100px rgba(0,0,0,.8);box-shadow:inset 0 0 100px rgba(0,0,0,.8);display:table;font-family:"Open Sans",Arial,sans-serif}h1{font-family:inherit;font-weight:500;line-height:1.1;color:inherit;font-size:36px}h1 small{font-size:68%;font-weight:400;line-height:1;color:#777}a{text-decoration:none;color:#fff;font-size:inherit;border-bottom:dotted 1px #707070}.lead{color:silver;font-size:21px;line-height:1.4}.cover{display:table-cell;vertical-align:middle;padding:0 20px}footer{position:fixed;width:100%;height:40px;left:0;bottom:0;color:#a0a0a0;font-size:14px}</style> | ||
</head> | ||
<body> | ||
<div class="cover"><h1>WAK WAWWWW !!!</h1> | ||
<p class="lead">"Ketika kita sakit hati atas perbuatan orang lain, pada saat yang sama kita belajar untuk menjaga perasaan orang lain"</p> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
/** | ||
* Created by IntelliJ IDEA. | ||
* User: multazam | ||
* Date: 07/07/20 | ||
* Time: 14:10 | ||
*/ | ||
|
||
class Testmodule extends CI_Controller { | ||
|
||
public function __construct() { | ||
parent::__construct(); | ||
} | ||
|
||
public function index() { | ||
$this->load->view('data'); | ||
} | ||
} |
Oops, something went wrong.