/** * This will save a submission * * @param string $type Type of submission we are dealing with * @param array $A Data for that submission * */ function savesubmission($type, $A) { global $_CONF, $_TABLES, $LANG12; COM_clearSpeedlimit($_CONF['speedlimit'], 'submit'); $last = COM_checkSpeedlimit('submit'); if ($last > 0) { $retval = COM_showMessageText($LANG12[30] . $last . $LANG12[31], $LANG12[26]); $retval = COM_createHTMLDocument($retval); return $retval; } if (!empty($type) && $type !== 'story') { // Update the submitspeedlimit for user - assuming Plugin approves // submission record COM_updateSpeedlimit('submit'); // see if this is a submission that needs to be handled by a plugin // and should include its own redirect $retval = PLG_saveSubmission($type, $A); if ($retval === false) { COM_errorLog("Could not save your submission. Bad type: {$type}"); } elseif (empty($retval)) { // plugin should include its own redirect - but in case handle // it here and redirect to the main page PLG_submissionSaved($type); COM_redirect($_CONF['site_url'] . '/index.php'); } else { PLG_submissionSaved($type); return $retval; } } if (!empty($A['title']) && !empty($A['introtext']) && TOPIC_checkTopicSelectionControl()) { $retval = savestory($A); PLG_submissionSaved($type); } else { $retval = COM_showMessageText($LANG12[23], $LANG12[22]) . submissionform($type); $retval = COM_createHTMLDocument($retval); } return $retval; }
/** * This will save a submission * * @param string $type Type of submission we are dealing with * @param array $A Data for that submission * */ function savesubmission($type, $A) { global $_CONF, $_TABLES, $_USER, $LANG12; $retval = COM_siteHeader(); COM_clearSpeedlimit($_CONF['speedlimit'], 'submit'); $last = COM_checkSpeedlimit('submit'); if ($last > 0) { $retval .= COM_startBlock($LANG12[26], '', COM_getBlockTemplate('_msg_block', 'header')) . $LANG12[30] . $last . $LANG12[31] . COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer')) . COM_siteFooter(); return $retval; } if (!empty($type) && $type != 'story') { // Update the submitspeedlimit for user - assuming Plugin approves // submission record COM_updateSpeedlimit('submit'); // see if this is a submission that needs to be handled by a plugin // and should include its own redirect $retval = PLG_saveSubmission($type, $A); if ($retval === false) { COM_errorLog("Could not save your submission. Bad type: {$type}"); } elseif (empty($retval)) { // plugin should include its own redirect - but in case handle // it here and redirect to the main page return COM_refresh($_CONF['site_url'] . '/index.php'); } else { return $retval; } } if (!empty($A['title']) && !empty($A['introtext'])) { $retval = savestory($A); } else { $retval .= COM_startBlock($LANG12[22], '', COM_getBlockTemplate('_msg_block', 'header')) . $LANG12[23] . COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer')) . submissionform($type) . COM_siteFooter(); } return $retval; }
} //lets do the sql insert $sql = "INSERT INTO " . $list_prefix . "prayer_list (id, request_for, request, postdate, expiredate, requested_by, username) VALUES ('" . $idval . "', '" . $HTTP_POST_VARS['request_for'] . "', '" . $HTTP_POST_VARS['request'] . "', '" . $req_date . "', '" . $expire . "', '" . addslashes($email) . "', '" . addslashes($username) . "');"; $result = db_query($sql); if ($result) { $WORK = "Your prayer request has been processed.<BR>\r\n"; } else { $WORK = "ERROR: the server was unable to process your prayer request at this time.<BR>\r\n"; $WORK .= "The SQL query was: " . $sql . "<BR>\r\n"; } $WORK = insert_into_template($MAIN, "{CONTENT}", $WORK); $WORK = filltemplate($WORK, "Submit a Prayer Request"); printf("%s", striptemplate($WORK)); } } //===Main code================================================================ //check to see if the user is logged in. $user = getuserinfo(); if (0 == strcmp($user['email'], "anonymous")) { $logged_in = 0; } else { $logged_in = 1; } //lets do the submission code. if (isset($HTTP_GET_VARS['submit'])) { //are we submitting a request? processsubmission(); } else { //if not lets allow them to submit. submissionform(); }