assign('page', $page); /* ---------------------------------------------------------------------- 11.02.2023 Получаем данные о пользователе ---------------------------------------------------------------------- */ $autor=\DB::getAll("SELECT * FROM `users` WHERE `id`=? LIMIT 1", $page[0]['user_id']); if ($autor[0]['dostup']=='a')$autor[0]['dostup']='Администратор сайта'; $smarty->assign('autor', $autor); /* ---------------------------------------------------------------------- 11.02.2023 Получаем количество статей пользователя ---------------------------------------------------------------------- */ $pageskolvo=\DB::getAll("SELECT count(*) FROM `pages` WHERE `user_id`=? AND `status`=1", $page[0]['user_id']); $smarty->assign('pageskolvo', $pageskolvo[0]['count(*)']); /* ---------------------------------------------------------------------- 11.02.2023 Получаем коментарии ---------------------------------------------------------------------- */ $comments=\DB::getAll("SELECT * FROM `pages_comments` WHERE `page_id`=? AND `status`=1 ORDER BY `id` DESC", $page[0]['id']); //Получаем инфу о пользователе - аву и фио for ($i=0; $iassign('comments', $comments); /* ---------------------------------------------------------------------- 14.02.2023 Пишем статистику ---------------------------------------------------------------------- */ $see=\DB::getValue("SELECT `see` FROM `pages` WHERE `id`=? LIMIT 1", $page[0]['id']); $user_id=($_SESSION['user_id'])?$_SESSION['user_id']:session_id(); $id=\DB::getValue("SELECT `id` FROM `likes` WHERE `content_id`=? AND `user_id`=? AND `tip`='see' LIMIT 1", array($page[0]['id'], $user_id)); if (!$id){ $see++; \DB::set("UPDATE `pages` SET `see`=? WHERE `id`=? LIMIT 1", array($see, $page[0]['id'])); \DB::add("INSERT INTO `likes` (`user_id`, `content_id`, `tip`) VALUES(?, ?, ?)", array($user_id, $page[0]['id'], 'see')); } $smarty->assign('see', $see); ?>