|
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
|
|
|
* Display a block where news moderators can show news that needs to be moderated. |
|
24
|
|
|
*/ |
|
25
|
|
|
function b_news_topics_moderate() |
|
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
|
|
|
$block = []; |
|
37
|
|
|
$dateformat = News\Utility::getModuleOption('dateformat'); |
|
38
|
|
|
$infotips = News\Utility::getModuleOption('infotips'); |
|
39
|
|
|
|
|
40
|
|
|
$storyarray = NewsStory:: getAllSubmitted(0, true, News\Utility::getModuleOption('restrictindex')); |
|
41
|
|
|
if (count($storyarray) > 0) { |
|
42
|
|
|
$block['lang_story_title'] = _MB_TITLE; |
|
43
|
|
|
$block['lang_story_date'] = _MB_POSTED; |
|
44
|
|
|
$block['lang_story_author'] = _MB_POSTER; |
|
45
|
|
|
$block['lang_story_action'] = _MB_ACTION; |
|
46
|
|
|
$block['lang_story_topic'] = _MB_TOPIC; |
|
47
|
|
|
$myts = \MyTextSanitizer::getInstance(); |
|
48
|
|
|
foreach ($storyarray as $newstory) { |
|
49
|
|
|
$title = $newstory->title(); |
|
50
|
|
|
$htmltitle = ''; |
|
51
|
|
|
if ($infotips > 0) { |
|
52
|
|
|
$story['infotips'] = News\Utility::makeInfotips($newstory->hometext()); |
|
53
|
|
|
$htmltitle = ' title="' . $story['infotips'] . '"'; |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
if (!isset($title) || ('' == $title)) { |
|
57
|
|
|
$linktitle = "<a href='" . XOOPS_URL . '/modules/news/index.php?op=edit&storyid=' . $newstory->storyid() . "' target='_blank'" . $htmltitle . '>' . _MD_NEWS_NOSUBJECT . '</a>'; |
|
58
|
|
|
} else { |
|
59
|
|
|
$linktitle = "<a href='" . XOOPS_URL . '/modules/news/submit.php?op=edit&storyid=' . $newstory->storyid() . "' target='_blank'" . $htmltitle . '>' . $title . '</a>'; |
|
60
|
|
|
} |
|
61
|
|
|
$story = []; |
|
62
|
|
|
$story['title'] = $linktitle; |
|
63
|
|
|
$story['date'] = formatTimestamp($newstory->created(), $dateformat); |
|
64
|
|
|
$story['author'] = "<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $newstory->uid() . "'>" . $newstory->uname() . '</a>'; |
|
65
|
|
|
$story['action'] = "<a href='" . XOOPS_URL . '/modules/news/admin/index.php?op=edit&storyid=' . $newstory->storyid() . "'>" . _EDIT . "</a> - <a href='" . XOOPS_URL . '/modules/news/admin/index.php?op=delete&storyid=' . $newstory->storyid() . "'>" . _MB_DELETE . '</a>'; |
|
66
|
|
|
$story['topic_title'] = $newstory->topic_title(); |
|
67
|
|
|
$story['topic_color'] = '#' . $myts->displayTarea($newstory->topic_color); |
|
68
|
|
|
$block['picture'] = XOOPS_URL . '/uploads/news/image/' . $newstory->picture(); |
|
69
|
|
|
$block['pictureinfo'] = $newstory->pictureinfo(); |
|
70
|
|
|
$block['stories'][] = &$story; |
|
71
|
|
|
unset($story); |
|
72
|
|
|
} |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
return $block; |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* @param $options |
|
80
|
|
|
*/ |
|
81
|
|
|
function b_news_topics_moderate_onthefly($options): void |
|
82
|
|
|
{ |
|
83
|
|
|
$options = explode('|', $options); |
|
84
|
|
|
$block = b_news_topics_moderate($options); |
|
|
|
|
|
|
85
|
|
|
|
|
86
|
|
|
$tpl = new \XoopsTpl(); |
|
87
|
|
|
$tpl->assign('block', $block); |
|
88
|
|
|
$tpl->display('db:news_block_moderate.tpl'); |
|
89
|
|
|
} |
|
90
|
|
|
|