1 | <?php |
||
2 | /** |
||
3 | * Module: Soapbox |
||
4 | * Author: hsalazar |
||
5 | * Licence: GNU |
||
6 | */ |
||
7 | |||
8 | use Xmf\Request; |
||
9 | use XoopsModules\Soapbox; |
||
10 | |||
11 | require __DIR__ . '/header.php'; |
||
12 | |||
13 | /** @var Soapbox\Helper $helper */ |
||
14 | $helper = Soapbox\Helper::getInstance(); |
||
15 | |||
16 | global $moduleDirName; |
||
17 | $moduleDirName = $myts->htmlSpecialChars(basename(__DIR__)); |
||
18 | if ('soapbox' !== $moduleDirName && '' !== $moduleDirName && !preg_match('/^(\D+)(\d*)$/', $moduleDirName)) { |
||
19 | echo('invalid dirname: ' . htmlspecialchars($moduleDirName, ENT_QUOTES)); |
||
20 | } |
||
21 | |||
22 | //require_once XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/include/cleantags.php'; |
||
23 | |||
24 | //$articleID = Request::getInt('$articleID', Request::getInt('$articleID', 0, 'POST'), 'GET'); |
||
25 | if (\Xmf\Request::hasVar('articleID', 'GET')) { |
||
26 | $articleID = \Xmf\Request::getInt('articleID', 0, 'GET'); |
||
27 | } |
||
28 | if (\Xmf\Request::hasVar('articleID', 'POST')) { |
||
29 | $articleID = \Xmf\Request::getInt('articleID', 0, 'POST'); |
||
30 | } |
||
31 | if (0 === $articleID) { |
||
32 | redirect_header('index.php'); |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * @param $articleID |
||
37 | */ |
||
38 | function PrintPage($articleID) |
||
39 | { |
||
40 | global $moduleDirName; |
||
41 | global $xoopsConfig, $xoopsModule; |
||
42 | /** @var Soapbox\Helper $helper */ |
||
43 | $helper = Soapbox\Helper::getInstance(); |
||
44 | |||
45 | $cleantags = new Soapbox\Cleantags(); |
||
46 | |||
47 | $myts = \MyTextSanitizer:: getInstance(); |
||
48 | $articleID = (int)$articleID; |
||
49 | //get entry object |
||
50 | /** @var \XoopsModules\Soapbox\EntrygetHandler $entrydataHandler */ |
||
51 | $entrydataHandler = new \XoopsModules\Soapbox\EntrygetHandler(); |
||
52 | $_entryob = $entrydataHandler->getArticleOnePermcheck($articleID, true, true); |
||
53 | if (!is_object($_entryob)) { |
||
54 | redirect_header(XOOPS_URL . '/modules/' . $moduleDirName . '/index.php', 1, 'Not Found'); |
||
55 | } |
||
56 | //------------------------------------- |
||
57 | $articles = $_entryob->toArray(); |
||
58 | //get category object |
||
59 | $_categoryob = $_entryob->_sbcolumns; |
||
60 | //get vars |
||
61 | $category = $_categoryob->toArray(); |
||
62 | //------------------------------------- |
||
63 | //get author |
||
64 | $authorname = Soapbox\Utility::getAuthorName($category['author']); |
||
65 | //------------------------------------- |
||
66 | |||
67 | $datetime = $myts->htmlSpecialChars(formatTimestamp($articles['datesub'], $helper->getConfig('dateformat'))); |
||
68 | // $lead = $myts->htmlSpecialChars($lead); |
||
69 | // $bodytext = str_replace("[pagebreak]","<br style=\"page-break-after:always;\">",$bodytext); |
||
70 | // $bodytext = $myts->displayTarea($bodytext, $html, $smiley, $xcodes, '', $breaks); |
||
71 | $bodytext = str_replace('[pagebreak]', '<br style="page-break-after:always;">', $_entryob->getVar('bodytext', 'none')); |
||
72 | $bodytext = $cleantags->cleanTags($myts->displayTarea($bodytext, $articles['html'], $articles['smiley'], $articles['xcodes'], '', $articles['breaks'])); |
||
0 ignored issues
–
show
Unused Code
introduced
by
![]() |
|||
73 | |||
74 | $sitename = $myts->htmlSpecialChars($xoopsConfig['sitename']); |
||
75 | $slogan = $myts->htmlSpecialChars($xoopsConfig['slogan']); |
||
76 | |||
77 | echo "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>\n"; |
||
78 | echo "<html>\n<head>\n"; |
||
79 | echo '<title>' . $sitename . "</title>\n"; |
||
80 | echo "<meta http-equiv='Content-Type' content='text/html; charset=" . _CHARSET . "'>\n"; |
||
81 | echo "<meta name='AUTHOR' content='" . $sitename . "'>\n"; |
||
82 | echo "<meta name='COPYRIGHT' content='Copyright (с) " . $sitename . "'>\n"; |
||
83 | echo "<meta name='DESCRIPTION' content='" . $slogan . "'>\n"; |
||
84 | echo "<meta name='GENERATOR' content='" . XOOPS_VERSION . "'>\n\n\n"; |
||
85 | |||
86 | //hack start 2003-3-18 by toshimitsu |
||
87 | //Column: --> _MD_SOAPBOX_COLUMNPRN , Author: --> _MD_SOAPBOX_AUTHORPRN |
||
88 | echo "<body bgcolor='#ffffff' text='#000000'> |
||
89 | <div style='width: 600px; border: 1px solid #000; padding: 20px;'> |
||
90 | <div style='text-align: center; display: block; padding-bottom: 12px; margin: 0 0 6px 0; border-bottom: 2px solid #ccc;'><h2 style='margin: 0;'>" . $sitename . '<br>' . $articles['headline'] . '</h2></div> |
||
91 | <div></div> |
||
92 | <div>' . _MD_SOAPBOX_COLUMNPRN . '<b>' . $category['name'] . "</b></div> |
||
93 | <div style='padding-bottom: 6px; border-bottom: 1px solid #ccc;'>" . _MD_SOAPBOX_AUTHORPRN . ' <b>' . $authorname . '</b></div> |
||
94 | <p>' . $articles['lead'] . '</p> |
||
95 | <p>' . $articles['bodytext'] . "</p> |
||
96 | <div style='padding-top: 12px; border-top: 2px solid #ccc;'><small><b>Published:</b> " . $datetime . '<br></div> |
||
97 | </div> |
||
98 | <br> |
||
99 | </body> |
||
100 | </html>'; |
||
101 | } |
||
102 | |||
103 | PrintPage($articleID); |
||
104 |