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\Request; |
||
| 12 | use XoopsModules\Wflinks; |
||
| 13 | |||
| 14 | require_once __DIR__ . '/admin_header.php'; |
||
| 15 | |||
| 16 | /** @var Wflinks\Helper $helper */ |
||
| 17 | $helper = Wflinks\Helper::getInstance(); |
||
| 18 | |||
| 19 | global $mytree; |
||
| 20 | xoops_load('XoopsUserUtility'); |
||
| 21 | $op = \Xmf\Request::getString('op', ''); |
||
| 22 | $requestid = \Xmf\Request::getInt('requestid', 0); |
||
| 23 | |||
| 24 | switch (mb_strtolower($op)) { |
||
| 25 | case 'listmodreqshow': |
||
| 26 | |||
| 27 | xoops_cp_header(); |
||
| 28 | |||
| 29 | $sql = 'SELECT modifysubmitter, requestid, lid, cid, title, url, description, screenshot, forumid, country, keywords, item_tag, googlemap, yahoomap, multimap, street1, street2, town, state, zip, tel, fax, voip, mobile, email, vat FROM ' |
||
| 30 | . $xoopsDB->prefix('wflinks_mod') |
||
| 31 | . ' WHERE requestid=' |
||
| 32 | . $requestid; |
||
| 33 | $mod_array = $xoopsDB->fetchArray($xoopsDB->query($sql)); |
||
| 34 | unset($sql); |
||
| 35 | |||
| 36 | $sql = 'SELECT submitter, lid, cid, title, url, description, screenshot, forumid, country, keywords, item_tag, googlemap, yahoomap, multimap, street1, street2, town, state, zip, tel, fax, voip, mobile, email, vat FROM ' |
||
| 37 | . $xoopsDB->prefix('wflinks_links') |
||
| 38 | . ' WHERE lid=' |
||
| 39 | . $mod_array['lid']; |
||
| 40 | $orig_array = $xoopsDB->fetchArray($xoopsDB->query($sql)); |
||
| 41 | unset($sql); |
||
| 42 | |||
| 43 | $orig_user = new \XoopsUser($orig_array['submitter']); |
||
| 44 | $submittername = \XoopsUserUtility::getUnameFromId($orig_array['submitter']); |
||
| 45 | $submitteremail = $orig_user::getUnameFromId('email'); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 46 | |||
| 47 | echo '<div><b>' . _AM_WFL_MOD_MODPOSTER . "</b> $submittername</div>"; |
||
| 48 | $not_allowed = ['lid', 'submitter', 'requestid', 'modifysubmitter']; |
||
| 49 | $sform = new \XoopsThemeForm(_AM_WFL_MOD_ORIGINAL, 'storyform', 'index.php'); |
||
| 50 | foreach ($orig_array as $key => $content) { |
||
| 51 | if (in_array($key, $not_allowed)) { |
||
| 52 | continue; |
||
| 53 | } |
||
| 54 | $lang_def = constant('_AM_WFL_MOD_' . mb_strtoupper($key)); |
||
| 55 | |||
| 56 | if ('cid' === $key) { |
||
| 57 | $sql = 'SELECT title FROM ' . $xoopsDB->prefix('wflinks_cat') . ' WHERE cid=' . $content; |
||
| 58 | $row = $xoopsDB->fetchArray($xoopsDB->query($sql)); |
||
| 59 | $content = $row['title']; |
||
| 60 | } |
||
| 61 | if ('forumid' === $key) { |
||
| 62 | $content = ''; |
||
| 63 | /** @var \XoopsModuleHandler $moduleHandler */ |
||
| 64 | $moduleHandler = xoops_getHandler('module'); |
||
| 65 | $xoopsforumModule = $moduleHandler->getByDirname('newbb'); |
||
| 66 | $sql = 'SELECT title FROM ' . $xoopsDB->prefix('bb_categories') . ' WHERE cid=' . $content; |
||
| 67 | if ($xoopsforumModule && $content > 0) { |
||
| 68 | $content = "<a href='" . XOOPS_URL . '/modules/newbb/viewforum.php?forum=' . $content . "'>Forumid</a>"; |
||
| 69 | } |
||
| 70 | } |
||
| 71 | if ('screenshot' === $key) { |
||
| 72 | $content = ''; |
||
| 73 | if ($content > 0) { |
||
| 74 | $content = "<img src='" . XOOPS_URL . '/' . $helper->getConfig('screenshots') . '/' . $logourl . "' width='" . $helper->getConfig('shotwidth') . "' alt=''>"; |
||
| 75 | } |
||
| 76 | } |
||
| 77 | if ('country' === $key) { |
||
| 78 | $content = Wflinks\Utility::getCountryName($mod_array['country']); |
||
| 79 | } |
||
| 80 | $sform->addElement(new \XoopsFormLabel($lang_def, $content)); |
||
| 81 | } |
||
| 82 | $sform->display(); |
||
| 83 | |||
| 84 | $orig_user = new \XoopsUser($mod_array['modifysubmitter']); |
||
| 85 | $submittername = \XoopsUserUtility::getUnameFromId($mod_array['modifysubmitter']); |
||
| 86 | $submitteremail = $orig_user::getUnameFromId('email'); |
||
| 87 | |||
| 88 | echo '<div><b>' . _AM_WFL_MOD_MODIFYSUBMITTER . "</b> $submittername</div>"; |
||
| 89 | $sform = new \XoopsThemeForm(_AM_WFL_MOD_PROPOSED, 'storyform', 'modifications.php'); |
||
| 90 | foreach ($mod_array as $key => $content) { |
||
| 91 | if (in_array($key, $not_allowed)) { |
||
| 92 | continue; |
||
| 93 | } |
||
| 94 | $lang_def = constant('_AM_WFL_MOD_' . mb_strtoupper($key)); |
||
| 95 | |||
| 96 | if ('cid' === $key) { |
||
| 97 | $sql = 'SELECT title FROM ' . $xoopsDB->prefix('wflinks_cat') . ' WHERE cid=' . $content; |
||
| 98 | $row = $xoopsDB->fetchArray($xoopsDB->query($sql)); |
||
| 99 | $content = $row['title']; |
||
| 100 | } |
||
| 101 | if ('forumid' === $key) { |
||
| 102 | $content = ''; |
||
| 103 | /** @var \XoopsModuleHandler $moduleHandler */ |
||
| 104 | $moduleHandler = xoops_getHandler('module'); |
||
| 105 | $xoopsforumModule = $moduleHandler->getByDirname('newbb'); |
||
| 106 | $sql = 'SELECT title FROM ' . $xoopsDB->prefix('bb_categories') . ' WHERE cid=' . $content; |
||
| 107 | $content = ''; |
||
| 108 | if ($xoopsforumModule && $content > 0) { |
||
| 109 | $content = "<a href='" . XOOPS_URL . '/modules/newbb/viewforum.php?forum=' . $content . "'>Forumid</a>"; |
||
| 110 | } |
||
| 111 | } |
||
| 112 | if ('screenshot' === $key) { |
||
| 113 | $content = ''; |
||
| 114 | if ($content > 0) { |
||
| 115 | $content = "<img src='" . XOOPS_URL . '/' . $helper->getConfig('screenshots') . '/' . $logourl . "' width='" . $helper->getConfig('shotwidth') . "' alt=''>"; |
||
| 116 | } |
||
| 117 | } |
||
| 118 | if ('country' === $key) { |
||
| 119 | $content = Wflinks\Utility::getCountryName($mod_array['country']); |
||
| 120 | } |
||
| 121 | $sform->addElement(new \XoopsFormLabel($lang_def, $content)); |
||
| 122 | } |
||
| 123 | $buttonTray = new \XoopsFormElementTray('', ''); |
||
| 124 | $buttonTray->addElement(new \XoopsFormHidden('requestid', $requestid)); |
||
| 125 | $buttonTray->addElement(new \XoopsFormHidden('lid', $mod_array['requestid'])); |
||
| 126 | $hidden = new \XoopsFormHidden('op', 'changemodreq'); |
||
| 127 | $buttonTray->addElement($hidden); |
||
| 128 | if ($mod_array) { |
||
| 129 | $butt_dup = new \XoopsFormButton('', '', _AM_WFL_BAPPROVE, 'submit'); |
||
| 130 | $butt_dup->setExtra('onclick="this.form.elements.op.value=\'changemodreq\'"'); |
||
| 131 | $buttonTray->addElement($butt_dup); |
||
| 132 | } |
||
| 133 | $butt_dupct2 = new \XoopsFormButton('', '', _AM_WFL_BIGNORE, 'submit'); |
||
| 134 | $butt_dupct2->setExtra('onclick="this.form.elements.op.value=\'ignoremodreq\'"'); |
||
| 135 | $buttonTray->addElement($butt_dupct2); |
||
| 136 | $sform->addElement($buttonTray); |
||
| 137 | $sform->display(); |
||
| 138 | xoops_cp_footer(); |
||
| 139 | break; |
||
| 140 | case 'changemodreq': |
||
| 141 | $sql = 'SELECT * FROM ' . $xoopsDB->prefix('wflinks_mod') . ' WHERE requestid=' . $requestid; |
||
| 142 | $link_array = $xoopsDB->fetchArray($xoopsDB->query($sql)); |
||
| 143 | |||
| 144 | $lid = $link_array['lid']; |
||
| 145 | $cid = $link_array['cid']; |
||
| 146 | $title = $link_array['title']; |
||
| 147 | $url = $link_array['url']; |
||
| 148 | $publisher = $xoopsUser->uname(); |
||
| 149 | $screenshot = $link_array['screenshot']; |
||
| 150 | $description = $link_array['description']; |
||
| 151 | $submitter = $link_array['modifysubmitter']; |
||
| 152 | $country = $link_array['country']; |
||
| 153 | $keywords = $link_array['keywords']; |
||
| 154 | $item_tag = $link_array['item_tag']; |
||
| 155 | $googlemap = $link_array['googlemap']; |
||
| 156 | $yahoomap = $link_array['yahoomap']; |
||
| 157 | $multimap = $link_array['multimap']; |
||
| 158 | $street1 = $link_array['street1']; |
||
| 159 | $street2 = $link_array['street2']; |
||
| 160 | $town = $link_array['town']; |
||
| 161 | $state = $link_array['state']; |
||
| 162 | $zip = $link_array['zip']; |
||
| 163 | $tel = $link_array['tel']; |
||
| 164 | $fax = $link_array['fax']; |
||
| 165 | $voip = $link_array['voip']; |
||
| 166 | $mobile = $link_array['mobile']; |
||
| 167 | $email = $link_array['email']; |
||
| 168 | $vat = $link_array['vat']; |
||
| 169 | $updated = time(); |
||
| 170 | |||
| 171 | $xoopsDB->query( |
||
| 172 | 'UPDATE ' |
||
| 173 | . $xoopsDB->prefix('wflinks_links') |
||
| 174 | . " SET cid = $cid, title='$title', url='$url', submitter='$submitter', screenshot='$screenshot', publisher='$publisher', status='2', updated='$updated', description='$description', 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 = " |
||
| 175 | . $lid |
||
| 176 | ); |
||
| 177 | $sql = 'DELETE FROM ' . $xoopsDB->prefix('wflinks_mod') . ' WHERE requestid=' . $requestid; |
||
| 178 | $result = $xoopsDB->query($sql); |
||
| 179 | redirect_header('index.php', 1, _AM_WFL_MOD_REQUPDATED); |
||
| 180 | break; |
||
| 181 | case 'ignoremodreq': |
||
| 182 | $sql = sprintf('DELETE FROM ' . $xoopsDB->prefix('wflinks_mod') . ' WHERE requestid=' . $requestid); |
||
| 183 | $xoopsDB->query($sql); |
||
| 184 | redirect_header('index.php', 1, _AM_WFL_MOD_REQDELETED); |
||
| 185 | break; |
||
| 186 | case 'main': |
||
| 187 | default: |
||
| 188 | |||
| 189 | $start = Request::getInt('start', 0, 'GET'); |
||
| 190 | $mytree = new Wflinks\Tree($xoopsDB->prefix('wflinks_mod'), 'requestid', 0); |
||
| 191 | $sql = 'SELECT * FROM ' . $xoopsDB->prefix('wflinks_mod') . ' ORDER BY requestdate DESC'; |
||
| 192 | $result = $xoopsDB->query($sql, $helper->getConfig('admin_perpage'), $start); |
||
| 193 | $totalmodrequests = $xoopsDB->getRowsNum($xoopsDB->query($sql)); |
||
| 194 | |||
| 195 | xoops_cp_header(); |
||
| 196 | |||
| 197 | echo "<fieldset><legend style='font-weight: bold; color: #0A3760;'>" . _AM_WFL_MOD_MODREQUESTSINFO . "</legend>\n"; |
||
| 198 | echo "<div style='padding: 8px;'>" . _AM_WFL_MOD_TOTMODREQUESTS . " <b>$totalmodrequests<></div>\n"; |
||
| 199 | echo "</fieldset><br>\n"; |
||
| 200 | |||
| 201 | echo "<table width='100%' cellspacing='1' class='outer'>\n"; |
||
| 202 | echo "<tr class='center;'>\n"; |
||
| 203 | echo '<th>' . _AM_WFL_MOD_MODID . "</th>\n"; |
||
| 204 | echo "<th style='text-align: left;'>" . _AM_WFL_MOD_MODTITLE . "</th>\n"; |
||
| 205 | echo '<th>' . _AM_WFL_MOD_MODIFYSUBMIT . "</th>\n"; |
||
| 206 | echo '<th>' . _AM_WFL_MOD_DATE . "</th>\n"; |
||
| 207 | echo '<th>' . _AM_WFL_MINDEX_ACTION . "</th>\n"; |
||
| 208 | echo "</tr>\n"; |
||
| 209 | if ($totalmodrequests > 0) { |
||
| 210 | while (false !== ($link_arr = $xoopsDB->fetchArray($result))) { |
||
| 211 | $path = $mytree->getNicePathFromId($link_arr['requestid'], 'title', 'modifications.php?op=listmodreqshow&requestid'); |
||
| 212 | $path = str_replace('/', '', $path); |
||
| 213 | $path = str_replace(':', '', trim($path)); |
||
| 214 | $title = trim($path); |
||
| 215 | $submitter = \XoopsUserUtility::getUnameFromId($link_arr['modifysubmitter']); |
||
| 216 | $requestdate = formatTimestamp($link_arr['requestdate'], $helper->getConfig('dateformatadmin')); |
||
| 217 | |||
| 218 | echo "<tr class='center;'>\n"; |
||
| 219 | echo "<td class='head'>" . $link_arr['requestid'] . "</td>\n"; |
||
| 220 | echo "<td class='even' style='text-align: left;'>" . $title . "</td>\n"; |
||
| 221 | echo "<td class='even'>" . $submitter . "</td>\n"; |
||
| 222 | echo "<td class='even'>" . $requestdate . "</td>\n"; |
||
| 223 | echo "<td class='even'> <a href='modifications.php?op=listmodreqshow&requestid=" . $link_arr['requestid'] . "'>" . $imageArray['view'] . "</a></td>\n"; |
||
| 224 | echo "</tr>\n"; |
||
| 225 | } |
||
| 226 | } else { |
||
| 227 | echo "<tr class='center;'><td class='head' colspan='7'>" . _AM_WFL_MOD_NOMODREQUEST . '</td></tr>'; |
||
| 228 | } |
||
| 229 | echo "</table>\n"; |
||
| 230 | |||
| 231 | require_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
||
| 232 | // $page = ( $totalmodrequests > $helper->getConfig('admin_perpage') ) ? _AM_WFL_MINDEX_PAGE : ''; |
||
| 233 | $pagenav = new \XoopsPageNav($totalmodrequests, $helper->getConfig('admin_perpage'), $start, 'start'); |
||
| 234 | echo "<div style='text-align: right; padding: 8px;'>" . $pagenav->renderNav() . '</div>'; |
||
| 235 | require_once __DIR__ . '/admin_footer.php'; |
||
| 236 | } |
||
| 237 |