Example #1
0
 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'));
 }
Example #2
0
 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;
 }
Example #3
0
 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;
 }
Example #4
0
 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 = $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!";
     }
 }
Example #6
0
 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;
     }
 }
Example #7
0
 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;
 }
Example #8
0
 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));
 }
Example #9
0
 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);
 }
Example #10
0
 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);
     }
 }
Example #11
0
 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')));
     }
 }
Example #12
0
 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']);
 }
Example #13
0
 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);
 }
Example #14
0
 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;
             }
         }
     }
 }
Example #15
0
 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];
         }
     }
 }
Example #16
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);
         }
     }
 }
Example #17
0
 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>';
 }
Example #18
0
 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;
     }
 }
Example #19
0
 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;
     }
 }
Example #20
0
 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]));
         }
     }
 }
Example #21
0
 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;
     }
 }
Example #22
0
 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!');
     }
 }
Example #23
0
 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);
     }
 }
Example #24
0
 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;
     }
 }
Example #25
0
 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('enabled')) {
         return;
     }
     echo '<div class="panel panel-warning"><div class="panel-heading">Data Array</div><div class="panel-body">';
     pr($form->data);
     pr($form->files);
     echo '</div></div>';
     echo '<div class="panel panel-danger"><div class="panel-heading">Errors</div><div class="panel-body">';
     pr($form->errors);
     echo '</div></div>';
     echo '<div class="panel panel-primary"><div class="panel-heading">Debug Info</div><div class="panel-body">';
     pr($form->debug);
     echo '</div></div>';
 }
Example #26
0
 function execute(&$form, $action_id)
 {
     $config = $form->actions_config[$action_id];
     $config = new \GCore\Libs\Parameter($config);
     $session = \GCore\Libs\Base::getSession();
     $session_ns = $config->get('namespace', '');
     $session_key = $config->get('key', '');
     if (empty($session_key)) {
         $session_key = $form->form['Form']['title'];
     }
     if (empty($session_ns)) {
         $session_ns = 'default';
     }
     $form->data = array_merge($form->data, $session->get('_chronoform_data_' . $session_key, array()));
     //clear the session if the clear option is set to yes
     if ((bool) $config->get('clear', 0) === true) {
         $session->clear('_chronoform_data_' . $session_key);
     }
 }
Example #27
0
 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;
 }
Example #28
0
 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;
     }
 }
 function execute(&$form, $action_id)
 {
     $config = $form->actions_config[$action_id];
     $config = new \GCore\Libs\Parameter($config);
     $session = \GCore\Libs\Base::getSession();
     //extract questions
     $q_as = explode("\n", $config->get('questions', ''));
     $rand = rand(0, count($q_as) - 1);
     $choosen = explode("=", $q_as[$rand]);
     $answers = explode(',', trim($choosen[1]));
     foreach ($answers as $k => $answer) {
         $answers[$k] = strtolower($answer);
     }
     $session_key = $config->get('session_key', '');
     if (empty($session_key)) {
         $session_key = $form->form['Form']['title'];
     }
     $session->set('chrono_security_answers_' . $session_key, $answers);
     $form->form['Form']['content'] = str_replace('{chrono_security_question}', trim($choosen[0]), $form->form['Form']['content']);
 }
Example #30
0
 function execute(&$form, $action_id)
 {
     $config = !empty($form->actions_config[$action_id]) ? $form->actions_config[$action_id] : array();
     $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'];
     }
     if ($config->get('reset', 0)) {
         $session->set('_chronoforms_paging_data_' . $session_key, array());
         $session->set('_chronoforms_paging_files_' . $session_key, array());
     }
     $stored_data = $session->get('_chronoforms_paging_data_' . $session_key, array());
     $stored_files = $session->get('_chronoforms_paging_files_' . $session_key, array());
     $session->set('_chronoforms_paging_data_' . $session_key, $this->merge($stored_data, $form->data));
     $session->set('_chronoforms_paging_files_' . $session_key, array_merge($stored_files, $form->files));
     $form->data = $this->merge($stored_data, $form->data);
     $form->files = array_merge($session->get('_chronoforms_paging_files_' . $session_key, array()), $form->files);
 }