diff --git a/admin/ajax/threads.php b/admin/ajax/threads.php index a9ea80f..69c115e 100644 --- a/admin/ajax/threads.php +++ b/admin/ajax/threads.php @@ -194,7 +194,7 @@ diff --git a/core/config.php b/core/config.php index 5ed093f..18cd0ae 100644 --- a/core/config.php +++ b/core/config.php @@ -81,6 +81,7 @@ const DB_USER = 'rsgrinko_delta'; const DB_PASSWORD = '2670135'; const DB_NAME = 'rsgrinko_delta'; + const DB_TABLE_PREFIX = 'd_'; /** * Путь до шаблонов diff --git a/core/lib/Core/MQTasks.class.php b/core/lib/Core/MQTasks.class.php index e65a2bf..9a3b6e9 100644 --- a/core/lib/Core/MQTasks.class.php +++ b/core/lib/Core/MQTasks.class.php @@ -423,34 +423,6 @@ DELETE from `jokes` WHERE `jokes`.id not in (SELECT id FROM t_temp);' } - public static function saveVisaviThreads(int $page = 1) - { - //181 - $link = 'https://visavi.net/api/forums/3?token=27e11369d8c770b3cb6d5e211a5aab99&page=' . $page; - $res = file_get_contents($link); - $res = json_decode($res, true, 512, JSON_THROW_ON_ERROR); - if (empty($res['data'])) { - throw new CoreException('Данных для обработки не найдено'); - } - $result= []; - /** @var DB $DB */ - $DB = DB::getInstance(); - foreach($res['data'] as $thread) { - $result[] = $DB->addItem('visavi_themes', ['thread_id' => (int)$thread['id'], 'title' => addslashes($thread['title'])]); - } - return $result; - } - - public function saveSiteScreen(string $url = 'it-stories.ru') - { - $image = file_get_contents('https://screen.2ip.ru/?url=' . $url); - if (empty($image)) { - throw new CoreException('Не удалось получить содержимое'); - } - return file_put_contents($_SERVER['DOCUMENT_ROOT'] . '/uploads/screens/' . $url . ' .png', $image); - } - - public static function getStory($from = null) { $tableName = 'podslyshano'; @@ -508,15 +480,4 @@ DELETE from `jokes` WHERE `jokes`.id not in (SELECT id FROM t_temp);' return 'Добавлено постов: ' . count($result); } - - public static function addIntoVisits($pageId, $date, $count) { - $DB = DB::getInstance(); - /** @var DB $DB */ - $arData = ['page_id' => $pageId, 'counter' => $count, 'date' => date('Y-m-d', strtotime($date))]; - //INSERT INTO `visits` (`id`, `page_id`, `counter`, `date`) VALUES (NULL, '123', '12', '2023-02-22'); - $res = $DB->addItem('visits', $arData); - - return $arData; - } - } \ No newline at end of file diff --git a/core/lib/Core/Models/File.class.php b/core/lib/Core/Models/File.class.php index e9f32a4..998104d 100644 --- a/core/lib/Core/Models/File.class.php +++ b/core/lib/Core/Models/File.class.php @@ -29,7 +29,7 @@ /** * Таблица заданий */ - const TABLE = 'files'; + const TABLE = DB_TABLE_PREFIX . 'files'; /** * Папка с файлами diff --git a/core/lib/Core/Models/MQ.class.php b/core/lib/Core/Models/MQ.class.php index b8905b0..472550f 100644 --- a/core/lib/Core/Models/MQ.class.php +++ b/core/lib/Core/Models/MQ.class.php @@ -28,10 +28,10 @@ class MQ { /** Таблица заданий */ - public const TABLE = 'threads'; + public const TABLE = DB_TABLE_PREFIX . 'threads'; /** Таблица истории заданий */ - public const TABLE_HISTORY = 'threads_history'; + public const TABLE_HISTORY = DB_TABLE_PREFIX . 'threads_history'; /** Формат даты и времени */ public const DATETIME_FORMAT = 'Y-m-d H:i:s'; diff --git a/core/lib/Core/Models/Posts.class.php b/core/lib/Core/Models/Posts.class.php index 41e0e8d..cbc8df5 100644 --- a/core/lib/Core/Models/Posts.class.php +++ b/core/lib/Core/Models/Posts.class.php @@ -31,7 +31,7 @@ class Posts { - private const TABLE = 'posts'; + private const TABLE = DB_TABLE_PREFIX . 'posts'; private const TABLE_SECTIONS = 'sections'; diff --git a/core/lib/Core/Models/Roles.class.php b/core/lib/Core/Models/Roles.class.php index 18ebef0..da594f7 100644 --- a/core/lib/Core/Models/Roles.class.php +++ b/core/lib/Core/Models/Roles.class.php @@ -30,12 +30,12 @@ /** * Таблица с ролями пользователей */ - const USER_ROLES_TABLE = 'user_roles'; + const USER_ROLES_TABLE = DB_TABLE_PREFIX . 'user_roles'; /** * Таблица с ролями */ - const ROLES_TABLE = 'roles'; + const ROLES_TABLE = DB_TABLE_PREFIX . 'roles'; /** * Роль "администратор" diff --git a/core/lib/Core/Models/User.class.php b/core/lib/Core/Models/User.class.php index 884df3d..ae41bfc 100644 --- a/core/lib/Core/Models/User.class.php +++ b/core/lib/Core/Models/User.class.php @@ -63,7 +63,7 @@ /** * Таблица с пользователями */ - private const TABLE = 'users'; + private const TABLE = DB_TABLE_PREFIX . 'users'; /** * @var string $cryptoSalt Соль для шифрования diff --git a/core/lib/Core/Models/UserMeta.class.php b/core/lib/Core/Models/UserMeta.class.php index 39784fc..0f15dce 100644 --- a/core/lib/Core/Models/UserMeta.class.php +++ b/core/lib/Core/Models/UserMeta.class.php @@ -9,7 +9,7 @@ /** * Таблица с мета полями */ - const TABLE = 'user_meta'; + const TABLE = DB_TABLE_PREFIX . 'user_meta'; /** * @var User $user diff --git a/test3.php b/test3.php index f5e30e5..263c436 100644 --- a/test3.php +++ b/test3.php @@ -5,38 +5,3 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/core/bootstrap.php'; $DB = DB::getInstance(); - - $post_id = 123; - -/* - $res = $DB->query('SELECT `counter` AS `views` FROM `visits` WHERE `page_id` = ' . $post_id . ' AND `date` = CURDATE()')[0]; - echo $res['views'];*/ - - - $res = $DB->query('SELECT * FROM `visits` WHERE `page_id` = '.$post_id.' ORDER BY `date` limit 31') ?: []; - - - $list = array(); - foreach ($res as $row) { - $list[] = array('year' => date('d.m.Y', strtotime($row['date'])), 'value' => $row['counter']); - } -?> - - - - - -
Статистика отсутствует
- -
- - -