Commit 83b55dfa authored by Indra Raja's avatar Indra Raja

Merge branch 'v1.2' into 'v.1.1'

# Conflicts:
#   module/Application/src/Controller/ApiController.php
#   module/Application/src/Controller/QueueController.php
#   module/Application/src/Model/Param/Storage/Mysql.php
parents b6beb3c7 31f7f095
This diff is collapsed.
...@@ -59,11 +59,13 @@ return [ ...@@ -59,11 +59,13 @@ return [
'api' => [ 'api' => [
'type' => Segment::class, 'type' => Segment::class,
'options' => [ 'options' => [
'route' => '/api[/][:action][/:id]', 'route' => '/api[/:action][:id][=:value]',
'constraints' => array( 'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*', 'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'id' => '[0-9]+', 'id=' => '[a-zA-Z][a-zA-Z0-9_-]*',
'value' => '[0-9]+',
), ),
'defaults' => [ 'defaults' => [
'controller' => Controller\ApiController::class, 'controller' => Controller\ApiController::class,
'action' => 'index', 'action' => 'index',
......
...@@ -192,6 +192,23 @@ class AdminController extends \Application\Master\GlobalActionController ...@@ -192,6 +192,23 @@ class AdminController extends \Application\Master\GlobalActionController
$view = new ViewModel(); $view = new ViewModel();
$result = new Result(); $result = new Result();
// require_once(APPPATH.'vendor/autoload.php');
// $options = array(
// 'cluster' => 'ap1',
// 'useTLS' => true
// );
// $pusher = new PusherPusher(
// '6f23df2468d8c1c7d0a2', //ganti dengan App_key pusher Anda
// 'd2c2bf5a98edcdddfda2', //ganti dengan App_secret pusher Anda
// '1090832', //ganti dengan App_key pusher Anda
// $options
// );
// $data['message'] = 'success';
// $pusher->trigger('my-channel', 'my-event', $data);
$today = gmdate("d M Y ", time()+60*60*7); $today = gmdate("d M Y ", time()+60*60*7);
$view->setVariable('today', $today); $view->setVariable('today', $today);
......
...@@ -225,6 +225,9 @@ class ApiController extends \Application\Master\GlobalActionController { ...@@ -225,6 +225,9 @@ class ApiController extends \Application\Master\GlobalActionController {
return $this->getOutput($result->toJson()); return $this->getOutput($result->toJson());
} }
public function TampilanUmumAction(){
}
public function saveregisterAction(){ public function saveregisterAction(){
$result = new Result(); $result = new Result();
...@@ -839,11 +842,10 @@ class ApiController extends \Application\Master\GlobalActionController { ...@@ -839,11 +842,10 @@ class ApiController extends \Application\Master\GlobalActionController {
// print_r($dataArraydokter);die; // print_r($dataArraydokter);die;
$param->saveGlobal($Dokter, $table_dokter); $param->saveGlobal($Dokter, $table_dokter);
$param->saveGlobal($DokterPoli, $table_dokter_to_poli); $param->saveGlobal($DokterPoli, $table_dokter_to_poli);
$result->code = 0; $result->code = 0;
$result->info = 'ok'; $result->info = 'ok';
$result->data = $DokterPoli->data; $result->data = $DokterPoli->data;
...@@ -1404,30 +1406,30 @@ class ApiController extends \Application\Master\GlobalActionController { ...@@ -1404,30 +1406,30 @@ class ApiController extends \Application\Master\GlobalActionController {
return $this->getOutput($result->toJson()); return $this->getOutput($result->toJson());
} }
public function loadAntrianAction(){ public function loadantrianAction(){
$result = new Result(); $result = new Result();
$request = $this->getRequest(); $request = $this->getRequest();
$post = $request->getPost(); $post = $request->getPost();
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig()); //$name = $this->isFieldMandatory(@$data['name'], 'name');
$antrian = new \Application\Model\Param($storage);
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$test = new \Application\Model\Param($storage);
$load = $antrian->loadAntrian();
// $id = $this->_getParam($test->loadAntrian($post->id_poli));
$load = $test->loadAntrian($post->id_poli);
if($load->code == 0){ if($load->code == 0){
$result->code = $result::CODE_SUCCESS; $result->code = $result::CODE_SUCCESS;
$result->info = $result::INFO_SUCCESS; $result->info = $result::INFO_SUCCESS;
$result->data = $load->data; $result->data = $load->data;
}else{
}
else{
$result->code = 1; $result->code = 1;
$result->info = 'Not Found'; $result->info = 'Not Found';
} }
return $this->getOutput($result->toJson()); return $this->getOutput($result->toJson());
...@@ -1466,7 +1468,7 @@ class ApiController extends \Application\Master\GlobalActionController { ...@@ -1466,7 +1468,7 @@ class ApiController extends \Application\Master\GlobalActionController {
$poli = new \Application\Model\Param($storage); $poli = new \Application\Model\Param($storage);
$load = $poli->loadPoli(); $load = $poli->loadPoli($post->$id_poli);
......
...@@ -180,6 +180,8 @@ class QueueController extends \Application\Master\GlobalActionController ...@@ -180,6 +180,8 @@ class QueueController extends \Application\Master\GlobalActionController
//print_r($uri);die; //print_r($uri);die;
$baseurl = sprintf('//%s', $uri->getHost()); $baseurl = sprintf('//%s', $uri->getHost());
$getpath = explode("/",$uri->getPath()); $getpath = explode("/",$uri->getPath());
// print_($getpath);die;
$decodeid = base64_decode($getpath[3]); $decodeid = base64_decode($getpath[3]);
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig()); $storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
......
...@@ -42,33 +42,46 @@ class UmumController extends \Application\Master\GlobalActionController ...@@ -42,33 +42,46 @@ class UmumController extends \Application\Master\GlobalActionController
$view = new ViewModel(); $view = new ViewModel();
$result = new Result(); $result = new Result();
$today = gmdate("d M Y ", time()+60*60*7); $today = gmdate("d M Y ", time()+60*60*7);
$view->setVariable('today', $today); $view->setVariable('today', $today);
/* get url */ /* get url */
$uri = $this->getRequest()->getUri(); $uri = $this->getRequest()->getUri();
$baseurl = sprintf('//%s', $uri->getHost()); $baseurl = sprintf('//%s', $uri->getHost());
$getpath = explode("/",$uri->getPath());
// echo "<pre>";
$this->headScript->appendScript(' var baseURL = "' . $baseurl . '"'); $decodeid = base64_decode($getpath[3]);
$this->headScript->appendFile('/action-js/antrian-js/action-umum.js');
$this->layout("layout/layoutUmum"); // function curl($url){
return $view; // $ch = curl_init();
} // curl_setopt($ch, CURLOPT_URL, $url);
// curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// $output = curl_exec($ch);
// curl_close($ch);
// return $output;
// }
public function tampilanantrianAction() // $send = curl("http://frontend.indra/api/loadantrian");
{
$view = new ViewModel();
$result = new Result();
$uri = $this->getRequest()->getUri(); // // mengubah JSON menjadi array
$baseurl = sprintf('//%s', $uri->getHost()); // $data = json_decode($send, TRUE);
// echo "<pre>";
// print_r($data);
// echo "</pre>";
// print_r($decodeid);
$this->headScript->appendScript(' var baseURL = "' . $baseurl . '"'); $this->headScript->appendScript(' var baseURL = "' . $baseurl . '"');
$this->headScript->appendFile('/action-js/antrian-js/action-umum.js'); $this->headScript->appendScript(' var id_poli = "' . $decodeid . '"');
$this->headScript->appendFile('/action-js/antrian-js/action-umumtampilan.js');
$this->layout("layout/layoutUmum"); $this->layout("layout/layoutUmum");
return $view; return $view;
} }
} }
...@@ -130,8 +130,8 @@ class Param extends Mapper { ...@@ -130,8 +130,8 @@ class Param extends Mapper {
$data = $this->_storage->loadantrianunregis($id); $data = $this->_storage->loadantrianunregis($id);
return $data; return $data;
} }
public function loadPoli($id = null){ public function loadPoli($id_poli = null){
$data = $this->_storage->loadPoli($id); $data = $this->_storage->loadPoli($id_poli);
return $data; return $data;
} }
public function loadPilihAntrian($iddok = null){ public function loadPilihAntrian($iddok = null){
...@@ -155,8 +155,8 @@ class Param extends Mapper { ...@@ -155,8 +155,8 @@ class Param extends Mapper {
return $data; return $data;
} }
public function loadAntrian($id = null){ public function loadAntrian($id_poli){
$data = $this->_storage->loadAntrian($id); $data = $this->_storage->loadAntrian($id_poli);
return $data; return $data;
} }
public function loadjumlahpasien(){ public function loadjumlahpasien(){
......
...@@ -1614,17 +1614,29 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton { ...@@ -1614,17 +1614,29 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
return $result; return $result;
} }
public function loadAntrian($id = null){ public function loadAntrian($id_poli){
$result = new Result(); $result = new Result();
try { try {
$sql="
SELECT DISTINCT on (idd.id_dokter) idd.id_dokter,idd.no_antrian,dok.nama_dokter,pol.nama_poli,dok.kode_dokter,rur.nama_ruang ,idd.status_code,idd.id_poli
FROM antrian_pasien idd
$sql = " SELECT DISTINCT on (idd.id_dokter) idd.id_dokter,idd.no_antrian,dok.nama_dokter,pol.nama_poli,dok.kode_dokter,rur.nama_ruang FROM antrian_pasien idd LEFT JOIN dokter_to_poli dok
LEFT JOIN dokter_to_poli dok on idd.id_dokter = dok.id_dokter on idd.id_dokter = dok.id_dokter
LEFT JOIN poli pol on idd.id_poli = pol.id_poli LEFT JOIN poli pol
LEFT JOIN ruang rur on idd.id_ruang = rur.id_ruang on idd.id_poli = pol.id_poli
LEFT JOIN ruang rur
on idd.id_ruang = rur.id_ruang
LEFT JOIN counter_status cs
on cs.status_code = idd.status_code
WHERE idd.id_pasien is not null
and
(cs.status_code=30 or cs.status_code =40) and
idd.id_poli=$id_poli
WHERE idd.id_pasien is not null and status_code=20 or status_code=30 or status_code =40";
";
$stmt = $this->_db->query($sql); $stmt = $this->_db->query($sql);
......
<!-- <script type="text/javascript">
// 1 detik = 1000
window.setTimeout("waktu()",1000);
function waktu() {
var tanggal = new Date();
setTimeout("waktu()",1000);
document.getElementById("tanggalku").innerHTML
= tanggal.getHours()+":"+tanggal.getMinutes()+":"+tanggal.getSeconds();
}
</script> -->
<!-- Page header --> <!-- Page header -->
<div class="row">
<div class="page-header" style="border-bottom: 0px solid #ddd0;"> <div class="page-header" style="border-bottom: 0px solid #ddd0;">
<!-- Header content --> <!-- Header content -->
<div class="page-header-content"> <div class="page-header-content">
<div class="page-title"> <div class="page-title">
<h4 style="font-size:25px;"><span class="text-semibold">Rumah Sakit - Mohon Antri Dengan Tertib</span></h4> <h4 style="color: #fff;font-size:25px;"><span class="text-semibold">Rumah Sakit - Mohon Antri Dengan Tertib</span></h4>
</div> </div>
<div class="heading-elements"> <div class="heading-elements">
<div class="heading-btn-group"> <div class="heading-btn-group">
<div style="color: #fff9ff;font-size: 50px;font-weight: 600;margin-top:-20px;"> <div style="color: #fff;font-size: 17px;font-weight: 600;margin-top:-20px;">
<span id="tanggalku"></span>
</div>
<div style="color: #fff9ff;font-size: 17px;font-weight: 600;margin-top:-20px;">
<?php echo $this->today; ?> <?php echo $this->today; ?>
</div> </div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
<div class="justify-content-center">
<div class="col-sm-200" >
<div class="card mb-3 alert alert-info alert-styled-left alert-arrow-left alert-component col-sm-100" style="border-color: #e94c72;background: #faebd73b;width: 1300px;margin-left: 100px;">
<div class="text-center content-group">
<div><input type="hidden" value="nomer antrian" id="text-to-speech" placeholder="Enter text to speak..."/></div>
<p class="error-title" style=" font-weight: ;font-size:50px;font-family: Times New Roman, Times, serif;color: #fff"><span > Nomer</span></p>
<h1 class="error-title" style=" font-weight: bold;font-size:100px;font-family: Times New Roman, Times, serif;color: #fff"><span id="no_antrian"></span></h1>
<p class="error-title" style=" font-weight: ;font-size:50px;font-family: Times New Roman, Times, serif;color: #fff"><span > Please Proceed To</span></p>
<p class="error-title" style=" font-weight: ;font-size:50px;font-family: Times New Roman, Times, serif;color: #fff"><span id="ruang"></span></p>
<!-- <div><input type="hidden" value="no_antrian" id="no_antrian" /></div>
<div><input type="hidden" value="nama_ruang" id="nama_ruang" /><span style="visibility:hidden" id="nama_ruang"></span></div> -->
</div>
</div>
<div id="listdata" class="card-deck" style="padding-left: 100px;padding-right: 100px;width: 2000px;">
</div> </div>
<div class="card">
<h5 class="card-header">Featured</h5>
<div class="card-body">
<h5 class="card-title">Special title treatment</h5>
<p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div> </div>
</div> </div>
<!-- <div id="box" class="wrap">
<!--
<div class="col-md-7 mt-25">
<div class="card mb-3">
<div class="text-center content-group">
<div><input type="hidden" value="nomer antrian" id="text-to-speech" placeholder="Enter text to speak..."/></div>
<p class="error-title" style=" font-weight: ;font-size:50px;font-family: Times New Roman, Times, serif;color: grey"><span > Number</span></p>
<h1 class="error-title" style=" font-weight: bold;font-size:215px;font-family: Times New Roman, Times, serif;color: red"><span id="no_antrian"></span></h1>
<p class="error-title" style=" font-weight: ;font-size:50px;font-family: Times New Roman, Times, serif;color: grey"><span > Please Proceed To</span></p>
<p class="error-title" style=" font-weight: ;font-size:50px;font-family: Times New Roman, Times, serif;color: red"><span > Ruang 1.1</span></p>
<div><input type="hidden" value="no_antrian" id="no_antrian" /></div>
<div><input type="hidden" value="nama_ruang" id="nama_ruang" /><span style="visibility:hidden" id="nama_ruang"></span></div> -->
<!-- </div>
</div>
</div> --> </div> -->
<!-- /navigation -->
\ No newline at end of file
<div class="container"></div> <div class="container"></div>
<form class="form-inline"> <form class="form-inline">
<div class="form-group form-control-lg "> <div class="form-group form-control-lg ">
......
<script type="text/javascript">
// 1 detik = 1000
window.setTimeout("waktu()",1000);
function waktu() {
var tanggal = new Date();
setTimeout("waktu()",1000);
document.getElementById("tanggalku").innerHTML
= tanggal.getHours()+":"+tanggal.getMinutes()+":"+tanggal.getSeconds();
}
</script>
<!-- Page header -->
<div class="page-header" style="border-bottom: 0px solid #ddd0;">
<!-- Header content -->
<div class="page-header-content">
<div class="page-title">
<div style=" text-align: center;color: #808080;font-family: Times New Roman, Times, serif;font-size: 50px;font-weight: 600;margin-top:-20px;">
<span id="tanggalku"></span>
</div>
<div style="text-align: center;color: #808080;font-family: Times New Roman, Times, serif;font-size: 17px;font-weight: 600;margin-top:-20px;">
<?php echo $this->today; ?>
</div>
</div>
</div>
<!-- /header content -->
</div>
<!-- /page header -->
<div id="box" class="wrap">
\ No newline at end of file
...@@ -187,6 +187,7 @@ ...@@ -187,6 +187,7 @@
->prependFile($this->basePath('js/bootstrap.min.js')) ->prependFile($this->basePath('js/bootstrap.min.js'))
->prependFile($this->basePath('js/jquery-3.1.0.min.js')) ->prependFile($this->basePath('js/jquery-3.1.0.min.js'))
->prependFile($this->basePath('/tamplate/js/bootbox.all.min.js')) ->prependFile($this->basePath('/tamplate/js/bootbox.all.min.js'))
//->prependFile($this->basePath('/js/jquery.nicescroll.js')) //->prependFile($this->basePath('/js/jquery.nicescroll.js'))
// ->prependFile($this->basePath('/js/jquery.seat-charts.js')) // ->prependFile($this->basePath('/js/jquery.seat-charts.js'))
// ->prependFile($this->basePath('/js/jquery.seat-charts.min.js')) // ->prependFile($this->basePath('/js/jquery.seat-charts.min.js'))
......
...@@ -30,18 +30,14 @@ ...@@ -30,18 +30,14 @@
width: 100wh; width: 100wh;
height: 90vh; height: 90vh;
color: #fff; color: #fff;
background-color: #4d5dfb; background: linear-gradient(-45deg, #EE7752, #E73C7E, #23A6D5, #23D5AB);
background: linear-gradient(to right, #f05053 80%, #e1eec3);
background-size: 400% 400%; background-size: 400% 400%;
-webkit-animation: Gradient 15s ease infinite; -webkit-animation: Gradient 15s ease infinite;
-moz-animation: Gradient 15s ease infinite; -moz-animation: Gradient 15s ease infinite;
animation: Gradient 15s ease infinite; animation: Gradient 15s ease infinite;
overflow: hidden; overflow: hidden;
} }
@-webkit-keyframes Gradient { @-webkit-keyframes Gradient {
0% { 0% {
background-position: 0% 50% background-position: 0% 50%
...@@ -89,6 +85,7 @@ ...@@ -89,6 +85,7 @@
<?= $this->headScript() <?= $this->headScript()
->prependFile($this->basePath('js/bootstrap.min.js')) ->prependFile($this->basePath('js/bootstrap.min.js'))
->prependFile($this->basePath('js/jquery-3.1.0.min.js')) ->prependFile($this->basePath('js/jquery-3.1.0.min.js'))
->prependFile($this->basePath('js/pusher.js'))
?> ?>
......
This diff is collapsed.
// alert(id); //alert(id);
loaddatapasien(id) loaddatapasien(id)
function loaddatapasien(param) { function loaddatapasien(param) {
...@@ -39,11 +39,6 @@ function loaddatapasien(param) { ...@@ -39,11 +39,6 @@ function loaddatapasien(param) {
}); });
} }
$('#tambah').on('click', function () { $('#tambah').on('click', function () {
savedataaja(); savedataaja();
}) })
...@@ -89,6 +84,7 @@ function savedataaja() { ...@@ -89,6 +84,7 @@ function savedataaja() {
console.log(response); console.log(response);
let $id = response.data[0].id_antrian; let $id = response.data[0].id_antrian;
console.log($id);
let $encodedId = btoa($id); let $encodedId = btoa($id);
......
...@@ -16,7 +16,7 @@ $(document).ready(function () { ...@@ -16,7 +16,7 @@ $(document).ready(function () {
separator: ':', separator: ':',
duration: true, duration: true,
minimum: '06:00', minimum: '06:00',
maximum: '18:00', maximum: '24:00',
durationNegative: true durationNegative: true
}); });
}); });
...@@ -37,7 +37,7 @@ $(document).ready(function () { ...@@ -37,7 +37,7 @@ $(document).ready(function () {
separator: ':', separator: ':',
duration: true, duration: true,
minimum: '00:00', minimum: '00:00',
maximum: '23:00', maximum: '24:00',
durationNegative: true durationNegative: true
}); });
}); });
...@@ -47,8 +47,8 @@ $(document).ready(function () { ...@@ -47,8 +47,8 @@ $(document).ready(function () {
required: true, required: true,
separator: ':', separator: ':',
duration: true, duration: true,
minimum: '00:10', minimum: '00:01',
maximum: '00:20', maximum: '00:59',
durationNegative: true durationNegative: true
}); });
}); });
...@@ -138,10 +138,23 @@ function loadpoli() { ...@@ -138,10 +138,23 @@ function loadpoli() {
for (var i = 0; i < res.length; i++) { for (var i = 0; i < res.length; i++) {
optionseg += '<option value="' + res[i].id_poli + '">' + res[i].nama_poli + '</option>'; optionseg += '<option value="' + res[i].id_poli + '">' + res[i].nama_poli + '</option>';
} }
$("select#poli").html(optionseg); $("select#poli").html(optionseg);
} else { } else {
bootbox.alert({ message: 'Data Poli Kosong', centerVertical: true }); bootbox.dialog({
message: "<span class='bigger-110'>" + result['info'] + "</span>",
buttons:
{
"OK":
{
"label": "<i class='icon-ok'></i> OK ",
"className": "btn-sm btn-danger",
"callback": function () {
notifyCancel('ERROR: ' + result['info'] + '. Bila ada kesulitan dimohon untuk menghubungi Admin terkait');
}
}
}
});
} }
} }
}); });
......
loadantrianumum();
function loadantrianumum() {
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadantrian',
success: function (result) {
// console.log(result);
// console.log(result.data);
$('loadantrian').empty();
if (result.code == 0) {
var res = result['data'];
let hasil = '';
for (var i = 0; i < res.length; i++) {
hasil += "<div class='box one" + i + "'> <div class='date'> <h4 >" + res[i]['nama_poli'] + "</h4> <h4 >" + res[i]['nama_ruang'] + "</h4></div> <div class='poster p" + i + "'> <h4 >" + res[i]['kode_dokter'] + "" + res[i]['no_antrian'] + "</h4> </div> </div>"
}
$("#box").append(hasil);
} else {
alert(result.info);
}
},
error: function (xhr) {
console.log('ERROR AJAX:' + xhr.status + '-' + xhr.statusText);
}
});
}
//alert(id);
loadantrian(id_poli);
function loadantrian(param) {
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + `/api/loadantrian`,
data: {
id_poli: param,
},
success: function (result) {
console.log(result);
// $('.loaddata').empty();
// console.log(result);
if (result['code'] == 0) {
var res = result['data'];
$("#listdata").empty();
$('#no_antrian').empty();
let hasil = '';
for (var i = 0; i < res.length; i++) {
$('#no_antrian').empty();
$('#no_antrian').append("-");
if(res[i]['status_code']==30){
valTemp= res[i]['kode_dokter'] + res[i]['no_antrian'];
$('#no_antrian').empty();
$('#no_antrian').append(valTemp);
ruang= res[i]['nama_ruang'];
$('#ruang').empty();
$('#ruang').append(ruang);
}else{
$('#no_antrian').append("-");
}
hasil =
`
<div class="card col-sm-2" style="border-color: #e94c72;background: #faebd73b; width: 20rem;">
<div class="alert alert-info alert-styled-left alert-arrow-left alert-component" style="background: #faebd73b;">
<div><input type="hidden" value="nomer antrian" id="text-to-speech" placeholder="Enter text to speak..."/></div>
<h1 class="error-title" style=" font-weight:;font-size:53px;font-family: Times New Roman, Times, serif;color: #fff"><span > `+res[i]['kode_dokter']+`-`+res[i]['no_antrian']+` </span></h1>
</div>
<div><input type="hidden" value="no_antrian" id="no_antrian" /></div>
<div><input type="hidden" value="nama_ruang" id="nama_ruang" /><span style="visibility:hidden" id="nama_ruang"></span></div>
</div>
`
$("#listdata").append(hasil);
}
} else {
$('#no_antrian').empty();
$('#no_antrian').append("-");
}
},
error: function (xhr) {
alert(xhr.status + '-' + xhr.statusText);
}
});
}
loadpoli(); loadpoli();
$('#pilih').on('click', function () { $('#pilih').on('click', function () {
// let poli = $("#poli option:selected").attr("value"); loaddatadokter()
window.location.href = ("tampilanantrian");
}); });
function loaddatadokter() {
let poli =$("#antrian_poli option:selected").attr("value");
console.log(poli);
/* save data */
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadpoli',
data: {
id_poli: poli,
},
success: function (response) {
if (response['code'] == 0) {
console.log(response);
let $id = poli;
console.log($id)
let $encodedId = btoa($id);
window.location.href = ("/umum/umumtampilan/" + $encodedId);
} else {
bootbox.alert({ message: ' gagal', centerVertical: true });
}
}, error: function (xhr) {
if (xhr.status != 200) {
//bootbox.alert(xhr.status + "-" + xhr.statusText + " <br>Silahkan coba kembali :) ");
} else {
alert('data tidak ada');
}
}
});
}
function loadpoli() { function loadpoli() {
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
dataType: 'json', dataType: 'json',
...@@ -13,7 +53,7 @@ function loadpoli() { ...@@ -13,7 +53,7 @@ function loadpoli() {
success: function (result) { success: function (result) {
if (result['code'] == 0) { if (result['code'] == 0) {
//console.log (result); console.log (result);
var res = result['data']; var res = result['data'];
optionseg = ''; optionseg = '';
optionseg += '<option value="Pilih" disabled selected>Pilih</option>'; optionseg += '<option value="Pilih" disabled selected>Pilih</option>';
...@@ -21,22 +61,60 @@ function loadpoli() { ...@@ -21,22 +61,60 @@ function loadpoli() {
optionseg += '<option value="' + res[i].id_poli + '">' + res[i].nama_poli + '</option>'; optionseg += '<option value="' + res[i].id_poli + '">' + res[i].nama_poli + '</option>';
} }
$("select#antrian_poli").html(optionseg); $("select#antrian_poli").html(optionseg);
let $id = result.data[0].id_poli;
// let $id = result.data['id_poli'];
// console.log($id);
} else { } else {
bootbox.dialog({
message: "<span class='bigger-110'>" + result['info'] + "</span>",
buttons:
{
"OK":
{
"label": "<i class='icon-ok'></i> OK ",
"className": "btn-sm btn-danger",
"callback": function () {
notifyCancel('ERROR: ' + result['info'] + '. Bila ada kesulitan dimohon untuk menghubungi Admin terkait');
}
}
}
});
} }
} }
}); });
} }
// function loadantriandata() {
// $.ajax({
// type: 'POST',
// dataType: 'json',
// url: baseURL + '/api/loadpoli',
// success: function (result) {
// if (result['code'] == 0) {
// console.log (result);
// var res = result['data'];
// optionseg = '';
// optionseg += '<option value="Pilih" disabled selected>Pilih</option>';
// for (var i = 0; i < res.length; i++) {
// optionseg += '<option value="' + res[i].id_poli + '">' + res[i].nama_poli + '</option>';
// }
// $("select#antrian_poli").html(optionseg);
// let $id = result.data[0].id_poli;
// // let $id = result.data['id_poli'];
// console.log($id);
// let $encodedId = btoa($id);
// window.location = (baseURL + "/umum/umumtampilan/"+$encodedId);
// } else {
// bootbox.dialog({
// message: "<span class='bigger-110'>" + result['info'] + "</span>",
// buttons:
// {
// "OK":
// {
// "label": "<i class='icon-ok'></i> OK ",
// "className": "btn-sm btn-danger",
// "callback": function () {
// notifyCancel('ERROR: ' + result['info'] + '. Bila ada kesulitan dimohon untuk menghubungi Admin terkait');
// }
// }
// }
// });
// }
// }
// });
// }
\ No newline at end of file
This diff is collapsed.
...@@ -60,7 +60,7 @@ class ClassLoader ...@@ -60,7 +60,7 @@ class ClassLoader
public function getPrefixes() public function getPrefixes()
{ {
if (!empty($this->prefixesPsr0)) { if (!empty($this->prefixesPsr0)) {
return call_user_func_array('array_merge', $this->prefixesPsr0); return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
} }
return array(); return array();
...@@ -279,7 +279,7 @@ class ClassLoader ...@@ -279,7 +279,7 @@ class ClassLoader
*/ */
public function setApcuPrefix($apcuPrefix) public function setApcuPrefix($apcuPrefix)
{ {
$this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null; $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
} }
/** /**
...@@ -377,11 +377,11 @@ class ClassLoader ...@@ -377,11 +377,11 @@ class ClassLoader
$subPath = $class; $subPath = $class;
while (false !== $lastPos = strrpos($subPath, '\\')) { while (false !== $lastPos = strrpos($subPath, '\\')) {
$subPath = substr($subPath, 0, $lastPos); $subPath = substr($subPath, 0, $lastPos);
$search = $subPath.'\\'; $search = $subPath . '\\';
if (isset($this->prefixDirsPsr4[$search])) { if (isset($this->prefixDirsPsr4[$search])) {
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
foreach ($this->prefixDirsPsr4[$search] as $dir) { foreach ($this->prefixDirsPsr4[$search] as $dir) {
$length = $this->prefixLengthsPsr4[$first][$search]; if (file_exists($file = $dir . $pathEnd)) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
return $file; return $file;
} }
} }
......
...@@ -7,4 +7,5 @@ $baseDir = dirname($vendorDir); ...@@ -7,4 +7,5 @@ $baseDir = dirname($vendorDir);
return array( return array(
'10a6847eba8a430a134fad89f4a30a26' => $vendorDir . '/zendframework/zend-cache/autoload/patternPluginManagerPolyfill.php', '10a6847eba8a430a134fad89f4a30a26' => $vendorDir . '/zendframework/zend-cache/autoload/patternPluginManagerPolyfill.php',
'3109cb1a231dcd04bee1f9f620d46975' => $vendorDir . '/paragonie/sodium_compat/autoload.php',
); );
...@@ -28,7 +28,9 @@ return array( ...@@ -28,7 +28,9 @@ return array(
'Zend\\Cache\\' => array($vendorDir . '/zendframework/zend-cache/src'), 'Zend\\Cache\\' => array($vendorDir . '/zendframework/zend-cache/src'),
'ZF\\DevelopmentMode\\' => array($vendorDir . '/zfcampus/zf-development-mode/src'), 'ZF\\DevelopmentMode\\' => array($vendorDir . '/zfcampus/zf-development-mode/src'),
'RestApi\\' => array($vendorDir . '/multidots/zf3-rest-api/src'), 'RestApi\\' => array($vendorDir . '/multidots/zf3-rest-api/src'),
'Pusher\\' => array($vendorDir . '/pusher/pusher-php-server/src'),
'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'), 'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'),
'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
'Psr\\Container\\' => array($vendorDir . '/psr/container/src'), 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'),
'Psr\\Cache\\' => array($vendorDir . '/psr/cache/src'), 'Psr\\Cache\\' => array($vendorDir . '/psr/cache/src'),
'Khansia\\' => array($vendorDir . '/Khansia'), 'Khansia\\' => array($vendorDir . '/Khansia'),
......
...@@ -13,6 +13,9 @@ class ComposerAutoloaderInitfe7d3cb9e3e556360705ee29bb11bde9 ...@@ -13,6 +13,9 @@ class ComposerAutoloaderInitfe7d3cb9e3e556360705ee29bb11bde9
} }
} }
/**
* @return \Composer\Autoload\ClassLoader
*/
public static function getLoader() public static function getLoader()
{ {
if (null !== self::$loader) { if (null !== self::$loader) {
......
...@@ -8,6 +8,7 @@ class ComposerStaticInitfe7d3cb9e3e556360705ee29bb11bde9 ...@@ -8,6 +8,7 @@ class ComposerStaticInitfe7d3cb9e3e556360705ee29bb11bde9
{ {
public static $files = array ( public static $files = array (
'10a6847eba8a430a134fad89f4a30a26' => __DIR__ . '/..' . '/zendframework/zend-cache/autoload/patternPluginManagerPolyfill.php', '10a6847eba8a430a134fad89f4a30a26' => __DIR__ . '/..' . '/zendframework/zend-cache/autoload/patternPluginManagerPolyfill.php',
'3109cb1a231dcd04bee1f9f620d46975' => __DIR__ . '/..' . '/paragonie/sodium_compat/autoload.php',
); );
public static $prefixLengthsPsr4 = array ( public static $prefixLengthsPsr4 = array (
...@@ -41,7 +42,9 @@ class ComposerStaticInitfe7d3cb9e3e556360705ee29bb11bde9 ...@@ -41,7 +42,9 @@ class ComposerStaticInitfe7d3cb9e3e556360705ee29bb11bde9
), ),
'P' => 'P' =>
array ( array (
'Pusher\\' => 7,
'Psr\\SimpleCache\\' => 16, 'Psr\\SimpleCache\\' => 16,
'Psr\\Log\\' => 8,
'Psr\\Container\\' => 14, 'Psr\\Container\\' => 14,
'Psr\\Cache\\' => 10, 'Psr\\Cache\\' => 10,
), ),
...@@ -153,10 +156,18 @@ class ComposerStaticInitfe7d3cb9e3e556360705ee29bb11bde9 ...@@ -153,10 +156,18 @@ class ComposerStaticInitfe7d3cb9e3e556360705ee29bb11bde9
array ( array (
0 => __DIR__ . '/..' . '/multidots/zf3-rest-api/src', 0 => __DIR__ . '/..' . '/multidots/zf3-rest-api/src',
), ),
'Pusher\\' =>
array (
0 => __DIR__ . '/..' . '/pusher/pusher-php-server/src',
),
'Psr\\SimpleCache\\' => 'Psr\\SimpleCache\\' =>
array ( array (
0 => __DIR__ . '/..' . '/psr/simple-cache/src', 0 => __DIR__ . '/..' . '/psr/simple-cache/src',
), ),
'Psr\\Log\\' =>
array (
0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
),
'Psr\\Container\\' => 'Psr\\Container\\' =>
array ( array (
0 => __DIR__ . '/..' . '/psr/container/src', 0 => __DIR__ . '/..' . '/psr/container/src',
......
This diff is collapsed.
The MIT License (MIT)
Copyright (c) 2015 Paragon Initiative Enterprises
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
#!/usr/bin/env bash
basedir=$( dirname $( readlink -f ${BASH_SOURCE[0]} ) )
php -dphar.readonly=0 "$basedir/other/build_phar.php" $*
\ No newline at end of file
{
"name": "paragonie/random_compat",
"description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
"keywords": [
"csprng",
"random",
"polyfill",
"pseudorandom"
],
"license": "MIT",
"type": "library",
"authors": [
{
"name": "Paragon Initiative Enterprises",
"email": "security@paragonie.com",
"homepage": "https://paragonie.com"
}
],
"support": {
"issues": "https://github.com/paragonie/random_compat/issues",
"email": "info@paragonie.com",
"source": "https://github.com/paragonie/random_compat"
},
"require": {
"php": "^7"
},
"require-dev": {
"vimeo/psalm": "^1",
"phpunit/phpunit": "4.*|5.*"
},
"suggest": {
"ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
}
}
-----BEGIN PUBLIC KEY-----
MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEEd+wCqJDrx5B4OldM0dQE0ZMX+lx1ZWm
pui0SUqD4G29L3NGsz9UhJ/0HjBdbnkhIK5xviT0X5vtjacF6ajgcCArbTB+ds+p
+h7Q084NuSuIpNb6YPfoUFgC/CL9kAoc
-----END PUBLIC KEY-----
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (MingW32)
iQEcBAABAgAGBQJWtW1hAAoJEGuXocKCZATaJf0H+wbZGgskK1dcRTsuVJl9IWip
QwGw/qIKI280SD6/ckoUMxKDCJiFuPR14zmqnS36k7N5UNPnpdTJTS8T11jttSpg
1LCmgpbEIpgaTah+cELDqFCav99fS+bEiAL5lWDAHBTE/XPjGVCqeehyPYref4IW
NDBIEsvnHPHPLsn6X5jq4+Yj5oUixgxaMPiR+bcO4Sh+RzOVB6i2D0upWfRXBFXA
NNnsg9/zjvoC7ZW73y9uSH+dPJTt/Vgfeiv52/v41XliyzbUyLalf02GNPY+9goV
JHG1ulEEBJOCiUD9cE1PUIJwHA/HqyhHIvV350YoEFiHl8iSwm7SiZu5kPjaq74=
=B6+8
-----END PGP SIGNATURE-----
<?php
/**
* Random_* Compatibility Library
* for using the new PHP 7 random_* API in PHP 5 projects
*
* @version 2.99.99
* @released 2018-06-06
*
* The MIT License (MIT)
*
* Copyright (c) 2015 - 2018 Paragon Initiative Enterprises
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
// NOP
<?php
$dist = dirname(__DIR__).'/dist';
if (!is_dir($dist)) {
mkdir($dist, 0755);
}
if (file_exists($dist.'/random_compat.phar')) {
unlink($dist.'/random_compat.phar');
}
$phar = new Phar(
$dist.'/random_compat.phar',
FilesystemIterator::CURRENT_AS_FILEINFO | \FilesystemIterator::KEY_AS_FILENAME,
'random_compat.phar'
);
rename(
dirname(__DIR__).'/lib/random.php',
dirname(__DIR__).'/lib/index.php'
);
$phar->buildFromDirectory(dirname(__DIR__).'/lib');
rename(
dirname(__DIR__).'/lib/index.php',
dirname(__DIR__).'/lib/random.php'
);
/**
* If we pass an (optional) path to a private key as a second argument, we will
* sign the Phar with OpenSSL.
*
* If you leave this out, it will produce an unsigned .phar!
*/
if ($argc > 1) {
if (!@is_readable($argv[1])) {
echo 'Could not read the private key file:', $argv[1], "\n";
exit(255);
}
$pkeyFile = file_get_contents($argv[1]);
$private = openssl_get_privatekey($pkeyFile);
if ($private !== false) {
$pkey = '';
openssl_pkey_export($private, $pkey);
$phar->setSignatureAlgorithm(Phar::OPENSSL, $pkey);
/**
* Save the corresponding public key to the file
*/
if (!@is_readable($dist.'/random_compat.phar.pubkey')) {
$details = openssl_pkey_get_details($private);
file_put_contents(
$dist.'/random_compat.phar.pubkey',
$details['key']
);
}
} else {
echo 'An error occurred reading the private key from OpenSSL.', "\n";
exit(255);
}
}
<?php
require_once 'lib/byte_safe_strings.php';
require_once 'lib/cast_to_int.php';
require_once 'lib/error_polyfill.php';
require_once 'other/ide_stubs/libsodium.php';
require_once 'lib/random.php';
$int = random_int(0, 65536);
<?xml version="1.0"?>
<psalm
autoloader="psalm-autoload.php"
stopOnFirstError="false"
useDocblockTypes="true"
>
<projectFiles>
<directory name="lib" />
</projectFiles>
<issueHandlers>
<RedundantConditionGivenDocblockType errorLevel="info" />
<UnresolvableInclude errorLevel="info" />
<DuplicateClass errorLevel="info" />
<InvalidOperand errorLevel="info" />
<UndefinedConstant errorLevel="info" />
<MissingReturnType errorLevel="info" />
<InvalidReturnType errorLevel="info" />
</issueHandlers>
</psalm>
/.idea/
/.php_cs.cache
/box/
/dist/sodium-compat.phar
/dist/sodium-compat.phar.sig
/composer.lock
/vendor/
/psalm.xml
/*
* ISC License
*
* Copyright (c) 2016-2019
* Paragon Initiative Enterprises <security at paragonie dot com>
*
* Copyright (c) 2013-2019
* Frank Denis <j at pureftpd dot org>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
\ No newline at end of file
This diff is collapsed.
build: false
shallow_clone: false
platform:
- x86
- x64
clone_folder: C:\projects\sodium_compat
image: Visual Studio 2017
install:
- cinst -y OpenSSL.Light
- SET PATH=C:\Program Files\OpenSSL;%PATH%
- sc config wuauserv start= auto
- net start wuauserv
- cinst -y php --version 5.6.30
- cd c:\tools\php56
- copy php.ini-production php.ini
- echo date.timezone="UTC" >> php.ini
- echo extension_dir=ext >> php.ini
- echo extension=php_openssl.dll >> php.ini
- cd C:\projects\sodium_compat
- SET PATH=C:\tools\php56;%PATH%
- php.exe -r "readfile('http://getcomposer.org/installer');" | php.exe
- php.exe composer.phar install --prefer-source --no-interaction
test_script:
- cd C:\projects\sodium_compat
- vendor\bin\phpunit.bat tests/Windows32Test.php
<?php
require_once 'autoload.php';
ParagonIE_Sodium_Compat::$fastMult = true;
<?php
require_once 'autoload.php';
define('DO_PEDANTIC_TEST', true);
ParagonIE_Sodium_Compat::$fastMult = true;
<?php
/*
This file should only ever be loaded on PHP 7+
*/
if (PHP_VERSION_ID < 70000) {
return;
}
spl_autoload_register(function ($class) {
$namespace = 'ParagonIE_Sodium_';
// Does the class use the namespace prefix?
$len = strlen($namespace);
if (strncmp($namespace, $class, $len) !== 0) {
// no, move to the next registered autoloader
return false;
}
// Get the relative class name
$relative_class = substr($class, $len);
// Replace the namespace prefix with the base directory, replace namespace
// separators with directory separators in the relative class name, append
// with .php
$file = dirname(__FILE__) . '/src/' . str_replace('_', '/', $relative_class) . '.php';
// if the file exists, require it
if (file_exists($file)) {
require_once $file;
return true;
}
return false;
});
<?php
require_once (dirname(__FILE__) . '/vendor/autoload.php');
if (PHP_VERSION_ID >= 50300) {
require_once (dirname(__FILE__) . '/tests/phpunit-shim.php');
}
<?php
if (PHP_VERSION_ID < 70000) {
if (!is_callable('sodiumCompatAutoloader')) {
/**
* Sodium_Compat autoloader.
*
* @param string $class Class name to be autoloaded.
*
* @return bool Stop autoloading?
*/
function sodiumCompatAutoloader($class)
{
$namespace = 'ParagonIE_Sodium_';
// Does the class use the namespace prefix?
$len = strlen($namespace);
if (strncmp($namespace, $class, $len) !== 0) {
// no, move to the next registered autoloader
return false;
}
// Get the relative class name
$relative_class = substr($class, $len);
// Replace the namespace prefix with the base directory, replace namespace
// separators with directory separators in the relative class name, append
// with .php
$file = dirname(__FILE__) . '/src/' . str_replace('_', '/', $relative_class) . '.php';
// if the file exists, require it
if (file_exists($file)) {
require_once $file;
return true;
}
return false;
}
// Now that we have an autoloader, let's register it!
spl_autoload_register('sodiumCompatAutoloader');
}
} else {
require_once dirname(__FILE__) . '/autoload-php7.php';
}
if (!class_exists('SodiumException', false)) {
require_once dirname(__FILE__) . '/src/SodiumException.php';
}
if (PHP_VERSION_ID >= 50300) {
// Namespaces didn't exist before 5.3.0, so don't even try to use this
// unless PHP >= 5.3.0
require_once dirname(__FILE__) . '/lib/namespaced.php';
require_once dirname(__FILE__) . '/lib/sodium_compat.php';
} else {
require_once dirname(__FILE__) . '/src/PHP52/SplFixedArray.php';
}
if (PHP_VERSION_ID < 70200 || !extension_loaded('sodium')) {
if (PHP_VERSION_ID >= 50300 && !defined('SODIUM_CRYPTO_SCALARMULT_BYTES')) {
require_once dirname(__FILE__) . '/lib/php72compat_const.php';
}
if (PHP_VERSION_ID >= 70000) {
assert(class_exists('ParagonIE_Sodium_Compat'), 'Possible filesystem/autoloader bug?');
} else {
assert(class_exists('ParagonIE_Sodium_Compat'));
}
require_once (dirname(__FILE__) . '/lib/php72compat.php');
}
#!/usr/bin/env bash
curl -LSs https://box-project.github.io/box2/installer.php | php
mkdir ~/box
mv box.phar ~/box/box
PATH=$PATH:~/box/ make -C dist/ build-phar
# PATH=$PATH:~/box/ make -C dist/ sign-phar
{
"name": "paragonie/sodium_compat",
"description": "Pure PHP implementation of libsodium; uses the PHP extension if it exists",
"keywords": [
"PHP",
"cryptography",
"elliptic curve",
"elliptic curve cryptography",
"Pure-PHP cryptography",
"side-channel resistant",
"Curve25519",
"X25519",
"ECDH",
"Elliptic Curve Diffie-Hellman",
"Ed25519",
"RFC 7748",
"RFC 8032",
"EdDSA",
"Edwards-curve Digital Signature Algorithm",
"ChaCha20",
"Salsa20",
"Xchacha20",
"Xsalsa20",
"Poly1305",
"BLAKE2b",
"public-key cryptography",
"secret-key cryptography",
"AEAD",
"Chapoly",
"Salpoly",
"ChaCha20-Poly1305",
"XSalsa20-Poly1305",
"XChaCha20-Poly1305",
"encryption",
"authentication",
"libsodium"
],
"license": "ISC",
"authors": [
{
"name": "Paragon Initiative Enterprises",
"email": "security@paragonie.com"
},
{
"name": "Frank Denis",
"email": "jedisct1@pureftpd.org"
}
],
"autoload": {
"files": ["autoload.php"]
},
"repositories": [
{
"type": "git",
"url": "https://github.com/garex/phpunit"
},
{
"type": "git",
"url": "https://github.com/garex/phpunit-mock-objects"
}
],
"require": {
"php": "^5.2.4|^5.3|^5.4|^5.5|^5.6|^7|^8",
"xrstf/composer-php52": "1.*",
"paragonie/random_compat": ">=1"
},
"minimum-stability": "dev",
"require-dev": {
"phpunit/phpunit-php52": "dev-3.6.12-php52",
"phpunit/phpunit-mock-objects-php52": "dev-1.1.0-php52"
},
"scripts": {
"post-install-cmd": [
"xrstf\\Composer52\\Generator::onPostInstallCmd"
],
"post-update-cmd": [
"xrstf\\Composer52\\Generator::onPostInstallCmd"
],
"post-autoload-dump": [
"xrstf\\Composer52\\Generator::onPostInstallCmd"
]
},
"suggest": {
"ext-libsodium": "PHP < 7.0: Better performance, password hashing (Argon2i), secure memory management (memzero), and better security.",
"ext-sodium": "PHP >= 7.0: Better performance, password hashing (Argon2i), secure memory management (memzero), and better security."
}
}
{
"name": "paragonie/sodium_compat",
"description": "Pure PHP implementation of libsodium; uses the PHP extension if it exists",
"keywords": [
"PHP",
"cryptography",
"elliptic curve",
"elliptic curve cryptography",
"Pure-PHP cryptography",
"side-channel resistant",
"Curve25519",
"X25519",
"ECDH",
"Elliptic Curve Diffie-Hellman",
"Ed25519",
"RFC 7748",
"RFC 8032",
"EdDSA",
"Edwards-curve Digital Signature Algorithm",
"ChaCha20",
"Salsa20",
"Xchacha20",
"Xsalsa20",
"Poly1305",
"BLAKE2b",
"public-key cryptography",
"secret-key cryptography",
"AEAD",
"Chapoly",
"Salpoly",
"ChaCha20-Poly1305",
"XSalsa20-Poly1305",
"XChaCha20-Poly1305",
"encryption",
"authentication",
"libsodium"
],
"license": "ISC",
"authors": [
{
"name": "Paragon Initiative Enterprises",
"email": "security@paragonie.com"
},
{
"name": "Frank Denis",
"email": "jedisct1@pureftpd.org"
}
],
"autoload": {
"files": ["autoload.php"]
},
"require": {
"php": "^5.2.4|^5.3|^5.4|^5.5|^5.6|^7|^8",
"paragonie/random_compat": ">=1"
},
"require-dev": {
"phpunit/phpunit": "^3|^4|^5|^6|^7"
},
"suggest": {
"ext-libsodium": "PHP < 7.0: Better performance, password hashing (Argon2i), secure memory management (memzero), and better security.",
"ext-sodium": "PHP >= 7.0: Better performance, password hashing (Argon2i), secure memory management (memzero), and better security."
}
}
# This builds sodium-compat.phar. To run this Makefile, `box` and `composer`
# must be installed and in your $PATH. Run it from inside the dist/ directory.
box := $(shell which box)
composer := "composer"
gitcommit := $(shell git rev-parse HEAD)
.PHONY: all
all: build-phar
.PHONY: sign-phar
sign-phar:
gpg -u 7F52D5C61D1255C731362E826B97A1C2826404DA --armor --output sodium-compat.phar.sig --detach-sig sodium-compat.phar
# ensure we run in clean tree. export git tree and run there.
.PHONY: build-phar
build-phar:
@echo "Creating .phar from revision $(shell git rev-parse HEAD)."
rm -rf worktree
install -d worktree
(cd $(CURDIR)/..; git archive HEAD) | tar -x -C worktree
$(MAKE) -f $(CURDIR)/Makefile -C worktree sodium-compat.phar
mv worktree/*.phar .
rm -rf worktree
.PHONY: clean
clean:
rm -vf sodium-compat.phar sodium-compat.phar.sig
# Inside workdir/:
sodium-compat.phar: dist/box.json composer.lock
cp dist/box.json .
php -d phar.readonly=0 $(box) build -c box.json -v
composer.lock:
$(composer) config autoloader-suffix $(gitcommit)
$(composer) install --no-dev
{
"chmod": "0755",
"finder": [
{
"in": "",
"name": "autoload.php"
},
{
"in": "src",
"name": "*.php"
},
{
"in": "lib",
"name": "*.php"
},
{
"in": "vendor/composer",
"name": "*.php"
},
{
"in": "vendor/paragonie",
"name": "*.php"
}
],
"compactors": [
"Herrera\\Box\\Compactor\\Php"
],
"main": "vendor/autoload.php",
"output": "sodium-compat.phar",
"shebang": false,
"stub": true
}
<?php
namespace Sodium;
require_once dirname(dirname(__FILE__)) . '/autoload.php';
use ParagonIE_Sodium_Compat;
const CRYPTO_AEAD_AES256GCM_KEYBYTES = ParagonIE_Sodium_Compat::CRYPTO_AEAD_AES256GCM_KEYBYTES;
const CRYPTO_AEAD_AES256GCM_NSECBYTES = ParagonIE_Sodium_Compat::CRYPTO_AEAD_AES256GCM_NSECBYTES;
const CRYPTO_AEAD_AES256GCM_NPUBBYTES = ParagonIE_Sodium_Compat::CRYPTO_AEAD_AES256GCM_NPUBBYTES;
const CRYPTO_AEAD_AES256GCM_ABYTES = ParagonIE_Sodium_Compat::CRYPTO_AEAD_AES256GCM_ABYTES;
const CRYPTO_AEAD_CHACHA20POLY1305_KEYBYTES = ParagonIE_Sodium_Compat::CRYPTO_AEAD_CHACHA20POLY1305_KEYBYTES;
const CRYPTO_AEAD_CHACHA20POLY1305_NSECBYTES = ParagonIE_Sodium_Compat::CRYPTO_AEAD_CHACHA20POLY1305_NSECBYTES;
const CRYPTO_AEAD_CHACHA20POLY1305_NPUBBYTES = ParagonIE_Sodium_Compat::CRYPTO_AEAD_CHACHA20POLY1305_NPUBBYTES;
const CRYPTO_AEAD_CHACHA20POLY1305_ABYTES = ParagonIE_Sodium_Compat::CRYPTO_AEAD_CHACHA20POLY1305_ABYTES;
const CRYPTO_AEAD_CHACHA20POLY1305_IETF_KEYBYTES = ParagonIE_Sodium_Compat::CRYPTO_AEAD_CHACHA20POLY1305_IETF_KEYBYTES;
const CRYPTO_AEAD_CHACHA20POLY1305_IETF_NSECBYTES = ParagonIE_Sodium_Compat::CRYPTO_AEAD_CHACHA20POLY1305_IETF_NSECBYTES;
const CRYPTO_AEAD_CHACHA20POLY1305_IETF_NPUBBYTES = ParagonIE_Sodium_Compat::CRYPTO_AEAD_CHACHA20POLY1305_IETF_NPUBBYTES;
const CRYPTO_AEAD_CHACHA20POLY1305_IETF_ABYTES = ParagonIE_Sodium_Compat::CRYPTO_AEAD_CHACHA20POLY1305_IETF_ABYTES;
const CRYPTO_AUTH_BYTES = ParagonIE_Sodium_Compat::CRYPTO_AUTH_BYTES;
const CRYPTO_AUTH_KEYBYTES = ParagonIE_Sodium_Compat::CRYPTO_AUTH_KEYBYTES;
const CRYPTO_BOX_SEALBYTES = ParagonIE_Sodium_Compat::CRYPTO_BOX_SEALBYTES;
const CRYPTO_BOX_SECRETKEYBYTES = ParagonIE_Sodium_Compat::CRYPTO_BOX_SECRETKEYBYTES;
const CRYPTO_BOX_PUBLICKEYBYTES = ParagonIE_Sodium_Compat::CRYPTO_BOX_PUBLICKEYBYTES;
const CRYPTO_BOX_KEYPAIRBYTES = ParagonIE_Sodium_Compat::CRYPTO_BOX_KEYPAIRBYTES;
const CRYPTO_BOX_MACBYTES = ParagonIE_Sodium_Compat::CRYPTO_BOX_MACBYTES;
const CRYPTO_BOX_NONCEBYTES = ParagonIE_Sodium_Compat::CRYPTO_BOX_NONCEBYTES;
const CRYPTO_BOX_SEEDBYTES = ParagonIE_Sodium_Compat::CRYPTO_BOX_SEEDBYTES;
const CRYPTO_KX_BYTES = ParagonIE_Sodium_Compat::CRYPTO_KX_BYTES;
const CRYPTO_KX_SEEDBYTES = ParagonIE_Sodium_Compat::CRYPTO_KX_SEEDBYTES;
const CRYPTO_KX_PUBLICKEYBYTES = ParagonIE_Sodium_Compat::CRYPTO_KX_PUBLICKEYBYTES;
const CRYPTO_KX_SECRETKEYBYTES = ParagonIE_Sodium_Compat::CRYPTO_KX_SECRETKEYBYTES;
const CRYPTO_GENERICHASH_BYTES = ParagonIE_Sodium_Compat::CRYPTO_GENERICHASH_BYTES;
const CRYPTO_GENERICHASH_BYTES_MIN = ParagonIE_Sodium_Compat::CRYPTO_GENERICHASH_BYTES_MIN;
const CRYPTO_GENERICHASH_BYTES_MAX = ParagonIE_Sodium_Compat::CRYPTO_GENERICHASH_BYTES_MAX;
const CRYPTO_GENERICHASH_KEYBYTES = ParagonIE_Sodium_Compat::CRYPTO_GENERICHASH_KEYBYTES;
const CRYPTO_GENERICHASH_KEYBYTES_MIN = ParagonIE_Sodium_Compat::CRYPTO_GENERICHASH_KEYBYTES_MIN;
const CRYPTO_GENERICHASH_KEYBYTES_MAX = ParagonIE_Sodium_Compat::CRYPTO_GENERICHASH_KEYBYTES_MAX;
const CRYPTO_SCALARMULT_BYTES = ParagonIE_Sodium_Compat::CRYPTO_SCALARMULT_BYTES;
const CRYPTO_SCALARMULT_SCALARBYTES = ParagonIE_Sodium_Compat::CRYPTO_SCALARMULT_SCALARBYTES;
const CRYPTO_SHORTHASH_BYTES = ParagonIE_Sodium_Compat::CRYPTO_SHORTHASH_BYTES;
const CRYPTO_SHORTHASH_KEYBYTES = ParagonIE_Sodium_Compat::CRYPTO_SHORTHASH_KEYBYTES;
const CRYPTO_SECRETBOX_KEYBYTES = ParagonIE_Sodium_Compat::CRYPTO_SECRETBOX_KEYBYTES;
const CRYPTO_SECRETBOX_MACBYTES = ParagonIE_Sodium_Compat::CRYPTO_SECRETBOX_MACBYTES;
const CRYPTO_SECRETBOX_NONCEBYTES = ParagonIE_Sodium_Compat::CRYPTO_SECRETBOX_NONCEBYTES;
const CRYPTO_SIGN_BYTES = ParagonIE_Sodium_Compat::CRYPTO_SIGN_BYTES;
const CRYPTO_SIGN_SEEDBYTES = ParagonIE_Sodium_Compat::CRYPTO_SIGN_SEEDBYTES;
const CRYPTO_SIGN_PUBLICKEYBYTES = ParagonIE_Sodium_Compat::CRYPTO_SIGN_PUBLICKEYBYTES;
const CRYPTO_SIGN_SECRETKEYBYTES = ParagonIE_Sodium_Compat::CRYPTO_SIGN_SECRETKEYBYTES;
const CRYPTO_SIGN_KEYPAIRBYTES = ParagonIE_Sodium_Compat::CRYPTO_SIGN_KEYPAIRBYTES;
const CRYPTO_STREAM_KEYBYTES = ParagonIE_Sodium_Compat::CRYPTO_STREAM_KEYBYTES;
const CRYPTO_STREAM_NONCEBYTES = ParagonIE_Sodium_Compat::CRYPTO_STREAM_NONCEBYTES;
<?php
require_once dirname(dirname(__FILE__)) . '/autoload.php';
if (PHP_VERSION_ID < 50300) {
return;
}
/*
* This file is just for convenience, to allow developers to reduce verbosity when
* they add this project to their libraries.
*
* Replace this:
*
* $x = ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_encrypt(...$args);
*
* with this:
*
* use ParagonIE\Sodium\Compat;
*
* $x = Compat::crypto_aead_xchacha20poly1305_encrypt(...$args);
*/
spl_autoload_register(function ($class) {
if ($class[0] === '\\') {
$class = substr($class, 1);
}
$namespace = 'ParagonIE\\Sodium';
// Does the class use the namespace prefix?
$len = strlen($namespace);
if (strncmp($namespace, $class, $len) !== 0) {
// no, move to the next registered autoloader
return false;
}
// Get the relative class name
$relative_class = substr($class, $len);
// Replace the namespace prefix with the base directory, replace namespace
// separators with directory separators in the relative class name, append
// with .php
$file = dirname(dirname(__FILE__)) . '/namespaced/' . str_replace('\\', '/', $relative_class) . '.php';
// if the file exists, require it
if (file_exists($file)) {
require_once $file;
return true;
}
return false;
});
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<?php
namespace ParagonIE\Sodium;
class Compat extends \ParagonIE_Sodium_Compat
{
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment