Completed
Push — master ( 67bb37...e20777 )
by Michael
02:35
created

report-abuse.php (1 issue)

Severity

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
include_once __DIR__ . '/header.php';
24
require_once XOOPS_ROOT_PATH . '/modules/adslight/include/gtickets.php';
25
//include XOOPS_ROOT_PATH . '/modules/adslight/class/utilities.php';
26
27
/**
28
 * @param $lid
29
 *
30
 * @return void
31
 */
32
function ReportAbuse($lid)
33
{
34
    global $xoopsConfig, $xoopsDB, $xoopsTheme, $xoopsLogger, $moduleDirName, $main_lang;
35
36
    include XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
37
    include XOOPS_ROOT_PATH . '/header.php';
38
39
    $lid    = (int)$lid;
40
    $idd = $idde = $iddee = '';
0 ignored issues
show
$iddee is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
41
    $result = $xoopsDB->query('SELECT lid, title, type FROM ' . $xoopsDB->prefix('adslight_listing') . ' WHERE lid=' . $xoopsDB->escape($lid));
42
    list($lid, $title, $type) = $xoopsDB->fetchRow($result);
43
44
    $GLOBALS['xoTheme']->addMeta('meta', 'robots', 'noindex, nofollow');
45
46
    echo "<table width='100%' border='0' cellspacing='1' cellpadding='8'><tr class='bg4'><td valign='top'>\n";
47
    echo '<strong>' . _ADSLIGHT_REPORTSENDTO . " $lid </strong>: \" $type : $title \"<br><br>
48
        <form action=\"report-abuse.php\" method=post>
49
        <input type=\"hidden\" name=\"lid\" value=\"$lid\" />";
50
    if ($GLOBALS['xoopsUser']) {
51
        $idd   = $GLOBALS['xoopsUser']->getVar('uname', 'E');
52
        $idde  = $GLOBALS['xoopsUser']->getVar('email', 'E');
53
        $iddee = $xoopsConfig['adminmail'];
54
    } else {
55
        $iddee = $xoopsConfig['adminmail'];
56
    }
57
58
    echo "
59
    <table width='99%' class='outer' cellspacing='1'>
60
    <tr>
61
      <td class='head' width='30%'>" . _ADSLIGHT_NAME . " </td>
62
      <td class='even'><input class=\"textbox\" type=\"text\" name=\"yname\" value=\"$idd\" /></td>
63
    </tr>
64
    <tr>
65
      <td class='head'>" . _ADSLIGHT_MAIL . " </td>
66
      <td class='even'><input class=\"textbox\" type=\"text\" name=\"ymail\" value=\"$idde\" /></td>
67
    </tr>
68
    <tr>
69
      <td class='head'></td>
70
      <td class='even'><input class=\"textbox\" type=\"hidden\" name=\"fmail\" value=\"$iddee\"/></td>
71
    </tr>";
72
73 View Code Duplication
    if ('1' == $GLOBALS['xoopsModuleConfig']['adslight_use_captcha']) {
74
        echo "<tr><td class='head'>" . _ADSLIGHT_CAPTCHA . " </td><td class='even'>";
75
        $jlm_captcha = '';
76
        $jlm_captcha = new XoopsFormCaptcha(_ADSLIGHT_CAPTCHA, 'xoopscaptcha', false);
77
        echo $jlm_captcha->render();
78
        echo '</td></tr>';
79
    }
80
81
    echo '</table><br>
82
    <input type=hidden name=op value=MailAd>
83
    <input type=submit value=' . _ADSLIGHT_SENDFR . '>
84
    </form>     ';
85
    echo '</td></tr></table>';
86
}
87
88
/**
89
 * @param $lid
90
 * @param $yname
91
 * @param $ymail
92
 * @param $fname
93
 * @param $fmail
94
 */
95
function MailAd($lid, $yname, $ymail, $fname, $fmail)
96
{
97
    global $xoopsConfig, $xoopsTpl, $xoopsDB, $xoopsModule, $myts, $xoopsLogger, $moduleDirName, $main_lang;
98
99 View Code Duplication
    if ('1' == $GLOBALS['xoopsModuleConfig']['adslight_use_captcha']) {
100
        xoops_load('xoopscaptcha');
101
        $xoopsCaptcha = XoopsCaptcha::getInstance();
102
        if (!$xoopsCaptcha->verify()) {
103
            redirect_header(XOOPS_URL . '/modules/adslight/index.php', 2, $xoopsCaptcha->getMessage());
104
        }
105
    }
106
107
    $lid    = (int)$lid;
108
    $result = $xoopsDB->query('SELECT lid, title, expire, type, desctext, tel, price, typeprice, date, email, submitter, town, country, photo FROM '
109
                              . $xoopsDB->prefix('adslight_listing')
110
                              . ' WHERE lid='
111
                              . $xoopsDB->escape($lid));
112
    list($lid, $title, $expire, $type, $desctext, $tel, $price, $typeprice, $date, $email, $submitter, $town, $country, $photo) = $xoopsDB->fetchRow($result);
113
114
    $title     = $myts->addSlashes($title);
115
    $expire    = $myts->addSlashes($expire);
116
    $type      = $myts->addSlashes($type);
117
    $desctext  = $myts->displayTarea($desctext, 1, 1, 1, 1, 1);
118
    $tel       = $myts->addSlashes($tel);
119
    $price     = $myts->addSlashes($price);
120
    $typeprice = $myts->addSlashes($typeprice);
121
    $submitter = $myts->addSlashes($submitter);
122
    $town      = $myts->addSlashes($town);
123
    $country   = $myts->addSlashes($country);
124
125
    $tags                       = array();
126
    $tags['YNAME']              = stripslashes($yname);
127
    $tags['YMAIL']              = $ymail;
128
    $tags['FNAME']              = stripslashes($fname);
129
    $tags['FMAIL']              = $fmail;
130
    $tags['HELLO']              = _ADSLIGHT_HELLO;
131
    $tags['LID']                = $lid;
132
    $tags['LISTING_NUMBER']     = _ADSLIGHT_LISTING_NUMBER;
133
    $tags['TITLE']              = $title;
134
    $tags['TYPE']               = AdslightUtilities::getNameType($type);
135
    $tags['DESCTEXT']           = $desctext;
136
    $tags['PRICE']              = $price;
137
    $tags['TYPEPRICE']          = $typeprice;
138
    $tags['TEL']                = $tel;
139
    $tags['TOWN']               = $town;
140
    $tags['COUNTRY']            = $country;
141
    $tags['OTHER']              = '' . _ADSLIGHT_INTERESS . '' . $xoopsConfig['sitename'] . '';
142
    $tags['LISTINGS']           = '' . XOOPS_URL . '/modules/adslight/';
143
    $tags['LINK_URL']           = '' . XOOPS_URL . '/modules/adslight/viewads.php?lid=' . $lid . '';
144
    $tags['THINKS_REPORT']      = '' . _ADSLIGHT_REPORTMESSAGE . '';
145
    $tags['NO_MAIL']            = '' . _ADSLIGHT_NOMAIL . '';
146
    $tags['YOU_CAN_VIEW_BELOW'] = '' . _ADSLIGHT_YOU_CAN_VIEW_BELOW . '';
147
    $tags['WEBMASTER']          = _ADSLIGHT_WEBMASTER;
148
    $tags['NO_REPLY']           = _ADSLIGHT_NOREPLY;
149
    $subject                    = '' . _ADSLIGHT_REPORTSUBJET . ' ' . $xoopsConfig['sitename'] . '';
150
151
    $xoopsMailer =& xoops_getMailer();
152
    $xoopsMailer->multimailer->isHTML(true);
153
    $xoopsMailer->useMail();
154
    $xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/mail_template/');
155
    $xoopsMailer->setTemplate('listing_report_abuse.tpl');
156
    $xoopsMailer->setFromEmail($ymail);
157
    $xoopsMailer->setToEmails($fmail);
158
    $xoopsMailer->setSubject($subject);
159
    $xoopsMailer->assign($tags);
160
161
    // $fmail = $xoopsConfig['adminmail'];
162
    // $xoopsMailer->setToEmails($xoopsConfig['adminmail']);
163
    // $idde = $xoopsUserIsAdmin->getVar("adminmail", "E");
164
165
    $xoopsMailer->send();
166
    echo $xoopsMailer->getErrors();
167
168
    redirect_header('index.php', 3, _ADSLIGHT_REPORTANNSEND);
169
}
170
171
##############################################################
172
$yname = XoopsRequest::getString('yname', '', 'POST');
173
$ymail = XoopsRequest::getString('ymail', '', 'POST');
174
$fname = XoopsRequest::getString('fname', '', 'POST');
175
$fmail = XoopsRequest::getString('fmail', '', 'POST');
176
177
$lid = XoopsRequest::getInt('lid', 0);
178
$op  = XoopsRequest::getString('op', '');
179
180 View Code Duplication
switch ($op) {
181
    case 'ReportAbuse':
182
        include XOOPS_ROOT_PATH . '/header.php';
183
        ReportAbuse($lid);
184
        include XOOPS_ROOT_PATH . '/footer.php';
185
        break;
186
187
    case 'MailAd':
188
        MailAd($lid, $yname, $ymail, $fname, $fmail);
189
        break;
190
191
    default:
192
        redirect_header('index.php', 1, _RETURNANN);
193
        break;
194
}
195