Completed
Push — master ( 0424ea...923121 )
by Michael
03:57
created

Upgrade to new PHP Analysis Engine

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
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 30 and the first side effect is on line 23.

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
include_once __DIR__ . '/header.php';
24
require_once(XOOPS_ROOT_PATH . '/modules/adslight/include/gtickets.php');
25
include(XOOPS_ROOT_PATH . '/modules/adslight/include/functions.php');
26
27
/**
28
 * @param $lid
29
 */
30
function PrintAd($lid)
31
{
32
    global $xoopsConfig, $xoopsUser, $xoopsDB, $xoopsModuleConfig, $useroffset, $myts, $xoopsLogger, $moduleDirName, $main_lang;
33
34
    $currenttheme = $xoopsConfig['theme_set'];
35
36
    $result =
37
        $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 ' .
38
                        $xoopsDB->prefix('adslight_listing') .
39
                        ' l LEFT JOIN ' .
40
                        $xoopsDB->prefix('adslight_pictures') .
41
                        ' p ON l.lid=p.lid where l.lid=' .
42
                        $xoopsDB->escape($lid) .
43
                        '');
44
    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);
45
46
    $title     = $myts->htmlSpecialChars($title);
47
    $expire    = $myts->htmlSpecialChars($expire);
48
    $type      = adslight_NameType($myts->htmlSpecialChars($type));
49
    $desctext  = $myts->displayTarea($desctext, 1, 1, 1, 1, 1);
50
    $tel       = $myts->htmlSpecialChars($tel);
51
    $price     = $myts->htmlSpecialChars($price);
52
    $typeprice = $myts->htmlSpecialChars($typeprice);
53
    $submitter = $myts->htmlSpecialChars($submitter);
54
    $town      = $myts->htmlSpecialChars($town);
55
    $country   = $myts->htmlSpecialChars($country);
56
57
    echo '
58
    <html>
59
    <head><title>' . $xoopsConfig['sitename'] . "</title>
60
    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />
61
    <meta http-equiv=\”robots\” content=\"noindex, nofollow, noarchive\" />
62
    <link rel=\"StyleSheet\" href=\"../../themes/" . $currenttheme . "/style/style.css\" type=\"text/css\">
63
    </head>
64
    <body bgcolor=\"#FFFFFF\" text=\"#000000\">
65
    <table border=0><tr><td>
66
    <table border=0 width=100% cellpadding=0 cellspacing=1 bgcolor=\"#000000\"><tr><td>
67
    <table border=0 width=100% cellpadding=15 cellspacing=1 bgcolor=\"#FFFFFF\"><tr><td>";
68
69
    $useroffset = '';
70 View Code Duplication
    if ($xoopsUser) {
71
        $timezone = $xoopsUser->timezone();
72
        if (isset($timezone)) {
73
            $useroffset = $xoopsUser->timezone();
74
        } else {
75
            $useroffset = $xoopsConfig['default_TZ'];
76
        }
77
    }
78
    $date  = ($useroffset * 3600) + $date;
79
    $date2 = $date + ($expire * 86400);
80
    $date  = formatTimestamp($date, 's');
81
    $date2 = formatTimestamp($date2, 's');
82
83
    echo '<br><br><table width=99% border=0>
84
        <tr>
85
      <td>' . _ADSLIGHT_CLASSIFIED . " (No. $lid ) <br>" . _ADSLIGHT_FROM . " $submitter <br><br>";
86
87
    echo " <strong>$type :</strong> <i>$title</i><br>";
88
    if ($price > 0) {
89
        echo '<strong>' . _ADSLIGHT_PRICE2 . "</strong> $price " . $xoopsModuleConfig['adslight_money'] . "  - $typeprice<br>";
90
    }
91
    if ($photo) {
92
        echo "<tr><td><left><img class=\"thumb\" src=\"" . XOOPS_URL . "/uploads/AdsLight/$url\" width=\"130px\" border=0 /></center>";
93
    }
94
    echo '</td>
95
          </tr>
96
    <tr>
97
      <td><strong>' . _ADSLIGHT_DESC . "</strong><br><br><div style=\"text-align:justify;\">$desctext</div><p>";
98
    if ($tel) {
99
        echo '<br><strong>' . _ADSLIGHT_TEL . "</strong> $tel";
100
    }
101
    if ($town) {
102
        echo '<br><strong>' . _ADSLIGHT_TOWN . "</strong> $town";
103
    }
104
    if ($country) {
105
        echo '<br><strong>' . _ADSLIGHT_COUNTRY . "</strong> $country";
106
    }
107
    echo '<hr />';
108
    echo '' . _ADSLIGHT_NOMAIL . ' <br>' . XOOPS_URL . '/modules/adslight/viewads.php?lid=' . $lid . '<br>';
109
    echo '<br><br>' . _ADSLIGHT_DATE2 . " $date " . _ADSLIGHT_AND . ' ' . _ADSLIGHT_DISPO . " $date2<br><br>";
110
    echo '</td>
111
    </tr>
112
    </table>';
113
    echo '<br><br></td></tr></table></td></tr></table>
114
    <br><br><center>
115
    ' . _ADSLIGHT_EXTRANN . ' <strong>' . $xoopsConfig['sitename'] . "</strong><br>
116
    <a href=\"" . XOOPS_URL . "/modules/adslight/\">" . XOOPS_URL . '/modules/adslight/</a>
117
    </td></tr></table>
118
    </body>
119
    </html>';
120
}
121
122
##############################################################
123
124 View Code Duplication
if (!isset($_POST['lid']) && isset($_GET['lid'])) {
125
    $lid = (int)$_GET['lid'];
126
} else {
127
    $lid = (int)$_POST['lid'];
128
}
129
130
$op = '';
131
if (!empty($_GET['op'])) {
132
    $op = $_GET['op'];
133
} elseif (!empty($_POST['op'])) {
134
    $op = $_POST['op'];
135
}
136
137
switch ($op) {
138
139
    case 'PrintAd':
140
        PrintAd($lid);
141
        break;
142
143
    default:
144
        redirect_header('index.php', 3, '' . _RETURNGLO . '');
145
        break;
146
147
}
148