XoopsModules25x /
lexikon
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: Lexikon - glossary module |
||
| 5 | * Version: v 1.00 |
||
| 6 | * Release Date: 8 May 2004 |
||
| 7 | * Author: hsalazar |
||
| 8 | * Licence: GNU |
||
| 9 | */ |
||
| 10 | |||
| 11 | include __DIR__ . '/header.php'; |
||
| 12 | |||
| 13 | global $xoTheme, $xoopsUser, $xoopsModuleConfig, $xoopsModule; |
||
| 14 | /*if ( !is_object( $xoopsUser ) && $xoopsModuleConfig['allowreq'] == 0 ) { |
||
| 15 | redirect_header( "index.php", 1, _NOPERM ); |
||
| 16 | |||
| 17 | }*/ |
||
| 18 | // permissions |
||
| 19 | $gpermHandler = xoops_getHandler('groupperm'); |
||
| 20 | $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; |
||
| 21 | $module_id = $xoopsModule->getVar('mid'); |
||
| 22 | $perm_itemid = isset($_POST['categoryID']) ? (int)$_POST['categoryID'] : 0; |
||
| 23 | if (!$gpermHandler->checkRight('lexikon_request', $perm_itemid, $groups, $module_id)) { |
||
| 24 | redirect_header('javascript:history.go(-1)', 3, _ERRORS); |
||
| 25 | } |
||
| 26 | if (empty($_POST['submit'])) { |
||
| 27 | $GLOBALS['xoopsOption']['template_main'] = 'lx_request.tpl'; |
||
| 28 | include XOOPS_ROOT_PATH . '/header.php'; |
||
| 29 | include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||
| 30 | $username_v = !empty($xoopsUser) ? $xoopsUser->getVar('uname', 'E') : ''; |
||
| 31 | $usermail_v = !empty($xoopsUser) ? $xoopsUser->getVar('email', 'E') : ''; |
||
| 32 | $notifypub = '1'; |
||
| 33 | include __DIR__ . '/include/requestform.php'; |
||
| 34 | $xoopsTpl->assign('modulename', $xoopsModule->dirname()); |
||
| 35 | |||
| 36 | $rform->assign($xoopsTpl); |
||
| 37 | |||
| 38 | $xoopsTpl->assign('lang_modulename', $xoopsModule->name()); |
||
| 39 | $xoopsTpl->assign('lang_moduledirname', $xoopsModule->getVar('dirname')); |
||
| 40 | |||
| 41 | $xoopsTpl->assign('xoops_pagetitle', $myts->htmlSpecialChars($xoopsModule->name()) . ' - ' . _MD_LEXIKON_ASKFORDEF); |
||
| 42 | $xoopsTpl->assign('xoops_module_header', '<link rel="stylesheet" type="text/css" href="assets/css/style.css" />'); |
||
| 43 | // Meta data |
||
| 44 | $meta_description = _MD_LEXIKON_ASKFORDEF . ' - ' . $myts->htmlSpecialChars($xoopsModule->name()); |
||
| 45 | if (isset($xoTheme) && is_object($xoTheme)) { |
||
| 46 | $xoTheme->addMeta('meta', 'description', $meta_description); |
||
| 47 | } else { |
||
| 48 | $xoopsTpl->assign('xoops_meta_description', $meta_description); |
||
| 49 | } |
||
| 50 | include XOOPS_ROOT_PATH . '/footer.php'; |
||
| 51 | } else { |
||
| 52 | extract($_POST); |
||
| 53 | |||
| 54 | $display = 'D'; |
||
| 55 | $myts = MyTextSanitizer::getInstance(); |
||
| 56 | $usermail = isset($_POST['usermail']) ? $myts->stripSlashesGPC($_POST['usermail']) : ''; |
||
| 57 | $username = isset($_POST['username']) ? $myts->stripSlashesGPC($_POST['username']) : ''; |
||
| 58 | $reqterm = isset($_POST['reqterm']) ? $myts->htmlSpecialChars($_POST['reqterm']) : ''; |
||
| 59 | $notifypub = isset($_POST['notifypub']) ? (int)$_POST['notifypub'] : 1; |
||
| 60 | $html = isset($_POST['html']) ? (int)$_POST['html'] : 1; |
||
| 61 | $smiley = isset($_POST['smiley']) ? (int)$_POST['smiley'] : 1; |
||
| 62 | $xcodes = isset($_POST['xcodes']) ? (int)$_POST['xcodes'] : 1; |
||
| 63 | if ($xoopsUser) { |
||
| 64 | $user = $xoopsUser->getVar('uid'); |
||
| 65 | } else { |
||
| 66 | $user = _MD_LEXIKON_ANONYMOUS; |
||
| 67 | } |
||
| 68 | $submit = 1; |
||
| 69 | $date = time(); |
||
| 70 | $offline = 1; |
||
| 71 | $request = 1; |
||
| 72 | $ref = ''; |
||
| 73 | $url = ''; |
||
| 74 | $init = substr($reqterm, 0, 1); |
||
| 75 | |||
| 76 | $xoopsDB->query('INSERT INTO ' |
||
| 77 | . $xoopsDB->prefix('lxentries') |
||
| 78 | . " (entryID, term, init, ref, url, uid, submit, datesub, html, smiley, xcodes, offline, notifypub, request ) VALUES ('', '$reqterm', '$init', '$ref', '$url', '$user', '$submit', '$date', '$html', '$smiley', '$xcodes', '$offline', '$notifypub', '$request' )"); |
||
| 79 | $newid = $xoopsDB->getInsertId(); |
||
| 80 | // Increment author's posts count |
||
| 81 | View Code Duplication | if (is_object($xoopsUser) && !empty($user)) { |
|
| 82 | $memberHandler = xoops_getHandler('member'); |
||
| 83 | $submitter = $memberHandler->getUser($user); |
||
| 84 | if (is_object($submitter)) { |
||
| 85 | $submitter->setVar('posts', $submitter->getVar('posts') + 1); |
||
| 86 | $res = $memberHandler->insertUser($submitter, true); |
||
| 87 | unset($submitter); |
||
| 88 | } |
||
| 89 | } |
||
| 90 | // trigger Notification |
||
| 91 | if (!empty($xoopsModuleConfig['notification_enabled'])) { |
||
| 92 | global $xoopsModule; |
||
| 93 | if ($newid == 0) { |
||
| 94 | $newid = $xoopsDB->getInsertId(); |
||
| 95 | } |
||
| 96 | $notificationHandler = xoops_getHandler('notification'); |
||
| 97 | $tags = array(); |
||
| 98 | $tags['ITEM_NAME'] = $reqterm; |
||
| 99 | $tags['DATESUB'] = formatTimestamp($date, 'd M Y'); |
||
| 100 | $tags['ITEM_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/submit.php?suggest=' . $newid; |
||
| 101 | $notificationHandler->triggerEvent('global', 0, 'term_request', $tags); |
||
| 102 | } |
||
| 103 | $adminmail = $xoopsConfig['adminmail']; |
||
| 104 | |||
| 105 | if ($xoopsUser) { |
||
| 106 | $logname = $xoopsUser->getVar('uname', 'E'); |
||
| 107 | } else { |
||
| 108 | $logname = $xoopsConfig['anonymous']; |
||
| 109 | } |
||
| 110 | |||
| 111 | View Code Duplication | if ($xoopsUser) { |
|
| 112 | $result = $xoopsDB->query('select email from ' . $xoopsDB->prefix('users') . " where uname='$logname'"); |
||
| 113 | list($address) = $xoopsDB->fetchRow($result); |
||
| 114 | } else { |
||
| 115 | $address = $xoopsConfig['adminmail']; |
||
| 116 | } |
||
| 117 | |||
| 118 | if ($xoopsModuleConfig['mailtoadmin'] == 1) { |
||
| 119 | $adminMessage = sprintf(_MD_LEXIKON_WHOASKED, $logname); |
||
| 120 | $adminMessage .= '' . $reqterm . "\n"; |
||
| 121 | $adminMessage .= '' . _MD_LEXIKON_EMAILLEFT . " $address\n"; |
||
| 122 | $adminMessage .= "\n"; |
||
| 123 | if ($notifypub == '1') { |
||
| 124 | $adminMessage .= _MD_LEXIKON_NOTIFYONPUB; |
||
| 125 | } |
||
| 126 | $adminMessage .= "\n" . $_SERVER['HTTP_USER_AGENT'] . "\n"; |
||
| 127 | $subject = $xoopsConfig['sitename'] . ' - ' . _MD_LEXIKON_DEFINITIONREQ; |
||
| 128 | $xoopsMailer =& xoops_getMailer(); |
||
| 129 | $xoopsMailer->useMail(); |
||
| 130 | $xoopsMailer->setToEmails($xoopsConfig['adminmail']); |
||
| 131 | $xoopsMailer->setFromEmail($address); |
||
| 132 | $xoopsMailer->setFromName($xoopsConfig['sitename']); |
||
| 133 | $xoopsMailer->setSubject($subject); |
||
| 134 | $xoopsMailer->setBody($adminMessage); |
||
| 135 | $xoopsMailer->send(); |
||
| 136 | //$messagesent = sprintf(_MD_LEXIKON_MESSAGESENT,$xoopsConfig['sitename'])."<br>"._MD_LEXIKON_THANKS1.""; |
||
| 137 | } |
||
| 138 | //send 'received!' mail |
||
| 139 | //if (LexikonUtility::getModuleOption('mailtosender') && $address) { |
||
|
0 ignored issues
–
show
|
|||
| 140 | View Code Duplication | if ($xoopsModuleConfig['mailtosender'] == 1 && $address) { |
|
| 141 | $conf_subject = _MD_LEXIKON_THANKS2; |
||
| 142 | $userMessage = sprintf(_MD_LEXIKON_GOODDAY2, $logname); |
||
| 143 | $userMessage .= "\n\n"; |
||
| 144 | $userMessage .= sprintf(_MD_LEXIKON_THANKYOU, $xoopsConfig['sitename']); |
||
| 145 | $userMessage .= "\n"; |
||
| 146 | $userMessage .= sprintf(_MD_LEXIKON_REQUESTSENT, $xoopsConfig['sitename']); |
||
| 147 | $userMessage .= "\n"; |
||
| 148 | $userMessage .= "--------------\n"; |
||
| 149 | $userMessage .= '' . $xoopsConfig['sitename'] . ' ' . _MD_LEXIKON_WEBMASTER . "\n"; |
||
| 150 | $userMessage .= '' . $xoopsConfig['adminmail'] . ''; |
||
| 151 | $xoopsMailer =& xoops_getMailer(); |
||
| 152 | $xoopsMailer->useMail(); |
||
| 153 | $xoopsMailer->setToEmails($address); |
||
| 154 | $xoopsMailer->setFromEmail($xoopsConfig['adminmail']); |
||
| 155 | $xoopsMailer->setFromName($xoopsConfig['sitename']); |
||
| 156 | $xoopsMailer->setSubject($conf_subject); |
||
| 157 | $xoopsMailer->setBody($userMessage); |
||
| 158 | $xoopsMailer->send(); |
||
| 159 | |||
| 160 | $messagesent = sprintf(_MD_LEXIKON_MESSAGESENT, $xoopsConfig['sitename']) . '<br>' . _MD_LEXIKON_THANKS1 . ''; |
||
| 161 | $messagesent .= sprintf(_MD_LEXIKON_SENTCONFIRMMAIL, $address); |
||
| 162 | //} |
||
| 163 | //if ($xoopsModuleConfig['mailtoadmin'] == 1) { |
||
| 164 | //$messagesent .= sprintf(_MD_LEXIKON_SENTCONFIRMMAIL,$address); |
||
| 165 | } else { |
||
| 166 | //$messagesent = sprintf(_MD_LEXIKON_SENTCONFIRMMAIL,$address); |
||
| 167 | $messagesent = sprintf(_MD_LEXIKON_MESSAGESENT, $xoopsConfig['sitename']) . '<br>' . _MD_LEXIKON_THANKS1 . ''; |
||
| 168 | } |
||
| 169 | redirect_header('index.php', 2, $messagesent); |
||
| 170 | } |
||
| 171 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.