These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
0 ignored issues
–
show
|
|||
2 | /** |
||
3 | * |
||
4 | * Module: Soapbox |
||
5 | * Version: v 1.5 |
||
6 | * Release Date: 23 August 2004 |
||
7 | * Author: hsalazar |
||
8 | * Licence: GNU |
||
9 | */ |
||
10 | |||
11 | use Xmf\Request; |
||
12 | |||
13 | include __DIR__ . '/header.php'; |
||
14 | global $moduleDirName; |
||
15 | $moduleDirName = $myts->htmlSpecialChars(basename(__DIR__)); |
||
16 | View Code Duplication | if ($moduleDirName !== 'soapbox' && $moduleDirName !== '' && !preg_match('/^(\D+)(\d*)$/', $moduleDirName)) { |
|
17 | echo('invalid dirname: ' . htmlspecialchars($moduleDirName, ENT_QUOTES)); |
||
18 | } |
||
19 | |||
20 | require_once XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/include/cleantags.php'; |
||
21 | |||
22 | $articleID = Request::getInt('$articleID', Request::getInt('$articleID', 0, 'POST'), 'GET'); |
||
23 | |||
24 | if (0 === $articleID) { |
||
25 | redirect_header('index.php'); |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * @param $articleID |
||
30 | */ |
||
31 | function PrintPage($articleID) |
||
32 | { |
||
33 | global $moduleDirName; |
||
34 | global $xoopsConfig, $xoopsModule, $xoopsModuleConfig; |
||
35 | $myts = MyTextSanitizer:: getInstance(); |
||
36 | $articleID = (int)$articleID; |
||
37 | //get entry object |
||
38 | $entrydataHandler = xoops_getModuleHandler('entryget', $moduleDirName); |
||
39 | $_entryob = $entrydataHandler->getArticleOnePermcheck($articleID, true, true); |
||
40 | View Code Duplication | if (!is_object($_entryob)) { |
|
41 | redirect_header(XOOPS_URL . '/modules/' . $moduleDirName . '/index.php', 1, 'Not Found'); |
||
42 | } |
||
43 | //------------------------------------- |
||
44 | $articles = $_entryob->toArray(); |
||
45 | //get category object |
||
46 | $_categoryob = $_entryob->_sbcolumns; |
||
47 | //get vars |
||
48 | $category = $_categoryob->toArray(); |
||
49 | //------------------------------------- |
||
50 | //get author |
||
51 | $authorname = SoapboxUtility::getAuthorName($category['author']); |
||
52 | //------------------------------------- |
||
53 | |||
54 | $datetime = $myts->htmlSpecialChars(formatTimestamp($articles['datesub'], $xoopsModuleConfig['dateformat'])); |
||
55 | // $lead = $myts->htmlSpecialChars($lead); |
||
56 | // $bodytext = str_replace("[pagebreak]","<br style=\"page-break-after:always;\">",$bodytext); |
||
57 | // $bodytext = $myts->displayTarea($bodytext, $html, $smiley, $xcodes, '', $breaks); |
||
58 | $bodytext = str_replace('[pagebreak]', '<br style="page-break-after:always;">', $_entryob->getVar('bodytext', 'none')); |
||
59 | $bodytext = $GLOBALS['SoapboxCleantags']->cleanTags($myts->displayTarea($bodytext, $articles['html'], $articles['smiley'], $articles['xcodes'], '', $articles['breaks'])); |
||
60 | |||
61 | $sitename = $myts->htmlSpecialChars($xoopsConfig['sitename']); |
||
62 | $slogan = $myts->htmlSpecialChars($xoopsConfig['slogan']); |
||
63 | |||
64 | echo "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>\n"; |
||
65 | echo "<html>\n<head>\n"; |
||
66 | echo '<title>' . $sitename . "</title>\n"; |
||
67 | echo "<meta http-equiv='Content-Type' content='text/html; charset=" . _CHARSET . "' />\n"; |
||
68 | echo "<meta name='AUTHOR' content='" . $sitename . "' />\n"; |
||
69 | echo "<meta name='COPYRIGHT' content='Copyright (c) 2004 by " . $sitename . "' />\n"; |
||
70 | echo "<meta name='DESCRIPTION' content='" . $slogan . "' />\n"; |
||
71 | echo "<meta name='GENERATOR' content='" . XOOPS_VERSION . "' />\n\n\n"; |
||
72 | |||
73 | //hack start 2003-3-18 by toshimitsu |
||
74 | //Column: --> _MD_SOAPBOX_COLUMNPRN , Author: --> _MD_SOAPBOX_AUTHORPRN |
||
75 | echo "<body bgcolor='#ffffff' text='#000000'> |
||
76 | <div style='width: 600px; border: 1px solid #000; padding: 20px;'> |
||
77 | <div style='text-align: center; display: block; padding-bottom: 12px; margin: 0 0 6px 0; border-bottom: 2px solid #ccc;'><img src='" |
||
78 | . XOOPS_URL |
||
79 | . '/modules/' |
||
80 | . $xoopsModule->dirname() |
||
81 | . "/assets/images/sb_slogo.png' border='0' alt='' /><h2 style='margin: 0;'>" |
||
82 | . $articles['headline'] |
||
83 | . '</h2></div> |
||
84 | <div></div> |
||
85 | <div>' |
||
86 | . _MD_SOAPBOX_COLUMNPRN |
||
87 | . '<b>' |
||
88 | . $category['name'] |
||
89 | . "</b></div> |
||
90 | <div style='padding-bottom: 6px; border-bottom: 1px solid #ccc;'>" |
||
91 | . _MD_SOAPBOX_AUTHORPRN |
||
92 | . ' <b>' |
||
93 | . $authorname |
||
94 | . '</b></div> |
||
95 | <p>' |
||
96 | . $articles['lead'] |
||
97 | . '</p> |
||
98 | <p>' |
||
99 | . $articles['bodytext'] |
||
100 | . "</p> |
||
101 | <div style='padding-top: 12px; border-top: 2px solid #ccc;'><small><b>Published: </b> " |
||
102 | . $datetime |
||
103 | . '<br></div> |
||
104 | </div> |
||
105 | <br> |
||
106 | </body> |
||
107 | </html>'; |
||
108 | } |
||
109 | |||
110 | PrintPage($articleID); |
||
111 |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.