Passed
Push — master ( 3ff696...926303 )
by Michael
04:01 queued 51s
created
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * You may not change or alter any portion of this comment or credits
7
 * of supporting developers from this source code or any supporting source code
8
 * which is considered copyrighted (c) material of the original comment or credit authors.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
 */
14
15
/**
16
 * @copyright    XOOPS Project (https://xoops.org)
17
 * @license      GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
18
 * @author       XOOPS Development Team
19
 * @author       Pascal Le Boustouller: original author ([email protected])
20
 * @author       Luc Bizet (www.frxoops.org)
21
 * @author       jlm69 (www.jlmzone.com)
22
 * @author       mamba (www.xoops.org)
23
 */
24
25
use Xmf\Request;
26
use XoopsModules\Adslight\{
27
    Utility
28
};
29
30
/** @var Helper $helper */
31
32
require_once __DIR__ . '/header.php';
33
//require_once XOOPS_ROOT_PATH . '/modules/adslight/include/gtickets.php';
34
35
/**
36
 * @param $lid
37
 */
38
function PrintAd($lid): void
39
{
40
    global $xoopsConfig, $xoopsDB, $useroffset, $myts;
41
42
    $currenttheme = $xoopsConfig['theme_set'];
43
    $lid          = (int)$lid;
44
45
    $result = $xoopsDB->query(
46
        'SELECT l.lid, l.title, l.expire, l.type, l.desctext, l.tel, l.price, l.typeprice, l.date_created, l.email, l.submitter, l.town, l.country, l.photo, p.cod_img, p.lid, p.uid_owner, p.url FROM '
47
        . $xoopsDB->prefix('adslight_listing')
48
        . ' l LEFT JOIN '
49
        . $xoopsDB->prefix('adslight_pictures')
50
        . ' p ON l.lid=p.lid WHERE l.lid='
51
        . $xoopsDB->escape($lid)
52
    );
53
    [$lid, $title, $expire, $type, $desctext, $tel, $price, $typeprice, $date_created, $email, $submitter, $town, $country, $photo, $cod_img, $pic_lid, $uid_owner, $url] = $xoopsDB->fetchRow($result);
54
55
    $title     = \htmlspecialchars($title, ENT_QUOTES | ENT_HTML5);
56
    $expire    = \htmlspecialchars($expire, ENT_QUOTES | ENT_HTML5);
57
    $type      = Utility::getNameType(htmlspecialchars($type, ENT_QUOTES | ENT_HTML5));
58
    $desctext  = $myts->displayTarea($desctext, 1, 1, 1, 1, 1);
59
    $tel       = \htmlspecialchars($tel, ENT_QUOTES | ENT_HTML5);
60
    $price     = \htmlspecialchars($price, ENT_QUOTES | ENT_HTML5);
61
    $typeprice = \htmlspecialchars($typeprice, ENT_QUOTES | ENT_HTML5);
62
    $submitter = \htmlspecialchars($submitter, ENT_QUOTES | ENT_HTML5);
63
    $town      = \htmlspecialchars($town, ENT_QUOTES | ENT_HTML5);
64
    $country   = \htmlspecialchars($country, ENT_QUOTES | ENT_HTML5);
65
66
    echo '
67
    <html>
68
    <head><title>' . $xoopsConfig['sitename'] . "</title>
69
    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" >
70
    <meta http-equiv=\”robots\” content=\"noindex, nofollow, noarchive\" >
71
    <link rel=\"StyleSheet\" href=\"../../themes/" . $currenttheme . '/style/style.css" type="text/css">
72
    </head>
73
    <body bgcolor="#FFFFFF" text="#000000">
74
    <table border=0><tr><td>
75
    <table border=0 width=100% cellpadding=0 cellspacing=1 bgcolor="#000000"><tr><td>
76
    <table border=0 width=100% cellpadding=15 cellspacing=1 bgcolor="#FFFFFF"><tr><td>';
77
78
    $useroffset = 0;
79
    if ($GLOBALS['xoopsUser'] instanceof \XoopsUser) {
80
        $timezone   = $GLOBALS['xoopsUser']->timezone();
81
        $useroffset = empty($timezone) ? $xoopsConfig['default_TZ'] : $GLOBALS['xoopsUser']->timezone();
82
    }
83
    $date_created = ($useroffset * 3600) + $date_created;
84
    $date2        = $date_created + ($expire * 86400);
85
    $date1        = formatTimestamp($date_created, 's');
0 ignored issues
show
The assignment to $date1 is dead and can be removed.
Loading history...
86
    $date2        = formatTimestamp($date2, 's');
87
88
    echo '<br><br><table width=99% border=0>
89
        <tr>
90
      <td>' . _ADSLIGHT_CLASSIFIED . " (No. ${lid} ) <br>" . _ADSLIGHT_FROM . " ${submitter} <br><br>";
91
92
    echo " <strong>${type} :</strong> <i>${title}</i><br>";
93
    if ($price > 0) {
94
        echo '<strong>' . _ADSLIGHT_PRICE2 . "</strong> ${price} " . $GLOBALS['xoopsModuleConfig']['adslight_currency_symbol'] . "  - ${typeprice}<br>";
95
    }
96
    if ($photo) {
97
        echo "<tr><td><div style='text-align:left'><img class=\"thumb\" src=\"" . XOOPS_URL . "/uploads/adslight/${url}\" width=\"130px\" border=0 ></div>";
98
    }
99
    echo '</td>
100
          </tr>
101
    <tr>
102
      <td><strong>' . _ADSLIGHT_DESC . "</strong><br><br><div style=\"text-align:justify;\">${desctext}</div><p>";
103
    if ('' !== $tel) {
104
        echo '<br><strong>' . _ADSLIGHT_TEL . "</strong> ${tel}";
105
    }
106
    if ('' !== $town) {
107
        echo '<br><strong>' . _ADSLIGHT_TOWN . "</strong> ${town}";
108
    }
109
    if ('' !== $country) {
110
        echo '<br><strong>' . _ADSLIGHT_COUNTRY . "</strong> ${country}";
111
    }
112
    echo '<hr>';
113
    echo '' . _ADSLIGHT_NOMAIL . ' <br>' . XOOPS_URL . '/modules/adslight/viewads.php?lid=' . $lid . '<br>';
114
    echo '<br><br>' . _ADSLIGHT_DATE2 . " ${date_created} " . _ADSLIGHT_AND . ' ' . _ADSLIGHT_DISPO . " ${date2}<br><br>";
115
    echo '</td>
116
    </tr>
117
    </table>';
118
    echo '<br><br></td></tr></table></td></tr></table>
119
    <br><br><div style="text-align:center">
120
    ' . _ADSLIGHT_EXTRANN . ' <strong>' . $xoopsConfig['sitename'] . '</strong></div><br>
121
    <a href="' . XOOPS_URL . '/modules/adslight/">' . XOOPS_URL . '/modules/adslight/</a>
122
    </td></tr></table>
123
    </body>
124
    </html>';
125
}
126
127
##############################################################
128
129
$lid = Request::getInt('lid', 0);
130
$op  = Request::getString('op', '');
131
132
switch ($op) {
133
    case 'PrintAd':
134
        PrintAd($lid);
135
        break;
136
    default:
137
        $helper->redirect('index.php', 3, ' ' . _RETURNANN . ' ');
138
        break;
139
}
140