@@ -37,48 +37,48 @@ discard block |
||
37 | 37 | $anonwaitdays = 1; |
38 | 38 | $ip = \Xmf\IPAddress::fromRequest()->asReadable(); |
39 | 39 | foreach (['topic_id', 'rate', 'forum'] as $var) { |
40 | - // ${$var} = isset($_POST[$var]) ? (int)($_POST[$var]) : (isset($_GET[$var])?(int)($_GET[$var]):0); |
|
41 | - ${$var} = Request::getInt($var, Request::getInt($var, 0, 'POST'), 'GET'); |
|
40 | + // ${$var} = isset($_POST[$var]) ? (int)($_POST[$var]) : (isset($_GET[$var])?(int)($_GET[$var]):0); |
|
41 | + ${$var} = Request::getInt($var, Request::getInt($var, 0, 'POST'), 'GET'); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | ///** @var Newbb\TopicHandler $topicHandler */ |
45 | 45 | //$topicHandler = Newbb\Helper::getInstance()->getHandler('Topic'); |
46 | 46 | $topicObject = $topicHandler->get($topic_id); |
47 | 47 | if (!$topicHandler->getPermission($topicObject->getVar('forum_id'), $topicObject->getVar('topic_status'), 'post') |
48 | - && !$topicHandler->getPermission($topicObject->getVar('forum_id'), $topicObject->getVar('topic_status'), 'reply')) { |
|
49 | - // irmtfan - issue with javascript:history.go(-1) |
|
50 | - redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _NOPERM); |
|
48 | + && !$topicHandler->getPermission($topicObject->getVar('forum_id'), $topicObject->getVar('topic_status'), 'reply')) { |
|
49 | + // irmtfan - issue with javascript:history.go(-1) |
|
50 | + redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _NOPERM); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | if (empty($rate)) { |
54 | - redirect_header('viewtopic.php?topic_id=' . $topic_id . '&forum=' . $forum . '', 4, _MD_NEWBB_NOVOTERATE); |
|
54 | + redirect_header('viewtopic.php?topic_id=' . $topic_id . '&forum=' . $forum . '', 4, _MD_NEWBB_NOVOTERATE); |
|
55 | 55 | } |
56 | 56 | ///** @var Newbb\RateHandler $rateHandler */ |
57 | 57 | //$rateHandler = Newbb\Helper::getInstance()->getHandler('Rate'); |
58 | 58 | if (0 !== $ratinguser) { |
59 | - // Check if Topic POSTER is voting (UNLESS Anonymous users allowed to post) |
|
60 | - $crit_post = new \CriteriaCompo(new \Criteria('topic_id', $topic_id)); |
|
61 | - $crit_post->add(new \Criteria('uid', $ratinguser)); |
|
62 | - // /** @var Newbb\PostHandler $postHandler */ |
|
63 | - // $postHandler = Newbb\Helper::getInstance()->getHandler('Post'); |
|
64 | - if ($postHandler->getCount($crit_post)) { |
|
65 | - redirect_header('viewtopic.php?topic_id=' . $topic_id . '&forum=' . $forum . '', 4, _MD_NEWBB_CANTVOTEOWN); |
|
66 | - } |
|
67 | - // Check if REG user is trying to vote twice. |
|
68 | - $crit_rate = new \CriteriaCompo(new \Criteria('topic_id', $topic_id)); |
|
69 | - $crit_rate->add(new \Criteria('ratinguser', $ratinguser)); |
|
70 | - if ($rateHandler->getCount($crit_rate)) { |
|
71 | - redirect_header('viewtopic.php?topic_id=' . $topic_id . '&forum=' . $forum . '', 4, _MD_NEWBB_VOTEONCE); |
|
72 | - } |
|
59 | + // Check if Topic POSTER is voting (UNLESS Anonymous users allowed to post) |
|
60 | + $crit_post = new \CriteriaCompo(new \Criteria('topic_id', $topic_id)); |
|
61 | + $crit_post->add(new \Criteria('uid', $ratinguser)); |
|
62 | + // /** @var Newbb\PostHandler $postHandler */ |
|
63 | + // $postHandler = Newbb\Helper::getInstance()->getHandler('Post'); |
|
64 | + if ($postHandler->getCount($crit_post)) { |
|
65 | + redirect_header('viewtopic.php?topic_id=' . $topic_id . '&forum=' . $forum . '', 4, _MD_NEWBB_CANTVOTEOWN); |
|
66 | + } |
|
67 | + // Check if REG user is trying to vote twice. |
|
68 | + $crit_rate = new \CriteriaCompo(new \Criteria('topic_id', $topic_id)); |
|
69 | + $crit_rate->add(new \Criteria('ratinguser', $ratinguser)); |
|
70 | + if ($rateHandler->getCount($crit_rate)) { |
|
71 | + redirect_header('viewtopic.php?topic_id=' . $topic_id . '&forum=' . $forum . '', 4, _MD_NEWBB_VOTEONCE); |
|
72 | + } |
|
73 | 73 | } else { |
74 | - // Check if ANONYMOUS user is trying to vote more than once per day. |
|
75 | - $crit_rate = new \CriteriaCompo(new \Criteria('topic_id', $topic_id)); |
|
76 | - $crit_rate->add(new \Criteria('ratinguser', $ratinguser)); |
|
77 | - $crit_rate->add(new \Criteria('ratinghostname', $ip)); |
|
78 | - $crit_rate->add(new \Criteria('ratingtimestamp', time() - (86400 * $anonwaitdays), '>')); |
|
79 | - if ($rateHandler->getCount($crit_rate)) { |
|
80 | - redirect_header('viewtopic.php?topic_id=' . $topic_id . '&forum=' . $forum . '', 4, _MD_NEWBB_VOTEONCE); |
|
81 | - } |
|
74 | + // Check if ANONYMOUS user is trying to vote more than once per day. |
|
75 | + $crit_rate = new \CriteriaCompo(new \Criteria('topic_id', $topic_id)); |
|
76 | + $crit_rate->add(new \Criteria('ratinguser', $ratinguser)); |
|
77 | + $crit_rate->add(new \Criteria('ratinghostname', $ip)); |
|
78 | + $crit_rate->add(new \Criteria('ratingtimestamp', time() - (86400 * $anonwaitdays), '>')); |
|
79 | + if ($rateHandler->getCount($crit_rate)) { |
|
80 | + redirect_header('viewtopic.php?topic_id=' . $topic_id . '&forum=' . $forum . '', 4, _MD_NEWBB_VOTEONCE); |
|
81 | + } |
|
82 | 82 | } |
83 | 83 | $rateObject = $rateHandler->create(); |
84 | 84 | $rateObject->setVar('rating', $rate * 2); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $votesDB = $GLOBALS['xoopsDB']->getRowsNum($voteresult); |
95 | 95 | $totalrating = 0; |
96 | 96 | while (false !== (list($rating) = $GLOBALS['xoopsDB']->fetchRow($voteresult))) { |
97 | - $totalrating += $rating; |
|
97 | + $totalrating += $rating; |
|
98 | 98 | } |
99 | 99 | $finalrating = $totalrating / $votesDB; |
100 | 100 | $finalrating = number_format($finalrating, 4); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | use Xmf\Request; |
33 | 33 | |
34 | -require_once __DIR__ . '/header.php'; |
|
34 | +require_once __DIR__.'/header.php'; |
|
35 | 35 | |
36 | 36 | $ratinguser = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0; |
37 | 37 | $anonwaitdays = 1; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | } |
52 | 52 | |
53 | 53 | if (empty($rate)) { |
54 | - redirect_header('viewtopic.php?topic_id=' . $topic_id . '&forum=' . $forum . '', 4, _MD_NEWBB_NOVOTERATE); |
|
54 | + redirect_header('viewtopic.php?topic_id='.$topic_id.'&forum='.$forum.'', 4, _MD_NEWBB_NOVOTERATE); |
|
55 | 55 | } |
56 | 56 | ///** @var Newbb\RateHandler $rateHandler */ |
57 | 57 | //$rateHandler = Newbb\Helper::getInstance()->getHandler('Rate'); |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | // /** @var Newbb\PostHandler $postHandler */ |
63 | 63 | // $postHandler = Newbb\Helper::getInstance()->getHandler('Post'); |
64 | 64 | if ($postHandler->getCount($crit_post)) { |
65 | - redirect_header('viewtopic.php?topic_id=' . $topic_id . '&forum=' . $forum . '', 4, _MD_NEWBB_CANTVOTEOWN); |
|
65 | + redirect_header('viewtopic.php?topic_id='.$topic_id.'&forum='.$forum.'', 4, _MD_NEWBB_CANTVOTEOWN); |
|
66 | 66 | } |
67 | 67 | // Check if REG user is trying to vote twice. |
68 | 68 | $crit_rate = new \CriteriaCompo(new \Criteria('topic_id', $topic_id)); |
69 | 69 | $crit_rate->add(new \Criteria('ratinguser', $ratinguser)); |
70 | 70 | if ($rateHandler->getCount($crit_rate)) { |
71 | - redirect_header('viewtopic.php?topic_id=' . $topic_id . '&forum=' . $forum . '', 4, _MD_NEWBB_VOTEONCE); |
|
71 | + redirect_header('viewtopic.php?topic_id='.$topic_id.'&forum='.$forum.'', 4, _MD_NEWBB_VOTEONCE); |
|
72 | 72 | } |
73 | 73 | } else { |
74 | 74 | // Check if ANONYMOUS user is trying to vote more than once per day. |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $crit_rate->add(new \Criteria('ratinghostname', $ip)); |
78 | 78 | $crit_rate->add(new \Criteria('ratingtimestamp', time() - (86400 * $anonwaitdays), '>')); |
79 | 79 | if ($rateHandler->getCount($crit_rate)) { |
80 | - redirect_header('viewtopic.php?topic_id=' . $topic_id . '&forum=' . $forum . '', 4, _MD_NEWBB_VOTEONCE); |
|
80 | + redirect_header('viewtopic.php?topic_id='.$topic_id.'&forum='.$forum.'', 4, _MD_NEWBB_VOTEONCE); |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 | $rateObject = $rateHandler->create(); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | $ratingid = $rateHandler->insert($rateObject); |
91 | 91 | |
92 | -$query = 'SELECT rating FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_votedata') . ' WHERE topic_id = ' . $topic_id . ' '; |
|
92 | +$query = 'SELECT rating FROM '.$GLOBALS['xoopsDB']->prefix('newbb_votedata').' WHERE topic_id = '.$topic_id.' '; |
|
93 | 93 | $voteresult = $GLOBALS['xoopsDB']->query($query); |
94 | 94 | $votesDB = $GLOBALS['xoopsDB']->getRowsNum($voteresult); |
95 | 95 | $totalrating = 0; |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $sql = sprintf('UPDATE "%s" SET rating = "%u", votes = "%u" WHERE topic_id = "%u"', $GLOBALS['xoopsDB']->prefix('newbb_topics'), $finalrating, $votesDB, $topic_id); |
102 | 102 | $GLOBALS['xoopsDB']->queryF($sql); |
103 | 103 | |
104 | -$ratemessage = _MD_NEWBB_VOTEAPPRE . '<br>' . sprintf(_MD_NEWBB_THANKYOU, $GLOBALS['xoopsConfig']['sitename']); |
|
105 | -redirect_header('viewtopic.php?topic_id=' . $topic_id . '&forum=' . $forum . '', 2, $ratemessage); |
|
104 | +$ratemessage = _MD_NEWBB_VOTEAPPRE.'<br>'.sprintf(_MD_NEWBB_THANKYOU, $GLOBALS['xoopsConfig']['sitename']); |
|
105 | +redirect_header('viewtopic.php?topic_id='.$topic_id.'&forum='.$forum.'', 2, $ratemessage); |
|
106 | 106 | // irmtfan enhance include footer.php |
107 | 107 | require_once $GLOBALS['xoops']->path('footer.php'); |
@@ -23,42 +23,42 @@ discard block |
||
23 | 23 | //require_once $GLOBALS['xoops']->path('header.php'); |
24 | 24 | |
25 | 25 | if (!empty($GLOBALS['xoopsModuleConfig']['do_rewrite'])) { |
26 | - require_once __DIR__ . '/seo_url.php'; |
|
27 | - /* for seo */ |
|
28 | - $toseo_url = ['index.php', 'viewforum.php', 'viewtopic.php', 'rss.php']; |
|
26 | + require_once __DIR__ . '/seo_url.php'; |
|
27 | + /* for seo */ |
|
28 | + $toseo_url = ['index.php', 'viewforum.php', 'viewtopic.php', 'rss.php']; |
|
29 | 29 | |
30 | - if (!empty($GLOBALS['xoopsModuleConfig']['do_rewrite']) && (!isset($_POST) || count($_POST) <= 0) |
|
31 | - && (false === strpos(getenv('REQUEST_URI'), '.html'))) { |
|
32 | - $redir = false; |
|
33 | - if (true === strpos(getenv('REQUEST_URI'), 'mark_read=') || true === strpos(getenv('REQUEST_URI'), 'mark=')) { |
|
34 | - // Mark Forums |
|
35 | - } else { |
|
36 | - if (in_array(basename(getenv('SCRIPT_NAME')), $toseo_url)) { |
|
37 | - //rewrite only for files |
|
30 | + if (!empty($GLOBALS['xoopsModuleConfig']['do_rewrite']) && (!isset($_POST) || count($_POST) <= 0) |
|
31 | + && (false === strpos(getenv('REQUEST_URI'), '.html'))) { |
|
32 | + $redir = false; |
|
33 | + if (true === strpos(getenv('REQUEST_URI'), 'mark_read=') || true === strpos(getenv('REQUEST_URI'), 'mark=')) { |
|
34 | + // Mark Forums |
|
35 | + } else { |
|
36 | + if (in_array(basename(getenv('SCRIPT_NAME')), $toseo_url)) { |
|
37 | + //rewrite only for files |
|
38 | 38 | |
39 | - if ('' !== trim(getenv('SCRIPT_NAME'))) { |
|
40 | - if (false === strpos(getenv('REQUEST_URI'), '/' . SEO_MODULE_NAME . '/')) { |
|
41 | - $redir = true; |
|
42 | - } elseif (getenv('QUERY_STRING')) { |
|
43 | - $redir = true; |
|
44 | - } |
|
45 | - } |
|
46 | - } |
|
47 | - } |
|
39 | + if ('' !== trim(getenv('SCRIPT_NAME'))) { |
|
40 | + if (false === strpos(getenv('REQUEST_URI'), '/' . SEO_MODULE_NAME . '/')) { |
|
41 | + $redir = true; |
|
42 | + } elseif (getenv('QUERY_STRING')) { |
|
43 | + $redir = true; |
|
44 | + } |
|
45 | + } |
|
46 | + } |
|
47 | + } |
|
48 | 48 | |
49 | - if (true === $redir) { |
|
50 | - $s = 'http://' . getenv('HTTP_HOST') . getenv('REQUEST_URI'); |
|
51 | - $s = str_replace('/' . REAL_MODULE_NAME . '/', '/' . SEO_MODULE_NAME . '/', $s); |
|
52 | - $newurl = seo_urls('<a href="' . $s . '"></a>'); |
|
53 | - $newurl = str_replace('<a href="', '', $newurl); |
|
54 | - $newurl = str_replace('"></a>', '', $newurl); |
|
55 | - if (!headers_sent()) { |
|
56 | - header('HTTP/1.1 301 Moved Permanently'); |
|
57 | - header("Location: $newurl"); |
|
58 | - exit(); |
|
59 | - } |
|
60 | - } |
|
61 | - } |
|
49 | + if (true === $redir) { |
|
50 | + $s = 'http://' . getenv('HTTP_HOST') . getenv('REQUEST_URI'); |
|
51 | + $s = str_replace('/' . REAL_MODULE_NAME . '/', '/' . SEO_MODULE_NAME . '/', $s); |
|
52 | + $newurl = seo_urls('<a href="' . $s . '"></a>'); |
|
53 | + $newurl = str_replace('<a href="', '', $newurl); |
|
54 | + $newurl = str_replace('"></a>', '', $newurl); |
|
55 | + if (!headers_sent()) { |
|
56 | + header('HTTP/1.1 301 Moved Permanently'); |
|
57 | + header("Location: $newurl"); |
|
58 | + exit(); |
|
59 | + } |
|
60 | + } |
|
61 | + } |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | require_once $GLOBALS['xoops']->path('modules/' . $moduleDirName . '/include/vars.php'); |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | //} |
82 | 82 | |
83 | 83 | if (is_object($GLOBALS['xoopsUser']) && !empty($GLOBALS['xoopsModuleConfig']['welcome_forum']) |
84 | - && !$GLOBALS['xoopsUser']->getVar('posts')) { |
|
85 | - require_once __DIR__ . '/include/functions.welcome.php'; |
|
84 | + && !$GLOBALS['xoopsUser']->getVar('posts')) { |
|
85 | + require_once __DIR__ . '/include/functions.welcome.php'; |
|
86 | 86 | } |
87 | 87 | // irmtfan for backward compatibility |
88 | 88 | $pollmodules = $GLOBALS['xoopsModuleConfig']['poll_module']; |
@@ -11,8 +11,8 @@ discard block |
||
11 | 11 | |
12 | 12 | use Xmf\Request; |
13 | 13 | |
14 | -require_once dirname(dirname(__DIR__)) . '/mainfile.php'; |
|
15 | -require_once __DIR__ . '/include/common.php'; |
|
14 | +require_once dirname(dirname(__DIR__)).'/mainfile.php'; |
|
15 | +require_once __DIR__.'/include/common.php'; |
|
16 | 16 | |
17 | 17 | // defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
18 | 18 | /** @var \XoopsLogger $xoopsLogger */ |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | //require_once $GLOBALS['xoops']->path('header.php'); |
24 | 24 | |
25 | 25 | if (!empty($GLOBALS['xoopsModuleConfig']['do_rewrite'])) { |
26 | - require_once __DIR__ . '/seo_url.php'; |
|
26 | + require_once __DIR__.'/seo_url.php'; |
|
27 | 27 | /* for seo */ |
28 | 28 | $toseo_url = ['index.php', 'viewforum.php', 'viewtopic.php', 'rss.php']; |
29 | 29 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | //rewrite only for files |
38 | 38 | |
39 | 39 | if ('' !== trim(getenv('SCRIPT_NAME'))) { |
40 | - if (false === strpos(getenv('REQUEST_URI'), '/' . SEO_MODULE_NAME . '/')) { |
|
40 | + if (false === strpos(getenv('REQUEST_URI'), '/'.SEO_MODULE_NAME.'/')) { |
|
41 | 41 | $redir = true; |
42 | 42 | } elseif (getenv('QUERY_STRING')) { |
43 | 43 | $redir = true; |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | if (true === $redir) { |
50 | - $s = 'http://' . getenv('HTTP_HOST') . getenv('REQUEST_URI'); |
|
51 | - $s = str_replace('/' . REAL_MODULE_NAME . '/', '/' . SEO_MODULE_NAME . '/', $s); |
|
52 | - $newurl = seo_urls('<a href="' . $s . '"></a>'); |
|
50 | + $s = 'http://'.getenv('HTTP_HOST').getenv('REQUEST_URI'); |
|
51 | + $s = str_replace('/'.REAL_MODULE_NAME.'/', '/'.SEO_MODULE_NAME.'/', $s); |
|
52 | + $newurl = seo_urls('<a href="'.$s.'"></a>'); |
|
53 | 53 | $newurl = str_replace('<a href="', '', $newurl); |
54 | 54 | $newurl = str_replace('"></a>', '', $newurl); |
55 | 55 | if (!headers_sent()) { |
@@ -61,10 +61,10 @@ discard block |
||
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
64 | -require_once $GLOBALS['xoops']->path('modules/' . $moduleDirName . '/include/vars.php'); |
|
64 | +require_once $GLOBALS['xoops']->path('modules/'.$moduleDirName.'/include/vars.php'); |
|
65 | 65 | |
66 | -require_once __DIR__ . '/include/functions.user.php'; |
|
67 | -require_once __DIR__ . '/include/functions.topic.php'; |
|
66 | +require_once __DIR__.'/include/functions.user.php'; |
|
67 | +require_once __DIR__.'/include/functions.topic.php'; |
|
68 | 68 | |
69 | 69 | require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); |
70 | 70 | require_once $GLOBALS['xoops']->path('class/module.textsanitizer.php'); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $menumode = 0; |
74 | 74 | $menumode_other = []; |
75 | 75 | $menu_url = htmlspecialchars(preg_replace('/&menumode=[^&]/', '', Request::getString('REQUEST_URI', '', 'SERVER')), ENT_QUOTES | ENT_HTML5); |
76 | -$menu_url .= (false === strpos($menu_url, '?')) ? '?menumode=' : '&menumode='; |
|
76 | +$menu_url .= (false === strpos($menu_url, '?')) ? '?menumode=' : '&menumode='; |
|
77 | 77 | //foreach ($GLOBALS['xoopsModuleConfig']['valid_menumodes'] as $key => $val) { |
78 | 78 | // if ($key !== $menumode) { |
79 | 79 | // $menumode_other[] = array('title' => $val, 'link' => $menu_url . $key); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | if (is_object($GLOBALS['xoopsUser']) && !empty($GLOBALS['xoopsModuleConfig']['welcome_forum']) |
84 | 84 | && !$GLOBALS['xoopsUser']->getVar('posts')) { |
85 | - require_once __DIR__ . '/include/functions.welcome.php'; |
|
85 | + require_once __DIR__.'/include/functions.welcome.php'; |
|
86 | 86 | } |
87 | 87 | // irmtfan for backward compatibility |
88 | 88 | $pollmodules = $GLOBALS['xoopsModuleConfig']['poll_module']; |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $postId = Request::getInt('post_id', 0, 'GET'); |
21 | 21 | |
22 | 22 | if (!$postId || !$attachId) { |
23 | - exit(_MD_NEWBB_NO_SUCH_FILE . ': post_id:' . $postId . '; attachid' . $attachId); |
|
23 | + exit(_MD_NEWBB_NO_SUCH_FILE . ': post_id:' . $postId . '; attachid' . $attachId); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | ///** @var Newbb\PostHandler $postHandler */ |
@@ -29,36 +29,36 @@ discard block |
||
29 | 29 | /** @var Newbb\Post $forumpost */ |
30 | 30 | $forumpost = $postHandler->get($postId); |
31 | 31 | if (!$approved = $forumpost->getVar('approved')) { |
32 | - exit(_MD_NEWBB_NORIGHTTOVIEW); |
|
32 | + exit(_MD_NEWBB_NORIGHTTOVIEW); |
|
33 | 33 | } |
34 | 34 | ///** @var TopicHandler $topicHandler */ |
35 | 35 | //$topicHandler = Newbb\Helper::getInstance()->getHandler('Topic'); |
36 | 36 | $topicObject = $topicHandler->getByPost($postId); |
37 | 37 | $topic_id = $topicObject->getVar('topic_id'); |
38 | 38 | if (!$approved = $topicObject->getVar('approved')) { |
39 | - exit(_MD_NEWBB_NORIGHTTOVIEW); |
|
39 | + exit(_MD_NEWBB_NORIGHTTOVIEW); |
|
40 | 40 | } |
41 | 41 | ///** @var NewbbForumHandler $forumHandler */ |
42 | 42 | //$forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
43 | 43 | $forumObject = $forumHandler->get($topicObject->getVar('forum_id')); |
44 | 44 | if (!$forumHandler->getPermission($forumObject)) { |
45 | - exit(_MD_NEWBB_NORIGHTTOACCESS); |
|
45 | + exit(_MD_NEWBB_NORIGHTTOACCESS); |
|
46 | 46 | } |
47 | 47 | if (!$topicHandler->getPermission($forumObject, $topicObject->getVar('topic_status'), 'view')) { |
48 | - exit(_MD_NEWBB_NORIGHTTOVIEW); |
|
48 | + exit(_MD_NEWBB_NORIGHTTOVIEW); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | $attachments = $forumpost->getAttachment(); |
52 | 52 | $attach = $attachments[$attachId]; |
53 | 53 | if (!$attach) { |
54 | - exit(_MD_NEWBB_NO_SUCH_FILE); |
|
54 | + exit(_MD_NEWBB_NO_SUCH_FILE); |
|
55 | 55 | } |
56 | 56 | $file_saved = $GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $attach['name_saved']); |
57 | 57 | if (!file_exists($file_saved)) { |
58 | - exit(_MD_NEWBB_NO_SUCH_FILE); |
|
58 | + exit(_MD_NEWBB_NO_SUCH_FILE); |
|
59 | 59 | } |
60 | 60 | if ($down = $forumpost->incrementDownload($attachId)) { |
61 | - $forumpost->saveAttachment(); |
|
61 | + $forumpost->saveAttachment(); |
|
62 | 62 | } |
63 | 63 | unset($forumpost); |
64 | 64 | $msg = ob_get_contents(); |
@@ -66,41 +66,41 @@ discard block |
||
66 | 66 | |
67 | 67 | $xoopsLogger->activated = false; |
68 | 68 | if (!empty($GLOBALS['xoopsModuleConfig']['download_direct'])) { |
69 | - header('Cache-Control: no-store, no-cache, must-revalidate'); |
|
70 | - header('Cache-Control: post-check=0, pre-check=0', false); |
|
71 | - header('Pragma: no-cache'); |
|
72 | - header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
|
73 | - header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); |
|
74 | - header('location: ' . XOOPS_URL . '/' . $GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $attach['name_saved']); |
|
69 | + header('Cache-Control: no-store, no-cache, must-revalidate'); |
|
70 | + header('Cache-Control: post-check=0, pre-check=0', false); |
|
71 | + header('Pragma: no-cache'); |
|
72 | + header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
|
73 | + header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); |
|
74 | + header('location: ' . XOOPS_URL . '/' . $GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $attach['name_saved']); |
|
75 | 75 | } else { |
76 | - $file_display = $attach['nameDisplay']; |
|
77 | - //$mimetype = $attach['mimetype']; |
|
76 | + $file_display = $attach['nameDisplay']; |
|
77 | + //$mimetype = $attach['mimetype']; |
|
78 | 78 | |
79 | - if (ini_get('zlib.output_compression')) { |
|
80 | - @ini_set('zlib.output_compression', 'Off'); |
|
81 | - } |
|
79 | + if (ini_get('zlib.output_compression')) { |
|
80 | + @ini_set('zlib.output_compression', 'Off'); |
|
81 | + } |
|
82 | 82 | |
83 | - if (function_exists('mb_http_output')) { |
|
84 | - mb_http_output('pass'); |
|
85 | - } |
|
86 | - header('Expires: 0'); |
|
87 | - //header('Content-Type: '.$mimetype); |
|
88 | - header('Content-Type: application/octet-stream'); |
|
89 | - if (preg_match("/MSIE (\d\.\d{1,2})/", Request::getString('HTTP_USER_AGENT', '', 'SERVER'))) { |
|
90 | - header('Content-Disposition: attachment; filename="' . $file_display . '"'); |
|
91 | - header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
|
92 | - header('Pragma: public'); |
|
93 | - } else { |
|
94 | - header('Content-Disposition: attachment; filename="' . $file_display . '"'); |
|
95 | - header('Pragma: no-cache'); |
|
96 | - } |
|
97 | - header('Content-Type: application/force-download'); |
|
98 | - header('Content-Transfer-Encoding: binary'); |
|
83 | + if (function_exists('mb_http_output')) { |
|
84 | + mb_http_output('pass'); |
|
85 | + } |
|
86 | + header('Expires: 0'); |
|
87 | + //header('Content-Type: '.$mimetype); |
|
88 | + header('Content-Type: application/octet-stream'); |
|
89 | + if (preg_match("/MSIE (\d\.\d{1,2})/", Request::getString('HTTP_USER_AGENT', '', 'SERVER'))) { |
|
90 | + header('Content-Disposition: attachment; filename="' . $file_display . '"'); |
|
91 | + header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
|
92 | + header('Pragma: public'); |
|
93 | + } else { |
|
94 | + header('Content-Disposition: attachment; filename="' . $file_display . '"'); |
|
95 | + header('Pragma: no-cache'); |
|
96 | + } |
|
97 | + header('Content-Type: application/force-download'); |
|
98 | + header('Content-Transfer-Encoding: binary'); |
|
99 | 99 | |
100 | - $handle = fopen($file_saved, 'rb'); |
|
101 | - while (!feof($handle)) { |
|
102 | - $buffer = fread($handle, 4096); |
|
103 | - echo $buffer; |
|
104 | - } |
|
105 | - fclose($handle); |
|
100 | + $handle = fopen($file_saved, 'rb'); |
|
101 | + while (!feof($handle)) { |
|
102 | + $buffer = fread($handle, 4096); |
|
103 | + echo $buffer; |
|
104 | + } |
|
105 | + fclose($handle); |
|
106 | 106 | } |
@@ -13,14 +13,14 @@ discard block |
||
13 | 13 | use XoopsModules\Newbb; |
14 | 14 | |
15 | 15 | ob_start(); |
16 | -require_once __DIR__ . '/header.php'; |
|
16 | +require_once __DIR__.'/header.php'; |
|
17 | 17 | require_once $GLOBALS['xoops']->path('header.php'); |
18 | 18 | |
19 | 19 | $attachId = Request::getInt('attachid', 0, 'GET'); |
20 | 20 | $postId = Request::getInt('post_id', 0, 'GET'); |
21 | 21 | |
22 | 22 | if (!$postId || !$attachId) { |
23 | - exit(_MD_NEWBB_NO_SUCH_FILE . ': post_id:' . $postId . '; attachid' . $attachId); |
|
23 | + exit(_MD_NEWBB_NO_SUCH_FILE.': post_id:'.$postId.'; attachid'.$attachId); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | ///** @var Newbb\PostHandler $postHandler */ |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | if (!$attach) { |
54 | 54 | exit(_MD_NEWBB_NO_SUCH_FILE); |
55 | 55 | } |
56 | -$file_saved = $GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $attach['name_saved']); |
|
56 | +$file_saved = $GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'].'/'.$attach['name_saved']); |
|
57 | 57 | if (!file_exists($file_saved)) { |
58 | 58 | exit(_MD_NEWBB_NO_SUCH_FILE); |
59 | 59 | } |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | header('Cache-Control: post-check=0, pre-check=0', false); |
71 | 71 | header('Pragma: no-cache'); |
72 | 72 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
73 | - header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); |
|
74 | - header('location: ' . XOOPS_URL . '/' . $GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $attach['name_saved']); |
|
73 | + header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); |
|
74 | + header('location: '.XOOPS_URL.'/'.$GLOBALS['xoopsModuleConfig']['dir_attachments'].'/'.$attach['name_saved']); |
|
75 | 75 | } else { |
76 | 76 | $file_display = $attach['nameDisplay']; |
77 | 77 | //$mimetype = $attach['mimetype']; |
@@ -87,11 +87,11 @@ discard block |
||
87 | 87 | //header('Content-Type: '.$mimetype); |
88 | 88 | header('Content-Type: application/octet-stream'); |
89 | 89 | if (preg_match("/MSIE (\d\.\d{1,2})/", Request::getString('HTTP_USER_AGENT', '', 'SERVER'))) { |
90 | - header('Content-Disposition: attachment; filename="' . $file_display . '"'); |
|
90 | + header('Content-Disposition: attachment; filename="'.$file_display.'"'); |
|
91 | 91 | header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
92 | 92 | header('Pragma: public'); |
93 | 93 | } else { |
94 | - header('Content-Disposition: attachment; filename="' . $file_display . '"'); |
|
94 | + header('Content-Disposition: attachment; filename="'.$file_display.'"'); |
|
95 | 95 | header('Pragma: no-cache'); |
96 | 96 | } |
97 | 97 | header('Content-Type: application/force-download'); |
@@ -8,5 +8,5 @@ |
||
8 | 8 | * @since 4.00 |
9 | 9 | * @package module::newbb |
10 | 10 | */ |
11 | -require_once __DIR__ . '/header.php'; |
|
11 | +require_once __DIR__.'/header.php'; |
|
12 | 12 | require_once $GLOBALS['xoops']->path('modules/tag/list.tag.php'); |
@@ -15,12 +15,12 @@ discard block |
||
15 | 15 | require_once __DIR__ . '/header.php'; |
16 | 16 | |
17 | 17 | foreach (['forum', 'topic_id', 'post_id', 'order'] as $getint) { |
18 | - ${$getint} = Request::getInt($getint, 0, 'GET'); |
|
18 | + ${$getint} = Request::getInt($getint, 0, 'GET'); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | if (!$topic_id && !$post_id) { |
22 | - $redirect = empty($forum) ? 'index.php' : "viewforum.php?forum={$forum}"; |
|
23 | - redirect_header($redirect, 2, _MD_NEWBB_ERRORTOPIC); |
|
22 | + $redirect = empty($forum) ? 'index.php' : "viewforum.php?forum={$forum}"; |
|
23 | + redirect_header($redirect, 2, _MD_NEWBB_ERRORTOPIC); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | ///** @var Newbb\ForumHandler $forumHandler */ |
@@ -35,13 +35,13 @@ discard block |
||
35 | 35 | $topicObject = $topicHandler->get($postObject->getVar('topic_id')); |
36 | 36 | $forumObject = $forumHandler->get($postObject->getVar('forum_id')); |
37 | 37 | if (!$forumHandler->getPermission($forumObject)) { |
38 | - redirect_header('index.php', 2, _MD_NEWBB_NORIGHTTOACCESS); |
|
38 | + redirect_header('index.php', 2, _MD_NEWBB_NORIGHTTOACCESS); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) { |
42 | - // /** @var Newbb\OnlineHandler $onlineHandler */ |
|
43 | - // $onlineHandler = Newbb\Helper::getInstance()->getHandler('Online'); |
|
44 | - $onlineHandler->init($forumObject); |
|
42 | + // /** @var Newbb\OnlineHandler $onlineHandler */ |
|
43 | + // $onlineHandler = Newbb\Helper::getInstance()->getHandler('Online'); |
|
44 | + $onlineHandler->init($forumObject); |
|
45 | 45 | } |
46 | 46 | $isAdmin = newbbIsAdmin($forumObject); |
47 | 47 | $uid = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0; |
@@ -51,30 +51,30 @@ discard block |
||
51 | 51 | $error_msg = null; |
52 | 52 | |
53 | 53 | if (!$topicHandler->getPermission($forumObject, $topic_status, 'edit') || (!$isAdmin && !$postObject->checkIdentity())) { |
54 | - $error_msg = _MD_NEWBB_NORIGHTTOEDIT; |
|
54 | + $error_msg = _MD_NEWBB_NORIGHTTOEDIT; |
|
55 | 55 | } elseif (!$isAdmin && !$postObject->checkTimelimit('edit_timelimit')) { |
56 | - $error_msg = _MD_NEWBB_TIMEISUP; |
|
56 | + $error_msg = _MD_NEWBB_TIMEISUP; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | if (!empty($error_msg)) { |
60 | - /* |
|
60 | + /* |
|
61 | 61 | * Build the page query |
62 | 62 | */ |
63 | - $query_vars = ['topic_id', 'post_id', 'forum', 'status', 'order', 'mode', 'viewmode']; |
|
64 | - $query_array = []; |
|
65 | - foreach ($query_vars as $var) { |
|
66 | - if (Request::getString($var, '', 'GET')) { |
|
67 | - $query_array[$var] = "{$var}=" . Request::getString($var, '', 'GET'); |
|
68 | - } |
|
69 | - } |
|
70 | - $page_query = htmlspecialchars(implode('&', array_values($query_array)), ENT_QUOTES | ENT_HTML5); |
|
71 | - unset($query_array); |
|
72 | - redirect_header("viewtopic.php?{$page_query}", 2, $error_msg); |
|
63 | + $query_vars = ['topic_id', 'post_id', 'forum', 'status', 'order', 'mode', 'viewmode']; |
|
64 | + $query_array = []; |
|
65 | + foreach ($query_vars as $var) { |
|
66 | + if (Request::getString($var, '', 'GET')) { |
|
67 | + $query_array[$var] = "{$var}=" . Request::getString($var, '', 'GET'); |
|
68 | + } |
|
69 | + } |
|
70 | + $page_query = htmlspecialchars(implode('&', array_values($query_array)), ENT_QUOTES | ENT_HTML5); |
|
71 | + unset($query_array); |
|
72 | + redirect_header("viewtopic.php?{$page_query}", 2, $error_msg); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) { |
76 | - // $onlineHandler = Newbb\Helper::getInstance()->getHandler('Online'); |
|
77 | - $onlineHandler->init($forumObject); |
|
76 | + // $onlineHandler = Newbb\Helper::getInstance()->getHandler('Online'); |
|
77 | + $onlineHandler->init($forumObject); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | $xoopsOption['template_main'] = 'newbb_edit_post.tpl'; |
@@ -125,28 +125,28 @@ discard block |
||
125 | 125 | $posts_context = []; |
126 | 126 | $posts_contextObject = $istopic ? [] : [$postHandler->get($postObject->getVar('pid'))]; |
127 | 127 | foreach ($posts_contextObject as $post_contextObject) { |
128 | - if ($GLOBALS['xoopsModuleConfig']['enable_karma'] && $post_contextObject->getVar('post_karma') > 0) { |
|
129 | - $p_message = sprintf(_MD_NEWBB_KARMA_REQUIREMENT, '***', $post_contextObject->getVar('post_karma')) . '</div>'; |
|
130 | - } elseif ($GLOBALS['xoopsModuleConfig']['allow_require_reply'] && $post_contextObject->getVar('require_reply')) { |
|
131 | - $p_message = _MD_NEWBB_REPLY_REQUIREMENT; |
|
132 | - } else { |
|
133 | - $p_message = $post_contextObject->getVar('post_text'); |
|
134 | - } |
|
135 | - |
|
136 | - if ($post_contextObject->getVar('uid')) { |
|
137 | - $p_name = newbbGetUnameFromId($post_contextObject->getVar('uid'), $GLOBALS['xoopsModuleConfig']['show_realname']); |
|
138 | - } else { |
|
139 | - $poster_name = $post_contextObject->getVar('poster_name'); |
|
140 | - $p_name = empty($poster_name) ? htmlspecialchars($GLOBALS['xoopsConfig']['anonymous'], ENT_QUOTES | ENT_HTML5) : $poster_name; |
|
141 | - } |
|
142 | - $p_date = formatTimestamp($post_contextObject->getVar('post_time')); |
|
143 | - $p_subject = $post_contextObject->getVar('subject'); |
|
144 | - |
|
145 | - $posts_context[] = [ |
|
146 | - 'subject' => $p_subject, |
|
147 | - 'meta' => _MD_NEWBB_BY . ' ' . $p_name . ' ' . _MD_NEWBB_ON . ' ' . $p_date, |
|
148 | - 'content' => $p_message |
|
149 | - ]; |
|
128 | + if ($GLOBALS['xoopsModuleConfig']['enable_karma'] && $post_contextObject->getVar('post_karma') > 0) { |
|
129 | + $p_message = sprintf(_MD_NEWBB_KARMA_REQUIREMENT, '***', $post_contextObject->getVar('post_karma')) . '</div>'; |
|
130 | + } elseif ($GLOBALS['xoopsModuleConfig']['allow_require_reply'] && $post_contextObject->getVar('require_reply')) { |
|
131 | + $p_message = _MD_NEWBB_REPLY_REQUIREMENT; |
|
132 | + } else { |
|
133 | + $p_message = $post_contextObject->getVar('post_text'); |
|
134 | + } |
|
135 | + |
|
136 | + if ($post_contextObject->getVar('uid')) { |
|
137 | + $p_name = newbbGetUnameFromId($post_contextObject->getVar('uid'), $GLOBALS['xoopsModuleConfig']['show_realname']); |
|
138 | + } else { |
|
139 | + $poster_name = $post_contextObject->getVar('poster_name'); |
|
140 | + $p_name = empty($poster_name) ? htmlspecialchars($GLOBALS['xoopsConfig']['anonymous'], ENT_QUOTES | ENT_HTML5) : $poster_name; |
|
141 | + } |
|
142 | + $p_date = formatTimestamp($post_contextObject->getVar('post_time')); |
|
143 | + $p_subject = $post_contextObject->getVar('subject'); |
|
144 | + |
|
145 | + $posts_context[] = [ |
|
146 | + 'subject' => $p_subject, |
|
147 | + 'meta' => _MD_NEWBB_BY . ' ' . $p_name . ' ' . _MD_NEWBB_ON . ' ' . $p_date, |
|
148 | + 'content' => $p_message |
|
149 | + ]; |
|
150 | 150 | } |
151 | 151 | $xoopsTpl->assign_by_ref('posts_context', $posts_context); |
152 | 152 | // irmtfan move to footer.php |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | use Xmf\Request; |
13 | 13 | use XoopsModules\Newbb; |
14 | 14 | |
15 | -require_once __DIR__ . '/header.php'; |
|
15 | +require_once __DIR__.'/header.php'; |
|
16 | 16 | |
17 | 17 | foreach (['forum', 'topic_id', 'post_id', 'order'] as $getint) { |
18 | 18 | ${$getint} = Request::getInt($getint, 0, 'GET'); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $query_array = []; |
65 | 65 | foreach ($query_vars as $var) { |
66 | 66 | if (Request::getString($var, '', 'GET')) { |
67 | - $query_array[$var] = "{$var}=" . Request::getString($var, '', 'GET'); |
|
67 | + $query_array[$var] = "{$var}=".Request::getString($var, '', 'GET'); |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | $page_query = htmlspecialchars(implode('&', array_values($query_array)), ENT_QUOTES | ENT_HTML5); |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | $post_karma = $postObject->getVar('post_karma'); |
116 | 116 | $require_reply = $postObject->getVar('require_reply'); |
117 | 117 | |
118 | -$xoopsTpl->assign('error_message', _MD_NEWBB_EDITEDBY . ' ' . $GLOBALS['xoopsUser']->uname()); |
|
119 | -require_once __DIR__ . '/include/form.post.php'; |
|
118 | +$xoopsTpl->assign('error_message', _MD_NEWBB_EDITEDBY.' '.$GLOBALS['xoopsUser']->uname()); |
|
119 | +require_once __DIR__.'/include/form.post.php'; |
|
120 | 120 | |
121 | 121 | ///** @var Newbb\KarmaHandler $karmaHandler */ |
122 | 122 | //$karmaHandler = Newbb\Helper::getInstance()->getHandler('Karma'); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | $posts_contextObject = $istopic ? [] : [$postHandler->get($postObject->getVar('pid'))]; |
127 | 127 | foreach ($posts_contextObject as $post_contextObject) { |
128 | 128 | if ($GLOBALS['xoopsModuleConfig']['enable_karma'] && $post_contextObject->getVar('post_karma') > 0) { |
129 | - $p_message = sprintf(_MD_NEWBB_KARMA_REQUIREMENT, '***', $post_contextObject->getVar('post_karma')) . '</div>'; |
|
129 | + $p_message = sprintf(_MD_NEWBB_KARMA_REQUIREMENT, '***', $post_contextObject->getVar('post_karma')).'</div>'; |
|
130 | 130 | } elseif ($GLOBALS['xoopsModuleConfig']['allow_require_reply'] && $post_contextObject->getVar('require_reply')) { |
131 | 131 | $p_message = _MD_NEWBB_REPLY_REQUIREMENT; |
132 | 132 | } else { |
@@ -144,11 +144,11 @@ discard block |
||
144 | 144 | |
145 | 145 | $posts_context[] = [ |
146 | 146 | 'subject' => $p_subject, |
147 | - 'meta' => _MD_NEWBB_BY . ' ' . $p_name . ' ' . _MD_NEWBB_ON . ' ' . $p_date, |
|
147 | + 'meta' => _MD_NEWBB_BY.' '.$p_name.' '._MD_NEWBB_ON.' '.$p_date, |
|
148 | 148 | 'content' => $p_message |
149 | 149 | ]; |
150 | 150 | } |
151 | 151 | $xoopsTpl->assign_by_ref('posts_context', $posts_context); |
152 | 152 | // irmtfan move to footer.php |
153 | -require_once __DIR__ . '/footer.php'; |
|
153 | +require_once __DIR__.'/footer.php'; |
|
154 | 154 | require_once $GLOBALS['xoops']->path('footer.php'); |
@@ -16,60 +16,60 @@ discard block |
||
16 | 16 | $seos = ['c', 'f', 't', 'p', 'rc', 'rf', 'v', 'pr', 'pdf']; |
17 | 17 | |
18 | 18 | $seoMap = [ |
19 | - 'c' => 'index.php', |
|
20 | - 'f' => 'viewforum.php', |
|
21 | - 't' => 'viewtopic.php', |
|
22 | - 'p' => 'viewtopic.php', |
|
23 | - 'rc' => 'rss.php', |
|
24 | - 'rf' => 'rss.php', |
|
25 | - 'pr' => 'print.php', |
|
26 | - 'pdf' => 'makepdf.php' |
|
19 | + 'c' => 'index.php', |
|
20 | + 'f' => 'viewforum.php', |
|
21 | + 't' => 'viewtopic.php', |
|
22 | + 'p' => 'viewtopic.php', |
|
23 | + 'rc' => 'rss.php', |
|
24 | + 'rf' => 'rss.php', |
|
25 | + 'pr' => 'print.php', |
|
26 | + 'pdf' => 'makepdf.php' |
|
27 | 27 | ]; |
28 | 28 | |
29 | 29 | if (!empty($seoOp) && !empty($seoMap[$seoOp]) && in_array($seoOp, $seos)) { |
30 | - // module specific dispatching logic, other module must implement as |
|
31 | - // per their requirements. |
|
32 | - $ori_self = Request::getString('PHP_SELF', '', 'SERVER'); |
|
33 | - $ori_self = explode('modules/newbb', $ori_self); |
|
34 | - $newUrl = $ori_self[0] . 'modules/newbb/' . $seoMap[$seoOp]; |
|
35 | - $_ENV['PHP_SELF'] = $newUrl; |
|
36 | - $_SERVER['SCRIPT_NAME'] = $newUrl; |
|
37 | - $_SERVER['PHP_SELF'] = $newUrl; |
|
38 | - switch ($seoOp) { |
|
39 | - case 'c': |
|
40 | - $_SERVER['REQUEST_URI'] = $newUrl . '?cat=' . $seoArg; |
|
41 | - $_GET['cat'] = $seoArg; |
|
42 | - break; |
|
43 | - case 'f': |
|
44 | - $_SERVER['REQUEST_URI'] = $newUrl . '?forum=' . $seoArg; |
|
45 | - $_GET['forum'] = $seoArg; |
|
46 | - break; |
|
47 | - case 'p': |
|
48 | - $_SERVER['REQUEST_URI'] = $newUrl . '?post_id=' . $seoArg; |
|
49 | - $_GET['post_id'] = $seoArg; |
|
50 | - break; |
|
51 | - case 'rc': |
|
52 | - $_SERVER['REQUEST_URI'] = $newUrl . '?c=' . $seoArg; |
|
53 | - $_GET['c'] = $seoArg; |
|
54 | - break; |
|
55 | - case 'rf': |
|
56 | - $_SERVER['REQUEST_URI'] = $newUrl . '?f=' . $seoArg; |
|
57 | - $_GET['f'] = $seoArg; |
|
58 | - break; |
|
59 | - default: |
|
60 | - case 't': |
|
61 | - case 'pr': |
|
62 | - $_SERVER['REQUEST_URI'] = $newUrl . '?topic_id=' . $seoArg; |
|
63 | - $_GET['topic_id'] = $seoArg; |
|
64 | - break; |
|
65 | - } |
|
66 | - require_once $seoMap[$seoOp]; |
|
30 | + // module specific dispatching logic, other module must implement as |
|
31 | + // per their requirements. |
|
32 | + $ori_self = Request::getString('PHP_SELF', '', 'SERVER'); |
|
33 | + $ori_self = explode('modules/newbb', $ori_self); |
|
34 | + $newUrl = $ori_self[0] . 'modules/newbb/' . $seoMap[$seoOp]; |
|
35 | + $_ENV['PHP_SELF'] = $newUrl; |
|
36 | + $_SERVER['SCRIPT_NAME'] = $newUrl; |
|
37 | + $_SERVER['PHP_SELF'] = $newUrl; |
|
38 | + switch ($seoOp) { |
|
39 | + case 'c': |
|
40 | + $_SERVER['REQUEST_URI'] = $newUrl . '?cat=' . $seoArg; |
|
41 | + $_GET['cat'] = $seoArg; |
|
42 | + break; |
|
43 | + case 'f': |
|
44 | + $_SERVER['REQUEST_URI'] = $newUrl . '?forum=' . $seoArg; |
|
45 | + $_GET['forum'] = $seoArg; |
|
46 | + break; |
|
47 | + case 'p': |
|
48 | + $_SERVER['REQUEST_URI'] = $newUrl . '?post_id=' . $seoArg; |
|
49 | + $_GET['post_id'] = $seoArg; |
|
50 | + break; |
|
51 | + case 'rc': |
|
52 | + $_SERVER['REQUEST_URI'] = $newUrl . '?c=' . $seoArg; |
|
53 | + $_GET['c'] = $seoArg; |
|
54 | + break; |
|
55 | + case 'rf': |
|
56 | + $_SERVER['REQUEST_URI'] = $newUrl . '?f=' . $seoArg; |
|
57 | + $_GET['f'] = $seoArg; |
|
58 | + break; |
|
59 | + default: |
|
60 | + case 't': |
|
61 | + case 'pr': |
|
62 | + $_SERVER['REQUEST_URI'] = $newUrl . '?topic_id=' . $seoArg; |
|
63 | + $_GET['topic_id'] = $seoArg; |
|
64 | + break; |
|
65 | + } |
|
66 | + require_once $seoMap[$seoOp]; |
|
67 | 67 | } else { |
68 | - $last = $seoOp . '/' . $seoArg; |
|
69 | - if ('' !== $seoOther) { |
|
70 | - $last .= '/' . $seoOther; |
|
71 | - } |
|
72 | - require_once $last; |
|
68 | + $last = $seoOp . '/' . $seoArg; |
|
69 | + if ('' !== $seoOther) { |
|
70 | + $last .= '/' . $seoOther; |
|
71 | + } |
|
72 | + require_once $last; |
|
73 | 73 | } |
74 | 74 | exit(); |
75 | 75 | |
@@ -79,45 +79,45 @@ discard block |
||
79 | 79 | */ |
80 | 80 | function checker(&$value) |
81 | 81 | { |
82 | - // keine Tags erlaubt |
|
83 | - $value = strip_tags($value); |
|
82 | + // keine Tags erlaubt |
|
83 | + $value = strip_tags($value); |
|
84 | 84 | |
85 | - // HTML-Tags maskieren |
|
86 | - $value = htmlspecialchars($value, ENT_QUOTES); |
|
85 | + // HTML-Tags maskieren |
|
86 | + $value = htmlspecialchars($value, ENT_QUOTES); |
|
87 | 87 | |
88 | - // Leerzeichen am Anfang und Ende beseitigen |
|
89 | - $value = trim($value); |
|
88 | + // Leerzeichen am Anfang und Ende beseitigen |
|
89 | + $value = trim($value); |
|
90 | 90 | |
91 | - // pruefe auf javascript include |
|
92 | - if (false !== strpos($value, '<script')) { |
|
93 | - $value = ''; |
|
94 | - } |
|
91 | + // pruefe auf javascript include |
|
92 | + if (false !== strpos($value, '<script')) { |
|
93 | + $value = ''; |
|
94 | + } |
|
95 | 95 | |
96 | - // pruefe auf Kommentare (SQL-Injections) |
|
97 | - if (false !== strpos($value, '/*')) { |
|
98 | - $value = ''; |
|
99 | - } |
|
96 | + // pruefe auf Kommentare (SQL-Injections) |
|
97 | + if (false !== strpos($value, '/*')) { |
|
98 | + $value = ''; |
|
99 | + } |
|
100 | 100 | |
101 | - // pruefe UNION Injections |
|
102 | - if (preg_match('/\sUNION\s+(ALL|SELECT)/i', $value)) { |
|
103 | - $value = ''; |
|
104 | - } |
|
101 | + // pruefe UNION Injections |
|
102 | + if (preg_match('/\sUNION\s+(ALL|SELECT)/i', $value)) { |
|
103 | + $value = ''; |
|
104 | + } |
|
105 | 105 | |
106 | - // Nullbyte Injection |
|
107 | - if (false !== strpos($value, chr(0))) { |
|
108 | - $value = ''; |
|
109 | - } |
|
106 | + // Nullbyte Injection |
|
107 | + if (false !== strpos($value, chr(0))) { |
|
108 | + $value = ''; |
|
109 | + } |
|
110 | 110 | |
111 | - //pruefe Verzeichnis |
|
112 | - if (false !== strpos($value, '../')) { |
|
113 | - $value = ''; |
|
114 | - } |
|
111 | + //pruefe Verzeichnis |
|
112 | + if (false !== strpos($value, '../')) { |
|
113 | + $value = ''; |
|
114 | + } |
|
115 | 115 | |
116 | - //pruefe auf externe |
|
117 | - $str = strstr($value, '://'); |
|
118 | - if (false !== strpos($value, '://')) { |
|
119 | - $value = ''; |
|
120 | - } |
|
116 | + //pruefe auf externe |
|
117 | + $str = strstr($value, '://'); |
|
118 | + if (false !== strpos($value, '://')) { |
|
119 | + $value = ''; |
|
120 | + } |
|
121 | 121 | |
122 | - return $value; |
|
122 | + return $value; |
|
123 | 123 | } |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | use Xmf\Request; |
4 | 4 | |
5 | -require_once __DIR__ . '/header.php'; |
|
5 | +require_once __DIR__.'/header.php'; |
|
6 | 6 | /* |
7 | 7 | * |
8 | 8 | * Module: newbbss |
@@ -31,43 +31,43 @@ discard block |
||
31 | 31 | // per their requirements. |
32 | 32 | $ori_self = Request::getString('PHP_SELF', '', 'SERVER'); |
33 | 33 | $ori_self = explode('modules/newbb', $ori_self); |
34 | - $newUrl = $ori_self[0] . 'modules/newbb/' . $seoMap[$seoOp]; |
|
34 | + $newUrl = $ori_self[0].'modules/newbb/'.$seoMap[$seoOp]; |
|
35 | 35 | $_ENV['PHP_SELF'] = $newUrl; |
36 | 36 | $_SERVER['SCRIPT_NAME'] = $newUrl; |
37 | 37 | $_SERVER['PHP_SELF'] = $newUrl; |
38 | 38 | switch ($seoOp) { |
39 | 39 | case 'c': |
40 | - $_SERVER['REQUEST_URI'] = $newUrl . '?cat=' . $seoArg; |
|
40 | + $_SERVER['REQUEST_URI'] = $newUrl.'?cat='.$seoArg; |
|
41 | 41 | $_GET['cat'] = $seoArg; |
42 | 42 | break; |
43 | 43 | case 'f': |
44 | - $_SERVER['REQUEST_URI'] = $newUrl . '?forum=' . $seoArg; |
|
44 | + $_SERVER['REQUEST_URI'] = $newUrl.'?forum='.$seoArg; |
|
45 | 45 | $_GET['forum'] = $seoArg; |
46 | 46 | break; |
47 | 47 | case 'p': |
48 | - $_SERVER['REQUEST_URI'] = $newUrl . '?post_id=' . $seoArg; |
|
48 | + $_SERVER['REQUEST_URI'] = $newUrl.'?post_id='.$seoArg; |
|
49 | 49 | $_GET['post_id'] = $seoArg; |
50 | 50 | break; |
51 | 51 | case 'rc': |
52 | - $_SERVER['REQUEST_URI'] = $newUrl . '?c=' . $seoArg; |
|
52 | + $_SERVER['REQUEST_URI'] = $newUrl.'?c='.$seoArg; |
|
53 | 53 | $_GET['c'] = $seoArg; |
54 | 54 | break; |
55 | 55 | case 'rf': |
56 | - $_SERVER['REQUEST_URI'] = $newUrl . '?f=' . $seoArg; |
|
56 | + $_SERVER['REQUEST_URI'] = $newUrl.'?f='.$seoArg; |
|
57 | 57 | $_GET['f'] = $seoArg; |
58 | 58 | break; |
59 | 59 | default: |
60 | 60 | case 't': |
61 | 61 | case 'pr': |
62 | - $_SERVER['REQUEST_URI'] = $newUrl . '?topic_id=' . $seoArg; |
|
62 | + $_SERVER['REQUEST_URI'] = $newUrl.'?topic_id='.$seoArg; |
|
63 | 63 | $_GET['topic_id'] = $seoArg; |
64 | 64 | break; |
65 | 65 | } |
66 | 66 | require_once $seoMap[$seoOp]; |
67 | 67 | } else { |
68 | - $last = $seoOp . '/' . $seoArg; |
|
68 | + $last = $seoOp.'/'.$seoArg; |
|
69 | 69 | if ('' !== $seoOther) { |
70 | - $last .= '/' . $seoOther; |
|
70 | + $last .= '/'.$seoOther; |
|
71 | 71 | } |
72 | 72 | require_once $last; |
73 | 73 | } |
@@ -4,29 +4,29 @@ |
||
4 | 4 | * @see http://www.php-fig.org/psr/psr-4/examples/ |
5 | 5 | */ |
6 | 6 | spl_autoload_register(function ($class) { |
7 | - // project-specific namespace prefix |
|
8 | - $prefix = 'XoopsModules\\' . ucfirst(basename(dirname(__DIR__))); |
|
7 | + // project-specific namespace prefix |
|
8 | + $prefix = 'XoopsModules\\' . ucfirst(basename(dirname(__DIR__))); |
|
9 | 9 | |
10 | - // base directory for the namespace prefix |
|
11 | - $base_dir = dirname(__DIR__) . '/class/'; |
|
10 | + // base directory for the namespace prefix |
|
11 | + $base_dir = dirname(__DIR__) . '/class/'; |
|
12 | 12 | |
13 | - // does the class use the namespace prefix? |
|
14 | - $len = strlen($prefix); |
|
13 | + // does the class use the namespace prefix? |
|
14 | + $len = strlen($prefix); |
|
15 | 15 | |
16 | - if (0 !== strncmp($prefix, $class, $len)) { |
|
17 | - return; |
|
18 | - } |
|
16 | + if (0 !== strncmp($prefix, $class, $len)) { |
|
17 | + return; |
|
18 | + } |
|
19 | 19 | |
20 | - // get the relative class name |
|
21 | - $relativeClass = substr($class, $len); |
|
20 | + // get the relative class name |
|
21 | + $relativeClass = substr($class, $len); |
|
22 | 22 | |
23 | - // replace the namespace prefix with the base directory, replace namespace |
|
24 | - // separators with directory separators in the relative class name, append |
|
25 | - // with .php |
|
26 | - $file = $base_dir . str_replace('\\', '/', $relativeClass) . '.php'; |
|
23 | + // replace the namespace prefix with the base directory, replace namespace |
|
24 | + // separators with directory separators in the relative class name, append |
|
25 | + // with .php |
|
26 | + $file = $base_dir . str_replace('\\', '/', $relativeClass) . '.php'; |
|
27 | 27 | |
28 | - // if the file exists, require it |
|
29 | - if (file_exists($file)) { |
|
30 | - require_once $file; |
|
31 | - } |
|
28 | + // if the file exists, require it |
|
29 | + if (file_exists($file)) { |
|
30 | + require_once $file; |
|
31 | + } |
|
32 | 32 | }); |
@@ -3,12 +3,12 @@ discard block |
||
3 | 3 | /** |
4 | 4 | * @see http://www.php-fig.org/psr/psr-4/examples/ |
5 | 5 | */ |
6 | -spl_autoload_register(function ($class) { |
|
6 | +spl_autoload_register(function($class) { |
|
7 | 7 | // project-specific namespace prefix |
8 | - $prefix = 'XoopsModules\\' . ucfirst(basename(dirname(__DIR__))); |
|
8 | + $prefix = 'XoopsModules\\'.ucfirst(basename(dirname(__DIR__))); |
|
9 | 9 | |
10 | 10 | // base directory for the namespace prefix |
11 | - $base_dir = dirname(__DIR__) . '/class/'; |
|
11 | + $base_dir = dirname(__DIR__).'/class/'; |
|
12 | 12 | |
13 | 13 | // does the class use the namespace prefix? |
14 | 14 | $len = strlen($prefix); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | // replace the namespace prefix with the base directory, replace namespace |
24 | 24 | // separators with directory separators in the relative class name, append |
25 | 25 | // with .php |
26 | - $file = $base_dir . str_replace('\\', '/', $relativeClass) . '.php'; |
|
26 | + $file = $base_dir.str_replace('\\', '/', $relativeClass).'.php'; |
|
27 | 27 | |
28 | 28 | // if the file exists, require it |
29 | 29 | if (file_exists($file)) { |
@@ -22,12 +22,12 @@ |
||
22 | 22 | */ |
23 | 23 | class NewbbCorePreload extends \XoopsPreloadItem |
24 | 24 | { |
25 | - // to add PSR-4 autoloader |
|
26 | - /** |
|
27 | - * @param $args |
|
28 | - */ |
|
29 | - public static function eventCoreIncludeCommonEnd($args) |
|
30 | - { |
|
31 | - require_once __DIR__ . '/autoloader.php'; |
|
32 | - } |
|
25 | + // to add PSR-4 autoloader |
|
26 | + /** |
|
27 | + * @param $args |
|
28 | + */ |
|
29 | + public static function eventCoreIncludeCommonEnd($args) |
|
30 | + { |
|
31 | + require_once __DIR__ . '/autoloader.php'; |
|
32 | + } |
|
33 | 33 | } |
@@ -28,6 +28,6 @@ |
||
28 | 28 | */ |
29 | 29 | public static function eventCoreIncludeCommonEnd($args) |
30 | 30 | { |
31 | - require_once __DIR__ . '/autoloader.php'; |
|
31 | + require_once __DIR__.'/autoloader.php'; |
|
32 | 32 | } |
33 | 33 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.rpc.php'); |
37 | 37 | |
38 | 38 | if (!empty($GLOBALS['xoopsModuleConfig']['do_rewrite'])) { |
39 | - require_once __DIR__ . '/seo_url.php'; |
|
39 | + require_once __DIR__ . '/seo_url.php'; |
|
40 | 40 | } |
41 | 41 | /* for seo */ |
42 | 42 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $category = Request::getInt('c', 0, 'GET'); |
48 | 48 | $forumSet = Request::getString('f', '', 'GET'); |
49 | 49 | if ('' !== $forumSet) { |
50 | - $forums = array_map('intval', array_map('trim', explode('|', $forumSet))); |
|
50 | + $forums = array_map('intval', array_map('trim', explode('|', $forumSet))); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | ///** @var Newbb\ForumHandler $forumHandler */ |
@@ -56,15 +56,15 @@ discard block |
||
56 | 56 | $validForums = $forumHandler->getIdsByPermission(); // get all accessible forums |
57 | 57 | |
58 | 58 | if (is_array($forums) && count($forums) > 0) { |
59 | - $validForums = array_intersect($forums, $validForums); |
|
59 | + $validForums = array_intersect($forums, $validForums); |
|
60 | 60 | } elseif ($category > 0) { |
61 | - $crit_top = new \CriteriaCompo(new \Criteria('cat_id', $category)); |
|
62 | - $crit_top->add(new \Criteria('forum_id', '(' . implode(', ', $validForums) . ')', 'IN')); |
|
63 | - $forums_top = $forumHandler->getIds($crit_top); |
|
64 | - $validForums = array_intersect($forums_top, $validForums); |
|
61 | + $crit_top = new \CriteriaCompo(new \Criteria('cat_id', $category)); |
|
62 | + $crit_top->add(new \Criteria('forum_id', '(' . implode(', ', $validForums) . ')', 'IN')); |
|
63 | + $forums_top = $forumHandler->getIds($crit_top); |
|
64 | + $validForums = array_intersect($forums_top, $validForums); |
|
65 | 65 | } |
66 | 66 | if (0 === count($validForums)) { |
67 | - newbbTrackbackResponse(1, _NOPERM); |
|
67 | + newbbTrackbackResponse(1, _NOPERM); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | asort($validForums); |
@@ -77,137 +77,137 @@ discard block |
||
77 | 77 | $tpl->caching = 2; |
78 | 78 | $tpl->cache_lifetime = $GLOBALS['xoopsModuleConfig']['rss_cachetime'] * 60; |
79 | 79 | if (!empty($GLOBALS['xoopsConfig']['rewrite'])) { |
80 | - $tpl->load_filter('output', 'xoRewriteModule'); |
|
80 | + $tpl->load_filter('output', 'xoRewriteModule'); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | //mod_loadFunctions('cache'); |
84 | 84 | $xoopsCachedTemplateId = "newbbb_rss_$forumSet"; |
85 | 85 | $compile_id = null; |
86 | 86 | if (!$tpl->is_cached('db:newbb_rss.tpl', $xoopsCachedTemplateId, $compile_id)) { |
87 | - require_once __DIR__ . '/include/functions.time.php'; |
|
88 | - |
|
89 | - // /** @var Newbb\XmlrssHandler $xmlrssHandler */ |
|
90 | - // $xmlrssHandler = Newbb\Helper::getInstance()->getHandler('Xmlrss'); |
|
91 | - $rss = $xmlrssHandler->create(); |
|
92 | - |
|
93 | - $rss->setVarRss('channel_title', $GLOBALS['xoopsConfig']['sitename'] . ' :: ' . _MD_NEWBB_FORUM); |
|
94 | - $rss->channel_link = XOOPS_URL . '/'; |
|
95 | - $rss->setVarRss('channel_desc', $GLOBALS['xoopsConfig']['slogan'] . ' :: ' . $xoopsModule->getInfo('description')); |
|
96 | - $rss->setVarRss('channel_lastbuild', formatTimestamp(time(), 'rss')); |
|
97 | - $rss->channel_webmaster = $GLOBALS['xoopsConfig']['adminmail']; |
|
98 | - $rss->channel_editor = $GLOBALS['xoopsConfig']['adminmail']; |
|
99 | - $rss->setVarRss('channel_category', $xoopsModule->getVar('name')); |
|
100 | - $rss->channel_generator = 'NewBB ' . $xoopsModule->getInfo('version'); |
|
101 | - $rss->channel_language = _LANGCODE; |
|
102 | - $rss->xml_encoding = $charset; |
|
103 | - $rss->image_url = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/' . $xoopsModule->getInfo('image'); |
|
104 | - |
|
105 | - $dimension = @getimagesize($GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/' . $xoopsModule->getInfo('image'))); |
|
106 | - if (empty($dimension[0])) { |
|
107 | - $width = 88; |
|
108 | - } else { |
|
109 | - $width = ($dimension[0] > 144) ? 144 : $dimension[0]; |
|
110 | - } |
|
111 | - if (empty($dimension[1])) { |
|
112 | - $height = 31; |
|
113 | - } else { |
|
114 | - $height = ($dimension[1] > 400) ? 400 : $dimension[1]; |
|
115 | - } |
|
116 | - $rss->image_width = $width; |
|
117 | - $rss->image_height = $height; |
|
118 | - |
|
119 | - $rss->max_items = $GLOBALS['xoopsModuleConfig']['rss_maxitems']; |
|
120 | - $rss->max_item_description = $GLOBALS['xoopsModuleConfig']['rss_maxdescription']; |
|
121 | - |
|
122 | - $forumCriteria = ' AND t.forum_id IN (' . implode(',', $validForums) . ')'; |
|
123 | - unset($validForums); |
|
124 | - $approveCriteria = ' AND t.approved = 1 AND p.approved = 1'; |
|
125 | - |
|
126 | - $query = 'SELECT' |
|
127 | - . ' f.forum_id, f.forum_name,' |
|
128 | - . ' t.topic_id, t.topic_title, t.type_id,' |
|
129 | - . ' p.post_id, p.post_time, p.subject, p.uid, p.poster_name, p.post_karma, p.require_reply, ' |
|
130 | - . ' pt.dohtml, pt.dosmiley, pt.doxcode, pt.dobr,' |
|
131 | - . ' pt.post_text' |
|
132 | - . ' FROM ' |
|
133 | - . $GLOBALS['xoopsDB']->prefix('newbb_posts') |
|
134 | - . ' AS p' |
|
135 | - . ' LEFT JOIN ' |
|
136 | - . $GLOBALS['xoopsDB']->prefix('newbb_topics') |
|
137 | - . ' AS t ON t.topic_last_post_id=p.post_id' |
|
138 | - . ' LEFT JOIN ' |
|
139 | - . $GLOBALS['xoopsDB']->prefix('newbb_posts_text') |
|
140 | - . ' AS pt ON pt.post_id=p.post_id' |
|
141 | - . ' LEFT JOIN ' |
|
142 | - . $GLOBALS['xoopsDB']->prefix('newbb_forums') |
|
143 | - . ' AS f ON f.forum_id=p.forum_id' |
|
144 | - . ' WHERE 1=1 ' |
|
145 | - . $forumCriteria |
|
146 | - . $approveCriteria |
|
147 | - . ' ORDER BY p.post_id DESC'; |
|
148 | - $limit = (int)($GLOBALS['xoopsModuleConfig']['rss_maxitems'] * 1.5); |
|
149 | - if (!$result = $GLOBALS['xoopsDB']->query($query, $limit)) { |
|
150 | - newbbTrackbackResponse(1, _MD_NEWBB_ERROR); |
|
151 | - //xoops_error($GLOBALS['xoopsDB']->error()); |
|
152 | - //return $xmlrssHandler->get($rss); |
|
153 | - } |
|
154 | - $rows = []; |
|
155 | - $types = []; |
|
156 | - while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { |
|
157 | - $users[$row['uid']] = 1; |
|
158 | - if ($row['type_id'] > 0) { |
|
159 | - $types[$row['type_id']] = 1; |
|
160 | - } |
|
161 | - $rows[] = $row; |
|
162 | - } |
|
163 | - |
|
164 | - if (count($rows) < 1) { |
|
165 | - newbbTrackbackResponse(1, _MD_NEWBB_NORSS_DATA); |
|
166 | - //return $xmlrssHandler->get($rss); |
|
167 | - } |
|
168 | - $users = newbbGetUnameFromIds(array_keys($users), $GLOBALS['xoopsModuleConfig']['show_realname']); |
|
169 | - if (count($types) > 0) { |
|
170 | - // /** @var Newbb\TypeHandler $typeHandler */ |
|
171 | - // $typeHandler = Newbb\Helper::getInstance()->getHandler('Type'); |
|
172 | - $type_list = $typeHandler->getList(new \Criteria('type_id', '(' . implode(', ', array_keys($types)) . ')', 'IN')); |
|
173 | - } |
|
174 | - |
|
175 | - foreach ($rows as $topic) { |
|
176 | - if ($topic['post_karma'] > 0 && $GLOBALS['xoopsModuleConfig']['enable_karma']) { |
|
177 | - continue; |
|
178 | - } |
|
179 | - if ($topic['require_reply'] && $GLOBALS['xoopsModuleConfig']['allow_require_reply']) { |
|
180 | - continue; |
|
181 | - } |
|
182 | - if (!empty($users[$topic['uid']])) { |
|
183 | - $topic['uname'] = $users[$topic['uid']]; |
|
184 | - } else { |
|
185 | - $topic['uname'] = $topic['poster_name'] ? $myts->htmlSpecialChars($topic['poster_name']) : $myts->htmlSpecialChars($GLOBALS['xoopsConfig']['anonymous']); |
|
186 | - } |
|
187 | - $description = $topic['forum_name'] . '::'; |
|
188 | - $topic['topic_subject'] = empty($type_list[$topic['type_id']]) ? '' : '[' . $type_list[$topic['type_id']] . '] '; |
|
189 | - $description .= $topic['topic_subject'] . $topic['topic_title'] . "<br>\n"; |
|
190 | - $description .= $myts->displayTarea($topic['post_text'], $topic['dohtml'], $topic['dosmiley'], $topic['doxcode'], $topic['dobr']); |
|
191 | - $label = _MD_NEWBB_BY . ' ' . $topic['uname']; |
|
192 | - $time = formatTimestamp($topic['post_time'], 'rss'); |
|
193 | - $link = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewtopic.php?post_id=' . $topic['post_id'] . ''; |
|
194 | - if (!empty($GLOBALS['xoopsModuleConfig']['do_rewrite'])) { |
|
195 | - $link = XOOPS_URL . '/' . REAL_MODULE_NAME . '/viewtopic.php?post_id=' . $topic['post_id'] . ''; |
|
196 | - $oldurl = '<a href=\'' . $link . '\'>'; |
|
197 | - $newurl = seo_urls($oldurl); |
|
198 | - $newurl = str_replace('<a href=\'', '', $newurl); |
|
199 | - $newurl = str_replace('\'>', '', $newurl); |
|
200 | - $link = $newurl; |
|
201 | - } |
|
202 | - $title = $topic['subject']; |
|
203 | - if (!$rss->addItem($title, $link, $description, $label, $time)) { |
|
204 | - break; |
|
205 | - } |
|
206 | - } |
|
207 | - |
|
208 | - $rss_feed = $xmlrssHandler->get($rss); |
|
209 | - |
|
210 | - $tpl->assign('rss', $rss_feed); |
|
211 | - unset($rss); |
|
87 | + require_once __DIR__ . '/include/functions.time.php'; |
|
88 | + |
|
89 | + // /** @var Newbb\XmlrssHandler $xmlrssHandler */ |
|
90 | + // $xmlrssHandler = Newbb\Helper::getInstance()->getHandler('Xmlrss'); |
|
91 | + $rss = $xmlrssHandler->create(); |
|
92 | + |
|
93 | + $rss->setVarRss('channel_title', $GLOBALS['xoopsConfig']['sitename'] . ' :: ' . _MD_NEWBB_FORUM); |
|
94 | + $rss->channel_link = XOOPS_URL . '/'; |
|
95 | + $rss->setVarRss('channel_desc', $GLOBALS['xoopsConfig']['slogan'] . ' :: ' . $xoopsModule->getInfo('description')); |
|
96 | + $rss->setVarRss('channel_lastbuild', formatTimestamp(time(), 'rss')); |
|
97 | + $rss->channel_webmaster = $GLOBALS['xoopsConfig']['adminmail']; |
|
98 | + $rss->channel_editor = $GLOBALS['xoopsConfig']['adminmail']; |
|
99 | + $rss->setVarRss('channel_category', $xoopsModule->getVar('name')); |
|
100 | + $rss->channel_generator = 'NewBB ' . $xoopsModule->getInfo('version'); |
|
101 | + $rss->channel_language = _LANGCODE; |
|
102 | + $rss->xml_encoding = $charset; |
|
103 | + $rss->image_url = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/' . $xoopsModule->getInfo('image'); |
|
104 | + |
|
105 | + $dimension = @getimagesize($GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/' . $xoopsModule->getInfo('image'))); |
|
106 | + if (empty($dimension[0])) { |
|
107 | + $width = 88; |
|
108 | + } else { |
|
109 | + $width = ($dimension[0] > 144) ? 144 : $dimension[0]; |
|
110 | + } |
|
111 | + if (empty($dimension[1])) { |
|
112 | + $height = 31; |
|
113 | + } else { |
|
114 | + $height = ($dimension[1] > 400) ? 400 : $dimension[1]; |
|
115 | + } |
|
116 | + $rss->image_width = $width; |
|
117 | + $rss->image_height = $height; |
|
118 | + |
|
119 | + $rss->max_items = $GLOBALS['xoopsModuleConfig']['rss_maxitems']; |
|
120 | + $rss->max_item_description = $GLOBALS['xoopsModuleConfig']['rss_maxdescription']; |
|
121 | + |
|
122 | + $forumCriteria = ' AND t.forum_id IN (' . implode(',', $validForums) . ')'; |
|
123 | + unset($validForums); |
|
124 | + $approveCriteria = ' AND t.approved = 1 AND p.approved = 1'; |
|
125 | + |
|
126 | + $query = 'SELECT' |
|
127 | + . ' f.forum_id, f.forum_name,' |
|
128 | + . ' t.topic_id, t.topic_title, t.type_id,' |
|
129 | + . ' p.post_id, p.post_time, p.subject, p.uid, p.poster_name, p.post_karma, p.require_reply, ' |
|
130 | + . ' pt.dohtml, pt.dosmiley, pt.doxcode, pt.dobr,' |
|
131 | + . ' pt.post_text' |
|
132 | + . ' FROM ' |
|
133 | + . $GLOBALS['xoopsDB']->prefix('newbb_posts') |
|
134 | + . ' AS p' |
|
135 | + . ' LEFT JOIN ' |
|
136 | + . $GLOBALS['xoopsDB']->prefix('newbb_topics') |
|
137 | + . ' AS t ON t.topic_last_post_id=p.post_id' |
|
138 | + . ' LEFT JOIN ' |
|
139 | + . $GLOBALS['xoopsDB']->prefix('newbb_posts_text') |
|
140 | + . ' AS pt ON pt.post_id=p.post_id' |
|
141 | + . ' LEFT JOIN ' |
|
142 | + . $GLOBALS['xoopsDB']->prefix('newbb_forums') |
|
143 | + . ' AS f ON f.forum_id=p.forum_id' |
|
144 | + . ' WHERE 1=1 ' |
|
145 | + . $forumCriteria |
|
146 | + . $approveCriteria |
|
147 | + . ' ORDER BY p.post_id DESC'; |
|
148 | + $limit = (int)($GLOBALS['xoopsModuleConfig']['rss_maxitems'] * 1.5); |
|
149 | + if (!$result = $GLOBALS['xoopsDB']->query($query, $limit)) { |
|
150 | + newbbTrackbackResponse(1, _MD_NEWBB_ERROR); |
|
151 | + //xoops_error($GLOBALS['xoopsDB']->error()); |
|
152 | + //return $xmlrssHandler->get($rss); |
|
153 | + } |
|
154 | + $rows = []; |
|
155 | + $types = []; |
|
156 | + while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { |
|
157 | + $users[$row['uid']] = 1; |
|
158 | + if ($row['type_id'] > 0) { |
|
159 | + $types[$row['type_id']] = 1; |
|
160 | + } |
|
161 | + $rows[] = $row; |
|
162 | + } |
|
163 | + |
|
164 | + if (count($rows) < 1) { |
|
165 | + newbbTrackbackResponse(1, _MD_NEWBB_NORSS_DATA); |
|
166 | + //return $xmlrssHandler->get($rss); |
|
167 | + } |
|
168 | + $users = newbbGetUnameFromIds(array_keys($users), $GLOBALS['xoopsModuleConfig']['show_realname']); |
|
169 | + if (count($types) > 0) { |
|
170 | + // /** @var Newbb\TypeHandler $typeHandler */ |
|
171 | + // $typeHandler = Newbb\Helper::getInstance()->getHandler('Type'); |
|
172 | + $type_list = $typeHandler->getList(new \Criteria('type_id', '(' . implode(', ', array_keys($types)) . ')', 'IN')); |
|
173 | + } |
|
174 | + |
|
175 | + foreach ($rows as $topic) { |
|
176 | + if ($topic['post_karma'] > 0 && $GLOBALS['xoopsModuleConfig']['enable_karma']) { |
|
177 | + continue; |
|
178 | + } |
|
179 | + if ($topic['require_reply'] && $GLOBALS['xoopsModuleConfig']['allow_require_reply']) { |
|
180 | + continue; |
|
181 | + } |
|
182 | + if (!empty($users[$topic['uid']])) { |
|
183 | + $topic['uname'] = $users[$topic['uid']]; |
|
184 | + } else { |
|
185 | + $topic['uname'] = $topic['poster_name'] ? $myts->htmlSpecialChars($topic['poster_name']) : $myts->htmlSpecialChars($GLOBALS['xoopsConfig']['anonymous']); |
|
186 | + } |
|
187 | + $description = $topic['forum_name'] . '::'; |
|
188 | + $topic['topic_subject'] = empty($type_list[$topic['type_id']]) ? '' : '[' . $type_list[$topic['type_id']] . '] '; |
|
189 | + $description .= $topic['topic_subject'] . $topic['topic_title'] . "<br>\n"; |
|
190 | + $description .= $myts->displayTarea($topic['post_text'], $topic['dohtml'], $topic['dosmiley'], $topic['doxcode'], $topic['dobr']); |
|
191 | + $label = _MD_NEWBB_BY . ' ' . $topic['uname']; |
|
192 | + $time = formatTimestamp($topic['post_time'], 'rss'); |
|
193 | + $link = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewtopic.php?post_id=' . $topic['post_id'] . ''; |
|
194 | + if (!empty($GLOBALS['xoopsModuleConfig']['do_rewrite'])) { |
|
195 | + $link = XOOPS_URL . '/' . REAL_MODULE_NAME . '/viewtopic.php?post_id=' . $topic['post_id'] . ''; |
|
196 | + $oldurl = '<a href=\'' . $link . '\'>'; |
|
197 | + $newurl = seo_urls($oldurl); |
|
198 | + $newurl = str_replace('<a href=\'', '', $newurl); |
|
199 | + $newurl = str_replace('\'>', '', $newurl); |
|
200 | + $link = $newurl; |
|
201 | + } |
|
202 | + $title = $topic['subject']; |
|
203 | + if (!$rss->addItem($title, $link, $description, $label, $time)) { |
|
204 | + break; |
|
205 | + } |
|
206 | + } |
|
207 | + |
|
208 | + $rss_feed = $xmlrssHandler->get($rss); |
|
209 | + |
|
210 | + $tpl->assign('rss', $rss_feed); |
|
211 | + unset($rss); |
|
212 | 212 | } |
213 | 213 | $tpl->display('db:newbb_rss.tpl', $xoopsCachedTemplateId, $compile_id); |
@@ -31,12 +31,12 @@ discard block |
||
31 | 31 | |
32 | 32 | use Xmf\Request; |
33 | 33 | |
34 | -require_once __DIR__ . '/header.php'; |
|
34 | +require_once __DIR__.'/header.php'; |
|
35 | 35 | require_once $GLOBALS['xoops']->path('class/template.php'); |
36 | 36 | require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.rpc.php'); |
37 | 37 | |
38 | 38 | if (!empty($GLOBALS['xoopsModuleConfig']['do_rewrite'])) { |
39 | - require_once __DIR__ . '/seo_url.php'; |
|
39 | + require_once __DIR__.'/seo_url.php'; |
|
40 | 40 | } |
41 | 41 | /* for seo */ |
42 | 42 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $validForums = array_intersect($forums, $validForums); |
60 | 60 | } elseif ($category > 0) { |
61 | 61 | $crit_top = new \CriteriaCompo(new \Criteria('cat_id', $category)); |
62 | - $crit_top->add(new \Criteria('forum_id', '(' . implode(', ', $validForums) . ')', 'IN')); |
|
62 | + $crit_top->add(new \Criteria('forum_id', '('.implode(', ', $validForums).')', 'IN')); |
|
63 | 63 | $forums_top = $forumHandler->getIds($crit_top); |
64 | 64 | $validForums = array_intersect($forums_top, $validForums); |
65 | 65 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $forumSet = implode(',', $validForums); |
72 | 72 | |
73 | 73 | $charset = 'UTF-8'; |
74 | -header('Content-Type:text/xml; charset=' . $charset); |
|
74 | +header('Content-Type:text/xml; charset='.$charset); |
|
75 | 75 | |
76 | 76 | $tpl = new \XoopsTpl(); |
77 | 77 | $tpl->caching = 2; |
@@ -84,25 +84,25 @@ discard block |
||
84 | 84 | $xoopsCachedTemplateId = "newbbb_rss_$forumSet"; |
85 | 85 | $compile_id = null; |
86 | 86 | if (!$tpl->is_cached('db:newbb_rss.tpl', $xoopsCachedTemplateId, $compile_id)) { |
87 | - require_once __DIR__ . '/include/functions.time.php'; |
|
87 | + require_once __DIR__.'/include/functions.time.php'; |
|
88 | 88 | |
89 | 89 | // /** @var Newbb\XmlrssHandler $xmlrssHandler */ |
90 | 90 | // $xmlrssHandler = Newbb\Helper::getInstance()->getHandler('Xmlrss'); |
91 | 91 | $rss = $xmlrssHandler->create(); |
92 | 92 | |
93 | - $rss->setVarRss('channel_title', $GLOBALS['xoopsConfig']['sitename'] . ' :: ' . _MD_NEWBB_FORUM); |
|
94 | - $rss->channel_link = XOOPS_URL . '/'; |
|
95 | - $rss->setVarRss('channel_desc', $GLOBALS['xoopsConfig']['slogan'] . ' :: ' . $xoopsModule->getInfo('description')); |
|
93 | + $rss->setVarRss('channel_title', $GLOBALS['xoopsConfig']['sitename'].' :: '._MD_NEWBB_FORUM); |
|
94 | + $rss->channel_link = XOOPS_URL.'/'; |
|
95 | + $rss->setVarRss('channel_desc', $GLOBALS['xoopsConfig']['slogan'].' :: '.$xoopsModule->getInfo('description')); |
|
96 | 96 | $rss->setVarRss('channel_lastbuild', formatTimestamp(time(), 'rss')); |
97 | 97 | $rss->channel_webmaster = $GLOBALS['xoopsConfig']['adminmail']; |
98 | 98 | $rss->channel_editor = $GLOBALS['xoopsConfig']['adminmail']; |
99 | 99 | $rss->setVarRss('channel_category', $xoopsModule->getVar('name')); |
100 | - $rss->channel_generator = 'NewBB ' . $xoopsModule->getInfo('version'); |
|
100 | + $rss->channel_generator = 'NewBB '.$xoopsModule->getInfo('version'); |
|
101 | 101 | $rss->channel_language = _LANGCODE; |
102 | 102 | $rss->xml_encoding = $charset; |
103 | - $rss->image_url = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/' . $xoopsModule->getInfo('image'); |
|
103 | + $rss->image_url = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/'.$xoopsModule->getInfo('image'); |
|
104 | 104 | |
105 | - $dimension = @getimagesize($GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/' . $xoopsModule->getInfo('image'))); |
|
105 | + $dimension = @getimagesize($GLOBALS['xoops']->path('modules/'.$xoopsModule->getVar('dirname').'/'.$xoopsModule->getInfo('image'))); |
|
106 | 106 | if (empty($dimension[0])) { |
107 | 107 | $width = 88; |
108 | 108 | } else { |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $rss->max_items = $GLOBALS['xoopsModuleConfig']['rss_maxitems']; |
120 | 120 | $rss->max_item_description = $GLOBALS['xoopsModuleConfig']['rss_maxdescription']; |
121 | 121 | |
122 | - $forumCriteria = ' AND t.forum_id IN (' . implode(',', $validForums) . ')'; |
|
122 | + $forumCriteria = ' AND t.forum_id IN ('.implode(',', $validForums).')'; |
|
123 | 123 | unset($validForums); |
124 | 124 | $approveCriteria = ' AND t.approved = 1 AND p.approved = 1'; |
125 | 125 | |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | . $forumCriteria |
146 | 146 | . $approveCriteria |
147 | 147 | . ' ORDER BY p.post_id DESC'; |
148 | - $limit = (int)($GLOBALS['xoopsModuleConfig']['rss_maxitems'] * 1.5); |
|
148 | + $limit = (int) ($GLOBALS['xoopsModuleConfig']['rss_maxitems'] * 1.5); |
|
149 | 149 | if (!$result = $GLOBALS['xoopsDB']->query($query, $limit)) { |
150 | 150 | newbbTrackbackResponse(1, _MD_NEWBB_ERROR); |
151 | 151 | //xoops_error($GLOBALS['xoopsDB']->error()); |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | if (count($types) > 0) { |
170 | 170 | // /** @var Newbb\TypeHandler $typeHandler */ |
171 | 171 | // $typeHandler = Newbb\Helper::getInstance()->getHandler('Type'); |
172 | - $type_list = $typeHandler->getList(new \Criteria('type_id', '(' . implode(', ', array_keys($types)) . ')', 'IN')); |
|
172 | + $type_list = $typeHandler->getList(new \Criteria('type_id', '('.implode(', ', array_keys($types)).')', 'IN')); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | foreach ($rows as $topic) { |
@@ -184,16 +184,16 @@ discard block |
||
184 | 184 | } else { |
185 | 185 | $topic['uname'] = $topic['poster_name'] ? $myts->htmlSpecialChars($topic['poster_name']) : $myts->htmlSpecialChars($GLOBALS['xoopsConfig']['anonymous']); |
186 | 186 | } |
187 | - $description = $topic['forum_name'] . '::'; |
|
188 | - $topic['topic_subject'] = empty($type_list[$topic['type_id']]) ? '' : '[' . $type_list[$topic['type_id']] . '] '; |
|
189 | - $description .= $topic['topic_subject'] . $topic['topic_title'] . "<br>\n"; |
|
187 | + $description = $topic['forum_name'].'::'; |
|
188 | + $topic['topic_subject'] = empty($type_list[$topic['type_id']]) ? '' : '['.$type_list[$topic['type_id']].'] '; |
|
189 | + $description .= $topic['topic_subject'].$topic['topic_title']."<br>\n"; |
|
190 | 190 | $description .= $myts->displayTarea($topic['post_text'], $topic['dohtml'], $topic['dosmiley'], $topic['doxcode'], $topic['dobr']); |
191 | - $label = _MD_NEWBB_BY . ' ' . $topic['uname']; |
|
191 | + $label = _MD_NEWBB_BY.' '.$topic['uname']; |
|
192 | 192 | $time = formatTimestamp($topic['post_time'], 'rss'); |
193 | - $link = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewtopic.php?post_id=' . $topic['post_id'] . ''; |
|
193 | + $link = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/viewtopic.php?post_id='.$topic['post_id'].''; |
|
194 | 194 | if (!empty($GLOBALS['xoopsModuleConfig']['do_rewrite'])) { |
195 | - $link = XOOPS_URL . '/' . REAL_MODULE_NAME . '/viewtopic.php?post_id=' . $topic['post_id'] . ''; |
|
196 | - $oldurl = '<a href=\'' . $link . '\'>'; |
|
195 | + $link = XOOPS_URL.'/'.REAL_MODULE_NAME.'/viewtopic.php?post_id='.$topic['post_id'].''; |
|
196 | + $oldurl = '<a href=\''.$link.'\'>'; |
|
197 | 197 | $newurl = seo_urls($oldurl); |
198 | 198 | $newurl = str_replace('<a href=\'', '', $newurl); |
199 | 199 | $newurl = str_replace('\'>', '', $newurl); |