diff --git a/core/lib/Core/App.class.php b/core/lib/Core/App.class.php
index 5fe4623..17b3361 100644
--- a/core/lib/Core/App.class.php
+++ b/core/lib/Core/App.class.php
@@ -21,21 +21,47 @@
namespace Core;
- use Core\Models\Posts;
+ use Core\DataBases\DB;
+ use Core\Helpers\Cache;
+ use Core\Helpers\Files;
+ use Core\Helpers\SystemFunctions;
+ use Core\Models\{Posts, User};
class App
{
+
+ /**
+ * Отрисовка главной страницы
+ *
+ * @return void
+ * @throws CoreException
+ */
public static function index()
{
global $twig, $USER;
- $userData = $USER ? $USER->getAllUserData() : '';
- $userRoles = $USER ? $USER->getRolesObject()->getFullRoles() : '';
+
+ $finish_time = microtime(true);
+ $delta = round($finish_time - START_TIME, 3);
+ if ($delta < 0.001) {
+ $delta = 0.001;
+ }
+
echo $twig->render(
'index.twig',
[
- 'sections' => (new Posts())->getMainSections(),
- 'user' => $USER ? $USER->getAllUserData() : null,
- ]
+ 'isAuthorized' => User::isAuthorized(),
+ 'isAdmin' => User::isAuthorized() && $USER->isAdmin(),
+ 'userDataTable' => User::isAuthorized() ? str_replace(
+ '
getAllUserData(), 'Информация о пользователе')
+ ) : '',
+ 'statString' => 'Использовано ОЗУ: '
+ . round(memory_get_usage() / 1024 / 1024, 2) . ' МБ / БД: '
+ . round(DB::$workingTime,3) . ' сек (' . DB::$quantity . ' шт.) / Кэш: '
+ . Files::convertBytes(Cache::getCacheSize())
+ . ' / Генерация: ' . $delta . ' сек',
+ ]
);
}
diff --git a/index.php b/index.php
index 3a1b178..cfc9d25 100644
--- a/index.php
+++ b/index.php
@@ -85,11 +85,11 @@
//echo str_replace('query('select count(*) as count from users')[0]['count'];
+ $count = (int)(DB::getInstance())->query('select count(*) as count from d_users')[0]['count'];
Pagination::execute($_REQUEST['page'], $count, 2);
$limit = Pagination::getLimit();
- $arData = (DB::getInstance())->query('select * from users order by id desc limit ' . $limit);
+ $arData = (DB::getInstance())->query('select * from d_users order by id desc limit ' . $limit);
$arResult = [];
foreach ($arData as $element) {
diff --git a/phpcmd.php b/phpcmd.php
index b2efa28..1154484 100644
--- a/phpcmd.php
+++ b/phpcmd.php
@@ -19,6 +19,7 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+ die();
use Core\DataBases\DB;
use Core\Helpers\{Cache, Files};
use Core\Models\{User};
diff --git a/templates/index.twig b/templates/index.twig
index 76b86a7..b0e524f 100644
--- a/templates/index.twig
+++ b/templates/index.twig
@@ -1,536 +1,78 @@
-{% extends 'layout.twig' %}
-
-
-
-{% block title %}Главная страница{% endblock %}
-
-{% block main %}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Music
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-