mambax7 /
wflinks
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
| 1 | <?php |
||||||
| 2 | /** |
||||||
| 3 | * Module: WF-Links |
||||||
| 4 | * Version: v1.0.3 |
||||||
| 5 | * Release Date: 21 June 2005 |
||||||
| 6 | * Developer: John N |
||||||
| 7 | * Team: WF-Projects |
||||||
| 8 | * Licence: GNU |
||||||
| 9 | */ |
||||||
| 10 | |||||||
| 11 | use Xmf\Module\Admin; |
||||||
| 12 | use Xmf\Request; |
||||||
| 13 | use XoopsModules\Tag\FormTag; |
||||||
| 14 | use XoopsModules\Wflinks\{Helper, |
||||||
| 15 | Tree, |
||||||
| 16 | Utility |
||||||
| 17 | }; |
||||||
| 18 | |||||||
| 19 | require_once __DIR__ . '/admin_header.php'; |
||||||
| 20 | |||||||
| 21 | $mytree = new Tree($xoopsDB->prefix('wflinks_cat'), 'cid', 'pid'); |
||||||
| 22 | |||||||
| 23 | $op = \Xmf\Request::getString('op', ''); |
||||||
| 24 | $lid = \Xmf\Request::getInt('lid', 0); |
||||||
| 25 | |||||||
| 26 | /** |
||||||
| 27 | * @param int $lid |
||||||
| 28 | * @return bool|null |
||||||
| 29 | */ |
||||||
| 30 | function edit($lid = 0) |
||||||
| 31 | { |
||||||
| 32 | global $xoopsDB, $myts, $mytree, $imageArray, $xoopsConfig, $xoopsModule, $xoopsUser; |
||||||
| 33 | /** @var Helper $helper */ |
||||||
| 34 | $helper = Helper::getInstance(); |
||||||
| 35 | |||||||
| 36 | $sql = 'SELECT * FROM ' . $xoopsDB->prefix('wflinks_links') . ' WHERE lid=' . $lid; |
||||||
| 37 | if (!$result = $xoopsDB->query($sql)) { |
||||||
| 38 | /** @var \XoopsLogger $logger */ |
||||||
| 39 | $logger = \XoopsLogger::getInstance(); |
||||||
| 40 | $logger->handleError(E_USER_WARNING, $sql, __FILE__, __LINE__); |
||||||
| 41 | |||||||
| 42 | return false; |
||||||
| 43 | } |
||||||
| 44 | $link_array = $xoopsDB->fetchArray($xoopsDB->query($sql)); |
||||||
| 45 | |||||||
| 46 | $directory = $helper->getConfig('screenshots'); |
||||||
| 47 | $lid = $link_array['lid'] ?: 0; |
||||||
| 48 | $cid = $link_array['cid'] ?: 0; |
||||||
| 49 | $title = $link_array['title'] ? htmlspecialchars($link_array['title']) : ''; |
||||||
| 50 | $url = $link_array['url'] ? htmlspecialchars($link_array['url']) : 'http://'; |
||||||
| 51 | $publisher = $link_array['publisher'] ? htmlspecialchars($link_array['publisher']) : ''; |
||||||
| 52 | $submitter = $link_array['submitter'] ? htmlspecialchars($link_array['submitter']) : ''; |
||||||
| 53 | $screenshot = $link_array['screenshot'] ? htmlspecialchars($link_array['screenshot']) : ''; |
||||||
| 54 | $descriptionb = $link_array['description'] ? htmlspecialchars($link_array['description']) : ''; |
||||||
| 55 | $published = $link_array['published'] ?: time(); |
||||||
| 56 | $expired = $link_array['expired'] ?: 0; |
||||||
| 57 | $updated = $link_array['updated'] ?: 0; |
||||||
| 58 | $offline = $link_array['offline'] ?: 0; |
||||||
| 59 | $forumid = $link_array['forumid'] ?: 0; |
||||||
| 60 | $ipaddress = $link_array['ipaddress'] ?: 0; |
||||||
| 61 | $notifypub = $link_array['notifypub'] ?: 0; |
||||||
| 62 | $country = $link_array['country'] ? htmlspecialchars($link_array['country']) : '-'; |
||||||
| 63 | $keywords = $link_array['keywords'] ? htmlspecialchars($link_array['keywords']) : ''; |
||||||
| 64 | $item_tag = $link_array['item_tag'] ? htmlspecialchars($link_array['item_tag']) : ''; |
||||||
| 65 | $googlemap = $link_array['googlemap'] ? htmlspecialchars($link_array['googlemap']) : 'http://maps.google.com'; |
||||||
| 66 | $yahoomap = $link_array['yahoomap'] ? htmlspecialchars($link_array['yahoomap']) : 'http://maps.yahoo.com'; |
||||||
| 67 | $multimap = $link_array['multimap'] ? htmlspecialchars($link_array['multimap']) : 'http://www.multimap.com'; |
||||||
| 68 | $street1 = $link_array['street1'] ? htmlspecialchars($link_array['street1']) : ''; |
||||||
| 69 | $street2 = $link_array['street2'] ? htmlspecialchars($link_array['street2']) : ''; |
||||||
| 70 | $town = $link_array['town'] ? htmlspecialchars($link_array['town']) : ''; |
||||||
| 71 | $state = $link_array['state'] ? htmlspecialchars($link_array['state']) : ''; |
||||||
| 72 | $zip = $link_array['zip'] ? htmlspecialchars($link_array['zip']) : ''; |
||||||
| 73 | $tel = $link_array['tel'] ? htmlspecialchars($link_array['tel']) : ''; |
||||||
| 74 | $mobile = $link_array['mobile'] ? htmlspecialchars($link_array['mobile']) : ''; |
||||||
| 75 | $voip = $link_array['voip'] ? htmlspecialchars($link_array['voip']) : ''; |
||||||
| 76 | $fax = $link_array['fax'] ? htmlspecialchars($link_array['fax']) : ''; |
||||||
| 77 | $email = $link_array['email'] ? htmlspecialchars($link_array['email']) : ''; |
||||||
| 78 | $vat = $link_array['vat'] ? htmlspecialchars($link_array['vat']) : ''; |
||||||
| 79 | |||||||
| 80 | require_once __DIR__ . '/admin_header.php'; |
||||||
| 81 | xoops_cp_header(); |
||||||
| 82 | xoops_load('XoopsUserUtility'); |
||||||
| 83 | |||||||
| 84 | if ($lid > 0) { |
||||||
| 85 | $_vote_data = Utility::getVoteDetails($lid); |
||||||
| 86 | $text_info = "<table style='width:100%;'> |
||||||
| 87 | <tr> |
||||||
| 88 | <td width='33%' valign='top'> |
||||||
| 89 | <div><b>" . _AM_WFL_LINK_ID . ' </b>' . $lid . '</div> |
||||||
| 90 | <div><b>' . _AM_WFL_MINDEX_SUBMITTED . ': </b>' . formatTimestamp($link_array['date'], $helper->getConfig('dateformat')) . '</div> |
||||||
| 91 | <div><b>' . _AM_WFL_LINK_SUBMITTER . ' </b>' . \XoopsUserUtility::getUnameFromId($submitter) . '</div> |
||||||
| 92 | <div><b>' . _AM_WFL_LINK_IP . ' </b>' . $ipaddress . '</div> |
||||||
| 93 | <div><b>' . _AM_WFL_PAGERANK . ' </b>' . Utility::pagerank($link_array['url']) . '</div> |
||||||
| 94 | <div><b>' . _AM_WFL_HITS . ' </b>' . $link_array['hits'] . "</div> |
||||||
| 95 | |||||||
| 96 | </td> |
||||||
| 97 | <td valign='top'> |
||||||
| 98 | <div><b>" . _AM_WFL_VOTE_TOTALRATE . ': </b>' . Request::getInt('rate', 0, 'vote_data') . '</div> |
||||||
| 99 | <div><b>' . _AM_WFL_VOTE_USERAVG . ': </b>' . (int)round($_vote_data['avg_rate'], 2) . '</div> |
||||||
| 100 | <div><b>' . _AM_WFL_VOTE_MAXRATE . ': </b>' . Request::getInt('min_rate', 0, 'vote_data') . '</div> |
||||||
| 101 | <div><b>' . _AM_WFL_VOTE_MINRATE . ': </b>' . Request::getInt('max_rate', 0, 'vote_data') . "</div> |
||||||
| 102 | </td> |
||||||
| 103 | <td valign='top'> |
||||||
| 104 | <div><b>" . _AM_WFL_VOTE_MOSTVOTEDTITLE . ': </b>' . Request::getInt('max_title', 0, 'vote_data') . '</div> |
||||||
| 105 | <div><b>' . _AM_WFL_VOTE_LEASTVOTEDTITLE . ': </b>' . Request::getInt('min_title', 0, 'vote_data') . '</div> |
||||||
| 106 | <div><b>' . _AM_WFL_VOTE_REGISTERED . ': </b>' . ($_vote_data['rate'] - $_vote_data['null_ratinguser']) . '</div> |
||||||
| 107 | <div><b>' . _AM_WFL_VOTE_NONREGISTERED . ': </b>' . Request::getInt('null_ratinguser', 0, 'vote_data') . '</div> |
||||||
| 108 | </td> |
||||||
| 109 | </tr> |
||||||
| 110 | </table>'; |
||||||
| 111 | echo "<fieldset style='border: #e8e8e8 1px solid;'><legend style='display: inline; font-weight: bold; color: #0A3760;'>" . _AM_WFL_INFORMATION . "</legend>\n |
||||||
| 112 | <div style='padding: 8px;'>" . $text_info . "</div>\n |
||||||
| 113 | <!-- <div style='padding: 8px;'><li>" . $imageArray['deleteimg'] . ' ' . _AM_WFL_VOTE_DELETEDSC . "</li></div>\n --> |
||||||
| 114 | </fieldset>\n |
||||||
| 115 | <br>\n"; |
||||||
| 116 | } |
||||||
| 117 | unset($_vote_data); |
||||||
| 118 | |||||||
| 119 | $caption = $lid ? _AM_WFL_LINK_MODIFYFILE : _AM_WFL_LINK_CREATENEWFILE; |
||||||
| 120 | $sform = new \XoopsThemeForm($caption, 'storyform', xoops_getenv('SCRIPT_NAME'), 'post', true); |
||||||
| 121 | $sform->setExtra('enctype="multipart / form - data"'); |
||||||
| 122 | |||||||
| 123 | if ('' === $submitter) { |
||||||
| 124 | $sform->addElement(new \XoopsFormHidden('submitter', $submitter)); |
||||||
| 125 | } |
||||||
| 126 | |||||||
| 127 | // Link publisher form |
||||||
| 128 | if ($publisher) { |
||||||
| 129 | $sform->addElement(new \XoopsFormText(_AM_WFL_LINK_PUBLISHER, 'publisher', 70, 255, $publisher)); |
||||||
| 130 | //$sform -> addElement( new \XoopsFormHidden( 'publisher', $publisher ) ) ; |
||||||
| 131 | } else { |
||||||
| 132 | $publisher = $xoopsUser->uname(); |
||||||
| 133 | $sform->addElement(new \XoopsFormHidden('publisher', $publisher)); |
||||||
| 134 | } |
||||||
| 135 | |||||||
| 136 | // Link title form |
||||||
| 137 | $sform->addElement(new \XoopsFormText(_AM_WFL_LINK_TITLE, 'title', 70, 255, $title), true); |
||||||
| 138 | |||||||
| 139 | // Link url form |
||||||
| 140 | $url_text = new \XoopsFormText('', 'url', 70, 255, $url); |
||||||
| 141 | $url_tray = new \XoopsFormElementTray(_AM_WFL_LINK_DLURL, ''); |
||||||
| 142 | $url_tray->addElement($url_text, true); |
||||||
| 143 | $url_tray->addElement(new \XoopsFormLabel(" <img src='../assets/images/icon/world.png' onClick=\"window.open(document.storyform.url.value,'','');return(false);\" alt='Check URL'>")); |
||||||
| 144 | $sform->addElement($url_tray); |
||||||
| 145 | |||||||
| 146 | // Category form |
||||||
| 147 | ob_start(); |
||||||
| 148 | $mytree->makeMySelBox('title', 'title', $cid, 0); |
||||||
| 149 | $sform->addElement(new \XoopsFormLabel(_AM_WFL_LINK_CATEGORY, ob_get_clean())); |
||||||
| 150 | |||||||
| 151 | // Link description form |
||||||
| 152 | // $editor = Utility::getWysiwygForm( _AM_WFL_LINK_DESCRIPTION, 'descriptionb', $descriptionb, 15, 60 ); |
||||||
| 153 | // $sform -> addElement($editor, false); |
||||||
| 154 | $optionsTrayNote = new \XoopsFormElementTray(_AM_WFL_LINK_DESCRIPTION, '<br>'); |
||||||
| 155 | if (class_exists('XoopsFormEditor')) { |
||||||
| 156 | $options['name'] = 'descriptionb'; |
||||||
| 157 | $options['value'] = $descriptionb; |
||||||
| 158 | $options['rows'] = 5; |
||||||
| 159 | $options['cols'] = '100%'; |
||||||
| 160 | $options['width'] = '100%'; |
||||||
| 161 | $options['height'] = '200px'; |
||||||
| 162 | $descriptionb = new \XoopsFormEditor('', $helper->getConfig('form_options'), $options, $nohtml = false, $onfailure = 'textarea'); |
||||||
| 163 | $optionsTrayNote->addElement($descriptionb); |
||||||
| 164 | } else { |
||||||
| 165 | $descriptionb = new \XoopsFormDhtmlTextArea('', 'descriptionb', $item->getVar('descriptionb', 'e'), '100%', '100%'); |
||||||
| 166 | $optionsTrayNote->addElement($descriptionb); |
||||||
| 167 | } |
||||||
| 168 | |||||||
| 169 | $sform->addElement($optionsTrayNote, false); |
||||||
| 170 | |||||||
| 171 | // Meta keywords form |
||||||
| 172 | $keywords = new \XoopsFormTextArea(_AM_WFL_KEYWORDS, 'keywords', $keywords, 7, 60, false); |
||||||
| 173 | $keywords->setDescription('<small>' . _AM_WFL_KEYWORDS_NOTE . '</small>'); |
||||||
| 174 | $sform->addElement($keywords); |
||||||
| 175 | |||||||
| 176 | // Insert tags if Tag-module is installed |
||||||
| 177 | if (Utility::isTagModuleIncluded()) { |
||||||
| 178 | require_once XOOPS_ROOT_PATH . '/modules/tag/include/formtag.php'; |
||||||
| 179 | $text_tags = new FormTag('item_tag', 70, 255, $link_array['item_tag'], 0); |
||||||
| 180 | $sform->addElement($text_tags); |
||||||
| 181 | } else { |
||||||
| 182 | $sform->addElement(new \XoopsFormHidden('item_tag', $link_array['item_tag'])); |
||||||
| 183 | } |
||||||
| 184 | |||||||
| 185 | // Screenshot |
||||||
| 186 | $graph_array = Wflinks\Lists::getListTypeAsArray(XOOPS_ROOT_PATH . '/' . $helper->getConfig('screenshots'), $type = 'images'); |
||||||
|
0 ignored issues
–
show
|
|||||||
| 187 | $indeximage_select = new \XoopsFormSelect('', 'screenshot', $screenshot); |
||||||
| 188 | $indeximage_select->addOptionArray($graph_array); |
||||||
| 189 | $indeximage_select->setExtra("onchange = 'showImgSelected(\"image\", \"screenshot\", \"" . $helper->getConfig('screenshots') . '", "", "' . XOOPS_URL . "\")'"); |
||||||
| 190 | $indeximage_tray = new \XoopsFormElementTray(_AM_WFL_LINK_SHOTIMAGE, ' '); |
||||||
| 191 | $indeximage_tray->setDescription(sprintf(_AM_WFL_LINK_MUSTBEVALID, '<b>' . $directory . '</b>')); |
||||||
| 192 | $indeximage_tray->addElement($indeximage_select); |
||||||
| 193 | if (!empty($imgurl)) { |
||||||
| 194 | $indeximage_tray->addElement(new \XoopsFormLabel('', " <br><br>< img src='" . XOOPS_URL . '/' . $helper->getConfig('screenshots') . '/' . $screenshot . "' name = 'image' id = 'image' alt = '' / > ")); |
||||||
| 195 | } else { |
||||||
| 196 | $indeximage_tray->addElement(new \XoopsFormLabel('', " <br><br><img src='" . XOOPS_URL . "/uploads/blank.gif' name='image' id='image' alt='' / > ")); |
||||||
| 197 | } |
||||||
| 198 | $sform->addElement($indeximage_tray); |
||||||
| 199 | |||||||
| 200 | if ($helper->getConfig('useaddress')) { |
||||||
| 201 | $sform->insertBreak(_AM_WFL_LINK_CREATEADDRESS, 'bg3'); |
||||||
| 202 | // Google Maps |
||||||
| 203 | $googlemap_text = new \XoopsFormText('', 'googlemap', 70, 1024, $googlemap); |
||||||
| 204 | $googlemap_tray = new \XoopsFormElementTray(_AM_WFL_LINK_GOOGLEMAP, ''); |
||||||
| 205 | $googlemap_tray->addElement($googlemap_text, false); |
||||||
| 206 | $googlemap_tray->addElement(new \XoopsFormLabel(" <img src='../assets/images/icon/google_map.png' onClick=\"window.open(document.storyform.googlemap.value,'','');return(false);\" alt='" . _AM_WFL_LINK_CHECKMAP . "'>")); |
||||||
| 207 | $sform->addElement($googlemap_tray); |
||||||
| 208 | // Yahoo Maps |
||||||
| 209 | $yahoomap_text = new \XoopsFormText('', 'yahoomap', 70, 1024, $yahoomap); |
||||||
| 210 | $yahoomap_tray = new \XoopsFormElementTray(_AM_WFL_LINK_YAHOOMAP, ''); |
||||||
| 211 | $yahoomap_tray->addElement($yahoomap_text, false); |
||||||
| 212 | $yahoomap_tray->addElement(new \XoopsFormLabel(" <img src='../assets/images/icon/yahoo_map.png' onClick=\"window.open(document.storyform.yahoomap.value,'','');return(false);\" alt='" . _AM_WFL_LINK_CHECKMAP . "'>")); |
||||||
| 213 | $sform->addElement($yahoomap_tray); |
||||||
| 214 | // MS Live Maps |
||||||
| 215 | $multimap_text = new \XoopsFormText('', 'multimap', 70, 1024, $multimap); |
||||||
| 216 | $multimap_tray = new \XoopsFormElementTray(_AM_WFL_LINK_MULTIMAP, ''); |
||||||
| 217 | $multimap_tray->addElement($multimap_text, false); |
||||||
| 218 | $multimap_tray->addElement(new \XoopsFormLabel(" <img src='../assets/images/icon/multimap.png' onClick=\"window.open(document.storyform.multimap.value,'','');return(false);\" alt='" . _AM_WFL_LINK_CHECKMAP . "'>")); |
||||||
| 219 | $sform->addElement($multimap_tray); |
||||||
| 220 | |||||||
| 221 | // Address |
||||||
| 222 | $street1 = new \XoopsFormText(_AM_WFL_STREET1, 'street1', 70, 255, $street1); |
||||||
| 223 | $sform->addElement($street1, false); |
||||||
| 224 | $street2 = new \XoopsFormText(_AM_WFL_STREET2, 'street2', 70, 255, $street2); |
||||||
| 225 | $sform->addElement($street2, false); |
||||||
| 226 | $town = new \XoopsFormText(_AM_WFL_TOWN, 'town', 70, 255, $town); |
||||||
| 227 | $sform->addElement($town, false); |
||||||
| 228 | $state = new \XoopsFormText(_AM_WFL_STATE, 'state', 70, 255, $state); |
||||||
| 229 | $sform->addElement($state, false); |
||||||
| 230 | $zip = new \XoopsFormText(_AM_WFL_ZIPCODE, 'zip', 25, 25, $zip); |
||||||
| 231 | $sform->addElement($zip, false); |
||||||
| 232 | $tel = new \XoopsFormText(_AM_WFL_TELEPHONE, 'tel', 25, 25, $tel); |
||||||
| 233 | $sform->addElement($tel, false); |
||||||
| 234 | $mobile = new \XoopsFormText(_AM_WFL_MOBILE, 'mobile', 25, 25, $mobile); |
||||||
| 235 | $sform->addElement($mobile, false); |
||||||
| 236 | $voip = new \XoopsFormText(_AM_WFL_VOIP, 'voip', 25, 25, $voip); |
||||||
| 237 | $sform->addElement($voip, false); |
||||||
| 238 | $fax = new \XoopsFormText(_AM_WFL_FAX, 'fax', 25, 25, $fax); |
||||||
| 239 | $sform->addElement($fax, false); |
||||||
| 240 | $email = new \XoopsFormText(_AM_WFL_EMAIL, 'email', 25, 60, $email); |
||||||
| 241 | $sform->addElement($email, false); |
||||||
| 242 | $vat = new \XoopsFormText(_AM_WFL_VAT, 'vat', 25, 25, $vat); |
||||||
| 243 | $vat->setDescription(_AM_WFL_VATWIKI); |
||||||
| 244 | $sform->addElement($vat, false); |
||||||
| 245 | // $sform -> addElement( new \XoopsFormHidden( 'vat', $link_array['vat'] ) ); /* If you don't want to use the VAT form, */ |
||||||
| 246 | /* use this line and comment-out the 3 lines above */ |
||||||
| 247 | } |
||||||
| 248 | |||||||
| 249 | // Country form |
||||||
| 250 | $country_select = new \XoopsFormSelectCountry(_AM_WFL_COUNTRY, 'country', $country); |
||||||
| 251 | $sform->addElement($country_select, false); |
||||||
| 252 | |||||||
| 253 | // Miscellaneous Link settings |
||||||
| 254 | $sform->insertBreak(_AM_WFL_LINK_MISCLINKSETTINGS, 'bg3'); |
||||||
| 255 | |||||||
| 256 | // Set Publish date |
||||||
| 257 | $sform->addElement(new \XoopsFormDateTime(_AM_WFL_LINK_SETPUBLISHDATE, 'was_published', $size = 15, $published)); |
||||||
| 258 | |||||||
| 259 | if ($lid) { |
||||||
| 260 | $sform->addElement(new \XoopsFormHidden('was_published', $published)); |
||||||
| 261 | $sform->addElement(new \XoopsFormHidden('was_expired', $expired)); |
||||||
| 262 | } |
||||||
| 263 | |||||||
| 264 | // Set Expire date |
||||||
| 265 | $isexpired = ($expired > time()) ? 1 : 0; |
||||||
| 266 | $expiredates = ($expired > time()) ? _AM_WFL_LINK_EXPIREDATESET . formatTimestamp($expired, $helper->getConfig('dateformat')) : _AM_WFL_LINK_SETDATETIMEEXPIRE; |
||||||
| 267 | $warning = ($published > $expired && $expired > time()) ? _AM_WFL_LINK_EXPIREWARNING : ''; |
||||||
| 268 | $expiredate_checkbox = new \XoopsFormCheckBox('', 'expiredateactivate', $isexpired); |
||||||
| 269 | $expiredate_checkbox->addOption(1, $expiredates . ' <br> <br> '); |
||||||
| 270 | |||||||
| 271 | $expiredate_tray = new \XoopsFormElementTray(_AM_WFL_LINK_EXPIREDATE . $warning, ''); |
||||||
| 272 | $expiredate_tray->addElement($expiredate_checkbox); |
||||||
| 273 | $expiredate_tray->addElement(new \XoopsFormDateTime(_AM_WFL_LINK_SETEXPIREDATE . ' <br> ', 'expired', 15, $expired)); |
||||||
| 274 | $expiredate_tray->addElement(new \XoopsFormRadioYN(_AM_WFL_LINK_CLEAREXPIREDATE, 'clearexpire', 0, ' ' . _YES . '', ' ' . _NO . '')); |
||||||
| 275 | $sform->addElement($expiredate_tray); |
||||||
| 276 | |||||||
| 277 | // Set Link offline |
||||||
| 278 | $linkstatus_radio = new \XoopsFormRadioYN(_AM_WFL_LINK_FILESSTATUS, 'offline', $offline, ' ' . _YES . '', ' ' . _NO . ''); |
||||||
| 279 | $sform->addElement($linkstatus_radio); |
||||||
| 280 | |||||||
| 281 | // Set Link updated |
||||||
| 282 | $up_dated = (0 == $updated) ? 0 : 1; |
||||||
| 283 | $link_updated_radio = new \XoopsFormRadioYN(_AM_WFL_LINK_SETASUPDATED, 'up_dated', $up_dated, ' ' . _YES . '', ' ' . _NO . ''); |
||||||
| 284 | $sform->addElement($link_updated_radio); |
||||||
| 285 | |||||||
| 286 | $result = $xoopsDB->query('SELECT COUNT( * ) FROM ' . $xoopsDB->prefix('wflinks_broken') . ' WHERE lid = ' . $lid); |
||||||
| 287 | list($broken_count) = $xoopsDB->fetchRow($result); |
||||||
| 288 | if ($broken_count > 0) { |
||||||
| 289 | $link_updated_radio = new \XoopsFormRadioYN(_AM_WFL_LINK_DELEDITMESS, 'delbroken', 1, ' ' . _YES . '', ' ' . _NO . ''); |
||||||
| 290 | $sform->addElement($link_updated_radio); |
||||||
| 291 | } |
||||||
| 292 | |||||||
| 293 | // Select forum |
||||||
| 294 | ob_start(); |
||||||
| 295 | Wflinks\Lists::getForum($helper->getConfig('selectforum'), $forumid); |
||||||
| 296 | $sform->addElement(new \XoopsFormLabel(_AM_WFL_LINK_DISCUSSINFORUM, ob_get_clean())); |
||||||
| 297 | |||||||
| 298 | //Create News Story |
||||||
| 299 | if (Utility::isNewsModuleIncluded()) { |
||||||
| 300 | $sform->insertBreak(_AM_WFL_LINK_CREATENEWSSTORY, 'bg3'); |
||||||
| 301 | $submitNews_radio = new \XoopsFormRadioYN(_AM_WFL_LINK_SUBMITNEWS, 'submitnews', 0, ' ' . _YES . '', ' ' . _NO . ''); |
||||||
| 302 | $sform->addElement($submitNews_radio); |
||||||
| 303 | |||||||
| 304 | require_once XOOPS_ROOT_PATH . '/class/xoopstopic.php'; |
||||||
| 305 | $xt = new \XoopsTopic($xoopsDB->prefix('news_topics')); |
||||||
| 306 | ob_start(); |
||||||
| 307 | $xt->makeTopicSelBox(1, 0, 'newstopicid'); |
||||||
| 308 | $sform->addElement(new \XoopsFormLabel(_AM_WFL_LINK_NEWSCATEGORY, ob_get_clean())); |
||||||
| 309 | $sform->addElement(new \XoopsFormText(_AM_WFL_LINK_NEWSTITLE, 'topic_id', 70, 255, ''), false); |
||||||
| 310 | } |
||||||
| 311 | |||||||
| 312 | if ($lid && 0 == $published) { |
||||||
| 313 | $approved = (0 == $published) ? 0 : 1; |
||||||
| 314 | $approve_checkbox = new \XoopsFormCheckBox(_AM_WFL_LINK_EDITAPPROVE, 'approved', 1); |
||||||
| 315 | $approve_checkbox->addOption(1, ' '); |
||||||
| 316 | $sform->addElement($approve_checkbox); |
||||||
| 317 | } |
||||||
| 318 | |||||||
| 319 | if ($lid) { |
||||||
| 320 | $buttonTray = new \XoopsFormElementTray('', ''); |
||||||
| 321 | $buttonTray->addElement(new \XoopsFormHidden('lid', $lid)); |
||||||
| 322 | $buttonTray->addElement(new \XoopsFormHidden('status', 2)); |
||||||
| 323 | $hidden = new \XoopsFormHidden('op', 'save'); |
||||||
| 324 | $buttonTray->addElement($hidden); |
||||||
| 325 | |||||||
| 326 | $butt_dup = new \XoopsFormButton('', '', _AM_WFL_BMODIFY, 'submit'); |
||||||
| 327 | $butt_dup->setExtra('onclick="this . form . elements . op . value = \'save\'"'); |
||||||
| 328 | $buttonTray->addElement($butt_dup); |
||||||
| 329 | $butt_dupct = new \XoopsFormButton('', '', _AM_WFL_BDELETE, 'submit'); |
||||||
| 330 | $butt_dupct->setExtra('onclick="this.form.elements.op.value=\'delete\'"'); |
||||||
| 331 | $buttonTray->addElement($butt_dupct); |
||||||
| 332 | $butt_dupct2 = new \XoopsFormButton('', '', _AM_WFL_BCANCEL, 'submit'); |
||||||
| 333 | $butt_dupct2->setExtra('onclick="this.form.elements.op.value=\'linksConfigMenu\'"'); |
||||||
| 334 | $buttonTray->addElement($butt_dupct2); |
||||||
| 335 | $sform->addElement($buttonTray); |
||||||
| 336 | } else { |
||||||
| 337 | $buttonTray = new \XoopsFormElementTray('', ''); |
||||||
| 338 | $buttonTray->addElement(new \XoopsFormHidden('status', 1)); |
||||||
| 339 | $buttonTray->addElement(new \XoopsFormHidden('notifypub', $notifypub)); |
||||||
| 340 | $buttonTray->addElement(new \XoopsFormHidden('op', 'save')); |
||||||
| 341 | $buttonTray->addElement(new \XoopsFormButton('', '', _AM_WFL_BSAVE, 'submit')); |
||||||
| 342 | $sform->addElement($buttonTray); |
||||||
| 343 | } |
||||||
| 344 | $sform->display(); |
||||||
| 345 | unset($hidden); |
||||||
| 346 | require_once __DIR__ . '/admin_footer.php'; |
||||||
| 347 | |||||||
| 348 | return null; |
||||||
| 349 | } |
||||||
| 350 | |||||||
| 351 | /** |
||||||
| 352 | * @param $url |
||||||
| 353 | * @param int $timeout |
||||||
| 354 | * |
||||||
| 355 | * @return float|null|string |
||||||
| 356 | */ |
||||||
| 357 | function fetchURL($url, $timeout = 2) |
||||||
| 358 | { |
||||||
| 359 | /** @var Helper $helper */ |
||||||
| 360 | $helper = Helper::getInstance(); |
||||||
| 361 | $url = urldecode($url); |
||||||
| 362 | $url_parsed = parse_url($url); |
||||||
| 363 | if (!isset($url_parsed['host'])) { |
||||||
| 364 | return ''; |
||||||
| 365 | } |
||||||
| 366 | |||||||
| 367 | $host = $url_parsed['host']; |
||||||
| 368 | $host = preg_replace('#http://#', '', $host); |
||||||
| 369 | $port = $url_parsed['port'] ?? 80; |
||||||
| 370 | // Open the socket |
||||||
| 371 | $handle = @fsockopen('http://' . $host, $port, $errno, $errstr, $timeout); |
||||||
| 372 | if (!$handle) { |
||||||
| 373 | return null; |
||||||
| 374 | } |
||||||
| 375 | |||||||
| 376 | // Set read timeout |
||||||
| 377 | stream_set_timeout($handle, $timeout); |
||||||
| 378 | for ($i = 0; $i < 1; ++$i) { |
||||||
|
0 ignored issues
–
show
++$i is not reachable.
This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed. Unreachable code is most often the result of function fx() {
try {
doSomething();
return true;
}
catch (\Exception $e) {
return false;
}
return false;
}
In the above example, the last Loading history...
|
|||||||
| 379 | // Time the responce |
||||||
| 380 | list($usec, $sec) = explode(' ', microtime(true)); |
||||||
| 381 | $start = (float)$usec + (float)$sec; |
||||||
| 382 | // send somthing |
||||||
| 383 | $write = fwrite($handle, "return ping\n"); |
||||||
| 384 | if (!$write) { |
||||||
| 385 | return ''; |
||||||
| 386 | } |
||||||
| 387 | fread($handle, 1024); |
||||||
| 388 | // Work out if we got a responce and time it |
||||||
| 389 | list($usec, $sec) = explode(' ', microtime(true)); |
||||||
| 390 | $laptime = ((float)$usec + (float)$sec) - $start; |
||||||
| 391 | if ($laptime > $timeout) { |
||||||
| 392 | return 'No Reply'; |
||||||
| 393 | } |
||||||
| 394 | |||||||
| 395 | return round($laptime, 3); |
||||||
| 396 | } |
||||||
| 397 | fclose($handle); |
||||||
| 398 | |||||||
| 399 | return null; |
||||||
| 400 | } |
||||||
| 401 | |||||||
| 402 | switch (mb_strtolower($op)) { |
||||||
| 403 | case 'pingtime': |
||||||
| 404 | case 'is_broken': |
||||||
| 405 | |||||||
| 406 | $_type = ('pingtime' === $op) ? 'is_broken' : 'pingtime'; |
||||||
| 407 | |||||||
| 408 | $start = \Xmf\Request::getInt('start', 0); |
||||||
| 409 | $ping = \Xmf\Request::getInt('ping', 0); |
||||||
| 410 | $cid = \Xmf\Request::getInt('cid', 0); |
||||||
| 411 | |||||||
| 412 | $sql = 'SELECT * FROM ' . $xoopsDB->prefix('wflinks_links'); |
||||||
| 413 | if ($cid > 0) { |
||||||
| 414 | $sql .= ' WHERE cid=' . $cid; |
||||||
| 415 | } |
||||||
| 416 | $sql .= ' ORDER BY lid DESC'; |
||||||
| 417 | if (!$result = $xoopsDB->query($sql)) { |
||||||
| 418 | /** @var \XoopsLogger $logger */ |
||||||
| 419 | $logger = \XoopsLogger::getInstance(); |
||||||
| 420 | $logger->handleError(E_USER_WARNING, $sql, __FILE__, __LINE__); |
||||||
| 421 | |||||||
| 422 | return false; |
||||||
| 423 | } |
||||||
| 424 | $broken_array = $xoopsDB->query($sql, $helper->getConfig('admin_perpage'), $start); |
||||||
| 425 | $broken_array_count = $xoopsDB->getRowsNum($result); |
||||||
| 426 | |||||||
| 427 | $heading = ('pingtime' === $op) ? _AM_WFL_PINGTIMES : _AM_WFL_LISTBROKEN; |
||||||
| 428 | |||||||
| 429 | require_once __DIR__ . '/admin_header.php'; |
||||||
| 430 | xoops_cp_header(); |
||||||
| 431 | |||||||
| 432 | echo " |
||||||
| 433 | <table width='100%' cellspacing='1' cellpadding='2' border='0' class='outer'>\n |
||||||
| 434 | <tr>\n |
||||||
| 435 | <th class='txtcenter;'>" . _AM_WFL_MINDEX_ID . "</th>\n |
||||||
| 436 | <th style='text-align: left;'>" . _AM_WFL_MINDEX_TITLE . "</th>\n |
||||||
| 437 | <th class='txtcenter;'>" . _AM_WFL_MINDEX_POSTER . "</th>\n |
||||||
| 438 | <th class='txtcenter;'>" . _AM_WFL_MINDEX_PUBLISHED . "</th>\n |
||||||
| 439 | <th class='txtcenter;'>" . _AM_WFL_MINDEX_RESPONSE . "</th>\n |
||||||
| 440 | <th class='txtcenter;'>PR</th>\n |
||||||
| 441 | <th class='txtcenter;'>" . _AM_WFL_MINDEX_ACTION . "</th>\n |
||||||
| 442 | </tr>\n |
||||||
| 443 | "; |
||||||
| 444 | |||||||
| 445 | if ($broken_array_count > 0) { |
||||||
| 446 | while (false !== ($published = $xoopsDB->fetchArray($broken_array))) { |
||||||
| 447 | $_ping_results = fetchURL($published['url']); |
||||||
| 448 | |||||||
| 449 | if ($_ping_results) { |
||||||
| 450 | $_ping_results .= '(s)'; |
||||||
| 451 | } else { |
||||||
| 452 | $_ping_results = _AM_WFL_LINK_NORESPONSE; |
||||||
| 453 | } |
||||||
| 454 | |||||||
| 455 | $lid = $published['lid']; |
||||||
| 456 | $cid = $published['cid']; |
||||||
| 457 | $title = "<a href='../singlelink.php?cid=" . $published['cid'] . '&lid=' . $published['lid'] . "'>" . htmlspecialchars(trim($published['title'])) . '</a>'; |
||||||
| 458 | |||||||
| 459 | $maintitle = urlencode(htmlspecialchars(trim($published['title']))); |
||||||
| 460 | $submitter = \XoopsUserUtility::getUnameFromId($published['submitter']); |
||||||
| 461 | $publish = formatTimestamp($published['published'], $helper->getConfig('dateformatadmin')); |
||||||
| 462 | $status = ($published['published'] > 0) ? $imageArray['online'] : "<a href='newlinks.php'>" . $imageArray['offline'] . '</a>'; |
||||||
| 463 | $icon = "<a href='main.php?op=edit&lid=" . $lid . "'>" . $imageArray['editimg'] . '</a> '; |
||||||
| 464 | $icon .= "<a href='main.php?op=delete&lid=" . $lid . "'>" . $imageArray['deleteimg'] . '</a>'; |
||||||
| 465 | echo "<tr class='txtcenter;'>\n |
||||||
| 466 | <td class='head'><small>" . $lid . "</small></td>\n |
||||||
| 467 | <td class='even' style='text-align: left;'><small>" . $title . "</small></td>\n |
||||||
| 468 | <td class='even'><small>" . $submitter . "</small></td>\n |
||||||
| 469 | <td class='even'><small>" . $publish . "</small></td>\n |
||||||
| 470 | <td class='even'><small>" . $_ping_results . "</small></td>\n |
||||||
| 471 | <td class='even'><small>" . Utility::pagerank($published['url']) . "</small></td>\n |
||||||
| 472 | <td class='even'>$icon</td>\n |
||||||
| 473 | </tr>\n"; |
||||||
| 474 | unset($published); |
||||||
| 475 | } |
||||||
| 476 | } else { |
||||||
| 477 | Utility::getLinkListFooter(); |
||||||
| 478 | } |
||||||
| 479 | Utility::getLinkListPageNav($broken_array_count, $start, 'art', 'op=' . $op); |
||||||
| 480 | require_once __DIR__ . '/admin_footer.php'; |
||||||
| 481 | break; |
||||||
| 482 | case 'edit': |
||||||
| 483 | edit($lid); |
||||||
| 484 | break; |
||||||
| 485 | case 'save': |
||||||
| 486 | $groups = $_POST['groups'] ?? []; |
||||||
| 487 | $lid = !empty($_POST['lid']) ? $_POST['lid'] : 0; |
||||||
| 488 | $cid = !empty($_POST['cid']) ? $_POST['cid'] : 0; |
||||||
| 489 | $urlrating = !empty($_POST['urlrating']) ? $_POST['urlrating'] : 6; |
||||||
| 490 | $status = !empty($_POST['status']) ? $_POST['status'] : 2; |
||||||
| 491 | $url = ('http://' !== $_POST['url']) ? $myts->addSlashes($_POST['url']) : ''; |
||||||
| 492 | $title = $myts->addSlashes(trim($_POST['title'])); |
||||||
| 493 | |||||||
| 494 | // Get data from form |
||||||
| 495 | $screenshot = ('blank.gif' !== $_POST['screenshot']) ? $myts->addSlashes($_POST['screenshot']) : ''; |
||||||
| 496 | $descriptionb = $myts->addSlashes(trim($_POST['descriptionb'])); |
||||||
| 497 | $country = $myts->addSlashes(trim($_POST['country'])); |
||||||
| 498 | $keywords = $myts->addSlashes(trim(mb_substr($_POST['keywords'], 0, $helper->getConfig('keywordlength')))); |
||||||
| 499 | $item_tag = $myts->addSlashes(trim($_POST['item_tag'])); |
||||||
| 500 | $forumid = (isset($_POST['forumid']) && $_POST['forumid'] > 0) ? Request::getInt('forumid', 0, 'POST') : 0; |
||||||
| 501 | if ($helper->getConfig('useaddress')) { |
||||||
| 502 | $googlemap = ('http://maps.google.com' !== $_POST['googlemap']) ? $myts->addSlashes($_POST['googlemap']) : ''; |
||||||
| 503 | $yahoomap = ('http://maps.yahoo.com' !== $_POST['yahoomap']) ? $myts->addSlashes($_POST['yahoomap']) : ''; |
||||||
| 504 | $multimap = ('http://www.multimap.com' !== $_POST['multimap']) ? $myts->addSlashes($_POST['multimap']) : ''; |
||||||
| 505 | $street1 = $myts->addSlashes(trim($_POST['street1'])); |
||||||
| 506 | $street2 = $myts->addSlashes(trim($_POST['street2'])); |
||||||
| 507 | $town = $myts->addSlashes(trim($_POST['town'])); |
||||||
| 508 | $state = $myts->addSlashes(trim($_POST['state'])); |
||||||
| 509 | $zip = $myts->addSlashes(trim($_POST['zip'])); |
||||||
| 510 | $tel = $myts->addSlashes(trim($_POST['tel'])); |
||||||
| 511 | $fax = $myts->addSlashes(trim($_POST['fax'])); |
||||||
| 512 | $voip = $myts->addSlashes(trim($_POST['voip'])); |
||||||
| 513 | $mobile = $myts->addSlashes(trim($_POST['mobile'])); |
||||||
| 514 | $email = Utility::convertEmail($myts->addSlashes(trim($_POST['email']))); |
||||||
| 515 | $vat = $myts->addSlashes(trim($_POST['vat'])); |
||||||
| 516 | } else { |
||||||
| 517 | $googlemap = $yahoomap = $multimap = $street1 = $street2 = $town = $state = $zip = $tel = $fax = $voip = $mobile = $email = $vat = ''; |
||||||
| 518 | } |
||||||
| 519 | |||||||
| 520 | $submitter = $xoopsUser->uid(); |
||||||
| 521 | $publisher = $myts->addSlashes(trim($_POST['publisher'])); |
||||||
| 522 | |||||||
| 523 | $published = strtotime($_POST['published']['date']) + $_POST['published']['time']; |
||||||
| 524 | $updated = (isset($_POST['was_published']) && 0 == $_POST['was_published']) ? 0 : time(); |
||||||
| 525 | if (0 == $_POST['up_dated']) { |
||||||
| 526 | $updated = 0; |
||||||
| 527 | $status = 1; |
||||||
| 528 | } |
||||||
| 529 | $offline = (1 == $_POST['offline']) ? 1 : 0; |
||||||
| 530 | $approved = (isset($_POST['approved']) && 1 == $_POST['approved']) ? 1 : 0; |
||||||
| 531 | $notifypub = (isset($_POST['notifypub']) && 1 == $_POST['notifypub']); |
||||||
| 532 | if ($lid) { |
||||||
| 533 | $publishdate = $_POST['was_published']; |
||||||
| 534 | $expiredate = $_POST['was_expired']; |
||||||
| 535 | } else { |
||||||
| 536 | $date = time(); |
||||||
| 537 | $publishdate = time(); |
||||||
| 538 | $expiredate = '0'; |
||||||
| 539 | } |
||||||
| 540 | if (1 == $approved && empty($publishdate)) { |
||||||
| 541 | $publishdate = time(); |
||||||
| 542 | } |
||||||
| 543 | if (Request::hasVar('expiredateactivate', 'POST')) { |
||||||
| 544 | $expiredate = strtotime($_POST['expired']['date']) + $_POST['expired']['time']; |
||||||
| 545 | } |
||||||
| 546 | if ($_POST['clearexpire']) { |
||||||
| 547 | $expiredate = '0'; |
||||||
| 548 | } |
||||||
| 549 | |||||||
| 550 | // Update or insert linkload data into database |
||||||
| 551 | if ($lid) { |
||||||
| 552 | $sql = 'UPDATE ' |
||||||
| 553 | . $xoopsDB->prefix('wflinks_links') |
||||||
| 554 | . " SET cid = $cid, title='$title', url='$url', screenshot='$screenshot', publisher='$publisher', status='$status', forumid='$forumid', published='$published', expired='$expiredate', updated='$updated', offline='$offline', description='$descriptionb', urlrating='$urlrating', 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=" |
||||||
| 555 | . $lid; |
||||||
| 556 | } else { |
||||||
| 557 | $date = time(); |
||||||
| 558 | $publishdate = time(); |
||||||
| 559 | $ipaddress = $_SERVER['REMOTE_ADDR']; |
||||||
| 560 | $sql = 'INSERT INTO ' |
||||||
| 561 | . $xoopsDB->prefix('wflinks_links') |
||||||
| 562 | . ' (lid, cid, title, url, screenshot, submitter, publisher, status, date, hits, rating, votes, comments, forumid, published, expired, updated, offline, description, ipaddress, notifypub, urlrating, country, keywords, item_tag, googlemap, yahoomap, multimap, street1, street2, town, state, zip, tel, fax, voip, mobile, email, vat )'; |
||||||
| 563 | $sql .= " VALUES (0, $cid, '$title', '$url', '$screenshot', '$submitter', '$publisher','$status', '$date', 0, 0, 0, 0, '$forumid', '$published', '$expiredate', '$updated', '$offline', '$descriptionb', '$ipaddress', '0', '$urlrating', '$country', '$keywords', '$item_tag', '$googlemap', '$yahoomap', '$multimap', '$street1', '$street2', '$town', '$state', '$zip', '$tel', '$fax', '$voip', '$mobile', '$email', '$vat' )"; |
||||||
| 564 | // $newid = $xoopsDB -> getInsertId(); |
||||||
| 565 | } |
||||||
| 566 | if (!$result = $xoopsDB->queryF($sql)) { |
||||||
| 567 | $logger->handleError(E_USER_WARNING, $sql, __FILE__, __LINE__); |
||||||
| 568 | |||||||
| 569 | return false; |
||||||
| 570 | } |
||||||
| 571 | |||||||
| 572 | $newid = $GLOBALS['xoopsDB']->getInsertId(); |
||||||
| 573 | |||||||
| 574 | // Add item_tag to Tag-module |
||||||
| 575 | if ($lid) { |
||||||
| 576 | $tagupdate = Utility::updateTag($lid, $item_tag); |
||||||
| 577 | } else { |
||||||
| 578 | $tagupdate = Utility::updateTag($newid, $item_tag); |
||||||
| 579 | } |
||||||
| 580 | |||||||
| 581 | // Send notifications |
||||||
| 582 | if (!$lid) { |
||||||
| 583 | $tags = []; |
||||||
| 584 | $tags['LINK_NAME'] = $title; |
||||||
| 585 | $tags['LINK_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/singlelink.php?cid=' . $cid . '&lid=' . $newid; |
||||||
| 586 | $sql = 'SELECT title FROM ' . $xoopsDB->prefix('wflinks_cat') . ' WHERE cid=' . $cid; |
||||||
| 587 | $result = $xoopsDB->query($sql); |
||||||
| 588 | $row = $xoopsDB->fetchArray($xoopsDB->query($sql)); |
||||||
| 589 | $tags['CATEGORY_NAME'] = $row['title']; |
||||||
| 590 | $tags['CATEGORY_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewcat.php?cid=' . $cid; |
||||||
| 591 | /** @var \XoopsNotificationHandler $notificationHandler */ |
||||||
| 592 | $notificationHandler = xoops_getHandler('notification'); |
||||||
| 593 | $notificationHandler->triggerEvent('global', 0, 'new_link', $tags); |
||||||
| 594 | $notificationHandler->triggerEvent('category', $cid, 'new_link', $tags); |
||||||
| 595 | } |
||||||
| 596 | if ($lid && $approved && $notifypub) { |
||||||
| 597 | $tags = []; |
||||||
| 598 | $tags['LINK_NAME'] = $title; |
||||||
| 599 | $tags['LINK_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/singlelink.php?cid=' . $cid . '&lid=' . $lid; |
||||||
| 600 | $sql = 'SELECT title FROM ' . $xoopsDB->prefix('wflinks_cat') . ' WHERE cid=' . $cid; |
||||||
| 601 | $result = $xoopsDB->query($sql); |
||||||
| 602 | $row = $xoopsDB->fetchArray($result); |
||||||
| 603 | $tags['CATEGORY_NAME'] = $row['title']; |
||||||
| 604 | $tags['CATEGORY_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewcat.php?cid=' . $cid; |
||||||
| 605 | $notificationHandler = xoops_getHandler('notification'); |
||||||
| 606 | $notificationHandler->triggerEvent('global', 0, 'new_link', $tags); |
||||||
|
0 ignored issues
–
show
The method
triggerEvent() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoopsNotificationHandler or XoopsPersistableObjectHandler.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 607 | $notificationHandler->triggerEvent('category', $cid, 'new_link', $tags); |
||||||
| 608 | $notificationHandler->triggerEvent('link', $lid, 'approve', $tags); |
||||||
| 609 | } |
||||||
| 610 | $message = (!$lid) ? _AM_WFL_LINK_NEWFILEUPLOAD : _AM_WFL_LINK_FILEMODIFIEDUPDATE; |
||||||
| 611 | $message = ($lid && !$_POST['was_published'] && $approved) ? _AM_WFL_LINK_FILEAPPROVED : $message; |
||||||
| 612 | if (\Xmf\Request::getInt('delbroken', 0)) { |
||||||
| 613 | $sql = 'DELETE FROM ' . $xoopsDB->prefix('wflinks_broken') . ' WHERE lid=' . $lid; |
||||||
| 614 | if (!$result = $xoopsDB->queryF($sql)) { |
||||||
| 615 | $logger->handleError(E_USER_WARNING, $sql, __FILE__, __LINE__); |
||||||
| 616 | |||||||
| 617 | return false; |
||||||
| 618 | } |
||||||
| 619 | } |
||||||
| 620 | if (\Xmf\Request::getInt('submitnews', 0)) { |
||||||
| 621 | require_once __DIR__ . '/newstory.php'; |
||||||
| 622 | } |
||||||
| 623 | redirect_header('main.php', 1, $message); |
||||||
| 624 | break; |
||||||
| 625 | case 'delete': |
||||||
| 626 | if (\Xmf\Request::getInt('confirm', 0)) { |
||||||
| 627 | $title = \Xmf\Request::getString('title', '');; |
||||||
| 628 | /** @var \XoopsLogger $logger */ |
||||||
| 629 | $logger = \XoopsLogger::getInstance(); |
||||||
| 630 | |||||||
| 631 | // delete link |
||||||
| 632 | $sql = 'DELETE FROM ' . $xoopsDB->prefix('wflinks_links') . ' WHERE lid=' . $lid; |
||||||
| 633 | if (!$result = $xoopsDB->query($sql)) { |
||||||
| 634 | $logger->handleError(E_USER_WARNING, $sql, __FILE__, __LINE__); |
||||||
| 635 | |||||||
| 636 | return false; |
||||||
| 637 | } |
||||||
| 638 | |||||||
| 639 | // delete from altcat |
||||||
| 640 | $sql = 'DELETE FROM ' . $xoopsDB->prefix('wflinks_altcat') . ' WHERE lid=' . $lid; |
||||||
| 641 | if (!$result = $xoopsDB->query($sql)) { |
||||||
| 642 | $logger->handleError(E_USER_WARNING, $sql, __FILE__, __LINE__); |
||||||
| 643 | |||||||
| 644 | return false; |
||||||
| 645 | } |
||||||
| 646 | |||||||
| 647 | // delete vote data |
||||||
| 648 | $sql = 'DELETE FROM ' . $xoopsDB->prefix('wflinks_votedata') . ' WHERE lid=' . $lid; |
||||||
| 649 | if (!$result = $xoopsDB->query($sql)) { |
||||||
| 650 | $logger->handleError(E_USER_WARNING, $sql, __FILE__, __LINE__); |
||||||
| 651 | |||||||
| 652 | return false; |
||||||
| 653 | } |
||||||
| 654 | |||||||
| 655 | // delete comments |
||||||
| 656 | xoops_comment_delete($xoopsModule->getVar('mid'), $lid); |
||||||
| 657 | redirect_header('main.php', 1, sprintf(_AM_WFL_LINK_FILEWASDELETED, $title)); |
||||||
| 658 | } else { |
||||||
| 659 | $sql = 'SELECT lid, title, item_tag, url FROM ' . $xoopsDB->prefix('wflinks_links') . ' WHERE lid=' . $lid; |
||||||
| 660 | if (!$result = $xoopsDB->query($sql)) { |
||||||
| 661 | $logger->handleError(E_USER_WARNING, $sql, __FILE__, __LINE__); |
||||||
| 662 | |||||||
| 663 | return false; |
||||||
| 664 | } |
||||||
| 665 | list($lid, $title) = $xoopsDB->fetchRow($result); |
||||||
| 666 | $item_tag = $result->fetchArray['item_tag']; |
||||||
| 667 | require_once __DIR__ . '/admin_header.php'; |
||||||
| 668 | xoops_cp_header(); |
||||||
| 669 | |||||||
| 670 | xoops_confirm(['op' => 'delete', 'lid' => $lid, 'confirm' => 1, 'title' => $title], 'main.php', _AM_WFL_LINK_REALLYDELETEDTHIS . '<br><br>' . $title, _DELETE); |
||||||
| 671 | |||||||
| 672 | // Remove item_tag from Tag-module |
||||||
| 673 | $tagupdate = Utility::updateTag($lid, $item_tag); |
||||||
| 674 | |||||||
| 675 | require_once __DIR__ . '/admin_footer.php'; |
||||||
| 676 | } |
||||||
| 677 | break; |
||||||
| 678 | case 'delvote': |
||||||
| 679 | $rid = \Xmf\Request::getInt('rid', 0); |
||||||
| 680 | $sql = 'DELETE FROM ' . $xoopsDB->prefix('wflinks_votedata') . ' WHERE ratingid=' . $rid; |
||||||
| 681 | if (!$result = $xoopsDB->queryF($sql)) { |
||||||
| 682 | $logger->handleError(E_USER_WARNING, $sql, __FILE__, __LINE__); |
||||||
| 683 | |||||||
| 684 | return false; |
||||||
| 685 | } |
||||||
| 686 | Utility::updateRating($rid); |
||||||
| 687 | redirect_header('main.php', 1, _AM_WFL_VOTE_VOTEDELETED); |
||||||
| 688 | break; |
||||||
| 689 | case 'main': |
||||||
| 690 | default: |
||||||
| 691 | $start = \Xmf\Request::getInt('start', 0); |
||||||
| 692 | $start1 = \Xmf\Request::getInt('start1', 0); |
||||||
| 693 | $start2 = \Xmf\Request::getInt('start2', 0); |
||||||
| 694 | $start3 = \Xmf\Request::getInt('start3', 0); |
||||||
| 695 | $start4 = \Xmf\Request::getInt('start4', 0); |
||||||
| 696 | $totalcats = Utility::getTotalCategory(); |
||||||
| 697 | |||||||
| 698 | $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('wflinks_broken')); |
||||||
| 699 | list($totalbrokenlinks) = $xoopsDB->fetchRow($result); |
||||||
| 700 | $result2 = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('wflinks_mod')); |
||||||
| 701 | list($totalmodrequests) = $xoopsDB->fetchRow($result2); |
||||||
| 702 | $result3 = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('wflinks_links') . ' WHERE published = 0'); |
||||||
| 703 | list($totalnewlinks) = $xoopsDB->fetchRow($result3); |
||||||
| 704 | $result4 = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('wflinks_links') . ' WHERE published > 0'); |
||||||
| 705 | list($totallinks) = $xoopsDB->fetchRow($result4); |
||||||
| 706 | |||||||
| 707 | xoops_cp_header(); |
||||||
| 708 | |||||||
| 709 | $adminObject = Admin::getInstance(); |
||||||
| 710 | $adminObject->displayNavigation(basename(__FILE__)); |
||||||
| 711 | $adminObject->addItemButton(_MI_WFL_ADD_LINK, 'main.php?op=edit', 'add', ''); |
||||||
| 712 | $adminObject->addItemButton(_MI_WFL_ADD_CATEGORY, 'category.php', 'add', ''); |
||||||
| 713 | $adminObject->displayButton('left', ''); |
||||||
| 714 | |||||||
| 715 | // echo " |
||||||
| 716 | // <fieldset style='border: #e8e8e8 1px solid;'><legend style='display: inline; font-weight: bold; color: #0A3760;'>" . _AM_WFL_MINDEX_LINKSUMMARY . "</legend>\n |
||||||
| 717 | // <div style='padding: 8px;'><small>\n |
||||||
| 718 | // <a href='category.php'>" . _AM_WFL_SCATEGORY . "</a><b>" . $totalcats . "</b> | \n |
||||||
| 719 | // <a href='main.php'>" . _AM_WFL_SFILES . "</a><b>" . $totallinks . "</b> | \n |
||||||
| 720 | // <a href='newlinks.php'>" . _AM_WFL_SNEWFILESVAL . "</a><b>" . $totalnewlinks . "</b> | \n |
||||||
| 721 | // <a href='modifications.php'>" . _AM_WFL_SMODREQUEST . "</a><b>" . $totalmodrequests . "</b> | \n |
||||||
| 722 | // <a href='brokenlink.php'>" . _AM_WFL_SBROKENSUBMIT . "</a><b>" . $totalbrokenlinks . "</b>\n |
||||||
| 723 | // </small></div></fieldset><br>\n |
||||||
| 724 | // "; |
||||||
| 725 | |||||||
| 726 | // if ($totalcats > 0) { |
||||||
| 727 | // $sform = new \XoopsThemeForm( _AM_WFL_CCATEGORY_MODIFY, "category", "category.php" ); |
||||||
| 728 | // ob_start(); |
||||||
| 729 | // $mytree -> makeMySelBox( "title", "title" ); |
||||||
| 730 | // $sform -> addElement( new \XoopsFormLabel( _AM_WFL_CCATEGORY_MODIFY_TITLE, ob_get_contents() ) ); |
||||||
| 731 | // ob_end_clean(); |
||||||
| 732 | // $dup_tray = new \XoopsFormElementTray( '', '' ); |
||||||
| 733 | // $dup_tray -> addElement( new \XoopsFormHidden( 'op', 'modCat' ) ); |
||||||
| 734 | // $butt_dup = new \XoopsFormButton( '', '', _AM_WFL_BMODIFY, 'submit' ); |
||||||
| 735 | // $butt_dup -> setExtra( 'onclick="this.form.elements.op.value=\'modCat\'"' ); |
||||||
| 736 | // $dup_tray -> addElement( $butt_dup ); |
||||||
| 737 | // $butt_dupct = new \XoopsFormButton( '', '', _AM_WFL_BDELETE, 'submit' ); |
||||||
| 738 | // $butt_dupct -> setExtra( 'onclick="this.form.elements.op.value=\'del\'"' ); |
||||||
| 739 | // $dup_tray -> addElement( $butt_dupct ); |
||||||
| 740 | // $sform -> addElement( $dup_tray ); |
||||||
| 741 | // $sform -> display(); |
||||||
| 742 | // } |
||||||
| 743 | |||||||
| 744 | if ($totallinks > 0) { |
||||||
| 745 | $sql = 'SELECT * FROM ' . $xoopsDB->prefix('wflinks_links') . ' WHERE published > 0 ORDER BY lid DESC'; |
||||||
| 746 | $published_array = $xoopsDB->query($sql, $helper->getConfig('admin_perpage'), $start); |
||||||
| 747 | $published_array_count = $xoopsDB->getRowsNum($xoopsDB->query($sql)); |
||||||
| 748 | Utility::getLinkListHeader(_AM_WFL_MINDEX_PUBLISHEDLINK); |
||||||
| 749 | Utility::getLinkListPageNavLeft($published_array_count, $start, 'art'); |
||||||
| 750 | if ($published_array_count > 0) { |
||||||
| 751 | while (false !== ($published = $xoopsDB->fetchArray($published_array))) { |
||||||
| 752 | Utility::getLinkListBody($published); |
||||||
| 753 | } |
||||||
| 754 | } else { |
||||||
| 755 | Utility::getLinkListFooter(); |
||||||
| 756 | } |
||||||
| 757 | Utility::getLinkListPageNav($published_array_count, $start, 'art'); |
||||||
| 758 | } |
||||||
| 759 | require_once __DIR__ . '/admin_footer.php'; |
||||||
| 760 | break; |
||||||
| 761 | } |
||||||
| 762 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths