core/api/modules/code/index.php

64 lines
4.2 KiB
PHP
Raw Normal View History

2023-08-14 09:15:58 +05:00
<?php
ini_set('display_errors', 0 );
if ( $_SESSION['dostup'] != 'a' && $_SESSION['dostup'] != 'e' && $_SESSION['dostup'] != 'c' ) header( 'Location: /login/' );// && $dostup!='m'
/* ----------------------------------------------------------------------
14.12.2022
Читаем заметки
---------------------------------------------------------------------- */
$zametka = \DB::getValue( 'SELECT `txt` FROM `zametka` WHERE `user_id`=' . $_SESSION['user_id'] );
$smarty -> assign( 'zametka', $zametka );
/* ----------------------------------------------------------------------
14.12.2022
Получаем инфу о пользователе
---------------------------------------------------------------------- */
$smarty -> assign( 'userInfo', \core::getUserInfo( $_SESSION['user_id'] ) );
/* ----------------------------------------------------------------------
14.12.2022
Получаем список задач
---------------------------------------------------------------------- */
$tasks = \DB::getAll( "SELECT * FROM `tasks` WHERE `user_id`=? OR `isp_id`=? ORDER BY `id` DESC LIMIT 10", array($_SESSION['user_id'], $_SESSION['user_id'] ) );
$smarty -> assign( 'tasks', $tasks );
/* ----------------------------------------------------------------------
14.12.2022
Получаем список разработчиков
---------------------------------------------------------------------- */
$coders = \DB::getAll( "SELECT * FROM `users` WHERE `dostup`='a' OR `dostup`='c' ORDER BY `fio`" );
$smarty -> assign( 'coders', $coders );
/* ----------------------------------------------------------------------
26.12.2022
Товар без картинок
---------------------------------------------------------------------- */
$tovarBezImg = \DB::getAll( "SELECT count(*) FROM `tovar` WHERE (`countImg`=0 OR `countImg`='' OR `countImg` ISNULL) AND `status`=1" );
$smarty -> assign( 'tovarBezImg', $tovarBezImg[0]['count(*)'] );
/* ----------------------------------------------------------------------
26.12.2022
Товар без цен
---------------------------------------------------------------------- */
//$tovarBezCen = \DB::getAll( "SELECT count(*) FROM `tovar` WHERE `id` IN ( SELECT `tovar_id` FROM `tovar_price_history` ) ");
//$allTovar = \DB::getAll( "SELECT count(*) FROM `tovar`");
//$smarty -> assign( 'tovarBezCen', $allTovar[0]['count(*)']- $tovarBezCen[0]['count(*)'] );
/* ----------------------------------------------------------------------
03.01.2023
Берем статистику критически важных модулей
---------------------------------------------------------------------- */
$smarty -> assign( 'stat_tovar_show', round(\DB::getValue("SELECT AVG(speed) FROM `site_speed` WHERE `mod`='tovar_show' ORDER BY `t` DESC LIMIT 10000"), 4) );
$smarty -> assign( 'stat_tovar_cat', round(\DB::getValue("SELECT AVG(speed) FROM `site_speed` WHERE `mod`='tovar_cat' ORDER BY `t` DESC LIMIT 10000"), 4) );
$smarty -> assign( 'stat_main', round(\DB::getValue("SELECT AVG(speed) FROM `site_speed` WHERE `mod`='main' ORDER BY `t` DESC LIMIT 10000"), 4) );
$smarty -> assign( 'stat_cart', round(\DB::getValue("SELECT AVG(speed) FROM `site_speed` WHERE `mod`='cart' ORDER BY `t` DESC LIMIT 10000"), 4) );
$smarty -> assign( 'stat_sitemap', round(\DB::getValue("SELECT AVG(speed) FROM `site_speed` WHERE `mod`='qsitemap' ORDER BY `t` DESC LIMIT 10000"), 4) );
$smarty -> assign( 'stat_css', round(\DB::getValue("SELECT AVG(speed) FROM `site_speed` WHERE `mod`='css' ORDER BY `t` DESC LIMIT 10000"), 4) );
$smarty -> assign( 'stat_lk', round(\DB::getValue("SELECT AVG(speed) FROM `site_speed` WHERE `mod`='lk' ORDER BY `t` DESC LIMIT 10000"), 4) );
$smarty -> assign( 'stat_act', round(\DB::getValue("SELECT AVG(speed) FROM `site_speed` WHERE `mod`='act' ORDER BY `t` DESC LIMIT 10000"), 4) );
$smarty -> assign( 'cat', round(\DB::getValue("SELECT AVG(speed) FROM `site_speed` WHERE `mod`='cat' ORDER BY `t` DESC LIMIT 10000"), 4) );
$smarty -> assign( 'page', round(\DB::getValue("SELECT AVG(speed) FROM `site_speed` WHERE `mod`='page' ORDER BY `t` DESC LIMIT 10000"), 4) );
?>