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