Completed
Push — master ( e78a73...9ae314 )
by Michael
01:46
created

submit.php (2 issues)

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
 * Module: WF-Links
5
 * Version: v1.0.3
6
 * Release Date: 21 June 2005
7
 * Developer: John N
8
 * Team: WF-Projects
9
 * Licence: GNU
10
 */
11
12
require_once __DIR__ . '/header.php';
13
14
include XOOPS_ROOT_PATH . '/header.php';
15
include XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
16
17
$mytree = new WflinksXoopsTree($xoopsDB->prefix('wflinks_cat'), 'cid', 'pid');
18
global $wfmyts, $xoopsModuleConfig;
19
20
$cid = wfl_cleanRequestVars($_REQUEST, 'cid', 0);
21
$lid = wfl_cleanRequestVars($_REQUEST, 'lid', 0);
22
$cid = (int)$cid;
23
$lid = (int)$lid;
24
25
if (false === wfl_checkgroups($cid, 'WFLinkSubPerm')) {
26
    redirect_header('index.php', 1, _MD_WFL_NOPERMISSIONTOPOST);
27
}
28
29
if (true === wfl_checkgroups($cid, 'WFLinkSubPerm')) {
30
    if (wfl_cleanRequestVars($_REQUEST, 'submit', 0)) {
31
        if (false === wfl_checkgroups($cid, 'WFLinkSubPerm')) {
32
            redirect_header('index.php', 1, _MD_WFL_NOPERMISSIONTOPOST);
33
        }
34
35
        $submitter    = (is_object($xoopsUser) && !empty($xoopsUser)) ? $xoopsUser->getVar('uid') : 0;
36
        $forumid      = wfl_cleanRequestVars($_REQUEST, 'forumid', 0);
37
        $offline      = wfl_cleanRequestVars($_REQUEST, 'offline', 0);
38
        $notifypub    = wfl_cleanRequestVars($_REQUEST, 'notifypub', 0);
39
        $approve      = wfl_cleanRequestVars($_REQUEST, 'approve', 0);
40
        $url          = $wfmyts->addSlashes(ltrim($_POST['url']));
41
        $title        = $wfmyts->addSlashes(ltrim($_REQUEST['title']));
42
        $descriptionb = $wfmyts->addSlashes(ltrim($_REQUEST['descriptionb']));
43
        $keywords     = $wfmyts->addSlashes(trim(substr($_POST['keywords'], 0, $xoopsModuleConfig['keywordlength'])));
44
45
        if ($xoopsModuleConfig['usercantag']) {
46
            $item_tag = $wfmyts->addSlashes(ltrim($_REQUEST['item_tag']));
47
        } else {
48
            $item_tag = '';
49
        }
50
51
        if ($xoopsModuleConfig['useaddress']) {
52
            $googlemap = ($_POST['googlemap'] !== 'http://maps.google.com') ? $wfmyts->addSlashes($_POST['googlemap']) : '';
53
            $yahoomap  = ($_POST['yahoomap'] !== 'http://maps.yahoo.com') ? $wfmyts->addSlashes($_POST['yahoomap']) : '';
54
            $multimap  = ($_POST['multimap'] !== 'http://www.multimap.com') ? $wfmyts->addSlashes($_POST['multimap']) : '';
55
            $street1   = $wfmyts->addSlashes(ltrim($_REQUEST['street1']));
56
            $street2   = $wfmyts->addSlashes(ltrim($_REQUEST['street2']));
57
            $town      = $wfmyts->addSlashes(ltrim($_REQUEST['town']));
58
            $state     = $wfmyts->addSlashes(ltrim($_REQUEST['state']));
59
            $zip       = $wfmyts->addSlashes(ltrim($_REQUEST['zip']));
60
            $tel       = $wfmyts->addSlashes(ltrim($_REQUEST['tel']));
61
            $fax       = $wfmyts->addSlashes(ltrim($_REQUEST['fax']));
62
            $voip      = $wfmyts->addSlashes(ltrim($_REQUEST['voip']));
63
            $mobile    = $wfmyts->addSlashes(ltrim($_REQUEST['mobile']));
64
            $email     = emailcnvrt($wfmyts->addSlashes(ltrim($_REQUEST['email'])));
65
            $vat       = $wfmyts->addSlashes(ltrim($_REQUEST['vat']));
66
        } else {
67
            $googlemap = $yahoomap = $multimap = $street1 = $street2 = $town = $state = $zip = $tel = $fax = $voip = $mobile = $email = $vat = '';
68
        }
69
70
        $country = $wfmyts->addSlashes(ltrim($_REQUEST['country']));
71
72
        $date        = time();
73
        $publishdate = 0;
74
        $ipaddress   = $_SERVER['REMOTE_ADDR'];
75
76
        if ($lid == 0) {
77
            $status      = 0;
78
            $publishdate = 0;
79
            $message     = _MD_WFL_THANKSFORINFO;
80
            if (true === wfl_checkgroups($cid, 'WFLinkAutoApp')) {
81
                $publishdate = time();
82
                $status      = 1;
83
                $message     = _MD_WFL_ISAPPROVED;
84
            }
85
86
            $sql = 'INSERT INTO '
87
                   . $xoopsDB->prefix('wflinks_links')
88
                   . ' (lid, cid, title, url, submitter, status, date, hits, rating, votes, comments, forumid, published, expired, offline, description, ipaddress, notifypub, country, keywords, item_tag, googlemap, yahoomap, multimap, street1, street2, town, state, zip, tel, fax, voip, mobile, email, vat ) ';
89
90
            $sql .= " VALUES    (0, $cid, '$title', '$url', '$submitter', '$status', '$date', 0, 0, 0, 0, '$forumid', '$publishdate', 0, '$offline', '$descriptionb', '$ipaddress', '$notifypub', '$country', '$keywords', '$item_tag', '$googlemap', '$yahoomap', '$multimap', '$street1', '$street2', '$town', '$state', '$zip', '$tel', '$fax', '$voip', '$mobile', '$email', '$vat' )";
91
92
            if (!$result = $xoopsDB->query($sql)) {
93
                $_error = $xoopsDB->error() . ' : ' . $xoopsDB->errno();
94
                XoopsErrorHandler_HandleError(E_USER_WARNING, $_error, __FILE__, __LINE__);
95
            }
96
            // $newid = $xoopsDB -> getInsertId();
97
            $newid = $GLOBALS['xoopsDB']->getInsertId();
98
99
            // Add item_tag to Tag-module
100
            if ($lid == 0) {
101
                $tagupdate = wfl_tagupdate($newid, $item_tag);
0 ignored issues
show
Are you sure the assignment to $tagupdate is correct as wfl_tagupdate($newid, $item_tag) (which targets wfl_tagupdate()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
102
            } else {
103
                $tagupdate = wfl_tagupdate($lid, $item_tag);
0 ignored issues
show
Are you sure the assignment to $tagupdate is correct as wfl_tagupdate($lid, $item_tag) (which targets wfl_tagupdate()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
104
            }
105
106
            // Notify of new link (anywhere) and new link in category
107
            $notificationHandler = xoops_getHandler('notification');
108
109
            $tags              = array();
110
            $tags['LINK_NAME'] = $title;
111
            $tags['LINK_URL']  = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/singlelink.php?cid=' . $cid . '&amp;lid=' . (int)$newid;
112
113
            $sql    = 'SELECT title FROM ' . $xoopsDB->prefix('wflinks_cat') . ' WHERE cid=' . $cid;
114
            $result = $xoopsDB->query($sql);
115
            $row    = $xoopsDB->fetchArray($result);
116
117
            $tags['CATEGORY_NAME'] = $row['title'];
118
            $tags['CATEGORY_URL']  = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewcat.php?cid=' . $cid;
119
            if (true === wfl_checkgroups($cid, 'WFLinkAutoApp')) {
120
                $notificationHandler->triggerEvent('global', 0, 'new_link', $tags);
121
                $notificationHandler->triggerEvent('category', $cid, 'new_link', $tags);
122
                redirect_header('index.php', 2, _MD_WFL_ISAPPROVED);
123
            } else {
124
                $tags['WAITINGFILES_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/newlinks.php';
125
                $notificationHandler->triggerEvent('global', 0, 'link_submit', $tags);
126
                $notificationHandler->triggerEvent('category', $cid, 'link_submit', $tags);
127
                if ($notifypub) {
128
                    require_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
129
                    $notificationHandler->subscribe('link', $newid, 'approve', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE);
130
                }
131
                redirect_header('index.php', 2, _MD_WFL_THANKSFORINFO);
132
            }
133
        } else {
134
            if (true === wfl_checkgroups($cid, 'WFLinkAutoApp') || $approve == 1) {
135
                $updated = time();
136
                $sql     = 'UPDATE '
137
                           . $xoopsDB->prefix('wflinks_links')
138
                           . " SET cid=$cid, title='$title', url='$url', updated='$updated', offline='$offline', description='$descriptionb', ipaddress='$ipaddress', notifypub='$notifypub', country='$country', keywords='$keywords', item_tag='$item_tag', googlemap='$googlemap', yahoomap='$yahoomap', multimap='$multimap', street1='$street1', street2='$street2', town='$town', state='$state',  zip='$zip', tel='$tel', fax='$fax', voip='$voip', mobile='$mobile', email='$email', vat='$vat' WHERE lid="
139
                           . $lid;
140
                if (!$result = $xoopsDB->query($sql)) {
141
                    $_error = $xoopsDB->error() . ' : ' . $xoopsDB->errno();
142
                    XoopsErrorHandler_HandleError(E_USER_WARNING, $_error, __FILE__, __LINE__);
143
                }
144
145
                $notificationHandler   = xoops_getHandler('notification');
146
                $tags                  = array();
147
                $tags['LINK_NAME']     = $title;
148
                $tags['LINK_URL']      = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/singlelink.php?cid=' . $cid . '&amp;lid=' . $lid;
149
                $sql                   = 'SELECT title FROM ' . $xoopsDB->prefix('wflinks_cat') . ' WHERE cid=' . $cid;
150
                $result                = $xoopsDB->query($sql);
151
                $row                   = $xoopsDB->fetchArray($result);
152
                $tags['CATEGORY_NAME'] = $row['title'];
153
                $tags['CATEGORY_URL']  = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewcat.php?cid=' . $lid;
154
155
                $notificationHandler->triggerEvent('global', 0, 'new_link', $tags);
156
                $notificationHandler->triggerEvent('category', $cid, 'new_link', $tags);
157
                $_message = _MD_WFL_ISAPPROVED;
158
            } else {
159
                $modifysubmitter = $xoopsUser->uid();
160
                $requestid       = $modifysubmitter;
161
                $requestdate     = time();
162
                $updated         = wfl_cleanRequestVars($_REQUEST, 'up_dated', time());
163
                $sql             = 'INSERT INTO '
164
                                   . $xoopsDB->prefix('wflinks_mod')
165
                                   . ' (requestid, lid, cid, title, url, forumid, description, modifysubmitter, requestdate, country, keywords, item_tag, googlemap, yahoomap, multimap, street1, street2, town, state, zip, tel, fax, voip, mobile, email, vat)';
166
                $sql             .= " VALUES (0, $lid, $cid, '$title', '$url', '$forumid', '$descriptionb', '$modifysubmitter', '$requestdate', '$country', '$keywords', '$item_tag', '$googlemap', '$yahoomap', '$multimap', '$street1', '$street2', '$town', '$state', '$zip', '$tel', '$fax', '$voip', '$mobile', '$email', '$vat')";
167
                if (!$result = $xoopsDB->query($sql)) {
168
                    $_error = $xoopsDB->error() . ' : ' . $xoopsDB->errno();
169
                    XoopsErrorHandler_HandleError(E_USER_WARNING, $_error, __FILE__, __LINE__);
170
                }
171
172
                $tags                      = array();
173
                $tags['MODIFYREPORTS_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/main.php?op=listModReq';
174
                $notificationHandler       = xoops_getHandler('notification');
175
                $notificationHandler->triggerEvent('global', 0, 'link_modify', $tags);
176
177
                $tags['WAITINGFILES_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/main.php?op=listNewlinks';
178
                $notificationHandler->triggerEvent('global', 0, 'link_submit', $tags);
179
                $notificationHandler->triggerEvent('category', $cid, 'link_submit', $tags);
180
                if ($notifypub) {
181
                    require_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
182
                    $notificationHandler->subscribe('link', $newid, 'approve', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE);
183
                }
184
                $_message = _MD_WFL_THANKSFORINFO;
185
            }
186
            redirect_header('index.php', 2, $_message);
187
        }
188
    } else {
189
        global $xoopsModuleConfig;
190
191
        $approve = wfl_cleanRequestVars($_REQUEST, 'approve', 0);
192
193
        //Show disclaimer
194
        if ($xoopsModuleConfig['showdisclaimer'] && !isset($_GET['agree']) && $approve == 0) {
195
            $GLOBALS['xoopsOption']['template_main'] = 'wflinks_disclaimer.tpl';
196
            include XOOPS_ROOT_PATH . '/header.php';
197
198
            $xoopsTpl->assign('image_header', wfl_imageheader());
199
            $xoopsTpl->assign('disclaimer', $wfmyts->displayTarea($xoopsModuleConfig['disclaimer'], 1, 1, 1, 1, 1));
200
            $xoopsTpl->assign('cancel_location', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/index.php');
201
            $xoopsTpl->assign('link_disclaimer', false);
202
            if (!isset($_REQUEST['lid'])) {
203
                $xoopsTpl->assign('agree_location', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/submit.php?agree=1');
204
            } elseif (isset($_REQUEST['lid'])) {
205
                $lid = (int)$_REQUEST['lid'];
206
                $xoopsTpl->assign('agree_location', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/submit.php?agree=1&amp;lid=' . $lid);
207
            }
208
            include XOOPS_ROOT_PATH . '/footer.php';
209
            exit();
210
        }
211
212
        echo "<br><div class='txtcenter;'>" . wfl_imageheader() . "</div><br>\n";
213
        echo '<div>' . _MD_WFL_SUB_SNEWMNAMEDESC . "</div>\n<br>\n";
214
215
        $sql        = 'SELECT * FROM ' . $xoopsDB->prefix('wflinks_links') . ' WHERE lid=' . $lid;
216
        $link_array = $xoopsDB->fetchArray($xoopsDB->query($sql));
217
218
        $lid          = $link_array['lid'] ?: 0;
219
        $cid          = $link_array['cid'] ?: 0;
220
        $title        = $link_array['title'] ? $wfmyts->htmlSpecialCharsStrip($link_array['title']) : '';
221
        $url          = $link_array['url'] ? $wfmyts->htmlSpecialCharsStrip($link_array['url']) : 'http://';
222
        $publisher    = $link_array['publisher'] ? $wfmyts->htmlSpecialCharsStrip($link_array['publisher']) : '';
223
        $screenshot   = $link_array['screenshot'] ? $wfmyts->htmlSpecialCharsStrip($link_array['screenshot']) : '';
224
        $descriptionb = $link_array['description'] ? $wfmyts->htmlSpecialCharsStrip($link_array['description']) : '';
225
        $published    = $link_array['published'] ?: 0;
226
        $expired      = $link_array['expired'] ?: 0;
227
        $updated      = $link_array['updated'] ?: 0;
228
        $offline      = $link_array['offline'] ?: 0;
229
        $forumid      = $link_array['forumid'] ?: 0;
230
        $ipaddress    = $link_array['ipaddress'] ?: 0;
231
        $notifypub    = $link_array['notifypub'] ?: 0;
232
        $country      = $link_array['country'] ? $wfmyts->htmlSpecialCharsStrip($link_array['country']) : '-';
233
        $keywords     = $link_array['keywords'] ? $wfmyts->htmlSpecialCharsStrip($link_array['keywords']) : '';
234
        $item_tag     = $link_array['item_tag'] ? $wfmyts->htmlSpecialCharsStrip($link_array['item_tag']) : '';
235
236
        $googlemap = $link_array['googlemap'] ? $wfmyts->htmlSpecialCharsStrip($link_array['googlemap']) : 'http://maps.google.com';
237
        $yahoomap  = $link_array['yahoomap'] ? $wfmyts->htmlSpecialCharsStrip($link_array['yahoomap']) : 'http://maps.yahoo.com';
238
        $multimap  = $link_array['multimap'] ? $wfmyts->htmlSpecialCharsStrip($link_array['multimap']) : 'http://www.multimap.com';
239
240
        $street1 = $link_array['street1'] ? $wfmyts->htmlSpecialCharsStrip($link_array['street1']) : '';
241
        $street2 = $link_array['street2'] ? $wfmyts->htmlSpecialCharsStrip($link_array['street2']) : '';
242
        $town    = $link_array['town'] ? $wfmyts->htmlSpecialCharsStrip($link_array['town']) : '';
243
        $state   = $link_array['state'] ? $wfmyts->htmlSpecialCharsStrip($link_array['state']) : '';
244
        $zip     = $link_array['zip'] ? $wfmyts->htmlSpecialCharsStrip($link_array['zip']) : '';
245
        $tel     = $link_array['tel'] ? $wfmyts->htmlSpecialCharsStrip($link_array['tel']) : '';
246
        $mobile  = $link_array['mobile'] ? $wfmyts->htmlSpecialCharsStrip($link_array['mobile']) : '';
247
        $voip    = $link_array['voip'] ? $wfmyts->htmlSpecialCharsStrip($link_array['voip']) : '';
248
        $fax     = $link_array['fax'] ? $wfmyts->htmlSpecialCharsStrip($link_array['fax']) : '';
249
        $email   = $link_array['email'] ? $wfmyts->htmlSpecialCharsStrip($link_array['email']) : '';
250
        $vat     = $link_array['vat'] ? $wfmyts->htmlSpecialCharsStrip($link_array['vat']) : '';
251
252
        $sform = new XoopsThemeForm(_MD_WFL_SUBMITCATHEAD, 'storyform', xoops_getenv('PHP_SELF'), 'post', true);
253
        $sform->setExtra('enctype="multipart/form-data"');
254
255
        // Title form
256
        $sform->addElement(new XoopsFormText(_MD_WFL_FILETITLE, 'title', 70, 255, $title), true);
257
258
        // Link url form
259
        $url_text = new XoopsFormText('', 'url', 70, 255, $url);
260
        $url_tray = new XoopsFormElementTray(_MD_WFL_DLURL, '');
261
        $url_tray->addElement($url_text, true);
262
        $url_tray->addElement(new XoopsFormLabel("&nbsp;<img src='" . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/assets/images/icon/world.png' onClick=\"window.open(document.storyform.url.value,'','');return(false);\" alt='Check URL'>"));
263
        $sform->addElement($url_tray);
264
265
        // Category selection menu
266
        $mytree     = new WflinksXoopsTree($xoopsDB->prefix('wflinks_cat'), 'cid', 'pid');
267
        $submitcats = array();
268
        $sql        = 'SELECT * FROM ' . $xoopsDB->prefix('wflinks_cat') . ' ORDER BY title';
269
        $result     = $xoopsDB->query($sql);
270
        while ($myrow = $xoopsDB->fetchArray($result)) {
271
            if (true === wfl_checkgroups($myrow['cid'], 'WFLinkSubPerm')) {
272
                $submitcats[$myrow['cid']] = $myrow['title'];
273
            }
274
        }
275
        ob_start();
276
        $mytree->makeMySelBox('title', 'title', $cid, 0);
277
        $sform->addElement(new XoopsFormLabel(_MD_WFL_CATEGORYC, ob_get_contents()));
278
        ob_end_clean();
279
280
        // Link description form
281
        //    $editor = wfl_getWysiwygForm( _MD_WFL_DESCRIPTIONC, 'descriptionb', $descriptionb, 15, 60 );
282
        //    $sform -> addElement($editor,false);
283
284
        $optionsTrayNote = new XoopsFormElementTray(_MD_WFL_DESCRIPTIONC, '<br>');
285
        if (class_exists('XoopsFormEditor')) {
286
            $options['name']   = 'descriptionb';
287
            $options['value']  = $descriptionb;
288
            $options['rows']   = 5;
289
            $options['cols']   = '100%';
290
            $options['width']  = '100%';
291
            $options['height'] = '200px';
292
            $editor            = new XoopsFormEditor('', $xoopsModuleConfig['form_optionsuser'], $options, $nohtml = false, $onfailure = 'textarea');
293
            $optionsTrayNote->addElement($editor);
294
        } else {
295
            $editor = new XoopsFormDhtmlTextArea('', 'descriptionb', $item->getVar('descriptionb', 'e'), '100%', '100%');
296
            $optionsTrayNote->addElement($editor);
297
        }
298
299
        $sform->addElement($optionsTrayNote, false);
300
301
        // Keywords form
302
        $keywords = new XoopsFormTextArea(_MD_WFL_KEYWORDS, 'keywords', $keywords, 7, 60, false);
303
        $keywords->setDescription('<small>' . _MD_WFL_KEYWORDS_NOTE . '</small>');
304
        $sform->addElement($keywords);
305
306
        // Insert tags if Tag-module is installed and if user is allowed
307 View Code Duplication
        if ($xoopsModuleConfig['usercantag']) {
308
            if (wfl_tag_module_included()) {
309
                require_once XOOPS_ROOT_PATH . '/modules/tag/include/formtag.php';
310
                $text_tags = new TagFormTag('item_tag', 70, 255, $link_array['item_tag'], 0);
311
                $sform->addElement($text_tags);
312
            } else {
313
                $sform->addElement(new XoopsFormHidden('item_tag', $link_array['item_tag']));
314
            }
315
        }
316
        if ($xoopsModuleConfig['useaddress']) {
317
            $sform->insertBreak(_MD_WFL_LINK_CREATEADDRESS, 'even');
318
            // Google Maps
319
            $googlemap_text = new XoopsFormText('', 'googlemap', 70, 1024, $googlemap);
320
            $googlemap_tray = new XoopsFormElementTray(_MD_WFL_LINK_GOOGLEMAP, '');
321
            $googlemap_tray->addElement($googlemap_text, false);
322
            $googlemap_tray->addElement(new XoopsFormLabel("&nbsp;<img src='" . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/assets/images/icon/google_map.png' onClick=\"window.open(document.storyform.googlemap.value,'','');return(false);\" alt='" . _MD_WFL_LINK_CHECKMAP . "'>"));
323
            $sform->addElement($googlemap_tray);
324
325
            // Yahoo Maps
326
            $yahoomap_text = new XoopsFormText('', 'yahoomap', 70, 1024, $yahoomap);
327
            $yahoomap_tray = new XoopsFormElementTray(_MD_WFL_LINK_YAHOOMAP, '');
328
            $yahoomap_tray->addElement($yahoomap_text, false);
329
            $yahoomap_tray->addElement(new XoopsFormLabel("&nbsp;<img src='" . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/assets/images/icon/yahoo_map.png' onClick=\"window.open(document.storyform.yahoomap.value,'','');return(false);\" alt='" . _MD_WFL_LINK_CHECKMAP . "'>"));
330
            $sform->addElement($yahoomap_tray);
331
332
            // Multimap
333
            $multimap_text = new XoopsFormText('', 'multimap', 70, 1024, $multimap);
334
            $multimap_tray = new XoopsFormElementTray(_MD_WFL_LINK_MULTIMAP, '');
335
            $multimap_tray->addElement($multimap_text, false);
336
            $multimap_tray->addElement(new XoopsFormLabel("&nbsp;<img src='" . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/assets/images/icon/multimap.png' onClick=\"window.open(document.storyform.multimap.value,'','');return(false);\" alt='" . _MD_WFL_LINK_CHECKMAP . "'>"));
337
            $sform->addElement($multimap_tray);
338
339
            // Address forms
340
            $street1 = new XoopsFormText(_MD_WFL_STREET1, 'street1', 70, 255, $street1);
341
            $sform->addElement($street1, false);
342
            $street2 = new XoopsFormText(_MD_WFL_STREET2, 'street2', 70, 255, $street2);
343
            $sform->addElement($street2, false);
344
            $town = new XoopsFormText(_MD_WFL_TOWN, 'town', 70, 255, $town);
345
            $sform->addElement($town, false);
346
            $state = new XoopsFormText(_MD_WFL_STATE, 'state', 70, 255, $state);
347
            $sform->addElement($state, false);
348
            $zip = new XoopsFormText(_MD_WFL_ZIPCODE, 'zip', 25, 25, $zip);
349
            $sform->addElement($zip, false);
350
            $tel = new XoopsFormText(_MD_WFL_TELEPHONE, 'tel', 25, 25, $tel);
351
            $sform->addElement($tel, false);
352
            $mobile = new XoopsFormText(_MD_WFL_MOBILE, 'mobile', 25, 25, $mobile);
353
            $sform->addElement($mobile, false);
354
            $voip = new XoopsFormText(_MD_WFL_VOIP, 'voip', 25, 25, $voip);
355
            $sform->addElement($voip, false);
356
            $fax = new XoopsFormText(_MD_WFL_FAX, 'fax', 25, 25, $fax);
357
            $sform->addElement($fax, false);
358
            $email = new XoopsFormText(_MD_WFL_EMAIL, 'email', 25, 25, $email);
359
            $sform->addElement($email, false);
360
            $vat = new XoopsFormText(_MD_WFL_VAT, 'vat', 25, 25, $vat);
361
            $vat->setDescription(_MD_WFL_VATWIKI);
362
            $sform->addElement($vat, false);
363
            //  $sform -> addElement( new XoopsFormHidden( 'vat', $link_array['vat'] ) ); /* If you don't want to use the VAT form,  */
364
            /* use this line and comment-out the 3 lines above  */
365
        }
366
367
        // Country form
368
        $sform->addElement(new XoopsFormSelectCountry(_MD_WFL_COUNTRY, 'country', $country), false);
369
370
        $option_tray = new XoopsFormElementTray(_MD_WFL_OPTIONS, '<br>');
371
        if (!$approve) {
372
            $notify_checkbox = new XoopsFormCheckBox('', 'notifypub');
373
            $notify_checkbox->addOption(1, _MD_WFL_NOTIFYAPPROVE);
374
            $option_tray->addElement($notify_checkbox);
375
        } else {
376
            $sform->addElement(new XoopsFormHidden('notifypub', 0));
377
        }
378
        if (true === wfl_checkgroups($cid, 'WFLinkAppPerm') && $lid > 0) {
379
            $approve_checkbox = new XoopsFormCheckBox('', 'approve', $approve);
380
            $approve_checkbox->addOption(1, _MD_WFL_APPROVE);
381
            $option_tray->addElement($approve_checkbox);
382
        } elseif (true === wfl_checkgroups($cid, 'WFLinkAutoApp')) {
383
            $sform->addElement(new XoopsFormHidden('approve', 1));
384
        } else {
385
            $sform->addElement(new XoopsFormHidden('approve', 0));
386
        }
387
        $sform->addElement($option_tray);
388
        $button_tray = new XoopsFormElementTray('', '');
389
        $button_tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
390
        $button_tray->addElement(new XoopsFormHidden('lid', $lid));
391
        $sform->addElement($button_tray);
392
        $sform->display();
393
        include XOOPS_ROOT_PATH . '/footer.php';
394
    }
395
} else {
396
    redirect_header('index.php', 2, _MD_WFL_NOPERMISSIONTOPOST);
397
}
398