| Conditions | 54 |
| Paths | > 20000 |
| Total Lines | 319 |
| Code Lines | 233 |
| Lines | 12 |
| Ratio | 3.76 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 24 | * @param int $lid |
||
| 25 | * @return bool|null |
||
| 26 | */ |
||
| 27 | function edit($lid = 0) |
||
| 28 | { |
||
| 29 | global $xoopsDB, $myts, $mytree, $imageArray, $xoopsConfig, $xoopsModule, $xoopsUser; |
||
| 30 | /** @var Wflinks\Helper $helper */ |
||
| 31 | $helper = Wflinks\Helper::getInstance(); |
||
| 32 | |||
| 33 | $sql = 'SELECT * FROM ' . $xoopsDB->prefix('wflinks_links') . ' WHERE lid=' . $lid; |
||
| 34 | if (!$result = $xoopsDB->query($sql)) { |
||
|
|
|||
| 35 | /** @var \XoopsLogger $logger */ |
||
| 36 | $logger = \XoopsLogger::getInstance(); |
||
| 37 | $logger->handleError(E_USER_WARNING, $sql, __FILE__, __LINE__); |
||
| 38 | |||
| 39 | return false; |
||
| 40 | } |
||
| 41 | $link_array = $xoopsDB->fetchArray($xoopsDB->query($sql)); |
||
| 42 | |||
| 43 | $directory = $helper->getConfig('screenshots'); |
||
| 44 | $lid = $link_array['lid'] ?: 0; |
||
| 45 | $cid = $link_array['cid'] ?: 0; |
||
| 46 | $title = $link_array['title'] ? htmlspecialchars($link_array['title']) : ''; |
||
| 47 | $url = $link_array['url'] ? htmlspecialchars($link_array['url']) : 'http://'; |
||
| 48 | $publisher = $link_array['publisher'] ? htmlspecialchars($link_array['publisher']) : ''; |
||
| 49 | $submitter = $link_array['submitter'] ? htmlspecialchars($link_array['submitter']) : ''; |
||
| 50 | $screenshot = $link_array['screenshot'] ? htmlspecialchars($link_array['screenshot']) : ''; |
||
| 51 | $descriptionb = $link_array['description'] ? htmlspecialchars($link_array['description']) : ''; |
||
| 52 | $published = $link_array['published'] ?: time(); |
||
| 53 | $expired = $link_array['expired'] ?: 0; |
||
| 54 | $updated = $link_array['updated'] ?: 0; |
||
| 55 | $offline = $link_array['offline'] ?: 0; |
||
| 56 | $forumid = $link_array['forumid'] ?: 0; |
||
| 57 | $ipaddress = $link_array['ipaddress'] ?: 0; |
||
| 58 | $notifypub = $link_array['notifypub'] ?: 0; |
||
| 59 | $country = $link_array['country'] ? htmlspecialchars($link_array['country']) : '-'; |
||
| 60 | $keywords = $link_array['keywords'] ? htmlspecialchars($link_array['keywords']) : ''; |
||
| 61 | $item_tag = $link_array['item_tag'] ? htmlspecialchars($link_array['item_tag']) : ''; |
||
| 62 | $googlemap = $link_array['googlemap'] ? htmlspecialchars($link_array['googlemap']) : 'http://maps.google.com'; |
||
| 63 | $yahoomap = $link_array['yahoomap'] ? htmlspecialchars($link_array['yahoomap']) : 'http://maps.yahoo.com'; |
||
| 64 | $multimap = $link_array['multimap'] ? htmlspecialchars($link_array['multimap']) : 'http://www.multimap.com'; |
||
| 65 | $street1 = $link_array['street1'] ? htmlspecialchars($link_array['street1']) : ''; |
||
| 66 | $street2 = $link_array['street2'] ? htmlspecialchars($link_array['street2']) : ''; |
||
| 67 | $town = $link_array['town'] ? htmlspecialchars($link_array['town']) : ''; |
||
| 68 | $state = $link_array['state'] ? htmlspecialchars($link_array['state']) : ''; |
||
| 69 | $zip = $link_array['zip'] ? htmlspecialchars($link_array['zip']) : ''; |
||
| 70 | $tel = $link_array['tel'] ? htmlspecialchars($link_array['tel']) : ''; |
||
| 71 | $mobile = $link_array['mobile'] ? htmlspecialchars($link_array['mobile']) : ''; |
||
| 72 | $voip = $link_array['voip'] ? htmlspecialchars($link_array['voip']) : ''; |
||
| 73 | $fax = $link_array['fax'] ? htmlspecialchars($link_array['fax']) : ''; |
||
| 74 | $email = $link_array['email'] ? htmlspecialchars($link_array['email']) : ''; |
||
| 75 | $vat = $link_array['vat'] ? htmlspecialchars($link_array['vat']) : ''; |
||
| 76 | |||
| 77 | require_once __DIR__ . '/admin_header.php'; |
||
| 78 | xoops_cp_header(); |
||
| 79 | xoops_load('XoopsUserUtility'); |
||
| 80 | |||
| 81 | if ($lid > 0) { |
||
| 82 | $_vote_data = Wflinks\Utility::getVoteDetails($lid); |
||
| 83 | $text_info = "<table style='width:100%;'> |
||
| 84 | <tr> |
||
| 85 | <td width='33%' valign='top'> |
||
| 86 | <div><b>" . _AM_WFL_LINK_ID . ' </b>' . $lid . '</div> |
||
| 87 | <div><b>' . _AM_WFL_MINDEX_SUBMITTED . ': </b>' . formatTimestamp($link_array['date'], $helper->getConfig('dateformat')) . '</div> |
||
| 88 | <div><b>' . _AM_WFL_LINK_SUBMITTER . ' </b>' . \XoopsUserUtility::getUnameFromId($submitter) . '</div> |
||
| 89 | <div><b>' . _AM_WFL_LINK_IP . ' </b>' . $ipaddress . '</div> |
||
| 90 | <div><b>' . _AM_WFL_PAGERANK . ' </b>' . Wflinks\Utility::pagerank($link_array['url']) . '</div> |
||
| 91 | <div><b>' . _AM_WFL_HITS . ' </b>' . $link_array['hits'] . "</div> |
||
| 92 | |||
| 93 | </td> |
||
| 94 | <td valign='top'> |
||
| 95 | <div><b>" . _AM_WFL_VOTE_TOTALRATE . ': </b>' . Request::getInt('rate', 0, 'vote_data') . '</div> |
||
| 96 | <div><b>' . _AM_WFL_VOTE_USERAVG . ': </b>' . (int)round($_vote_data['avg_rate'], 2) . '</div> |
||
| 97 | <div><b>' . _AM_WFL_VOTE_MAXRATE . ': </b>' . Request::getInt('min_rate', 0, 'vote_data') . '</div> |
||
| 98 | <div><b>' . _AM_WFL_VOTE_MINRATE . ': </b>' . Request::getInt('max_rate', 0, 'vote_data') . "</div> |
||
| 99 | </td> |
||
| 100 | <td valign='top'> |
||
| 101 | <div><b>" . _AM_WFL_VOTE_MOSTVOTEDTITLE . ': </b>' . Request::getInt('max_title', 0, 'vote_data') . '</div> |
||
| 102 | <div><b>' . _AM_WFL_VOTE_LEASTVOTEDTITLE . ': </b>' . Request::getInt('min_title', 0, 'vote_data') . '</div> |
||
| 103 | <div><b>' . _AM_WFL_VOTE_REGISTERED . ': </b>' . ($_vote_data['rate'] - $_vote_data['null_ratinguser']) . '</div> |
||
| 104 | <div><b>' . _AM_WFL_VOTE_NONREGISTERED . ': </b>' . Request::getInt('null_ratinguser', 0, 'vote_data') . '</div> |
||
| 105 | </td> |
||
| 106 | </tr> |
||
| 107 | </table>'; |
||
| 108 | echo "<fieldset style='border: #e8e8e8 1px solid;'><legend style='display: inline; font-weight: bold; color: #0A3760;'>" . _AM_WFL_INFORMATION . "</legend>\n |
||
| 109 | <div style='padding: 8px;'>" . $text_info . "</div>\n |
||
| 110 | <!-- <div style='padding: 8px;'><li>" . $imageArray['deleteimg'] . ' ' . _AM_WFL_VOTE_DELETEDSC . "</li></div>\n --> |
||
| 111 | </fieldset>\n |
||
| 112 | <br>\n"; |
||
| 113 | } |
||
| 114 | unset($_vote_data); |
||
| 115 | |||
| 116 | $caption = $lid ? _AM_WFL_LINK_MODIFYFILE : _AM_WFL_LINK_CREATENEWFILE; |
||
| 117 | $sform = new \XoopsThemeForm($caption, 'storyform', xoops_getenv('SCRIPT_NAME'), 'post', true); |
||
| 118 | $sform->setExtra('enctype="multipart / form - data"'); |
||
| 119 | |||
| 120 | if ('' === $submitter) { |
||
| 121 | $sform->addElement(new \XoopsFormHidden('submitter', $submitter)); |
||
| 122 | } |
||
| 123 | |||
| 124 | // Link publisher form |
||
| 125 | if ($publisher) { |
||
| 126 | $sform->addElement(new \XoopsFormText(_AM_WFL_LINK_PUBLISHER, 'publisher', 70, 255, $publisher)); |
||
| 127 | //$sform -> addElement( new \XoopsFormHidden( 'publisher', $publisher ) ) ; |
||
| 128 | } else { |
||
| 129 | $publisher = $xoopsUser->uname(); |
||
| 130 | $sform->addElement(new \XoopsFormHidden('publisher', $publisher)); |
||
| 131 | } |
||
| 132 | |||
| 133 | // Link title form |
||
| 134 | $sform->addElement(new \XoopsFormText(_AM_WFL_LINK_TITLE, 'title', 70, 255, $title), true); |
||
| 135 | |||
| 136 | // Link url form |
||
| 137 | $url_text = new \XoopsFormText('', 'url', 70, 255, $url); |
||
| 138 | $url_tray = new \XoopsFormElementTray(_AM_WFL_LINK_DLURL, ''); |
||
| 139 | $url_tray->addElement($url_text, true); |
||
| 140 | $url_tray->addElement(new \XoopsFormLabel(" <img src='../assets/images/icon/world.png' onClick=\"window.open(document.storyform.url.value,'','');return(false);\" alt='Check URL'>")); |
||
| 141 | $sform->addElement($url_tray); |
||
| 142 | |||
| 143 | // Category form |
||
| 144 | ob_start(); |
||
| 145 | $mytree->makeMySelBox('title', 'title', $cid, 0); |
||
| 146 | $sform->addElement(new \XoopsFormLabel(_AM_WFL_LINK_CATEGORY, ob_get_clean())); |
||
| 147 | |||
| 148 | // Link description form |
||
| 149 | // $editor = Wflinks\Utility::getWysiwygForm( _AM_WFL_LINK_DESCRIPTION, 'descriptionb', $descriptionb, 15, 60 ); |
||
| 150 | // $sform -> addElement($editor, false); |
||
| 151 | $optionsTrayNote = new \XoopsFormElementTray(_AM_WFL_LINK_DESCRIPTION, '<br>'); |
||
| 152 | if (class_exists('XoopsFormEditor')) { |
||
| 153 | $options['name'] = 'descriptionb'; |
||
| 154 | $options['value'] = $descriptionb; |
||
| 155 | $options['rows'] = 5; |
||
| 156 | $options['cols'] = '100%'; |
||
| 157 | $options['width'] = '100%'; |
||
| 158 | $options['height'] = '200px'; |
||
| 159 | $descriptionb = new \XoopsFormEditor('', $helper->getConfig('form_options'), $options, $nohtml = false, $onfailure = 'textarea'); |
||
| 160 | $optionsTrayNote->addElement($descriptionb); |
||
| 161 | } else { |
||
| 162 | $descriptionb = new \XoopsFormDhtmlTextArea('', 'descriptionb', $item->getVar('descriptionb', 'e'), '100%', '100%'); |
||
| 163 | $optionsTrayNote->addElement($descriptionb); |
||
| 164 | } |
||
| 165 | |||
| 166 | $sform->addElement($optionsTrayNote, false); |
||
| 167 | |||
| 168 | // Meta keywords form |
||
| 169 | $keywords = new \XoopsFormTextArea(_AM_WFL_KEYWORDS, 'keywords', $keywords, 7, 60, false); |
||
| 170 | $keywords->setDescription('<small>' . _AM_WFL_KEYWORDS_NOTE . '</small>'); |
||
| 171 | $sform->addElement($keywords); |
||
| 172 | |||
| 173 | // Insert tags if Tag-module is installed |
||
| 174 | if (Wflinks\Utility::isTagModuleIncluded()) { |
||
| 175 | require_once XOOPS_ROOT_PATH . '/modules/tag/include/formtag.php'; |
||
| 176 | $text_tags = new FormTag('item_tag', 70, 255, $link_array['item_tag'], 0); |
||
| 177 | $sform->addElement($text_tags); |
||
| 178 | } else { |
||
| 179 | $sform->addElement(new \XoopsFormHidden('item_tag', $link_array['item_tag'])); |
||
| 180 | } |
||
| 181 | |||
| 182 | // Screenshot |
||
| 183 | $graph_array = Wflinks\Lists::getListTypeAsArray(XOOPS_ROOT_PATH . '/' . $helper->getConfig('screenshots'), $type = 'images'); |
||
| 184 | $indeximage_select = new \XoopsFormSelect('', 'screenshot', $screenshot); |
||
| 185 | $indeximage_select->addOptionArray($graph_array); |
||
| 186 | $indeximage_select->setExtra("onchange = 'showImgSelected(\"image\", \"screenshot\", \"" . $helper->getConfig('screenshots') . '", "", "' . XOOPS_URL . "\")'"); |
||
| 187 | $indeximage_tray = new \XoopsFormElementTray(_AM_WFL_LINK_SHOTIMAGE, ' '); |
||
| 188 | $indeximage_tray->setDescription(sprintf(_AM_WFL_LINK_MUSTBEVALID, '<b>' . $directory . '</b>')); |
||
| 189 | $indeximage_tray->addElement($indeximage_select); |
||
| 190 | if (!empty($imgurl)) { |
||
| 191 | $indeximage_tray->addElement(new \XoopsFormLabel('', " <br><br>< img src='" . XOOPS_URL . '/' . $helper->getConfig('screenshots') . '/' . $screenshot . "' name = 'image' id = 'image' alt = '' / > ")); |
||
| 192 | } else { |
||
| 193 | $indeximage_tray->addElement(new \XoopsFormLabel('', " <br><br><img src='" . XOOPS_URL . "/uploads/blank.gif' name='image' id='image' alt='' / > ")); |
||
| 194 | } |
||
| 195 | $sform->addElement($indeximage_tray); |
||
| 196 | |||
| 197 | if ($helper->getConfig('useaddress')) { |
||
| 198 | $sform->insertBreak(_AM_WFL_LINK_CREATEADDRESS, 'bg3'); |
||
| 199 | // Google Maps |
||
| 200 | $googlemap_text = new \XoopsFormText('', 'googlemap', 70, 1024, $googlemap); |
||
| 201 | $googlemap_tray = new \XoopsFormElementTray(_AM_WFL_LINK_GOOGLEMAP, ''); |
||
| 202 | $googlemap_tray->addElement($googlemap_text, false); |
||
| 203 | $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 . "'>")); |
||
| 204 | $sform->addElement($googlemap_tray); |
||
| 205 | // Yahoo Maps |
||
| 206 | $yahoomap_text = new \XoopsFormText('', 'yahoomap', 70, 1024, $yahoomap); |
||
| 207 | $yahoomap_tray = new \XoopsFormElementTray(_AM_WFL_LINK_YAHOOMAP, ''); |
||
| 208 | $yahoomap_tray->addElement($yahoomap_text, false); |
||
| 209 | $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 . "'>")); |
||
| 210 | $sform->addElement($yahoomap_tray); |
||
| 211 | // MS Live Maps |
||
| 212 | $multimap_text = new \XoopsFormText('', 'multimap', 70, 1024, $multimap); |
||
| 213 | $multimap_tray = new \XoopsFormElementTray(_AM_WFL_LINK_MULTIMAP, ''); |
||
| 214 | $multimap_tray->addElement($multimap_text, false); |
||
| 215 | $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 . "'>")); |
||
| 216 | $sform->addElement($multimap_tray); |
||
| 217 | |||
| 218 | // Address |
||
| 219 | $street1 = new \XoopsFormText(_AM_WFL_STREET1, 'street1', 70, 255, $street1); |
||
| 220 | $sform->addElement($street1, false); |
||
| 221 | $street2 = new \XoopsFormText(_AM_WFL_STREET2, 'street2', 70, 255, $street2); |
||
| 222 | $sform->addElement($street2, false); |
||
| 223 | $town = new \XoopsFormText(_AM_WFL_TOWN, 'town', 70, 255, $town); |
||
| 224 | $sform->addElement($town, false); |
||
| 225 | $state = new \XoopsFormText(_AM_WFL_STATE, 'state', 70, 255, $state); |
||
| 226 | $sform->addElement($state, false); |
||
| 227 | $zip = new \XoopsFormText(_AM_WFL_ZIPCODE, 'zip', 25, 25, $zip); |
||
| 228 | $sform->addElement($zip, false); |
||
| 229 | $tel = new \XoopsFormText(_AM_WFL_TELEPHONE, 'tel', 25, 25, $tel); |
||
| 230 | $sform->addElement($tel, false); |
||
| 231 | $mobile = new \XoopsFormText(_AM_WFL_MOBILE, 'mobile', 25, 25, $mobile); |
||
| 232 | $sform->addElement($mobile, false); |
||
| 233 | $voip = new \XoopsFormText(_AM_WFL_VOIP, 'voip', 25, 25, $voip); |
||
| 234 | $sform->addElement($voip, false); |
||
| 235 | $fax = new \XoopsFormText(_AM_WFL_FAX, 'fax', 25, 25, $fax); |
||
| 236 | $sform->addElement($fax, false); |
||
| 237 | $email = new \XoopsFormText(_AM_WFL_EMAIL, 'email', 25, 60, $email); |
||
| 238 | $sform->addElement($email, false); |
||
| 239 | $vat = new \XoopsFormText(_AM_WFL_VAT, 'vat', 25, 25, $vat); |
||
| 240 | $vat->setDescription(_AM_WFL_VATWIKI); |
||
| 241 | $sform->addElement($vat, false); |
||
| 242 | // $sform -> addElement( new \XoopsFormHidden( 'vat', $link_array['vat'] ) ); /* If you don't want to use the VAT form, */ |
||
| 243 | /* use this line and comment-out the 3 lines above */ |
||
| 244 | } |
||
| 245 | |||
| 246 | // Country form |
||
| 247 | $country_select = new \XoopsFormSelectCountry(_AM_WFL_COUNTRY, 'country', $country); |
||
| 248 | $sform->addElement($country_select, false); |
||
| 249 | |||
| 250 | // Miscellaneous Link settings |
||
| 251 | $sform->insertBreak(_AM_WFL_LINK_MISCLINKSETTINGS, 'bg3'); |
||
| 252 | |||
| 253 | // Set Publish date |
||
| 254 | $sform->addElement(new \XoopsFormDateTime(_AM_WFL_LINK_SETPUBLISHDATE, 'was_published', $size = 15, $published)); |
||
| 255 | |||
| 256 | if ($lid) { |
||
| 257 | $sform->addElement(new \XoopsFormHidden('was_published', $published)); |
||
| 258 | $sform->addElement(new \XoopsFormHidden('was_expired', $expired)); |
||
| 259 | } |
||
| 260 | |||
| 261 | // Set Expire date |
||
| 262 | $isexpired = ($expired > time()) ? 1 : 0; |
||
| 263 | $expiredates = ($expired > time()) ? _AM_WFL_LINK_EXPIREDATESET . formatTimestamp($expired, $helper->getConfig('dateformat')) : _AM_WFL_LINK_SETDATETIMEEXPIRE; |
||
| 264 | $warning = ($published > $expired && $expired > time()) ? _AM_WFL_LINK_EXPIREWARNING : ''; |
||
| 265 | $expiredate_checkbox = new \XoopsFormCheckBox('', 'expiredateactivate', $isexpired); |
||
| 266 | $expiredate_checkbox->addOption(1, $expiredates . ' <br> <br> '); |
||
| 267 | |||
| 268 | $expiredate_tray = new \XoopsFormElementTray(_AM_WFL_LINK_EXPIREDATE . $warning, ''); |
||
| 269 | $expiredate_tray->addElement($expiredate_checkbox); |
||
| 270 | $expiredate_tray->addElement(new \XoopsFormDateTime(_AM_WFL_LINK_SETEXPIREDATE . ' <br> ', 'expired', 15, $expired)); |
||
| 271 | $expiredate_tray->addElement(new \XoopsFormRadioYN(_AM_WFL_LINK_CLEAREXPIREDATE, 'clearexpire', 0, ' ' . _YES . '', ' ' . _NO . '')); |
||
| 272 | $sform->addElement($expiredate_tray); |
||
| 273 | |||
| 274 | // Set Link offline |
||
| 275 | $linkstatus_radio = new \XoopsFormRadioYN(_AM_WFL_LINK_FILESSTATUS, 'offline', $offline, ' ' . _YES . '', ' ' . _NO . ''); |
||
| 276 | $sform->addElement($linkstatus_radio); |
||
| 277 | |||
| 278 | // Set Link updated |
||
| 279 | $up_dated = (0 == $updated) ? 0 : 1; |
||
| 280 | $link_updated_radio = new \XoopsFormRadioYN(_AM_WFL_LINK_SETASUPDATED, 'up_dated', $up_dated, ' ' . _YES . '', ' ' . _NO . ''); |
||
| 281 | $sform->addElement($link_updated_radio); |
||
| 282 | |||
| 283 | $result = $xoopsDB->query('SELECT COUNT( * ) FROM ' . $xoopsDB->prefix('wflinks_broken') . ' WHERE lid = ' . $lid); |
||
| 284 | list($broken_count) = $xoopsDB->fetchRow($result); |
||
| 285 | if ($broken_count > 0) { |
||
| 286 | $link_updated_radio = new \XoopsFormRadioYN(_AM_WFL_LINK_DELEDITMESS, 'delbroken', 1, ' ' . _YES . '', ' ' . _NO . ''); |
||
| 287 | $sform->addElement($link_updated_radio); |
||
| 288 | } |
||
| 289 | |||
| 290 | // Select forum |
||
| 291 | ob_start(); |
||
| 292 | Wflinks\Lists::getForum($helper->getConfig('selectforum'), $forumid); |
||
| 293 | $sform->addElement(new \XoopsFormLabel(_AM_WFL_LINK_DISCUSSINFORUM, ob_get_clean())); |
||
| 294 | |||
| 295 | //Create News Story |
||
| 296 | if (Wflinks\Utility::isNewsModuleIncluded()) { |
||
| 297 | $sform->insertBreak(_AM_WFL_LINK_CREATENEWSSTORY, 'bg3'); |
||
| 298 | $submitNews_radio = new \XoopsFormRadioYN(_AM_WFL_LINK_SUBMITNEWS, 'submitnews', 0, ' ' . _YES . '', ' ' . _NO . ''); |
||
| 299 | $sform->addElement($submitNews_radio); |
||
| 300 | |||
| 301 | require_once XOOPS_ROOT_PATH . '/class/xoopstopic.php'; |
||
| 302 | $xt = new \XoopsTopic($xoopsDB->prefix('news_topics')); |
||
| 303 | ob_start(); |
||
| 304 | $xt->makeTopicSelBox(1, 0, 'newstopicid'); |
||
| 305 | $sform->addElement(new \XoopsFormLabel(_AM_WFL_LINK_NEWSCATEGORY, ob_get_clean())); |
||
| 306 | $sform->addElement(new \XoopsFormText(_AM_WFL_LINK_NEWSTITLE, 'topic_id', 70, 255, ''), false); |
||
| 307 | } |
||
| 308 | |||
| 309 | if ($lid && 0 == $published) { |
||
| 310 | $approved = (0 == $published) ? 0 : 1; |
||
| 311 | $approve_checkbox = new \XoopsFormCheckBox(_AM_WFL_LINK_EDITAPPROVE, 'approved', 1); |
||
| 312 | $approve_checkbox->addOption(1, ' '); |
||
| 313 | $sform->addElement($approve_checkbox); |
||
| 314 | } |
||
| 315 | |||
| 316 | if ($lid) { |
||
| 317 | $buttonTray = new \XoopsFormElementTray('', ''); |
||
| 318 | $buttonTray->addElement(new \XoopsFormHidden('lid', $lid)); |
||
| 319 | $buttonTray->addElement(new \XoopsFormHidden('status', 2)); |
||
| 320 | $hidden = new \XoopsFormHidden('op', 'save'); |
||
| 321 | $buttonTray->addElement($hidden); |
||
| 322 | |||
| 323 | $butt_dup = new \XoopsFormButton('', '', _AM_WFL_BMODIFY, 'submit'); |
||
| 324 | $butt_dup->setExtra('onclick="this . form . elements . op . value = \'save\'"'); |
||
| 325 | $buttonTray->addElement($butt_dup); |
||
| 326 | $butt_dupct = new \XoopsFormButton('', '', _AM_WFL_BDELETE, 'submit'); |
||
| 327 | $butt_dupct->setExtra('onclick="this.form.elements.op.value=\'delete\'"'); |
||
| 328 | $buttonTray->addElement($butt_dupct); |
||
| 329 | $butt_dupct2 = new \XoopsFormButton('', '', _AM_WFL_BCANCEL, 'submit'); |
||
| 330 | $butt_dupct2->setExtra('onclick="this.form.elements.op.value=\'linksConfigMenu\'"'); |
||
| 331 | $buttonTray->addElement($butt_dupct2); |
||
| 332 | $sform->addElement($buttonTray); |
||
| 333 | } else { |
||
| 334 | $buttonTray = new \XoopsFormElementTray('', ''); |
||
| 335 | $buttonTray->addElement(new \XoopsFormHidden('status', 1)); |
||
| 336 | $buttonTray->addElement(new \XoopsFormHidden('notifypub', $notifypub)); |
||
| 337 | $buttonTray->addElement(new \XoopsFormHidden('op', 'save')); |
||
| 338 | $buttonTray->addElement(new \XoopsFormButton('', '', _AM_WFL_BSAVE, 'submit')); |
||
| 339 | $sform->addElement($buttonTray); |
||
| 340 | } |
||
| 341 | $sform->display(); |
||
| 342 | unset($hidden); |
||
| 343 | require_once __DIR__ . '/admin_footer.php'; |
||
| 758 |