Completed
Branch master (f83415)
by Michael
02:57 queued 18s
created

sendfriend.php (1 issue)

Labels
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
include_once __DIR__ . '/header.php';
23
require XOOPS_ROOT_PATH . '/modules/adslight/include/gtickets.php';
24
include XOOPS_ROOT_PATH . '/modules/adslight/include/functions.php';
25
26
/**
27
 * @param $lid
28
 */
29
function SendFriend($lid)
30
{
31
    global $xoopsConfig, $xoopsModuleConfig, $xoopsDB, $xoopsUser, $xoopsTheme, $xoopsLogger, $moduleDirName, $main_lang;
32
33
    include XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
34
    include XOOPS_ROOT_PATH . '/header.php';
35
    $xoTheme->addMeta('meta', 'robots', 'noindex, nofollow');
36
37
    $result = $xoopsDB->query('SELECT lid, title, type FROM ' . $xoopsDB->prefix('adslight_listing') . " WHERE lid={$lid}");
38
    list($lid, $title, $type) = $xoopsDB->fetchRow($result);
39
40
    echo "<table width='100%' border='0' cellspacing='1' cellpadding='8'><tr class='bg4'><td valign='top'>
41
        <strong>" . _ADSLIGHT_SENDTO . " $lid \"<strong>$type : $title</strong>\" " . _ADSLIGHT_FRIEND . "<br><br>
42
        <form action=\"sendfriend.php\" method=post>
43
        <input type=\"hidden\" name=\"lid\" value=\"$lid\" />";
44
45
    if ($xoopsUser instanceof XoopsUser) {
0 ignored issues
show
The class XoopsUser does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

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