добавлена лицензия в PHP файлы

This commit is contained in:
rsgrinko committed 2022-07-15 00:29:53 +03:00
1 parent 4f1275727b
commit f99506e117
52 files changed
+1287 -260

No files matched your search

+45 -25
View File
@@ -1,4 +1,23 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
use Core\Models\MQ;
@@ -7,7 +26,7 @@
$MQ = new MQ();
ob_start();
?>
<table class="table table-primary mb30">
<table class="table table-primary mb30">
<thead>
<tr>
<th></th>
@@ -65,7 +84,7 @@
}
?>
</tbody>
</table>
</table>
<?php
$result['threads'] = ob_get_clean();
ob_start();
@@ -89,26 +108,26 @@
<tbody>
<?php
$arTasks = $MQ->getTasksHistory(10, 'id', 'desc');
foreach($arTasks as $task) {
foreach ($arTasks as $task) {
?>
<tr class="<?php
if($task['status'] === MQ::STATUS_OK) {
if ($task['status'] === MQ::STATUS_OK) {
echo 'alert-success';
} elseif($task['status'] === MQ::STATUS_ERROR) {
} elseif ($task['status'] === MQ::STATUS_ERROR) {
echo 'alert-danger';
}
?>">
<td><?=$task['id'];?></td>
<td><?=$task['task_id'];?></td>
<td><?=$task['execution_time'];?></td>
<td><?=$task['attempts'];?></td>
<td><?=$task['class'];?></td>
<td><?=$task['method'];?></td>
<td><?=$task['params'];?></td>
<td><?=$task['status'];?></td>
<td><?=$task['response'];?></td>
<td><?=$task['date_created'];?></td>
<td><?=$task['date_updated'];?></td>
<td><?= $task['id']; ?></td>
<td><?= $task['task_id']; ?></td>
<td><?= $task['execution_time']; ?></td>
<td><?= $task['attempts']; ?></td>
<td><?= $task['class']; ?></td>
<td><?= $task['method']; ?></td>
<td><?= $task['params']; ?></td>
<td><?= $task['status']; ?></td>
<td><?= $task['response']; ?></td>
<td><?= $task['date_created']; ?></td>
<td><?= $task['date_updated']; ?></td>
</tr>
<?php
}
@@ -132,11 +151,11 @@
<tbody>
<tr>
<td><?=$MQ->getCountTasks();?></td>
<td><?=$MQ->getCountWorkers() . ' / ' . MQ::WORKERS_LIMIT;?></td>
<td><?=$MQ->getCountTasks(['active' => 'Y']);?></td>
<td><?=$MQ->getCountTasks(['active' => 'Y', 'in_progress' => 'Y']);?></td>
<td><?=$MQ->getCountTasks(['in_progress' => 'N', 'status' => MQ::STATUS_ERROR]);?></td>
<td><?= $MQ->getCountTasks(); ?></td>
<td><?= $MQ->getCountWorkers() . ' / ' . MQ::WORKERS_LIMIT; ?></td>
<td><?= $MQ->getCountTasks(['active' => 'Y']); ?></td>
<td><?= $MQ->getCountTasks(['active' => 'Y', 'in_progress' => 'Y']); ?></td>
<td><?= $MQ->getCountTasks(['in_progress' => 'N', 'status' => MQ::STATUS_ERROR]); ?></td>
</tr>
</tbody>
</table>
@@ -155,9 +174,9 @@
<tbody>
<tr>
<td><?=$MQ->getCountTasksHistory();?></td>
<td><?=$MQ->getCountTasksHistory(['status' => MQ::STATUS_OK]);?></td>
<td><?=$MQ->getCountTasksHistory(['status' => MQ::STATUS_ERROR]);?></td>
<td><?= $MQ->getCountTasksHistory(); ?></td>
<td><?= $MQ->getCountTasksHistory(['status' => MQ::STATUS_OK]); ?></td>
<td><?= $MQ->getCountTasksHistory(['status' => MQ::STATUS_ERROR]); ?></td>
</tr>
</tbody>
</table>
@@ -166,7 +185,8 @@
ob_start();
?>
<div class="progress">
<div style="width: <?=round(($MQ->getCountWorkers() / MQ::WORKERS_LIMIT)*100, 2);?>%" aria-valuemax="100" aria-valuemin="0" aria-valuenow="40" role="progressbar" class="progress-bar progress-bar-warning">
<div style="width: <?= round(($MQ->getCountWorkers() / MQ::WORKERS_LIMIT) * 100, 2); ?>%" aria-valuemax="100" aria-valuemin="0"
aria-valuenow="40" role="progressbar" class="progress-bar progress-bar-warning">
<span class="sr-only">40% Complete (success)</span>
</div>
</div>
+33 -6
View File
@@ -1,5 +1,26 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
use Core\Helpers\{Cache, SystemFunctions};
require_once __DIR__ . '/inc/header.php';
?>
<div class="pageheader">
@@ -38,12 +59,18 @@
$arCacheInfo = Cache::getCacheInfo();
?>
<tr>
<td><?=$arCacheInfo['countAll'] . ' ' . SystemFunctions::numWord($arCacheInfo['countAll'], ['раз', 'раза', 'раз']);?></td>
<td><?=$arCacheInfo['countWrite'] . ' ' . SystemFunctions::numWord($arCacheInfo['countWrite'], ['раз', 'раза', 'раз']);?></td>
<td><?=$arCacheInfo['countRead'] . ' ' . SystemFunctions::numWord($arCacheInfo['countRead'], ['раз', 'раза', 'раз']);?></td>
<td><?=$arCacheInfo['cacheDir'];?></td>
<td><?=$arCacheInfo['cachedCount'] . ' ' . SystemFunctions::numWord($arCacheInfo['cachedCount'], ['элемент', 'элемента', 'элементов']);?></td>
<td><?=SystemFunctions::convertBytes($arCacheInfo['size']);?></td>
<td><?= $arCacheInfo['countAll'] . ' ' . SystemFunctions::numWord($arCacheInfo['countAll'], ['раз', 'раза', 'раз']
); ?></td>
<td><?= $arCacheInfo['countWrite'] . ' ' . SystemFunctions::numWord($arCacheInfo['countWrite'], ['раз', 'раза', 'раз']
); ?></td>
<td><?= $arCacheInfo['countRead'] . ' ' . SystemFunctions::numWord($arCacheInfo['countRead'], ['раз', 'раза', 'раз']
); ?></td>
<td><?= $arCacheInfo['cacheDir']; ?></td>
<td><?= $arCacheInfo['cachedCount'] . ' ' . SystemFunctions::numWord(
$arCacheInfo['cachedCount'],
['элемент', 'элемента', 'элементов']
); ?></td>
<td><?= SystemFunctions::convertBytes($arCacheInfo['size']); ?></td>
</tr>
</tbody>
</table>
+27 -6
View File
@@ -1,5 +1,26 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
use Core\Models\{User, Roles};
require_once __DIR__ . '/inc/header.php';
?>
<div class="pageheader">
@@ -35,14 +56,14 @@
<tbody>
<?php
$arRoles = Roles::getAllRoles();
foreach($arRoles as $role){
foreach ($arRoles as $role) {
?>
<tr>
<td><?= $role['id'];?></td>
<td><?= $role['name'];?></td>
<td><?= $role['description'];?></td>
<td><?= $role['date_created'] ? date('d.m.Y H:i:s', strtotime($role['date_created'])) : '-';?></td>
<td><?= $role['date_updated'] ? date('d.m.Y H:i:s', strtotime($role['date_updated'])) : '-';?></td>
<td><?= $role['id']; ?></td>
<td><?= $role['name']; ?></td>
<td><?= $role['description']; ?></td>
<td><?= $role['date_created'] ? date('d.m.Y H:i:s', strtotime($role['date_created'])) : '-'; ?></td>
<td><?= $role['date_updated'] ? date('d.m.Y H:i:s', strtotime($role['date_updated'])) : '-'; ?></td>
</tr>
<?php
}
+21 -1
View File
@@ -1,10 +1,30 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
use Core\Models\User;
require_once __DIR__ . '/../../core/bootstrap.php';
$userId = User::getCurrentUserId();
if(!empty($userId)) {
if (!empty($userId)) {
$USER = new User($userId);
$arUser = $USER->getAllUserData();
} else {
+29 -8
View File
@@ -1,4 +1,25 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
?>
</div>
@@ -6,15 +27,15 @@
</section>
<script src="//<?php echo $_SERVER['SERVER_NAME'];?>/admin/styles/js/jquery-1.11.1.min.js"></script>
<script src="//<?php echo $_SERVER['SERVER_NAME'];?>/admin/styles/js/jquery-migrate-1.2.1.min.js"></script>
<script src="//<?php echo $_SERVER['SERVER_NAME'];?>/admin/styles/js/bootstrap.min.js"></script>
<script src="//<?php echo $_SERVER['SERVER_NAME'];?>/admin/styles/js/modernizr.min.js"></script>
<script src="//<?php echo $_SERVER['SERVER_NAME'];?>/admin/styles/js/pace.min.js"></script>
<script src="//<?php echo $_SERVER['SERVER_NAME'];?>/admin/styles/js/retina.min.js"></script>
<script src="//<?php echo $_SERVER['SERVER_NAME'];?>/admin/styles/js/jquery.cookies.js"></script>
<script src="//<?php echo $_SERVER['SERVER_NAME']; ?>/admin/styles/js/jquery-1.11.1.min.js"></script>
<script src="//<?php echo $_SERVER['SERVER_NAME']; ?>/admin/styles/js/jquery-migrate-1.2.1.min.js"></script>
<script src="//<?php echo $_SERVER['SERVER_NAME']; ?>/admin/styles/js/bootstrap.min.js"></script>
<script src="//<?php echo $_SERVER['SERVER_NAME']; ?>/admin/styles/js/modernizr.min.js"></script>
<script src="//<?php echo $_SERVER['SERVER_NAME']; ?>/admin/styles/js/pace.min.js"></script>
<script src="//<?php echo $_SERVER['SERVER_NAME']; ?>/admin/styles/js/retina.min.js"></script>
<script src="//<?php echo $_SERVER['SERVER_NAME']; ?>/admin/styles/js/jquery.cookies.js"></script>
<script src="//<?php echo $_SERVER['SERVER_NAME'];?>/admin/styles/js/custom.js"></script>
<script src="//<?php echo $_SERVER['SERVER_NAME']; ?>/admin/styles/js/custom.js"></script>
</body>
</html>
+36 -17
View File
@@ -1,4 +1,23 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
use Core\Models\User;
@@ -23,13 +42,13 @@
<title>Delta - CPanel</title>
<link href="//<?=$_SERVER['SERVER_NAME']; ?>/admin/styles/css/style.default.css" rel="stylesheet">
<link href="//<?= $_SERVER['SERVER_NAME']; ?>/admin/styles/css/style.default.css" rel="stylesheet">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="//<?=$_SERVER['SERVER_NAME']; ?>/admin/styles/js/html5shiv.js"></script>
<script src="//<?=$_SERVER['SERVER_NAME']; ?>/admin/styles/js/respond.min.js"></script>
<script src="//<?= $_SERVER['SERVER_NAME']; ?>/admin/styles/js/html5shiv.js"></script>
<script src="//<?= $_SERVER['SERVER_NAME']; ?>/admin/styles/js/respond.min.js"></script>
<![endif]-->
<style>
.preloader {
@@ -47,7 +66,7 @@
<div class="headerwrapper">
<div class="header-left">
<a href="index.php" class="logo">
<img src="//<?=$_SERVER['SERVER_NAME']; ?>/admin/styles/images/logo.png" alt=""/>
<img src="//<?= $_SERVER['SERVER_NAME']; ?>/admin/styles/images/logo.png" alt=""/>
</a>
<div class="pull-right">
<a href="" class="menu-collapse">
@@ -71,7 +90,7 @@
<ul class="media-list dropdown-list">
<li class="media">
<img class="img-circle pull-left noti-thumb"
src="//<?=$_SERVER['SERVER_NAME']; ?>/admin/styles/images/photos/user1.png" alt="">
src="//<?= $_SERVER['SERVER_NAME']; ?>/admin/styles/images/photos/user1.png" alt="">
<div class="media-body">
<strong>Nusja Nawancali</strong> likes a photo of you
<small class="date"><i class="fa fa-thumbs-up"></i> 15 minutes ago</small>
@@ -79,7 +98,7 @@
</li>
<li class="media">
<img class="img-circle pull-left noti-thumb"
src="//<?=$_SERVER['SERVER_NAME']; ?>/admin/styles/images/photos/user2.png" alt="">
src="//<?= $_SERVER['SERVER_NAME']; ?>/admin/styles/images/photos/user2.png" alt="">
<div class="media-body">
<strong>Weno Carasbong</strong> shared a photo of you in your <strong>Mobile Uploads</strong> album.
<small class="date"><i class="fa fa-calendar"></i> July 04, 2014</small>
@@ -87,7 +106,7 @@
</li>
<li class="media">
<img class="img-circle pull-left noti-thumb"
src="//<?=$_SERVER['SERVER_NAME']; ?>/admin/styles/images/photos/user3.png" alt="">
src="//<?= $_SERVER['SERVER_NAME']; ?>/admin/styles/images/photos/user3.png" alt="">
<div class="media-body">
<strong>Venro Leonga</strong> likes a photo of you
<small class="date"><i class="fa fa-thumbs-up"></i> July 03, 2014</small>
@@ -95,7 +114,7 @@
</li>
<li class="media">
<img class="img-circle pull-left noti-thumb"
src="//<?=$_SERVER['SERVER_NAME']; ?>/admin/styles/images/photos/user4.png" alt="">
src="//<?= $_SERVER['SERVER_NAME']; ?>/admin/styles/images/photos/user4.png" alt="">
<div class="media-body">
<strong>Nanterey Reslaba</strong> shared a photo of you in your <strong>Mobile Uploads</strong> album.
<small class="date"><i class="fa fa-calendar"></i> July 03, 2014</small>
@@ -103,7 +122,7 @@
</li>
<li class="media">
<img class="img-circle pull-left noti-thumb"
src="//<?=$_SERVER['SERVER_NAME']; ?>/admin/styles/images/photos/user1.png" alt="">
src="//<?= $_SERVER['SERVER_NAME']; ?>/admin/styles/images/photos/user1.png" alt="">
<div class="media-body">
<strong>Nusja Nawancali</strong> shared a photo of you in your <strong>Mobile Uploads</strong> album.
<small class="date"><i class="fa fa-calendar"></i> July 02, 2014</small>
@@ -128,7 +147,7 @@
<li class="media">
<span class="badge badge-success">New</span>
<img class="img-circle pull-left noti-thumb"
src="//<?=$_SERVER['SERVER_NAME']; ?>/admin/styles/images/photos/user1.png" alt="">
src="//<?= $_SERVER['SERVER_NAME']; ?>/admin/styles/images/photos/user1.png" alt="">
<div class="media-body">
<strong>Nusja Nawancali</strong>
<p>Hi! How are you?...</p>
@@ -138,7 +157,7 @@
<li class="media">
<span class="badge badge-success">New</span>
<img class="img-circle pull-left noti-thumb"
src="//<?=$_SERVER['SERVER_NAME']; ?>/admin/styles/images/photos/user2.png" alt="">
src="//<?= $_SERVER['SERVER_NAME']; ?>/admin/styles/images/photos/user2.png" alt="">
<div class="media-body">
<strong>Weno Carasbong</strong>
<p>Lorem ipsum dolor sit amet...</p>
@@ -147,7 +166,7 @@
</li>
<li class="media">
<img class="img-circle pull-left noti-thumb"
src="//<?=$_SERVER['SERVER_NAME']; ?>/admin/styles/images/photos/user3.png" alt="">
src="//<?= $_SERVER['SERVER_NAME']; ?>/admin/styles/images/photos/user3.png" alt="">
<div class="media-body">
<strong>Venro Leonga</strong>
<p>Do you have the time to listen to me...</p>
@@ -156,7 +175,7 @@
</li>
<li class="media">
<img class="img-circle pull-left noti-thumb"
src="//<?=$_SERVER['SERVER_NAME']; ?>/admin/styles/images/photos/user4.png" alt="">
src="//<?= $_SERVER['SERVER_NAME']; ?>/admin/styles/images/photos/user4.png" alt="">
<div class="media-body">
<strong>Nanterey Reslaba</strong>
<p>It might seem crazy what I'm about to say...</p>
@@ -165,7 +184,7 @@
</li>
<li class="media">
<img class="img-circle pull-left noti-thumb"
src="//<?=$_SERVER['SERVER_NAME']; ?>/admin/styles/images/photos/user1.png" alt="">
src="//<?= $_SERVER['SERVER_NAME']; ?>/admin/styles/images/photos/user1.png" alt="">
<div class="media-body">
<strong>Nusja Nawancali</strong>
<p>Hey I just met you and this is crazy...</p>
@@ -189,7 +208,7 @@
<li><a href="#"><i class="glyphicon glyphicon-cog"></i> Account Settings</a></li>
<li><a href="#"><i class="glyphicon glyphicon-question-sign"></i> Help</a></li>
<li class="divider"></li>
<li><a href="//<?=$_SERVER['SERVER_NAME']; ?>/admin/logout.php"><i class="glyphicon glyphicon-log-out"></i>Выход</a>
<li><a href="//<?= $_SERVER['SERVER_NAME']; ?>/admin/logout.php"><i class="glyphicon glyphicon-log-out"></i>Выход</a>
</li>
</ul>
</div><!-- btn-group -->
@@ -216,8 +235,8 @@
?>" alt="">
</a>
<div class="media-body">
<h4 class="media-heading"><?=$arUser['name']; ?></h4>
<small class="text-muted"><?=$arUser['email'];?>
<h4 class="media-heading"><?= $arUser['name']; ?></h4>
<small class="text-muted"><?= $arUser['email']; ?>
</small>
</div>
</div><!-- media -->
+25 -2
View File
@@ -1,4 +1,26 @@
<?php require_once __DIR__ . '/inc/header.php'; ?>
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
require_once __DIR__ . '/inc/header.php';
?>
<div class="pageheader">
<div class="media">
<div class="pageicon pull-left">
@@ -19,4 +41,5 @@
типа статистика или хз
</div><!-- contentpanel -->
<?php require_once __DIR__ . '/inc/footer.php'; ?>
<?php
require_once __DIR__ . '/inc/footer.php';
+31 -13
View File
@@ -1,4 +1,23 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
use Core\Models\User;
@@ -9,7 +28,6 @@
} else {
$auth = false;
if (!empty($_REQUEST['login'] && !empty($_REQUEST['pass']))) {
if (User::securityAuthorize(
$_REQUEST['login'],
$_REQUEST['pass'],
@@ -43,8 +61,8 @@
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="//<?=$_SERVER['SERVER_NAME']; ?>/admin/styles/js/html5shiv.js"></script>
<script src="//<?=$_SERVER['SERVER_NAME']; ?>/admin/styles/js/respond.min.js"></script>
<script src="//<?= $_SERVER['SERVER_NAME']; ?>/admin/styles/js/html5shiv.js"></script>
<script src="//<?= $_SERVER['SERVER_NAME']; ?>/admin/styles/js/respond.min.js"></script>
<![endif]-->
</head>
@@ -56,14 +74,14 @@
<div class="panel panel-signin">
<div class="panel-body">
<div class="logo text-center">
<img src="//<?=$_SERVER['SERVER_NAME']; ?>/admin/styles/images/logo-primary.png" alt="Chain Logo">
<img src="//<?= $_SERVER['SERVER_NAME']; ?>/admin/styles/images/logo-primary.png" alt="Chain Logo">
</div>
<br/>
<h4 class="text-center mb5">Авторизация в системе</h4>
<p class="text-center">Войдите в свой аккаунт</p>
<div class="mb30"></div>
<?php if($err_mess) { ?>
<?php if ($err_mess) { ?>
<div class="alert alert-danger">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
Ошибка авторизации
@@ -101,15 +119,15 @@
</section>
<script src="//<?=$_SERVER['SERVER_NAME']; ?>/admin/styles/js/jquery-1.11.1.min.js"></script>
<script src="//<?=$_SERVER['SERVER_NAME']; ?>/admin/styles/js/jquery-migrate-1.2.1.min.js"></script>
<script src="//<?=$_SERVER['SERVER_NAME']; ?>/admin/styles/js/bootstrap.min.js"></script>
<script src="//<?=$_SERVER['SERVER_NAME']; ?>/admin/styles/js/modernizr.min.js"></script>
<script src="//<?=$_SERVER['SERVER_NAME']; ?>/admin/styles/js/pace.min.js"></script>
<script src="//<?=$_SERVER['SERVER_NAME']; ?>/admin/styles/js/retina.min.js"></script>
<script src="//<?=$_SERVER['SERVER_NAME']; ?>/admin/styles/js/jquery.cookies.js"></script>
<script src="//<?= $_SERVER['SERVER_NAME']; ?>/admin/styles/js/jquery-1.11.1.min.js"></script>
<script src="//<?= $_SERVER['SERVER_NAME']; ?>/admin/styles/js/jquery-migrate-1.2.1.min.js"></script>
<script src="//<?= $_SERVER['SERVER_NAME']; ?>/admin/styles/js/bootstrap.min.js"></script>
<script src="//<?= $_SERVER['SERVER_NAME']; ?>/admin/styles/js/modernizr.min.js"></script>
<script src="//<?= $_SERVER['SERVER_NAME']; ?>/admin/styles/js/pace.min.js"></script>
<script src="//<?= $_SERVER['SERVER_NAME']; ?>/admin/styles/js/retina.min.js"></script>
<script src="//<?= $_SERVER['SERVER_NAME']; ?>/admin/styles/js/jquery.cookies.js"></script>
<script src="//<?=$_SERVER['SERVER_NAME']; ?>/admin/styles/js/custom.js"></script>
<script src="//<?= $_SERVER['SERVER_NAME']; ?>/admin/styles/js/custom.js"></script>
</body>
</html>
+21
View File
@@ -1,5 +1,26 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
use Core\Models\User;
require_once __DIR__ . '/inc/bootstrap.php';
User::logout();
header('Location: index.php');
+19
View File
@@ -1,4 +1,23 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
use Core\Models\{User, Roles};
+19
View File
@@ -1,4 +1,23 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
use Core\Models\{User, MQ};
+25 -8
View File
@@ -1,14 +1,32 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
use Core\Models\User;
use Core\Models\User;
require_once __DIR__ . '/inc/bootstrap.php';
if (User::isAuthorized()) {
require_once __DIR__ . '/inc/bootstrap.php';
if (User::isAuthorized()) {
header('Location: index.php');
} else {
} else {
$arErrors = [];
if (!empty($_REQUEST['send']) && $_REQUEST['send'] === 'Y') {
if (empty($_REQUEST['login'])) {
$arErrors[] = 'Логин не задан';
}
@@ -25,13 +43,12 @@ if (User::isAuthorized()) {
$arErrors[] = 'Пользователь с таким логином уже зарегистрирован';
}
if(empty($arErrors)) {
if (empty($arErrors)) {
$userId = User::create($_REQUEST['login'], $_REQUEST['pass'], $_REQUEST['email'], $_REQUEST['name']);
User::authorize($userId);
header('Location: index.php');
}
}
@@ -124,4 +141,4 @@ if (User::isAuthorized()) {
</body>
</html>
<?php } ?>
<?php } ?>
+27 -7
View File
@@ -1,4 +1,24 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
use Core\Models\{User, MQ};
require_once __DIR__ . '/inc/header.php';
@@ -51,7 +71,6 @@
</div>
</div>
<div class="row">
@@ -109,13 +128,13 @@
</div><!-- contentpanel -->
<script>
var isPaused = false;
function update()
{
function update() {
isPaused = true;
$.ajax({
url: 'ajax/threads.php',
cache: false,
success: function(data){
success: function (data) {
data = JSON.parse(data);
$('#info_threads').html(data.info_threads);
$('#info_threads_history').html(data.info_threads_history);
@@ -127,13 +146,14 @@
}
});
}
$(document).ready(function(){
$(document).ready(function () {
update();
setInterval(function () {
if(!isPaused){
if (!isPaused) {
update();
}
},500);
}, 500);
});
</script>
<?php require_once __DIR__ . '/inc/footer.php'; ?>
+20 -1
View File
@@ -1,4 +1,23 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
use Core\Models\User;
@@ -47,7 +66,7 @@
$userObject = new User($elUser['id']);
?>
<tr>
<td><a href="profile.php?userId=<?= $elUser['id'];?>"><?= $elUser['id']; ?></a></td>
<td><a href="profile.php?userId=<?= $elUser['id']; ?>"><?= $elUser['id']; ?></a></td>
<td><?= $elUser['login']; ?></td>
<td><?= $elUser['password']; ?></td>
<td><?= $elUser['name']; ?></td>
+22 -8
View File
@@ -1,4 +1,23 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
use Core\Models\User;
use Core\Helpers\Cache;
@@ -107,16 +126,11 @@
// debug
function sendTelegram(?string $message, ?string $file = null): void
{
(new \Core\ExternalServices\TelegramSender(TELEGRAM_BOT_TOKEN))
->setChat(TELEGRAM_NOTIFICATION_CHANNEL)
->sendMessage($message);
(new \Core\ExternalServices\TelegramSender(TELEGRAM_BOT_TOKEN))->setChat(TELEGRAM_NOTIFICATION_CHANNEL)->sendMessage($message);
if(!empty($file)) {
(new \Core\ExternalServices\TelegramSender(TELEGRAM_BOT_TOKEN))
->setChat(TELEGRAM_NOTIFICATION_CHANNEL)
->sendDocument($file);
if (!empty($file)) {
(new \Core\ExternalServices\TelegramSender(TELEGRAM_BOT_TOKEN))->setChat(TELEGRAM_NOTIFICATION_CHANNEL)->sendDocument($file);
}
}
//end debug
+19
View File
@@ -1,4 +1,23 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* Версия сервиса
+25 -7
View File
@@ -1,6 +1,27 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
@ignore_user_abort(true);
set_time_limit(0);
use Core\Helpers\Cache;
use Core\Models\MQ;
@@ -16,8 +37,8 @@
// Каждые 10 минут добавляем в очередь задание на проверку новостей слободы и отправку в телегу
$cacheId = md5('cron_myslo');
$runMyslo = false;
if(Cache::check($cacheId) && $cronMyslo = Cache::get($cacheId)) {
if((time() - (int)$cronMyslo) > 600) {
if (Cache::check($cacheId) && $cronMyslo = Cache::get($cacheId)) {
if ((time() - (int)$cronMyslo) > 600) {
$runMyslo = true;
Cache::set($cacheId, time());
}
@@ -26,9 +47,6 @@
Cache::set($cacheId, time());
}
if($runMyslo === true) {
$result = (new MQ())->setAttempts(3)
->setPriority(3)
->setCheckDuplicates(true)
->createTask('Core\MQTasks', 'getMySLO');
if ($runMyslo === true) {
$result = (new MQ())->setAttempts(3)->setPriority(3)->setCheckDuplicates(true)->createTask('Core\MQTasks', 'getMySLO');
}
+19
View File
@@ -1,4 +1,23 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
namespace Core;
+24 -5
View File
@@ -1,4 +1,23 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
namespace Core;
@@ -70,12 +89,12 @@
public function showTrace(): void
{
echo '<div style="color: #b30000;background: #ffe2e2;padding: 10px;border: 1px solid #ffa0a0;margin: 10px;display: inline-block;">';
echo '<span style="font-weight:bold; font-size: 1.1em;">'.$this->getMessage().'</span><br>';
echo $this->getFile() . ': '.$this->getLine() . '<br>';
echo '<span style="font-weight:bold; font-size: 1.1em;">' . $this->getMessage() . '</span><br>';
echo $this->getFile() . ': ' . $this->getLine() . '<br>';
$arTrace = $this->generateCallTrace();
foreach($arTrace as $key => $value) {
echo '<span>'.$value.'</span><br>';
foreach ($arTrace as $key => $value) {
echo '<span>' . $value . '</span><br>';
}
echo '</div>';
}
}
}
@@ -1,4 +1,23 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
namespace Core\ExternalServices;
@@ -1,4 +1,24 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* Класс для работы с API телеграмм
* Поддерживает:
@@ -1,7 +1,26 @@
<?php
/**
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* Класс-обработчик команд Telegram
*
* Поддерживает:
* - работа с простыми командами
* - выделение аргументов команды
@@ -15,10 +34,10 @@
* @author Roman Grinko <rsgrinko@gmail.com>
*/
namespace Core\ExternalServices;
namespace Core\ExternalServices;
class TelegramActions
{
class TelegramActions
{
/** @var string Текущая команда */
private static string $cmd;
@@ -93,7 +112,8 @@ class TelegramActions
} elseif (!empty($data[self::$messageType]['contact'])) {
self::$eventType = 'contact';
self::$event['phone_number'] = $data[self::$messageType]['contact']['phone_number'];
self::$event['name'] = $data[self::$messageType]['contact']['first_name'] . ' ' . $data['message']['contact']['last_name'];
self::$event['name'] = $data[self::$messageType]['contact']['first_name'] . ' '
. $data['message']['contact']['last_name'];
} elseif (!empty($data[self::$messageType]['location'])) {
self::$eventType = 'location';
self::$event['latitude'] = $data[self::$messageType]['location']['latitude'];
@@ -131,7 +151,6 @@ class TelegramActions
if (!empty($arParams)) {
self::$params = implode(' ', $arParams);
}
} elseif (!empty($data) && isset($data['callback_query']['from']['id']) and $data['callback_query']['from']['id'] !== '') {
self::$eventType = 'callback';
self::$event['callback_id'] = self::$chatId = (int)$data['callback_query']['id']; // идентификатор callback
@@ -141,7 +160,10 @@ class TelegramActions
self::$event['first_name'] = $data['callback_query']['from']['first_name']; // имя собеседника
self::$event['last_name'] = $data['callback_query']['from']['last_name']; // фамилию собеседника
self::$event['chat_time'] = $data['callback_query']['message']['date']; // дата сообщения
self::$event['data'] = json_decode($data['callback_query']['data'], true); // Содержимое callback запроса
self::$event['data'] = json_decode(
$data['callback_query']['data'],
true
); // Содержимое callback запроса
self::$cmd = self::$event['data']['method'];
} else {
self::$eventType = null;
@@ -204,6 +226,7 @@ class TelegramActions
*
* @param string $name Имя метода
* @param ?array $arguments Массив аргументов метода
*
* @return void
*/
public static function __callStatic(string $name, ?array $arguments): void
@@ -269,7 +292,7 @@ class TelegramActions
['/online', '/yastat'],
['/fail2ban', '/stat'],
['/getcam', '/clearcache'],
['/deploy']
['/deploy'],
];
}
@@ -359,7 +382,13 @@ class TelegramActions
public static function commandTest(): void
{
Telegram::sendChatAction(self::getChatId()); // печатает...
Telegram::execute(self::getChatId(), 'Запущена команда test, переданы аргумент: ' . self::getParams(), '', self::getInlineKeyboard(), self::getKeyboard());
Telegram::execute(
self::getChatId(),
'Запущена команда test, переданы аргумент: ' . self::getParams(),
'',
self::getInlineKeyboard(),
self::getKeyboard()
);
}
/**
@@ -374,21 +403,17 @@ class TelegramActions
$message = '<b>Посетители онлайн (' . count($result) . ')</b>' . PHP_EOL;
foreach ($result as $key => $item) {
$message .= '✔ <b>Пользователь #' . ($key + 1) . '</b> '
. PHP_EOL
. '<b>IP:</b> ' . $item['ip']
. PHP_EOL
. '<b>Страница:</b> <code>' . $item['page'] . '</code>'
. PHP_EOL
. '<b>Referer:</b> <code>' . (!empty(trim($item['referer'])) ? SystemFunctions::getBaseUrl($item['referer']) : 'нет') . '</code>'
. PHP_EOL
. '<b>Бот:</b> ' . (SystemFunctions::isSearchBot($item['useragent']) ?? 'нет')
. PHP_EOL
. '<b>Последняя активность:</b> ' . SystemFunctions::secToString(time() - (int)$item['last_active'])
. PHP_EOL
. '<b>Геозона:</b> ' . SystemFunctions::gluingLocationToString(['country' => $item['country'], 'region' => $item['region'], 'city' => $item['city']])
. PHP_EOL
. PHP_EOL;
$message .= '✔ <b>Пользователь #' . ($key + 1) . '</b> ' . PHP_EOL . '<b>IP:</b> ' . $item['ip'] . PHP_EOL . '<b>Страница:</b> <code>'
. $item['page'] . '</code>' . PHP_EOL . '<b>Referer:</b> <code>' . (!empty(
trim(
$item['referer']
)
) ? SystemFunctions::getBaseUrl($item['referer']) : 'нет') . '</code>' . PHP_EOL . '<b>Бот:</b> ' . (SystemFunctions::isSearchBot(
$item['useragent']
) ?? 'нет') . PHP_EOL . '<b>Последняя активность:</b> ' . SystemFunctions::secToString(time() - (int)$item['last_active'])
. PHP_EOL . '<b>Геозона:</b> ' . SystemFunctions::gluingLocationToString(
['country' => $item['country'], 'region' => $item['region'], 'city' => $item['city']]
) . PHP_EOL . PHP_EOL;
}
Telegram::sendChatAction(self::getChatId()); // печатает...
Telegram::execute(self::getChatId(), $message, '', self::getInlineKeyboard(), self::getKeyboard());
@@ -405,15 +430,11 @@ class TelegramActions
$message = '<b>Список заблокированных IP (' . Fail2ban::getBlockedIpCount() . ' из ' . Fail2ban::getAllIpCount() . ')</b>' . PHP_EOL;
foreach ($result as $key => $item) {
$message .= '🚩 <b> ' . $item['ip'] . '</b> '
. PHP_EOL
. '<b>Попыток:</b> ' . $item['attempts']
. PHP_EOL
. '<b>Активность:</b> ' . SystemFunctions::secToString(time() - $item['last_active'])
. PHP_EOL
. '<b>Геозона:</b> ' . SystemFunctions::gluingLocationToString(['country' => $item['country'], 'region' => $item['region'], 'city' => $item['city']])
. PHP_EOL
. PHP_EOL;
$message .= '🚩 <b> ' . $item['ip'] . '</b> ' . PHP_EOL . '<b>Попыток:</b> ' . $item['attempts'] . PHP_EOL . '<b>Активность:</b> '
. SystemFunctions::secToString(time() - $item['last_active']) . PHP_EOL . '<b>Геозона:</b> '
. SystemFunctions::gluingLocationToString(
['country' => $item['country'], 'region' => $item['region'], 'city' => $item['city']]
) . PHP_EOL . PHP_EOL;
}
Telegram::sendChatAction(self::getChatId()); // печатает...
Telegram::execute(self::getChatId(), $message, '', self::getInlineKeyboard(), self::getKeyboard());
@@ -443,9 +464,10 @@ class TelegramActions
[
[
['text' => 'Очистка кэша', 'callback_data' => self::getPreparedCallbackData('clearcache')],
['text' => 'Сброс Opcache', 'callback_data' => self::getPreparedCallbackData('clearopcache')]
['text' => 'Сброс Opcache', 'callback_data' => self::getPreparedCallbackData('clearopcache')],
],
]
]);
);
$countCacheElements = \FCCache::getCountElements();
$cacheSize = \FCCache::getCacheSize();
@@ -454,25 +476,23 @@ class TelegramActions
$countAllIp = Fail2ban::getAllIpCount();
$arOpcache = opcache_get_status();
$message = '📱 <b>Статистика по проекту</b>'
. PHP_EOL
. '<b>В кэше:</b> ' . $countCacheElements . ' ' . SystemFunctions::numWord($countCacheElements, ['элемент', 'элемента', 'элементов'])
. PHP_EOL
. '<b>Размер кэша:</b> ' . SystemFunctions::convertBytes($cacheSize)
. PHP_EOL
. '<b>В Opcache:</b> ' . $arOpcache['opcache_statistics']['num_cached_scripts'] . ' ' . SystemFunctions::numWord($arOpcache['opcache_statistics']['num_cached_scripts'], ['элемент', 'элемента', 'элементов'])
. PHP_EOL
. '<b>Opcache (используется):</b> ' . SystemFunctions::convertBytes($arOpcache['memory_usage']['used_memory'])
. PHP_EOL
. '<b>Opcache (свободно):</b> ' . SystemFunctions::convertBytes($arOpcache['memory_usage']['free_memory'])
. PHP_EOL
. '<b>Opcache (битая):</b> ' . SystemFunctions::convertBytes($arOpcache['memory_usage']['wasted_memory'])
. PHP_EOL
. '<b>Opcache (всего):</b> 512Mb'
. PHP_EOL
. '<b>Онлайн на сайте:</b> ' . $usersOnline . ' ' . SystemFunctions::numWord($usersOnline, ['посетитель', 'посетителя', 'посетителей'])
. PHP_EOL
. '<b>Заблокировано:</b> ' . $countBlockedIp . ' ' . SystemFunctions::numWord($countBlockedIp, ['адрес', 'адреса', 'адресов']) . ' из ' . $countAllIp;
$message = '📱 <b>Статистика по проекту</b>' . PHP_EOL . '<b>В кэше:</b> ' . $countCacheElements . ' ' . SystemFunctions::numWord(
$countCacheElements,
['элемент', 'элемента', 'элементов']
) . PHP_EOL . '<b>Размер кэша:</b> ' . SystemFunctions::convertBytes($cacheSize) . PHP_EOL . '<b>В Opcache:</b> '
. $arOpcache['opcache_statistics']['num_cached_scripts'] . ' ' . SystemFunctions::numWord(
$arOpcache['opcache_statistics']['num_cached_scripts'],
['элемент', 'элемента', 'элементов']
) . PHP_EOL . '<b>Opcache (используется):</b> ' . SystemFunctions::convertBytes($arOpcache['memory_usage']['used_memory']) . PHP_EOL
. '<b>Opcache (свободно):</b> ' . SystemFunctions::convertBytes($arOpcache['memory_usage']['free_memory']) . PHP_EOL
. '<b>Opcache (битая):</b> ' . SystemFunctions::convertBytes($arOpcache['memory_usage']['wasted_memory']) . PHP_EOL
. '<b>Opcache (всего):</b> 512Mb' . PHP_EOL . '<b>Онлайн на сайте:</b> ' . $usersOnline . ' ' . SystemFunctions::numWord(
$usersOnline,
['посетитель', 'посетителя', 'посетителей']
) . PHP_EOL . '<b>Заблокировано:</b> ' . $countBlockedIp . ' ' . SystemFunctions::numWord(
$countBlockedIp,
['адрес', 'адреса', 'адресов']
) . ' из ' . $countAllIp;
Telegram::sendChatAction(self::getChatId()); // печатает...
Telegram::execute(self::getChatId(), $message, '', self::getInlineKeyboard(), self::getKeyboard());
}
@@ -484,11 +504,8 @@ class TelegramActions
*/
public static function commandYaStat(): void
{
$objectYandex = new Yandex(
YANDEX_APP_ID,
YANDEX_APP_SECRET,
YANDEX_REDIRECT_URL
YANDEX_APP_ID, YANDEX_APP_SECRET, YANDEX_REDIRECT_URL
);
$objectYandex->loadConfig()->refreshToken();
$objectYandex->save();
@@ -501,14 +518,15 @@ class TelegramActions
'entity_field' => 'page_level',
'field' => 'partner_wo_nds',
'lang' => 'ru',
'pretty' => '0'
'pretty' => '0',
];
$result = $objectYandex->request(
'partner2.yandex.ru',
'api/statistics2/get.json',
$query);
$query
);
$day_price = [];
@@ -530,10 +548,8 @@ class TelegramActions
$day_price['today'] = $day_price['today'] ?? '0';
$day_price['yesterday'] = $day_price['yesterday'] ?? '0';
$message = '<b>Статистика РСЯ</b>' . PHP_EOL
. 'Доход за сегодня: ' . $day_price['today'] . ' р.' . PHP_EOL
. 'Доход за вчера: ' . $day_price['yesterday'] . ' р.' . PHP_EOL
. 'Курс доллара: ' . SystemFunctions::getExchangeRates('USD', 2) . ' р.';
$message = '<b>Статистика РСЯ</b>' . PHP_EOL . 'Доход за сегодня: ' . $day_price['today'] . ' р.' . PHP_EOL . 'Доход за вчера: '
. $day_price['yesterday'] . ' р.' . PHP_EOL . 'Курс доллара: ' . SystemFunctions::getExchangeRates('USD', 2) . ' р.';
Telegram::sendChatAction(self::getChatId()); // печатает...
Telegram::execute(self::getChatId(), $message, '', self::getInlineKeyboard(), self::getKeyboard());
}
@@ -547,7 +563,13 @@ class TelegramActions
{
$image = SystemFunctions::getCamScreen();
Telegram::sendChatAction(self::getChatId()); // печатает...
Telegram::execute(self::getChatId(), 'Снимок сделан ' . date('d.m.Y H:i:s', strtotime('+3 hours')), $image, self::getInlineKeyboard(), self::getKeyboard());
Telegram::execute(
self::getChatId(),
'Снимок сделан ' . date('d.m.Y H:i:s', strtotime('+3 hours')),
$image,
self::getInlineKeyboard(),
self::getKeyboard()
);
}
/**
@@ -586,4 +608,4 @@ class TelegramActions
opcache_reset();
Telegram::answerCallbackQuery(self::getEventData()['callback_id'], 'Opcache очищен.', false);
}
}
}
@@ -1,4 +1,24 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* Класс для работы с API телеграмм (не-статический)
*
+22 -2
View File
@@ -1,4 +1,23 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
namespace Core\Helpers;
@@ -178,7 +197,7 @@
*
* @return bool Флаг успеха
*/
public static function del(string $name): bool
public static function delete(string $name): bool
{
if (self::check($name)) {
if (!unlink(self::$cacheDir . md5($name) . '.tmp')) {
@@ -214,8 +233,9 @@
{
$return_size = 0;
foreach (scandir(self::$cacheDir) as $file) {
if ($file == '.' or $file == '..')
if ($file == '.' or $file == '..') {
continue;
}
$return_size = $return_size + filesize(self::$cacheDir . $file);
}
return $return_size;
+19
View File
@@ -1,4 +1,23 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
namespace Core\Helpers;
+19
View File
@@ -1,4 +1,23 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* Работа с файлами и директориями.
+19
View File
@@ -1,4 +1,23 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
namespace Core\Helpers;
+19
View File
@@ -1,4 +1,23 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
namespace Core\Helpers;
+19
View File
@@ -1,4 +1,23 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
namespace Core\Helpers;
+33 -8
View File
@@ -1,11 +1,34 @@
<?php
namespace Core\Helpers;
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
class Pagination
{
namespace Core\Helpers;
class Pagination
{
private static $page;
private static $total;
private static $total_pages;
private static $limit;
/**
@@ -40,7 +63,6 @@ class Pagination
$limit = $start . ', ' . self::$limit;
return $limit;
}
/**
@@ -57,15 +79,18 @@ class Pagination
}
if (self::$page != 1) {
$prevPage = '<li class="page-item active"><a class="page-link" href="' . $url . $paginator_name . '=' . (self::$page - 1) . '">‹</a></li>';
$prevPage = '<li class="page-item active"><a class="page-link" href="' . $url . $paginator_name . '=' . (self::$page - 1)
. '">‹</a></li>';
} else {
$prevPage = '<li class="page-item"><span class="page-link">‹</span></li>';
}
if (self::$page != self::$total_pages) {
$nextPage = '<li class="page-item active"><a class="page-link" href="' . $url . $paginator_name . '=' . (self::$page + 1) . '">›</a></li>';
$nextPage = '<li class="page-item active"><a class="page-link" href="' . $url . $paginator_name . '=' . (self::$page + 1)
. '">›</a></li>';
} else {
$nextPage = '<li class="page-item"><span class="page-link">›</span></li>';
}
echo '<ul class="pagination">'.$prevPage.'<li class="page-item"><a class="page-link" href="#">' . self::$page . ' из ' . self::$total_pages . '</a></li>'.$nextPage.'</ul>';
echo '<ul class="pagination">' . $prevPage . '<li class="page-item"><a class="page-link" href="#">' . self::$page . ' из '
. self::$total_pages . '</a></li>' . $nextPage . '</ul>';
}
}
}
+20
View File
@@ -1,4 +1,24 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* Класс реестра
*/
@@ -1,4 +1,23 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
namespace Core\Helpers;
@@ -636,11 +655,14 @@
public static function arrayToXml(array $arData = [], ?string $objectName = null): string
{
$rootData = '';
if(!empty($objectName)) {
if (!empty($objectName)) {
$rootData = ' object="' . $objectName . '"';
}
$xml = new \SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><DeltaCore version="' . CORE_VERSION . '"' . $rootData . ' date="' . date('d.m.Y H:i:s') . '"/>');
$xml = new \SimpleXMLElement(
'<?xml version="1.0" encoding="UTF-8"?><DeltaCore version="' . CORE_VERSION . '"' . $rootData . ' date="' . date('d.m.Y H:i:s')
. '"/>'
);
static::arrayToXmlHelper($arData, $xml);
$dom = dom_import_simplexml($xml)->ownerDocument;
+19
View File
@@ -1,4 +1,23 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
namespace Core\Helpers;
+19
View File
@@ -1,4 +1,23 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
namespace Core\Helpers;
+24 -8
View File
@@ -1,4 +1,23 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
namespace Core;
@@ -138,9 +157,7 @@
if ($res) {
$j++;
$DB->update(
'bashorg',
['hash' => $hash],
['ext_id' => (int)$element['id'], 'date' => $element['date'], 'rating' => $element['rating']]
'bashorg', ['hash' => $hash], ['ext_id' => (int)$element['id'], 'date' => $element['date'], 'rating' => $element['rating']]
);
}
}
@@ -217,7 +234,7 @@ DELETE from `jokes` WHERE `jokes`.id not in (SELECT id FROM t_temp);'
public static function sendJokeToTelegram()
{
if(date('H') > 21 || date('H') < 9) {
if (date('H') > 21 || date('H') < 9) {
return 'Нерабочее время :(';
}
$telegram = new \Core\ExternalServices\TelegramSender(TELEGRAM_BOT_TOKEN);
@@ -237,7 +254,7 @@ DELETE from `jokes` WHERE `jokes`.id not in (SELECT id FROM t_temp);'
public static function getMySLO()
{
$cacheId = md5('getMySLO_criminal');
if(Cache::check($cacheId)) {
if (Cache::check($cacheId)) {
$oldLink = Cache::get($cacheId);
} else {
$oldLink = '';
@@ -257,9 +274,8 @@ DELETE from `jokes` WHERE `jokes`.id not in (SELECT id FROM t_temp);'
$link = 'https://myslo.ru' . trim($link[1][0]);
if($oldLink !== $link) {
sendTelegram('OLD (' .strlen($oldLink).'): ' . $oldLink . PHP_EOL . 'NEW (' .strlen($link).'): ' . $link);
if ($oldLink !== $link) {
sendTelegram('OLD (' . strlen($oldLink) . '): ' . $oldLink . PHP_EOL . 'NEW (' . strlen($link) . '): ' . $link);
sendTelegram('Обнаружен новый пост');
$full = file_get_contents($link);
+19 -1
View File
@@ -1,8 +1,26 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
namespace Core\Models;
use Core\CoreException;
/**
+19
View File
@@ -1,4 +1,23 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
namespace Core\Models;
+19
View File
@@ -1,4 +1,23 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
namespace Core\Models;
+19
View File
@@ -1,4 +1,23 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
namespace Core\Models;
+21 -2
View File
@@ -1,4 +1,23 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
namespace Core\Models;
@@ -73,7 +92,7 @@
public function addRole(int $roleId): ?int
{
$cacheId = md5('Roles_' . $this->user->getId() . '_getRoles');
Cache::del($cacheId);
Cache::delete($cacheId);
/** @var $DB DB */
$DB = DB::getInstance();
@@ -90,7 +109,7 @@
public function removeRole(int $roleId): ?int
{
$cacheId = md5('Roles_' . $this->user->getId() . '_getRoles');
Cache::del($cacheId);
Cache::delete($cacheId);
/** @var $DB DB */
$DB = DB::getInstance();
+19 -1
View File
@@ -1,8 +1,26 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
namespace Core\Models;
class Router
{
+31 -5
View File
@@ -1,8 +1,26 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* Класс для работы с пользователями
*
* @author Roman Grinko <rsgrinko@gmail.com>
*/
namespace Core\Models;
@@ -190,7 +208,7 @@
{
$newToken = self::generateGUID();
(DB::getInstance())->update(self::TABLE, ['id' => $this->id], ['token' => $newToken]);
Log::logToFile('Создан токен ' . $newToken, 'User.log');
Log::logToFile('Создан токен ' . $newToken, 'User.log', ['userId' => $this->id]);
return $newToken;
}
@@ -297,14 +315,15 @@
*
* @param string $login Логин
* @param string $password Пароль
* @param string $email E-Mail
* @param string $name Имя
* @param string $image Аватар
*
* @return int
* @throws CoreException
*/
public static function create(string $login, string $password, string $email, string $name = ''): int
{
Log::logToFile(__METHOD__, 'User.log', func_get_args());
Log::logToFile('Создание нового пользователя', 'User.log', func_get_args());
/** @var $DB DB */
$DB = DB::getInstance();
@@ -330,8 +349,15 @@
public function update(array $fields): bool
{
$cacheId = md5('User_getAllUserData_' . $this->id);
/** @var $DB DB */
$DB = DB::getInstance();
Log::logToFile(
'Изменение данных пользователя c ID ' . $this->id,
'User.log',
['before' => $this->getAllUserData(), 'after' => func_get_args()]
);
Cache::delete($cacheId);
return $DB->update(self::TABLE, ['id' => $this->id], $fields);
}
+20 -1
View File
@@ -1,6 +1,26 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
namespace Core;
use Core\Helpers\SystemFunctions;
class Template
@@ -20,7 +40,6 @@
public static function render($buffer): ?string
{
$buffer = str_replace(array_keys(self::$arTemplateVariables), array_values(self::$arTemplateVariables), $buffer);
return $buffer;
}
+17 -1
View File
@@ -1,6 +1,22 @@
<?php
/**
* Класс административной панели
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
namespace Core;
+20
View File
@@ -0,0 +1,20 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+33 -10
View File
@@ -1,8 +1,28 @@
<?php
if(count($argv) < 2) {
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
if (count($argv) < 2) {
die('Не выбрано действие. Для справки наберите php -f partizan.php -?' . PHP_EOL);
}
switch($argv[1]) {
switch ($argv[1]) {
case 'migrate':
define('DB_HOST', 'localhost');
define('DB_USER', 'rsgrinko_delta');
@@ -10,21 +30,24 @@
define('DB_NAME', 'rsgrinko_delta');
define('DB_TABLE_VERSIONS', 'versions');
function connectDB() {
function connectDB()
{
$errorMessage = 'Невозможно подключиться к серверу базы данных';
$conn = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
if (!$conn)
if (!$conn) {
throw new Exception($errorMessage);
else {
} else {
$query = $conn->query('set names utf8');
if (!$query)
if (!$query) {
throw new Exception($errorMessage);
else
} else {
return $conn;
}
}
}
function getMigrationFiles($conn) {
function getMigrationFiles($conn)
{
$sqlFolder = 'migrations/';
$allFiles = glob($sqlFolder . '*.sql');
@@ -46,7 +69,8 @@
}
function migrate($conn, $file) {
function migrate($conn, $file)
{
$command = sprintf('mysql -u%s -p%s -h %s -D %s < %s', DB_USER, DB_PASSWORD, DB_HOST, DB_NAME, $file);
shell_exec($command);
$baseName = basename($file);
@@ -72,7 +96,6 @@
}
break;
default:
echo 'Неизвестная команда' . PHP_EOL;
+21 -2
View File
@@ -1,6 +1,27 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
use Core\Models\Router;
Router::route('/', '\Core\App::index');
Router::route('/404', function () {
@@ -13,8 +34,6 @@
});
Router::route('/test', '\Core\App::test');
Router::route('/test/(\d+)', '\Core\App::test');
+19
View File
@@ -1,4 +1,23 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* Инициализация runtime
+19
View File
@@ -1,4 +1,23 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* Воркер диспетчера очереди
+50 -32
View File
@@ -1,4 +1,23 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
use Core\CoreException;
use Core\ExternalServices\Telegram;
@@ -7,7 +26,7 @@
const USE_ROUTER = true;
require_once $_SERVER['DOCUMENT_ROOT'] . '/core/bootstrap.php';
?>
?>
<!doctype html>
<html lang="ru">
<head>
@@ -22,7 +41,8 @@
<nav class="navbar navbar-expand-md navbar-dark bg-dark" aria-label="Fourth navbar example">
<div class="container-fluid">
<a class="navbar-brand" href="#">Delta Framework</a>
<button class="navbar-toggler collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#navbarsExample04" aria-controls="navbarsExample04" aria-expanded="false" aria-label="Toggle navigation">
<button class="navbar-toggler collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#navbarsExample04"
aria-controls="navbarsExample04" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
@@ -50,25 +70,27 @@
</nav>
<div class="container">
<div class="row justify-content-md-center">
<div class="col-md">
<?php
echo $_REQUEST['route'] . '<br>';
<?php
echo $_REQUEST['route'] . '<br>';
if (User::isAuthorized()) {
global $USER;
echo str_replace('<table style="', '<table style="width:100%;', SystemFunctions::arrayToTable($USER->getAllUserData(), 'Информация о пользователе'));
echo str_replace(
'<table style="',
'<table style="width:100%;',
SystemFunctions::arrayToTable($USER->getAllUserData(), 'Информация о пользователе')
);
}
//echo str_replace('<table style="', '<table style="width:100%;', SystemFunctions::arrayToTable(Cache::getCacheInfo(), 'Информация о кэше'));
//echo str_replace('<table style="', '<table style="width:100%;', SystemFunctions::arrayToTable(Cache::getCacheInfo(), 'Информация о кэше'));
$count = (int)(DB::getInstance())->query('select count(*) as count from users')[0]['count'];
Pagination::execute($_REQUEST['page'], $count, 2);
$limit = Pagination::getLimit();
$count = (int)(DB::getInstance())->query('select count(*) as count from users')[0]['count'];
Pagination::execute($_REQUEST['page'], $count, 2);
$limit = Pagination::getLimit();
$arData = (DB::getInstance())->query('select * from users order by id desc limit ' . $limit);
$arData = (DB::getInstance())->query('select * from users order by id desc limit ' . $limit);
$arResult = [];
foreach ($arData as $element) {
@@ -82,17 +104,19 @@ $arData = (DB::getInstance())->query('select * from users order by id desc limit
'image' => $element['image'],
'token' => $element['token'],
'last_active' => $element['last_active'],
'groups' => array_map(function($element){ return Roles::getAllRoles()[$element]; }, (new User($element['id']))->getRolesObject()->getRoles()),
'groups' => array_map(function ($element) {
return Roles::getAllRoles()[$element];
}, (new User($element['id']))->getRolesObject()->getRoles()),
//'groups_human' => User::getAllGroups(),
];
}
echo '<nav aria-label="Page navigation example">';
Pagination::show('page');
echo '</nav>';
echo '<nav aria-label="Page navigation example">';
Pagination::show('page');
echo '</nav>';
echo str_replace('<table style="', '<table style="width:100%;', SystemFunctions::arrayToTable($arResult, 'Пользователи'));
?>
echo str_replace('<table style="', '<table style="width:100%;', SystemFunctions::arrayToTable($arResult, 'Пользователи'));
?>
</div>
</div>
</div>
@@ -112,21 +136,15 @@ echo str_replace('<table style="', '<table style="width:100%;', SystemFunctions:
$delta = 0.001;
}
$cacheSize = Cache::getCacheSize();
echo '<p class="text-center text-muted">Использовано ОЗУ: '
. round(memory_get_usage() / 1024 / 1024, 2)
. ' МБ / БД: '
. round(DB::$workingTime, 3)
. ' сек ('
. DB::$quantity
. ' шт.) / Кэш: '
. Files::convertBytes($cacheSize)
. ' / Генерация: '
. $delta
. ' сек</p>';
echo '<p class="text-center text-muted">Использовано ОЗУ: ' . round(memory_get_usage() / 1024 / 1024, 2) . ' МБ / БД: ' . round(
DB::$workingTime,
3
) . ' сек (' . DB::$quantity . ' шт.) / Кэш: ' . Files::convertBytes($cacheSize) . ' / Генерация: ' . $delta . ' сек</p>';
?>
<p class="text-center text-muted">© <?=date('Y');?> Delta Project</p>
<p class="text-center text-muted">© <?= date('Y'); ?> Delta Project</p>
</footer>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
</body>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
</body>
</html>
+29 -4
View File
@@ -1,4 +1,23 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
use Core\CoreException;
use Core\ExternalServices\Telegram;
@@ -77,11 +96,17 @@
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\Helpers\\Log;');">Log</button>
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\Helpers\\Files;');">Files</button>
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\Helpers\\Mail;');">Mail</button>
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\Helpers\\Pagination;');">Pagination</button>
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\Helpers\\Registry;');">Registry</button>
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\Helpers\\SystemFunctions;');">SystemFunctions</button>
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\Helpers\\Pagination;');">
Pagination
</button>
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\Helpers\\Registry;');">Registry
</button>
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\Helpers\\SystemFunctions;');">
SystemFunctions
</button>
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\Helpers\\Zip;');">Zip</button>
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\CoreException;');">CoreException</button>
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\CoreException;');">CoreException
</button>
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\Template;');">Template</button>
</div>
+21
View File
@@ -1,6 +1,27 @@
<?php
/**
* Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
$_SERVER['DOCUMENT_ROOT'] = '/home/rsgrinko/sites/dev.it-stories.ru';
require_once $_SERVER['DOCUMENT_ROOT'] . '/core/bootstrap.php';
use Core\MQTasks;
echo MQTasks::sendJokeToTelegram();