Passed
Push — master ( 23721f...32f8a2 )
by Lio
03:12 queued 45s
created

event.php (9 issues)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 You may not change or alter any portion of this comment or credits
7
 of supporting developers from this source code or any supporting source code
8
 which is considered copyrighted (c) material of the original comment or credit authors.
9
10
 This program is distributed in the hope that it will be useful,
11
 but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
*/
14
15
/**
16
 * Module: Countdown
17
 *
18
 * @category        Module
19
 * @package         countdown
20
 * @author          XOOPS Development Team <https://xoops.org>
21
 * @copyright       {@link https://xoops.org/ XOOPS Project}
22
 * @license         GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
23
 * @link            https://xoops.org/
24
 * @since           1.0.0
25
 */
26
27
use Xmf\Request;
0 ignored issues
show
The type Xmf\Request was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
28
use XoopsModules\Countdown;
29
30
$GLOBALS['xoopsOption']['template_main'] = 'countdown_event_view.tpl';
31
require_once __DIR__ . '/header.php';
32
$start = Request::getInt('start', 0);
33
// Define Stylesheet
34
$xoTheme->addStylesheet($stylesheet);
35
36
$db = \XoopsDatabaseFactory::getDatabaseConnection();
0 ignored issues
show
The type XoopsDatabaseFactory was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
37
38
// Get Handler
39
/** @var \XoopsPersistableObjectHandler $eventsHandler */
40
$eventsHandler = new Countdown\EventsHandler($db);
41
42
$eventsPaginationLimit = $helper->getConfig('usereventperpage');
43
44
$criteria = new \CriteriaCompo();
0 ignored issues
show
The type CriteriaCompo was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
45
46
$criteria->setOrder('DESC');
47
$criteria->setLimit($eventsPaginationLimit);
48
$criteria->setStart($start);
49
50
$eventsCount = $eventsHandler->getCount($criteria);
51
$eventsArray = $eventsHandler->getAll($criteria);
52
53
$moduleDirNameUpper = strtoupper($moduleDirName);
54
55
$id = Request::getInt('id', 0, 'GET');
56
57
//viewItem();
58
$eventsPaginationLimit = 1;
59
$myid                  = $id;
60
//id
61
$eventsObject = $eventsHandler->get($myid);
62
63
$criteria = new \CriteriaCompo();
64
$criteria->setSort('event_id');
65
$criteria->setOrder('DESC');
66
$criteria->setLimit($eventsPaginationLimit);
67
$criteria->setStart($start);
68
$events['id']           = $eventsObject->getVar('event_id');
69
$events['uid']          = $eventsObject->getVar('event_uid');
70
$events['submitter']    = \XoopsUser::getUnameFromId($eventsObject->getVar('event_uid'));
0 ignored issues
show
The type XoopsUser was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
71
$events['name']         = $eventsObject->getVar('event_name');
72
$events['category']     = $eventsObject->getVar('event_categoryid');
73
$categoryHandler        = $helper->getHandler('category');
74
$categoryObj            = $categoryHandler->get($eventsObject->getVar('event_categoryid'));
75
$events['categoryname'] = $categoryObj->getVar('category_title');
76
$categoryname           = $categoryObj->getVar('category_title');
77
$events['logo']         = $eventsObject->getVar('event_logo');
78
$events['description']  = ($eventsObject->getVar('event_description'));
79
$events['date']         = date(_DATESTRING, strtotime($eventsObject->getVar('event_date')));
0 ignored issues
show
The constant _DATESTRING was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
80
$events['dateiso']      = $eventsObject->getVar('event_date');
81
$events['date_created'] = formatTimestamp($eventsObject->getVar('date_created'));
0 ignored issues
show
The function formatTimestamp was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

81
$events['date_created'] = /** @scrutinizer ignore-call */ formatTimestamp($eventsObject->getVar('date_created'));
Loading history...
82
$date_created           = formatTimestamp($eventsObject->getVar('date_created'));
83
$events['date_updated'] = formatTimestamp($eventsObject->getVar('date_updated'));
84
$date_updated           = formatTimestamp($eventsObject->getVar('date_updated'));
85
86
if ($date_created == $date_updated) {
87
    $events['info'] = sprintf(_MD_COUNTDOWN_POSTEDBY, \XoopsUser::getUnameFromId($eventsObject->getVar('event_uid')), formatTimestamp($eventsObject->getVar('date_created'), 'M d Y'), $categoryname);
88
} else {
89
    $events['info'] = sprintf(_MD_COUNTDOWN_POSTEDBY, \XoopsUser::getUnameFromId($eventsObject->getVar('event_uid')), formatTimestamp($eventsObject->getVar('date_updated'), 'M d Y'), $categoryname);
90
}
91
92
//       $GLOBALS['xoopsTpl']->append('events', $events);
93
$keywords[] = $eventsObject->getVar('event_id');
94
95
$GLOBALS['xoopsTpl']->assign('events', $events);
96
$start = $id;
97
98
// Display Navigation
99
if ($eventsCount > $eventsPaginationLimit) {
100
    $GLOBALS['xoopsTpl']->assign('event_url', COUNTDOWN_URL . '/event.php');
101
    require_once XOOPS_ROOT_PATH . '/class/pagenav.php';
0 ignored issues
show
The constant XOOPS_ROOT_PATH was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
102
    $pagenav = new \XoopsPageNav($eventsCount, $eventsPaginationLimit, $start, 'id');
0 ignored issues
show
The type XoopsPageNav was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
103
    $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4));
104
}
105
106
//keywords
107
if (isset($keywords)) {
108
    $utility::metaKeywords(xoops_getModuleOption('keywords', $moduleDirName) . ', ' . implode(', ', $keywords));
0 ignored issues
show
The function xoops_getModuleOption was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

108
    $utility::metaKeywords(/** @scrutinizer ignore-call */ xoops_getModuleOption('keywords', $moduleDirName) . ', ' . implode(', ', $keywords));
Loading history...
109
}
110
//description
111
$utility::metaDescription(_MD_COUNTDOWN_EVENTS_DESC);
112
//
113
$GLOBALS['xoopsTpl']->assign('event_url', COUNTDOWN_URL . '/event.php');
114
$GLOBALS['xoopsTpl']->assign('countdown_url', COUNTDOWN_URL);
115
$GLOBALS['xoopsTpl']->assign('admin', COUNTDOWN_ADMIN);
116
$GLOBALS['xoopsTpl']->assign('copyright', $copyright);
117
118
require XOOPS_ROOT_PATH . '/include/comment_view.php';
119
require __DIR__ . '/footer.php';
120
require dirname(__DIR__, 2) . '/footer.php';
121