ADD: GeSHi (Highlighter)
This commit is contained in:
parent
e2784d7cfe
commit
533198d8d0
27 changed files with 216 additions and 312 deletions
|
@ -25,9 +25,8 @@ class ProfileController extends Controller
|
|||
$posts = FeedModel::feed($this->pageNumber, $this->limit, $this->user, 'profile.posts', $profile['id']);
|
||||
$pagesCount = FeedModel::feedCount($this->user, 'profile.posts', $profile['id']);
|
||||
|
||||
//[count_posts] => 244 [count_answers] => 408 [count_comments] => 580 [count_items] => 65 )
|
||||
$count = UserModel::contentCount($profile['id']);
|
||||
|
||||
$count = UserModel::contentCount($profile['id']);
|
||||
if (($count['count_answers'] + $count['count_comments']) < 3) {
|
||||
Request::getHead()->addMeta('robots', 'noindex');
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ class Parser
|
|||
$jevix->cfgSetTagShort(['img', 'hr']);
|
||||
|
||||
// Преформатированные теги. (в них все будет заменятся на HTML сущности)
|
||||
// $jevix->cfgSetTagPreformatted(['pre', 'code']);
|
||||
$jevix->cfgSetTagPreformatted(['pre', 'code']);
|
||||
|
||||
// Теги, которые необходимо вырезать из текста вместе с контентом.
|
||||
$jevix->cfgSetTagCutWithContent(['script', 'style', 'br']);
|
||||
|
@ -115,9 +115,11 @@ class Parser
|
|||
{
|
||||
$content = htmlspecialchars_decode($content);
|
||||
$content = preg_replace('#^<code>(.*)<\/code>$#uis', '$1', $content);
|
||||
$formatter = null;
|
||||
$code = \Kadet\Highlighter\highlight($content, new Kadet\Highlighter\Language\Php(), $formatter);
|
||||
|
||||
return '<pre class="lb">' . $code . '</pre>';
|
||||
$geshi = new GeSHi($content, 'php');
|
||||
// нумер.
|
||||
// $geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
|
||||
|
||||
return '<pre class="language-css">' . $geshi->parse_code() . '</pre>';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ class AnswerModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
// Все ответы
|
||||
public static function getAnswers($page, $limit, $user, $sheet)
|
||||
{
|
||||
$uid = $user['id'];
|
||||
$user_id = $user['id'];
|
||||
$sort = self::sorts($sheet);
|
||||
$start = ($page - 1) * $limit;
|
||||
$sql = "SELECT
|
||||
|
@ -75,9 +75,9 @@ class AnswerModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
INNER JOIN users u ON u.id = answer_user_id
|
||||
INNER JOIN posts ON answer_post_id = post_id
|
||||
LEFT JOIN votes_answer ON votes_answer_item_id = answer_id
|
||||
AND votes_answer_user_id = $uid
|
||||
AND votes_answer_user_id = $user_id
|
||||
LEFT JOIN favorites fav ON fav.tid = answer_id
|
||||
AND fav.user_id = $uid
|
||||
AND fav.user_id = $user_id
|
||||
AND fav.action_type = 'answer'
|
||||
$sort
|
||||
ORDER BY answer_id DESC LIMIT :start, :limit ";
|
||||
|
@ -117,7 +117,7 @@ class AnswerModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
|
||||
|
||||
// Получаем ответы в посте
|
||||
public static function getAnswersPost($post_id, $uid, $type)
|
||||
public static function getAnswersPost($post_id, $user_id, $type)
|
||||
{
|
||||
$sort = "";
|
||||
if ($type == 1) {
|
||||
|
@ -155,9 +155,9 @@ class AnswerModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
FROM answers
|
||||
LEFT JOIN users u ON u.id = answer_user_id
|
||||
LEFT JOIN votes_answer ON votes_answer_item_id = answer_id
|
||||
AND votes_answer_user_id = $uid
|
||||
AND votes_answer_user_id = $user_id
|
||||
LEFT JOIN favorites fav ON fav.tid = answer_id
|
||||
AND fav.user_id = $uid
|
||||
AND fav.user_id = $user_id
|
||||
AND fav.action_type = 'answer'
|
||||
WHERE answer_post_id = $post_id
|
||||
$sort ";
|
||||
|
@ -166,7 +166,7 @@ class AnswerModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
}
|
||||
|
||||
// Страница ответов участника
|
||||
public static function userAnswers($page, $limit, $uid, $uid_vote)
|
||||
public static function userAnswers($page, $limit, $user_id, $uid_vote)
|
||||
{
|
||||
$start = ($page - 1) * $limit;
|
||||
$sql = "SELECT
|
||||
|
@ -197,24 +197,24 @@ class AnswerModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
LEFT JOIN posts ON answer_post_id = post_id
|
||||
LEFT JOIN votes_answer ON votes_answer_item_id = answer_id
|
||||
AND votes_answer_user_id = :uid_vote
|
||||
WHERE answer_user_id = :uid
|
||||
WHERE answer_user_id = :user_id
|
||||
AND answer_is_deleted = 0 AND post_is_deleted = 0 AND post_tl = 0 AND post_tl = 0
|
||||
ORDER BY answer_id DESC LIMIT :start, :limit ";
|
||||
|
||||
return DB::run($sql, ['uid' => $uid, 'uid_vote' => $uid_vote, 'start' => $start, 'limit' => $limit])->fetchAll();
|
||||
return DB::run($sql, ['user_id' => $user_id, 'uid_vote' => $uid_vote, 'start' => $start, 'limit' => $limit])->fetchAll();
|
||||
}
|
||||
|
||||
// Количество ответов участника
|
||||
public static function userAnswersCount($uid)
|
||||
public static function userAnswersCount($user_id)
|
||||
{
|
||||
$sql = "SELECT
|
||||
answer_id
|
||||
FROM answers
|
||||
LEFT JOIN posts ON answer_post_id = post_id
|
||||
WHERE answer_user_id = :uid AND answer_is_deleted = 0
|
||||
WHERE answer_user_id = :user_id AND answer_is_deleted = 0
|
||||
AND post_is_deleted = 0 AND post_tl = 0 AND post_tl = 0";
|
||||
|
||||
return DB::run($sql, ['uid' => $uid])->rowCount();
|
||||
return DB::run($sql, ['user_id' => $user_id])->rowCount();
|
||||
}
|
||||
|
||||
// Информацию по id ответа
|
||||
|
|
|
@ -18,13 +18,13 @@ class AuditModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
|
||||
// Let's limit How many complaints are filed today (for frequency limitation)
|
||||
// Сколько жалоб подано сегодня (для ограничение частоты)
|
||||
public static function getSpeedReport($uid)
|
||||
public static function getSpeedReport($user_id)
|
||||
{
|
||||
$sql = "SELECT id FROM audits
|
||||
WHERE user_id = :uid AND type_belonging = 'report'
|
||||
WHERE user_id = :user_id AND type_belonging = 'report'
|
||||
AND add_date >= DATE_SUB(NOW(), INTERVAL 1 DAY)";
|
||||
|
||||
return DB::run($sql, ['uid' => $uid])->rowCount();
|
||||
return DB::run($sql, ['user_id' => $user_id])->rowCount();
|
||||
}
|
||||
|
||||
// Get a list of forbidden stop words
|
||||
|
|
|
@ -30,7 +30,7 @@ class AuthModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
return DB::run($sql, ['ip' => $ip])->fetch();
|
||||
}
|
||||
|
||||
public static function getAuthTokenByUserId($uid)
|
||||
public static function getAuthTokenByUserId($user_id)
|
||||
{
|
||||
$sql = "SELECT
|
||||
auth_id,
|
||||
|
@ -39,9 +39,9 @@ class AuthModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
auth_hashedvalidator,
|
||||
auth_expires
|
||||
FROM users_auth_tokens
|
||||
WHERE auth_user_id = :uid";
|
||||
WHERE auth_user_id = :user_id";
|
||||
|
||||
return DB::run($sql, ['uid' => $uid])->fetch();
|
||||
return DB::run($sql, ['user_id' => $user_id])->fetch();
|
||||
}
|
||||
|
||||
public static function insertToken($params)
|
||||
|
@ -89,10 +89,10 @@ class AuthModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
return DB::run($sql, $params);
|
||||
}
|
||||
|
||||
public static function deleteTokenByUserId($uid)
|
||||
public static function deleteTokenByUserId($user_id)
|
||||
{
|
||||
$sql = "DELETE FROM users_auth_tokens WHERE auth_user_id = :uid";
|
||||
$sql = "DELETE FROM users_auth_tokens WHERE auth_user_id = :user_id";
|
||||
|
||||
return DB::run($sql, ['uid' => $uid]);
|
||||
return DB::run($sql, ['user_id' => $user_id]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ class CommentModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
}
|
||||
|
||||
// Получаем комментарии к ответу
|
||||
public static function getComments($answer_id, $uid)
|
||||
public static function getComments($answer_id, $user_id)
|
||||
{
|
||||
$sql = "SELECT
|
||||
comment_id,
|
||||
|
@ -170,14 +170,14 @@ class CommentModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
FROM comments
|
||||
LEFT JOIN users ON id = comment_user_id
|
||||
LEFT JOIN votes_comment ON votes_comment_item_id = comment_id
|
||||
AND votes_comment_user_id = :uid
|
||||
AND votes_comment_user_id = :user_id
|
||||
WHERE comment_answer_id = " . $answer_id;
|
||||
|
||||
return DB::run($sql, ['uid' => $uid])->fetchAll();
|
||||
return DB::run($sql, ['user_id' => $user_id])->fetchAll();
|
||||
}
|
||||
|
||||
// Страница комментариев участника
|
||||
public static function userComments($page, $limit, $uid, $id)
|
||||
public static function userComments($page, $limit, $user_id, $id)
|
||||
{
|
||||
$start = ($page - 1) * $limit;
|
||||
$sql = "SELECT
|
||||
|
@ -208,24 +208,24 @@ class CommentModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
LEFT JOIN posts ON comment_post_id = post_id
|
||||
LEFT JOIN votes_comment ON votes_comment_item_id = comment_id
|
||||
AND votes_comment_user_id = :id
|
||||
WHERE comment_user_id = :uid AND comment_is_deleted = 0
|
||||
WHERE comment_user_id = :user_id AND comment_is_deleted = 0
|
||||
AND post_is_deleted = 0 AND post_tl = 0
|
||||
ORDER BY comment_id DESC LIMIT :start, :limit";
|
||||
|
||||
return DB::run($sql, ['uid' => $uid, 'id' => $id, 'start' => $start, 'limit' => $limit])->fetchAll();
|
||||
return DB::run($sql, ['user_id' => $user_id, 'id' => $id, 'start' => $start, 'limit' => $limit])->fetchAll();
|
||||
}
|
||||
|
||||
// Количество комментариев участника
|
||||
public static function userCommentsCount($uid)
|
||||
public static function userCommentsCount($user_id)
|
||||
{
|
||||
$sql = "SELECT
|
||||
comment_id
|
||||
FROM comments
|
||||
LEFT JOIN posts ON comment_post_id = post_id
|
||||
WHERE comment_user_id = :uid AND comment_is_deleted = 0
|
||||
WHERE comment_user_id = :user_id AND comment_is_deleted = 0
|
||||
AND post_is_deleted = 0 AND post_tl = 0";
|
||||
|
||||
return DB::run($sql, ['uid' => $uid])->rowCount();
|
||||
return DB::run($sql, ['user_id' => $user_id])->rowCount();
|
||||
}
|
||||
|
||||
// Получаем комментарий по id комментария
|
||||
|
|
|
@ -8,9 +8,9 @@ class FacetModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
{
|
||||
// All facets
|
||||
// Все фасеты
|
||||
public static function getFacetsAll($page, $limit, $uid, $sort, $type)
|
||||
public static function getFacetsAll($page, $limit, $user_id, $sort, $type)
|
||||
{
|
||||
$signet = self::sorts($sort, $uid, $type);
|
||||
$signet = self::sorts($sort, $user_id, $type);
|
||||
|
||||
$start = ($page - 1) * $limit;
|
||||
$sql = "SELECT
|
||||
|
@ -29,16 +29,16 @@ class FacetModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
facet_type,
|
||||
facet_is_deleted
|
||||
FROM facets
|
||||
LEFT JOIN facets_signed ON signed_facet_id = facet_id AND signed_user_id = $uid
|
||||
LEFT JOIN facets_signed ON signed_facet_id = facet_id AND signed_user_id = $user_id
|
||||
$signet
|
||||
LIMIT :start, :limit";
|
||||
|
||||
return DB::run($sql, ['start' => $start, 'limit' => $limit])->fetchAll();
|
||||
}
|
||||
|
||||
public static function getFacetsAllCount($uid, $sort, $type)
|
||||
public static function getFacetsAllCount($user_id, $sort, $type)
|
||||
{
|
||||
$signet = self::sorts($sort, $uid, $type);
|
||||
$signet = self::sorts($sort, $user_id, $type);
|
||||
|
||||
$sql = "SELECT
|
||||
facet_id,
|
||||
|
@ -47,17 +47,17 @@ class FacetModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
signed_user_id,
|
||||
facet_is_deleted
|
||||
FROM facets
|
||||
LEFT JOIN facets_signed ON signed_facet_id = facet_id AND signed_user_id = $uid
|
||||
LEFT JOIN facets_signed ON signed_facet_id = facet_id AND signed_user_id = $user_id
|
||||
$signet";
|
||||
|
||||
return DB::run($sql)->rowCount();
|
||||
}
|
||||
|
||||
public static function sorts($sort, $uid, $type)
|
||||
public static function sorts($sort, $user_id, $type)
|
||||
{
|
||||
switch ($sort) {
|
||||
case 'my':
|
||||
$signet = "WHERE facet_type = '$type' AND signed_user_id = $uid ORDER BY facet_count DESC";
|
||||
$signet = "WHERE facet_type = '$type' AND signed_user_id = $user_id ORDER BY facet_count DESC";
|
||||
break;
|
||||
case 'new':
|
||||
$signet = "WHERE facet_type = '$type' ORDER BY facet_id DESC";
|
||||
|
@ -130,7 +130,7 @@ class FacetModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
|
||||
// Facet owner
|
||||
// Собственник фасета
|
||||
public static function getOwnerFacet($uid, $type)
|
||||
public static function getOwnerFacet($user_id, $type)
|
||||
{
|
||||
$sql = "SELECT
|
||||
facet_id,
|
||||
|
@ -153,9 +153,9 @@ class FacetModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
facet_count,
|
||||
facet_is_deleted
|
||||
FROM facets
|
||||
WHERE facet_type = :type AND facet_user_id = :uid AND facet_is_deleted = 0";
|
||||
WHERE facet_type = :type AND facet_user_id = :user_id AND facet_is_deleted = 0";
|
||||
|
||||
return DB::run($sql, ['uid' => $uid, 'type' => $type])->fetchAll();
|
||||
return DB::run($sql, ['user_id' => $user_id, 'type' => $type])->fetchAll();
|
||||
}
|
||||
|
||||
public static function addPostFacets($rows, $post_id)
|
||||
|
@ -274,7 +274,7 @@ class FacetModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
|
||||
// Participant contribution
|
||||
// Вклад участника
|
||||
public static function participation($uid)
|
||||
public static function participation($user_id)
|
||||
{
|
||||
$sql = " SELECT
|
||||
relation_facet_id as count,
|
||||
|
@ -290,28 +290,28 @@ class FacetModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
FROM facets
|
||||
) AS rel
|
||||
ON rel.facet_id = relation_facet_id
|
||||
WHERE post_user_id = :uid AND facet_type = 'topic'
|
||||
WHERE post_user_id = :user_id AND facet_type = 'topic'
|
||||
GROUP BY relation_facet_id
|
||||
ORDER BY count DESC LIMIT 5";
|
||||
|
||||
return DB::run($sql, ['uid' => $uid])->fetchAll();
|
||||
return DB::run($sql, ['user_id' => $user_id])->fetchAll();
|
||||
}
|
||||
|
||||
public static function userReads($uid)
|
||||
public static function userReads($user_id)
|
||||
{
|
||||
$sql = "SELECT
|
||||
signed_facet_id
|
||||
FROM facets_signed
|
||||
WHERE signed_user_id = :uid";
|
||||
WHERE signed_user_id = :user_id";
|
||||
|
||||
return DB::run($sql, ['uid' => $uid])->fetchAll();
|
||||
return DB::run($sql, ['user_id' => $user_id])->fetchAll();
|
||||
}
|
||||
|
||||
// Topics to which the participant is not subscribed
|
||||
// Темы на которые участник не подписан
|
||||
public static function advice($uid)
|
||||
public static function advice($user_id)
|
||||
{
|
||||
$userReads = self::userReads($uid);
|
||||
$userReads = self::userReads($user_id);
|
||||
|
||||
$result = [];
|
||||
foreach ($userReads as $ind => $row) {
|
||||
|
@ -383,7 +383,7 @@ class FacetModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
* @param int $user_id
|
||||
* @param string $type (topic | blog)
|
||||
*/
|
||||
public static function getFacetsUser($uid, $type)
|
||||
public static function getFacetsUser($user_id, $type)
|
||||
{
|
||||
$sql = "SELECT
|
||||
facet_id,
|
||||
|
@ -391,9 +391,9 @@ class FacetModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
facet_slug,
|
||||
facet_user_id,
|
||||
facet_type
|
||||
FROM facets WHERE facet_user_id = :uid AND facet_type = :type";
|
||||
FROM facets WHERE facet_user_id = :user_id AND facet_type = :type";
|
||||
|
||||
return DB::run($sql, ['uid' => $uid, 'type' => $type])->fetchAll();
|
||||
return DB::run($sql, ['user_id' => $user_id, 'type' => $type])->fetchAll();
|
||||
}
|
||||
|
||||
// Number of faces created by the contributor
|
||||
|
@ -402,11 +402,11 @@ class FacetModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
* @param int $user_id
|
||||
* @param string $type (topic | blog)
|
||||
*/
|
||||
public static function countFacetsUser($uid, $type)
|
||||
public static function countFacetsUser($user_id, $type)
|
||||
{
|
||||
$sql = "SELECT facet_id FROM facets WHERE facet_user_id = :uid AND facet_type = :type";
|
||||
$sql = "SELECT facet_id FROM facets WHERE facet_user_id = :user_id AND facet_type = :type";
|
||||
|
||||
return DB::run($sql, ['uid' => $uid, 'type' => $type])->rowCount();
|
||||
return DB::run($sql, ['user_id' => $user_id, 'type' => $type])->rowCount();
|
||||
}
|
||||
|
||||
// Participants subscribed to the topic
|
||||
|
|
|
@ -24,7 +24,7 @@ class FileModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
return DB::run($sql, $params);
|
||||
}
|
||||
|
||||
public static function get($file_id, $uid, $type)
|
||||
public static function get($file_id, $user_id, $type)
|
||||
{
|
||||
$sql = "SELECT
|
||||
file_id,
|
||||
|
@ -36,15 +36,15 @@ class FileModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
file_is_deleted
|
||||
FROM files
|
||||
WHERE file_id = :file_id AND
|
||||
file_user_id = :uid AND file_type = :type";
|
||||
file_user_id = :user_id AND file_type = :type";
|
||||
|
||||
return DB::run($sql, ['file_id' => $file_id, 'uid' => $uid, 'type' => $type])->fetch();
|
||||
return DB::run($sql, ['file_id' => $file_id, 'user_id' => $user_id, 'type' => $type])->fetch();
|
||||
}
|
||||
|
||||
public static function removal($file_path, $uid)
|
||||
public static function removal($file_path, $user_id)
|
||||
{
|
||||
$sql = "UPDATE files SET file_is_deleted = 1 WHERE file_path = :file_path AND file_user_id = :uid";
|
||||
$sql = "UPDATE files SET file_is_deleted = 1 WHERE file_path = :file_path AND file_user_id = :user_id";
|
||||
|
||||
return DB::run($sql, ['file_path' => $file_path, 'uid' => $uid]);
|
||||
return DB::run($sql, ['file_path' => $file_path, 'user_id' => $user_id]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,39 +8,39 @@ class FolderModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
{
|
||||
// Output of all folders depending on the type, priority
|
||||
// Вывод всех папок в зависимости от типа, пренадлежности
|
||||
public static function get($type, $uid)
|
||||
public static function get($type, $user_id)
|
||||
{
|
||||
$sql = "SELECT id, title as value FROM folders WHERE action_type = :type AND user_id = :uid";
|
||||
$sql = "SELECT id, title as value FROM folders WHERE action_type = :type AND user_id = :user_id";
|
||||
|
||||
return DB::run($sql, ['type' => $type, 'uid' => $uid])->fetchAll();
|
||||
return DB::run($sql, ['type' => $type, 'user_id' => $user_id])->fetchAll();
|
||||
}
|
||||
|
||||
// Number of folders
|
||||
// Количество папок
|
||||
public static function getCount($type, $uid)
|
||||
public static function getCount($type, $user_id)
|
||||
{
|
||||
$sql = "SELECT id, title as value FROM folders WHERE action_type = :type AND user_id = :uid";
|
||||
$sql = "SELECT id, title as value FROM folders WHERE action_type = :type AND user_id = :user_id";
|
||||
|
||||
return DB::run($sql, ['type' => $type, 'uid' => $uid])->rowCount();
|
||||
return DB::run($sql, ['type' => $type, 'user_id' => $user_id])->rowCount();
|
||||
}
|
||||
|
||||
// To check for a match by title
|
||||
// Для проверки совпадению по title
|
||||
public static function getOneTitle($type, $uid, $title)
|
||||
public static function getOneTitle($type, $user_id, $title)
|
||||
{
|
||||
$sql = "SELECT title FROM folders WHERE action_type = :type AND user_id = :uid AND title = :title";
|
||||
$sql = "SELECT title FROM folders WHERE action_type = :type AND user_id = :user_id AND title = :title";
|
||||
|
||||
return DB::run($sql, ['type' => $type, 'uid' => $uid, 'title' => $title])->fetch();
|
||||
return DB::run($sql, ['type' => $type, 'user_id' => $user_id, 'title' => $title])->fetch();
|
||||
}
|
||||
|
||||
// If not in the personal list, then add
|
||||
// Если нет в личном списке, то добавляем
|
||||
public static function create($folders, $type, $uid)
|
||||
public static function create($folders, $type, $user_id)
|
||||
{
|
||||
foreach ($folders as $row) {
|
||||
if (!self::getOneTitle($type, $uid, $row['value'])) {
|
||||
$sql = "INSERT INTO folders (title, action_type, user_id) VALUES (:value, :type, :uid)";
|
||||
DB::run($sql, ['value' => $row['value'], 'type' => $type, 'uid' => $uid]);
|
||||
if (!self::getOneTitle($type, $user_id, $row['value'])) {
|
||||
$sql = "INSERT INTO folders (title, action_type, user_id) VALUES (:value, :type, :user_id)";
|
||||
DB::run($sql, ['value' => $row['value'], 'type' => $type, 'user_id' => $user_id]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,39 +49,39 @@ class FolderModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
|
||||
// Deleting the linked content folder
|
||||
// Удаление папки привязанному контенту
|
||||
public static function deletingFolderContent($tid, $type, $uid)
|
||||
public static function deletingFolderContent($tid, $type, $user_id)
|
||||
{
|
||||
$sql = "DELETE FROM folders_relation WHERE tid = :tid AND action_type = :type AND user_id = :uid";
|
||||
$sql = "DELETE FROM folders_relation WHERE tid = :tid AND action_type = :type AND user_id = :user_id";
|
||||
|
||||
return DB::run($sql, ['tid' => $tid, 'type' => $type, 'uid' => $uid]);
|
||||
return DB::run($sql, ['tid' => $tid, 'type' => $type, 'user_id' => $user_id]);
|
||||
}
|
||||
|
||||
// Link folder to content
|
||||
// Привязываем папку к контенту
|
||||
public static function saveFolderContent($id, $tid, $type, $uid)
|
||||
public static function saveFolderContent($id, $tid, $type, $user_id)
|
||||
{
|
||||
$sql = "INSERT INTO folders_relation (folder_id, tid, action_type, user_id) VALUES (:id, :tid, :type, :uid)";
|
||||
$sql = "INSERT INTO folders_relation (folder_id, tid, action_type, user_id) VALUES (:id, :tid, :type, :user_id)";
|
||||
|
||||
return DB::run($sql, ['id' => $id, 'tid' => $tid, 'type' => $type, 'uid' => $uid]);
|
||||
return DB::run($sql, ['id' => $id, 'tid' => $tid, 'type' => $type, 'user_id' => $user_id]);
|
||||
}
|
||||
|
||||
// Delete the folder itself
|
||||
// Удаляем саму папку
|
||||
public static function deletingFolder($id, $type, $uid)
|
||||
public static function deletingFolder($id, $type, $user_id)
|
||||
{
|
||||
$sql = "DELETE FROM folders WHERE id = :id AND action_type = :type AND user_id = :uid";
|
||||
$sql = "DELETE FROM folders WHERE id = :id AND action_type = :type AND user_id = :user_id";
|
||||
|
||||
DB::run($sql, ['id' => $id, 'type' => $type, 'uid' => $uid]);
|
||||
DB::run($sql, ['id' => $id, 'type' => $type, 'user_id' => $user_id]);
|
||||
|
||||
return self::deletingLinkedContent($id, $type, $uid);
|
||||
return self::deletingLinkedContent($id, $type, $user_id);
|
||||
}
|
||||
|
||||
// Removing a content link from a folder
|
||||
// Удаляем привязку контента к папке
|
||||
public static function deletingLinkedContent($id, $type, $uid)
|
||||
public static function deletingLinkedContent($id, $type, $user_id)
|
||||
{
|
||||
$sql = "DELETE FROM folders_relation WHERE folder_id = :id AND action_type = :type AND user_id = :uid";
|
||||
$sql = "DELETE FROM folders_relation WHERE folder_id = :id AND action_type = :type AND user_id = :user_id";
|
||||
|
||||
DB::run($sql, ['id' => $id, 'type' => $type, 'uid' => $uid]);
|
||||
DB::run($sql, ['id' => $id, 'type' => $type, 'user_id' => $user_id]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,22 +39,20 @@ class HomeModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
post_translation,
|
||||
post_draft,
|
||||
post_date,
|
||||
post_published,
|
||||
post_user_id,
|
||||
post_votes,
|
||||
post_hits_count,
|
||||
post_answers_count,
|
||||
post_comments_count,
|
||||
post_content,
|
||||
post_content_img,
|
||||
post_thumb_img,
|
||||
post_merged_id,
|
||||
post_closed,
|
||||
post_is_deleted,
|
||||
post_user_id,
|
||||
post_merged_id,
|
||||
post_tl,
|
||||
post_lo,
|
||||
post_top,
|
||||
post_url_domain,
|
||||
post_is_deleted,
|
||||
rel.*,
|
||||
votes_post_item_id, votes_post_user_id,
|
||||
u.id, u.login, u.avatar, u.created_at,
|
||||
|
@ -68,18 +66,13 @@ class HomeModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
relation_post_id,
|
||||
GROUP_CONCAT(facet_type, '@', facet_slug, '@', facet_title SEPARATOR '@') AS facet_list
|
||||
FROM facets
|
||||
LEFT JOIN facets_posts_relation
|
||||
on facet_id = relation_facet_id
|
||||
LEFT JOIN facets_posts_relation ON facet_id = relation_facet_id
|
||||
GROUP BY relation_post_id
|
||||
) AS rel
|
||||
ON rel.relation_post_id= post_id
|
||||
) AS rel ON rel.relation_post_id= post_id
|
||||
LEFT JOIN users u ON u.id = post_user_id
|
||||
LEFT JOIN favorites fav ON fav.tid = post_id
|
||||
AND fav.user_id = :uid AND fav.action_type = 'post'
|
||||
LEFT JOIN votes_post
|
||||
ON votes_post_item_id = post_id AND votes_post_user_id = :uid2
|
||||
|
||||
WHERE post_type != 'page' AND post_draft = 0 $string $display $sort LIMIT :start, :limit";
|
||||
LEFT JOIN favorites fav ON fav.tid = post_id AND fav.user_id = :uid AND fav.action_type = 'post'
|
||||
LEFT JOIN votes_post ON votes_post_item_id = post_id AND votes_post_user_id = :uid2
|
||||
WHERE post_type != 'page' AND post_draft = 0 $string $display $sort LIMIT :start, :limit";
|
||||
|
||||
return DB::run($sql, ['uid' => $user['id'], 'uid2' => $user['id'], 'start' => $start, 'limit' => $limit])->fetchAll();
|
||||
}
|
||||
|
@ -155,12 +148,12 @@ class HomeModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
public static function latestAnswers($user)
|
||||
{
|
||||
$tl = $user['trust_level'];
|
||||
$uid = $user['id'];
|
||||
$user_id = $user['id'];
|
||||
$user_answer = "AND post_tl = 0";
|
||||
if ($uid) {
|
||||
$user_answer = "AND answer_user_id != $uid AND post_tl <= $tl";
|
||||
if ($user_id) {
|
||||
$user_answer = "AND answer_user_id != $user_id AND post_tl <= $tl";
|
||||
if ($user['trust_level'] != 5) {
|
||||
$user_answer = "AND answer_user_id != $uid AND post_tl <= $tl";
|
||||
$user_answer = "AND answer_user_id != $user_id AND post_tl <= $tl";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -168,15 +161,11 @@ class HomeModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
answer_id,
|
||||
answer_post_id,
|
||||
answer_user_id,
|
||||
answer_is_deleted,
|
||||
answer_content,
|
||||
answer_date,
|
||||
post_id,
|
||||
post_tl,
|
||||
post_slug,
|
||||
post_type,
|
||||
post_is_deleted,
|
||||
id,
|
||||
login,
|
||||
avatar
|
||||
FROM answers
|
||||
|
|
|
@ -8,7 +8,7 @@ class UserAreaModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
{
|
||||
// Sites added by the user
|
||||
// Сайты добавленные участником
|
||||
public static function getUserSites($page, $limit, $uid)
|
||||
public static function getUserSites($page, $limit, $user_id)
|
||||
{
|
||||
$start = ($page - 1) * $limit;
|
||||
$sql = "SELECT
|
||||
|
@ -39,22 +39,22 @@ class UserAreaModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
GROUP BY relation_item_id
|
||||
) AS rel
|
||||
ON rel.relation_item_id = item_id
|
||||
WHERE item_user_id = :uid ORDER BY item_id DESC
|
||||
WHERE item_user_id = :user_id ORDER BY item_id DESC
|
||||
LIMIT :start, :limit ";
|
||||
|
||||
return DB::run($sql, ['uid' => $uid, 'start' => $start, 'limit' => $limit])->fetchAll();
|
||||
return DB::run($sql, ['user_id' => $user_id, 'start' => $start, 'limit' => $limit])->fetchAll();
|
||||
}
|
||||
|
||||
public static function getUserSitesCount($uid)
|
||||
public static function getUserSitesCount($user_id)
|
||||
{
|
||||
$sql = "SELECT item_id, item_is_deleted FROM items WHERE item_user_id = :uid ORDER BY item_id DESC";
|
||||
$sql = "SELECT item_id, item_is_deleted FROM items WHERE item_user_id = :user_id ORDER BY item_id DESC";
|
||||
|
||||
return DB::run($sql, ['uid' => $uid])->rowCount();
|
||||
return DB::run($sql, ['user_id' => $user_id])->rowCount();
|
||||
}
|
||||
|
||||
// Bookmarks
|
||||
// Закладки
|
||||
public static function bookmarks($page, $limit, $uid)
|
||||
public static function bookmarks($page, $limit, $user_id)
|
||||
{
|
||||
$start = ($page - 1) * $limit;
|
||||
$sql = "SELECT
|
||||
|
@ -91,18 +91,18 @@ class UserAreaModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
ON rel.relation_item_id = fav.tid
|
||||
LEFT JOIN items ON item_id = fav.tid
|
||||
LEFT JOIN votes_item ON votes_item_item_id = fav.tid
|
||||
AND votes_item_user_id = :uid
|
||||
AND votes_item_user_id = :user_id
|
||||
WHERE fav.user_id = :uid_two AND fav.action_type = 'website' AND item_published = 1
|
||||
LIMIT :start, :limit";
|
||||
|
||||
return DB::run($sql, ['uid' => $uid, 'uid_two' => $uid, 'start' => $start, 'limit' => $limit])->fetchAll();
|
||||
return DB::run($sql, ['user_id' => $user_id, 'uid_two' => $user_id, 'start' => $start, 'limit' => $limit])->fetchAll();
|
||||
}
|
||||
|
||||
public static function bookmarksCount($uid)
|
||||
public static function bookmarksCount($user_id)
|
||||
{
|
||||
$sql = "SELECT user_id FROM favorites WHERE user_id = :uid AND action_type = 'website'";
|
||||
$sql = "SELECT user_id FROM favorites WHERE user_id = :user_id AND action_type = 'website'";
|
||||
|
||||
return DB::run($sql, ['uid' => $uid])->rowCount();
|
||||
return DB::run($sql, ['user_id' => $user_id])->rowCount();
|
||||
}
|
||||
|
||||
public static function auditCount()
|
||||
|
|
|
@ -193,7 +193,7 @@ class WebModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
|
||||
// Check if the domain exists
|
||||
// Проверим наличие домена
|
||||
public static function getItemOne($domain, $uid)
|
||||
public static function getItemOne($domain, $user_id)
|
||||
{
|
||||
$sql = "SELECT
|
||||
item_id,
|
||||
|
@ -230,13 +230,13 @@ class WebModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
GROUP BY relation_item_id
|
||||
) AS rel
|
||||
ON rel.relation_item_id = item_id
|
||||
LEFT JOIN votes_item ON votes_item_item_id = item_id AND votes_item_user_id = :uid
|
||||
LEFT JOIN votes_item ON votes_item_item_id = item_id AND votes_item_user_id = :user_id
|
||||
LEFT JOIN favorites fav ON fav.tid = item_id
|
||||
AND fav.user_id = :uid_two AND fav.action_type = 'website'
|
||||
WHERE item_domain = :domain AND item_is_deleted = 0";
|
||||
|
||||
|
||||
return DB::run($sql, ['domain' => $domain, 'uid' => $uid, 'uid_two' => $uid])->fetch();
|
||||
return DB::run($sql, ['domain' => $domain, 'user_id' => $user_id, 'uid_two' => $user_id])->fetch();
|
||||
}
|
||||
|
||||
// Add a domain
|
||||
|
|
|
@ -7,7 +7,7 @@ use DB;
|
|||
class MessagesModel extends \Hleb\Scheme\App\Models\MainModel
|
||||
{
|
||||
// All dialogs
|
||||
public static function getMessages($uid)
|
||||
public static function getMessages($user_id)
|
||||
{
|
||||
$sql = "SELECT
|
||||
dialog_id,
|
||||
|
@ -20,13 +20,13 @@ class MessagesModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
dialog_sender_count,
|
||||
dialog_recipient_count
|
||||
FROM messages_dialog
|
||||
WHERE dialog_sender_id = $uid OR dialog_recipient_id = :uid
|
||||
WHERE dialog_sender_id = $user_id OR dialog_recipient_id = $user_id
|
||||
ORDER BY dialog_update_time DESC";
|
||||
|
||||
return DB::run($sql, ['uid' => $uid])->fetchAll();
|
||||
return DB::run($sql)->fetchAll();
|
||||
}
|
||||
|
||||
public static function lastBranches($uid)
|
||||
public static function lastBranches($user_id)
|
||||
{
|
||||
$sql = "SELECT
|
||||
dialog_id,
|
||||
|
@ -39,7 +39,7 @@ class MessagesModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
avatar
|
||||
FROM messages_dialog
|
||||
LEFT JOIN users ON dialog_sender_id = id OR dialog_recipient_id = id
|
||||
WHERE dialog_sender_id = $uid OR dialog_recipient_id = $uid
|
||||
WHERE dialog_sender_id = $user_id OR dialog_recipient_id = $user_id
|
||||
ORDER BY dialog_update_time DESC LIMIT 15";
|
||||
|
||||
return DB::run($sql)->fetchAll();
|
||||
|
@ -218,7 +218,7 @@ class MessagesModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
|
||||
|
||||
// Changing the number of messages
|
||||
public static function updateDialogCount($dialog_id, $uid)
|
||||
public static function updateDialogCount($dialog_id, $user_id)
|
||||
{
|
||||
if (!$inbox_dialog = self::getDialogById($dialog_id)) {
|
||||
return false;
|
||||
|
@ -253,7 +253,7 @@ class MessagesModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
|
||||
DB::run($sql_dialog, $params);
|
||||
|
||||
if ($inbox_dialog['dialog_sender_id'] == $uid) {
|
||||
if ($inbox_dialog['dialog_sender_id'] == $user_id) {
|
||||
|
||||
$recipient_unread = 0;
|
||||
$sql = "UPDATE messages_dialog SET dialog_recipient_unread = :recipient
|
||||
|
|
|
@ -45,7 +45,7 @@ class NotificationModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
const TYPE_ADD_REPLY_WEBSITE = 34; // replica added to the site
|
||||
|
||||
// Лист уведомлений
|
||||
public static function listNotification($uid)
|
||||
public static function listNotification($user_id)
|
||||
{
|
||||
$sql = "SELECT
|
||||
n.id as notif_id,
|
||||
|
@ -61,24 +61,24 @@ class NotificationModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
u.avatar
|
||||
FROM notifications n
|
||||
JOIN users u ON u.id = n.sender_id
|
||||
WHERE n.recipient_id = :uid
|
||||
ORDER BY n.id DESC LIMIT 100";
|
||||
WHERE n.recipient_id = :user_id
|
||||
ORDER BY n.id DESC LIMIT 100";
|
||||
|
||||
return DB::run($sql, ['uid' => $uid])->fetchAll();
|
||||
return DB::run($sql, ['user_id' => $user_id])->fetchAll();
|
||||
}
|
||||
|
||||
// Уведомления
|
||||
public static function bell($uid)
|
||||
public static function bell($user_id)
|
||||
{
|
||||
$sql = "SELECT
|
||||
recipient_id,
|
||||
action_type,
|
||||
read_flag
|
||||
FROM notifications
|
||||
WHERE recipient_id = :uid
|
||||
AND read_flag = 0";
|
||||
WHERE recipient_id = :user_id
|
||||
AND read_flag = 0";
|
||||
|
||||
return DB::run($sql, ['uid' => $uid])->fetch();
|
||||
return DB::run($sql, ['user_id' => $user_id])->fetch();
|
||||
}
|
||||
|
||||
// Отправка
|
||||
|
@ -97,11 +97,11 @@ class NotificationModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
}
|
||||
|
||||
// Оповещение просмотрено
|
||||
public static function updateMessagesUnread($uid, $notif_id)
|
||||
public static function updateMessagesUnread($user_id, $notif_id)
|
||||
{
|
||||
$sql = "UPDATE notifications SET read_flag = 1 WHERE recipient_id = :uid AND id = :notif_id";
|
||||
$sql = "UPDATE notifications SET read_flag = 1 WHERE recipient_id = :user_id AND id = :notif_id";
|
||||
|
||||
return DB::run($sql, ['uid' => $uid, 'notif_id' => $notif_id]);
|
||||
return DB::run($sql, ['user_id' => $user_id, 'notif_id' => $notif_id]);
|
||||
}
|
||||
|
||||
public static function getNotification($id)
|
||||
|
@ -121,10 +121,10 @@ class NotificationModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
return DB::run($sql, ['id' => $id])->fetch();
|
||||
}
|
||||
|
||||
public static function setRemove($uid)
|
||||
public static function setRemove($user_id)
|
||||
{
|
||||
$sql = "UPDATE notifications SET read_flag = 1 WHERE recipient_id = :uid";
|
||||
$sql = "UPDATE notifications SET read_flag = 1 WHERE recipient_id = :user_id";
|
||||
|
||||
return DB::run($sql, ['uid' => $uid]);
|
||||
return DB::run($sql, ['user_id' => $user_id]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ class PostModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
// Полная версия поста
|
||||
public static function getPost($params, $name, $user)
|
||||
{
|
||||
$uid = $user['id'];
|
||||
$user_id = $user['id'];
|
||||
$sort = $name == 'slug' ? "post_slug = :params" : "post_id = :params";
|
||||
|
||||
$sql = "SELECT
|
||||
|
@ -111,8 +111,8 @@ class PostModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
fav.action_type
|
||||
FROM posts
|
||||
LEFT JOIN users u ON u.id = post_user_id
|
||||
LEFT JOIN favorites fav ON fav.tid = post_id AND fav.user_id = $uid AND fav.action_type = 'post'
|
||||
LEFT JOIN votes_post ON votes_post_item_id = post_id AND votes_post_user_id = $uid
|
||||
LEFT JOIN favorites fav ON fav.tid = post_id AND fav.user_id = $user_id AND fav.action_type = 'post'
|
||||
LEFT JOIN votes_post ON votes_post_item_id = post_id AND votes_post_user_id = $user_id
|
||||
WHERE $sort AND post_tl <= :trust_level";
|
||||
|
||||
$data = ['params' => $params, 'trust_level' => $user['trust_level']];
|
||||
|
@ -316,7 +316,7 @@ class PostModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
|
||||
// Check if the domain exists
|
||||
// Проверим наличие домена
|
||||
public static function getDomain($domain, $uid)
|
||||
public static function getDomain($domain, $user_id)
|
||||
{
|
||||
$sql = "SELECT
|
||||
item_id,
|
||||
|
@ -338,11 +338,11 @@ class PostModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
votes_item_user_id,
|
||||
votes_item_item_id
|
||||
FROM items
|
||||
LEFT JOIN votes_item ON votes_item_item_id = item_id AND votes_item_user_id = :uid
|
||||
LEFT JOIN votes_item ON votes_item_item_id = item_id AND votes_item_user_id = :user_id
|
||||
WHERE item_domain = :domain AND item_is_deleted = 0";
|
||||
|
||||
|
||||
return DB::run($sql, ['domain' => $domain, 'uid' => $uid])->fetch();
|
||||
return DB::run($sql, ['domain' => $domain, 'user_id' => $user_id])->fetch();
|
||||
}
|
||||
|
||||
// 5 popular domains
|
||||
|
@ -380,20 +380,20 @@ class PostModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
}
|
||||
|
||||
// Список читаемых постов
|
||||
public static function getFocusPostUser($uid)
|
||||
public static function getFocusPostUser($user_id)
|
||||
{
|
||||
$sql = "SELECT
|
||||
signed_post_id,
|
||||
signed_user_id
|
||||
FROM posts_signed
|
||||
WHERE signed_user_id = :uid";
|
||||
WHERE signed_user_id = :user_id";
|
||||
|
||||
return DB::run($sql, ['uid' => $uid])->fetchAll();
|
||||
return DB::run($sql, ['user_id' => $user_id])->fetchAll();
|
||||
}
|
||||
|
||||
public static function getFocusPostsListUser($uid)
|
||||
public static function getFocusPostsListUser($user_id)
|
||||
{
|
||||
$focus_posts = self::getFocusPostUser($uid);
|
||||
$focus_posts = self::getFocusPostUser($user_id);
|
||||
|
||||
$result = [];
|
||||
foreach ($focus_posts as $ind => $row) {
|
||||
|
@ -450,8 +450,8 @@ class PostModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
ON rel.relation_post_id = post_id
|
||||
|
||||
INNER JOIN users u ON u.id = post_user_id
|
||||
LEFT JOIN votes_post ON votes_post_item_id = post_id AND votes_post_user_id = $uid
|
||||
LEFT JOIN favorites fav ON fav.tid = post_id AND fav.user_id = $uid AND fav.action_type = 'post'
|
||||
LEFT JOIN votes_post ON votes_post_item_id = post_id AND votes_post_user_id = $user_id
|
||||
LEFT JOIN favorites fav ON fav.tid = post_id AND fav.user_id = $user_id AND fav.action_type = 'post'
|
||||
$string LIMIT 100";
|
||||
|
||||
return DB::run($sql)->fetchAll();
|
||||
|
|
|
@ -30,7 +30,7 @@ class TeamModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
|
||||
// Get the full version of teams with participants in them
|
||||
// Получим полную версию команд с участниками в них
|
||||
public static function all($uid, $limit)
|
||||
public static function all($user_id, $limit)
|
||||
{
|
||||
$sql = "SELECT
|
||||
t.team_id as id,
|
||||
|
@ -56,16 +56,16 @@ class TeamModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
GROUP BY r.team_id
|
||||
) AS rel
|
||||
ON rel.team_id= t.team_id
|
||||
WHERE u.id = :uid ORDER BY t.team_is_deleted LIMIT :limit";
|
||||
WHERE u.id = :user_id ORDER BY t.team_is_deleted LIMIT :limit";
|
||||
|
||||
return DB::run($sql, ['uid' => $uid, 'limit' => $limit])->fetchAll();
|
||||
return DB::run($sql, ['user_id' => $user_id, 'limit' => $limit])->fetchAll();
|
||||
}
|
||||
|
||||
// Number of folders
|
||||
// Количество команд
|
||||
public static function allCount($uid)
|
||||
public static function allCount($user_id)
|
||||
{
|
||||
return DB::run("SELECT team_id FROM teams WHERE team_user_id = :uid", ['uid' => $uid])->rowCount();
|
||||
return DB::run("SELECT team_id FROM teams WHERE team_user_id = :user_id", ['user_id' => $user_id])->rowCount();
|
||||
}
|
||||
|
||||
// Creation of a team
|
||||
|
|
|
@ -77,7 +77,7 @@ class BadgeModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
|
||||
// All participant awards
|
||||
// Все награды участника
|
||||
public static function getBadgeUserAll($uid)
|
||||
public static function getBadgeUserAll($user_id)
|
||||
{
|
||||
$sql = "SELECT
|
||||
bu_id,
|
||||
|
@ -91,9 +91,9 @@ class BadgeModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
badge_description
|
||||
FROM badges_user
|
||||
LEFT JOIN badges ON badge_id = bu_badge_id
|
||||
WHERE bu_user_id = :uid";
|
||||
WHERE bu_user_id = :user_id";
|
||||
|
||||
return DB::run($sql, ['uid' => $uid])->fetchAll();
|
||||
return DB::run($sql, ['user_id' => $user_id])->fetchAll();
|
||||
}
|
||||
|
||||
// Remove member award
|
||||
|
|
|
@ -58,7 +58,7 @@ class InvitationModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
}
|
||||
|
||||
// Все инвайты участинка
|
||||
public static function userResult($uid)
|
||||
public static function userResult($user_id)
|
||||
{
|
||||
$sql = "SELECT
|
||||
uid,
|
||||
|
@ -72,10 +72,10 @@ class InvitationModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
login
|
||||
FROM invitations
|
||||
LEFT JOIN users ON id = active_uid
|
||||
WHERE uid = :uid
|
||||
WHERE uid = :user_id
|
||||
ORDER BY add_time DESC";
|
||||
|
||||
return DB::run($sql, ['uid' => $uid])->fetchAll();
|
||||
return DB::run($sql, ['user_id' => $user_id])->fetchAll();
|
||||
}
|
||||
|
||||
// Проверим не активированный инвайт
|
||||
|
|
|
@ -41,9 +41,9 @@ class UserModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
}
|
||||
|
||||
// Страница участников
|
||||
public static function getUsersAll($page, $limit, $uid, $type)
|
||||
public static function getUsersAll($page, $limit, $user_id, $type)
|
||||
{
|
||||
$sort = "ORDER BY id = $uid DESC, trust_level DESC";
|
||||
$sort = "ORDER BY id = $user_id DESC, trust_level DESC";
|
||||
if ($type == 'new') {
|
||||
$sort = "ORDER BY created_at DESC";
|
||||
}
|
||||
|
@ -132,15 +132,15 @@ class UserModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
}
|
||||
|
||||
// Просмотры
|
||||
public static function userHits($uid)
|
||||
public static function userHits($user_id)
|
||||
{
|
||||
$sql = "UPDATE users SET hits_count = (hits_count + 1) WHERE id = :uid";
|
||||
$sql = "UPDATE users SET hits_count = (hits_count + 1) WHERE id = :user_id";
|
||||
|
||||
return DB::run($sql, ['uid' => $uid]);
|
||||
return DB::run($sql, ['user_id' => $user_id]);
|
||||
}
|
||||
|
||||
// Страница закладок участника (комментарии и посты)
|
||||
public static function userFavorite($uid, $tag_id = null)
|
||||
public static function userFavorite($user_id, $tag_id = null)
|
||||
{
|
||||
$tag = '';
|
||||
if ($tag_id) $tag = 'AND fol.id = ' . $tag_id;
|
||||
|
@ -168,13 +168,13 @@ class UserModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
LEFT JOIN items ON item_id = fav.tid AND fav.action_type = 'website'
|
||||
LEFT JOIN folders_relation fr ON fr.tid = fav.tid
|
||||
LEFT JOIN folders fol ON folder_id = fol.id AND fol.user_id = :uid2
|
||||
WHERE fav.user_id = :uid $tag ORDER BY fav.id DESC LIMIT 100";
|
||||
WHERE fav.user_id = :user_id $tag ORDER BY fav.id DESC LIMIT 100";
|
||||
|
||||
return DB::run($sql, ['uid' => $uid, 'uid2' => $uid])->fetchAll();
|
||||
return DB::run($sql, ['user_id' => $user_id, 'uid2' => $user_id])->fetchAll();
|
||||
}
|
||||
|
||||
// Страница черновиков
|
||||
public static function userDraftPosts($uid)
|
||||
public static function userDraftPosts($user_id)
|
||||
{
|
||||
$sql = "SELECT
|
||||
post_id,
|
||||
|
@ -190,11 +190,11 @@ class UserModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
avatar
|
||||
FROM posts
|
||||
LEFT JOIN users ON id = post_user_id
|
||||
WHERE id = :uid
|
||||
WHERE id = :user_id
|
||||
AND post_draft = 1 AND post_is_deleted = 0
|
||||
ORDER BY post_id DESC";
|
||||
|
||||
return DB::run($sql, ['uid' => $uid])->fetchAll();
|
||||
return DB::run($sql, ['user_id' => $user_id])->fetchAll();
|
||||
}
|
||||
|
||||
// Информация участника
|
||||
|
@ -219,66 +219,66 @@ class UserModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
}
|
||||
|
||||
// Количество контента участника
|
||||
public static function contentCount($uid)
|
||||
public static function contentCount($user_id)
|
||||
{
|
||||
$sql = "SELECT
|
||||
(SELECT COUNT(post_id)
|
||||
FROM posts
|
||||
WHERE post_user_id = $uid and post_draft = 0 and post_is_deleted = 0)
|
||||
WHERE post_user_id = $user_id and post_draft = 0 and post_is_deleted = 0)
|
||||
AS count_posts,
|
||||
|
||||
(SELECT COUNT(answer_id)
|
||||
FROM answers
|
||||
WHERE answer_user_id = $uid and answer_is_deleted = 0)
|
||||
WHERE answer_user_id = $user_id and answer_is_deleted = 0)
|
||||
AS count_answers,
|
||||
|
||||
(SELECT COUNT(comment_id)
|
||||
FROM comments
|
||||
WHERE comment_user_id = $uid and comment_is_deleted = 0)
|
||||
WHERE comment_user_id = $user_id and comment_is_deleted = 0)
|
||||
AS count_comments,
|
||||
|
||||
(SELECT COUNT(item_id)
|
||||
FROM items
|
||||
WHERE item_user_id = $uid and item_is_deleted = 0)
|
||||
WHERE item_user_id = $user_id and item_is_deleted = 0)
|
||||
AS count_items";
|
||||
|
||||
return DB::run($sql)->fetch();
|
||||
}
|
||||
|
||||
// Находит ли пользователь в бан- листе
|
||||
public static function isBan($uid)
|
||||
public static function isBan($user_id)
|
||||
{
|
||||
$sql = "SELECT
|
||||
banlist_user_id,
|
||||
banlist_status
|
||||
FROM users_banlist
|
||||
WHERE banlist_user_id = :uid AND banlist_status = 1";
|
||||
WHERE banlist_user_id = :user_id AND banlist_status = 1";
|
||||
|
||||
return DB::run($sql, ['uid' => $uid])->fetch();
|
||||
return DB::run($sql, ['user_id' => $user_id])->fetch();
|
||||
}
|
||||
|
||||
// Находит ли пользователь в бесшумном режиме
|
||||
public static function isLimitingMode($uid)
|
||||
public static function isLimitingMode($user_id)
|
||||
{
|
||||
$sql = "SELECT
|
||||
id,
|
||||
limiting_mode
|
||||
FROM users
|
||||
WHERE id = :uid AND limiting_mode = 1";
|
||||
WHERE id = :user_id AND limiting_mode = 1";
|
||||
|
||||
return DB::run($sql, ['uid' => $uid])->fetch();
|
||||
return DB::run($sql, ['user_id' => $user_id])->fetch();
|
||||
}
|
||||
|
||||
// Активирован ли пользователь (e-mail)
|
||||
public static function isActivated($uid)
|
||||
public static function isActivated($user_id)
|
||||
{
|
||||
$sql = "SELECT
|
||||
id,
|
||||
activated
|
||||
FROM users
|
||||
WHERE id = :uid AND activated = 1";
|
||||
WHERE id = :user_id AND activated = 1";
|
||||
|
||||
return DB::run($sql, ['uid' => $uid])->fetch();
|
||||
return DB::run($sql, ['user_id' => $user_id])->fetch();
|
||||
}
|
||||
|
||||
// Password Recovery
|
||||
|
@ -291,11 +291,11 @@ class UserModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
}
|
||||
|
||||
// Для одноразового использования кода восстановления
|
||||
public static function editRecoverFlag($uid)
|
||||
public static function editRecoverFlag($user_id)
|
||||
{
|
||||
$sql = "UPDATE users_activate SET activate_flag = 1 WHERE activate_user_id = :uid";
|
||||
$sql = "UPDATE users_activate SET activate_flag = 1 WHERE activate_user_id = :user_id";
|
||||
|
||||
return DB::run($sql, ['uid' => $uid]);
|
||||
return DB::run($sql, ['user_id' => $user_id]);
|
||||
}
|
||||
|
||||
// Проверяем код смены пароля (использовали его или нет)
|
||||
|
@ -335,15 +335,15 @@ class UserModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
}
|
||||
|
||||
// Активируем e-mail
|
||||
public static function EmailActivate($uid)
|
||||
public static function EmailActivate($user_id)
|
||||
{
|
||||
$sql = "UPDATE users_email_activate SET email_activate_flag = :flag WHERE user_id = :uid";
|
||||
$sql = "UPDATE users_email_activate SET email_activate_flag = :flag WHERE user_id = :user_id";
|
||||
|
||||
DB::run($sql, ['uid' => $uid, 'flag' => 1]);
|
||||
DB::run($sql, ['user_id' => $user_id, 'flag' => 1]);
|
||||
|
||||
$sql = "UPDATE users SET activated = :flag WHERE id = :uid";
|
||||
$sql = "UPDATE users SET activated = :flag WHERE id = :user_id";
|
||||
|
||||
return DB::run($sql, ['uid' => $uid, 'flag' => 1]);
|
||||
return DB::run($sql, ['user_id' => $user_id, 'flag' => 1]);
|
||||
}
|
||||
|
||||
public static function setLogAgent($params)
|
||||
|
|
|
@ -23,7 +23,7 @@ class MainConnector implements Connector
|
|||
"App\Commands\*" => "app/Commands/",
|
||||
|
||||
// ... or, if a specific class is added,
|
||||
// "Phphleb\Debugpan\DPanel" => "app/ThirdParty/phphleb/debugpan/DPanel.php",
|
||||
"Phphleb\Debugpan\DPanel" => "app/ThirdParty/phphleb/debugpan/DPanel.php",
|
||||
|
||||
"DB" => "app/Libraries/DB.php",
|
||||
"Configuration" => "app/Libraries/Configuration.php",
|
||||
|
|
|
@ -35,10 +35,10 @@
|
|||
"cocur/slugify": "^4.1",
|
||||
"phpmailer/phpmailer": "^6.5",
|
||||
"erusev/parsedown": "^1.8.0@beta",
|
||||
"kadet/keylighter": "dev-master",
|
||||
"wamania/php-stemmer": "^3.0",
|
||||
"donatj/phpuseragentparser": "dev-master",
|
||||
"utopia-php/domains": "dev-master"
|
||||
"utopia-php/domains": "dev-master",
|
||||
"geshi/geshi": "dev-master"
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
|
|
|
@ -106,28 +106,6 @@ class UserModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
return $result->fetch();
|
||||
}
|
||||
|
||||
// Number of member content
|
||||
public static function contentCount($uid)
|
||||
{
|
||||
$sql = "SELECT
|
||||
(SELECT COUNT(post_id)
|
||||
FROM posts
|
||||
WHERE post_user_id = $uid and post_draft = 0 and post_is_deleted = 0)
|
||||
AS count_posts,
|
||||
|
||||
(SELECT COUNT(answer_id)
|
||||
FROM answers
|
||||
WHERE answer_user_id = $uid and answer_is_deleted = 0)
|
||||
AS count_answers,
|
||||
|
||||
(SELECT COUNT(comment_id)
|
||||
FROM comments
|
||||
WHERE comment_user_id = $uid and comment_is_deleted = 0)
|
||||
AS count_comments";
|
||||
|
||||
return DB::run($sql)->fetch();
|
||||
}
|
||||
|
||||
// Number of IP duplicates by `user_reg_ip` field
|
||||
public static function duplicatesRegistrationCount($ip)
|
||||
{
|
||||
|
|
|
@ -99,7 +99,6 @@ class Users extends Controller
|
|||
'meta' => Meta::get(__('admin.edit')),
|
||||
'data' => [
|
||||
'type' => $this->type,
|
||||
'count' => UserModel::contentCount($user_id),
|
||||
'user' => $user,
|
||||
]
|
||||
]
|
||||
|
|
|
@ -65,33 +65,6 @@
|
|||
<input type="checkbox" name="scroll" <?php if ($data['user']['scroll'] == 1) : ?>checked <?php endif; ?>> <?= __('app.endless_scroll'); ?>
|
||||
</fieldset>
|
||||
|
||||
<hr>
|
||||
<fieldset>
|
||||
<?php if ($data['count']['count_posts'] != 0) : ?>
|
||||
<?= __('admin.posts'); ?>:
|
||||
<a target="_blank" rel="noopener noreferrer" title="<?= __('admin.posts'); ?> <?= $data['user']['login']; ?>" href="<?= url('profile.posts', ['login' => $data['user']['login']]); ?>">
|
||||
<?= $data['count']['count_posts']; ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<br>
|
||||
<?php if ($data['count']['count_answers'] != 0) : ?>
|
||||
<?= __('admin.answers'); ?>:
|
||||
<a target="_blank" rel="noopener noreferrer" title="<?= __('admin.answers'); ?> <?= $data['user']['login']; ?>" href="<?= url('profile.answers', ['login' => $data['user']['login']]); ?>">
|
||||
<?= $data['count']['count_answers']; ?>
|
||||
</a>
|
||||
<?php else : ?>
|
||||
---
|
||||
<?php endif; ?>
|
||||
<br>
|
||||
<?php if ($data['count']['count_comments'] != 0) : ?>
|
||||
<?= __('admin.comments'); ?>:
|
||||
<a target="_blank" rel="noopener noreferrer" title="<?= __('admin.comments'); ?> <?= $data['user']['login']; ?>" href="<?= url('profile.comments', ['login' => $data['user']['login']]); ?>">
|
||||
<?= $data['count']['count_comments']; ?>
|
||||
</a>
|
||||
<?php else : ?>
|
||||
---
|
||||
<?php endif; ?>
|
||||
</fieldset>
|
||||
<hr>
|
||||
<fieldset>
|
||||
<a class="text-sm" href="<?= url('admin.badges.user.add', ['id' => $data['user']['id']]); ?>">
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,38 +4,15 @@
|
|||
* Выделение кода
|
||||
*/
|
||||
|
||||
pre.lb { background: #181818; padding: 15px; }
|
||||
pre.lb span.kl-language, pre.lb span.kl-expression { color: white; }
|
||||
pre.lb span.kl-keyword { color: #FF9700; }
|
||||
pre.lb span.kl-operator { color: #c17200; }
|
||||
pre.lb span.kl-delimiter { color: #c17200; }
|
||||
pre.lb span.kl-string { color: #b7e388; }
|
||||
pre.lb span.kl-comment { color: #888; }
|
||||
pre.lb span.kl-number { color: #E26F90; }
|
||||
pre.lb span.kl-constant { color: #F5A2B7; }
|
||||
pre.lb span.kl-call { color: #F4BD8C; }
|
||||
pre.lb span.kl-call.kl-preprocessor { color: #99764b; }
|
||||
pre.lb span.kl-preprocessor { color: #ad916f; }
|
||||
pre.lb span.kl-symbol { color: #ffdebb; }
|
||||
pre.lb span.kl-variable { color: #AD83E2; }
|
||||
pre.lb span.kl-annotation { color: #FF9700; }
|
||||
pre.lb span.kl-parameter { color: #6691C2; }
|
||||
pre.lb span.kl-annotation.kl-arguments { color: white; }
|
||||
pre.lb span.kl-variable.kl-splat { color: #BD9CE0; }
|
||||
pre.lb span.kl-variable.kl-property { color: #BD9CE0; }
|
||||
pre.lb span.kl-symbol.kl-dotnet { color: #ffdebb; }
|
||||
pre.lb span.kl-comment.kl-docblock { color: #999; }
|
||||
pre.lb span.kl-tag { color: #c17200; }
|
||||
pre.lb span.kl-symbol.kl-tag { font-weight: bold; }
|
||||
pre.lb span.kl-attribute { color: #F4BD8C; }
|
||||
pre.lb span.kl-format.kl-bold { font-weight: bold; }
|
||||
pre.lb span.kl-format.kl-italics { font-style: italic; }
|
||||
pre.lb span.kl-format.kl-strike { text-decoration: line-through; }
|
||||
pre.lb span.kl-format.kl-underline { text-decoration: underline; }
|
||||
pre.lb span.kl-format.kl-monospace, pre.lb span.kl-format.kl-block.kl-code { color: #666; }
|
||||
pre.lb span.kl-format.kl-header { color: #6691C2; }
|
||||
pre.lb span.kl-symbol.kl-type { color: #F5A2B7; }
|
||||
pre.lb span.kl-tag.kl-namespace { color: #FF9700; font-weight: normal; }
|
||||
pre.lb span.kl-attribute.kl-namespace { color: #ffdebb; }
|
||||
pre.lb span.kl-diff.kl-add, pre.lb span.kl-annotation.kl-diff.kl-add { color: #89B366; }
|
||||
pre.lb span.kl-diff.kl-remove, pre.lb span.kl-annotation.kl-diff.kl-remove { color: #E26F90; }
|
||||
code {
|
||||
color: #9b4f5e;
|
||||
background-color: #f5f2f0;
|
||||
padding: 3px;
|
||||
border-radius: 3px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
pre {
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
}
|
|
@ -157,19 +157,6 @@ aside ul {
|
|||
|
||||
aside ul a { color: var(--gray); }
|
||||
|
||||
code {
|
||||
color: #9b4f5e;
|
||||
background-color: #f5f2f0;
|
||||
padding: 3px;
|
||||
border-radius: 3px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
pre {
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
margin-left: 15px;
|
||||
background-color: #f3f3f6;
|
||||
|
@ -180,7 +167,7 @@ blockquote {
|
|||
|
||||
blockquote p { margin: 2px; }
|
||||
|
||||
.cut-post img { max-width: 100%; }
|
||||
.cut-post img { max-width: 780px; }
|
||||
|
||||
hr {
|
||||
border: none;
|
||||
|
|
Loading…
Reference in a new issue