FIX: favicons в результатах поиска
This commit is contained in:
parent
107caa7b42
commit
9ec0d1d446
|
@ -22,9 +22,9 @@ class AddAnswerController extends Controller
|
|||
// Let's check the stop words, url
|
||||
// Проверим стоп слова и url
|
||||
$trigger = (new \App\Services\Audit())->prohibitedContent($content);
|
||||
|
||||
|
||||
$this->union($post, $url_post, $content);
|
||||
|
||||
|
||||
$last_id = AnswerModel::add($post['post_id'], $content, $trigger);
|
||||
|
||||
// Add an audit entry and an alert to the admin
|
||||
|
@ -64,11 +64,11 @@ class AddAnswerController extends Controller
|
|||
// If there are no replies to the post and the author of the post = the author of the answer, then add the answer to the end of the post
|
||||
// Если ответов на пост нет и автор поста = автора ответа, то дописываем ответ в конец поста
|
||||
if ((AnswerModel::getNumberAnswers($post['post_id']) == null) && ($post['post_user_id'] == $this->user['id'])) {
|
||||
|
||||
|
||||
AnswerModel::mergePost($post['post_id'], $content);
|
||||
|
||||
redirect($url_post);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ class CommentController extends Controller
|
|||
]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// On the home page
|
||||
// На главной странице
|
||||
public function lastComment()
|
||||
|
|
|
@ -6,7 +6,6 @@ use Hleb\Constructor\Handlers\Request;
|
|||
use App\Controllers\Controller;
|
||||
use App\Services\Сheck\FacetPresence;
|
||||
use App\Services\Meta\Facet;
|
||||
use App\Models\User\UserModel;
|
||||
use App\Models\{FeedModel, SubscriptionModel, FacetModel, PostModel};
|
||||
|
||||
class TopicFacetController extends Controller
|
||||
|
|
|
@ -28,7 +28,7 @@ class AdminController extends Controller
|
|||
'item',
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public function deleted()
|
||||
{
|
||||
return $this->render(
|
||||
|
@ -40,7 +40,7 @@ class AdminController extends Controller
|
|||
'item',
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public function comments()
|
||||
{
|
||||
return $this->render(
|
||||
|
@ -52,15 +52,15 @@ class AdminController extends Controller
|
|||
'item',
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public function status()
|
||||
{
|
||||
Request::getResources()->addBottomScript('/assets/js/catalog.js');
|
||||
|
||||
|
||||
$code = Request::get('code');
|
||||
|
||||
|
||||
$pagesCount = 0; // TODO
|
||||
|
||||
|
||||
return $this->render(
|
||||
'/item/admin/status',
|
||||
[
|
||||
|
@ -68,14 +68,14 @@ class AdminController extends Controller
|
|||
'data' => [
|
||||
'pagesCount' => ceil($pagesCount / $this->limit),
|
||||
'pNum' => $this->pageNumber,
|
||||
'status' => WebModel::getStatus($this->pageNumber, $code),
|
||||
'status' => WebModel::getStatus($this->pageNumber, $code),
|
||||
'code' => $code
|
||||
]
|
||||
],
|
||||
'item',
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public static function httpCode($url)
|
||||
{
|
||||
stream_context_set_default([
|
||||
|
@ -84,12 +84,12 @@ class AdminController extends Controller
|
|||
'verify_peer_name' => false,
|
||||
],
|
||||
]);
|
||||
|
||||
|
||||
$headers = get_headers($url);
|
||||
|
||||
return (empty($headers[0])) ? 404 : substr($headers[0], 9, 3);
|
||||
}
|
||||
|
||||
|
||||
// Once a month
|
||||
public static function updateStatus()
|
||||
{
|
||||
|
|
|
@ -14,7 +14,7 @@ class ImgController extends Controller
|
|||
if (!UserData::checkAdmin()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$item_id = Request::getPostInt('id');
|
||||
$item = WebModel::getItemId($item_id);
|
||||
notEmptyOrView404($item);
|
||||
|
@ -36,17 +36,17 @@ class ImgController extends Controller
|
|||
// "https://www.google.com/s2/favicons?domain=" . $url;
|
||||
return "https://favicon.yandex.net/favicon/" . $url;
|
||||
}
|
||||
|
||||
|
||||
public function screenshot()
|
||||
{
|
||||
if (!UserData::checkAdmin()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$item_id = Request::getPostInt('id');
|
||||
$item = WebModel::getItemId($item_id);
|
||||
notEmptyOrView404($item);
|
||||
|
||||
|
||||
$puth = HLEB_PUBLIC_DIR . Img::PATH['thumbs'] . host($item['item_url']) . '.png';
|
||||
|
||||
if (!file_exists($puth)) {
|
||||
|
@ -56,10 +56,10 @@ class ImgController extends Controller
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static function getScreenshot($url)
|
||||
{
|
||||
return "https://api.screenshotone.com/take?image_width=880&url=" . $url ."&access_key=" . config('integration.sc_access_key');
|
||||
{
|
||||
return "https://api.screenshotone.com/take?image_width=880&url=" . $url . "&access_key=" . config('integration.sc_access_key');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,15 +29,15 @@ class AddPostController extends Controller
|
|||
// Adding from page topic / blog
|
||||
// Добавление со странице темы / блога
|
||||
$facet_id = Request::getInt('facet_id');
|
||||
|
||||
|
||||
if ($facet_id) {
|
||||
$facet = FacetPresence::all($facet_id);
|
||||
|
||||
if ($facet['facet_type'] == 'topic') {
|
||||
$topic = FacetPresence::index($facet_id, 'id', 'topic');
|
||||
} elseif ($facet['facet_type'] == 'blog' && $facet['facet_user_id'] == $this->user['id']) {
|
||||
$blog = FacetPresence::index($facet_id, 'id', 'blog');
|
||||
}
|
||||
$facet = FacetPresence::all($facet_id);
|
||||
|
||||
if ($facet['facet_type'] == 'topic') {
|
||||
$topic = FacetPresence::index($facet_id, 'id', 'topic');
|
||||
} elseif ($facet['facet_type'] == 'blog' && $facet['facet_user_id'] == $this->user['id']) {
|
||||
$blog = FacetPresence::index($facet_id, 'id', 'blog');
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render(
|
||||
|
|
|
@ -146,7 +146,7 @@ class ProfileController extends Controller
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Index profile or not
|
||||
public function indexing($profile_id)
|
||||
{
|
||||
|
@ -154,7 +154,7 @@ class ProfileController extends Controller
|
|||
if (($amount['count_answers'] + $amount['count_comments']) < 3) {
|
||||
Request::getHead()->addMeta('robots', 'noindex');
|
||||
}
|
||||
|
||||
|
||||
if (UserModel::isDeleted($profile_id)) {
|
||||
Request::getHead()->addMeta('robots', 'noindex');
|
||||
}
|
||||
|
|
|
@ -64,18 +64,18 @@ class SettingController extends Controller
|
|||
function settingForm()
|
||||
{
|
||||
Request::getResources()->addBottomScript('/assets/js/dialog/dialog.js');
|
||||
|
||||
|
||||
$new = SettingModel::getNewEmail();
|
||||
$email = $new['email'] ?? null;
|
||||
|
||||
if($code = Request::getGet('newemail')) {
|
||||
if (SettingModel::available($code)) {
|
||||
SettingModel::editEmail($email);
|
||||
|
||||
is_return(__('msg.change_saved'), 'success', url('setting'));
|
||||
}
|
||||
if ($code = Request::getGet('newemail')) {
|
||||
if (SettingModel::available($code)) {
|
||||
SettingModel::editEmail($email);
|
||||
|
||||
is_return(__('msg.change_saved'), 'success', url('setting'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $this->render(
|
||||
'/user/setting/setting',
|
||||
[
|
||||
|
@ -229,7 +229,7 @@ class SettingController extends Controller
|
|||
]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
function deletion()
|
||||
{
|
||||
return $this->render(
|
||||
|
@ -239,7 +239,7 @@ class SettingController extends Controller
|
|||
'data' => []
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function notificationEdit()
|
||||
{
|
||||
|
@ -256,24 +256,24 @@ class SettingController extends Controller
|
|||
|
||||
is_return(__('msg.change_saved'), 'success', '/setting/notifications');
|
||||
}
|
||||
|
||||
|
||||
function newEmail()
|
||||
{
|
||||
$email = Request::getPost('email');
|
||||
|
||||
|
||||
if (RulesUserSetting::rulesNewEmail($email) === false) {
|
||||
return json_encode('error');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (is_array(AuthModel::checkRepetitions($email, 'email'))) {
|
||||
return json_encode('repeat');
|
||||
}
|
||||
|
||||
|
||||
$code = Html::randomString('crypto', 20);
|
||||
|
||||
|
||||
SettingModel::setNewEmail($email, $code);
|
||||
|
||||
SendEmail::mailText($this->user['id'], 'new.email', ['link' => '/setting?newemail=' . $code, 'new_email' =>$email]);
|
||||
SendEmail::mailText($this->user['id'], 'new.email', ['link' => '/setting?newemail=' . $code, 'new_email' => $email]);
|
||||
|
||||
return json_encode('success');
|
||||
}
|
||||
|
@ -293,5 +293,4 @@ class SettingController extends Controller
|
|||
|
||||
Session::logout();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ $sw = $sw ?? '?';
|
|||
<?php if ($type == 'website') : ?>
|
||||
<div class="text-sm mb5 lowercase">
|
||||
<span class="green">
|
||||
<?= Img::website($result['item_domain'], 'favicon', $result['item_domain'], 'favicons mr5'); ?>
|
||||
<?= Img::website('favicon', host($result['item_url']), 'favicons mr5'); ?>
|
||||
<?= $result['item_domain']; ?>
|
||||
</span>
|
||||
<a class="gray-600 ml15" href="<?= url('website', ['id' => $result['item_id'], 'slug' => $result['item_slug']]); ?>"><?= __('web.more'); ?></a>
|
||||
|
|
Loading…
Reference in a new issue