XoopsModules25x /
soapbox
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 | // $Id: print.php,v 0.0.1 2005/10/24 20:30:00 domifara Exp $ |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
50% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 3 | /** |
||
| 4 | * $Id: print.php v 1.5 23 August 2004 hsalazar Exp $ |
||
| 5 | * Module: Soapbox |
||
| 6 | * Version: v 1.5 |
||
| 7 | * Release Date: 23 August 2004 |
||
| 8 | * Author: hsalazar |
||
| 9 | * Licence: GNU |
||
| 10 | */ |
||
| 11 | include __DIR__ . '/header.php'; |
||
| 12 | global $moduleDirName; |
||
| 13 | $moduleDirName = &$myts->htmlSpecialChars(basename(__DIR__)); |
||
| 14 | View Code Duplication | if ($moduleDirName !== "soapbox" && $moduleDirName !== "" && !preg_match('/^(\D+)(\d*)$/', $moduleDirName)) { |
|
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history...
|
|||
| 15 | echo("invalid dirname: " . htmlspecialchars($moduleDirName, ENT_QUOTES)); |
||
| 16 | } |
||
| 17 | |||
| 18 | include_once XOOPS_ROOT_PATH . "/modules/" . $moduleDirName . "/include/cleantags.php"; |
||
| 19 | |||
| 20 | $articleID = 0; |
||
| 21 | if ( isset( $_GET['articleID'] ) ){$articleID = (int)($_GET['articleID']);} |
||
| 22 | if ( isset( $_POST['articleID'] ) ){$articleID = (int)($_POST['articleID']);} |
||
| 23 | |||
| 24 | if (empty($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 | $_entrydata_handler =& xoops_getmodulehandler('entryget', $moduleDirName); |
||
| 39 | $_entryob =& $_entrydata_handler->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 = 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='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/assets/images/sb_slogo.png' border='0' alt='' /><h2 style='margin: 0;'>" . $articles['headline'] . "</h2></div> |
||
| 78 | <div></div> |
||
| 79 | <div>" . _MD_SOAPBOX_COLUMNPRN . "<b>" . $category['name'] . "</b></div> |
||
| 80 | <div style='padding-bottom: 6px; border-bottom: 1px solid #ccc;'>" . _MD_SOAPBOX_AUTHORPRN . " <b>" . $authorname . "</b></div> |
||
| 81 | <p>" . $articles['lead'] . "</p> |
||
| 82 | <p>" . $articles['bodytext'] . "</p> |
||
| 83 | <div style='padding-top: 12px; border-top: 2px solid #ccc;'><small><b>Published: </b> " . $datetime . "<br /></div> |
||
| 84 | </div> |
||
| 85 | <br /> |
||
| 86 | </body> |
||
| 87 | </html>"; |
||
| 88 | } |
||
| 89 | |||
| 90 | PrintPage($articleID); |
||
| 91 |
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.