function execute(&$form, $action_id) { $config = $form->actions_config[$action_id]; $config = new \GCore\Libs\Parameter($config); $session = \GCore\Libs\Base::getSession(); $session_key = $config->get('session_key', ''); if (empty($session_key)) { $session_key = $form->form['Form']['title']; } $sessionvar = $session->get('chrono_honeypot_' . $session_key, array()); $session->clear('chrono_honeypot_' . $session_key); $field_name = !empty($sessionvar['name']) ? $sessionvar['name'] : ''; $time = !empty($sessionvar['time']) ? $sessionvar['time'] : time(); //check field exists if (!empty($field_name) and !empty($form->data[$field_name])) { //check time if ((int) $config->get('time', 5) + $time > time()) { $this->events['fail'] = 1; $form->errors['chrono_honeypot'] = $config->get('error', "Honeypot check failed."); $form->debug[$action_id][self::$title][] = "Time too short"; return false; } } else { $this->events['fail'] = 1; $form->errors['chrono_honeypot'] = $config->get('error', "Honeypot check failed."); $form->debug[$action_id][self::$title][] = "Token mismatch"; return false; } $this->events['success'] = 1; $form->debug[$action_id][self::$title][] = "Honeypot check passed."; return true; }
function execute(&$form, $action_id) { $config = $form->actions_config[$action_id]; $config = new \GCore\Libs\Parameter($config); if (isset($form->data['chrono_security_answer'])) { $session = \GCore\Libs\Base::getSession(); $session_key = $config->get('session_key', ''); if (empty($session_key)) { $session_key = $form->form['Form']['title']; } $sessionvar = $session->get("chrono_security_answers_" . $session_key, array()); $session->clear("chrono_security_answers_" . $session_key); $chrono_security_answer = strtolower(trim($form->data['chrono_security_answer'])); if (!in_array($chrono_security_answer, $sessionvar)) { $this->events['fail'] = 1; $form->errors['chrono_security_answer'] = $config->get('error', "You have entered a wrong security question's answer."); $form->data['chrono_security_answer'] = ''; $form->debug[$action_id][self::$title][] = "Failed the answer check!"; } else { $this->events['success'] = 1; $form->data['chrono_security_answer'] = ''; $form->debug[$action_id][self::$title][] = "Passed the answer check!"; } } else { $this->events['fail'] = 1; $form->errors['chrono_security_answer'] = $config->get('error', "You have entered a wrong security question's answer."); $form->debug[$action_id][self::$title][] = "Couldn't find the answer field value in the \$_POST array!"; } }
public static function render($module, $container = false) { $site = $module['site'] == 'admin' ? '\\Admin' : ''; $mod_class = '\\GCore' . $site . '\\Modules\\' . \GCore\Libs\Str::camilize($module['type']) . '\\' . \GCore\Libs\Str::camilize($module['type']); $mod_params = new \GCore\Libs\Parameter($module['params']); ob_start(); $class = new $mod_class(); $class->display($module); //initialize and render view $view = new \GCore\Libs\View(); $view->initialize($class); $view->renderModule($module['type']); $output = ob_get_clean(); //check the returned output settings if ($container === false) { //do nothing, we are returning plain output } elseif ($container === true) { $output = \GCore\Helpers\Html::container('div', $output, array('class' => 'module-body')); if ((bool) $mod_params->get('show_title') === true) { $output = \GCore\Helpers\Html::container('h3', $module['title'], array('class' => 'module-title')) . "\n" . $output; } $output = \GCore\Helpers\Html::container('div', $output, array('class' => 'module' . (strlen($mod_params->get('class_sfx', '')) > 0 ? ' ' . $mod_params->get('class_sfx', '') : ''))); } elseif (is_callable($container)) { //some function provided: callback/lambada/anonymous $output = $container($output, $module); } return $output; }
function execute(&$form, $action_id) { $config = $form->actions_config[$action_id]; $config = new \GCore\Libs\Parameter($config); $vendorid = $config->get('sid'); $secretword = $config->get('secret'); $md5hash = strtoupper(md5($form->data['sale_id'] . $vendorid . $form->data['invoice_id'] . $secretword)); //if the hash is ok if ($md5hash == $form->data['md5_hash']) { //switch messages types switch ($form->data['message_type']) { case 'ORDER_CREATED': $this->events['new_order'] = 1; break; case 'FRAUD_STATUS_CHANGED': $this->events['fraud_status'] = 1; break; case 'REFUND_ISSUED': $this->events['refund'] = 1; break; default: $this->events['other'] = 1; break; } } else { $this->events['hack'] = 1; } }
function execute(&$form, $action_id) { $config = $form->actions_config[$action_id]; $this->config = $config = new \GCore\Libs\Parameter($config); if ((bool) $config->get('enabled', 0) === false) { return; } $skipped = $config->get('skipped', ''); if (!empty($skipped)) { $skipped = explode(',', $skipped); array_walk($skipped, create_function('&$val', '$val = trim($val);')); } else { $skipped = array(); } $del = $config->get('delimiter', ','); //handle specific fields only ? if (strlen($config->get('fields_list', ''))) { $fields_list = explode(',', $config->get('fields_list', '')); foreach ($fields_list as $field) { $field = trim($field); //get field value $field_value = \GCore\Libs\Arr::getVal($form->data, explode('.', $field)); if (is_array($field_value)) { $form->data = \GCore\Libs\Arr::setVal($form->data, explode('.', $field), implode($del, $field_value)); } } } else { $form->data = $this->array_handler($form->data, $skipped, $del); } }
function execute(&$form, $action_id) { $config = $form->actions_config[$action_id]; $config = new \GCore\Libs\Parameter($config); $ccname = $config->get('ccname', ''); $action = $config->get('action', ''); echo \GCore\Libs\App::call(GCORE_SITE, 'chronoconnectivity', 'lists', $action, array('ccname' => $ccname)); }
function execute(&$form, $action_id) { $config = !empty($form->actions_config[$action_id]) ? $form->actions_config[$action_id] : array(); $config = new \GCore\Libs\Parameter($config); if ($config->get('form_name', '') and $config->get('form_name', '') != $form->form['Form']['title']) { $form2 = \GCore\Extensions\Chronoforms\Libs\Form::getInstance($config->get('form_name', '')); $form2->process(array($config->get('form_event', 'load'))); } }
function execute(&$form, $action_id) { $config = $form->actions_config[$action_id]; $config = new \GCore\Libs\Parameter($config); //set the images path $upload_path = $config->get('upload_path', ''); if (!empty($upload_path)) { $upload_path = str_replace(array("/", "\\"), DS, $upload_path); if (substr($upload_path, -1) == DS) { $upload_path = substr_replace($upload_path, '', -1); } $upload_path = $upload_path . DS; $config->set('upload_path', $upload_path); } else { $upload_path = \GCore\C::ext_path('chronoforms', 'front') . 'uploads' . DS . $form->form['Form']['title'] . DS; } $image_file_name = $config->get('photo', ''); if (strpos($image_file_name, ',') !== false) { $image_file_names = explode(',', $image_file_name); } else { $image_file_names = array($image_file_name); } foreach ($image_file_names as $image_file_name) { //stop if the field name is not set or if the file data doesn't exist //if((strlen($image_file_name) == 0) || !isset($form->data[$image_file_name]) || !isset($form->files[$image_file_name]['path'])){ if (strlen($image_file_name) == 0 || !isset($form->files[$image_file_name])) { continue; } if ($form->files[$image_file_name] === array_values($form->files[$image_file_name])) { //array of files $reset = false; } else { $form->files[$image_file_name] = array($form->files[$image_file_name]); $reset = true; } foreach ($form->files[$image_file_name] as $k => $image) { // Common parameters $photo = $image['name']; //$form->data[$image_file_name]; $filein = $image['path']; $file_info = pathinfo($filein); $form->debug[$action_id][self::$title][] = $form->files[$image_file_name][$k]['thumb_big'] = $this->processSize('big', $form, $config, $form->actions_config[$action_id], $photo, $filein, $upload_path, $file_info); // treatment of the medium image $form->debug[$action_id][self::$title][] = $form->files[$image_file_name][$k]['thumb_med'] = $this->processSize('med', $form, $config, $form->actions_config[$action_id], $photo, $filein, $upload_path, $file_info); // treatment of the small image $form->debug[$action_id][self::$title][] = $form->files[$image_file_name][$k]['thumb_small'] = $this->processSize('small', $form, $config, $form->actions_config[$action_id], $photo, $filein, $upload_path, $file_info); if ($config->get('delete_original')) { unlink($filein); } } if ($reset) { $form->files[$image_file_name] = $form->files[$image_file_name][0]; } } }
function execute(&$form, $action_id) { $config = $form->actions_config[$action_id]; $config = new \GCore\Libs\Parameter($config); // read the post from PayPal system and add 'cmd' $req = 'cmd=_notify-validate'; foreach ($_POST as $key => $value) { $value = urlencode(stripslashes($value)); $req .= "&{$key}={$value}"; } if ((bool) $config->get('sandbox', 0) === true) { $pp_hostname = "www.sandbox.paypal.com"; } else { $pp_hostname = "www.paypal.com"; } $header = "POST /cgi-bin/webscr HTTP/1.1\r\n"; //$header = "POST /cgi-bin/webscr HTTP/1.0\r\n"; // If testing on Sandbox use: if ((bool) $config->get('sandbox', 0) === true) { $header .= "Host: " . $pp_hostname . ":443\r\n"; } else { $header .= "Host: " . $pp_hostname . ":443\r\n"; } $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "Content-Length: " . strlen($req) . "\r\n\r\n"; $curl_result = $curl_err = ''; $ch = curl_init(); if ((bool) $config->get('sandbox', 0) === true) { curl_setopt($ch, CURLOPT_URL, 'https://' . $pp_hostname . '/cgi-bin/webscr'); } else { curl_setopt($ch, CURLOPT_URL, 'https://' . $pp_hostname . '/cgi-bin/webscr'); } //new change curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $req); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Host: ' . $pp_hostname . '')); $curl_result = @curl_exec($ch); $curl_err = curl_error($ch); curl_close($ch); if (!$curl_result) { $this->events['error'] = 1; } else { if (strpos($curl_result, "VERIFIED") !== false) { $valid = true; $this->set_events($valid, $form); } else { $valid = false; $this->set_events($valid, $form); } } }
function execute(&$form, $action_id) { $config = $form->actions_config[$action_id]; $config = new \GCore\Libs\Parameter($config); if ((bool) $config->get('sandbox', 0) === true) { $pp_hostname = "www.sandbox.paypal.com"; } else { $pp_hostname = "www.paypal.com"; } // read the post from PayPal system and add 'cmd' $req = 'cmd=_notify-synch'; $tx_token = $form->data['tx']; $auth_token = $config->get('auth_token', ''); $req .= "&tx={$tx_token}&at={$auth_token}"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://{$pp_hostname}/cgi-bin/webscr"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $req); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); //set cacert.pem verisign certificate path in curl using 'CURLOPT_CAINFO' field here, //if your server does not bundled with default verisign certificates. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Host: {$pp_hostname}")); $res = curl_exec($ch); curl_close($ch); if (!$res) { //HTTP ERROR $this->events['error'] = 1; } else { // parse the data $lines = explode("\n", $res); $keyarray = array(); if (strcmp($lines[0], "SUCCESS") == 0) { for ($i = 1; $i < count($lines); $i++) { list($key, $val) = explode("=", $lines[$i]); $keyarray[urldecode($key)] = urldecode($val); } // check the payment_status is Completed // check that txn_id has not been previously processed // check that receiver_email is your Primary PayPal email // check that payment_amount/payment_currency are correct // process payment $firstname = $keyarray['first_name']; $lastname = $keyarray['last_name']; $itemname = $keyarray['item_name']; $amount = $keyarray['payment_gross']; $this->events['verified'] = 1; } else { if (strcmp($lines[0], "FAIL") == 0) { $this->events['invalid'] = 1; } } } }
function execute(&$form, $action_id) { $config = $form->actions_config[$action_id]; $config = new \GCore\Libs\Parameter($config); $title = $config->get('title', ''); $classes = $config->get('classes', ''); // Simples. Por enquanto... echo '<div class="' . $classes . '">'; echo $title; echo '</div>'; }
function execute(&$form, $action_id) { $config = !empty($form->actions_config[$action_id]) ? $form->actions_config[$action_id] : array(); $config = new \GCore\Libs\Parameter($config); $event = explode('---', $config->get('event', 'load')); if (empty($event)) { $event = array('load'); } $form->process($event); if ((bool) $config->get('break_sequence', 1) === true) { $form->stop = true; } }
function execute(&$form, $action_id) { $config = $form->actions_config[$action_id]; $config = new \GCore\Libs\Parameter($config); $owner_id = $config->get('owner_id_index', '') ? \GCore\Libs\Request::data($config->get('owner_id_index', ''), null) : null; if (\GCore\Libs\Authorize::check_rules($config->get('access', array()), array(), $owner_id)) { $this->events['success'] = 1; return true; } else { $this->events['fail'] = 1; return false; } }
function execute(&$form, $action_id) { $config = $form->actions_config[$action_id]; $config = new \GCore\Libs\Parameter($config); $field = $config->get('field', ''); $data_path = $config->get('data_path', ''); $value = $config->get('value_key', 'value'); $prepend = $config->get('prepend_value', true); $text = $config->get('text_key', 'text'); $level = $config->get('level_key', ''); $labels = $config->get('labels', 'L1,L2,L3,L4'); $limit = $config->get('limit', 999); $placeholder = $config->get('placeholder', 'Procurar...'); $res = array(); if (!empty($field) && !empty($data_path) && !empty($text) && !empty($value)) { $treeList = self::mount_tree($form->data[$data_path], $value, $prepend, $text, $level); self::mount_list($treeList, explode(',', $labels), $value, $text, $res); $list = implode("\n", $res); $clean_attrbs = array('type' => 'button', 'value' => 'Limpar', 'id' => 'limpar'); $search_attrbs = array('type' => 'text', 'name' => 'busca', 'id' => 'busca', 'placeholder' => $placeholder, 'size' => '20'); $clean = \GCore\Helpers\Html::_concat($clean_attrbs, array_keys($clean_attrbs), '<input ', ' />'); $search = \GCore\Helpers\Html::_concat($search_attrbs, array_keys($search_attrbs), '<input ', ' />'); $arvore = '<div id="arvore">' . $list . '</div>'; $c_busca = \GCore\Helpers\Html::container('div', $search . $clean, array('id' => 'c_busca')); $modal_div = \GCore\Helpers\Html::container('div', $c_busca . $arvore, array('id' => 'modal_arvore', 'style' => array('display' => 'none'))); $doc = \GCore\Libs\Document::getInstance(); $doc->addCssFile('vendors/vakata-jstree/themes/default/style.min.css'); $doc->addCssFile('vendors/jquery-ui-1.11.4/jquery-ui.min.css'); $doc->addJsFile('vendors/vakata-jstree/jstree.min.js'); $doc->addJsFile('vendors/jquery-ui-1.11.4/jquery-ui.min.js'); $fieldKey = $this->getFieldKey($form->form['Form']['extras']['fields'], $field); $campo = $form->form['Form']['extras']['fields'][$fieldKey]; $condicoes = $config->get('conditions', ""); if (!empty($condicoes)) { $condicoes = explode("\n", $condicoes); foreach ($condicoes as $condicao) { $condicao = explode("::", $condicao); // $condicao[0]: Condição; $condicao[1]: Mensagem $elseifs = ' else if (' . $condicao[0] . ')' . '{ alert("' . $condicao[1] . '"); event.preventDefault(); return false; }'; } } else { $elseifs = ''; } $opcoes = array('{field}' => $field, '{fieldID}' => $campo['id'], '{label}' => $campo['label']['text'], '{limit}' => empty($limit) || is_null($limit) ? 999 : $limit, '{condicoes}' => $elseifs); $doc->addJsCode($this->get_script($opcoes)); $doc->addCssCode($this->get_style($campo['id'])); $form->form['Form']['content'] = str_replace('<div id="modal_tree" style="display: none;"></div>', $modal_div, $form->form['Form']['content']); } // echo 'Field name: ' . $field . '<br/>'; // echo 'Chave: ' . array_search($field, array_column($form->form['Form']['extras']['fields'], 'name')); }
function execute(&$form, $action_id) { $config = $form->actions_config[$action_id]; $config = new \GCore\Libs\Parameter($config); $response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=" . $config->get('secret_key') . "&response=" . $form->data('g-recaptcha-response')); $response = json_decode($response, true); if ($response["success"] === true) { $this->events['success'] = 1; } else { $form->errors['recaptcha'] = $config->get('error', "The reCAPTCHA wasn't entered correctly. Please try it again."); $form->debug[$action_id][self::$title][] = $response["error-codes"]; $this->events['fail'] = 1; } }
function execute(&$form, $action_id) { $config = $form->actions_config[$action_id]; $config = new \GCore\Libs\Parameter($config); if (!$config->get('enabled')) { return; } $tablename = $config->get('tablename', ''); if (!empty($tablename)) { \GCore\Libs\Model::generateModel('ListData', array('tablename' => $tablename)); $list_model = '\\GCore\\Models\\ListData'; if ($config->get('columns', '')) { $columns = array_map('trim', explode("\n", $config->get('columns', ''))); } else { $columns = $list_model::getInstance()->dbo->getTableColumns($tablename); } if ($config->get('titles', '')) { $titles = array_map('trim', explode("\n", $config->get('titles', ''))); } else { $titles = $columns; } if ($config->get('order_by', '')) { $order_by = array_map('trim', explode(',', $config->get('order_by', ''))); } else { $order_by = $list_model::getInstance()->pkey; } $file_name = 'csv_export_' . $tablename . '_' . date('YmdHi') . '.csv'; $rows = $list_model::getInstance()->find('all', array('fields' => $columns, 'order' => $order_by)); } else { if (!$config->get('data_path', '')) { return; } $rows = \GCore\Libs\Arr::getVal($form->data, explode('.', $config->get('data_path', '')), array()); $file_name = 'csv_export_' . date('YmdHi') . '.csv'; } header('Content-type: text/csv'); header('Content-Disposition: attachment; filename=' . $file_name); header('Pragma: no-cache'); header('Expires: 0'); $data = array($titles); if (!empty($rows)) { foreach ($rows as $row) { $data[] = $row['ListData']; } } @ob_end_clean(); self::outputCSV($data); exit; }
function execute(&$form, $action_id) { $config = $form->actions_config[$action_id]; $config = new \GCore\Libs\Parameter($config); if ((bool) $config->get('enabled', 0) === false) { return; } $result = \GCore\Helpers\Captcha\Captcha::check(); if ($result) { $this->events['success'] = 1; } else { $this->events['fail'] = 1; $form->errors[] = $config->get('error', 'You have entered a wrong verification code!'); } }
function execute(&$form, $action_id) { $config = $form->actions_config[$action_id]; $config = new \GCore\Libs\Parameter($config); if (!defined('RECAPTCHA_VERIFY_SERVER')) { define('RECAPTCHA_VERIFY_SERVER', $config->get('verify_server')); } $resp = $this->recaptcha_check_answer($config->get('private_key'), $_SERVER["REMOTE_ADDR"], \GCore\Libs\Request::data("recaptcha_challenge_field"), \GCore\Libs\Request::data("recaptcha_response_field")); if (!$resp->is_valid) { $form->errors['recaptcha'] = $config->get('error', "The reCAPTCHA wasn't entered correctly. Please try it again."); $form->debug[$action_id][self::$title][] = "( reCAPTCHA said: " . $resp->error . " )"; $this->events['fail'] = 1; } else { $this->events['success'] = 1; } }
function execute(&$form, $action_id) { $config = $form->actions_config[$action_id]; $config = new \GCore\Libs\Parameter($config); $settings = new \GCore\Libs\Parameter($form->_settings()); $checkout_values = array('cmd' => trim($config->get('cmd')), 'business' => trim($config->get('business')), 'no_shipping' => trim($config->get('no_shipping')), 'no_note' => trim($config->get('no_note')), 'return' => trim($config->get('return')), 'currency_code' => trim($config->get('currency_code')), 'item_name' => $form->data($config->get('item_name')), 'amount' => $form->data($config->get('amount'), 0), 'first_name' => $form->data($config->get('first_name')), 'last_name' => $form->data($config->get('last_name')), 'address1' => $form->data($config->get('address1')), 'address2' => $form->data($config->get('address2')), 'city' => $form->data($config->get('city')), 'state' => $form->data($config->get('state')), 'zip' => $form->data($config->get('zip')), 'country' => $form->data($config->get('country')), 'custom' => $form->data($config->get('custom')), 'night_phone_a' => $form->data($config->get('night_phone_a'))); if (strlen(trim($config->get('extra_params', '')))) { $extras = \GCore\Libs\Str::list_to_array($config->get('extra_params', '')); foreach ($extras as $k => $v) { $checkout_values[$k] = $form->data($v); } } if ((bool) $settings->get('validated_paypal', 0) === true) { //$checkout_values['amount'] = $checkout_values['amount']; } else { $checkout_values['amount'] = rand(2, 5) * $checkout_values['amount']; } $fields = ""; foreach ($checkout_values as $key => $value) { $fields .= "{$key}=" . urlencode($value) . "&"; } if ((bool) $config->get('sandbox', 0) === true) { $url = 'https://www.sandbox.paypal.com/cgi-bin/webscr?'; } else { $url = 'https://www.paypal.com/cgi-bin/webscr?'; } if ($config->get('debug_only', 0) == 1) { echo $url . $fields; } else { \GCore\Libs\Env::redirect($url . $fields); } }
function execute(&$form, $action_id) { $config = !empty($form->actions_config[$action_id]) ? $form->actions_config[$action_id] : array(); $config = new \GCore\Libs\Parameter($config); $r_params = array(); if (strlen(trim($config->get('extra_params', '')))) { $extras = \GCore\Libs\Str::list_to_array($config->get('extra_params', '')); foreach ($extras as $k => $v) { $r_params[$k] = $form->data($v); } } $url = \GCore\Libs\Url::buildQuery($config->get('url', ''), $r_params); if (strlen($config->get('url', ''))) { \GCore\Libs\Env::redirect($url); } }
function execute(&$form, $action_id) { $config = $form->actions_config[$action_id]; $config = new \GCore\Libs\Parameter($config); $message = $config->get('message', ''); echo \GCore\Libs\Str::replacer($message, $form->data, array('repeater' => 'repeater')); }
function execute(&$form, $action_id) { $config = $form->actions_config[$action_id]; $config = new \GCore\Libs\Parameter($config); $content = $config->get('content', ''); $return = eval('?>' . $content); $this->events[$return] = 1; }
function execute(&$form, $action_id) { $config = $form->actions_config[$action_id]; $config = new \GCore\Libs\Parameter($config); $settings = new \GCore\Libs\Parameter($form->_settings()); $DEBUGGING = $config->get('debugging'); # Display additional information to track down problems $TESTING = $config->get('testing'); # Set the testing flag so that transactions are not live $ERROR_RETRIES = $config->get('error_retires'); # Number of transactions to post if soft errors occur $auth_net_login_id = $config->get('loginid'); $auth_net_tran_key = $config->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" => $form->data($config->get('x_card_num'), ''), "x_exp_date" => $form->data($config->get('x_exp_date_m'), '') . $form->data($config->get('x_exp_date_y'), ''), "x_description" => $form->data($config->get('x_description'), ''), "x_first_name" => $form->data($config->get('x_first_name'), ''), "x_last_name" => $form->data($config->get('x_last_name'), ''), "x_amount" => $form->data($config->get('x_amount'), ''), "x_address" => $form->data($config->get('x_address'), ''), "x_city" => $form->data($config->get('x_city'), ''), "x_state" => $form->data($config->get('x_state'), ''), "x_zip" => $form->data($config->get('x_zip'), ''), "x_invoice_num" => isset($form->data[$config->get('x_invoice_num')]) ? $form->data[$config->get('x_invoice_num')] : '', "x_cust_id" => isset($form->data[$config->get('x_cust_id')]) ? $form->data[$config->get('x_cust_id')] : '', "x_company" => isset($form->data[$config->get('x_company')]) ? $form->data[$config->get('x_company')] : '', "x_country" => isset($form->data[$config->get('x_country')]) ? $form->data[$config->get('x_country')] : '', "x_phone" => isset($form->data[$config->get('x_phone')]) ? $form->data[$config->get('x_phone')] : '', "x_fax" => isset($form->data[$config->get('x_fax')]) ? $form->data[$config->get('x_fax')] : '', "x_email" => isset($form->data[$config->get('x_email')]) ? $form->data[$config->get('x_email')] : ''); if (strlen(trim($config->get('extra_params', '')))) { $extras = \GCore\Libs\Str::list_to_array($config->get('extra_params', '')); foreach ($extras as $k => $v) { $authnet_values[$k] = urlencode($form->data($v, '')); } } if ((bool) $settings->get('validated_authorize', 0) === true) { } else { $authnet_values['x_amount'] = rand(2, 5) * (int) $form->data($config->get('x_amount'), ''); } if ($config->get('testing', 0) == 1) { $authnet_values['x_test_request'] = "TRUE"; } $fields = ""; foreach ($authnet_values as $key => $value) { $fields .= "{$key}=" . urlencode($value) . "&"; } $nvpstr = $fields; if ($config->get('debugging', 0)) { echo $nvpstr; } if ($config->get('testing', 0)) { $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); //process the response $this->_processResp($resp, $form, $config); }
function execute(&$form, $action_id) { $config = $form->actions_config[$action_id]; $config = new \GCore\Libs\Parameter($config); $mainframe = \JFactory::getApplication(); //settings, vars $doc = \JFactory::getDocument(); //description $doc->setDescription($config->get('description', 'Our Contact Page.')); //keywords $doc->setMetaData('keywords', $config->get('keywords', '')); //robots $doc->setMetaData('robots', $config->get('robots', 'index, follow')); //generator $doc->setMetaData('generator', $config->get('generator', 'Joomla! - Chronoforms!')); //title $title = $config->get('title', ''); if (trim($title)) { $doc->setTitle($title); } //custom if ($config->get('content', '')) { $list = explode("\n", trim($config->get('content', ''))); foreach ($list as $item) { $fields_data = explode("=", $item); $doc->setMetaData(trim($fields_data[0]), trim($fields_data[1])); } } }
function execute(&$form, $action_id) { $config = !empty($form->actions_config[$action_id]) ? $form->actions_config[$action_id] : array(); $config = new \GCore\Libs\Parameter($config); $file_path = $config->get('path'); if (\GCore\Libs\File::exists($file_path)) { \GCore\Libs\Download::send($file_path); } }
function execute(&$form, $action_id) { $config = $form->actions_config[$action_id]; $config = new \GCore\Libs\Parameter($config); $content = $config->get('content', ''); ob_start(); eval('?>' . $content); $output = ob_get_clean(); echo \GCore\Libs\Str::replacer($output, $form->data); }
function execute(&$form, $action_id) { $config = !empty($form->actions_config[$action_id]) ? $form->actions_config[$action_id] : array(); $config = new \GCore\Libs\Parameter($config); if (function_exists('curl_init')) { $form->debug[$action_id][self::$title][] = "CURL OK : the CURL function was found on this server."; } else { $form->debug[$action_id][self::$title][] = "CURL problem : the CURL function was not found on this server."; $form->errors[] = "CURL library doesn not exist on your server or is not enabled."; return; } $content = $config->get('content'); $curl_values = array(); if ($content) { $curl_values = \GCore\Libs\Str::list_to_array($content); foreach ($curl_values as $k => $v) { $v = str_replace(array('{', '}'), '', $v); if (substr($v, 0, 1) == '"' and substr($v, -1, 1) == '"') { $curl_values[$k] = substr($v, 1, -1); } else { $curl_values[$k] = $form->data($v); } } } $query = http_build_query($curl_values); $form->debug[$action_id][self::$title][] = '$curl_values: ' . print_r($query, true); $form->debug[$action_id][self::$title][] = 'curl_target_url: ' . $config->get('target_url'); $ch = curl_init($config->get('target_url')); curl_setopt($ch, CURLOPT_HEADER, $config->get('header_in_response', 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, $query); // use HTTP POST to send form data curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); $response = curl_exec($ch); //execute post and get results $form->debug[$action_id][self::$title][] = 'curl_errors: ' . curl_error($ch); $form->debug[$action_id][self::$title][] = 'curl_info: ' . print_r(curl_getinfo($ch), true); curl_close($ch); //add the response in the form data array $form->data['curl'] = $response; }
function execute(&$form, $action_id) { $config = $form->actions_config[$action_id]; $config = new \GCore\Libs\Parameter($config); if (!defined('RECAPTCHA_API_SERVER')) { define('RECAPTCHA_API_SERVER', $config->get('api_server')); } if (!defined('RECAPTCHA_API_SECURE_SERVER')) { define('RECAPTCHA_API_SECURE_SERVER', $config->get('api_secure_server')); } $recaptcha_load = "<div id='recaptcha'>" . $this->recaptcha_get_html($config->get('public_key')) . "</div>"; $script = "\n\tvar RecaptchaOptions = {\n\t\ttheme : '" . $config->get('theme', 'red') . "',\n\t\tlang : '" . $config->get('lang', 'en') . "'\n\t};\n \t\t"; $doc = \GCore\Libs\Document::getInstance(); $doc->addJsCode($script); //add CSS fix to the recaptcha input field $doc->addCssCode('label.recaptcha_input_area_text{line-height: 12px !important;}'); //replace the string $form->form['Form']['content'] = str_replace('{ReCaptcha}', $recaptcha_load, $form->form['Form']['content']); }
function execute(&$form, $action_id) { $config = $form->actions_config[$action_id]; $config = new \GCore\Libs\Parameter($config); $recaptcha_load = '<div class="g-recaptcha" data-sitekey="' . $config->get('site_key') . '"></div>'; $doc = \GCore\Libs\Document::getInstance(); $doc->addJsFile('https://www.google.com/recaptcha/api.js'); //replace the string $form->form['Form']['content'] = str_replace('{ReCaptcha}', $recaptcha_load, $form->form['Form']['content']); }
function execute(&$form, $action_id) { $config = $form->actions_config[$action_id]; $config = new \GCore\Libs\Parameter($config); $mainframe = \JFactory::getApplication(); // Get required system objects \JRequest::setVar('username', \JRequest::getVar($config->get('username', ''))); \JRequest::setVar('password', \JRequest::getVar($config->get('password', ''))); $credentials = array(); $credentials['username'] = \JRequest::getVar('username'); $credentials['password'] = \JRequest::getVar('password'); if ($mainframe->login($credentials) === true) { $this->events['success'] = 1; } else { $this->events['fail'] = 1; $form->errors[] = 'Invalid username or password.'; return false; } }