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 | * $Id: index.php v 1.0 8 May 2004 hsalazar Exp $ |
||
| 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( "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 | exit(); |
||
| 17 | }*/ |
||
| 18 | // permissions |
||
| 19 | $gperm_handler = 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']) ? intval($_POST['categoryID']) : 0; |
||
| 23 | if (!$gperm_handler->checkRight('lexikon_request', $perm_itemid, $groups, $module_id)) { |
||
| 24 | redirect_header('javascript:history.go(-1)', 3, _ERRORS); |
||
| 25 | exit(); |
||
| 26 | } |
||
| 27 | if ( empty($_POST['submit']) ) { |
||
| 28 | $xoopsOption['template_main'] = 'lx_request.html'; |
||
| 29 | include XOOPS_ROOT_PATH."/header.php"; |
||
| 30 | include_once XOOPS_ROOT_PATH."/class/xoopsformloader.php"; |
||
| 31 | $username_v = !empty($xoopsUser) ? $xoopsUser->getVar("uname", "E") : ""; |
||
| 32 | $usermail_v = !empty($xoopsUser) ? $xoopsUser->getVar("email", "E") : ""; |
||
| 33 | $notifypub = '1'; |
||
| 34 | include "include/requestform.php"; |
||
| 35 | $xoopsTpl -> assign ( 'modulename', $xoopsModule->dirname()); |
||
| 36 | |||
| 37 | $rform->assign($xoopsTpl); |
||
| 38 | |||
| 39 | $xoopsTpl -> assign ( 'lang_modulename', $xoopsModule->name() ); |
||
| 40 | $xoopsTpl -> assign ( 'lang_moduledirname', $xoopsModule->getVar('dirname') ); |
||
| 41 | |||
| 42 | $xoopsTpl->assign('xoops_pagetitle', $myts->htmlSpecialChars($xoopsModule->name()). ' - ' ._MD_LEXIKON_ASKFORDEF); |
||
| 43 | $xoopsTpl->assign("xoops_module_header", '<link rel="stylesheet" type="text/css" href="style.css" />'); |
||
| 44 | // Meta data |
||
| 45 | $meta_description = _MD_LEXIKON_ASKFORDEF. ' - ' .$myts->htmlSpecialChars($xoopsModule->name()); |
||
| 46 | if (isset($xoTheme) && is_object($xoTheme)) { |
||
| 47 | $xoTheme->addMeta( 'meta', 'description', $meta_description); |
||
| 48 | } else { |
||
| 49 | $xoopsTpl->assign('xoops_meta_description', $meta_description); |
||
| 50 | } |
||
| 51 | include XOOPS_ROOT_PATH."/footer.php"; |
||
| 52 | } else { |
||
| 53 | extract($_POST); |
||
| 54 | |||
| 55 | $display = "D"; |
||
| 56 | $myts = MyTextSanitizer::getInstance(); |
||
| 57 | $usermail = (isset($_POST['usermail'])) ? $myts->stripSlashesGPC($_POST['usermail']) : ''; |
||
| 58 | $username = (isset($_POST['username'])) ? $myts->stripSlashesGPC($_POST['username']) : ''; |
||
| 59 | $reqterm = (isset($_POST['reqterm'])) ? $myts->htmlSpecialChars($_POST['reqterm']) : ''; |
||
| 60 | $notifypub = (isset($_POST['notifypub'])) ? intval($_POST['notifypub']) : 1; |
||
| 61 | $html = (isset($_POST['html'])) ? intval($_POST['html']) : 1; |
||
| 62 | $smiley = (isset($_POST['smiley'])) ? intval($_POST['smiley']) : 1; |
||
| 63 | $xcodes = (isset($_POST['xcodes'])) ? intval($_POST['xcodes']) : 1; |
||
| 64 | if ( $xoopsUser ) { |
||
| 65 | $user = $xoopsUser -> getVar ("uid"); |
||
| 66 | } else { |
||
| 67 | $user = _MD_LEXIKON_ANONYMOUS; |
||
| 68 | } |
||
| 69 | $submit = 1; |
||
| 70 | $date = time(); |
||
| 71 | $offline = 1; |
||
| 72 | $request = 1; |
||
| 73 | $ref = ''; |
||
| 74 | $url = ''; |
||
| 75 | $init = substr($reqterm, 0, 1); |
||
| 76 | |||
| 77 | $xoopsDB -> query ( "INSERT INTO ".$xoopsDB->prefix("lxentries")." (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' )"); |
||
| 78 | $newid = $xoopsDB -> getInsertId(); |
||
| 79 | // Increment author's posts count |
||
| 80 | View Code Duplication | if (is_object($xoopsUser) && !empty($user)) { |
|
| 81 | $member_handler = xoops_gethandler('member'); |
||
| 82 | $submitter = $member_handler -> getUser($user); |
||
| 83 | if (is_object($submitter) ) { |
||
| 84 | $submitter -> setVar('posts',$submitter -> getVar('posts') + 1); |
||
| 85 | $res=$member_handler -> insertUser($submitter, true); |
||
| 86 | unset($submitter); |
||
| 87 | } |
||
| 88 | } |
||
| 89 | // trigger Notification |
||
| 90 | if(!empty($xoopsModuleConfig['notification_enabled']) ){ |
||
| 91 | global $xoopsModule; |
||
| 92 | if ($newid == 0) { |
||
| 93 | $newid = $xoopsDB->getInsertId(); |
||
| 94 | } |
||
| 95 | $notification_handler = xoops_gethandler('notification'); |
||
| 96 | $tags = array(); |
||
| 97 | $tags['ITEM_NAME'] = $reqterm; |
||
| 98 | $tags['DATESUB'] = formatTimestamp( $date, 'd M Y' ); |
||
| 99 | $tags['ITEM_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/submit.php?suggest='. $newid; |
||
| 100 | $notification_handler->triggerEvent('global', 0, 'term_request', $tags); |
||
| 101 | } |
||
| 102 | $adminmail = $xoopsConfig['adminmail']; |
||
| 103 | |||
| 104 | if ($xoopsUser) { |
||
| 105 | $logname = $xoopsUser->getVar("uname", "E"); |
||
| 106 | } else { |
||
| 107 | $logname = $xoopsConfig['anonymous']; |
||
| 108 | } |
||
| 109 | |||
| 110 | View Code Duplication | if ($xoopsUser) { |
|
| 111 | $result = $xoopsDB->query("select email from ".$xoopsDB->prefix("users")." where uname='$logname'"); |
||
| 112 | list($address) = $xoopsDB->fetchRow($result); |
||
| 113 | } else { |
||
| 114 | $address = $xoopsConfig['adminmail']; |
||
| 115 | } |
||
| 116 | |||
| 117 | if ($xoopsModuleConfig['mailtoadmin'] == 1) { |
||
| 118 | $adminMessage = sprintf( _MD_LEXIKON_WHOASKED, $logname ); |
||
| 119 | $adminMessage .= "".$reqterm."\n"; |
||
| 120 | $adminMessage .= ""._MD_LEXIKON_EMAILLEFT." $address\n"; |
||
| 121 | $adminMessage .= "\n"; |
||
| 122 | if ($notifypub == '1') { |
||
| 123 | $adminMessage .= _MD_LEXIKON_NOTIFYONPUB; |
||
| 124 | } |
||
| 125 | $adminMessage .= "\n".$_SERVER['HTTP_USER_AGENT']."\n"; |
||
| 126 | $subject = $xoopsConfig['sitename']." - "._MD_LEXIKON_DEFINITIONREQ; |
||
| 127 | $xoopsMailer = getMailer(); |
||
| 128 | $xoopsMailer->useMail(); |
||
| 129 | $xoopsMailer->setToEmails($xoopsConfig['adminmail']); |
||
| 130 | $xoopsMailer->setFromEmail($address); |
||
| 131 | $xoopsMailer->setFromName($xoopsConfig['sitename']); |
||
| 132 | $xoopsMailer->setSubject($subject); |
||
| 133 | $xoopsMailer->setBody($adminMessage); |
||
| 134 | $xoopsMailer->send(); |
||
| 135 | //$messagesent = sprintf(_MD_LEXIKON_MESSAGESENT,$xoopsConfig['sitename'])."<br />"._MD_LEXIKON_THANKS1.""; |
||
| 136 | } |
||
| 137 | //send 'received!' mail |
||
| 138 | //if (lx_getmoduleoption('mailtosender') && $address) { |
||
|
0 ignored issues
–
show
|
|||
| 139 | View Code Duplication | if ( $xoopsModuleConfig['mailtosender'] == 1 && $address) { |
|
| 140 | $conf_subject = _MD_LEXIKON_THANKS2; |
||
| 141 | $userMessage = sprintf(_MD_LEXIKON_GOODDAY2, $logname); |
||
| 142 | $userMessage .= "\n\n"; |
||
| 143 | $userMessage .= sprintf(_MD_LEXIKON_THANKYOU,$xoopsConfig['sitename']); |
||
| 144 | $userMessage .= "\n"; |
||
| 145 | $userMessage .= sprintf(_MD_LEXIKON_REQUESTSENT,$xoopsConfig['sitename']); |
||
| 146 | $userMessage .= "\n"; |
||
| 147 | $userMessage .= "--------------\n"; |
||
| 148 | $userMessage .= "".$xoopsConfig['sitename']." "._MD_LEXIKON_WEBMASTER."\n"; |
||
| 149 | $userMessage .= "".$xoopsConfig['adminmail'].""; |
||
| 150 | $xoopsMailer = getMailer(); |
||
| 151 | $xoopsMailer->useMail(); |
||
| 152 | $xoopsMailer->setToEmails($address); |
||
| 153 | $xoopsMailer->setFromEmail($xoopsConfig['adminmail']); |
||
| 154 | $xoopsMailer->setFromName($xoopsConfig['sitename']); |
||
| 155 | $xoopsMailer->setSubject($conf_subject); |
||
| 156 | $xoopsMailer->setBody($userMessage); |
||
| 157 | $xoopsMailer->send(); |
||
| 158 | |||
| 159 | $messagesent = sprintf(_MD_LEXIKON_MESSAGESENT,$xoopsConfig['sitename'])."<br />"._MD_LEXIKON_THANKS1.""; |
||
| 160 | $messagesent .= sprintf(_MD_LEXIKON_SENTCONFIRMMAIL,$address); |
||
| 161 | //} |
||
| 162 | //if ($xoopsModuleConfig['mailtoadmin'] == 1) { |
||
| 163 | //$messagesent .= sprintf(_MD_LEXIKON_SENTCONFIRMMAIL,$address); |
||
| 164 | } else { |
||
| 165 | //$messagesent = sprintf(_MD_LEXIKON_SENTCONFIRMMAIL,$address); |
||
| 166 | $messagesent = sprintf(_MD_LEXIKON_MESSAGESENT,$xoopsConfig['sitename'])."<br />"._MD_LEXIKON_THANKS1.""; |
||
| 167 | } |
||
| 168 | redirect_header("index.php", 2, $messagesent ); |
||
| 169 | } |
||
| 170 |
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.