Passed
Push — master ( 5e790e...222087 )
by Michael
03:14
created

print.php (7 issues)

1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 33 and the first side effect is on line 26.

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.

Loading history...
2
/*
3
-------------------------------------------------------------------------
4
                     ADSLIGHT 2 : Module for Xoops
5
6
        Redesigned and ameliorate By Luc Bizet user at www.frxoops.org
7
        Started with the Classifieds module and made MANY changes
8
        Website : http://www.luc-bizet.fr
9
        Contact : [email protected]
10
-------------------------------------------------------------------------
11
             Original credits below Version History
12
##########################################################################
13
#                    Classified Module for Xoops                         #
14
#  By John Mordo user jlm69 at www.xoops.org and www.jlmzone.com         #
15
#      Started with the MyAds module and made MANY changes               #
16
##########################################################################
17
 Original Author: Pascal Le Boustouller
18
 Author Website : [email protected]
19
 Licence Type   : GPL
20
-------------------------------------------------------------------------
21
*/
22
23
use Xmf\Request;
0 ignored issues
show
The type Xmf\Request was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
24
use XoopsModules\Adslight;
25
26
require_once __DIR__ . '/header.php';
27
//require_once XOOPS_ROOT_PATH . '/modules/adslight/include/gtickets.php';
0 ignored issues
show
Unused Code Comprehensibility introduced by
36% 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...
28
//include XOOPS_ROOT_PATH . '/modules/adslight/class/Utility.php';
29
30
/**
31
 * @param $lid
32
 */
33
function PrintAd($lid)
34
{
35
    global $xoopsConfig, $xoopsDB, $useroffset, $myts, $xoopsLogger, $moduleDirName, $main_lang;
36
37
    $currenttheme = $xoopsConfig['theme_set'];
38
    $lid          = (int)$lid;
39
40
    $result = $xoopsDB->query('SELECT l.lid, l.title, l.expire, l.type, l.desctext, l.tel, l.price, l.typeprice, l.date, l.email, l.submitter, l.town, l.country, l.photo, p.cod_img, p.lid, p.uid_owner, p.url FROM '
41
                              . $xoopsDB->prefix('adslight_listing')
42
                              . ' l LEFT JOIN '
43
                              . $xoopsDB->prefix('adslight_pictures')
44
                              . ' p ON l.lid=p.lid WHERE l.lid='
45
                              . $xoopsDB->escape($lid));
46
    list($lid, $title, $expire, $type, $desctext, $tel, $price, $typeprice, $date, $email, $submitter, $town, $country, $photo, $cod_img, $pic_lid, $uid_owner, $url) = $xoopsDB->fetchRow($result);
47
48
    $title     = $myts->htmlSpecialChars($title);
49
    $expire    = $myts->htmlSpecialChars($expire);
50
    $type      = Adslight\Utility::getNameType($myts->htmlSpecialChars($type));
51
    $desctext  = $myts->displayTarea($desctext, 1, 1, 1, 1, 1);
52
    $tel       = $myts->htmlSpecialChars($tel);
53
    $price     = $myts->htmlSpecialChars($price);
54
    $typeprice = $myts->htmlSpecialChars($typeprice);
55
    $submitter = $myts->htmlSpecialChars($submitter);
56
    $town      = $myts->htmlSpecialChars($town);
57
    $country   = $myts->htmlSpecialChars($country);
58
59
    echo '
60
    <html>
61
    <head><title>' . $xoopsConfig['sitename'] . "</title>
62
    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" >
63
    <meta http-equiv=\”robots\” content=\"noindex, nofollow, noarchive\" >
64
    <link rel=\"StyleSheet\" href=\"../../themes/" . $currenttheme . '/style/style.css" type="text/css">
65
    </head>
66
    <body bgcolor="#FFFFFF" text="#000000">
67
    <table border=0><tr><td>
68
    <table border=0 width=100% cellpadding=0 cellspacing=1 bgcolor="#000000"><tr><td>
69
    <table border=0 width=100% cellpadding=15 cellspacing=1 bgcolor="#FFFFFF"><tr><td>';
70
71
    $useroffset = 0;
72
    if ($GLOBALS['xoopsUser'] instanceof \XoopsUser) {
0 ignored issues
show
The type XoopsUser was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
73
        $timezone   = $GLOBALS['xoopsUser']->timezone();
74
        $useroffset = (!empty($timezone)) ? $GLOBALS['xoopsUser']->timezone() : $xoopsConfig['default_TZ'];
75
    }
76
    $date  = ($useroffset * 3600) + $date;
77
    $date2 = $date + ($expire * 86400);
78
    $date  = formatTimestamp($date, 's');
0 ignored issues
show
The function formatTimestamp was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

78
    $date  = /** @scrutinizer ignore-call */ formatTimestamp($date, 's');
Loading history...
79
    $date2 = formatTimestamp($date2, 's');
80
81
    echo '<br><br><table width=99% border=0>
82
        <tr>
83
      <td>' . _ADSLIGHT_CLASSIFIED . " (No. $lid ) <br>" . _ADSLIGHT_FROM . " $submitter <br><br>";
84
85
    echo " <strong>$type :</strong> <i>$title</i><br>";
86
    if ($price > 0) {
87
        echo '<strong>' . _ADSLIGHT_PRICE2 . "</strong> $price " . $GLOBALS['xoopsModuleConfig']['adslight_currency_symbol'] . "  - $typeprice<br>";
88
    }
89
    if ($photo) {
90
        echo "<tr><td><div style='text-align:left'><img class=\"thumb\" src=\"" . XOOPS_URL . "/uploads/AdsLight/$url\" width=\"130px\" border=0 ></div>";
0 ignored issues
show
The constant XOOPS_URL was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
91
    }
92
    echo '</td>
93
          </tr>
94
    <tr>
95
      <td><strong>' . _ADSLIGHT_DESC . "</strong><br><br><div style=\"text-align:justify;\">$desctext</div><p>";
96
    if ($tel) {
97
        echo '<br><strong>' . _ADSLIGHT_TEL . "</strong> $tel";
98
    }
99
    if ($town) {
100
        echo '<br><strong>' . _ADSLIGHT_TOWN . "</strong> $town";
101
    }
102
    if ($country) {
103
        echo '<br><strong>' . _ADSLIGHT_COUNTRY . "</strong> $country";
104
    }
105
    echo '<hr>';
106
    echo '' . _ADSLIGHT_NOMAIL . ' <br>' . XOOPS_URL . '/modules/adslight/viewads.php?lid=' . $lid . '<br>';
107
    echo '<br><br>' . _ADSLIGHT_DATE2 . " $date " . _ADSLIGHT_AND . ' ' . _ADSLIGHT_DISPO . " $date2<br><br>";
108
    echo '</td>
109
    </tr>
110
    </table>';
111
    echo '<br><br></td></tr></table></td></tr></table>
112
    <br><br><div style="text-align:center">
113
    ' . _ADSLIGHT_EXTRANN . ' <strong>' . $xoopsConfig['sitename'] . '</strong></div><br>
114
    <a href="' . XOOPS_URL . '/modules/adslight/">' . XOOPS_URL . '/modules/adslight/</a>
115
    </td></tr></table>
116
    </body>
117
    </html>';
118
}
119
120
##############################################################
121
122
$lid = Request::getInt('lid', 0);
123
$op  = Request::getString('op', '');
124
125
switch ($op) {
126
127
    case 'PrintAd':
128
        PrintAd($lid);
129
        break;
130
131
    default:
132
        redirect_header('index.php', 3, ' ' . _RETURNANN . ' ');
0 ignored issues
show
The function redirect_header was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

132
        /** @scrutinizer ignore-call */ 
133
        redirect_header('index.php', 3, ' ' . _RETURNANN . ' ');
Loading history...
133
        break;
134
135
}
136