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

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

No files matched your search

+103 -83
View File
@@ -1,71 +1,90 @@
<?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.
*/
use Core\Models\MQ; use Core\Models\MQ;
require_once __DIR__ . '/../inc/bootstrap.php'; require_once __DIR__ . '/../inc/bootstrap.php';
$result = null; $result = null;
$MQ = new MQ(); $MQ = new MQ();
ob_start(); ob_start();
?> ?>
<table class="table table-primary mb30"> <table class="table table-primary mb30">
<thead> <thead>
<tr> <tr>
<th></th> <th></th>
<th>ID</th> <th>ID</th>
<th>Активен</th> <th>Активен</th>
<th>Выполняется</th> <th>Выполняется</th>
<th>Приоритет</th> <th>Приоритет</th>
<th>Время выполнения</th> <th>Время выполнения</th>
<th>Попытки</th> <th>Попытки</th>
<th>Лимит попыток</th> <th>Лимит попыток</th>
<th>Класс</th> <th>Класс</th>
<th>Метод</th> <th>Метод</th>
<th>Параметры</th> <th>Параметры</th>
<th>Статус</th> <th>Статус</th>
<th>Результат</th> <th>Результат</th>
<th>Создан</th> <th>Создан</th>
<th>Обновлен</th> <th>Обновлен</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php <?php
$arTasks = $MQ->getTasks(10, 'priority', 'asc'); $arTasks = $MQ->getTasks(10, 'priority', 'asc');
foreach ($arTasks as $task) { foreach ($arTasks as $task) {
?> ?>
<tr class="<?php <tr class="<?php
if ($task['active'] === MQ::VALUE_Y && $task['in_progress'] === MQ::VALUE_Y && $task['status'] === 'ERROR') { if ($task['active'] === MQ::VALUE_Y && $task['in_progress'] === MQ::VALUE_Y && $task['status'] === 'ERROR') {
echo 'alert-warning'; echo 'alert-warning';
} elseif ($task['active'] === MQ::VALUE_N && $task['status'] === 'ERROR') { } elseif ($task['active'] === MQ::VALUE_N && $task['status'] === 'ERROR') {
echo 'alert-danger'; echo 'alert-danger';
} elseif ($task['in_progress'] === MQ::VALUE_Y) { } elseif ($task['in_progress'] === MQ::VALUE_Y) {
echo 'alert-success'; echo 'alert-success';
} elseif ($task['in_progress'] === MQ::VALUE_N && $task['status'] === 'ERROR') { } elseif ($task['in_progress'] === MQ::VALUE_N && $task['status'] === 'ERROR') {
echo 'alert-danger'; echo 'alert-danger';
} elseif ($task['active'] === MQ::VALUE_Y && $task['in_progress'] === MQ::VALUE_N) { } elseif ($task['active'] === MQ::VALUE_Y && $task['in_progress'] === MQ::VALUE_N) {
echo 'alert-info'; echo 'alert-info';
} }
?>"> ?>">
<td><?= $task['in_progress'] === MQ::VALUE_Y ? '<span class="badge badge-success">RUN</span>' : ''; ?></td> <td><?= $task['in_progress'] === MQ::VALUE_Y ? '<span class="badge badge-success">RUN</span>' : ''; ?></td>
<td><?= $task['id']; ?></td> <td><?= $task['id']; ?></td>
<td><?= $task['active'] === MQ::VALUE_Y ? 'Да' : 'Нет'; ?></td> <td><?= $task['active'] === MQ::VALUE_Y ? 'Да' : 'Нет'; ?></td>
<td><?= $task['in_progress'] === MQ::VALUE_Y ? 'Да' : 'Нет'; ?></td> <td><?= $task['in_progress'] === MQ::VALUE_Y ? 'Да' : 'Нет'; ?></td>
<td><?= $task['priority']; ?></td> <td><?= $task['priority']; ?></td>
<td><?= $task['execution_time']; ?></td> <td><?= $task['execution_time']; ?></td>
<td><?= $task['attempts']; ?></td> <td><?= $task['attempts']; ?></td>
<td><?= $task['attempts_limit']; ?></td> <td><?= $task['attempts_limit']; ?></td>
<td><?= $task['class']; ?></td> <td><?= $task['class']; ?></td>
<td><?= $task['method']; ?></td> <td><?= $task['method']; ?></td>
<td><?= $task['params']; ?></td> <td><?= $task['params']; ?></td>
<td><?= $task['status']; ?></td> <td><?= $task['status']; ?></td>
<td><?= $task['response']; ?></td> <td><?= $task['response']; ?></td>
<td><?= $task['date_created']; ?></td> <td><?= $task['date_created']; ?></td>
<td><?= $task['date_updated']; ?></td> <td><?= $task['date_updated']; ?></td>
</tr> </tr>
<?php <?php
} }
?> ?>
</tbody> </tbody>
</table> </table>
<?php <?php
$result['threads'] = ob_get_clean(); $result['threads'] = ob_get_clean();
ob_start(); ob_start();
@@ -89,26 +108,26 @@
<tbody> <tbody>
<?php <?php
$arTasks = $MQ->getTasksHistory(10, 'id', 'desc'); $arTasks = $MQ->getTasksHistory(10, 'id', 'desc');
foreach($arTasks as $task) { foreach ($arTasks as $task) {
?> ?>
<tr class="<?php <tr class="<?php
if($task['status'] === MQ::STATUS_OK) { if ($task['status'] === MQ::STATUS_OK) {
echo 'alert-success'; echo 'alert-success';
} elseif($task['status'] === MQ::STATUS_ERROR) { } elseif ($task['status'] === MQ::STATUS_ERROR) {
echo 'alert-danger'; echo 'alert-danger';
} }
?>"> ?>">
<td><?=$task['id'];?></td> <td><?= $task['id']; ?></td>
<td><?=$task['task_id'];?></td> <td><?= $task['task_id']; ?></td>
<td><?=$task['execution_time'];?></td> <td><?= $task['execution_time']; ?></td>
<td><?=$task['attempts'];?></td> <td><?= $task['attempts']; ?></td>
<td><?=$task['class'];?></td> <td><?= $task['class']; ?></td>
<td><?=$task['method'];?></td> <td><?= $task['method']; ?></td>
<td><?=$task['params'];?></td> <td><?= $task['params']; ?></td>
<td><?=$task['status'];?></td> <td><?= $task['status']; ?></td>
<td><?=$task['response'];?></td> <td><?= $task['response']; ?></td>
<td><?=$task['date_created'];?></td> <td><?= $task['date_created']; ?></td>
<td><?=$task['date_updated'];?></td> <td><?= $task['date_updated']; ?></td>
</tr> </tr>
<?php <?php
} }
@@ -132,11 +151,11 @@
<tbody> <tbody>
<tr> <tr>
<td><?=$MQ->getCountTasks();?></td> <td><?= $MQ->getCountTasks(); ?></td>
<td><?=$MQ->getCountWorkers() . ' / ' . MQ::WORKERS_LIMIT;?></td> <td><?= $MQ->getCountWorkers() . ' / ' . MQ::WORKERS_LIMIT; ?></td>
<td><?=$MQ->getCountTasks(['active' => 'Y']);?></td> <td><?= $MQ->getCountTasks(['active' => 'Y']); ?></td>
<td><?=$MQ->getCountTasks(['active' => 'Y', 'in_progress' => '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(['in_progress' => 'N', 'status' => MQ::STATUS_ERROR]); ?></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@@ -155,9 +174,9 @@
<tbody> <tbody>
<tr> <tr>
<td><?=$MQ->getCountTasksHistory();?></td> <td><?= $MQ->getCountTasksHistory(); ?></td>
<td><?=$MQ->getCountTasksHistory(['status' => MQ::STATUS_OK]);?></td> <td><?= $MQ->getCountTasksHistory(['status' => MQ::STATUS_OK]); ?></td>
<td><?=$MQ->getCountTasksHistory(['status' => MQ::STATUS_ERROR]);?></td> <td><?= $MQ->getCountTasksHistory(['status' => MQ::STATUS_ERROR]); ?></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@@ -166,7 +185,8 @@
ob_start(); ob_start();
?> ?>
<div class="progress"> <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> <span class="sr-only">40% Complete (success)</span>
</div> </div>
</div> </div>
+36 -9
View File
@@ -1,5 +1,26 @@
<?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.
*/
use Core\Helpers\{Cache, SystemFunctions}; use Core\Helpers\{Cache, SystemFunctions};
require_once __DIR__ . '/inc/header.php'; require_once __DIR__ . '/inc/header.php';
?> ?>
<div class="pageheader"> <div class="pageheader">
@@ -36,15 +57,21 @@
<tbody> <tbody>
<?php <?php
$arCacheInfo = Cache::getCacheInfo(); $arCacheInfo = Cache::getCacheInfo();
?> ?>
<tr> <tr>
<td><?=$arCacheInfo['countAll'] . ' ' . SystemFunctions::numWord($arCacheInfo['countAll'], ['раз', 'раза', 'раз']);?></td> <td><?= $arCacheInfo['countAll'] . ' ' . SystemFunctions::numWord($arCacheInfo['countAll'], ['раз', 'раза', 'раз']
<td><?=$arCacheInfo['countWrite'] . ' ' . SystemFunctions::numWord($arCacheInfo['countWrite'], ['раз', 'раза', 'раз']);?></td> ); ?></td>
<td><?=$arCacheInfo['countRead'] . ' ' . SystemFunctions::numWord($arCacheInfo['countRead'], ['раз', 'раза', 'раз']);?></td> <td><?= $arCacheInfo['countWrite'] . ' ' . SystemFunctions::numWord($arCacheInfo['countWrite'], ['раз', 'раза', 'раз']
<td><?=$arCacheInfo['cacheDir'];?></td> ); ?></td>
<td><?=$arCacheInfo['cachedCount'] . ' ' . SystemFunctions::numWord($arCacheInfo['cachedCount'], ['элемент', 'элемента', 'элементов']);?></td> <td><?= $arCacheInfo['countRead'] . ' ' . SystemFunctions::numWord($arCacheInfo['countRead'], ['раз', 'раза', 'раз']
<td><?=SystemFunctions::convertBytes($arCacheInfo['size']);?></td> ); ?></td>
</tr> <td><?= $arCacheInfo['cacheDir']; ?></td>
<td><?= $arCacheInfo['cachedCount'] . ' ' . SystemFunctions::numWord(
$arCacheInfo['cachedCount'],
['элемент', 'элемента', 'элементов']
); ?></td>
<td><?= SystemFunctions::convertBytes($arCacheInfo['size']); ?></td>
</tr>
</tbody> </tbody>
</table> </table>
</div><!-- table-responsive --> </div><!-- table-responsive -->
+27 -6
View File
@@ -1,5 +1,26 @@
<?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.
*/
use Core\Models\{User, Roles}; use Core\Models\{User, Roles};
require_once __DIR__ . '/inc/header.php'; require_once __DIR__ . '/inc/header.php';
?> ?>
<div class="pageheader"> <div class="pageheader">
@@ -35,14 +56,14 @@
<tbody> <tbody>
<?php <?php
$arRoles = Roles::getAllRoles(); $arRoles = Roles::getAllRoles();
foreach($arRoles as $role){ foreach ($arRoles as $role) {
?> ?>
<tr> <tr>
<td><?= $role['id'];?></td> <td><?= $role['id']; ?></td>
<td><?= $role['name'];?></td> <td><?= $role['name']; ?></td>
<td><?= $role['description'];?></td> <td><?= $role['description']; ?></td>
<td><?= $role['date_created'] ? date('d.m.Y H:i:s', strtotime($role['date_created'])) : '-';?></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['date_updated'] ? date('d.m.Y H:i:s', strtotime($role['date_updated'])) : '-'; ?></td>
</tr> </tr>
<?php <?php
} }
+23 -3
View File
@@ -1,13 +1,33 @@
<?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.
*/
use Core\Models\User; use Core\Models\User;
require_once __DIR__ . '/../../core/bootstrap.php'; require_once __DIR__ . '/../../core/bootstrap.php';
$userId = User::getCurrentUserId(); $userId = User::getCurrentUserId();
if(!empty($userId)) { if (!empty($userId)) {
$USER = new User($userId); $USER = new User($userId);
$arUser = $USER->getAllUserData(); $arUser = $USER->getAllUserData();
} else { } else {
$USER = null; $USER = null;
$arUser = []; $arUser = [];
} }
+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> </div>
@@ -6,15 +27,15 @@
</section> </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-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/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/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/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/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/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.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> </body>
</html> </html>
+37 -18
View File
@@ -1,4 +1,23 @@
<?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.
*/
use Core\Models\User; use Core\Models\User;
@@ -23,13 +42,13 @@
<title>Delta - CPanel</title> <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> <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 --> <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]> <!--[if lt IE 9]>
<script src="//<?=$_SERVER['SERVER_NAME']; ?>/admin/styles/js/html5shiv.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> <script src="//<?= $_SERVER['SERVER_NAME']; ?>/admin/styles/js/respond.min.js"></script>
<![endif]--> <![endif]-->
<style> <style>
.preloader { .preloader {
@@ -47,7 +66,7 @@
<div class="headerwrapper"> <div class="headerwrapper">
<div class="header-left"> <div class="header-left">
<a href="index.php" class="logo"> <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> </a>
<div class="pull-right"> <div class="pull-right">
<a href="" class="menu-collapse"> <a href="" class="menu-collapse">
@@ -71,7 +90,7 @@
<ul class="media-list dropdown-list"> <ul class="media-list dropdown-list">
<li class="media"> <li class="media">
<img class="img-circle pull-left noti-thumb" <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"> <div class="media-body">
<strong>Nusja Nawancali</strong> likes a photo of you <strong>Nusja Nawancali</strong> likes a photo of you
<small class="date"><i class="fa fa-thumbs-up"></i> 15 minutes ago</small> <small class="date"><i class="fa fa-thumbs-up"></i> 15 minutes ago</small>
@@ -79,7 +98,7 @@
</li> </li>
<li class="media"> <li class="media">
<img class="img-circle pull-left noti-thumb" <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"> <div class="media-body">
<strong>Weno Carasbong</strong> shared a photo of you in your <strong>Mobile Uploads</strong> album. <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> <small class="date"><i class="fa fa-calendar"></i> July 04, 2014</small>
@@ -87,7 +106,7 @@
</li> </li>
<li class="media"> <li class="media">
<img class="img-circle pull-left noti-thumb" <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"> <div class="media-body">
<strong>Venro Leonga</strong> likes a photo of you <strong>Venro Leonga</strong> likes a photo of you
<small class="date"><i class="fa fa-thumbs-up"></i> July 03, 2014</small> <small class="date"><i class="fa fa-thumbs-up"></i> July 03, 2014</small>
@@ -95,7 +114,7 @@
</li> </li>
<li class="media"> <li class="media">
<img class="img-circle pull-left noti-thumb" <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"> <div class="media-body">
<strong>Nanterey Reslaba</strong> shared a photo of you in your <strong>Mobile Uploads</strong> album. <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> <small class="date"><i class="fa fa-calendar"></i> July 03, 2014</small>
@@ -103,7 +122,7 @@
</li> </li>
<li class="media"> <li class="media">
<img class="img-circle pull-left noti-thumb" <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"> <div class="media-body">
<strong>Nusja Nawancali</strong> shared a photo of you in your <strong>Mobile Uploads</strong> album. <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> <small class="date"><i class="fa fa-calendar"></i> July 02, 2014</small>
@@ -128,7 +147,7 @@
<li class="media"> <li class="media">
<span class="badge badge-success">New</span> <span class="badge badge-success">New</span>
<img class="img-circle pull-left noti-thumb" <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"> <div class="media-body">
<strong>Nusja Nawancali</strong> <strong>Nusja Nawancali</strong>
<p>Hi! How are you?...</p> <p>Hi! How are you?...</p>
@@ -138,7 +157,7 @@
<li class="media"> <li class="media">
<span class="badge badge-success">New</span> <span class="badge badge-success">New</span>
<img class="img-circle pull-left noti-thumb" <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"> <div class="media-body">
<strong>Weno Carasbong</strong> <strong>Weno Carasbong</strong>
<p>Lorem ipsum dolor sit amet...</p> <p>Lorem ipsum dolor sit amet...</p>
@@ -147,7 +166,7 @@
</li> </li>
<li class="media"> <li class="media">
<img class="img-circle pull-left noti-thumb" <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"> <div class="media-body">
<strong>Venro Leonga</strong> <strong>Venro Leonga</strong>
<p>Do you have the time to listen to me...</p> <p>Do you have the time to listen to me...</p>
@@ -156,7 +175,7 @@
</li> </li>
<li class="media"> <li class="media">
<img class="img-circle pull-left noti-thumb" <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"> <div class="media-body">
<strong>Nanterey Reslaba</strong> <strong>Nanterey Reslaba</strong>
<p>It might seem crazy what I'm about to say...</p> <p>It might seem crazy what I'm about to say...</p>
@@ -165,7 +184,7 @@
</li> </li>
<li class="media"> <li class="media">
<img class="img-circle pull-left noti-thumb" <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"> <div class="media-body">
<strong>Nusja Nawancali</strong> <strong>Nusja Nawancali</strong>
<p>Hey I just met you and this is crazy...</p> <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-cog"></i> Account Settings</a></li>
<li><a href="#"><i class="glyphicon glyphicon-question-sign"></i> Help</a></li> <li><a href="#"><i class="glyphicon glyphicon-question-sign"></i> Help</a></li>
<li class="divider"></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> </li>
</ul> </ul>
</div><!-- btn-group --> </div><!-- btn-group -->
@@ -213,11 +232,11 @@
} else { } else {
echo '/uploads/users/system.png'; echo '/uploads/users/system.png';
} }
?>" alt=""> ?>" alt="">
</a> </a>
<div class="media-body"> <div class="media-body">
<h4 class="media-heading"><?=$arUser['name']; ?></h4> <h4 class="media-heading"><?= $arUser['name']; ?></h4>
<small class="text-muted"><?=$arUser['email'];?> <small class="text-muted"><?= $arUser['email']; ?>
</small> </small>
</div> </div>
</div><!-- media --> </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="pageheader">
<div class="media"> <div class="media">
<div class="pageicon pull-left"> <div class="pageicon pull-left">
@@ -19,4 +41,5 @@
типа статистика или хз типа статистика или хз
</div><!-- contentpanel --> </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 <?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;
@@ -9,7 +28,6 @@
} else { } else {
$auth = false; $auth = false;
if (!empty($_REQUEST['login'] && !empty($_REQUEST['pass']))) { if (!empty($_REQUEST['login'] && !empty($_REQUEST['pass']))) {
if (User::securityAuthorize( if (User::securityAuthorize(
$_REQUEST['login'], $_REQUEST['login'],
$_REQUEST['pass'], $_REQUEST['pass'],
@@ -43,8 +61,8 @@
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]> <!--[if lt IE 9]>
<script src="//<?=$_SERVER['SERVER_NAME']; ?>/admin/styles/js/html5shiv.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> <script src="//<?= $_SERVER['SERVER_NAME']; ?>/admin/styles/js/respond.min.js"></script>
<![endif]--> <![endif]-->
</head> </head>
@@ -56,14 +74,14 @@
<div class="panel panel-signin"> <div class="panel panel-signin">
<div class="panel-body"> <div class="panel-body">
<div class="logo text-center"> <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> </div>
<br/> <br/>
<h4 class="text-center mb5">Авторизация в системе</h4> <h4 class="text-center mb5">Авторизация в системе</h4>
<p class="text-center">Войдите в свой аккаунт</p> <p class="text-center">Войдите в свой аккаунт</p>
<div class="mb30"></div> <div class="mb30"></div>
<?php if($err_mess) { ?> <?php if ($err_mess) { ?>
<div class="alert alert-danger"> <div class="alert alert-danger">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
Ошибка авторизации Ошибка авторизации
@@ -101,15 +119,15 @@
</section> </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-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/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/bootstrap.min.js"></script>
<script src="//<?=$_SERVER['SERVER_NAME']; ?>/admin/styles/js/modernizr.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/pace.min.js"></script>
<script src="//<?=$_SERVER['SERVER_NAME']; ?>/admin/styles/js/retina.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.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> </body>
</html> </html>
+21
View File
@@ -1,5 +1,26 @@
<?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.
*/
use Core\Models\User; use Core\Models\User;
require_once __DIR__ . '/inc/bootstrap.php'; require_once __DIR__ . '/inc/bootstrap.php';
User::logout(); User::logout();
header('Location: index.php'); header('Location: index.php');
+19
View File
@@ -1,4 +1,23 @@
<?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.
*/
use Core\Models\{User, Roles}; use Core\Models\{User, Roles};
+19
View File
@@ -1,4 +1,23 @@
<?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.
*/
use Core\Models\{User, MQ}; use Core\Models\{User, MQ};
+119 -102
View File
@@ -1,127 +1,144 @@
<?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.
*/
use Core\Models\User; use Core\Models\User;
require_once __DIR__ . '/inc/bootstrap.php'; require_once __DIR__ . '/inc/bootstrap.php';
if (User::isAuthorized()) { if (User::isAuthorized()) {
header('Location: index.php'); header('Location: index.php');
} else { } else {
$arErrors = []; $arErrors = [];
if (!empty($_REQUEST['send']) && $_REQUEST['send'] === 'Y') { if (!empty($_REQUEST['send']) && $_REQUEST['send'] === 'Y') {
if (empty($_REQUEST['login'])) {
$arErrors[] = 'Логин не задан';
}
if (empty($_REQUEST['name'])) {
$arErrors[] = 'Имя не задано';
}
if (empty($_REQUEST['email'])) {
$arErrors[] = 'E-Mail не задан';
}
if (empty($_REQUEST['pass'])) {
$arErrors[] = 'Пароль не задан';
}
if (!empty($_REQUEST['login']) && User::isUserExists($_REQUEST['login'])) {
$arErrors[] = 'Пользователь с таким логином уже зарегистрирован';
}
if (empty($_REQUEST['login'])) { if (empty($arErrors)) {
$arErrors[] = 'Логин не задан'; $userId = User::create($_REQUEST['login'], $_REQUEST['pass'], $_REQUEST['email'], $_REQUEST['name']);
}
if (empty($_REQUEST['name'])) { User::authorize($userId);
$arErrors[] = 'Имя не задано'; header('Location: index.php');
} }
if (empty($_REQUEST['email'])) {
$arErrors[] = 'E-Mail не задан';
}
if (empty($_REQUEST['pass'])) {
$arErrors[] = 'Пароль не задан';
}
if (!empty($_REQUEST['login']) && User::isUserExists($_REQUEST['login'])) {
$arErrors[] = 'Пользователь с таким логином уже зарегистрирован';
} }
if(empty($arErrors)) {
$userId = User::create($_REQUEST['login'], $_REQUEST['pass'], $_REQUEST['email'], $_REQUEST['name']);
User::authorize($userId); ?>
header('Location: index.php'); <!DOCTYPE html>
} <html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
} <title>Delta Framework - Регистрация</title>
<link href="//<?php echo $_SERVER['SERVER_NAME']; ?>/admin/styles/css/style.default.css" rel="stylesheet">
?> <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!DOCTYPE html> <!--[if lt IE 9]>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<title>Delta Framework - Регистрация</title>
<link href="//<?php echo $_SERVER['SERVER_NAME']; ?>/admin/styles/css/style.default.css" rel="stylesheet">
<!-- 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/html5shiv.js"></script>
<script src="//<?= $_SERVER['SERVER_NAME']; ?>/admin/styles/js/respond.min.js"></script> <script src="//<?= $_SERVER['SERVER_NAME']; ?>/admin/styles/js/respond.min.js"></script>
<![endif]--> <![endif]-->
</head> </head>
<body class="signin"> <body class="signin">
<section> <section>
<div class="panel panel-signin"> <div class="panel panel-signin">
<div class="panel-body"> <div class="panel-body">
<div class="logo text-center"> <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 (!empty($arErrors)) { ?>
<div class="alert alert-danger">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo implode('<br>', $arErrors); ?>
</div> </div>
<?php } ?> <br/>
<h4 class="text-center mb5">Регистрация в системе</h4>
<p class="text-center">Создайте свой аккаунт</p>
<form action="register.php" method="post"> <div class="mb30"></div>
<input type="hidden" name="send" value="Y"> <?php if (!empty($arErrors)) { ?>
<div class="input-group mb15"> <div class="alert alert-danger">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<input value="<?php echo $_REQUEST['login']; ?>" type="text" class="form-control" name="login" placeholder="Логин"> <?php echo implode('<br>', $arErrors); ?>
</div><!-- input-group -->
<div class="input-group mb15">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input value="<?php echo $_REQUEST['name']; ?>" type="text" class="form-control" name="name" placeholder="Имя">
</div><!-- input-group -->
<div class="input-group mb15">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input value="<?php echo $_REQUEST['email']; ?>" type="text" class="form-control" name="email" placeholder="E-Mail">
</div><!-- input-group -->
<div class="input-group mb15">
<span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
<input value="<?php echo $_REQUEST['pass']; ?>" type="text" class="form-control" name="pass" placeholder="Пароль">
</div><!-- input-group -->
<div class="clearfix">
<div class="pull-right">
<button type="submit" class="btn btn-success">Регистрация <i class="fa fa-angle-right ml5"></i>
</button>
</div> </div>
</div> <?php } ?>
</form>
</div><!-- panel-body --> <form action="register.php" method="post">
<div class="panel-footer"> <input type="hidden" name="send" value="Y">
<a href="signup" class="btn btn-primary btn-block">Войти в систему</a> <div class="input-group mb15">
</div><!-- panel-footer --> <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
</div><!-- panel --> <input value="<?php echo $_REQUEST['login']; ?>" type="text" class="form-control" name="login" placeholder="Логин">
</div><!-- input-group -->
<div class="input-group mb15">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input value="<?php echo $_REQUEST['name']; ?>" type="text" class="form-control" name="name" placeholder="Имя">
</div><!-- input-group -->
<div class="input-group mb15">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input value="<?php echo $_REQUEST['email']; ?>" type="text" class="form-control" name="email" placeholder="E-Mail">
</div><!-- input-group -->
<div class="input-group mb15">
<span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
<input value="<?php echo $_REQUEST['pass']; ?>" type="text" class="form-control" name="pass" placeholder="Пароль">
</div><!-- input-group -->
</section> <div class="clearfix">
<div class="pull-right">
<button type="submit" class="btn btn-success">Регистрация <i class="fa fa-angle-right ml5"></i>
</button>
</div>
</div>
</form>
<script src="//<?= $_SERVER['SERVER_NAME']; ?>/admin/styles/js/jquery-1.11.1.min.js"></script> </div><!-- panel-body -->
<script src="//<?= $_SERVER['SERVER_NAME']; ?>/admin/styles/js/jquery-migrate-1.2.1.min.js"></script> <div class="panel-footer">
<script src="//<?= $_SERVER['SERVER_NAME']; ?>/admin/styles/js/bootstrap.min.js"></script> <a href="signup" class="btn btn-primary btn-block">Войти в систему</a>
<script src="//<?= $_SERVER['SERVER_NAME']; ?>/admin/styles/js/modernizr.min.js"></script> </div><!-- panel-footer -->
<script src="//<?= $_SERVER['SERVER_NAME']; ?>/admin/styles/js/pace.min.js"></script> </div><!-- panel -->
<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> </section>
</body> <script src="//<?= $_SERVER['SERVER_NAME']; ?>/admin/styles/js/jquery-1.11.1.min.js"></script>
</html> <script src="//<?= $_SERVER['SERVER_NAME']; ?>/admin/styles/js/jquery-migrate-1.2.1.min.js"></script>
<?php } ?> <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>
</body>
</html>
<?php } ?>
+87 -67
View File
@@ -1,4 +1,24 @@
<?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.
*/
use Core\Models\{User, MQ}; use Core\Models\{User, MQ};
require_once __DIR__ . '/inc/header.php'; require_once __DIR__ . '/inc/header.php';
@@ -43,7 +63,7 @@
<h4 class="panel-title">Завершенные задания</h4> <h4 class="panel-title">Завершенные задания</h4>
<p>Задания, которые были успешно выполнены</p> <p>Задания, которые были успешно выполнены</p>
</div><!-- panel-heading --> </div><!-- panel-heading -->
<div class="panel-body" id="info_threads_history"> <div class="panel-body" id="info_threads_history">
<div class="preloader"></div> <div class="preloader"></div>
</div> </div>
</div><!-- panel --> </div><!-- panel -->
@@ -51,89 +71,89 @@
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="panel panel-primary"> <div class="panel panel-primary">
<div class="panel-heading"> <div class="panel-heading">
<h4 class="panel-title">Текущая нагрузка на диспетчер очереди</h4> <h4 class="panel-title">Текущая нагрузка на диспетчер очереди</h4>
<p>Чем больше количество активных воркеров - тем больше нагрузка</p> <p>Чем больше количество активных воркеров - тем больше нагрузка</p>
</div><!-- panel-heading --> </div><!-- panel-heading -->
<div class="panel-body" id="progress"> <div class="panel-body" id="progress">
<div class="preloader"></div> <div class="preloader"></div>
</div>
</div> </div>
</div> </div>
</div> </div>
</div>
<!-- table --> <!-- table -->
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="panel panel-primary"> <div class="panel panel-primary">
<div class="panel-heading"> <div class="panel-heading">
<h4 class="panel-title">Очередь</h4> <h4 class="panel-title">Очередь</h4>
<p>Список текущих заданий очереди</p> <p>Список текущих заданий очереди</p>
</div><!-- panel-heading --> </div><!-- panel-heading -->
<div class="table-responsive" id="threads_table"> <div class="table-responsive" id="threads_table">
<div class="preloader"></div> <div class="preloader"></div>
</div><!-- table-responsive --> </div><!-- table-responsive -->
</div>
</div> </div>
</div> <!-- end table -->
<!-- end table -->
</div><!-- contentpanel --> </div><!-- contentpanel -->
<!-- table --> <!-- table -->
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="panel panel-primary"> <div class="panel panel-primary">
<div class="panel-heading"> <div class="panel-heading">
<h4 class="panel-title">Выполненные задания</h4> <h4 class="panel-title">Выполненные задания</h4>
<p>Список заверщившихся заданий</p> <p>Список заверщившихся заданий</p>
</div><!-- panel-heading --> </div><!-- panel-heading -->
<div class="table-responsive" id="threads_history_table"> <div class="table-responsive" id="threads_history_table">
<div class="preloader"></div> <div class="preloader"></div>
</div><!-- table-responsive --> </div><!-- table-responsive -->
</div>
</div> </div>
</div> <!-- end table -->
<!-- end table -->
</div><!-- contentpanel --> </div><!-- contentpanel -->
<script> <script>
var isPaused = false; var isPaused = false;
function update()
{
isPaused = true;
$.ajax({
url: 'ajax/threads.php',
cache: false,
success: function(data){
data = JSON.parse(data);
$('#info_threads').html(data.info_threads);
$('#info_threads_history').html(data.info_threads_history);
$('#progress').html(data.progress);
$('#threads_table').html(data.threads);
$('#threads_history_table').html(data.threads_history);
isPaused = false; function update() {
} isPaused = true;
$.ajax({
url: 'ajax/threads.php',
cache: false,
success: function (data) {
data = JSON.parse(data);
$('#info_threads').html(data.info_threads);
$('#info_threads_history').html(data.info_threads_history);
$('#progress').html(data.progress);
$('#threads_table').html(data.threads);
$('#threads_history_table').html(data.threads_history);
isPaused = false;
}
});
}
$(document).ready(function () {
update();
setInterval(function () {
if (!isPaused) {
update();
}
}, 500);
}); });
} </script>
$(document).ready(function(){
update();
setInterval(function () {
if(!isPaused){
update();
}
},500);
});
</script>
<?php require_once __DIR__ . '/inc/footer.php'; ?> <?php require_once __DIR__ . '/inc/footer.php'; ?>
+20 -1
View File
@@ -1,4 +1,23 @@
<?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.
*/
use Core\Models\User; use Core\Models\User;
@@ -47,7 +66,7 @@
$userObject = new User($elUser['id']); $userObject = new User($elUser['id']);
?> ?>
<tr> <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['login']; ?></td>
<td><?= $elUser['password']; ?></td> <td><?= $elUser['password']; ?></td>
<td><?= $elUser['name']; ?></td> <td><?= $elUser['name']; ?></td>
+22 -8
View File
@@ -1,4 +1,23 @@
<?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.
*/
use Core\Models\User; use Core\Models\User;
use Core\Helpers\Cache; use Core\Helpers\Cache;
@@ -107,16 +126,11 @@
// debug // debug
function sendTelegram(?string $message, ?string $file = null): void function sendTelegram(?string $message, ?string $file = null): void
{ {
(new \Core\ExternalServices\TelegramSender(TELEGRAM_BOT_TOKEN)) (new \Core\ExternalServices\TelegramSender(TELEGRAM_BOT_TOKEN))->setChat(TELEGRAM_NOTIFICATION_CHANNEL)->sendMessage($message);
->setChat(TELEGRAM_NOTIFICATION_CHANNEL)
->sendMessage($message);
if(!empty($file)) { if (!empty($file)) {
(new \Core\ExternalServices\TelegramSender(TELEGRAM_BOT_TOKEN)) (new \Core\ExternalServices\TelegramSender(TELEGRAM_BOT_TOKEN))->setChat(TELEGRAM_NOTIFICATION_CHANNEL)->sendDocument($file);
->setChat(TELEGRAM_NOTIFICATION_CHANNEL)
->sendDocument($file);
} }
} }
//end debug //end debug
+19
View File
@@ -1,4 +1,23 @@
<?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.
*/
/** /**
* Версия сервиса * Версия сервиса
+26 -8
View File
@@ -1,6 +1,27 @@
<?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.
*/
@ignore_user_abort(true); @ignore_user_abort(true);
set_time_limit(0); set_time_limit(0);
use Core\Helpers\Cache; use Core\Helpers\Cache;
use Core\Models\MQ; use Core\Models\MQ;
@@ -14,10 +35,10 @@
// Каждые 10 минут добавляем в очередь задание на проверку новостей слободы и отправку в телегу // Каждые 10 минут добавляем в очередь задание на проверку новостей слободы и отправку в телегу
$cacheId = md5('cron_myslo'); $cacheId = md5('cron_myslo');
$runMyslo = false; $runMyslo = false;
if(Cache::check($cacheId) && $cronMyslo = Cache::get($cacheId)) { if (Cache::check($cacheId) && $cronMyslo = Cache::get($cacheId)) {
if((time() - (int)$cronMyslo) > 600) { if ((time() - (int)$cronMyslo) > 600) {
$runMyslo = true; $runMyslo = true;
Cache::set($cacheId, time()); Cache::set($cacheId, time());
} }
@@ -26,9 +47,6 @@
Cache::set($cacheId, time()); Cache::set($cacheId, time());
} }
if($runMyslo === true) { if ($runMyslo === true) {
$result = (new MQ())->setAttempts(3) $result = (new MQ())->setAttempts(3)->setPriority(3)->setCheckDuplicates(true)->createTask('Core\MQTasks', 'getMySLO');
->setPriority(3)
->setCheckDuplicates(true)
->createTask('Core\MQTasks', 'getMySLO');
} }
+19
View File
@@ -1,4 +1,23 @@
<?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.
*/
namespace Core; namespace Core;
+24 -5
View File
@@ -1,4 +1,23 @@
<?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.
*/
namespace Core; namespace Core;
@@ -70,12 +89,12 @@
public function showTrace(): void public function showTrace(): void
{ {
echo '<div style="color: #b30000;background: #ffe2e2;padding: 10px;border: 1px solid #ffa0a0;margin: 10px;display: inline-block;">'; 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 '<span style="font-weight:bold; font-size: 1.1em;">' . $this->getMessage() . '</span><br>';
echo $this->getFile() . ': '.$this->getLine() . '<br>'; echo $this->getFile() . ': ' . $this->getLine() . '<br>';
$arTrace = $this->generateCallTrace(); $arTrace = $this->generateCallTrace();
foreach($arTrace as $key => $value) { foreach ($arTrace as $key => $value) {
echo '<span>'.$value.'</span><br>'; echo '<span>' . $value . '</span><br>';
} }
echo '</div>'; echo '</div>';
} }
} }
@@ -1,4 +1,23 @@
<?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.
*/
namespace Core\ExternalServices; namespace Core\ExternalServices;
@@ -39,17 +58,17 @@
return $this->responseHeader; return $this->responseHeader;
} }
private $usertAgent = null; private $usertAgent = null;
private $requestType = null; private $requestType = null;
private $url = null; private $url = null;
private $params = []; private $params = [];
private $referer = ''; private $referer = '';
private $usePostMethod = false; private $usePostMethod = false;
public function __construct() public function __construct()
{ {
@@ -1,4 +1,24 @@
<?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.
*/
/** /**
* Класс для работы с API телеграмм * Класс для работы с API телеграмм
* Поддерживает: * Поддерживает:
File diff suppressed because it is too large. Load diff
@@ -1,4 +1,24 @@
<?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.
*/
/** /**
* Класс для работы с API телеграмм (не-статический) * Класс для работы с API телеграмм (не-статический)
* *
+22 -2
View File
@@ -1,4 +1,23 @@
<?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.
*/
namespace Core\Helpers; namespace Core\Helpers;
@@ -178,7 +197,7 @@
* *
* @return bool Флаг успеха * @return bool Флаг успеха
*/ */
public static function del(string $name): bool public static function delete(string $name): bool
{ {
if (self::check($name)) { if (self::check($name)) {
if (!unlink(self::$cacheDir . md5($name) . '.tmp')) { if (!unlink(self::$cacheDir . md5($name) . '.tmp')) {
@@ -214,8 +233,9 @@
{ {
$return_size = 0; $return_size = 0;
foreach (scandir(self::$cacheDir) as $file) { foreach (scandir(self::$cacheDir) as $file) {
if ($file == '.' or $file == '..') if ($file == '.' or $file == '..') {
continue; continue;
}
$return_size = $return_size + filesize(self::$cacheDir . $file); $return_size = $return_size + filesize(self::$cacheDir . $file);
} }
return $return_size; return $return_size;
+19
View File
@@ -1,4 +1,23 @@
<?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.
*/
namespace Core\Helpers; namespace Core\Helpers;
+19
View File
@@ -1,4 +1,23 @@
<?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.
*/
/** /**
* Работа с файлами и директориями. * Работа с файлами и директориями.
+19
View File
@@ -1,4 +1,23 @@
<?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.
*/
namespace Core\Helpers; namespace Core\Helpers;
+23 -4
View File
@@ -1,4 +1,23 @@
<?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.
*/
namespace Core\Helpers; namespace Core\Helpers;
@@ -122,17 +141,17 @@
} }
} }
$subject = (empty($this->subject)) ? 'No subject' : $this->subject; $subject = (empty($this->subject)) ? 'No subject' : $this->subject;
$body = $this->body; $body = $this->body;
$boundary = md5(uniqid(time())); $boundary = md5(uniqid(time()));
$headers = [ $headers = [
'Content-Type: multipart/mixed; boundary="' . $boundary . '"', 'Content-Type: multipart/mixed; boundary="' . $boundary . '"',
'Content-Transfer-Encoding: 7bit', 'Content-Transfer-Encoding: 7bit',
'MIME-Version: 1.0', 'MIME-Version: 1.0',
'From: ' . $from, 'From: ' . $from,
'Date: ' . date('r'), 'Date: ' . date('r'),
]; ];
$message = [ $message = [
'--' . $boundary, '--' . $boundary,
'Content-Type: text/html; charset=UTF-8', 'Content-Type: text/html; charset=UTF-8',
'Content-Transfer-Encoding: base64', 'Content-Transfer-Encoding: base64',
+19
View File
@@ -1,4 +1,23 @@
<?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.
*/
namespace Core\Helpers; namespace Core\Helpers;
+91 -66
View File
@@ -1,71 +1,96 @@
<?php <?php
namespace Core\Helpers;
class Pagination
{
private static $page;
private static $total;
private static $total_pages;
private static $limit;
/** /**
* Задание первоначальных данных для пагинации * Copyright (c) 2022 Roman Grinko <rsgrinko@gmail.com>
* * Permission is hereby granted, free of charge, to any person obtaining
* @param int $page * a copy of this software and associated documentation files (the
* @param int $total * "Software"), to deal in the Software without restriction, including
* @param int $limit * 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.
*/ */
public static function execute($page, $total, $limit): void
namespace Core\Helpers;
class Pagination
{ {
self::$page = $page; private static $page;
self::$total = $total;
self::$limit = $limit; private static $total;
private static $total_pages;
private static $limit;
/**
* Задание первоначальных данных для пагинации
*
* @param int $page
* @param int $total
* @param int $limit
*/
public static function execute($page, $total, $limit): void
{
self::$page = $page;
self::$total = $total;
self::$limit = $limit;
}
/**
* Формирование лимита для выборки из базы элементов текущей страницы
*
* @return string
*/
public static function getLimit(): string
{
self::$total_pages = intval((self::$total - 1) / self::$limit) + 1;
if (empty(self::$page) or self::$page < 0) {
self::$page = 1;
}
if (self::$page > self::$total_pages) {
self::$page = self::$total_pages;
}
$start = self::$page * self::$limit - self::$limit;
$limit = $start . ', ' . self::$limit;
return $limit;
}
/**
* Вывод пагинации на страницу
*
* @param string $paginator_name
* @param array $params
*/
public static function show($paginator_name = 'page', $params = []): void
{
$url = '?';
foreach ($params as $key => $value) {
$url .= $key . '=' . $value . '&';
}
if (self::$page != 1) {
$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>';
} 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>';
}
} }
/**
* Формирование лимита для выборки из базы элементов текущей страницы
*
* @return string
*/
public static function getLimit(): string
{
self::$total_pages = intval((self::$total - 1) / self::$limit) + 1;
if (empty(self::$page) or self::$page < 0) {
self::$page = 1;
}
if (self::$page > self::$total_pages) {
self::$page = self::$total_pages;
}
$start = self::$page * self::$limit - self::$limit;
$limit = $start . ', ' . self::$limit;
return $limit;
}
/**
* Вывод пагинации на страницу
*
* @param string $paginator_name
* @param array $params
*/
public static function show($paginator_name = 'page', $params = []): void
{
$url = '?';
foreach ($params as $key => $value) {
$url .= $key . '=' . $value . '&';
}
if (self::$page != 1) {
$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>';
} 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>';
}
}
+20
View File
@@ -1,4 +1,24 @@
<?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.
*/
/** /**
* Класс реестра * Класс реестра
*/ */
@@ -1,4 +1,23 @@
<?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.
*/
namespace Core\Helpers; namespace Core\Helpers;
@@ -584,7 +603,7 @@
if (mb_strlen($text) < $limit) { if (mb_strlen($text) < $limit) {
return $text; return $text;
} else { } else {
$text = mb_substr($text, 0, $limit); $text = mb_substr($text, 0, $limit);
$length = mb_strripos($text, ' '); $length = mb_strripos($text, ' ');
$end = mb_substr($text, $length - 1, 1); $end = mb_substr($text, $length - 1, 1);
@@ -636,11 +655,14 @@
public static function arrayToXml(array $arData = [], ?string $objectName = null): string public static function arrayToXml(array $arData = [], ?string $objectName = null): string
{ {
$rootData = ''; $rootData = '';
if(!empty($objectName)) { if (!empty($objectName)) {
$rootData = ' object="' . $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); static::arrayToXmlHelper($arData, $xml);
$dom = dom_import_simplexml($xml)->ownerDocument; $dom = dom_import_simplexml($xml)->ownerDocument;
+19
View File
@@ -1,4 +1,23 @@
<?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.
*/
namespace Core\Helpers; namespace Core\Helpers;
+19
View File
@@ -1,4 +1,23 @@
<?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.
*/
namespace Core\Helpers; namespace Core\Helpers;
+26 -10
View File
@@ -1,4 +1,23 @@
<?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.
*/
namespace Core; namespace Core;
@@ -138,9 +157,7 @@
if ($res) { if ($res) {
$j++; $j++;
$DB->update( $DB->update(
'bashorg', 'bashorg', ['hash' => $hash], ['ext_id' => (int)$element['id'], 'date' => $element['date'], 'rating' => $element['rating']]
['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() public static function sendJokeToTelegram()
{ {
if(date('H') > 21 || date('H') < 9) { if (date('H') > 21 || date('H') < 9) {
return 'Нерабочее время :('; return 'Нерабочее время :(';
} }
$telegram = new \Core\ExternalServices\TelegramSender(TELEGRAM_BOT_TOKEN); $telegram = new \Core\ExternalServices\TelegramSender(TELEGRAM_BOT_TOKEN);
@@ -237,14 +254,14 @@ DELETE from `jokes` WHERE `jokes`.id not in (SELECT id FROM t_temp);'
public static function getMySLO() public static function getMySLO()
{ {
$cacheId = md5('getMySLO_criminal'); $cacheId = md5('getMySLO_criminal');
if(Cache::check($cacheId)) { if (Cache::check($cacheId)) {
$oldLink = Cache::get($cacheId); $oldLink = Cache::get($cacheId);
} else { } else {
$oldLink = ''; $oldLink = '';
} }
$file = file_get_contents('https://myslo.ru/news/criminal'); $file = file_get_contents('https://myslo.ru/news/criminal');
$file = preg_match_all('/"item width-100-tiny">(.*?)<div class="clear">/us', $file, $file2); $file = preg_match_all('/"item width-100-tiny">(.*?)<div class="clear">/us', $file, $file2);
$file2 = $file2[1][0]; $file2 = $file2[1][0];
preg_match_all('/<h1 class="h3">(.*?)<\/h1>/us', $file2, $title); preg_match_all('/<h1 class="h3">(.*?)<\/h1>/us', $file2, $title);
@@ -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]); $link = 'https://myslo.ru' . trim($link[1][0]);
if ($oldLink !== $link) {
if($oldLink !== $link) { sendTelegram('OLD (' . strlen($oldLink) . '): ' . $oldLink . PHP_EOL . 'NEW (' . strlen($link) . '): ' . $link);
sendTelegram('OLD (' .strlen($oldLink).'): ' . $oldLink . PHP_EOL . 'NEW (' .strlen($link).'): ' . $link);
sendTelegram('Обнаружен новый пост'); sendTelegram('Обнаружен новый пост');
$full = file_get_contents($link); $full = file_get_contents($link);
+19 -1
View File
@@ -1,8 +1,26 @@
<?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.
*/
namespace Core\Models; namespace Core\Models;
use Core\CoreException; use Core\CoreException;
/** /**
+19
View File
@@ -1,4 +1,23 @@
<?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.
*/
namespace Core\Models; namespace Core\Models;
+19
View File
@@ -1,4 +1,23 @@
<?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.
*/
namespace Core\Models; namespace Core\Models;
+19
View File
@@ -1,4 +1,23 @@
<?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.
*/
namespace Core\Models; namespace Core\Models;
+21 -2
View File
@@ -1,4 +1,23 @@
<?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.
*/
namespace Core\Models; namespace Core\Models;
@@ -73,7 +92,7 @@
public function addRole(int $roleId): ?int public function addRole(int $roleId): ?int
{ {
$cacheId = md5('Roles_' . $this->user->getId() . '_getRoles'); $cacheId = md5('Roles_' . $this->user->getId() . '_getRoles');
Cache::del($cacheId); Cache::delete($cacheId);
/** @var $DB DB */ /** @var $DB DB */
$DB = DB::getInstance(); $DB = DB::getInstance();
@@ -90,7 +109,7 @@
public function removeRole(int $roleId): ?int public function removeRole(int $roleId): ?int
{ {
$cacheId = md5('Roles_' . $this->user->getId() . '_getRoles'); $cacheId = md5('Roles_' . $this->user->getId() . '_getRoles');
Cache::del($cacheId); Cache::delete($cacheId);
/** @var $DB DB */ /** @var $DB DB */
$DB = DB::getInstance(); $DB = DB::getInstance();
+20 -2
View File
@@ -1,8 +1,26 @@
<?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.
*/
namespace Core\Models; namespace Core\Models;
class Router class Router
{ {
@@ -29,7 +47,7 @@
* Добавление маршрута в таблицу маршрутизации * Добавление маршрута в таблицу маршрутизации
* *
* @param string $pattern Маршрут * @param string $pattern Маршрут
* @param mixed $callback Callback функция * @param mixed $callback Callback функция
* *
* @return void * @return void
*/ */
+31 -5
View File
@@ -1,8 +1,26 @@
<?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.
*/
/** /**
* Класс для работы с пользователями * Класс для работы с пользователями
*
* @author Roman Grinko <rsgrinko@gmail.com>
*/ */
namespace Core\Models; namespace Core\Models;
@@ -190,7 +208,7 @@
{ {
$newToken = self::generateGUID(); $newToken = self::generateGUID();
(DB::getInstance())->update(self::TABLE, ['id' => $this->id], ['token' => $newToken]); (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; return $newToken;
} }
@@ -297,14 +315,15 @@
* *
* @param string $login Логин * @param string $login Логин
* @param string $password Пароль * @param string $password Пароль
* @param string $email E-Mail
* @param string $name Имя * @param string $name Имя
* @param string $image Аватар
* *
* @return int
* @throws CoreException * @throws CoreException
*/ */
public static function create(string $login, string $password, string $email, string $name = ''): int 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 */ /** @var $DB DB */
$DB = DB::getInstance(); $DB = DB::getInstance();
@@ -330,8 +349,15 @@
public function update(array $fields): bool public function update(array $fields): bool
{ {
$cacheId = md5('User_getAllUserData_' . $this->id);
/** @var $DB DB */ /** @var $DB DB */
$DB = DB::getInstance(); $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); return $DB->update(self::TABLE, ['id' => $this->id], $fields);
} }
+21 -2
View File
@@ -1,6 +1,26 @@
<?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.
*/
namespace Core; namespace Core;
use Core\Helpers\SystemFunctions; use Core\Helpers\SystemFunctions;
class Template class Template
@@ -9,7 +29,7 @@
public static function set(string $varName, string $varValue): void public static function set(string $varName, string $varValue): void
{ {
$varName = '{{' . $varName . '}}'; $varName = '{{' . $varName . '}}';
self::$arTemplateVariables[$varName] = $varValue; self::$arTemplateVariables[$varName] = $varValue;
} }
@@ -20,7 +40,6 @@
public static function render($buffer): ?string public static function render($buffer): ?string
{ {
$buffer = str_replace(array_keys(self::$arTemplateVariables), array_values(self::$arTemplateVariables), $buffer); $buffer = str_replace(array_keys(self::$arTemplateVariables), array_values(self::$arTemplateVariables), $buffer);
return $buffer; return $buffer;
} }
+17 -1
View File
@@ -1,6 +1,22 @@
<?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.
*/ */
namespace Core; 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.
*/
+41 -18
View File
@@ -1,8 +1,28 @@
<?php <?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); die('Не выбрано действие. Для справки наберите php -f partizan.php -?' . PHP_EOL);
} }
switch($argv[1]) { switch ($argv[1]) {
case 'migrate': case 'migrate':
define('DB_HOST', 'localhost'); define('DB_HOST', 'localhost');
define('DB_USER', 'rsgrinko_delta'); define('DB_USER', 'rsgrinko_delta');
@@ -10,26 +30,29 @@
define('DB_NAME', 'rsgrinko_delta'); define('DB_NAME', 'rsgrinko_delta');
define('DB_TABLE_VERSIONS', 'versions'); define('DB_TABLE_VERSIONS', 'versions');
function connectDB() { function connectDB()
{
$errorMessage = 'Невозможно подключиться к серверу базы данных'; $errorMessage = 'Невозможно подключиться к серверу базы данных';
$conn = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); $conn = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
if (!$conn) if (!$conn) {
throw new Exception($errorMessage); throw new Exception($errorMessage);
else { } else {
$query = $conn->query('set names utf8'); $query = $conn->query('set names utf8');
if (!$query) if (!$query) {
throw new Exception($errorMessage); throw new Exception($errorMessage);
else } else {
return $conn; return $conn;
}
} }
} }
function getMigrationFiles($conn) { function getMigrationFiles($conn)
{
$sqlFolder = 'migrations/'; $sqlFolder = 'migrations/';
$allFiles = glob($sqlFolder . '*.sql'); $allFiles = glob($sqlFolder . '*.sql');
$query = sprintf('show tables from `%s` like "%s"', DB_NAME, DB_TABLE_VERSIONS); $query = sprintf('show tables from `%s` like "%s"', DB_NAME, DB_TABLE_VERSIONS);
$data = $conn->query($query); $data = $conn->query($query);
$firstMigration = !$data->num_rows; $firstMigration = !$data->num_rows;
if ($firstMigration) { if ($firstMigration) {
@@ -37,8 +60,8 @@
} }
$versionsFiles = []; $versionsFiles = [];
$query = sprintf('select `name` from `%s`', DB_TABLE_VERSIONS); $query = sprintf('select `name` from `%s`', DB_TABLE_VERSIONS);
$data = $conn->query($query)->fetch_all(MYSQLI_ASSOC); $data = $conn->query($query)->fetch_all(MYSQLI_ASSOC);
foreach ($data as $row) { foreach ($data as $row) {
array_push($versionsFiles, $sqlFolder . $row['name']); array_push($versionsFiles, $sqlFolder . $row['name']);
} }
@@ -46,15 +69,16 @@
} }
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); $command = sprintf('mysql -u%s -p%s -h %s -D %s < %s', DB_USER, DB_PASSWORD, DB_HOST, DB_NAME, $file);
shell_exec($command); shell_exec($command);
$baseName = basename($file); $baseName = basename($file);
$query = sprintf('insert into `%s` (`name`) values("%s")', DB_TABLE_VERSIONS, $baseName); $query = sprintf('insert into `%s` (`name`) values("%s")', DB_TABLE_VERSIONS, $baseName);
$conn->query($query); $conn->query($query);
} }
$conn = connectDB(); $conn = connectDB();
$files = getMigrationFiles($conn); $files = getMigrationFiles($conn);
if (empty($files)) { if (empty($files)) {
echo 'Ваша база данных в актуальном состоянии.'; echo 'Ваша база данных в актуальном состоянии.';
@@ -72,7 +96,6 @@
} }
break; break;
default: default:
echo 'Неизвестная команда' . PHP_EOL; echo 'Неизвестная команда' . PHP_EOL;
+21 -2
View File
@@ -1,6 +1,27 @@
<?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.
*/
use Core\Models\Router; use Core\Models\Router;
Router::route('/', '\Core\App::index'); Router::route('/', '\Core\App::index');
Router::route('/404', function () { Router::route('/404', function () {
@@ -13,8 +34,6 @@
}); });
Router::route('/test', '\Core\App::test'); Router::route('/test', '\Core\App::test');
Router::route('/test/(\d+)', '\Core\App::test'); Router::route('/test/(\d+)', '\Core\App::test');
+19
View File
@@ -1,4 +1,23 @@
<?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.
*/
/** /**
* Инициализация runtime * Инициализация runtime
+19
View File
@@ -1,4 +1,23 @@
<?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.
*/
/** /**
* Воркер диспетчера очереди * Воркер диспетчера очереди
+69 -51
View File
@@ -1,4 +1,23 @@
<?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.
*/
use Core\CoreException; use Core\CoreException;
use Core\ExternalServices\Telegram; use Core\ExternalServices\Telegram;
@@ -7,7 +26,7 @@
const USE_ROUTER = true; const USE_ROUTER = true;
require_once $_SERVER['DOCUMENT_ROOT'] . '/core/bootstrap.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/core/bootstrap.php';
?> ?>
<!doctype html> <!doctype html>
<html lang="ru"> <html lang="ru">
<head> <head>
@@ -22,7 +41,8 @@
<nav class="navbar navbar-expand-md navbar-dark bg-dark" aria-label="Fourth navbar example"> <nav class="navbar navbar-expand-md navbar-dark bg-dark" aria-label="Fourth navbar example">
<div class="container-fluid"> <div class="container-fluid">
<a class="navbar-brand" href="#">Delta Framework</a> <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> <span class="navbar-toggler-icon"></span>
</button> </button>
@@ -50,49 +70,53 @@
</nav> </nav>
<div class="container"> <div class="container">
<div class="row justify-content-md-center"> <div class="row justify-content-md-center">
<div class="col-md"> <div class="col-md">
<?php <?php
echo $_REQUEST['route'] . '<br>'; echo $_REQUEST['route'] . '<br>';
if (User::isAuthorized()) { if (User::isAuthorized()) {
global $USER; 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']; $count = (int)(DB::getInstance())->query('select count(*) as count from users')[0]['count'];
Pagination::execute($_REQUEST['page'], $count, 2); Pagination::execute($_REQUEST['page'], $count, 2);
$limit = Pagination::getLimit(); $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 = []; $arResult = [];
foreach ($arData as $element) { foreach ($arData as $element) {
//(new User($element['id']))->addToGroup(2); //(new User($element['id']))->addToGroup(2);
$arResult[$element['id']] = [ $arResult[$element['id']] = [
'id' => $element['id'], 'id' => $element['id'],
'login' => $element['login'], 'login' => $element['login'],
//'password' => $element['password'], //'password' => $element['password'],
'name' => $element['name'], 'name' => $element['name'],
'email' => $element['email'], 'email' => $element['email'],
'image' => $element['image'], 'image' => $element['image'],
'token' => $element['token'], 'token' => $element['token'],
'last_active' => $element['last_active'], '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) {
//'groups_human' => User::getAllGroups(), return Roles::getAllRoles()[$element];
}, (new User($element['id']))->getRolesObject()->getRoles()),
//'groups_human' => User::getAllGroups(),
]; ];
} }
echo '<nav aria-label="Page navigation example">'; echo '<nav aria-label="Page navigation example">';
Pagination::show('page'); Pagination::show('page');
echo '</nav>'; 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> </div>
</div> </div>
@@ -107,26 +131,20 @@ echo str_replace('<table style="', '<table style="width:100%;', SystemFunctions:
</ul> </ul>
<?php <?php
$finish_time = microtime(true); $finish_time = microtime(true);
$delta = round($finish_time - START_TIME, 3); $delta = round($finish_time - START_TIME, 3);
if ($delta < 0.001) { if ($delta < 0.001) {
$delta = 0.001; $delta = 0.001;
} }
$cacheSize = Cache::getCacheSize(); $cacheSize = Cache::getCacheSize();
echo '<p class="text-center text-muted">Использовано ОЗУ: ' echo '<p class="text-center text-muted">Использовано ОЗУ: ' . round(memory_get_usage() / 1024 / 1024, 2) . ' МБ / БД: ' . round(
. round(memory_get_usage() / 1024 / 1024, 2) DB::$workingTime,
. ' МБ / БД: ' 3
. round(DB::$workingTime, 3) ) . ' сек (' . DB::$quantity . ' шт.) / Кэш: ' . Files::convertBytes($cacheSize) . ' / Генерация: ' . $delta . ' сек</p>';
. ' сек ('
. 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> </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> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"
</body> integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
</body>
</html> </html>
+29 -4
View File
@@ -1,4 +1,23 @@
<?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.
*/
use Core\CoreException; use Core\CoreException;
use Core\ExternalServices\Telegram; 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\\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\\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\\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\\Pagination;');">
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\Helpers\\Registry;');">Registry</button> Pagination
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\Helpers\\SystemFunctions;');">SystemFunctions</button> </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\\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> <button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\Template;');">Template</button>
</div> </div>
+21
View File
@@ -1,6 +1,27 @@
<?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.
*/
$_SERVER['DOCUMENT_ROOT'] = '/home/rsgrinko/sites/dev.it-stories.ru'; $_SERVER['DOCUMENT_ROOT'] = '/home/rsgrinko/sites/dev.it-stories.ru';
require_once $_SERVER['DOCUMENT_ROOT'] . '/core/bootstrap.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/core/bootstrap.php';
use Core\MQTasks; use Core\MQTasks;
echo MQTasks::sendJokeToTelegram(); echo MQTasks::sendJokeToTelegram();