|
1
|
|
|
<?php declare(strict_types=1); |
|
2
|
|
|
/* |
|
3
|
|
|
* You may not change or alter any portion of this comment or credits |
|
4
|
|
|
* of supporting developers from this source code or any supporting source code |
|
5
|
|
|
* which is considered copyrighted (c) material of the original comment or credit authors. |
|
6
|
|
|
* |
|
7
|
|
|
* This program is distributed in the hope that it will be useful, |
|
8
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
9
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* @copyright {@link https://xoops.org/ XOOPS Project} |
|
14
|
|
|
* @license {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later} |
|
15
|
|
|
* @author XOOPS Development Team |
|
16
|
|
|
*/ |
|
17
|
|
|
|
|
18
|
|
|
use XoopsModules\News; |
|
19
|
|
|
use XoopsModules\News\Helper; |
|
20
|
|
|
use XoopsModules\News\NewsStory; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* @return array|null|false |
|
24
|
|
|
*/ |
|
25
|
|
|
function b_news_bigstory_show() |
|
26
|
|
|
{ |
|
27
|
|
|
// require_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php'; |
|
28
|
|
|
|
|
29
|
|
|
/** @var Helper $helper */ |
|
30
|
|
|
if (!class_exists(Helper::class)) { |
|
31
|
|
|
return false; |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
$helper = Helper::getInstance(); |
|
|
|
|
|
|
35
|
|
|
|
|
36
|
|
|
$myts = \MyTextSanitizer::getInstance(); |
|
37
|
|
|
$restricted = News\Utility::getModuleOption('restrictindex'); |
|
38
|
|
|
$dateformat = News\Utility::getModuleOption('dateformat'); |
|
39
|
|
|
$infotips = News\Utility::getModuleOption('infotips'); |
|
40
|
|
|
|
|
41
|
|
|
$block = []; |
|
42
|
|
|
$onestory = new NewsStory(); |
|
43
|
|
|
$stories = $onestory->getBigStory(1, 0, $restricted, 0, 1, true, 'counter'); |
|
44
|
|
|
if (0 == count($stories)) { |
|
45
|
|
|
$block['message'] = _MB_NEWS_NOTYET; |
|
46
|
|
|
} else { |
|
47
|
|
|
foreach ($stories as $key => $story) { |
|
48
|
|
|
$htmltitle = ''; |
|
49
|
|
|
if ($infotips > 0) { |
|
50
|
|
|
$block['infotips'] = News\Utility::makeInfotips($story->hometext()); |
|
51
|
|
|
$htmltitle = ' title="' . $block['infotips'] . '"'; |
|
52
|
|
|
} else { |
|
53
|
|
|
$htmltitle = ' title="' . $story->title('Show') . '"'; |
|
54
|
|
|
} |
|
55
|
|
|
$block['htmltitle'] = $htmltitle; |
|
56
|
|
|
$block['message'] = _MB_NEWS_TMRSI; |
|
57
|
|
|
$block['story_title'] = $story->title('Show'); |
|
58
|
|
|
$block['story_id'] = $story->storyid(); |
|
59
|
|
|
$block['story_date'] = formatTimestamp($story->published(), $dateformat); |
|
60
|
|
|
$block['story_hits'] = $story->counter(); |
|
61
|
|
|
$block['story_rating'] = $story->rating(); |
|
62
|
|
|
$block['story_votes'] = $story->votes(); |
|
63
|
|
|
$block['story_author'] = $story->uname(); |
|
64
|
|
|
$block['story_text'] = $story->hometext(); |
|
65
|
|
|
$block['story_topic_title'] = $story->topic_title(); |
|
66
|
|
|
$block['story_topic_color'] = '#' . $myts->displayTarea($story->topic_color); |
|
67
|
|
|
$block['story_picture'] = XOOPS_URL . '/uploads/news/image/' . $story->picture(); |
|
68
|
|
|
$block['story_pictureinfo'] = $story->pictureinfo(); |
|
69
|
|
|
} |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
return $block; |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* @param $options |
|
77
|
|
|
*/ |
|
78
|
|
|
function b_news_bigstory_onthefly($options): void |
|
79
|
|
|
{ |
|
80
|
|
|
$options = explode('|', $options); |
|
81
|
|
|
$block = b_news_bigstory_show($options); |
|
|
|
|
|
|
82
|
|
|
|
|
83
|
|
|
$tpl = new \XoopsTpl(); |
|
84
|
|
|
$tpl->assign('block', $block); |
|
85
|
|
|
$tpl->display('db:news_block_bigstory.tpl'); |
|
86
|
|
|
} |
|
87
|
|
|
|