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