| Server IP : 37.9.174.138 / Your IP : 216.73.216.117 Web Server : Apache System : Linux vps6.backend.sk 6.12.100+deb13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.100-1 (2026-07-30) x86_64 User : ftpuser ( 1001) PHP Version : 8.4.24 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/backend-accounting.sk/app/doc/ |
Upload File : |
<?php
require '../config.php';
require '../app/classes/App.php';
require '../vendor/autoload.php';
require '../vendor/google/recaptcha/src/autoload.php';
$app = App::run();
?>
<html lang="sk">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="/lib/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="/lib/bootstrap/css/docs.css" rel="stylesheet">
<link href="/bower_components/notific8/dist/notific8.css" rel="stylesheet">
<title>ENBRA - SV</title>
</head>
<body style="margin-top: 70px;">
<?php
$modules = scandir(DOCUMENT_ROOT . "modules");
foreach ($modules as $key => $module) {
if ($module !== "." && $module !== "..") {
$modulePath = DOCUMENT_ROOT . "modules/" . $module . "/";
$moduleName = $module;
if (file_exists($modulePath . "config.ini")) {
$moduleConfig = parse_ini_file($modulePath . "config.ini", true, INI_SCANNER_TYPED);
if (!isset($moduleConfig["documentation"]) || !isset($moduleConfig["documentation"]["enabled"]) || $moduleConfig["documentation"]["enabled"] !== true) {
unset($modules[$key]);
continue;
} else {
$moduleConfig = $moduleConfig["documentation"];
}
$moduleName = isset($moduleConfig["name"]) ? $moduleConfig["name"] : $moduleName;
} else {
unset($modules[$key]);
continue;
}
$modules[$key] = array(
"name" => $moduleName,
"folder" => $module,
"path" => $modulePath
);
} else {
unset($modules[$key]);
}
}
?>
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#home">ENBRA - SV</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<?php foreach ($modules as $module) { ?>
<li><a href="#<?php echo $module["folder"] ?>"><?php echo $module["name"] ?></a></li>
<?php } ?>
</ul>
</div>
</div>
</nav>
<div class="container">
<div class="anchor" id="home"></div>
<?php
$protocol = "http";
if (isset($_SERVER['HTTPS']) &&
($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) ||
isset($_SERVER['HTTP_X_FORWARDED_PROTO']) &&
$_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
$protocol = "https";
}
?>
<div class="bs-callout bs-callout-danger" id="callout-popover-needs-tooltip"> <h4>API DOCUMENTATION</h4> <p>Version <?php echo $app->getConfig("version"); ?></p> <p>BASE URL: <?php echo $protocol . "://" . $_SERVER['HTTP_HOST'] . "/" ?></p> </div>
<div class="bs-callout" id="callout-popover-needs-tooltip"> <h4>RESPONSE STRUCTURE</h4>
{ <br>
  code: INT (0 on success) <i>//see DOC below</i> <br>
  status: STRING (HTTP REPONSE CODE + HTTP RESPONSE STATUS) <i>//see DOC below</i> <br>
  message: STRING <br>
  data: ARRAY <br>
} <br>
<br><br>
<h4 style="color: #3c763d !important">SUCCESS RESPONSE EXAMPLE</h4>
<p>
<b>QUERY: </b>/api/users/users/getAuthToken/
<br>
<b>HTTP REPONSE: </b>HTTP/1.1 200 OK
</p>
{<br>
  code: 0, <br>
  status: "200 OK", <br>
  message: "Success.", <br>
  data:
<br>  { <br>
    authToken: "test@test.com|9381e615196df49ce27d3ea77ded2d7353e0c6fe318139e183e8b25c0dbb4f2d"
<br>
  }<br>
}
<br><br>
<h4 style="color: #ce4844 !important">ERROR RESPONSE EXAMPLE</h4>
<p>
<b>QUERY: </b>/api/users/users/getAuthToken/
<br>
<b>HTTP REPONSE: </b>HTTP/1.1 401 Unauthorized
</p>
{<br>
  code: 40102, <br>
  status: "401 Unauthorized", <br>
  message: "Nesprávne meno alebo heslo", <br>
  data: [] <br>
}
</div>
<div class="bs-callout bs-callout-warning" id="callout-popover-needs-tooltip"> <h4>USER AUTHORIZATION</h4>
<p>
If API endpoint requires authorization, you must send in header Authorization Token: <br>
Authorization: test@test.com|9381e615196df49ce27d3ea77ded2d7353e0c6fe318139e183e8b25c0dbb4f2d
<br><br>
<b>Authorization token is valid at least two hours.</b><br>
<b>If token expired and API endpoint requires authorization, you will get 401 Unauthorized HTTP reponse with <font color="red">code 40103</font>. You must get new AuthToken calling <i>/api/users/users/getAuthToken/</i> described below.</b>
</p>
</div>
<div class="bs-callout" id="callout-popover-needs-tooltip"> <h4>NOTIFICATION STRUCTURE</h4>
<?php require 'returns/notification_template.php'; ?>
</div>
<?php
foreach ($modules as $module) {
$classes = array();
if (file_exists($module["path"] . "api")) {
$classes = array_merge($classes, array_map(function($val) {
return $val === "." || $val === ".." ? $val : "\\api\\" . $val;
}, scandir($module["path"] . "api")));
}
if (file_exists($module["path"] . "admin/api")) {
$classes = array_merge($classes, array_map(function($val) {
return $val === "." || $val === ".." ? $val : "\\admin\\api\\" . $val;
}, scandir($module["path"] . "admin/api")));
}
if (count($classes) === 0) {
continue;
}
?>
<div class="anchor" id="<?php echo $module["folder"] ?>"></div>
<div style="margin-top: 15px;" class="panel panel-primary">
<div class="panel-heading">
<h2 style="margin-top: 10px;"><?php echo $module["name"] ?></h2>
</div>
<div class="panel-body" style="margin-top: -15px;">
<div class="row">
<ul class="nav nav-pills" style="background: #f7f7f7;">
<?php
foreach ($classes as $classFileName) {
if ($classFileName !== "." && $classFileName !== "..") {
$className = "modules" . "\\" . $module["folder"] . str_replace(".php", "", $classFileName);
$classAnnotationReader = new \app\classes\AnnotationReader($className);
if ($classAnnotationReader->getParameter("includeInDoc") === true) {
?>
<li><a style="border-radius: 0px;" href="#<?php echo $module["folder"] . str_replace(".php", "", substr($classFileName, strripos($classFileName, "\\") + 1)) ?>"><i class="glyphicon glyphicon-chevron-right"></i> <?php echo str_replace(".php", "", substr($classFileName, strripos($classFileName, "\\") + 1)) ?></a></li>
<?php
}
}
}
?>
</ul>
</div>
<?php
foreach ($classes as $classFileName) {
if ($classFileName !== "." && $classFileName !== "..") {
$className = "modules" . "\\" . $module["folder"] . str_replace(".php", "", $classFileName);
$classExplode = explode("\\", $classFileName);
$classExplode = array_map("lcfirst", $classExplode);
$classFileName = implode("\\", $classExplode);
$classAnnotationReader = new \app\classes\AnnotationReader($className);
if ($classAnnotationReader->getParameter("includeInDoc") === true) {
$title = lcfirst(str_replace(array(".php", "\\", "/api/", "/admin/api/"), array("", "/", "/api/" . lcfirst($module["name"]) . "/", "/api/admin/"), $classFileName));
?>
<h3 class="page-header">
<?php
$titleExplode = explode("/", $title);
$titleExplode[count($titleExplode) - 1] = "<font color='green'><b>" . $titleExplode[count($titleExplode) - 1] . "</b></font>";
echo implode("/", $titleExplode);
?></h3>
<div style="padding-top: 125px; margin-top: -125px;" class="anchor" id="<?php echo $module["folder"] . ucfirst(str_replace(".php", "", substr($classFileName, strripos($classFileName, "\\") + 1))) ?>"></div>
<div class="bs-callout bs-callout-info">
<?php
foreach ($classAnnotationReader->getParameters() as $key => $val) {
if ($key !== "includeInDoc") {
?>
<div class="row">
<div class="col-md-4">
<b>
<?php
$title = preg_replace("([A-Z])", " $0", $key);
echo ucfirst(strtolower($title));
?>
</b>
</div>
<div class="col-md-8">
<?php
echo is_array($val) ? implode(", ", $val) : $val;
?>
</div>
</div>
<?php
}
}
?>
</div>
<?php
foreach (get_class_methods($className) as $classMethod) {
$annotationReader = new \app\classes\AnnotationReader($className, $classMethod);
if ($annotationReader->getParameter("includeInDoc") === true) {
?>
<h4 style="margin-top: 50px;"><span style="padding: 8px;" class="label label-<?php echo $annotationReader->getParameter("requestMethod") === "POST" ? "danger" : "success" ?>"><?php echo $annotationReader->getParameter("requestMethod") ?></span> <?php
$link = lcfirst(str_replace(array(".php", "\\", "/api/", "/admin/api/"), array("", "/", "/api/" . lcfirst($module["name"]) . "/", "/api/admin/"), $classFileName)) . "/" . $classMethod . "/" . (is_array($annotationReader->getParameter("RequiredGetParameters")) && count($annotationReader->getParameter("RequiredGetParameters")) > 0 ? ("?" . implode("&", array_map(function($item) {
return $item . "={" . $item . "}";
}, $annotationReader->getParameter("RequiredGetParameters")))) : "");
$linkExplode = explode("/", $link);
$linkExplode[count($linkExplode) - 2] = "<font color='#337ab7'><b>" . $linkExplode[count($linkExplode) - 2] . "</b></font>";
$linkExplode[count($linkExplode) - 3] = "<font color='green'>" . $linkExplode[count($linkExplode) - 3] . "</font>";
echo implode("/", $linkExplode);
?>
<div class="btn btn-default" data-toggle="tooltip" title="Copy URL" onclick="copyText('<?php echo $link ?>')"><i class="glyphicon glyphicon-duplicate"></i></div>
</h4>
<figure class="highlight">
<?php
foreach ($annotationReader->getParameters() as $key => $val) {
if ($key !== "includeInDoc" && $key !== "requestMethod" && $key !== "requireReturns") {
?>
<div class="row">
<div class="col-md-4">
<b>
<?php
$title = preg_replace("([A-Z])", " $0", $key);
echo ucfirst(strtolower($title));
?>
</b>
</div>
<div class="col-md-8">
<?php
echo is_array($val) ? implode(", ", $val) : $val;
?>
</div>
</div>
<?php
} else if ($key === "requireReturns") {
?>
<div class="row">
<div class="col-md-8 col-md-offset-4">
<?php
require 'returns/' . $val;
?>
</div>
</div>
<?php
}
}
?>
</figure>
<?php
}
}
}
}
}
?>
</div>
</div>
<?php
}
?>
<h3 class="page-header">Response Codes</h3>
<div class="bs-callout bs-callout-warning" id="callout-popover-needs-tooltip">
<table class="table">
<thead>
<tr>
<!--<th>Status</th>-->
<th>Code</th>
<th>HTTP status code</th>
<th>Default message</th>
</tr>
</thead>
<tbody>
<?php foreach (app\constants\ResponseCodes::getConstants() as $key => $val) { ?>
<tr>
<!--<td><?php // echo $key; ?></td>-->
<td><?php echo $val; ?></td>
<td><?php
if ($val === 0) {
$code = 200;
} else
if ($val === 1) {
$code = 500;
} else {
$code = substr($val, 0, 3);
}
echo \app\constants\HttpReponseCodes::getMessageForCode($code);
?></td>
<td><?php echo app\constants\ResponseCodes::getMessageForCode($val); ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<h3 class="page-header">HTTP Response Codes</h3>
<div class="bs-callout bs-callout-warning" id="callout-popover-needs-tooltip">
<table class="table">
<thead>
<tr>
<th>Code</th>
<th>Message</th>
</tr>
</thead>
<tbody>
<?php foreach (\app\constants\HttpReponseCodes::getConstants() as $key => $val) { ?>
<tr>
<td><?php echo $val; ?></td>
<td><?php echo \app\constants\HttpReponseCodes::getMessageForCode($val); ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</body>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script src="/lib/bootstrap/js/bootstrap.min.js"></script>
<script src="/bower_components/notific8/dist/notific8.min.js"></script>
<style>
.anchor{
padding-top: 70px;
position: relative;
margin-top: -70px;
z-index: -1;
}
</style>
<script>
$(document).ready(function () {
$('a[href*="#"]:not([href="#"]):not([data-toggle]):not([role])').click(function () {
if (location.pathname.replace(/^\//, '') === this.pathname.replace(/^\//, '') && location.hostname === this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top
}, 300);
return false;
}
}
});
});
function copyText(text) {
var dummy = document.createElement("textarea");
document.body.appendChild(dummy);
dummy.value = text;
dummy.select();
document.execCommand("copy");
document.body.removeChild(dummy);
notific8("<i class='glyphicon glyphicon-ok'></i> Copied.", {life: 500});
}
$(document).ready(function () {
$('[data-toggle="tooltip"]').tooltip();
});
</script>
</html>