1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Module: Soapbox |
4
|
|
|
* Version: v 1.5 |
5
|
|
|
* Release Date: 23 August 2004 |
6
|
|
|
* Author: hsalazar |
7
|
|
|
* Licence: GNU |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
use Xmf\Request; |
11
|
|
|
use XoopsModules\Soapbox; |
12
|
|
|
|
13
|
|
|
require __DIR__ . '/header.php'; |
14
|
|
|
|
15
|
|
|
$moduleDirName = basename(__DIR__); |
16
|
|
|
|
17
|
|
|
/** @var \XoopsModules\Soapbox\Helper $helper */ |
18
|
|
|
$helper = \XoopsModules\Soapbox\Helper::getInstance(); |
19
|
|
|
|
20
|
|
|
$op = ''; |
21
|
|
|
if (is_object($xoopsUser)) { |
22
|
|
|
$xoopsConfig['module_cache'] = 0; //disable caching since the URL will be the same, but content different from one user to another |
23
|
|
|
} |
24
|
|
|
$GLOBALS['xoopsOption']['template_main'] = 'sb_index.tpl'; |
25
|
|
|
require_once XOOPS_ROOT_PATH . '/header.php'; |
26
|
|
|
|
27
|
|
|
//$moduleDirName = & $myts->htmlSpecialChars(basename(__DIR__)); |
28
|
|
|
//if ($moduleDirName !== "soapbox" && $moduleDirName !== "" && !preg_match('/^(\D+)(\d*)$/', $moduleDirName)) { |
29
|
|
|
// echo("invalid dirname: " . htmlspecialchars($moduleDirName, ENT_QUOTES)); |
30
|
|
|
//} |
31
|
|
|
|
32
|
|
|
//---GET view sort -- |
33
|
|
|
$sortname = \Xmf\Request::getString('sortname', 'datesub', 'GET'); |
34
|
|
|
if (!in_array($sortname, ['datesub', 'weight', 'counter', 'rating', 'headline'], true)) { |
35
|
|
|
$sortname = 'datesub'; |
36
|
|
|
} |
37
|
|
|
$sortorder = \Xmf\Request::getString('sortorder', 'DESC', 'GET'); |
38
|
|
|
if (!in_array($sortorder, ['ASC', 'DESC'], true)) { |
39
|
|
|
$sortorder = 'DESC'; |
40
|
|
|
} |
41
|
|
|
//--------------- |
42
|
|
|
require XOOPS_ROOT_PATH . '/class/pagenav.php'; |
43
|
|
|
$start = \Xmf\Request::getInt('start', 0, 'GET'); //$start = isset($_GET['start']) ? (int)($_GET['start']) : 0; |
44
|
|
|
//--------------- |
45
|
|
|
|
46
|
|
|
$category = []; |
47
|
|
|
$articles = []; |
48
|
|
|
// Options |
49
|
|
|
switch ($op) { |
50
|
|
|
case 'default': |
51
|
|
|
default: |
52
|
|
|
//------------------------------------- |
53
|
|
|
/** @var \XoopsModules\Soapbox\EntrydataHandler $entrydataHandler */ |
54
|
|
|
$entrydataHandler = new \XoopsModules\Soapbox\EntrydataHandler(); |
55
|
|
|
|
56
|
|
|
//------------------------------------- |
57
|
|
|
|
58
|
|
|
$author = \Xmf\Request::getInt('author', 0, 'GET'); |
59
|
|
|
//get category object |
60
|
|
|
if (!empty($author)) { |
61
|
|
|
$categoryobArray = $entrydataHandler->getColumnsByAuthor($author, true, (int)$helper->getConfig('colsperindex'), $start, 'weight', 'ASC'); |
62
|
|
|
$totalcols = $entrydataHandler->total_getColumnsByAuthor; |
63
|
|
|
} else { |
64
|
|
|
//get category object |
65
|
|
|
$categoryobArray = $entrydataHandler->getColumnsAllPermcheck((int)$helper->getConfig('colsperindex'), $start, true, 'weight', 'ASC', null, null, true, false); |
|
|
|
|
66
|
|
|
$totalcols = $entrydataHandler->total_getColumnsAllPermcheck; |
67
|
|
|
} |
68
|
|
|
$xoopsTpl->assign('lang_mainhead', $myts->htmlSpecialChars($helper->getConfig('introtitle'))); |
69
|
|
|
$xoopsTpl->assign('lang_maintext', $myts->htmlSpecialChars($helper->getConfig('introtext'))); |
70
|
|
|
$xoopsTpl->assign('lang_modulename', $xoopsModule->name()); |
71
|
|
|
$xoopsTpl->assign('lang_moduledirname', $moduleDirName); |
72
|
|
|
$xoopsTpl->assign('imgdir', $myts->htmlSpecialChars($helper->getConfig('sbimgdir'))); |
73
|
|
|
$xoopsTpl->assign('uploaddir', $myts->htmlSpecialChars($helper->getConfig('sbuploaddir'))); |
74
|
|
|
|
75
|
|
|
//---------------------------- |
76
|
|
|
if (0 === $totalcols) { |
77
|
|
|
$xoopsTpl->assign('lang_nothing', _MD_SOAPBOX_NOTHING); |
78
|
|
|
} |
79
|
|
|
//---------------------------- |
80
|
|
|
foreach ($categoryobArray as $categoryob) { |
81
|
|
|
//---------------------------- |
82
|
|
|
$category = $categoryob->toArray(); //all assign |
83
|
|
|
//------------------------------------- |
84
|
|
|
//get author |
85
|
|
|
$category['authorname'] = Soapbox\Utility::getAuthorName($category['author']); |
86
|
|
|
//------------------------------------- |
87
|
|
|
if ('' !== $category['colimage']) { |
88
|
|
|
$category['imagespan'] = '<span class="picleft"><img class="pic" src="' . XOOPS_URL . '/' . $myts->htmlSpecialChars($helper->getConfig('sbuploaddir')) . '/' . $category['colimage'] . '"></span>'; |
89
|
|
|
} else { |
90
|
|
|
$category['imagespan'] = ''; |
91
|
|
|
} |
92
|
|
|
//------------------------------------- |
93
|
|
|
$entryobArray = $entrydataHandler->getArticlesAllPermcheck(1, 0, true, true, 0, 0, null, $sortname, $sortorder, $categoryob, null, true, false); |
94
|
|
|
$totalarts = $entrydataHandler->total_getArticlesAllPermcheck; |
95
|
|
|
$category['totalarts'] = $totalarts; |
96
|
|
|
//------------------------------------------------------ |
97
|
|
|
foreach ($entryobArray as $entryob) { |
98
|
|
|
//----------- |
99
|
|
|
unset($articles); |
100
|
|
|
//get vars |
101
|
|
|
$articles = $entryob->toArray(); |
102
|
|
|
$articles['id'] = $articles['articleID']; |
103
|
|
|
$articles['datesub'] = $myts->htmlSpecialChars(formatTimestamp($articles['datesub'], $helper->getConfig('dateformat'))); |
104
|
|
|
// $articles['poster'] = XoopsUserUtility::getUnameFromId( $articles['uid'] ); |
105
|
|
|
$articles['poster'] = Soapbox\Utility::getLinkedUnameFromId($category['author']); |
106
|
|
|
$articles['bodytext'] = xoops_substr($articles['bodytext'], 0, 255); |
107
|
|
|
//-------------------- |
108
|
|
|
if (0 !== $articles['submit']) { |
109
|
|
|
$articles['headline'] = '[' . _MD_SOAPBOX_SELSUBMITS . ']' . $articles['headline']; |
110
|
|
|
$articles['teaser'] = $xoopsUser->getVar('uname') . _MD_SOAPBOX_SUB_SNEWNAMEDESC; |
111
|
|
|
$articles['lead'] = $xoopsUser->getVar('uname') . _MD_SOAPBOX_SUB_SNEWNAMEDESC; |
112
|
|
|
} elseif (0 === $entryob->getVar('datesub') || ($entryob->getVar('datesub') > time())) { |
113
|
|
|
$articles['headline'] = '[' . _MD_SOAPBOX_SELWAITEPUBLISH . ']' . $articles['headline']; |
114
|
|
|
$articles['teaser'] = $xoopsUser->getVar('uname') . _MD_SOAPBOX_SUB_SNEWNAMEDESC; |
115
|
|
|
$articles['lead'] = $xoopsUser->getVar('uname') . _MD_SOAPBOX_SUB_SNEWNAMEDESC; |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
// Functional links |
119
|
|
|
$articles['adminlinks'] = $entrydataHandler->getadminlinks($entryob, $categoryob); |
120
|
|
|
$articles['userlinks'] = $entrydataHandler->getuserlinks($entryob); |
121
|
|
|
//loop tail |
122
|
|
|
$category['content'][] = $articles; |
123
|
|
|
unset($articles); |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
$category['total'] = $totalcols; |
127
|
|
|
$pagenav = new \XoopsPageNav($category['total'], (int)$helper->getConfig('colsperindex'), $start, 'start', ''); |
128
|
|
|
$category['navbar'] = '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>'; |
129
|
|
|
|
130
|
|
|
$xoopsTpl->append_by_ref('cols', $category); |
131
|
|
|
unset($category); |
132
|
|
|
} |
133
|
|
|
} |
134
|
|
|
//$xoopsTpl->assign("xoops_module_header", '<link rel="stylesheet" type="text/css" href="style.css">'); |
135
|
|
|
$xoopsTpl->assign('xoops_module_header', '<link rel="stylesheet" type="text/css" href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/assets/css/style.css">'); |
136
|
|
|
|
137
|
|
|
require XOOPS_ROOT_PATH . '/footer.php'; |
138
|
|
|
|
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.