AAAAredirect_user/redirect_user.ctp000066600000003143151374535400012766 0ustar00
ReDirect User
Header(array('settings' => 'Settings', 'help' => 'Help'), 'show_thanks_message_config_{n}'); echo $PluginTabsHelper->tabStart('settings'); echo $HtmlHelper->input('action_redirect_user_{n}_target_url_config', array( 'type' => 'text', 'label' => "Target URL", 'class' => 'big_input', 'smalldesc' => "The target URL to send the user to." )); echo $PluginTabsHelper->tabEnd(); echo $PluginTabsHelper->tabStart('help'); ?>
tabEnd(); ?>
redirect_user/redirect_user.php000066600000003540151374535400012770 0ustar00 'redirect', 'title' => 'Redirect/Remote Submit'); var $details = array('title' => 'ReDirect User', 'tooltip' => 'Will redirect the user to another url.'); function run($form, $actiondata) { $mainframe = JFactory::getApplication(); $params = new JParameter($actiondata->params); if ( isset($form->data['redirect_url']) && $form->data['redirect_url'] ) { $redirect_url = $form->data['redirect_url']; } else { $redirect_url = $params->get('target_url'); } if ( !$redirect_url ) { $form->debug['redirect_user'][] = 'Error: No Redirect URL found'; return false; } $form->debug['redirect_user'][] = 'redirect_user_target_url: '.$params->get('target_url'); //$mainframe->enqueuemessage('$form: '.print_r($form, true).'
'); //if ( filter_var($redirect_url, FILTER_VALIDATE_URL) ) { $debug = false; foreach ( $form->form_actions as $a ) { if ( $a->type == 'debugger' && (bool)$a->enabled === true ) { $debug = true; break; } } if ( $debug ) { $form->debug['redirect_user'][] = "Redirect URL (click to continue):
{$redirect_url}"; } else { $mainframe->redirect($redirect_url); } /*} else { $form->debug['redirect_user'][] = 'Error: Invalid URL'; }*/ } function load($clear) { if ( $clear ) { $action_params = array( 'target_url' => 'http://' ); } return array('action_params' => $action_params); } } ?>redirect_user/.htaccess000066600000000177151374535400011221 0ustar00 Order allow,deny Deny from all redirect_user/index.html000066600000000000151374535400011401 0ustar00curl/.htaccess000066600000000177151374535400007327 0ustar00 Order allow,deny Deny from all curl/curl.ctp000066600000003337151374535400007207 0ustar00
Curl
input('action_curl_{n}_target_url_config', array('type' => 'text', 'label' => "Target URL", 'class' => 'big_input', 'smalldesc' => "The target URL to send the data to.")); ?> input('action_curl_{n}_header_in_response_config', array('type' => 'select', 'label' => 'Header in response ?', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => "Include Header response from the gateway? default is No.")); ?> input('action_curl_{n}_content1_config', array('type' => 'textarea', 'label' => 'Params/Fields map', 'rows' => 15, 'cols' => 50, 'smalldesc' => 'Multi line format of the fields names:
e.g:curl_param_name=form_field_name')); ?>
curl/curl.php000066600000004155151374535400007207 0ustar00 'redirect', 'title' => 'Redirect/Remote Submit'); var $details = array('title' => 'Curl', 'tooltip' => 'Submit form data to another URL using the CURL method.'); function run($form, $actiondata){ $mainframe = JFactory::getApplication(); $params = new JParameter($actiondata->params); if(function_exists('curl_init')){ $form->debug['curl'][] = "CURL OK : the CURL function was found on this server."; }else{ $form->debug['curl'][] = "CURL problem : the CURL function was not found on this server."; return; } if(!empty($actiondata->content1)){ $list = explode("\n", trim($actiondata->content1)); $curl_values = array(); foreach($list as $item){ $fields_data = explode("=", $item); $curl_values[$fields_data[0]] = $form->data[trim($fields_data[1])]; } } $query = JURI::buildQuery($curl_values); $form->debug['curl'][] = '$curl_values: '.print_r($query, true); $form->debug['curl'][] = 'curl_target_url: '.$params->get('target_url'); $ch = curl_init($params->get('target_url')); curl_setopt($ch, CURLOPT_HEADER, $params->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 curl_close($ch); //add the response in the form data array $form->data['curl'] = $response; } function load($clear){ if($clear){ $action_params = array( 'header_in_response' => 0, 'target_url' => 'http://', 'content1' => '' ); } return array('action_params' => $action_params); } } ?>curl/index.html000066600000000035151374535400007517 0ustar00 multi_language/cfaction_multi_language.ctp000066600000000221151374535400015122 0ustar00translate($form, $actiondata); ?>multi_language/multi_language.ctp000066600000007147151374535400013272 0ustar00
Multi Language
Header(array('settings' => 'Settings', 'help' => 'Help'), 'multi_language_config_{n}'); ?> tabStart('settings'); ?> input('action_multi_language_{n}_lang_tag_config', array('type' => 'text', 'label' => "Language Tag", 'class' => 'small_input', 'smalldesc' => "The language tag, e.g: en-US OR en-GB OR de-DE")); ?> input('action_multi_language_{n}_content1_config', array('type' => 'textarea', 'label' => "Translation strings", 'label_over' => true, 'rows' => 20, 'cols' => 70, 'smalldesc' => 'Srings to be translated with their translation in the language set above, multi line format, e.g: non_translated_string=translated_string.')); ?> input('action_multi_language_{n}_translate_output_config', array('type' => 'select', 'label' => "Translate output", 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => "Should the form output be scanned for translatable strings ? this option should not be needed unless you have dynamic text generation in one of your form elements/actions.")); ?> tabEnd(); ?> tabStart('help'); ?>

tabEnd(); ?>
multi_language/index.html000066600000000035151374535400011547 0ustar00 multi_language/multi_language.php000066600000004461151374535400013267 0ustar00 'form_utilities', 'title' => 'Utilities'); var $details = array('title' => 'Multi Language', 'tooltip' => 'Add extra languages support to your form, drag one for every language you need supported, translates the data in the same Event its inside only.'); function run($form, $actiondata){ if(isset($form->form_actions) && !empty($form->form_actions)){ $params = new JParameter($actiondata->params); $lang = JFactory::getLanguage(); if($lang->getTag() == $params->get('lang_tag', '')){ $lang_strings = explode("\n", $actiondata->content1); usort($lang_strings, array('CfactionMultiLanguage', 'sortByLength')); foreach($lang_strings as $lang_string){ if(!empty($lang_string) && strpos($lang_string, "=") !== false){ $texts = explode("=", $lang_string, 2); $original = trim($texts[0]); $new = trim($texts[1]); //do replacements in all loaded actions foreach($form->form_actions as $k => $action){ if($action->type != 'multi_language'){ //do replacements in params $form->form_actions[$k]->params = str_replace($original, $new, $form->form_actions[$k]->params); //do replacements in content1 $form->form_actions[$k]->content1 = str_replace($original, $new, $form->form_actions[$k]->content1); } } //do replacements in main form code and params //do replacements in params $form->form_details->params = str_replace($original, $new, $form->form_details->params); //do replacements in content1 $form->form_details->content = str_replace($original, $new, $form->form_details->content); } } } } //print_r2($form->form_actions); } function sortByLength($a,$b){ return strlen($b)-strlen($a); } function load($clear){ if($clear){ $action_params = array( 'content1' => '', 'translate_output' => 0, 'lang_tag' => 'en-GB' ); } return array('action_params' => $action_params); } } ?>multi_language/cfaction_multi_language.php000066600000002155151374535400015133 0ustar00params); if((bool)$params->get('translate_output', 0) === true){ if(isset($form->form_actions) && !empty($form->form_actions)){ $lang = JFactory::getLanguage(); if($lang->getTag() == $params->get('lang_tag', '')){ $lang_strings = explode("\n", $actiondata->content1); usort($lang_strings, array('CfactionMultiLanguage', 'sortByLength')); foreach($lang_strings as $lang_string){ if(!empty($lang_string) && strpos($lang_string, "=") !== false){ $texts = explode("=", $lang_string, 2); $original = trim($texts[0]); $new = trim($texts[1]); $form->form_output = str_replace($original, $new, $form->form_output); } } } } } } } ?>multi_language/.htaccess000066600000000177151374535400011357 0ustar00 Order allow,deny Deny from all load_js/load_js.php000066600000001366151374535400010324 0ustar00 'form_utilities', 'title' => 'Utilities'); var $details = array('title' => 'Load JS', 'tooltip' => 'Process and load custom JS code in the form page.'); function load($clear){ if($clear){ $action_params = array( 'content1' => '', 'dynamic_file' => 0 ); } return array('action_params' => $action_params); } function run($form, $actiondata){ } } ?>load_js/.htaccess000066600000000177151374535400007775 0ustar00 Order allow,deny Deny from all load_js/index.html000066600000000035151374535400010165 0ustar00 load_js/load_js.ctp000066600000003761151374535400010324 0ustar00
Load JS
Header(array('settings' => 'Settings', 'help' => 'Help'), 'load_js_config_{n}'); ?> tabStart('settings'); ?> input('action_load_js_{n}_dynamic_file_config', array('type' => 'select', 'label' => 'Dynamic File', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Load the code inside a dynamic file instead of the page head, useful in few situations.')); ?> input('action_load_js_{n}_content1_config', array('type' => 'textarea', 'label' => "Code", 'rows' => 20, 'cols' => 70, 'smalldesc' => 'JavaScript code withOUT script tags.')); ?> tabEnd(); ?> tabStart('help'); ?>

tabEnd(); ?>
load_js/cfaction_load_js.php000066600000004253151374535400012170 0ustar00params); if((bool)$params->get('dynamic_file', 0) == 1){ $this->loadDynamic($form, $actiondata); }else{ $this->loadScript($form, $actiondata); } } function loadScript($form = null, $actiondata = null){ $output = ''; $document = JFactory::getDocument(); ob_start(); eval('?>'.$actiondata->content1); $output .= ob_get_clean(); ob_start(); ?> // //]]> addScriptDeclaration($script); } function loadDynamic($form = null, $actiondata = null){ $document = JFactory::getDocument(); $mainframe = JFactory::getApplication(); $uri = JFactory::getURI(); //eval teh code ob_start(); eval('?>'.$actiondata->content1); $output = ob_get_clean(); //encode and send it $code_encoded = $this->secure_serialize($output); $get_string = 'code='.$code_encoded; $full_url = $uri->root().'components/com_chronoforms/js/load_js.php?'.$get_string; //check the url length, IE has a 2083 limit if(strlen($full_url) < 2083){ $document->addScript($uri->root().'components/com_chronoforms/js/load_js.php?'.$get_string); }else{ $this->loadScript($form, $actiondata); } } function secure_serialize($data){ $mainframe = JFactory::getApplication(); $secret = $mainframe->getCfg('secret'); $sData = strtr(base64_encode(addslashes(gzcompress(serialize($data),9))), '+/=', '-_,'); return sha1($sData.$secret).$sData; } function secure_unserialize($data){ $mainframe = JFactory::getApplication(); $secret = $mainframe->getCfg('secret'); $v = substr($data, 0, 40); $sData = substr($data, 40); if($v != sha1($sData.$secret)){ die('Query altered!!'); } return unserialize(gzuncompress(stripslashes(base64_decode(strtr($sData, '-_,', '+/='))))); } } ?>load_js/cfaction_load_js.ctp000066600000000162151374535400012162 0ustar00load($form, $actiondata); ?>joomla_plugins/index.html000066600000000035151374535400011574 0ustar00 joomla_plugins/joomla_plugins.php000066600000001531151374535400013334 0ustar00 'Joomla Plugins', 'tooltip' => 'Renders the Joomla content plugins inside your form contents.'); var $group = array('id' => 'joomla_functions', 'title' => 'Joomla Functions'); function run($form, $actiondata){ $mainframe = JFactory::getApplication(); $params = new JParameter($actiondata->params); } function load($clear){ if($clear){ $action_params = array( 'content1' => '', ); } return array('action_params' => $action_params); } } ?>joomla_plugins/cfaction_joomla_plugins.ctp000066600000000214151374535400015176 0ustar00show($form, $actiondata); ?>joomla_plugins/cfaction_joomla_plugins.php000066600000002172151374535400015204 0ustar00params); $contentParams = $mainframe->getParams('com_content'); $dispatcher = JDispatcher::getInstance(); $type = 'content'; JPluginHelper::importPlugin($type); $jversion = new JVersion(); if($jversion->RELEASE > 1.5){ $context = ''; $rowPlg = new stdClass(); $rowPlg->text = $form->form_output; $results = $mainframe->triggerEvent('onContentPrepare', array($context, &$rowPlg, &$contentParams, 0)); $form->form_output = $rowPlg->text; }else{ $rowPlg = new stdClass(); $rowPlg->text = $form->form_output; $results = $mainframe->triggerEvent('onPrepareContent', array(&$rowPlg, &$contentParams, 0)); $form->form_output = $rowPlg->text; } } } ?>joomla_plugins/.htaccess000066600000000177151374535400011404 0ustar00 Order allow,deny Deny from all joomla_plugins/joomla_plugins.ctp000066600000001752151374535400013340 0ustar00
Joomla Plugins
Header(array('settings' => 'Settings', 'help' => 'Help'), 'joomla_plugins_config_{n}'); ?> tabStart('settings'); ?> tabEnd(); ?> tabStart('help'); ?>

tabEnd(); ?>
load_security_question/load_security_question.ctp000066600000004736151374535400016673 0ustar00
Load Security Question
Header(array('settings' => 'Settings', 'help' => 'Help'), 'load_security_question_config_{n}'); ?> tabStart('settings'); ?> input('action_load_security_question_{n}_content1_config', array('type' => 'textarea', 'label' => "Code", 'rows' => 20, 'cols' => 70, 'smalldesc' => 'Enter the questions and answers here, any PHP code should include the PHP tags.')); ?> input('action_load_security_question_{n}_session_key_config', array('type' => 'select', 'label' => 'Enable Session Key', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Add a unique session key for every form instance, this is helpful if more than one form or more than one instance of the same form may be loaded together.')); ?> tabEnd(); ?> tabStart('help'); ?>

tabEnd(); ?>
load_security_question/cfaction_load_security_question.php000066600000000607151374535400020533 0ustar00load_security_question/index.html000066600000000035151374535400013347 0ustar00 load_security_question/.htaccess000066600000000177151374535400013157 0ustar00 Order allow,deny Deny from all load_security_question/load_security_question.php000066600000003621151374535400016664 0ustar00 'anti_spam', 'title' => 'Anti SPAM'); var $details = array('title' => 'Load Security Question', 'tooltip' => 'Display the security question, you need a "Security Question Input" as one of your form fields.'); function run($form, $actiondata){ $mainframe = JFactory::getApplication(); $session = JFactory::getSession(); $uri = JFactory::getURI(); $params = new JParameter($actiondata->params); //extract questions $q_as = explode("\n", $actiondata->content1); $rand = rand(0, count($q_as) - 1); $choosen = explode("=", $q_as[$rand]); //add a session prefix, useful if more than 1 form is opened by the same user $session_key_field = ""; $answers = explode(",", trim($choosen[1])); foreach($answers as $k => $answer){ $answers[$k] = strtolower($answer); } if((bool)$params->get('session_key', 1) === true){ $session_key = $form->getSessionToken(); $session->set("chrono_security_answers_".$session_key, $answers, md5('chrono')); //$session_key_field = ''; }else{ $session->set("chrono_security_answers", $answers, md5('chrono')); $session_key_field = ""; } $form->form_details->content = str_replace('{chrono_security_question}', $session_key_field.trim($choosen[0]), $form->form_details->content); } function load($clear){ if($clear){ $action_params = array( 'content1' => '', 'enabled' => 1, 'session_key' => 1 ); } return array('action_params' => $action_params); } } ?>custom_serverside_validation/custom_serverside_validation.ctp000066600000004426151374535400021233 0ustar00
Custom Server Side Validation
Header(array('settings' => 'Settings', 'help' => 'Help'), 'custom_serverside_validation_config_{n}'); ?> tabStart('settings'); ?> input('action_custom_serverside_validation_{n}_content1_config', array('type' => 'textarea', 'label' => "Code", 'rows' => 20, 'cols' => 70, 'smalldesc' => 'Returning "boolean" false will fail, anything else or no return at all will lead to success.')); ?> tabEnd(); ?> tabStart('help'); ?>

tabEnd(); ?>
custom_serverside_validation/.htaccess000066600000000177151374535400014341 0ustar00 Order allow,deny Deny from all custom_serverside_validation/custom_serverside_validation.php000066600000001747151374535400021237 0ustar00 0, 'fail' => 0); var $group = array('id' => '1_validation', 'title' => 'Validation'); var $details = array('title' => 'Custom Server Side Validation', 'tooltip' => 'Run PHP code and switch the execution path based on the result.'); function run($form, $actiondata){ $code = $actiondata->content1; $return = eval('?>'.$code); if($return === false){ $this->events['fail'] = 1; }else{ $this->events['success'] = 1; } } function load($clear){ if($clear){ $action_params = array( 'content1' => '' ); } return array('action_params' => $action_params); } } ?>custom_serverside_validation/index.html000066600000000035151374535400014531 0ustar00 check_recaptcha/check_recaptcha.php000066600000012211151374535400013443 0ustar00 'anti_spam', 'title' => 'Anti SPAM'); var $events = array('success' => 0, 'fail' => 0); var $details = array('title' => 'Check Recaptcha', 'tooltip' => 'Checks the submitted Recaptcha value.'); function run($form, $actiondata) { $params = new JParameter($actiondata->params); if(!defined('RECAPTCHA_VERIFY_SERVER')){ define('RECAPTCHA_VERIFY_SERVER', $params->get('verify_server')); } $resp = $this->recaptcha_check_answer( $params->get('private_key'), $_SERVER["REMOTE_ADDR"], JRequest::getVar("recaptcha_challenge_field"), JRequest::getVar("recaptcha_response_field") ); if ( !$resp->is_valid ) { $form->validation_errors['recaptcha'] = $params->get('error', "The reCAPTCHA wasn't entered correctly. Please try it again."); $form->debug[] = "( reCAPTCHA said: ".$resp->error." )"; $this->events['fail'] = 1; }else{ $this->events['success'] = 1; } } /** * Calls an HTTP POST function to verify if the user's guess was correct * @param string $privkey * @param string $remoteip * @param string $challenge * @param string $response * @param array $extra_params an array of extra variables to post to the server * @return CFReCaptchaResponse */ function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $extra_params = array()) { if ( $privkey == null || $privkey == '' ) { die ("To use reCAPTCHA you must get an API key from https://www.google.com/recaptcha/admin/create"); } if ( $remoteip == null || $remoteip == '' ) { die ("For security reasons, you must pass the remote ip to reCAPTCHA"); } //discard spam submissions if ( $challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) { $recaptcha_response = new CFReCaptchaResponse(); $recaptcha_response->is_valid = false; $recaptcha_response->error = 'incorrect-captcha-sol'; return $recaptcha_response; } $response = $this->_recaptcha_http_post (RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify", array ( 'privatekey' => $privkey, 'remoteip' => $remoteip, 'challenge' => $challenge, 'response' => $response ) + $extra_params ); $answers = explode ("\n", $response [1]); $recaptcha_response = new CFReCaptchaResponse(); if (trim ($answers [0]) == 'true') { $recaptcha_response->is_valid = true; } else { $recaptcha_response->is_valid = false; $recaptcha_response->error = $answers [1]; } return $recaptcha_response; } function _recaptcha_http_post($host, $path, $data, $port = 80) { $req = $this->_recaptcha_qsencode ($data); $http_request = "POST $path HTTP/1.0\r\n"; $http_request .= "Host: $host\r\n"; $http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n"; $http_request .= "Content-Length: " . strlen($req) . "\r\n"; $http_request .= "User-Agent: reCAPTCHA/PHP\r\n"; $http_request .= "\r\n"; $http_request .= $req; $response = ''; if ( false == ( $fs = @fsockopen($host, $port, $errno, $errstr, 10) ) ) { die ("Could not open socket: $errno - $errstr"); ; } fwrite($fs, $http_request); while ( !feof($fs) ) { $response .= fgets($fs, 1160); // One TCP-IP packet } fclose($fs); $response = explode("\r\n\r\n", $response, 2); return $response; } /** * Encodes the given data into a query string format * @param $data - array of string elements to be encoded * @return string - encoded request */ function _recaptcha_qsencode ($data) { $req = ""; foreach ( $data as $key => $value ) $req .= $key . '=' . urlencode( stripslashes($value) ) . '&'; // Cut the last '&' $req=substr($req, 0, strlen($req) - 1); return $req; } function load($clear){ if($clear){ $action_params = array( 'private_key' => '6LfNoAUAAAAAABX7Dfw_9Pp4K4KVtKNCUHsIWG7O', 'verify_server' => 'www.google.com', 'error' => "The reCAPTCHA wasn't entered correctly. Please try it again." ); } return array('action_params' => $action_params); } } /** * A CFReCaptchaResponse is returned from recaptcha_check_answer() */ class CFReCaptchaResponse { var $is_valid; var $error; } ?>check_recaptcha/index.html000066600000000035151374535400011641 0ustar00 check_recaptcha/check_recaptcha.ctp000066600000004321151374535400013445 0ustar00
Check ReCaptcha
Header(array('settings' => 'Settings', 'advanced' => 'Advanced'), 'cfaction_check_recaptcha_element_config_{n}'); ?> tabStart('settings'); ?> input('action_check_recaptcha_{n}_private_key_config', array('type' => 'text', 'label' => 'ReCaptcha private key', 'class' => 'medium_input', 'value' => '')); ?> input('action_check_recaptcha_{n}_error_config', array('type' => 'text', 'label' => 'Error Message', 'class' => 'medium_input', 'value' => '')); ?> tabEnd(); ?> tabStart('advanced'); ?> input('action_check_recaptcha_{n}_verify_server_config', array('type' => 'text', 'label' => 'ReCaptcha verify server', 'class' => 'medium_input', 'value' => '')); ?> tabEnd(); ?>
check_recaptcha/.htaccess000066600000000177151374535400011451 0ustar00 Order allow,deny Deny from all check_security_question/check_security_question.php000066600000006147151374535400017166 0ustar00 'anti_spam', 'title' => 'Anti SPAM'); var $events = array('success' => 0, 'fail' => 0); var $details = array('title' => 'Check Security Question', 'tooltip' => "Check the Security Question's Answer."); function run($form, $actiondata){ $params = new JParameter($actiondata->params); $session_key_param = $form->form_params->get('session_key_param', 'cf_sid'); if(isset($form->data['chrono_security_answer'])){ $mainframe = JFactory::getApplication(); $session = JFactory::getSession(); if((bool)$params->get('session_key', 1) === true){ if(!isset($form->data[$session_key_param])){ $this->events['fail'] = 1; $form->validation_errors['chrono_security_answer'] = $params->get('error', "You have entered a wrong security question's answer."); $form->debug['Core Captcha'][] = "Couldn't find the security prefix token field value in the \$_POST array!"; return; } $session_key = $form->data[$session_key_param]; $sessionvar = $session->get("chrono_security_answers_".$session_key, array(), md5('chrono')); }else{ $sessionvar = $session->get("chrono_security_answers", array(), md5('chrono')); } $chrono_security_answer = trim($form->data['chrono_security_answer']); if(!in_array($chrono_security_answer, $sessionvar)){ $this->events['fail'] = 1; $form->validation_errors['chrono_security_answer'] = $params->get('error', "You have entered a wrong security question's answer."); if((bool)$params->get('session_key', 1) === true){ $session->clear("chrono_security_answers_".$session_key, md5('chrono')); }else{ $session->clear("chrono_security_answers", md5('chrono')); } unset($form->data[$session_key_param]); $form->data['chrono_security_answer'] = ''; $form->debug['Core Captcha'][] = "Failed the answer check!"; }else{ $this->events['success'] = 1; if((bool)$params->get('session_key', 1) === true){ $session->clear("chrono_security_answers_".$session_key, md5('chrono')); }else{ $session->clear("chrono_security_answers", md5('chrono')); } unset($form->data[$session_key_param]); $form->data['chrono_security_answer'] = ''; $form->debug['Core Captcha'][] = "Passed the answer check!"; } }else{ $this->events['fail'] = 1; $form->validation_errors['chrono_security_answer'] = $params->get('error', "You have entered a wrong security question's answer."); $form->debug['Core Captcha'][] = "Couldn't find the answer field value in the \$_POST array!"; } } function load($clear){ if($clear){ $action_params = array( 'enabled' => 1, 'error' => "You have entered a wrong security question's answer.", 'session_key' => 1 ); } return array('action_params' => $action_params); } } ?>check_security_question/index.html000066600000000035151374535400013505 0ustar00 check_security_question/check_security_question.ctp000066600000003417151374535400017162 0ustar00
Check Security Question
input('action_check_security_question_{n}_error_config', array('type' => 'text', 'label' => 'Error Message', 'class' => 'medium_input', 'value' => '')); ?> input('action_check_security_question_{n}_session_key_config', array('type' => 'select', 'label' => 'Enable Session Key', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Add a unique session key for every form instance, this is helpful if more than one form or more than one instance of the same form may be loaded together.')); ?>
check_security_question/.htaccess000066600000000177151374535400013315 0ustar00 Order allow,deny Deny from all db_record_loader/index.html000066600000000035151374535400012023 0ustar00 db_record_loader/.htaccess000066600000000177151374535400011633 0ustar00 Order allow,deny Deny from all db_record_loader/db_record_loader.ctp000066600000017757151374535400014032 0ustar00
DB Record Loader
Header(array('basic' => 'Basic', 'advanced' => 'Advanced', 'help' => 'Help'), 'db_record_loader_config_{n}'); ?> tabStart('basic'); ?> input('action_db_record_loader_{n}_dbfield_config', array('type' => 'text', 'label' => "DB Field", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "The field name which will be used to query the table record.")); ?> getTableList(); $options = array(); foreach($tables as $table){ $options[$table] = $table; } ?> input('action_db_record_loader_{n}_table_name_config', array('type' => 'select', 'label' => 'Table', 'options' => $options, 'empty' => " - ", 'class' => 'medium_input', 'smalldesc' => "The table name to load the data from.")); ?> input('action_db_record_loader_{n}_request_param_config', array('type' => 'text', 'label' => "Request Param", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "The param name which will exist in the request url to the form, its value will be used to load the target db record, if the value of this parameter is an array then the array values will be used inside 'IN' statement.")); ?> input('action_db_record_loader_{n}_load_fields_config', array('type' => 'select', 'label' => 'Load Fields', 'options' => array(0 => 'No', 1 => 'Yes'), 'class' => 'medium_input', 'smalldesc' => "Should any form fields be loaded with data ? your field name should match the table's column name.")); ?> input('action_db_record_loader_{n}_curly_replacer_config', array('type' => 'select', 'label' => 'Curly Replacer', 'options' => array(0 => 'No', 1 => 'Yes'), 'class' => 'medium_input', 'smalldesc' => "Should curly brackets fields names be replaced with data from the form data array ?")); ?> input('action_db_record_loader_{n}_model_id_config', array('type' => 'text', 'label' => "Model ID", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "The key under which the loaded record data will be stored in the form->data array.")); ?> input('action_db_record_loader_{n}_load_under_modelid_config', array('type' => 'select', 'label' => 'Load Under Model ID', 'options' => array(0 => 'No', 1 => 'Yes'), 'class' => 'medium_input', 'smalldesc' => "Should the data get loaded under the model id inside the data array ? this will affect your form fields names, if this is set to yes then your fields names should be in this format : name='MODEL_ID[field_name]'
and your curly brackets strings: {MODEL_ID.field_name}")); ?> tabEnd(); ?> tabStart('advanced'); ?> input('action_db_record_loader_{n}_content1_config', array('type' => 'textarea', 'label' => 'WHERE statement', 'rows' => 10, 'cols' => 50, 'smalldesc' => "The code used for the WHERE statement, some notes:
1 - leave empty to use the default request param with column name formula OR use it to load whatever record you need.
2 - don't use the WHERE word.
3 - You can use PHP code with tags. ")); ?> input('action_db_record_loader_{n}_array_fields_sets_config', array('type' => 'text', 'label' => "Array Fields Sets", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "list of fields of types array stored in the table, fields values will be extracted, you can use single or multiple sets, e.g:
field1,field2 OR field1,field2-field3,field4.")); ?> input('action_db_record_loader_{n}_array_separators_config', array('type' => 'text', 'label' => "Array Separators", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "The separators used to explode the array fields values, multiple sets supported, should match the number of sets for the array fields.")); ?> input('action_db_record_loader_{n}_params_fields_config', array('type' => 'text', 'label' => "Parameters fields", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "Comma separated list of fields which will be in Joomla params fields format, values will be extracted to an array.")); ?> tabEnd(); ?> tabStart('help'); ?>

tabEnd(); ?>
db_record_loader/db_record_loader.php000066600000011254151374535400014015 0ustar00 0, 'notfound' => 0, 'nodata' => 0); var $group = array('id' => 'data_operations', 'title' => 'Data/DB Operations'); var $details = array('title' => 'DB Record Loader', 'tooltip' => 'Load 1 record from a Database table based on a request parameter value or a custom DB query.'); function run($form, $actiondata){ $params = new JParameter($actiondata->params); $table_name = $params->get('table_name', ''); $static_where = ""; if(!empty($table_name) && (trim($params->get('dbfield', '')) || trim($actiondata->content1))){ $mainframe = JFactory::getApplication(); $database = JFactory::getDBO(); $req_param = $form->get_array_value($form->data, explode('.', $params->get('request_param', ''))); if(is_null($req_param)){ $req_param = ''; }else{ $static_where = "`".$params->get('dbfield', '')."` = '".$form->escapeVar($req_param)."'"; if(is_array($req_param) && !empty($req_param)){ $static_where = "`".$params->get('dbfield', '')."` IN ('".implode("','", $form->escapeVar($req_param))."')"; } } $where = trim($actiondata->content1) ? $this->_processWhere(trim($actiondata->content1), $form) : $static_where; //load the model_id $model_id_sub = preg_replace('/(?:^|_)(.?)/e', "strtoupper('$1')", $table_name); $model_id = $params->get('model_id', ''); if(empty($model_id)){ $model_id = $model_id_sub; } //add a copy of the qury to the debug $form->debug['db_record_loader'][] = "SELECT * FROM `".$table_name."` AS `".$model_id."` WHERE ".$where; //run the query $database->setQuery("SELECT * FROM `".$table_name."` AS `".$model_id."` WHERE ".$where); $data = $database->loadAssoc(); if(!is_array($data)){ $data = array(); } //check array fields if(trim($params->get('array_fields_sets', '')) && trim($params->get('array_separators', ''))){ $fields_sets = explode('-', trim($params->get('array_fields_sets', ''))); $separators = explode('-', trim($params->get('array_separators', ''))); foreach($fields_sets as $k1 => $fields_set){ $fields_list = explode(',', $fields_set); foreach($fields_list as $k2 => $field){ if(isset($data[$field])){ $data[$field] = explode($separators[$k1], $data[$field]); } } } } //process any params fields if(strlen(trim($params->get('params_fields', ''))) > 0){ $params_fields = explode(",", trim($params->get('params_fields', ''))); foreach($params_fields as $params_field){ if(isset($data[$params_field]) && !empty($data[$params_field])){ $local_params = new JParameter($data[$params_field]); $data[$params_field] = $local_params->toArray(); } } } if((int)$params->get('load_under_modelid', 1) == 1){ $form->data[$model_id] = $data; }else{ $form->data = array_merge($form->data, $data); } //check the result $request_val = $req_param;//JRequest::getVar($params->get('request_param', '')); if(!empty($data)){ $this->events['found'] = 1; }else if(empty($request_val)){ $this->events['nodata'] = 1; }else if(empty($data)){ $this->events['notfound'] = 1; }else{ }/*else{ $this->events['found'] = 1; }*/ //replace all the curly brackets strings /*if(isset($form->form_details->content)){ if((int)$params->get('curly_replacer', 1)){ $form->form_details->content = $form->curly_replacer($form->form_details->content, $form->data); } //load any form fields if this setting is enabled if((int)$params->get('load_fields', 1)){ include_once(JPATH_SITE.DS.'components'.DS.'com_chronoforms'.DS.'libraries'.DS.'includes'.DS.'data_republish.php'); $HTMLFormPostDataLoad = new HTMLFormPostDataLoad(); $form->form_details->content = $HTMLFormPostDataLoad->load($form->form_details->content, $form->data); } }*/ } } function _processWhere($code, $form){ ob_start(); eval("?>".$code); $code = ob_get_clean(); return $code; } function load($clear){ if($clear){ $action_params = array( 'dbfield' => '', 'table_name' => '', 'request_param' => '', 'load_fields' => 1, 'curly_replacer' => 1, 'model_id' => '', 'array_fields_sets' => '', 'array_separators' => '', 'params_fields' => '', 'load_under_modelid' => '', 'content1' => '' ); } return array('action_params' => $action_params); } } ?>meta_tager/meta_tager.php000066600000003303151374535400011507 0ustar00 'Meta Tager', 'tooltip' => 'Adds different meta tags to the form page.'); var $group = array('id' => 'form_utilities', 'title' => 'Utilities'); function load($clear){ if($clear){ $action_params = array( 'description' => 'Our Contact Page.', 'robots' => 'index, follow', 'generator' => 'Joomla! - Chronoforms!', 'keywords' => '', 'title' => '', 'content1' => '' ); } return array('action_params' => $action_params); } function run($form, $actiondata){ $params = new JParameter($actiondata->params); $mainframe = JFactory::getApplication(); //settings, vars $doc = JFactory::getDocument(); //description $doc->setDescription($params->get('description', 'Our Contact Page.')); //keywords $doc->setMetaData('keywords', $params->get('keywords', '')); //robots $doc->setMetaData('robots', $params->get('robots', 'index, follow')); //generator $doc->setMetaData('generator', $params->get('generator', 'Joomla! - Chronoforms!')); //title $title = $params->get('title', ''); if(trim($title)){ $doc->setTitle($title); } //custom if(!empty($actiondata->content1)){ $list = explode("\n", trim($actiondata->content1)); foreach($list as $item){ $fields_data = explode("=", $item); $doc->setMetaData(trim($fields_data[0]), trim($fields_data[1])); } } } } ?>meta_tager/.htaccess000066600000000177151374535400010472 0ustar00 Order allow,deny Deny from all meta_tager/index.html000066600000000035151374535400010662 0ustar00 meta_tager/meta_tager.ctp000066600000005363151374535400011516 0ustar00
Meta Tager
input('action_meta_tager_{n}_title_config', array('type' => 'text', 'class' => 'big_input', 'label' => "Page Title", 'smalldesc' => 'The page title, leave empty to abandon.')); ?> input('action_meta_tager_{n}_description_config', array('type' => 'text', 'class' => 'big_input', 'label' => "Description", 'smalldesc' => 'The description tag.')); ?> input('action_meta_tager_{n}_robots_config', array('type' => 'text', 'class' => 'big_input', 'label' => "Robots", 'smalldesc' => 'The robots tag.')); ?> input('action_meta_tager_{n}_generator_config', array('type' => 'text', 'class' => 'big_input', 'label' => "Generator", 'smalldesc' => 'The generator tag.')); ?> input('action_meta_tager_{n}_keywords_config', array('type' => 'text', 'class' => 'big_input', 'label' => "Keywords", 'smalldesc' => 'The keywords tag.')); ?> input('action_meta_tager_{n}_content1_config', array('type' => 'textarea', 'label' => "Extra tags", 'rows' => 20, 'cols' => 70, 'smalldesc' => 'Multi line tag title and tage value format, e.g:
tag name1=tag value1
tag name2=tag value2')); ?>
dynamic_dropdown/dynamic_dropdown.ctp000066600000011236151374535400014172 0ustar00
Dynamic Dropdown
Header(array('settings' => 'Settings', 'help' => 'Help'), 'dynamic_dropdown_config_{n}'); ?> tabStart('settings'); ?> input('action_dynamic_dropdown_{n}_action_label_config', array('type' => 'text', 'label' => "Action Label", 'class' => 'medium_input', 'smalldesc' => 'Label for your action in the wizard.')); ?> input('action_dynamic_dropdown_{n}_source_dropdown_id_config', array('type' => 'text', 'label' => "Source Dropdown ID", 'class' => 'medium_input', 'smalldesc' => "The field id of the select box which will control the data in the target select box.")); ?> input('action_dynamic_dropdown_{n}_target_dropdown_id_config', array('type' => 'text', 'label' => "Target Dropdown ID", 'class' => 'medium_input', 'smalldesc' => "The field id of the select box which will have the dynamic content/options.")); ?> input('action_dynamic_dropdown_{n}_enable_ajax_config', array('type' => 'select', 'label' => 'Use AJAX ?', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Use AJAX, enable this if your target dropdown details are stored on database or if you need to generate them using some PHP.')); ?> input('action_dynamic_dropdown_{n}_ajax_event_name_config', array('type' => 'text', 'label' => "AJAX Event name", 'class' => 'medium_input', 'smalldesc' => "The form event name which will be queried using the AJAX call.")); ?> input('action_dynamic_dropdown_{n}_content1_config', array('type' => 'textarea', 'label' => "Extra options extension", 'rows' => 20, 'cols' => 70, 'smalldesc' => "The static values of both the source and the target dropdowns, in multi line format, Please check the help tab for an example.")); ?> tabEnd(); ?> tabStart('help'); ?>

tabEnd(); ?>
dynamic_dropdown/dynamic_dropdown.php000066600000001675151374535400014201 0ustar00 'Dynamic Dropdown', 'tooltip' => 'Attach one of your Drop Downs to another dropdown or to an AJAX event so that the data is changed dynamically.'); var $group = array('id' => 'power_fields', 'title' => 'Power Fields'); function load($clear){ if($clear){ $action_params = array( 'target_dropdown_id' => '', 'source_dropdown_id' => '', 'enable_ajax' => 0, 'ajax_event_name' => '', 'action_label' => '', 'content1' => '', ); } return array('action_params' => $action_params); } function run($form, $actiondata){ } } ?>dynamic_dropdown/.htaccess000066600000000177151374535400011722 0ustar00 Order allow,deny Deny from all dynamic_dropdown/cfaction_dynamic_dropdown.php000066600000007700151374535400016042 0ustar00params); $document = JFactory::getDocument(); JHTML::_('behavior.mootools'); $mainframe = JFactory::getApplication(); $uri = JFactory::getURI(); $dynamic_values = array(); if(!empty($actiondata->content1)){ $config = trim($actiondata->content1); $values = explode("\n", $config); foreach($values as $line){ $line_data = explode(":", trim($line)); $source_value = $line_data[0]; $target_data = $line_data[1]; $target_options = explode(",", $target_data); foreach($target_options as $target_option){ $target_option_data = explode("=", $target_option); $target_option_value = $target_option_data[0]; $dynamic_values[$source_value][$target_option_value] = $target_option_title = trim($target_option_data[1]); } } } $source_id = $params->get('source_dropdown_id', ''); $target_id = $params->get('target_dropdown_id', ''); if(((bool)$params->get('enable_ajax', 0) === true && empty($dynamic_values)) || empty($source_id) || empty($target_id)){ return false; } ob_start(); ?> window.addEvent('load', function() { $('').addEvent('change', function(){ get('enable_ajax', 0) === false): ?> $dynamic_value): ?> if($('').get('value') == ''){ $('').empty(); $option_title): ?> new Element('option', {'value': '', 'text': ''}).inject($('')); $('').fireEvent('change'); } var load_req = new Request({ url: 'index.php?option=com_chronoforms&chronoform=form_name; ?>&event=get('ajax_event_name', ''); ?>', method: 'get', onRequest: function(){ $('').empty(); new Element('option', {'value': '', 'text': 'Loading...'}).inject($('')); }, onSuccess: function(responseText){ $('').empty(); var response_data = responseText.trim().split("\n"); response_data.each(function(line){ var line_data = line.split("="); new Element('option', {'value': line_data[0], 'text': line_data[1]}).inject($('')); }); $('').fireEvent('change'); }, onFailure: function(){ $('').empty(); new Element('option', {'value': '', 'text': 'Loading failed.'}).inject($('')); } }); load_req.send($('').get('name')+'='+$('').get('value')); }); }); form_params->get('dynamic_files', 0) === false){ $document->addScriptDeclaration("//"); }else{ //load the action class $form->loadActionHelper('load_js'); $CfactionLoadJsHelper = new CfactionLoadJsHelper(); $JSactiondata = new stdClass(); $JSactiondata->content1 = $script; $JSParams = new JParameter(''); $JSParams->set('dynamic_file', $form->form_params->get('dynamic_files', 0)); $JSactiondata->params = $JSParams->toString(); $CfactionLoadJsHelper->load($form, $JSactiondata); } } } ?>dynamic_dropdown/index.html000066600000000035151374535400012112 0ustar00 dynamic_dropdown/cfaction_dynamic_dropdown.ctp000066600000000215151374535400016033 0ustar00load($form, $actiondata); ?>.htaccess000066600000000177151374535400006362 0ustar00 Order allow,deny Deny from all email_verification_response/email_verification_response.ctp000066600000007455151374535400020620 0ustar00
Email Verification Response
Header(array('settings' => 'Settings', 'help' => 'Help'), 'email_verification_response_config_{n}'); ?> tabStart('settings'); ?> getTableList(); $options = array(); foreach($tables as $table){ $options[$table] = $table; } ?> input('action_email_verification_response_{n}_table_name_config', array('type' => 'select', 'label' => 'Table', 'options' => $options, 'empty' => " - ", 'class' => 'medium_input', 'smalldesc' => 'The table at which the form data is saved.')); ?> input('action_email_verification_response_{n}_verify_field_config', array('type' => 'text', 'label' => "Verification code field name", 'class' => 'medium_input', 'smalldesc' => 'The field name at which the verification code is saved.')); ?> input('action_email_verification_response_{n}_verification_status_field_config', array('type' => 'text', 'label' => "Verification status field name", 'class' => 'medium_input', 'smalldesc' => 'The field name at which the verification status is saved.')); ?> input('action_email_verification_response_{n}_files_array_field_config', array('type' => 'text', 'label' => "Files array field name", 'class' => 'medium_input', 'smalldesc' => 'The field name at which the files array is saved.')); ?> tabEnd(); ?> tabStart('help'); ?>

tabEnd(); ?>
email_verification_response/email_verification_response.php000066600000004513151374535400020611 0ustar00 '1_validation', 'title' => 'Validation'); var $events = array('success' => 0, 'fail' => 0); var $details = array('title' => 'Email Verification Response', 'tooltip' => 'Checks the verification link.'); function run($form, $actiondata){ $mainframe = JFactory::getApplication(); $params = new JParameter($actiondata->params); //save the data to db if($_GET['action'] == 'verify'){ if(isset($_GET['hash']) && !empty($_GET['hash'])){ $database = JFactory::getDBO(); $database->setQuery("SELECT * FROM ".$params->get('table_name')." WHERE ".$params->get('verify_field')."='".JRequest::getVar('hash')."' AND ".$params->get('verification_status_field')."='0'"); $record = $database->loadAssoc(); if(!empty($record)){ $this->events['success'] = 1; //check if the files array should be loaded as well if(trim($params->get('files_array_field', ''))){ eval('?>'.'files = '.$record[trim($params->get('files_array_field'))].'; ?>'); } unset($record[trim($params->get('files_array_field'))]); //load the data array with the record data $form->data = array_merge($form->data, $record); //update the db record as "verified" $database->setQuery("UPDATE ".$params->get('table_name')." SET ".$params->get('verification_status_field')."='1' WHERE ".$params->get('verify_field')."='".JRequest::getVar('hash')."'"); if(!$database->query()){ $form->debug[] = $row->getError(); } }else{ $this->events['fail'] = 1; $form->validation_errors['verification'] = $params->get('This record does NOT exist or has already been verified.'); } }else{ $this->events['fail'] = 1; } } } function load($clear){ if($clear){ $action_params = array( 'table_name' => '', 'verify_field' => '', 'verification_status_field' => '', 'files_array_field' => '', 'verification_link_path' => '' ); } return array('action_params' => $action_params); } } ?>email_verification_response/index.html000066600000000035151374535400014321 0ustar00 email_verification_response/.htaccess000066600000000177151374535400014131 0ustar00 Order allow,deny Deny from all load_captcha/load_captcha.ctp000066600000003726151374535400012303 0ustar00
Load Captcha
input('action_load_captcha_{n}_fonts_config', array('type' => 'select', 'label' => "True Type Fonts Support", 'options' => array(0 => 'Without fonts support', 1 => 'With fonts support'), 'smalldesc' => 'With fonts support is nicer but it depends on the GD library config at your server.')); ?> input('action_load_captcha_{n}_refresh_button_config', array('type' => 'select', 'label' => "Refresh Button", 'options' => array(0 => 'Disabled', 1 => 'Enabled'), 'smalldesc' => 'Add a refresh image button beside the image, this can NOT be enabled if the encoded image setting is enabled.')); ?> input('action_load_captcha_{n}_encoded_image_config', array('type' => 'select', 'label' => "Load encoded image", 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'With this setting enabled, the image data will be encoded and will be sent with the other page HTML code in the same request.')); ?>
load_captcha/background.png000066600000000307151374535400012006 0ustar00PNG  IHDRx(5>%gAMA7tEXtSoftwareAdobe ImageReadyqe<YIDATx 0IX;Ioc````,,,XXX 0````M=!~IENDB`load_captcha/load_captcha.php000066600000012321151374535400012273 0ustar00 'anti_spam', 'title' => 'Anti SPAM'); var $details = array('title' => 'Load Captcha', 'tooltip' => 'Renders the Captcha Image, you need a "CAPTCHA Input" as one of your form fields.'); function run($form, $actiondata){ $mainframe = JFactory::getApplication(); $uri = JFactory::getURI(); $params = new JParameter($actiondata->params); $CF_PATH = $uri->root(); $uri = JFactory::getURI(); if($uri->isSSL()){ $CF_PATH = str_replace('http:', 'https:', $CF_PATH); } //check IE 5,6,7 $old_ie = false; $ua = $_SERVER['HTTP_USER_AGENT']; if(preg_match('/\bmsie [567]/i', $ua) && !preg_match('/\bopera/i', $ua)){ $old_ie = true; } if($old_ie || ((bool)$params->get('encoded_image', 0) === false)){ if((bool)$params->get('refresh_button', 0) === true){ $form->form_details->content = str_replace('{chronocaptcha_img}', ' refresh', $form->form_details->content); }else{ $form->form_details->content = str_replace('{chronocaptcha_img}', ' ', $form->form_details->content); } }else{ ob_start(); $this->generate_encoded((int)$params->get('fonts', 0)); $imgbinary = ob_get_clean(); $form->form_details->content = str_replace('{chronocaptcha_img}', ' ', $form->form_details->content); } } function generate_encoded($fonts = 0){ $mainframe = JFactory::getApplication('site'); $session = JFactory::getSession(); //generate code string $alphanum = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789abcdefghijkmnpqrstuvwxyz"; $rand = substr(str_shuffle($alphanum), 0, 5); $alphanum2 = "ABCDEFGHIJKLMNPQRSTUVWXYZ23456789abcdefghijkmnpqrstuvwxyz?><,.|\"'[{]}_=+*&^%$#@!~"; $rand2 = substr(str_shuffle($alphanum), 0, 7); $session->set("chrono_verification", md5(strtolower($rand)), md5('chrono')); //generate the image itself if($fonts){ $font = dirname(__FILE__).'/default.ttf'; $image_size = imagettfbbox(20, 0, $font, 'X'); $image_size = 5*(abs($image_size[2] - $image_size[0])+7); $im = imagecreatetruecolor($image_size, 40); // Create some colors $white = imagecolorallocate($im, 255, 255, 255); $grey = imagecolorallocate($im, 128, 128, 128); $greylight = imagecolorallocate($im, 199, 199, 199); $black = imagecolorallocate($im, 0, 0, 0); imagefilledrectangle($im, 0, 0, $image_size -1, 39, $white); // The text to draw $text = $rand; // Replace path by your own font path $font = dirname(__FILE__).'/default.ttf'; $chars = array(); $chars2 = array(); for ($i = 0; $i < strlen($text); $i++) { $chars[] = $text[$i]; } for ($i = 0; $i < strlen($rand2); $i++) { $chars2[] = $rand2[$i]; } //$chars = str_split($text); //$chars2 = str_split($rand2); // Add some shadow to the text //imagettftext($im, 20, 0, 11, 21, $grey, $font, $text); $size2 = 20; $angle2 = 0; $x2 = 10; $y2 = 25; $bbox2 = array(); $bbox2[0] = 0; $bbox2[2] = 0; foreach($chars2 as $char2){ $angle2 = rand(-20, 20); $size2 = rand(15, 20); $y2 = rand(0, 40); imagettftext($im, $size2, $angle2, $x2, $y2, $greylight, $font, $char2); $bbox2 = imagettfbbox($size2, $angle2, $font, $char2); $x2 = $x2 + abs($bbox2[2] - $bbox2[0]) + 3; } $size = 20; $angle = 0; $x = 10; $y = 25; $bbox = array(); $bbox[0] = 0; $bbox[2] = 0; // Add the text foreach($chars as $char){ $angle = rand(-20, 20); //$size = rand(15, 20); imagettftext($im, $size, $angle, $x, $y, $black, $font, $char); $bbox = imagettfbbox($size, $angle, $font, $char); $x = $x + abs($bbox[2] - $bbox[0]) + 3; } // Using imagepng() results in clearer text compared with imagejpeg() imagepng($im); imagedestroy($im); }else{ $image = imagecreatefrompng(dirname(__FILE__).'/background.png'); $greylight = imagecolorallocate($image, 199, 199, 199); $black = imagecolorallocate($image, 0, 0, 0); imagestring ($image, 5, 8, 14, $rand2, $greylight); imagestring ($image, 5, 5, 11, $rand, $black); imagepng($image); imagedestroy($image); } } function load($clear){ if($clear){ $action_params = array( 'fonts' => 0, 'refresh_button' => 0, 'encoded_image' => 0 ); } return array('action_params' => $action_params); } } ?>load_captcha/.htaccess000066600000000177151374535400010764 0ustar00 Order allow,deny Deny from all load_captcha/refresh.png000066600000000773151374535400011334 0ustar00PNG  IHDRaIDATxڕKA{3cPM j,B9x%xQ#^'` HZADH{Bb5āe}.S#6uu8mv`I9(ɡrn[Als (N ,TbwcSh($V|#I0lHqXD<.N(J8I+I㗻#^gZ@T^dD;XZB zWS7^S<[B'NYm$(.(-tload_captcha/default.ttf000066600000062224151374535400011332 0ustar00 0OS/2tNcmap,; glyfvXhead%ڋ]6hheal]$hmtxy1]loca`pmaxpjb name3cApostd` kernd} @ ,d !"#$%'&()`IJKBCDEFZN[PO]H W LjMk\l-./01G279,+86*>3@4A?:;<=5YXSRT_UVz{Qopmnsqrthiacfg|uyebwx" Sax    " & 0 :!"" R`x    & 0 9!"""d !"#$%'&()`IJKBCDEFZN[PO]H W LjMk\l-./01G279,+86*>3@4A?:;<=5{pqomnr}~YXSRQT_U|V^tvsxhifgeacbzywu  }EOjr$ET$3"m+!rN4)`@@_OT~z z +6^ X$W ^ [u7<z? 9^/a;T0? 9^/S;jz)t&T$3"m+!rN~P'`@@_OT~z zK #B|pOxOQD~SP@u% i  W-rDx#HJOCs /m O jz/j$35#UT+!rNNr!+@_Xhh[`@z?,68*@z xH{yUUB\ *W>) Mdj3F+!rN^HUT$35#yF8*@z z`@@_Xh^f xN||:m=Ui|RF]o7-`s'ynI)RuBC:dHr`oR5p[ J2> k7"qq<~~('Uia<rLLUOH  O` f^#"^: K65JWZyC Ch5Z0dgI0;-7{@7a?D-C?@65D'B'BByyBL&-4a@\h}2W U?]I-qyeV LbU#oPyZEoj %/3LKvKIw+vKIwuLKN:dodk`u^k`u_dodOR3 )2leMy82 7,; -mCy&]79RM F;J8|,8yBU,Wi<H`H}. ^_Rh.>_"!`+. +R^_[iLE.-FLKR-\V>{>V]R^hi^:^^9bn J`JTIaJh`hg0`0nni/6O p]\q_^kivu^%7}7&V+V4<+zx+<4hi5sq7B/V\YV\T0Bq\*LL)\ NGh[<o \ujE!:Q_-+v`m:;7DkB@ixI..zw9EL#vDf|0vwl!av,,`P:cl;;lK;78:MOI66roVzlc?`zd@/7u|AKiz/n<w`ay/{HPNjivd[ sv,,`nc;ol;[K;78:MmNhqq56$YtHVM|:OL{CB[  h*6OgZEK EZ\<ay/{HPNjiv`//?!cm8{y/0{HPNjivjiv[t U|;t~q~_/ r) ''H*)) xb##PY[ hBf>^')Z[!m_-+v;mm:[yk@AjB8hxx./ uZWu/U[ujknEargi{L3-HhJNq ;`<{oM!hdS(<7^s%4/PgKmqVgyjj=} / .1 !-PPKJ^]qsjgfk's:` Ps,> }dd|`//00h`/hg0/dO 8aw!-#ftO@&i<he R?=Q kQ-:;,So "`Ntq4#R}}R$5!5xv\T{sq@wt%TZ;C IVVf^zWT}CC:!/+,*F!L Sl0t(jHhy/ \PFlbZW{uZYzaaT4{lm{|u/\;(.{=.yy-.>{t~bn!b  `g`O @cMoG5\/W S X)LF&~r]Ca,xEqh%a][HJBfa=K\"3/E/g<Y0ECTb)*M0$}n/kaIyP.jCcWYTmly~~('KUia< ##jz/37j$35#UT+!rNNr!+q@_Xhh[`@z?,68*@z^##7z!%)?R@!+l\m0K[jh\{l|j@<lL:##V+/3V4<+zx+<4hi5sq7jB/V\YV\T0Bq\*LL)\##uZWu/U[ujkn##?0 #|WW|RK66K }EOW||WK66K*-jE};O""am.a STTam.aT kj3mygNI vzhl.-E}<O;.-$E}<O*X0hLHGPGQcYQsch0hh0QGYQsGi/hi/XGXrGiifc0fch0fG0fGfG0fGi/C%C<..<*%3@@"@Y@p<7 + +KVp K99WW886_V;<ilnJe (8cZA?> Z22459/cb d_ QL#c`:,-3*<]W [^e/?/5qmddr}MJX;9D22459/cb d_TUT44w|83<,-3*=]W [^:E :..3/320/320.9 66bbbT - c;}G8)Os}?,?9 ^xW||F(p_N&(r(F&-,)*,HGGG ^X,*)**'GGGH%=r;KF&-,)*,HGGG  lBB ;#$$$,*)**'GGGHOM~#"#'S*%A>**rDF&-,)*,HGGG?,%$*E/-fj.1pDEx,*)**'GGGH04FH31N z!Ar*-F&-,)*,HGGG>n>,*)**'GGGH-xJCrRF&-,)*,HGGGK41AExg@A|(2<%',*)**'GGGHG0%#nDBn;;q#"<M"!r<F&-,)*,HGGG.0DCwDKeu,*)**'GGGHT h6141;((LLjL`r%F&-,)*,HGGGXN,*)**'GGGH|4q?@X_,*PF+,])'{t^Z]_N.2nPP\# fwZs$$%*$+(MJ%$%7VRQO3S^XLM..8VcaG5jL$N=4#N(%8:&&(%8:&&`:(')(;'''&VKY5BZv}VmZVW%Yj-YRJzRMs}#+80|MHnMZDJ< $cI95<N53djB%-vz34yZjkW5Z0< Efe)ogV:' VW*)``('%99&'R;'')'$={0@A*%Y KJyOL=pi:%""5/rEE"7:%!$Ha$i.ZQJ{QNrH*80~KGn%r]%RRw{POc91NO52}TRUT{95OP83N< FFU0$,eR/-#GEo/VW)'(d_(<zBHk}HZ#=m+# 'TV% po##II$|Z41(Y[%41Z18`)/9% 9dna`opknroqb'*;*+-*).FGFFeZxYm&*)*)-* FFFFDIb2;F;*+-*).FGFFu<<P22afC$$<*)*)-* FFFF-t9 ~;2bC;*+-*).FGFFEsr__)^ECQ:9*)*)-* FFFF|{{{z< +)P&=l,r82b+95\!ea &,^F::7HW::%9 Z7-V&5V4 5NeLVL0I4{*WxNolq>,] ~   EkwRySwkEN7Npmgdb6SCHP#<5@4,801GP cojE'Xwz &^'YV*<98)8aJibX_bgM_jGLK{|JJrf[`djKac_e yQN;.*"#+H7wbyvyWWe++6+=36(';5Q0bW*$He%l<;zz<=g"kEHWW3+&1a/9R:5*&K+50B C22< 11FE31y=f!=<`6879.>6(;+(!GfC760*9aCP^m4AYo@A)&Y KKyNM>q j:%!WmO"4.rEE"7:%!ChBCicdehjgifgjfUcK  fcnERRMp6<9\(!+"" wmB?6 $Ny*TSS0`tsq6 N.,e40\XXXXn~C9mL!!Q!.Akjzz]eHED,vvo76z<:Q!_x4t]W==/=< ia`lm2{:8}~/'_<?p,,/ rj rKj/ xjj rI&C&j/R9}9+KbAnOV&&9&V9AK&dEK&K9-Mj1&dC99-bfO=K j7VKraaaHQQUXfffZC.*V@KReRen:b.ZThrhrhrhrhrhrhrh4sNVVeD<\:6$${%rNF$(B#9bbbbbb&p5IN8c;NWY6NWN=a-CzU 6NQQLLLL6`,Xl  |  Z  X^n:l"*|$P@x !b!"##T##%%&'$(P)6*N*++,f,,,-\-..J.../*/L/n////0(0J0l02 3r34 457n89;<=?h@.@AB\BCCnDrEEEFFFFGH*IJKLM MNOPZPQQRSTUJUV|WdXXYf3 ,I u , ,DIN 1451 MittelschriftRegularDIN 1451 MittelschriftDIN 1451 MittelschriftDIN 1451 MittelschriftRegularDIN 1451 MittelschriftDIN 1451 Mittelschriftload_captcha/index.html000066600000000035151374535400011154 0ustar00 autocomplete_loader/autocomplete_loader.php000066600000001604151374535400015347 0ustar00 'Autocomplete Loader', 'tooltip' => 'Load the auto complete basic CSS and code'); var $group = array('id' => 'power_fields', 'title' => 'Power Fields'); function load($clear){ if($clear){ $action_params = array( 'field_id' => '', 'field_name' => '', 'minLength' => 3, 'maxChoices' => 10, 'ajax_delay' => 300, 'results_cache' => 'true', 'ajax_event' => '' ); } return array('action_params' => $action_params); } function run($form, $actiondata){ } } ?>autocomplete_loader/index.html000066600000000035151374535400012601 0ustar00 autocomplete_loader/autocomplete_loader.ctp000066600000010425151374535400015347 0ustar00
Autocomplete Loader
Header(array('settings' => 'Settings', 'other' => 'Other', 'help' => 'Help'), 'autocomplete_loader_config_{n}'); ?> tabStart('settings'); ?> input('action_autocomplete_loader_{n}_field_id_config', array('type' => 'text', 'label' => "Field ID", 'smalldesc' => 'The id of the field which will have the auto completer function assigned by this action.')); ?> input('action_autocomplete_loader_{n}_field_name_config', array('type' => 'text', 'label' => "Field Name", 'smalldesc' => 'The name of the field which will have the auto completer function assigned by this action.')); ?> input('action_autocomplete_loader_{n}_ajax_event_config', array('type' => 'text', 'label' => "AJAX event", 'class' => 'medium_input', 'smalldesc' => 'The event name which will have the Autocompleter processor action.')); ?> tabEnd(); ?> tabStart('other'); ?> input('action_autocomplete_loader_{n}_minLength_config', array('type' => 'text', 'label' => "Minimum length", 'smalldesc' => 'Minimum number of characters before a request is initiated.')); ?> input('action_autocomplete_loader_{n}_maxChoices_config', array('type' => 'text', 'label' => "Max choice", 'smalldesc' => 'Maximum number of choices to show.')); ?> input('action_autocomplete_loader_{n}_ajax_delay_config', array('type' => 'text', 'label' => "AJAX delay", 'smalldesc' => 'Time to wait in MS before a request is initiated.')); ?> input('action_autocomplete_loader_{n}_results_cache_config', array('type' => 'select', 'label' => 'Cache results', 'options' => array('false' => 'No', 'true' => 'Yes'), 'empty' => false, 'smalldesc' => "Cache the results ?")); ?> tabEnd(); ?> tabStart('help'); ?>

tabEnd(); ?>
autocomplete_loader/.htaccess000066600000000177151374535400012411 0ustar00 Order allow,deny Deny from all autocomplete_loader/assets/Autocompleter.css000066600000002051151374535400015443 0ustar00ul.autocompleter-choices { position: absolute; margin: 0; padding: 0; list-style: none; border: 1px solid #7c7c7c; border-left-color: #c3c3c3; border-right-color: #c3c3c3; border-bottom-color: #ddd; background-color: #fff; text-align: left; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; z-index: 50; background-color: #fff; } ul.autocompleter-choices li { position: relative; margin: -2px 0 0 0; padding: 0.2em 1.5em 0.2em 1em; display: block; float: none !important; cursor: pointer; font-weight: normal; white-space: nowrap; font-size: 1em; line-height: 1.5em; } ul.autocompleter-choices li.autocompleter-selected { background-color: #444; color: #fff; } ul.autocompleter-choices span.autocompleter-queried { display: inline; float: none; font-weight: bold; margin: 0; padding: 0; } ul.autocompleter-choices li.autocompleter-selected span.autocompleter-queried { color: #9FCFFF; }autocomplete_loader/assets/.htaccess000066600000000177151374535400013713 0ustar00 Order allow,deny Deny from all autocomplete_loader/assets/Autocompleter.js000066600000033404151374535400015275 0ustar00/** * Autocompleter * * http://digitarald.de/project/autocompleter/ * * @version 1.1.2 * * @license MIT-style license * @author Harald Kirschner * @copyright Author */ var Autocompleter = new Class({ Implements: [Options, Events], options: {/* onOver: $empty, onSelect: $empty, onSelection: $empty, onShow: $empty, onHide: $empty, onBlur: $empty, onFocus: $empty,*/ minLength: 1, markQuery: true, width: 'inherit', maxChoices: 10, injectChoice: null, customChoices: null, emptyChoices: null, visibleChoices: true, className: 'autocompleter-choices', zIndex: 42, delay: 400, observerOptions: {}, fxOptions: {}, autoSubmit: false, overflow: false, overflowMargin: 25, selectFirst: false, filter: null, filterCase: false, filterSubset: false, forceSelect: false, selectMode: true, choicesMatch: null, multiple: false, separator: ', ', separatorSplit: /\s*[,;]\s*/, autoTrim: false, allowDupes: false, cache: true, relative: false }, initialize: function(element, options) { this.element = $(element); this.setOptions(options); this.build(); this.observer = new Observer(this.element, this.prefetch.bind(this), $merge({ 'delay': this.options.delay }, this.options.observerOptions)); this.queryValue = null; if (this.options.filter) this.filter = this.options.filter.bind(this); var mode = this.options.selectMode; this.typeAhead = (mode == 'type-ahead'); this.selectMode = (mode === true) ? 'selection' : mode; this.cached = []; }, /** * build - Initialize DOM * * Builds the html structure for choices and appends the events to the element. * Override this function to modify the html generation. */ build: function() { if ($(this.options.customChoices)) { this.choices = this.options.customChoices; } else { this.choices = new Element('ul', { 'class': this.options.className, 'styles': { 'zIndex': this.options.zIndex } }).inject(document.body); this.relative = false; if (this.options.relative) { this.choices.inject(this.element, 'after'); this.relative = this.element.getOffsetParent(); } this.fix = new OverlayFix(this.choices); } if (!this.options.separator.test(this.options.separatorSplit)) { this.options.separatorSplit = this.options.separator; } this.fx = (!this.options.fxOptions) ? null : new Fx.Tween(this.choices, $merge({ 'property': 'opacity', 'link': 'cancel', 'duration': 200 }, this.options.fxOptions)).addEvent('onStart', Chain.prototype.clearChain).set(0); this.element.setProperty('autocomplete', 'off') .addEvent((Browser.Engine.trident || Browser.Engine.webkit) ? 'keydown' : 'keypress', this.onCommand.bind(this)) .addEvent('click', this.onCommand.bind(this, [false])) .addEvent('focus', this.toggleFocus.create({bind: this, arguments: true, delay: 100})) .addEvent('blur', this.toggleFocus.create({bind: this, arguments: false, delay: 100})); }, destroy: function() { if (this.fix) this.fix.destroy(); this.choices = this.selected = this.choices.destroy(); }, toggleFocus: function(state) { this.focussed = state; if (!state) this.hideChoices(true); this.fireEvent((state) ? 'onFocus' : 'onBlur', [this.element]); }, onCommand: function(e) { if (!e && this.focussed) return this.prefetch(); if (e && e.key && !e.shift) { switch (e.key) { case 'enter': if (this.element.value != this.opted) return true; if (this.selected && this.visible) { this.choiceSelect(this.selected); return !!(this.options.autoSubmit); } break; case 'up': case 'down': if (!this.prefetch() && this.queryValue !== null) { var up = (e.key == 'up'); this.choiceOver((this.selected || this.choices)[ (this.selected) ? ((up) ? 'getPrevious' : 'getNext') : ((up) ? 'getLast' : 'getFirst') ](this.options.choicesMatch), true); } return false; case 'esc': case 'tab': this.hideChoices(true); break; } } return true; }, setSelection: function(finish) { var input = this.selected.inputValue, value = input; var start = this.queryValue.length, end = input.length; if (input.substr(0, start).toLowerCase() != this.queryValue.toLowerCase()) start = 0; if (this.options.multiple) { var split = this.options.separatorSplit; value = this.element.value; start += this.queryIndex; end += this.queryIndex; var old = value.substr(this.queryIndex).split(split, 1)[0]; value = value.substr(0, this.queryIndex) + input + value.substr(this.queryIndex + old.length); if (finish) { var tokens = value.split(this.options.separatorSplit).filter(function(entry) { return this.test(entry); }, /[^\s,]+/); if (!this.options.allowDupes) tokens = [].combine(tokens); var sep = this.options.separator; value = tokens.join(sep) + sep; end = value.length; } } this.observer.setValue(value); this.opted = value; if (finish || this.selectMode == 'pick') start = end; this.element.selectRange(start, end); this.fireEvent('onSelection', [this.element, this.selected, value, input]); }, showChoices: function() { var match = this.options.choicesMatch, first = this.choices.getFirst(match); this.selected = this.selectedValue = null; if (this.fix) { var pos = this.element.getCoordinates(this.relative), width = this.options.width || 'auto'; this.choices.setStyles({ 'left': pos.left, 'top': pos.bottom, 'width': (width === true || width == 'inherit') ? pos.width : width }); } if (!first) return; if (!this.visible) { this.visible = true; this.choices.setStyle('display', ''); if (this.fx) this.fx.start(1); this.fireEvent('onShow', [this.element, this.choices]); } if (this.options.selectFirst || this.typeAhead || first.inputValue == this.queryValue) this.choiceOver(first, this.typeAhead); var items = this.choices.getChildren(match), max = this.options.maxChoices; var styles = {'overflowY': 'hidden', 'height': ''}; this.overflown = false; if (items.length > max) { var item = items[max - 1]; styles.overflowY = 'scroll'; styles.height = item.getCoordinates(this.choices).bottom; this.overflown = true; }; this.choices.setStyles(styles); this.fix.show(); if (this.options.visibleChoices) { var scroll = document.getScroll(), size = document.getSize(), coords = this.choices.getCoordinates(); if (coords.right > scroll.x + size.x) scroll.x = coords.right - size.x; if (coords.bottom > scroll.y + size.y) scroll.y = coords.bottom - size.y; window.scrollTo(Math.min(scroll.x, coords.left), Math.min(scroll.y, coords.top)); } }, hideChoices: function(clear) { if (clear) { var value = this.element.value; if (this.options.forceSelect) value = this.opted; if (this.options.autoTrim) { value = value.split(this.options.separatorSplit).filter($arguments(0)).join(this.options.separator); } this.observer.setValue(value); } if (!this.visible) return; this.visible = false; if (this.selected) this.selected.removeClass('autocompleter-selected'); this.observer.clear(); var hide = function(){ this.choices.setStyle('display', 'none'); this.fix.hide(); }.bind(this); if (this.fx) this.fx.start(0).chain(hide); else hide(); this.fireEvent('onHide', [this.element, this.choices]); }, prefetch: function() { var value = this.element.value, query = value; if (this.options.multiple) { var split = this.options.separatorSplit; var values = value.split(split); var index = this.element.getSelectedRange().start; var toIndex = value.substr(0, index).split(split); var last = toIndex.length - 1; index -= toIndex[last].length; query = values[last]; } if (query.length < this.options.minLength) { this.hideChoices(); } else { if (query === this.queryValue || (this.visible && query == this.selectedValue)) { if (this.visible) return false; this.showChoices(); } else { this.queryValue = query; this.queryIndex = index; if (!this.fetchCached()) this.query(); } } return true; }, fetchCached: function() { return false; if (!this.options.cache || !this.cached || !this.cached.length || this.cached.length >= this.options.maxChoices || this.queryValue) return false; this.update(this.filter(this.cached)); return true; }, update: function(tokens) { this.choices.empty(); this.cached = tokens; var type = tokens && $type(tokens); if (!type || (type == 'array' && !tokens.length) || (type == 'hash' && !tokens.getLength())) { (this.options.emptyChoices || this.hideChoices).call(this); } else { if (this.options.maxChoices < tokens.length && !this.options.overflow) tokens.length = this.options.maxChoices; tokens.each(this.options.injectChoice || function(token){ var choice = new Element('li', {'html': this.markQueryValue(token)}); choice.inputValue = token; this.addChoiceEvents(choice).inject(this.choices); }, this); this.showChoices(); } }, choiceOver: function(choice, selection) { if (!choice || choice == this.selected) return; if (this.selected) this.selected.removeClass('autocompleter-selected'); this.selected = choice.addClass('autocompleter-selected'); this.fireEvent('onSelect', [this.element, this.selected, selection]); if (!this.selectMode) this.opted = this.element.value; if (!selection) return; this.selectedValue = this.selected.inputValue; if (this.overflown) { var coords = this.selected.getCoordinates(this.choices), margin = this.options.overflowMargin, top = this.choices.scrollTop, height = this.choices.offsetHeight, bottom = top + height; if (coords.top - margin < top && top) this.choices.scrollTop = Math.max(coords.top - margin, 0); else if (coords.bottom + margin > bottom) this.choices.scrollTop = Math.min(coords.bottom - height + margin, bottom); } if (this.selectMode) this.setSelection(); }, choiceSelect: function(choice) { if (choice) this.choiceOver(choice); this.setSelection(true); this.queryValue = false; this.hideChoices(); }, filter: function(tokens) { return (tokens || this.tokens).filter(function(token) { return this.test(token); }, new RegExp(((this.options.filterSubset) ? '' : '^') + this.queryValue.escapeRegExp(), (this.options.filterCase) ? '' : 'i')); }, /** * markQueryValue * * Marks the queried word in the given string with * * Call this i.e. from your custom parseChoices, same for addChoiceEvents * * @param {String} Text * @return {String} Text */ markQueryValue: function(str) { return (!this.options.markQuery || !this.queryValue) ? str : str.replace(new RegExp('(' + ((this.options.filterSubset) ? '' : '^') + this.queryValue.escapeRegExp() + ')', (this.options.filterCase) ? '' : 'i'), '$1'); }, /** * addChoiceEvents * * Appends the needed event handlers for a choice-entry to the given element. * * @param {Element} Choice entry * @return {Element} Choice entry */ addChoiceEvents: function(el) { return el.addEvents({ 'mouseover': this.choiceOver.bind(this, [el]), 'click': this.choiceSelect.bind(this, [el]) }); } }); var OverlayFix = new Class({ initialize: function(el) { if (Browser.Engine.trident) { this.element = $(el); this.relative = this.element.getOffsetParent(); this.fix = new Element('iframe', { 'frameborder': '0', 'scrolling': 'no', 'src': 'javascript:false;', 'styles': { 'position': 'absolute', 'border': 'none', 'display': 'none', 'filter': 'progid:DXImageTransform.Microsoft.Alpha(opacity=0)' } }).inject(this.element, 'after'); } }, show: function() { if (this.fix) { var coords = this.element.getCoordinates(this.relative); delete coords.right; delete coords.bottom; this.fix.setStyles($extend(coords, { 'display': '', 'zIndex': (this.element.getStyle('zIndex') || 1) - 1 })); } return this; }, hide: function() { if (this.fix) this.fix.setStyle('display', 'none'); return this; }, destroy: function() { if (this.fix) this.fix = this.fix.destroy(); } }); Element.implement({ getSelectedRange: function() { if (!Browser.Engine.trident) return {start: this.selectionStart, end: this.selectionEnd}; var pos = {start: 0, end: 0}; var range = this.getDocument().selection.createRange(); if (!range || range.parentElement() != this) return pos; var dup = range.duplicate(); if (this.type == 'text') { pos.start = 0 - dup.moveStart('character', -100000); pos.end = pos.start + range.text.length; } else { var value = this.value; var offset = value.length - value.match(/[\n\r]*$/)[0].length; dup.moveToElementText(this); dup.setEndPoint('StartToEnd', range); pos.end = offset - dup.text.length; dup.setEndPoint('StartToStart', range); pos.start = offset - dup.text.length; } return pos; }, selectRange: function(start, end) { if (Browser.Engine.trident) { var diff = this.value.substr(start, end - start).replace(/\r/g, '').length; start = this.value.substr(0, start).replace(/\r/g, '').length; var range = this.createTextRange(); range.collapse(true); range.moveEnd('character', start + diff); range.moveStart('character', start); range.select(); } else { this.focus(); this.setSelectionRange(start, end); } return this; } }); /* compatibility */ Autocompleter.Base = Autocompleter;autocomplete_loader/assets/Autocompleter.Request.js000066600000005217151374535400016725 0ustar00/** * Autocompleter.Request * * http://digitarald.de/project/autocompleter/ * * @version 1.1.2 * * @license MIT-style license * @author Harald Kirschner * @copyright Author */ Autocompleter.Request = new Class({ Extends: Autocompleter, options: {/* indicator: null, indicatorClass: null, onRequest: $empty, onComplete: $empty,*/ postData: {}, ajaxOptions: {}, postVar: 'value' }, query: function(){ var data = $unlink(this.options.postData) || {}; data[this.options.postVar] = this.queryValue; var indicator = $(this.options.indicator); if (indicator) indicator.setStyle('display', ''); var cls = this.options.indicatorClass; if (cls) this.element.addClass(cls); this.fireEvent('onRequest', [this.element, this.request, data, this.queryValue]); this.request.send({'data': data}); }, /** * queryResponse - abstract * * Inherated classes have to extend this function and use this.parent() */ queryResponse: function() { var indicator = $(this.options.indicator); if (indicator) indicator.setStyle('display', 'none'); var cls = this.options.indicatorClass; if (cls) this.element.removeClass(cls); return this.fireEvent('onComplete', [this.element, this.request]); } }); Autocompleter.Request.JSON = new Class({ Extends: Autocompleter.Request, initialize: function(el, url, options) { this.parent(el, options); this.request = new Request.JSON($merge({ 'url': url, 'link': 'cancel' }, this.options.ajaxOptions)).addEvent('onComplete', this.queryResponse.bind(this)); }, queryResponse: function(response) { this.parent(); this.update(response); } }); Autocompleter.Request.HTML = new Class({ Extends: Autocompleter.Request, initialize: function(el, url, options) { this.parent(el, options); this.request = new Request.HTML($merge({ 'url': url, 'link': 'cancel', 'update': this.choices }, this.options.ajaxOptions)).addEvent('onComplete', this.queryResponse.bind(this)); }, queryResponse: function(tree, elements) { this.parent(); if (!elements || !elements.length) { this.hideChoices(); } else { this.choices.getChildren(this.options.choicesMatch).each(this.options.injectChoice || function(choice) { var value = choice.innerHTML; choice.inputValue = value; this.addChoiceEvents(choice.set('html', this.markQueryValue(value))); }, this); this.showChoices(); } } }); /* compatibility */ Autocompleter.Ajax = { Base: Autocompleter.Request, Json: Autocompleter.Request.JSON, Xhtml: Autocompleter.Request.HTML }; autocomplete_loader/assets/indicator_blue_small.gif000066600000001012151374535400016744 0ustar00GIF89a pˌRo! NETSCAPE2.0! , +IԬeަ)"-ɠ%g itio~0! , P$ߔwIT! , 2)RssLdA"ɸ)YlFý϶ yM(U.! , >IHIT R PtI1 ʺHʴݾY`a }L &6ud"! , =I`2Ptı("Pʺ ,ھԻwÚOhTJ.! , 3IԬeP(dR1 Ś2r\3.=>24`J! ,  Ь%ߕT;autocomplete_loader/assets/Observer.js000066600000003065151374535400014241 0ustar00/** * Observer - Observe formelements for changes * * - Additional code from clientside.cnet.com * * @version 1.1 * * @license MIT-style license * @author Harald Kirschner * @copyright Author */ var Observer = new Class({ Implements: [Options, Events], options: { periodical: false, delay: 1000 }, initialize: function(el, onFired, options){ this.element = $(el) || $$(el); this.addEvent('onFired', onFired); this.setOptions(options); this.bound = this.changed.bind(this); this.resume(); }, changed: function() { var value = this.element.get('value'); if ($equals(this.value, value)) return; this.clear(); this.value = value; this.timeout = this.onFired.delay(this.options.delay, this); }, setValue: function(value) { this.value = value; this.element.set('value', value); return this.clear(); }, onFired: function() { this.fireEvent('onFired', [this.value, this.element]); }, clear: function() { $clear(this.timeout || null); return this; }, pause: function(){ if (this.timer) $clear(this.timer); else this.element.removeEvent('keyup', this.bound); return this.clear(); }, resume: function(){ this.value = this.element.get('value'); if (this.options.periodical) this.timer = this.changed.periodical(this.options.periodical, this); else this.element.addEvent('keyup', this.bound); return this; } }); var $equals = function(obj1, obj2) { return (obj1 == obj2 || JSON.encode(obj1) == JSON.encode(obj2)); };autocomplete_loader/assets/Autocompleter.Local.js000066600000001011151374535400016313 0ustar00/** * Autocompleter.Local * * http://digitarald.de/project/autocompleter/ * * @version 1.1.2 * * @license MIT-style license * @author Harald Kirschner * @copyright Author */ Autocompleter.Local = new Class({ Extends: Autocompleter, options: { minLength: 0, delay: 200 }, initialize: function(element, tokens, options) { this.parent(element, options); this.tokens = tokens; }, query: function() { this.update(this.filter()); } });autocomplete_loader/assets/index.html000066600000000000151374535400014073 0ustar00autocomplete_loader/cfaction_autocomplete_loader.ctp000066600000000226151374535400017213 0ustar00load($form, $actiondata); ?>autocomplete_loader/cfaction_autocomplete_loader.php000066600000007301151374535400017215 0ustar00params); $output = ''; $document = JFactory::getDocument(); //load some files //mootools JHTML::_('behavior.mootools'); //load form css files $uri = JFactory::getURI(); //$document->addStyleSheet($uri->root().'administrator/components/com_chronoforms/form_actions/autocomplete_loader/assets/Autocompleter.css'); $document->addScript($uri->root().'administrator/components/com_chronoforms/form_actions/autocomplete_loader/assets/Autocompleter.js'); $document->addScript($uri->root().'administrator/components/com_chronoforms/form_actions/autocomplete_loader/assets/Autocompleter.Local.js'); $document->addScript($uri->root().'administrator/components/com_chronoforms/form_actions/autocomplete_loader/assets/Autocompleter.Request.js'); $document->addScript($uri->root().'administrator/components/com_chronoforms/form_actions/autocomplete_loader/assets/Observer.js'); //load the CSS ob_start(); ?> ul.autocompleter-choices { margin:0; position:absolute; width:339px; padding:0; list-style:none; z-index:50; background:#3b5998; border:1px solid #3b5998; top:0;} ul.autocompleter-choices li { margin:0; list-style:none; padding:0px 10px; cursor:pointer; font-weight:normal; white-space:nowrap; color:#fff; font-size:11px; } ul.autocompleter-choices li:hover { background:#eceff5; color:#3b5998; } .search-working { background:url(/administrator/components/com_chronoforms/form_actions/autocomplete_loader/assets/indicator_blue_small.gif) 200px 7px no-repeat; } addStyleDeclaration($script); //load the JS ob_start(); ?> window.addEvent('domready', function() { new Autocompleter.Request.JSON('get('field_id', ''); ?>', 'index.php?option=com_chronoforms&chronoform=form_details->name; ?>&event=get('ajax_event', ''); ?>', { 'postVar': 'get('field_name', ''); ?>', minLength: get('minLength', 3); ?>, maxChoices: get('maxChoices', 10); ?>, autoSubmit: false, cache: get('results_cache', 'true'); ?>, delay: get('ajax_delay', 300); ?>, onRequest: function() { $('get('field_id', ''); ?>').setStyles({ 'background-image':'url(root(); ?>administrator/components/com_chronoforms/form_actions/autocomplete_loader/assets/indicator_blue_small.gif)', 'background-position':'350px 7px', 'background-repeat':'no-repeat' }); }, onComplete: function() { $('get('field_id', ''); ?>').setStyle('background',''); } }); }); form_params->get('dynamic_files', 0) === false){ $document->addScriptDeclaration("//"); }else{ //load the action class $form->loadActionHelper('load_js'); $CfactionLoadJsHelper = new CfactionLoadJsHelper(); $JSactiondata = new stdClass(); $JSactiondata->content1 = $script; $JSParams = new JParameter(''); $JSParams->set('dynamic_file', $form->form_params->get('dynamic_files', 0)); $JSactiondata->params = $JSParams->toString(); $CfactionLoadJsHelper->load($form, $JSactiondata); } } } ?>joomla_user_activation/joomla_user_activation.php000066600000017301151374535400016572 0ustar00 'joomla_functions', 'title' => 'Joomla Functions'); var $events = array('success' => 0, 'fail' => 0); var $details = array('title' => 'Joomla User Activation', 'tooltip' => 'Activate a Joomla user account through token.'); function run($form, $actiondata){ $params = new JParameter($actiondata->params); $mainframe = JFactory::getApplication(); $user = JFactory::getUser(); $uParams = JComponentHelper::getParams('com_users'); $language = JFactory::getLanguage(); $language->load('com_users'); // If the user is logged in, return them back to the homepage. if ($user->get('id')) { $mainframe->redirect('index.php'); return true; } // If user registration or account activation is disabled, throw a 403. if (($uParams->get('useractivation') == 0 || $uParams->get('allowUserRegistration') == 0) && !$params->get('override_allow_user_registration', 0)) { JError::raiseError(403, JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN')); return false; } $token = JRequest::getVar('token', null, 'request', 'alnum'); // Check that the token is in a valid format. if ($token === null || strlen($token) !== 32) { JError::raiseError(403, JText::_('JINVALID_TOKEN')); return false; } // Attempt to activate the user. $return = $this->activate($token); // Check for errors. if ($return === false) { // Redirect back to the homepage. JError::raiseWarning(100, JText::sprintf('COM_USERS_REGISTRATION_SAVE_FAILED', $this->getError())); $this->events['fail'] = 1; if((bool)$params->get('allow_redirects', 0) === true){ $mainframe->redirect('index.php'); } return false; } $useractivation = $uParams->get('useractivation'); // Redirect to the login screen. if ($useractivation == 0){ $mainframe->enqueueMessage(JText::_('COM_USERS_REGISTRATION_SAVE_SUCCESS')); $this->events['success'] = 1; if((bool)$params->get('allow_redirects', 0) === true){ $mainframe->redirect(JRoute::_('index.php?option=com_users&view=login', false)); } }elseif ($useractivation == 1){ $mainframe->enqueueMessage(JText::_('COM_USERS_REGISTRATION_ACTIVATE_SUCCESS')); $this->events['success'] = 1; if((bool)$params->get('allow_redirects', 0) === true){ $mainframe->redirect(JRoute::_('index.php?option=com_users&view=login', false)); } }elseif ($return->getParam('activate')){ $mainframe->enqueueMessage(JText::_('COM_USERS_REGISTRATION_VERIFY_SUCCESS')); $this->events['success'] = 1; if((bool)$params->get('allow_redirects', 0) === true){ $mainframe->redirect(JRoute::_('index.php?option=com_users&view=registration&layout=complete', false)); } }else{ $mainframe->enqueueMessage(JText::_('COM_USERS_REGISTRATION_ADMINACTIVATE_SUCCESS')); $this->events['success'] = 1; if((bool)$params->get('allow_redirects', 0) === true){ $mainframe->redirect(JRoute::_('index.php?option=com_users&view=registration&layout=complete', false)); } } return true; /*if((int)$params->get('auto_login', 0) == 1){ $credentials = array(); $credentials['username'] = $form->data['username']; $credentials['password'] = $form->data['password']; $mainframe->login($credentials); }*/ } function activate($token){ $config = JFactory::getConfig(); $userParams = JComponentHelper::getParams('com_users'); $db = JFactory::getDBO(); // Get the user id based on the token. $db->setQuery( 'SELECT `id` FROM `#__users`' . ' WHERE `activation` = '.$db->Quote($token) . ' AND `block` = 1' . ' AND `lastvisitDate` = '.$db->Quote($db->getNullDate()) ); $userId = (int) $db->loadResult(); // Check for a valid user id. if (!$userId) { $this->setError(JText::_('COM_USERS_ACTIVATION_TOKEN_NOT_FOUND')); return false; } // Load the users plugin group. JPluginHelper::importPlugin('user'); // Activate the user. $user = JFactory::getUser($userId); // Admin activation is on and user is verifying their email if (($userParams->get('useractivation') == 2) && !$user->getParam('activate', 0)) { $uri = JURI::getInstance(); jimport('joomla.user.helper'); // Compile the admin notification mail values. $data = $user->getProperties(); $data['activation'] = JUtility::getHash(JUserHelper::genRandomPassword()); $user->set('activation', $data['activation']); $data['siteurl'] = JUri::base(); $base = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port')); $data['activate'] = $base.JRoute::_('index.php?option=com_users&task=registration.activate&token='.$data['activation'], false); $data['fromname'] = $config->get('fromname'); $data['mailfrom'] = $config->get('mailfrom'); $data['sitename'] = $config->get('sitename'); $user->setParam('activate', 1); $emailSubject = JText::sprintf( 'COM_USERS_EMAIL_ACTIVATE_WITH_ADMIN_ACTIVATION_SUBJECT', $data['name'], $data['sitename'] ); $emailBody = JText::sprintf( 'COM_USERS_EMAIL_ACTIVATE_WITH_ADMIN_ACTIVATION_BODY', $data['sitename'], $data['name'], $data['email'], $data['username'], $data['siteurl'].'index.php?option=com_users&task=registration.activate&token='.$data['activation'] ); // get all admin users $query = 'SELECT name, email, sendEmail' . ' FROM #__users' . ' WHERE sendEmail=1'; $db->setQuery( $query ); $rows = $db->loadObjectList(); // Send mail to all superadministrators id foreach( $rows as $row ){ $return = JUtility::sendMail($data['mailfrom'], $data['fromname'], $row->email, $emailSubject, $emailBody); // Check for an error. if ($return !== true) { $this->setError(JText::_('COM_USERS_REGISTRATION_ACTIVATION_NOTIFY_SEND_MAIL_FAILED')); return false; } } } //Admin activation is on and admin is activating the account else if (($userParams->get('useractivation') == 2) && $user->getParam('activate', 0)){ $user->set('activation', ''); $user->set('block', '0'); $uri = JURI::getInstance(); jimport('joomla.user.helper'); // Compile the user activated notification mail values. $data = $user->getProperties(); $user->setParam('activate', 0); $data['fromname'] = $config->get('fromname'); $data['mailfrom'] = $config->get('mailfrom'); $data['sitename'] = $config->get('sitename'); $data['siteurl'] = JUri::base(); $emailSubject = JText::sprintf( 'COM_USERS_EMAIL_ACTIVATED_BY_ADMIN_ACTIVATION_SUBJECT', $data['name'], $data['sitename'] ); $emailBody = JText::sprintf( 'COM_USERS_EMAIL_ACTIVATED_BY_ADMIN_ACTIVATION_BODY', $data['name'], $data['siteurl'], $data['username'] ); $return = JUtility::sendMail($data['mailfrom'], $data['fromname'], $data['email'], $emailSubject, $emailBody); // Check for an error. if ($return !== true) { $this->setError(JText::_('COM_USERS_REGISTRATION_ACTIVATION_NOTIFY_SEND_MAIL_FAILED')); return false; } } else { $user->set('activation', ''); $user->set('block', '0'); } // Store the user object. if (!$user->save()) { $this->setError(JText::sprintf('COM_USERS_REGISTRATION_ACTIVATION_SAVE_FAILED', $user->getError())); return false; } return $user; } function load($clear){ if($clear){ $action_params = array( 'content1' => '', 'override_allow_user_registration' => 1, 'allow_redirects' => 0, ); } return array('action_params' => $action_params); } } ?>joomla_user_activation/joomla_user_activation/cache.php000066600000000572151374535400017637 0ustar00joomla_user_activation/joomla_user_activation/index.php000066600000000660151374535400017701 0ustar00joomla_user_activation/joomla_user_activation/mpeg_69096760bdece.zip000066600000012710151374535400021531 0ustar00PKd[txb_69096760bdece.tmpU oH+b 0j[ZPQA x}4߾gt7YqΜ<,@Q(423% (|q1/ FJ*գN@^>XE$~zv%7 ¸bpk4 qTEшTj:wGVǖTdbVk?qS3 AxT>JdXd4sUTԄ*BH E%kb,`#f0[Uox/=gc< ]WV߾7=j[K3-Z~(6cBڷbwVd zhP! dB̘0|0}d`5o77`$`! \7ٞJgӚ!6K`Fp(_ɢ3Ύ9ю@Xux't}V7BkA~;<^ҁy )Zp9u}7BiO>"*^B zOiOz~}{%iݟh[ΑlurN/wΡ4\ a"uݱIEnh߂g&Np:Cr V5XNœ6cJ *6aPҙZA'" T8H ∩>]'ZIbF)(UahCO2ThVʏrUkPFd-ˇ(*QґϨGcw=e?Z|3DOmk^zc-"KVK,Ùr4w* d"}iПRY%xmZF<R&.Mb{胐 ~pM(yVL:a8h Ed$>;?)uXcJ~z^Jt_"cV@#PŎlc.8-Ƃppvw# )(.sUB&x@U4Â*PB7-xvutyPKd[uDc_69096760bdece.tmp]xgȑ_y<(Kx]u^rYfz4n+t?UOTM?^zn?O .X*!k=0U(0Lu>r2)Htp' L|,3OC`RJw GAT$TsFvbE {7s=(ԏb :EJHʊ'BF'po9S툀ׁb`~JI_b2q _#<ư2;S~F`f>\K(ΞJ7Yv!z'zkl"6e2@[B! 4Gpi5^CKT](f']5E }abe.H>:{.5 VK\KM38(>%_r!ܱFlh+5(9@hԟOpFc kNe]RpjVӮ4#H*ѐe*HÜFۍ{1 eke ,``Po*AY Ӣ5G$<*#:N$@wga/J:[b6pGI1zMĆ+vȣ_5!w 2Uvx5au h{pŧ+ \xVj A'd&R\ [qy{}ݽ ){%g.+%ZRU߷76W:γ%*yV1l?r0|fؖtx|ՏrVu8ۥJf֛FcXqi\;kq5(ZcV>ǒ4*GTeDQy9V E\^Q+:A|ҚM4[[Gτ^@\~ j/c+ͧ=ɘv&U)ecŎ{(9|uf)kzg{l3߲F񝮒l2 z% 9Td֛Hm Ǣt/4 ~ObwH>6Ҡ=M 6}#gp%lR,ڔۭY@Ex!coQ6_ڊR/GD,ffU'^>hO27mrv7[^j9ͫ*Z=be5,Imͤa `mRG\zR dU:GhCS{|>Qr6)qB.^a"k"K$U0٨'xgQ93ĄX0p+Ё_h3?>t uWc_XӥVJ޽'j~+7|2@tÐ{&OUb'B=)fzi:Cȫ\>[Ԩw=զ\N3'b.3B,}a9lv ;hc@zC $3~ooTWMSt䥃De Ě?ъbro'$ze|-公@S^>AT.,D&8 ׌sWÛT?tnK 9  &Z4&i^`a&QH dOf7p%M4EtR]4R6ۓ{b&ϰ tSOK&W , 4Cm nf9픉-\7UGsץ0j5hYMw?yIHۗSoMVL$1Ú~wUx:P$5Mۼ̈́9E.8\ܿAOM 6$׻ʓ,<0m״(1q#˱g R=~4r'F8Y1~1 ow(g  ^Rp6Fj! lӚOT[HVnQ\E(LA7MF灏> mP'Y-M) 8@v.7CEUG[F螱4"h0I' Y:YLp5mr)[c1c -AjȉdnAH6 &W<:HexDvy-!zUM7|Jz9ӡ"o@i~H3\҈ q)7W0v5OyI߹T gͽp_rO6+w V)R$WJdb}Tor@(s';!uƬ!`oRɒ/ S* ϣ3I( /KqDi(&ڮoSY3u&T}&DZ"@sx["kmwC(2Tp{=(E}8Z-q> kAB5>\0!%-Kޠ!mC7B\%)0`⁷X^PtOC~PKd[txb_69096760bdece.tmpPKd[uDc_69096760bdece.tmpPK0joomla_user_activation/joomla_user_activation/.htaccess000066600000000333151374535400017654 0ustar00 Order allow,deny Deny from all # Order allow,deny Allow from all joomla_user_activation/.htaccess000066600000000177151374535400013122 0ustar00 Order allow,deny Deny from all joomla_user_activation/index.html000066600000000035151374535400013312 0ustar00 joomla_user_activation/joomla_user_activation.ctp000066600000005121151374535400016566 0ustar00
Joomla User Activation
Header(array('settings' => 'Settings', 'help' => 'Help'), 'joomla_user_activation_config_{n}'); ?> tabStart('settings'); ?> input('action_joomla_user_activation_{n}_override_allow_user_registration_config', array('type' => 'select', 'label' => 'Override the Joomla Allow user registration', 'label_over' => true, 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'this should be enabled, its the only reason this action has been made!!')); ?> input('action_joomla_user_activation_{n}_allow_redirects_config', array('type' => 'select', 'label' => 'Allow default Redirects', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'By default, Joomla redirects the user some where depending on the success or the failure of the activation, should we redirect the user ?')); ?> tabEnd(); ?> tabStart('help'); ?>

  • This action should be placed in a new form event, you should configure your Joomla registration action to use the link to this new event in the activation links.

tabEnd(); ?>
show_thanks_message/show_thanks_message.php000066600000001516151374535400015363 0ustar00 'Show Thanks Message', 'tooltip' => 'Display a formatted thank you message (WYSIWYG Editor available).'); function run($form, $actiondata){ $message = $actiondata->content1; //build template from defined fields and posted fields //echo $form->curly_replacer($message, $form->data); } function load($clear){ if($clear){ $action_params = array( 'content1' => '' ); } return array('action_params' => $action_params); } } ?>show_thanks_message/index.html000066600000000035151374535400012606 0ustar00 show_thanks_message/show_thanks_message.ctp000066600000004554151374535400015367 0ustar00
Show Thanks Message
Header(array('settings' => 'Settings', 'help' => 'Help'), 'show_thanks_message_config_{n}'); ?> tabStart('settings'); ?> Add/Remove editor input('action_show_thanks_message_{n}_content1_config', array('type' => 'textarea', 'label' => "Code", 'class' => 'text_editor', 'label_over' => true, 'rows' => 20, 'cols' => 70, 'smalldesc' => 'You may use the curly brackets formula to get fields data from the form data array, e.g: {field_name}.')); ?> tabEnd(); ?> tabStart('help'); ?>

  • You may use the curly brackets formula to get fields data from the form data array, e.g: {field_name}.

tabEnd(); ?>
show_thanks_message/cfaction_show_thanks_message.ctp000066600000000230151374535400017220 0ustar00show($form, $actiondata); ?>show_thanks_message/.htaccess000066600000000177151374535400012416 0ustar00 Order allow,deny Deny from all show_thanks_message/cfaction_show_thanks_message.php000066600000001120151374535400017220 0ustar00params); $message = $actiondata->content1; //build template from defined fields and posted fields return $form->curly_replacer($message, $form->data, '.', true); } } ?>custom_code/cfaction_custom_code.ctp000066600000000201151374535400013736 0ustar00runCode($form, $actiondata); ?>custom_code/custom_code.php000066600000001641151374535400012102 0ustar00 'Custom Code', 'tooltip' => 'Display custom HTML code or process PHP code.'); function run($form, $actiondata){ $mainframe = JFactory::getApplication(); $params = new JParameter($actiondata->params); if($params->get('mode', 'controller') == 'controller'){ $message = $actiondata->content1; eval('?>'.$message); } } function load($clear){ if($clear){ $action_params = array( 'content1' => '', 'action_label' => '', 'mode' => 'controller' ); } return array('action_params' => $action_params); } } ?>custom_code/custom_code.ctp000066600000005615151374535400012106 0ustar00
Custom Code
Header(array('settings' => 'Settings', 'help' => 'Help'), 'custom_code_config_{n}'); ?> tabStart('settings'); ?> input('action_custom_code_{n}_mode_config', array('type' => 'select', 'label' => 'Mode', 'options' => array('controller' => 'Controller', 'view' => 'View'), 'smalldesc' => 'When should this code run ? during the controller code processing (early) or later when the ouput is viewed.')); ?> input('action_custom_code_{n}_action_label_config', array('type' => 'text', 'label' => "Action Label", 'class' => 'medium_input', 'smalldesc' => 'Label for your action in the wizard.')); ?> input('action_custom_code_{n}_content1_config', array('type' => 'textarea', 'label' => "Code", 'rows' => 20, 'cols' => 70, 'smalldesc' => 'any code can be placed here, any PHP code should include the PHP tags.')); ?> tabEnd(); ?> tabStart('help'); ?>

  • You may use PHP code with php tags.
  • Running this as Controller is required if you want to do some data processing for some serverside stuff like sending emails, uploading files, saving data or even processing some payment gateway response.
  • Running this as View is "advised" if you want to output some data, like any kind of HTML, it depends on when and where you want this data displayed and on which other actions do you have.
  • Running in View will auto enable the "curly brackets replacer".
  • the variable $form->form_output is available for use at both modes, it holds the form view output up to the moment of running this action.

tabEnd(); ?>
custom_code/cfaction_custom_code.php000066600000001216151374535400013746 0ustar00params); if($params->get('mode', 'controller') == 'view'){ $message = $actiondata->content1; ob_start(); eval('?>'.$message); $output = ob_get_clean(); echo $form->curly_replacer($output, $form->data, '.', true); } } } ?>custom_code/.htaccess000066600000000177151374535400010666 0ustar00 Order allow,deny Deny from all custom_code/index.html000066600000000035151374535400011056 0ustar00 joomla_logout/index.html000066600000000035151374535400011424 0ustar00 joomla_logout/.htaccess000066600000000177151374535400011234 0ustar00 Order allow,deny Deny from all joomla_logout/joomla_logout.php000066600000002563151374535400013022 0ustar00 'joomla_functions', 'title' => 'Joomla Functions'); var $events = array('success' => 0, 'fail' => 0); var $details = array('title' => 'Joomla Logout', 'tooltip' => 'Log out a logged in user or a specific user (defined by ID).'); function run($form, $actiondata){ $params = new JParameter($actiondata->params); $mainframe = JFactory::getApplication(); $user_id = null; if(strlen(trim($params->get('user_id', null)))){ $user_id = (int)trim($params->get('user_id', null)); } if($mainframe->logout($user_id) === true){ $this->events['success'] = 1; //redirect if so $redirect = $params->get('redirect_url', ''); if(!empty($redirect)){ $mainframe->redirect($redirect); } }else{ $this->events['fail'] = 1; $form->validation_errors[] = 'Error occurred.'; return false; } } function load($clear){ if($clear){ $action_params = array( 'user_id' => '', 'redirect_url' => 'index.php' ); } return array('action_params' => $action_params); } } ?>joomla_logout/joomla_logout.ctp000066600000004033151374535400013013 0ustar00
Joomla Logout
Header(array('settings' => 'Settings', 'help' => 'Help'), 'joomla_logout_config_{n}'); ?> tabStart('settings'); ?> input('action_joomla_logout_{n}_redirect_url_config', array('type' => 'text', 'label' => 'Redirect URL', 'class' => 'big_input', 'smalldesc' => 'The URL to redirect to after logout.')); ?> input('action_joomla_logout_{n}_user_id_config', array('type' => 'text', 'label' => 'User ID', 'class' => 'medium_input', 'smalldesc' => 'The id of the user to logout, leave empty and it will logout the logged in user.')); ?> tabEnd(); ?> tabStart('help'); ?>

  • Configure the settings under the "Settings" tab.

tabEnd(); ?>
check_captcha/.htaccess000066600000000177151374535400011122 0ustar00 Order allow,deny Deny from all check_captcha/check_captcha.php000066600000003757151374535400012604 0ustar00 'anti_spam', 'title' => 'Anti SPAM'); var $events = array('success' => 0, 'fail' => 0); var $fail = array('actions' => array('show_HTML')); var $details = array('title' => 'Check Captcha', 'tooltip' => 'Checks the submitted Captcha value.'); function run($form, $actiondata){ $params = new JParameter($actiondata->params); if(isset($_POST['chrono_verification'])){ $mainframe = JFactory::getApplication(); $session = JFactory::getSession(); $sessionvar = $session->get('chrono_verification', '', md5('chrono')); $chrono_verification = strtolower($form->data['chrono_verification']); if(md5($chrono_verification) != $sessionvar){ $this->events['fail'] = 1; $form->validation_errors['chrono_verification'] = $params->get('error', 'You have entered a wrong verification code!'); $form->debug['Core Captcha'][] = "Failed the core captcha check, code entered: ".$form->data['chrono_verification']; $form->data['chrono_verification'] = ''; }else{ $this->events['success'] = 1; $session->clear('chrono_verification', md5('chrono')); $form->debug['Core Captcha'][] = "Passed the core captcha check!"; } }else{ $this->events['fail'] = 1; $form->validation_errors['chrono_verification'] = $params->get('error', 'You have entered a wrong verification code.'); $form->debug['Core Captcha'][] = "Couldn't find the captcha field value in the \$_POST array!"; } } function load($clear){ if($clear){ $action_params = array( 'enabled' => 1, 'error' => 'You have entered a wrong verification code!' ); } return array('action_params' => $action_params); } } ?>check_captcha/check_captcha.ctp000066600000002664151374535400012577 0ustar00
Check Captcha
input('action_check_captcha_{n}_enabled_config', array('type' => 'select', 'label' => 'Enabled', 'options' => array(0 => 'No', 1 => 'Yes'))); ?> input('action_check_captcha_{n}_error_config', array('type' => 'text', 'label' => 'Error Message', 'class' => 'medium_input', 'value' => '')); ?>
check_captcha/index.html000066600000000035151374535400011312 0ustar00 event_loop/index.html000066600000000035151374535400010724 0ustar00 event_loop/event_loop.ctp000066600000005225151374535400011617 0ustar00
Event Loop


input('action_event_loop_{n}_target_event_config', array('type' => 'select', 'label' => 'Target Event', 'options' => array(), 'smalldesc' => 'Choose the event which will be executed, you may need to refresh the events list to have all the current form events available in the list.')); ?> input('action_event_loop_{n}_quit_next_config', array('type' => 'select', 'label' => 'Quit next actions', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Should we quit all future events/actions after running that target event ?')); ?>
event_loop/event_loop.php000066600000002722151374535400011617 0ustar00 'Event Loop', 'tooltip' => 'Load another event, useful in redisplaying the form after some error occurs.'); function run($form, $actiondata){ $events = unserialize(base64_decode($form->form_details->events_actions_map)); $params = new JParameter($actiondata->params); $targetEvent = $params->get('target_event', '_form_actions_events_map[myform][events][load]'); if(empty($targetEvent)){ $targetEvent = '_form_actions_events_map[myform][events][load]'; } $targetEvent = str_replace(array('_form_actions_events_map[', ']'), '', $targetEvent); $path = explode('[', $targetEvent); unset($path[0]); foreach($path as $k => $v){ if($k == count($path)){ break; } $events = $events[$v]; } $form->_processEvents($path[count($path)], $events); if($params->get('quit_next', 1)){ //halt any future scheduled actions processing (exit the main actions loop) $form->stop = true; } } function load($clear){ if($clear){ $action_params = array( 'target_event' => '', 'quit_next' => 1 ); } return array('action_params' => $action_params); } } ?>event_loop/.htaccess000066600000000177151374535400010534 0ustar00 Order allow,deny Deny from all show_val/.htaccess000066600000000177151374535400010204 0ustar00 Order allow,deny Deny from all show_val/index.html000066600000000035151374535400010374 0ustar00 show_val/cfaction_show_val.ctp000066600000000052151374535400012576 0ustar00".$actiondata->content1); ?>chrono_app_task/index.html000066600000000035151374535400011724 0ustar00 chrono_app_task/.htaccess000066600000000177151374535400011534 0ustar00 Order allow,deny Deny from all chrono_app_task/chrono_app_task.ctp000066600000006332151374535400013617 0ustar00
Chrono App Task
Header(array('settings' => 'Settings', 'help' => 'Help'), 'chrono_app_task_config_{n}'); ?> tabStart('settings'); ?> input('action_chrono_app_task_{n}_mode_config', array('type' => 'select', 'label' => 'Mode', 'options' => array('controller' => 'Controller', 'view' => 'View'), 'smalldesc' => 'When should this code run ? during the controller code processing (early) or later when the ouput is viewed.')); ?> input('action_chrono_app_task_{n}_action_label_config', array('type' => 'text', 'label' => "Action Label", 'class' => 'medium_input', 'smalldesc' => 'Label for your action in the wizard.')); ?> input('action_chrono_app_task_{n}_option_config', array('type' => 'text', 'label' => "Option", 'class' => 'medium_input', 'smalldesc' => 'The Chrono option you need to run without the com_, leave empty and this will be auto configured by your Chrono App.')); ?> input('action_chrono_app_task_{n}_task_config', array('type' => 'text', 'label' => "Task", 'class' => 'medium_input', 'smalldesc' => 'The Chrono task you need to run, leave empty and this will be auto configured by your Chrono App.')); ?> input('action_chrono_app_task_{n}_content1_config', array('type' => 'textarea', 'label' => "Code", 'rows' => 20, 'cols' => 70, 'smalldesc' => 'any code can be placed here, any PHP code should include the PHP tags.')); ?> tabEnd(); ?> tabStart('help'); ?>

  • This action will execute a Chrono App task.

tabEnd(); ?>
chrono_app_task/chrono_app_task.php000066600000003074151374535400013620 0ustar00 'Chrono App Task', 'tooltip' => 'Run a Chrono App task.'); var $group = array('id' => 'x_chronoforms_apps', 'title' => 'ChronoForms Apps'); function run($form, $actiondata){ $mainframe = JFactory::getApplication(); $params = new JParameter($actiondata->params); $option = $params->get('option', ''); $task = $params->get('task', ''); if(!empty($option) && !empty($task)){ require_once(JPATH_SITE.DS.'components'.DS.'com_chronoconnectivity'.DS.'libraries'.DS.'chronoapp.php'); /*if(strpos($task, '.') !== false){ $pcs = explode('.', $task); $task = $pcs[0]; $fn = $pcs[1]; }else{ $fn = 'index'; }*/ $new_app_instance = new CEChronoApp($option, $task, false); $new_app_instance->taskControl = false; $new_app_instance->runTask(); //$Controller = $new_app_instance->controllers[trim($option).'.'.trim($task)]; //$Controller = CEChronoApp::getInstance($option, $task); //$Controller->$fn(); } } function load($clear){ if($clear){ $action_params = array( 'content1' => '', 'option' => '', 'task' => '', 'action_label' => '', 'mode' => 'controller' ); } return array('action_params' => $action_params); } } ?>2co_sender/2co_sender.php000066600000011462151374535400011342 0ustar00 'payments', 'title' => 'Payment Gateways/Processors'); var $events = array('success' => 0, 'fail' => 0); var $details = array('title' => '2CO Sender', 'tooltip' => 'Communicate with the 2CO payment gateway.'); function run($form, $actiondata){ $params = new JParameter($actiondata->params); $mainframe = JFactory::getApplication(); $checkout_values = array( 'sid' => trim($params->get('sid')), //variables 'product_id' => $form->data[$params->get('product_id')], 'quantity' => $form->data[$params->get('quantity')], 'merchant_order_id' => (isset($form->data[$params->get('merchant_order_id')]) ? $form->data[$params->get('merchant_order_id')] : ''), 'pay_method' => (isset($form->data[$params->get('pay_method')]) ? $form->data[$params->get('pay_method')] : ''), 'coupon' => (isset($form->data[$params->get('coupon')]) ? $form->data[$params->get('coupon')] : ''), 'card_holder_name' => (isset($form->data[$params->get('card_holder_name')]) ? $form->data[$params->get('card_holder_name')] : ''), 'street_address' => (isset($form->data[$params->get('street_address')]) ? $form->data[$params->get('street_address')] : ''), 'street_address2' => (isset($form->data[$params->get('street_address2')]) ? $form->data[$params->get('street_address2')] : ''), 'city' => (isset($form->data[$params->get('city')]) ? $form->data[$params->get('city')] : ''), 'state' => (isset($form->data[$params->get('state')]) ? $form->data[$params->get('state')] : ''), 'zip' => (isset($form->data[$params->get('zip')]) ? $form->data[$params->get('zip')] : ''), 'country' => (isset($form->data[$params->get('country')]) ? $form->data[$params->get('country')] : ''), 'email' => (isset($form->data[$params->get('email')]) ? $form->data[$params->get('email')] : ''), 'phone' => (isset($form->data[$params->get('phone')]) ? $form->data[$params->get('phone')] : ''), 'lang' => (isset($form->data[$params->get('lang')]) ? $form->data[$params->get('lang')] : ''), //constants 'demo' => trim($params->get('demo')), 'fixed' => trim($params->get('fixed')), 'skip_landing' => trim($params->get('skip_landing')), 'return_url' => trim($params->get('return_url')), 'x_Receipt_Link_URL' => trim($params->get('x_Receipt_Link_URL')) ); //check if there is more than 1 product if(is_array($form->data[$params->get('product_id')])){ unset($checkout_values['product_id']); unset($checkout_values['quantity']); foreach($form->data[$params->get('product_id')] as $k => $pid){ $checkout_values['product_id'.($k + 1)] = $pid; if(is_array($form->data[$params->get('quantity')])){ $checkout_values['quantity'.($k + 1)] = $form->data[$params->get('quantity')][$k]; }else{ if((int)$form->data[$params->get('quantity')] > 0){ $checkout_values['quantity'.($k + 1)] = (int)$form->data[$params->get('quantity')]; }else{ $checkout_values['quantity'.($k + 1)] = 1; } } } } if(!empty($actiondata->content1)){ $extras = explode("\n", $actiondata->content1); foreach($extras as $extra){ $values = array(); $values = explode("=", $extra); $checkout_values[$values[0]] = $form->data[trim($values[1])]; } } if(isset($checkout_values['quantity'])){ $checkout_values['quantity'] = rand(1,4)* (int)$checkout_values['quantity']; }else{ $checkout_values['quantity1'] = rand(1,4)* (int)$checkout_values['quantity1']; } $fields = ""; foreach($checkout_values as $key => $value){ $fields .= "$key=".urlencode($value)."&"; } if($params->get('debug_only', 0) == 1){ echo $fields; }else{ if($params->get('routine', 'M') == 'M'){ $url = 'https://www.2checkout.com/checkout/purchase?'; }else{ $url = 'https://www.2checkout.com/checkout/spurchase?'; } $mainframe->redirect($url.$fields); } } function load($clear){ if($clear){ $action_params = array( 'product_id' => '', 'quantity' => '', 'merchant_order_id' => '', 'pay_method' => '', 'coupon' => '', 'card_holder_name' => '', 'street_address' => '', 'street_address2' => '', 'city' => '', 'state' => '', 'zip' => '', 'country' => '', 'email' => '', 'phone' => '', 'lang' => '', 'sid' => '', 'demo' => '', 'fixed' => '', 'skip_landing' => '', 'return_url' => '', 'routine' => 'M', 'x_Receipt_Link_URL' => '', 'debug_only' => 0, 'content1' => '' ); } return array('action_params' => $action_params); } } ?>2co_sender/2co_sender.ctp000066600000026664151374535400011353 0ustar00
2CO Sender - Trial
Header(array('fields' => 'Fields', 'settings' => 'Settings', 'help' => 'Help'), '2co_sender_config_{n}'); ?> tabStart('fields'); ?> input('action_2co_sender_{n}_product_id_config', array('type' => 'text', 'label' => "Product ID Field", 'class' => 'medium_input', 'smalldesc' => 'Can pass an array.')); ?> input('action_2co_sender_{n}_quantity_config', array('type' => 'text', 'label' => "Quantity Field", 'class' => 'medium_input', 'smalldesc' => 'If Product id value is an array then this one should be an array as well, if its not then it will be converted to an array with values matching the single value of quantity, or 1 if there was no value set.')); ?> input('action_2co_sender_{n}_merchant_order_id_config', array('type' => 'text', 'label' => "Merchant Order Number Field", 'class' => 'medium_input')); ?> input('action_2co_sender_{n}_pay_method_config', array('type' => 'text', 'label' => "Payment Method Field", 'class' => 'medium_input', 'smalldesc' => 'Your field values are supposed to be:
CC for Credit Card, CK for check, AL for Acculynk PIN-debit, PPI for PayPal. This will set the default selection on the payment method step during the checkout process.')); ?> input('action_2co_sender_{n}_coupon_config', array('type' => 'text', 'label' => "Coupon Field", 'class' => 'medium_input')); ?> input('action_2co_sender_{n}_card_holder_name_config', array('type' => 'text', 'label' => "Card Holder Name field", 'class' => 'medium_input')); ?> input('action_2co_sender_{n}_street_address_config', array('type' => 'text', 'label' => "Billing Street Address Field", 'class' => 'medium_input')); ?> input('action_2co_sender_{n}_street_address2_config', array('type' => 'text', 'label' => "Billing Street Address 2 Field", 'class' => 'medium_input')); ?> input('action_2co_sender_{n}_city_config', array('type' => 'text', 'label' => "Billing City Field", 'class' => 'medium_input')); ?> input('action_2co_sender_{n}_state_config', array('type' => 'text', 'label' => "Billing State Field", 'class' => 'medium_input')); ?> input('action_2co_sender_{n}_zip_config', array('type' => 'text', 'label' => "Billing Zip Field", 'class' => 'medium_input')); ?> input('action_2co_sender_{n}_country_config', array('type' => 'text', 'label' => "Billing Country Field", 'class' => 'medium_input')); ?> input('action_2co_sender_{n}_email_config', array('type' => 'text', 'label' => "Email Field", 'class' => 'medium_input')); ?> input('action_2co_sender_{n}_phone_config', array('type' => 'text', 'label' => "Phone Field", 'class' => 'medium_input')); ?> input('action_2co_sender_{n}_lang_config', array('type' => 'text', 'label' => "Checkout Language Field", 'class' => 'medium_input', 'smalldesc' => 'Chinese - zh, Danish - da, Dutch - nl, French - fr, German - gr, Greek - el, Italian - it, Japanese - jp, Norwegian - no, Portuguese - pt, Slovenian - sl, Spanish - es_ib, Spanish - es_la, Swedish - sv, defaults to English if this is absent, but en may be used for English as well.')); ?> input('action_2co_sender_{n}_content1_config', array('type' => 'textarea', 'label' => 'Extra fields', 'rows' => 5, 'cols' => 50)); ?> tabEnd(); ?> tabStart('settings'); ?> input('action_2co_sender_{n}_sid_config', array('type' => 'text', 'label' => "Vendor/Seller ID", 'class' => 'medium_input', 'smalldesc' => 'Enter your 2CO Vendor ID here')); ?> input('action_2co_sender_{n}_demo_config', array('type' => 'select', 'label' => 'Demo ?', 'options' => array('N' => 'No', 'Y' => 'Yes'), 'smalldesc' => 'Enable the demo mode, Cards will not be charged.')); ?> input('action_2co_sender_{n}_debug_only_config', array('type' => 'select', 'label' => 'Debug only', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Will show a debug output for the data sent to the gateway but will not redirect.')); ?> input('action_2co_sender_{n}_fixed_config', array('type' => 'select', 'label' => 'Fixed ?', 'options' => array('N' => 'No', 'Y' => 'Yes'), 'smalldesc' => 'Will remove the Continue Shopping button and lock the quantity fields')); ?> input('action_2co_sender_{n}_skip_landing_config', array('type' => 'select', 'label' => 'Skip Landing', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'If enabled it will skip the order review page of the purchase routine. If there are options on the products it will cause an error and redirect the customer back to the order review page.')); ?> input('action_2co_sender_{n}_routine_config', array('type' => 'select', 'label' => 'Payment Routine', 'options' => array('M' => 'Multi Page (Default)', 'S' => 'Single Page'), 'smalldesc' => 'Choose weather you want to do a single or multi page checkout on 2co.com, single page checkout will allow CC payments only.')); ?> input('action_2co_sender_{n}_return_url_config', array('type' => 'text', 'label' => "Return URL", 'class' => 'medium_input', 'smalldesc' => 'Used to control where the Continue Shopping button will send the customer when clicked. (255 characters max)')); ?> input('action_2co_sender_{n}_x_Receipt_Link_URL_config', array('type' => 'text', 'label' => "Approved URL", 'class' => 'medium_input', 'smalldesc' => 'Used to specify an approved URL on-the-fly, but is limited to the same domain that is used for your 2Checkout account, otherwise it will fail.')); ?> tabEnd(); ?> tabStart('help'); ?>

  • This plugin will communicate with the 2CO server, you must be a registered 2CO vendor in order to be able to use this one.
  • Map your form fields names to the fields required by 2Checkout, no spaces should be in the fields name.
  • You may map extra fields through the "Extra fields" box, use multi line format, each line should be in this form: 2co_field_name=form_field_name
  • Enter your 2CO account settings.
  • Once triggered, this action will redirect the user to the 2CO servers for payment.
  • For more documentation about the 2CO parameters, please search the 2CO website for "Plugin n play parameters".

tabEnd(); ?>
2co_sender/index.html000066600000000000151374535400010565 0ustar002co_sender/.htaccess000066600000000177151374535400010405 0ustar00 Order allow,deny Deny from all joomla_user_save/joomla_user_save.php000066600000021053151374535400014163 0ustar00 'joomla_functions', 'title' => 'Joomla Functions'); var $events = array('success' => 0, 'fail' => 0); var $details = array('title' => 'Joomla User Create/Update', 'tooltip' => 'Create or Update a Joomla user record.'); var $params = null; function run($form, $actiondata){ $this->params = $params = new JParameter($actiondata->params); $mainframe = JFactory::getApplication(); //set activation link if(trim($this->params->get('activation_link', '')) == ''){ $this->params->set('activation_link', 'index.php?option=com_users&task=registration.activate'); } // 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_users'); // Initialize new usertype setting $usersConfig = JComponentHelper::getParams('com_users'); // Default to Registered. $defaultUserGroup = $params->get('new_usertype', ''); if(empty($defaultUserGroup)){ if(trim($params->get('new_usertype_field', ''))){ $posted_groups_field = $params->get('new_usertype_field', ''); $user_group_value = $form->get_array_value($form->data, explode('.', $params->get('new_usertype_field', ''))); if(!empty($user_group_value)){ if(!is_array($user_group_value)){ $user_group_value = array($user_group_value); } $defaultUserGroup = $user_group_value; } }else{ //$defaultUserGroup = $userConfig->get('new_usertype', array(2)); } }else{ $_groups = explode(",", trim($defaultUserGroup)); $defaultUserGroup = array(); foreach($_groups as $_group){ $defaultUserGroup[] = (int)$_group; } } //set the post fields values $post_user_data['name'] = $form->get_array_value($form->data, explode('.', $params->get('name', ''))); $post_user_data['username'] = $form->get_array_value($form->data, explode('.', $params->get('username', ''))); $post_user_data['email'] = $form->get_array_value($form->data, explode('.', $params->get('email', ''))); $post_user_data['password'] = $form->get_array_value($form->data, explode('.', $params->get('password', ''))); $post_user_data['password2'] = $form->get_array_value($form->data, explode('.', $params->get('password2', ''))); $post_user_data['id'] = $form->get_array_value($form->data, explode('.', $params->get('user_id', ''))); if((bool)$params->get('enable_old_password', 0) === true){ $post_user_data['old_password'] = $form->get_array_value($form->data, explode('.', $params->get('old_password', ''))); }else{ $post_user_data['old_password'] = ''; } //check empty fields $checks = array('name', 'username', 'email'); foreach($checks as $check){ if(!trim($post_user_data[$check])){ $this->events['fail'] = 1; $form->validation_errors[$params->get($check)] = 'You must provide your '.$check.'.'; //return false; } } if($this->events['fail'] == 1){ return false; } //case create/update $noPassword = false; if($params->get('function', 0) == 0){ $user_id = empty($post_user_data['id']) ? 0 : $post_user_data['id']; $user = JFactory::getUser($user_id); //check if the password is empty if(!trim($post_user_data['password'])){ //new user must have a password if(empty($post_user_data['id'])){ $this->events['fail'] = 1; $form->validation_errors[$params->get('password')] = 'You must provide a Password.'; return false; }else{ unset($post_user_data['password']); unset($post_user_data['password2']); $noPassword = true; } } //check the 2 passwords if(isset($post_user_data['password']) && isset($post_user_data['password2']) && ($post_user_data['password'] != $post_user_data['password2'])){ $this->events['fail'] = 1; $form->validation_errors[$params->get('password2')] = 'Passwords do NOT match.'; $form->debug[] = "Couldn't create/update user, Passwords do NOT match."; return false; } }else if($params->get('function', 0) == 1){ $user = JFactory::getUser(); if(!$user->get('id')){ $this->events['fail'] = 1; $form->validation_errors[] = 'No users logged in.'; $form->debug[] = "Couldn't get logged in user data."; return false; }else{ $post_user_data['id'] = $user->get('id'); } //user is updating his own record if(trim($post_user_data['old_password']) || trim($post_user_data['password']) || trim($post_user_data['password2'])){ //some password field has been changed, make sure they are correct //check the 2 passwords if($post_user_data['password'] != $post_user_data['password2']){ $this->events['fail'] = 1; $form->validation_errors[$params->get('password2')] = 'Passwords do NOT match.'; $form->debug[] = "Couldn't create/update user, Passwords do NOT match."; return false; } //chek old password if((bool)$params->get('enable_old_password', 0) === true){ //print_r2($user); $parts = explode(":", $user->get('password')); $salt = $parts[1]; $enc_pass = md5($post_user_data['old_password'].$salt).":".$salt; if($enc_pass != $user->get('password')){ $this->events['fail'] = 1; $form->validation_errors[$params->get('old_password')] = 'Wrong password entered.'; $form->debug[] = "Old password has been entered incorrectly."; return false; }else{ //check if the password is empty if(!trim($post_user_data['password']) || !trim($post_user_data['password2'])){ $this->events['fail'] = 1; $form->validation_errors[$params->get('password')] = 'Please enter a new password.'; return false; } } } }else{ $form->data = $form->set_array_value($form->data, explode('.', $params->get('old_password', '')), null); $form->data = $form->set_array_value($form->data, explode('.', $params->get('password', '')), null); $form->data = $form->set_array_value($form->data, explode('.', $params->get('password2', '')), null); } } // Bind the post array to the user object //$post_user_data = $form->data; if(!$user->bind($post_user_data)){ //JError::raiseError( 500, $user->getError()); $this->events['fail'] = 1; $form->validation_errors[] = $user->getError(); $form->debug[] = "Couldn't bind new user, Joomla returned this error : ".$user->getError(); return false; } if($params->get('function', 0) == 0){ $user->set('groups', $defaultUserGroup); // Set some initial user values if(!isset($post_user_data['id']) || empty($post_user_data['id'])){ $user->set('id', 0); $user->set('usertype', 'deprecated'); //$user->set('groups', $defaultUserGroup); $date = JFactory::getDate(); $user->set('registerDate', $date->toMySQL()); }else{ $user->set('id', (int)$post_user_data['id']); if($noPassword === true){ $user->set('password', null); } } } // If there was an error with registration, set the message and display form if(!$user->save()){ /*JError::raiseWarning('', JText::_( $user->getError())); $this->register();*/ $this->events['fail'] = 1; $form->validation_errors[] = $user->getError(); $form->debug[] = "Couldn't save user, Joomla returned this error : ".$user->getError(); return false; }else{ $this->events['success'] = 1; } //store user data $user_data = (array)$user; $removes = array('params', '_params', 'guest', '_errorMsg', '_errors'); foreach($removes as $remove){ unset($user_data[$remove]); } $form->data['_PLUGINS_']['joomla_user_save'] = $user_data; //inject user data under the correct data path if(strlen(trim($params->get('user_data_path', ''))) > 0){ $form->data = $form->set_array_value($form->data, explode('.', trim($params->get('user_data_path', ''))), $user_data); } } function load($clear){ if($clear){ $action_params = array( 'content1' => '', 'name' => '', 'username' => '', 'email' => '', 'password' => '', 'password2' => '', 'old_password' => '', 'user_id' => '', 'new_usertype' => '', 'new_usertype_field' => '', 'function' => 0, 'enable_old_password' => 0, 'user_data_path' => 'User', ); } return array('action_params' => $action_params); } } ?>joomla_user_save/.htaccess000066600000000177151374535400011717 0ustar00 Order allow,deny Deny from all joomla_user_save/joomla_user_save.ctp000066600000017653151374535400014175 0ustar00
Joomla User Create/Update
Header(array('fields' => 'Fields', 'settings' => 'Settings', 'help' => 'Help'), 'joomla_user_save_config_{n}'); ?> tabStart('fields'); ?> input('action_joomla_user_save_{n}_name_config', array('type' => 'text', 'label' => 'Name field name', 'class' => 'medium_input', 'smalldesc' => 'The name of the field which is going to hold the Name data')); ?> input('action_joomla_user_save_{n}_username_config', array('type' => 'text', 'label' => 'Username field name', 'class' => 'medium_input', 'smalldesc' => 'The name of the field which is going to hold the Username data')); ?> input('action_joomla_user_save_{n}_email_config', array('type' => 'text', 'label' => 'Email field name', 'class' => 'medium_input', 'smalldesc' => 'The name of the field which is going to hold the Email data')); ?> input('action_joomla_user_save_{n}_password_config', array('type' => 'text', 'label' => 'Password field name', 'class' => 'medium_input', 'smalldesc' => 'The name of the field which is going to hold the Password data')); ?> input('action_joomla_user_save_{n}_password2_config', array('type' => 'text', 'label' => 'Verify Password field name', 'class' => 'medium_input', 'smalldesc' => 'The name of the field which is going to hold the Verify Password data')); ?> input('action_joomla_user_save_{n}_old_password_config', array('type' => 'text', 'label' => 'Old Password field name', 'class' => 'medium_input', 'smalldesc' => 'The name of the field which is going to hold the Old Password data')); ?> input('action_joomla_user_save_{n}_user_id_config', array('type' => 'text', 'label' => 'User ID field name', 'class' => 'medium_input', 'smalldesc' => 'The name of the field which is going to hold the user id, useful when updating users data by an admin or a different user.')); ?> tabEnd(); ?> tabStart('settings'); ?> input('action_joomla_user_save_{n}_override_allow_user_registration_config', array('type' => 'select', 'label' => 'Override the Joomla Allow user registration', 'label_over' => true, 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Its advised that you disable the Joomla allow user registration setting and enable this one so that users are forced to register here.')); ?> setQuery($query); $options = array(); $groups = $database->loadObjectList(); foreach($groups as $group){ $options[$group->id] = $group->title; } ?> input('action_joomla_user_save_{n}_new_usertype_config', array('type' => 'select', 'label' => 'Usertype', 'options' => $options, 'size' => 6, 'multiple' => 'multiple', 'rule' => "split", 'splitter' => ",", 'smalldesc' => 'The new user type/group.')); ?> input('action_joomla_user_save_{n}_new_usertype_field_config', array('type' => 'text', 'label' => 'Usertype field name', 'class' => 'medium_input', 'smalldesc' => 'The name of the field which is going to hold the group id of the new created users, the User Type field should be empty.')); ?> input('action_joomla_user_save_{n}_function_config', array('type' => 'select', 'label' => 'Function', 'options' => array(0 => 'Create/Update', 1 => 'Update Self'), 'smalldesc' => '"Create/Update will create or update any loaded user record, the "id" field should be present in the data array, "Update Self" will update the details of the logged ins user.')); ?> input('action_joomla_user_save_{n}_enable_old_password_config', array('type' => 'select', 'label' => 'Enable Old Password', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Enable Old password data check, useful for "Update Self" function only.')); ?> input('action_joomla_user_save_{n}_user_data_path_config', array('type' => 'text', 'label' => 'User Data Path', 'class' => 'medium_input', 'smalldesc' => 'The data path under which the saved user data will be present in the form->data array.')); ?> tabEnd(); ?> tabStart('help'); ?>

  • Assign your form field's names to the required fields names under the "Fields" tab.
  • Configure the settings under the "Settings" tab.
  • This action can be used by Admins to create/update users OR by users to update their own accounts.
  • In case of updating existing users (either by admins or end users), passing empty password fields will not overwrite the saved password.

tabEnd(); ?>
joomla_user_save/index.html000066600000000035151374535400012107 0ustar00 db_multi_record_loader/db_multi_record_loader.php000066600000030070151374535400016436 0ustar00 0, 'notfound' => 0, 'nodata' => 0); var $group = array('id' => 'data_operations', 'title' => 'Data/DB Operations'); var $details = array('title' => 'DB Multi Record Loader', 'tooltip' => 'Load Database table records based on a request parameter value or a custom DB query.'); function run($form, $actiondata){ $params = new JParameter($actiondata->params); $table_name = $params->get('table_name', ''); if(!empty($table_name) && (int)$params->get('load_data', 1) == 1){ $mainframe = JFactory::getApplication(); $database = JFactory::getDBO(); $table_field = $params->get('dbfield', ''); if(trim($actiondata->content1)){ $where = " WHERE ".$this->_processWhere(trim($actiondata->content1), $form); }else if(!empty($table_field)){ //$where = " WHERE `".$params->get('dbfield', '')."` = '".$form->data[$params->get('request_param', '')]."'"; $req_param = $form->get_array_value($form->data, explode('.', $params->get('request_param', ''))); if(is_null($req_param)){ $req_param = ''; $where = " WHERE `".$table_field."` = '".$form->escapeVar($req_param)."'"; }else{ if(is_array($req_param) && !empty($req_param)){ $where = " WHERE `".$table_field."` IN ('".implode("','", $form->escapeVar($req_param))."')"; }else{ $where = " WHERE `".$table_field."` = '".$form->escapeVar($req_param)."'"; } } }else{ $where = ""; } //load the model_id $model_id_sub = preg_replace('/(?:^|_)(.?)/e', "strtoupper('$1')", $table_name); $model_id = $params->get('model_id', ''); if(empty($model_id)){ $model_id = $model_id_sub; } //check fields $fields = array(); if(trim($params->get('fields', ''))){ $fields_list = explode(",", trim($params->get('fields', ''))); foreach($fields_list as $field){ $fields[] = "`".$field."`"; } }else{ $fields = array("`".$model_id."`.*"); } //check the association $assoc = ''; $assoc_models = array(); $primaries = array(); if($params->get('enable_association', 0) == 1 && $params->get('load_data', 1) == 1){ if(trim($params->get('associated_models', ''))){ //add primary key for the main table $fields_list = $database->getTableFields(array(trim($params->get('table_name', ''))), false); $table_fields = $fields_list[trim($params->get('table_name', ''))]; foreach($table_fields as $table_field => $field_data){ if($field_data->Key == 'PRI'){ $primaries[$model_id] = $table_field; } } //find associated models list $assoc_models = explode(',', $params->get('associated_models')); foreach($assoc_models as $k => $assoc_model){ $assoc_models[$k] = trim($assoc_model); } //find other multi record loaders $models_list = array(); $wheres_list = array(); foreach($form->form_actions as $form_action){ if($form_action->type == 'db_multi_record_loader'){ $action_params = new JParameter($form_action->params); if(trim($action_params->get('model_id', '')) && trim($action_params->get('table_name', ''))){ $models_list[trim($action_params->get('model_id', ''))] = array('table' => trim($action_params->get('table_name', ''))); $models_list[trim($action_params->get('model_id', ''))]['join_type'] = trim($action_params->get('join_type', 'INNER')); $models_list[trim($action_params->get('model_id', ''))]['join_rule'] = trim($action_params->get('join_rule', '')); if(in_array(trim($action_params->get('model_id', '')), $assoc_models)){ //find some table info (primary key) $fields_list = $database->getTableFields(array(trim($action_params->get('table_name', ''))), false); $table_fields = $fields_list[trim($action_params->get('table_name', ''))]; foreach($table_fields as $table_field => $field_data){ if($field_data->Key == 'PRI'){ $primaries[trim($action_params->get('model_id', ''))] = $table_field; } } //get table fields list if(trim($action_params->get('fields', ''))){ $table_fields = explode(",", trim($action_params->get('fields', ''))); foreach($table_fields as $table_field){ $table_field = trim($table_field); $field_alias = "`".trim($action_params->get('model_id', '')).".".$table_field."`"; $field_name = "`".trim($action_params->get('model_id', ''))."`.`".$table_field."`"; $fields[] = $field_name." AS ".$field_alias; } }else{ foreach($table_fields as $table_field => $field_data){ $fields[] = "`".trim($action_params->get('model_id', ''))."`.`".$table_field."` AS `".trim($action_params->get('model_id', '')).".".$table_field."`"; } //$fields[] = "`".trim($action_params->get('model_id', ''))."`.*"; } //append any WHERE data if(trim($form_action->content1)){ if(!empty($where)){ //$where .= " AND ".$this->_processWhere($form_action->content1, $form); $wheres_list[trim($action_params->get('model_id', ''))] = " ON ".$this->_processWhere($form_action->content1, $form); }else{ $where = " WHERE ".$this->_processWhere($form_action->content1, $form); } } } } } } //build the JOIN statement foreach($assoc_models as $assoc_model){ if(isset($models_list[$assoc_model])){ $assoc .= " ".$models_list[$assoc_model]['join_type']." JOIN `".$models_list[$assoc_model]['table']."` AS `".$assoc_model."`"; if(strlen(trim($models_list[$assoc_model]['join_rule'])) > 0){ $assoc .= " ON ".$models_list[$assoc_model]['join_rule']; } if(isset($wheres_list[$assoc_model])){ $assoc .= $wheres_list[$assoc_model]; } } } } } //add the page navigation data if((bool)$params->get('enable_pagination', 0) === true && $params->get('load_type', 'all') == 'all'){ $option = 'com_chronoforms.db_multi_record_loader.'.$actiondata->id; $session = JFactory::getSession(); if(isset($form->data['limit'])){ $session->set($option.'.limit', (int)$form->data['limit'], md5('chrono')); } $limit = $mainframe->getUserStateFromRequest($option.'.limit', 'limit', $session->get($option.'.limit', (int)$params->get('pagination_limit', 50), md5('chrono')), 'int'); $limitstart = $mainframe->getUserStateFromRequest($option.'.limitstart', 'limitstart', 0, 'int'); $sql = "SELECT count(*) FROM `".$params->get('table_name', '')."` AS `".$model_id."`".$assoc.$where; $database->setQuery($sql); $total = $database->loadResult(); jimport('joomla.html.pagination'); $pageNav = new JPagination($total, $limitstart, $limit); //get current page url //load show_html action helper class $form->loadActionHelper('show_html'); $url = CfactionShowHtmlHelper::selfURL(); if($form->admin === false){ $form->paginatior_footer = '
'; }else{ $form->paginatior_footer = ''; } $form->paginatior_footer .= $pageNav->getListFooter(); $form->paginatior_footer .= '
'; //check order data $order = ''; if(isset($form->data['order'])){ $order = ' ORDER BY `'.trim($form->data['order']).'`'.(isset($form->data['direction']) ? ' '.$form->data['direction']: ' ASC'); } $fields = implode(", ", $fields); if((bool)$params->get('count', 0) === true){ $fields = 'count(*)'; } $sql = "SELECT ".$fields." FROM `".$params->get('table_name', '')."` AS `".$model_id."`".$assoc.$where.$order." LIMIT $pageNav->limitstart,$pageNav->limit"; }else{ $fields = implode(", ", $fields); if((bool)$params->get('count', 0) === true){ $fields = 'count(*)'; } $sql = "SELECT ".$fields." FROM `".$params->get('table_name', '')."` AS `".$model_id."`".$assoc.$where; } //echo $form->paginatior_footer; //add debug data $form->debug['db_multi_record_loader'][] = $sql; //run the sql and get the data $database->setQuery($sql); if($params->get('load_type', 'all') == 'first'){ $data = $database->loadAssoc(); }else{ $data = $database->loadAssocList(); } //process the data if association was enabled if(!empty($assoc_models) && !empty($data)){ if($params->get('load_type', 'all') == 'first'){ foreach($data as $k => $v){ if(strpos($k, '.')){ $details = explode('.', $k); if((bool)$params->get('group_model_data', 1) === true){ $data[$details[0]][$details[1]] = $v; }else{ $form->data[$details[0]][$details[1]] = $v; } unset($data[$k]); } } }else{ foreach($data as $datak => $datav){ if(is_array($datav)){ foreach($datav as $k => $v){ if(strpos($k, '.')){ $details = explode('.', $k); $data[$datak][$details[0]][$details[1]] = $v; unset($data[$datak][$k]); }/*else{ $data[$datak][$model_id][$k] = $v; unset($data[$datak][$k]); }*/ } } } if((int)$params->get('group_model_data', 1) == 1){ $data = $this->group_model_data($data, $model_id, $primaries); } } } //print_r2($data); //data must be loaded under some model id $form->data[$model_id] = $data; //check the result //$request_val = $form->data[$params->get('request_param', '')]; if(empty($data)){ $this->events['notfound'] = 1; }else{ $this->events['found'] = 1; } //print_r2($form->data); } } function group_model_data($data, $main_model_id, $primaries){ if(!empty($primaries)){ if(isset($primaries[$main_model_id])){ $primary = $primaries[$main_model_id]; unset($primaries[$main_model_id]); }else{ return $data; } $unique_values = array(); $new_data = array(); foreach($data as $datak => $datav){ if(is_array($datav)){ if(isset($datav[$primary])){ if(!isset($unique_values[$datav[$primary]])){ $unique_values[$datav[$primary]] = $datak; //$new_data[] = $datav; foreach($primaries as $model => $pr){ if(isset($datav[$model])){ $temp_model_data = $datav[$model]; unset($datav[$model]); $datav[$model][] = $temp_model_data; } } $new_data[$datak] = $datav; }else{ foreach($primaries as $model => $pr){ if(isset($datav[$model])){ $temp_model_data = $datav[$model]; unset($datav[$model]); $new_data[$unique_values[$datav[$primary]]][$model][] = $temp_model_data; } } } } } } foreach($primaries as $model => $pr){ foreach($new_data as $k => $v){ if(is_array($v) && isset($v[$model])){ $new_data[$k][$model] = $this->group_model_data($v[$model], $model, $primaries); } } } $data = $new_data; } return $data; } function _processWhere($code, $form){ ob_start(); eval("?>".$code); $code = ob_get_clean(); return $code; } function load($clear){ if($clear){ $action_params = array( 'dbfield' => '', 'table_name' => '', 'request_param' => '', 'load_data' => 1, 'model_id' => '', 'fields' => '', 'count' => 0, 'join_type' => 'INNER', 'join_rule' => '', 'load_type' => 'all', 'enable_association' => 0, 'associated_models' => '', 'group_model_data' => 1, 'pagination_limit' => '50', 'enable_pagination' => 0, 'data_display_fields' => '', 'enable_data_displayer' => 0, 'data_order_fields' => '', 'content1' => '' ); } return array('action_params' => $action_params); } } ?>db_multi_record_loader/db_multi_record_loader.ctp000066600000031311151374535400016434 0ustar00
DB Multi Record Loader
Header(array('basic' => 'Basic', 'advanced' => 'Advanced', 'displayer' => 'Data Displayer', 'help' => 'Help'), 'db_multi_record_loader_config_{n}'); ?> tabStart('basic'); ?> input('action_db_multi_record_loader_{n}_dbfield_config', array('type' => 'text', 'label' => "DB Field", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "The field name which will be used to query the table record, if left empty then all records will be loaded.")); ?> getTableList(); $options = array(); foreach($tables as $table){ $options[$table] = $table; } ?> input('action_db_multi_record_loader_{n}_table_name_config', array('type' => 'select', 'label' => 'Table', 'options' => $options, 'empty' => " - ", 'class' => 'medium_input', 'smalldesc' => "The table name to load the data from.")); ?> input('action_db_multi_record_loader_{n}_request_param_config', array('type' => 'text', 'label' => "Request Param", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "The param name which will exist in the request url to the form, its value will be used to load the target db records, if the value of this parameter is an array then the array values will be used inside 'IN' statement.")); ?> input('action_db_multi_record_loader_{n}_model_id_config', array('type' => 'text', 'label' => "Model ID", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "The key under which the loaded record data will be stored in the form->data array.
this is obligatory, if left empty then a camilized version of the table name will be used, e.g: jos_my_table = JosMyTable")); ?> input('action_db_multi_record_loader_{n}_fields_config', array('type' => 'text', 'label' => "Fields", 'class' => 'big_input', 'label_over' => true, 'smalldesc' => "List of comma separated fields names to load from this table (field_name1,field_name2..etc), leave empty to load all fields.")); ?> tabEnd(); ?> tabStart('advanced'); ?> input('action_db_multi_record_loader_{n}_load_data_config', array('type' => 'select', 'label' => 'Load Data', 'options' => array(0 => 'No', 1 => 'Yes'), 'class' => 'medium_input', 'smalldesc' => "Do you want to load the data of this model OR just use it in the models associations ?")); ?> input('action_db_multi_record_loader_{n}_load_type_config', array('type' => 'select', 'label' => 'Data Load Type', 'options' => array('all' => 'ALL', 'first' => 'First Record'), 'smalldesc' => "Which data to load ? All data (normal behavior) OR first record only (similar to the Record Loader Action).")); ?> input('action_db_multi_record_loader_{n}_enable_association_config', array('type' => 'select', 'label' => 'Enable Associations', 'options' => array(0 => 'No', 1 => 'Yes'), 'class' => 'medium_input', 'smalldesc' => "Do you want to enable the associations for this model ? this will allow you to load data from multiple tables and have them associated together.")); ?> input('action_db_multi_record_loader_{n}_join_type_config', array('type' => 'select', 'label' => 'JOIN Type', 'options' => array('INNER' => 'INNER', 'LEFT' => 'LEFT', 'RIGHT' => 'RIGHT'), 'smalldesc' => "The JOIN type used in case of an association.")); ?> input('action_db_multi_record_loader_{n}_join_rule_config', array('type' => 'text', 'label' => 'JOIN Rule', 'class' => 'big_input', 'smalldesc' => "The JOIN rule used in case of an association, example: MODEL_ID1.field1=MODEL_ID2.field2")); ?> input('action_db_multi_record_loader_{n}_associated_models_config', array('type' => 'text', 'label' => "Associated Models", 'class' => 'big_input', 'label_over' => true, 'smalldesc' => "list of models ids to associate this one with, comma separated, exactly as they are in other 'Multi DB Record Loader' configs.")); ?> input('action_db_multi_record_loader_{n}_group_model_data_config', array('type' => 'select', 'label' => 'Group Model Data', 'options' => array(0 => 'No', 1 => 'Yes'), 'class' => 'medium_input', 'smalldesc' => "This will add a bit of overhead on the server, but will remove any duplicates from the results and will group any associated models data under the same item.")); ?> input('action_db_multi_record_loader_{n}_content1_config', array('type' => 'textarea', 'label' => 'WHERE statement', 'rows' => 10, 'cols' => 50, 'smalldesc' => "The code used for the WHERE statement, some notes:
1 - leave empty to use the default request param with column name formula (associations not enabled), OR to load ALL records (associations enabled).
2 - don't use the WHERE word.
3 - in case of associations, pay attention to write the join rule, e.g: `User`.`id` = `Profile`.`user_id`
4 - in case of associations, if other associated models have WHERE statements then all the WHERE data will be appended using AND.
5 - You can use PHP code with tags. ")); ?> tabEnd(); ?> tabStart('displayer'); ?> input('action_db_multi_record_loader_{n}_enable_data_displayer_config', array('type' => 'select', 'label' => 'Enable Data Displayer', 'options' => array(0 => 'No', 1 => 'Yes'), 'class' => 'medium_input', 'smalldesc' => "Do you want to enable the generic data displayer ?")); ?> input('action_db_multi_record_loader_{n}_data_display_fields_config', array('type' => 'text', 'label' => "Display Fields", 'class' => 'big_input', 'smalldesc' => "Enter comma separated list of fields and titles in this format:
field_name:Field_Title
e.g:field1:Name,field2:Company")); ?> input('action_db_multi_record_loader_{n}_data_order_fields_config', array('type' => 'text', 'label' => "Order Fields", 'class' => 'big_input', 'smalldesc' => "Enter comma separated list of fields names to be sortable.")); ?> input('action_db_multi_record_loader_{n}_enable_pagination_config', array('type' => 'select', 'label' => 'Enable Pagination', 'options' => array(0 => 'No', 1 => 'Top', 2 => 'Bottom'), 'class' => 'medium_input', 'smalldesc' => "Do you want to enable the pagination feature for the records returned ? if so, where do you want it displayed ?")); ?> input('action_db_multi_record_loader_{n}_pagination_limit_config', array('type' => 'text', 'label' => "Limit", 'class' => 'small_input', 'smalldesc' => "The number of records per page.")); ?> tabEnd(); ?> tabStart('help'); ?>

  • Select the table name to load the data from
  • Your table must have a primary key.
  • Please give your table a unique model id, e.g: jos_content can have "Article".
  • If you disable "Load Data" then no db query will run for this model, this is useful when you only need to create an association with another model loading the data.
  • If you enable the associations then your model will check for any associated models to load the data from.
  • Associated models should have a list of models connected to the current model somehow, these models should be loaded through similar actions in the same form event.
  • Grouping model data is useful when you have lots of duplicated records in the data returned, this is usually the case when you have 1 or more models associated.
  • You may enable data pagination under the pagination tab, please use this variable to show the pagination limit boxes or links:
    $form->paginatior_footer

tabEnd(); ?>
db_multi_record_loader/cfaction_db_multi_record_loader.ctp000066600000000231151374535400020277 0ustar00load($form, $actiondata); ?>db_multi_record_loader/.htaccess000066600000000177151374535400013045 0ustar00 Order allow,deny Deny from all db_multi_record_loader/cfaction_db_multi_record_loader.php000066600000010600151374535400020301 0ustar00params); $output = ''; if((bool)$params->get('enable_data_displayer', 0) === true && $params->get('load_type', 'all') == 'all'){ //find the model data $table_name = $params->get('table_name', ''); $model_id_sub = preg_replace('/(?:^|_)(.?)/e', "strtoupper('$1')", $table_name); $model_id = $params->get('model_id', ''); if(empty($model_id)){ $model_id = $model_id_sub; } //pre output creation $fields_names = array(); $fields_headings = array(); $order_fields = array(); //get order fields $order_str = trim($params->get('data_order_fields', '')); if(!empty($order_str)){ $order_fields = explode(",", trim($params->get('data_order_fields', ''))); } //get display fields $fields_data = trim($params->get('data_display_fields', '')); if(!empty($fields_data)){ $fields_data = explode(",", $fields_data); foreach($fields_data as $field_data){ $field_data = explode(":", trim($field_data)); $fields_names[] = $field_name = $field_data[0]; if(!isset($field_data[1])){ $field_data[1] = strtoupper($field_data[0]); } $fields_headings[] = $field_heading = $field_data[1]; } } //create the table code $output .= ''; $output .= ''; $output .= ''; $form->loadActionHelper('show_html'); $showHTMLHelper = new CfactionShowHtmlHelper(); foreach($fields_headings as $k => $field_heading){ if(in_array($fields_names[$k], $order_fields)){ $direction = 'asc'; if(isset($form->data['order']) && ($form->data['order'] == $fields_names[$k]) && isset($form->data['direction'])){ if($form->data['direction'] == 'asc'){ $direction = 'desc'; }else{ $direction = 'asc'; } } $class = ''; if(isset($form->data['order']) && ($form->data['order'] == $fields_names[$k])){ $class = ' direction_'.(isset($form->data['direction']) ? $form->data['direction']: 'asc'); } $field_heading = ''.$field_heading.''; }else{ $field_heading = $field_heading; } $output .= ''; } $output .= ''; $output .= ''; $output .= ''; $i = 0; if(!empty($form->data[$model_id])){ foreach($form->data[$model_id] as $r => $record){ $output .= ''; foreach($fields_names as $k => $field_name){ if(strpos($field_name, '.') !== false){ $record[$field_name] = $form->get_array_value($record, explode('.', $field_name)); } $output .= ''; } $output .= ''; $i = 1 - $i; } } $output .= ''; $output .= '
'.$field_heading.'
'.$record[$field_name].'
'; } if((bool)$params->get('enable_pagination', 0) === true && isset($form->paginatior_footer)){ //check the position of the pagination if((int)$params->get('enable_pagination', 0) == 1){ $output = $form->paginatior_footer.$output; }else if((int)$params->get('enable_pagination', 0) == 2){ $output = $output.$form->paginatior_footer; } } //add CSS $this->_addCSS($form, $actiondata); //end echo $output; } function _addCSS($form, $actiondata){ $document = JFactory::getDocument(); //add some CSS formatting for pagination ob_start(); ?> .list-footer ul li { display: inline; } #db_multi_record_loader_id; ?> { width: 100%; margin: 0px 0px; } #db_multi_record_loader_id; ?> .cell { padding: 2px; } #db_multi_record_loader_id; ?> .cell { padding: 2px; } #db_multi_record_loader_id; ?> thead { background-color: #dedede; } addStyleDeclaration($script); } } ?>db_multi_record_loader/index.html000066600000000035151374535400013235 0ustar00 multi_page/multi_page.php000066600000003273151374535400011551 0ustar00 'Multi Page', 'tooltip' => 'Handles the data transactions between the different form pages.'); var $group = array('id' => 'form_utilities', 'title' => 'Utilities'); function run($form, $actiondata){ $params = new JParameter($actiondata->params); $session_key = $form->getSessionToken(); //Data to Session config $data_to_session_details = new stdClass(); $data_to_session_details->type = 'data_to_session'; $data_to_session_Params = new JParameter(''); $data_to_session_Params->set('merge', 1); if((bool)$params->get('session_key', 0) === true){ $data_to_session_Params->set('key', $session_key); } $data_to_session_details->params = $data_to_session_Params->toString(); $form->runAction($data_to_session_details); //Session to Data config $session_to_data_details = new stdClass(); $session_to_data_details->type = 'session_to_data'; $session_to_data_Params = new JParameter(''); if((bool)$params->get('session_key', 0) === true){ $session_to_data_Params->set('key', $session_key); } $session_to_data_details->params = $session_to_data_Params->toString(); $form->runAction($session_to_data_details); } function load($clear){ if($clear){ $action_params = array( 'show_navigation' => 0, 'session_key' => 0 ); } return array('action_params' => $action_params); } } ?>multi_page/multi_page.ctp000066600000003345151374535400011550 0ustar00
Multi Page
Header(array('settings' => 'Settings', 'help' => 'Help'), 'multi_page_config_{n}'); ?> tabStart('settings'); ?> input('action_multi_page_{n}_session_key_config', array('type' => 'select', 'label' => 'Unique Session Key', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Add a unique session key for every form instance, this is helpful if more than one form or more than one instance of the same form may be loaded together.

*please note that if this parameter is enabled then you will have to include the session key in the form URL in case of a page navigation.')); ?> tabEnd(); ?> tabStart('help'); ?>

  • This action should be added to the TOP of every event used in a different form page so that it can handle all the data transactions between the different pages.

tabEnd(); ?>
multi_page/index.html000066600000000035151374535400010700 0ustar00 multi_page/.htaccess000066600000000177151374535400010510 0ustar00 Order allow,deny Deny from all authenticator/authenticator.ctp000066600000010366151374535400013021 0ustar00
Authenticator
Header(array('settings' => 'Settings', 'help' => 'Help'), 'authenticator_config_{n}'); ?> tabStart('settings'); ?> RELEASE > 1.5){ $options = $action_params['groups_list']; }else{ $options = $action_params['groups_list']; //$options = array(18 => 'Registered users', 19 => 'Authors', 20 => 'Editors', 21 => 'Publishers', 23 => 'Managers', 24 => 'Administrators', 25 => 'Super Administrators'); } ?> input('action_authenticator_{n}_groups_config', array('type' => 'select', 'label' => 'Allowed groups', 'options' => $options, 'size' => 11, 'class' => 'medium_input', 'multiple' => 'multiple', 'rule' => "split", 'splitter' => ",", 'smalldesc' => 'Select the groups authorized.')); ?> input('action_authenticator_{n}_guests_config', array('type' => 'select', 'label' => 'Allow guests', 'options' => array(0 => 'No', 1 => 'Yes'), 'class' => 'medium_input', 'smalldesc' => "Guests are non logged in users, choose wheather you want to allow them access or not.")); ?> input('action_authenticator_{n}_inheritable_config', array('type' => 'select', 'label' => 'Inheritable Permissions', 'options' => array(0 => 'No', 1 => 'Yes'), 'class' => 'medium_input', 'smalldesc' => "Enable this if you want sub groups to inherit the access permissions of their parents.")); ?> input('action_authenticator_{n}_denied_groups_config', array('type' => 'select', 'label' => 'Denied groups', 'options' => $options, 'size' => 11, 'class' => 'medium_input', 'multiple' => 'multiple', 'rule' => "split", 'splitter' => ",", 'smalldesc' => 'Select the groups denied, this is useful only if you have the "Inheritable" option set to "Yes".')); ?> input('action_authenticator_{n}_content1_config', array('type' => 'textarea', 'label' => "Code", 'rows' => 20, 'cols' => 70, 'smalldesc' => 'any code can be placed here, any PHP code should include the PHP tags.')); ?> tabEnd(); ?> tabStart('help'); ?>

  • Select which user groups should be allowed access.
  • Permissions are not inheritable by default, this means that if you need to allow both the "Public" group and the "Administrators" group then you need to select BOTH of them.
  • If the user's group is Allowed AND Denied then the authentication will fail leading to a denied.
  • Insert next form events in the "Allowed" event or insert "Show stopper" in the "Denied" event to halt the form.

tabEnd(); ?>
authenticator/authenticator.php000066600000020071151374535400013014 0ustar00 0, 'denied' => 0); var $group = array('id' => 'form_security', 'title' => 'Security'); var $details = array('title' => 'Authenticator', 'tooltip' => "Control users access to your form's different events, select which users groups should be allowed access and which ones should be denied."); //var $users_groups = array(); function run($form, $actiondata){ $params = new JParameter($actiondata->params); $user = JFactory::getUser(); //check guests $guest = $params->get('guests', 1); if($user->guest && $guest){ $this->events['allowed'] = 1; return true; } //check other groups $jversion = new JVersion(); if((bool)$params->get('inheritable', 0) === true){ //get users groups objects from the db $db_users_groups = $this->get_groups_list(); } if($jversion->RELEASE > 1.5){ if(trim($params->get('groups', '')) || trim($params->get('denied_groups', ''))){ if(trim($params->get('groups', ''))){ $_groups = explode(',', trim($params->get('groups', ''))); array_walk($_groups, 'trim'); }else{ $_groups = array(); } //if guest, then add the public group if((bool)$user->guest === true){ $user->groups[] = 1; } $user->groups = array_unique($user->groups); //check denied groups if there are any if(trim($params->get('denied_groups', ''))){ $d_groups = explode(',', trim($params->get('denied_groups', ''))); array_walk($d_groups, 'trim'); if(!empty($d_groups)){ $denied_groups = array(); foreach($d_groups as $d_group){ if((bool)$params->get('inheritable', 0) === true){ $group = $form->search_array($db_users_groups, array('key' => 'id', 'value' => $d_group)); if(!empty($group)){ $children = $this->get_child_path($group[0], $db_users_groups); $denied_groups = array_merge($denied_groups, $children); } }else{ $denied_groups[] = (int)$d_group; } } $denied_groups = array_unique($denied_groups); if($this->group_exists($user, $denied_groups) === true){ $this->events['denied'] = 1; return false; } } } $allowed_groups = array(); foreach($_groups as $_group){ if((bool)$params->get('inheritable', 0) === true){ $group = $form->search_array($db_users_groups, array('key' => 'id', 'value' => $_group)); if(!empty($group)){ $children = $this->get_child_path($group[0], $db_users_groups); $allowed_groups = array_merge($allowed_groups, $children); } }else{ $allowed_groups[] = (int)$_group; } } $allowed_groups = array_unique($allowed_groups); if($this->group_exists($user, $allowed_groups) === true){ $this->events['allowed'] = 1; return true; } } }else{ if(trim($params->get('groups', '')) || trim($params->get('denied_groups', ''))){ if(trim($params->get('groups', ''))){ $_groups = explode(',', trim($params->get('groups', ''))); array_walk($_groups, 'trim'); }else{ $_groups = array(); } //if guest, then add the public group if((bool)$user->guest === true){ $user->gid = 29; } //check denied groups if there are any if(trim($params->get('denied_groups', ''))){ $d_groups = explode(',', trim($params->get('denied_groups', ''))); array_walk($d_groups, 'trim'); if(!empty($d_groups)){ $denied_groups = array(); foreach($d_groups as $d_group){ if((bool)$params->get('inheritable', 0) === true){ $group = $form->search_array($db_users_groups, array('key' => 'id', 'value' => $d_group)); if(!empty($group)){ $children = $this->get_child_path($group[0], $db_users_groups); $denied_groups = array_merge($denied_groups, $children); } }else{ $denied_groups[] = (int)$d_group; } } $denied_groups = array_unique($denied_groups); if($this->group_exists($user, $denied_groups) === true){ $this->events['denied'] = 1; return false; } } } $allowed_groups = array(); foreach($_groups as $_group){ if((bool)$params->get('inheritable', 0) === true){ $group = $form->search_array($db_users_groups, array('key' => 'id', 'value' => $_group)); if(!empty($group)){ $children = $this->get_child_path($group[0], $db_users_groups); $allowed_groups = array_merge($allowed_groups, $children); } }else{ $allowed_groups[] = (int)$_group; } } $allowed_groups = array_unique($allowed_groups); if($this->group_exists($user, $allowed_groups) === true){ $this->events['allowed'] = 1; return true; } } } //user group not found, set denied = 1 $this->events['denied'] = 1; return null; } function load($clear){ if($clear){ $action_params = array( 'guests' => 1, 'content1' => '', 'groups' => '', 'denied_groups' => '', 'inheritable' => 0, 'groups_list' => $this->get_goptions_list($this->get_groups_list()) ); } return array('action_params' => $action_params); } function group_exists($user, $groups){ $jversion = new JVersion(); if($jversion->RELEASE > 1.5){ if(!empty($user->groups)){ foreach($user->groups as $kg => $group){ if(in_array((int)$group, $groups, true)){ //$this->events['allowed'] = 1; return true; } } } }else{ if(in_array((int)$user->gid, $groups, true)){ //$this->events['allowed'] = 1; return true; } } return false; } function get_groups_list(){ /*if(isset($this->users_groups) && !empty($this->users_groups)){ return $this->users_groups; }*/ static $users_groups; if(!isset($users_groups)){ $users_groups = array(); }else{ return $users_groups; } $jversion = new JVersion(); $database = JFactory::getDBO(); if($jversion->RELEASE > 1.5){ $query = "SELECT * FROM `#__usergroups` ORDER BY `lft`"; $database->setQuery($query); $users_groups = $groups = $database->loadAssocList(); }else{ $query = "SELECT * FROM `#__core_acl_aro_groups`"; $database->setQuery($query); $users_groups = $groups = $database->loadAssocList(); } return $groups; } function get_goptions_list($groups){ $jversion = new JVersion(); $options = array(); foreach($groups as $group){ //$options[$group->id] = $group->title; $child_path = $this->get_parent_path($group, $groups); $depth = count($child_path); array_shift($child_path); foreach($child_path as $k => $p){ $child_path[$k] = '|—'; } if($jversion->RELEASE > 1.5){ $options[$group['id']] = implode('', $child_path).$group['title']; }else{ $options[$group['id']] = implode('', $child_path).$group['name']; } } return $options; } function get_parent_path($m_group, $groups, &$return = array()){ if(empty($return)){ if($m_group['id'] == 1){ return array(1); }else{ $return[] = (int)$m_group['id']; } } foreach($groups as $group){ if((int)$group['id'] == (int)$m_group['parent_id']){ $return[] = (int)$group['id']; if((int)$group['id'] == 1){ break; }else{ $return = $this->get_parent_path($group, $groups, $return); } } } return $return; } function get_child_path($m_group, $groups, &$return = array()){ if(empty($return)){ $return[] = (int)$m_group['id']; } $children = array(); foreach($groups as $group){ if(((int)$group['parent_id'] == (int)$m_group['id']) && !in_array((int)$group['id'], $return)){ $return[] = (int)$group['id']; $children[] = $group; //$return = $this->get_child_path($group, $groups, $return); } } foreach($children as $child){ $return = $this->get_child_path($child, $groups, $return); } return $return; } } ?>authenticator/.htaccess000066600000000177151374535400011234 0ustar00 Order allow,deny Deny from all authenticator/index.html000066600000000000151374535400011414 0ustar00custom_datepicker_moo/.htaccess000066600000000177151374535400012741 0ustar00 Order allow,deny Deny from all custom_datepicker_moo/index.html000066600000000035151374535400013131 0ustar00 custom_datepicker_moo/custom_datepicker_moo.php000066600000001645151374535400016234 0ustar00 'Custom Mootools Datepicker', 'tooltip' => 'Load a custom Mootools Datepicker class.'); var $group = array('id' => 'power_fields', 'title' => 'Power Fields'); function load($clear){ if($clear){ $action_params = array( 'field_class' => '', 'pickerClass' => 'datepicker_dashboard', 'format' => '%d-%m-%Y %H:%M:%S', 'allowEmpty' => 1, 'timePicker' => 1, 'pickOnly' => '', 'content1' => '', ); } return array('action_params' => $action_params); } function run($form, $actiondata){ } } ?>custom_datepicker_moo/cfaction_custom_datepicker_moo.ctp000066600000000231151374535400020067 0ustar00load($form, $actiondata); ?>custom_datepicker_moo/custom_datepicker_moo.ctp000066600000011015151374535400016223 0ustar00
Custom Mootools Datepicker
Header(array('settings' => 'Settings', 'help' => 'Help'), 'custom_datepicker_moo_config_{n}'); ?> tabStart('settings'); ?> input('action_custom_datepicker_moo_{n}_field_class_config', array('type' => 'text', 'label' => "Field Class", 'class' => 'medium_input', 'smalldesc' => "The class name assigned to the field(s) which will be used as date field.")); ?> input('action_custom_datepicker_moo_{n}_pickerClass_config', array('type' => 'select', 'label' => "Picker Style", 'options' => array('datepicker_dashboard' => 'DashBoard', 'datepicker_jqui' => 'JQUI', 'datepicker_vista' => 'Vista'), 'smalldesc' => "The class for the picker itself, will control how the calendar looks like.")); ?> input('action_custom_datepicker_moo_{n}_format_config', array('type' => 'text', 'label' => "Date format shown", 'class' => 'medium_input', 'smalldesc' => "The format shown inside the visible field for the user in the form.")); ?> input('action_custom_datepicker_moo_{n}_allowEmpty_config', array('type' => 'select', 'label' => 'Allow Empty ?', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Allow the field to be empty, will load the field with empty value.')); ?> input('action_custom_datepicker_moo_{n}_timePicker_config', array('type' => 'select', 'label' => 'Load Time picker ?', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Load the time picker after selecting a date ?')); ?> input('action_custom_datepicker_moo_{n}_pickOnly_config', array('type' => 'select', 'label' => 'Pick Only', 'options' => array(0 => 'Disabled', 'time' => 'Time', 'days' => 'Days', 'months' => 'Months', 'years' => 'Years'), 'smalldesc' => 'Should this date field pick some specific data only ?')); ?> input('action_custom_datepicker_moo_{n}_content1_config', array('type' => 'textarea', 'label' => "Extra options extension", 'rows' => 10, 'cols' => 50, 'smalldesc' => "Add extra picker options here, e.g:
days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], startView: 'decades'")); ?> tabEnd(); ?> tabStart('help'); ?>

  • Add your fields class then start configuring your picker.
  • All picker options and config are available here:
    http://mootools.net/forge/p/mootools_datepicker

tabEnd(); ?>
custom_datepicker_moo/cfaction_custom_datepicker_moo.php000066600000005336151374535400020103 0ustar00params); $document = JFactory::getDocument(); JHTML::_('behavior.mootools'); $mainframe = JFactory::getApplication(); $uri = JFactory::getURI(); //check picker types $jversion = new JVersion(); $script = ""; if(($jversion->RELEASE > 1.5) && $form->form_params->get('datepicker_type', 0) == 1){ $cf_url = $uri->root(); $cf_url .= 'components/com_chronoforms/js/datepicker_moo/'; // you can change the uncommented line here to change the style $datepicker_style = $params->get('pickerClass', 'datepicker_dashboard'); $document->addStyleSheet($cf_url.$datepicker_style.'/'.$datepicker_style.'.css'); $document->addScript($cf_url.'Locale.en-US.DatePicker.js'); $document->addScript($cf_url.'Picker.js'); $document->addScript($cf_url.'Picker.Attach.js'); $document->addScript($cf_url.'Picker.Date.js'); if((bool)$params->get('pickOnly', 0) === false){ $pickOnly = 'false'; }else{ $pickOnly = "'".$params->get('pickOnly', 0)."'"; } $con_str = "$$('.".$params->get('field_class', 'cf_datetime_picker')."'), {pickerClass: '".$params->get('pickerClass', 'datepicker_dashboard')."', format: '".$params->get('format', 'd-m-Y H:i:s')."', allowEmpty: ".$params->get('allowEmpty', 'true').", timePicker: ".$params->get('timePicker', 'true').", pickOnly: ".$pickOnly.""; $pickerClass = "Picker.Date"; ob_start(); eval('?>'.$actiondata->content1); $actiondata->content1 = ob_get_clean(); if(!empty($actiondata->content1)){ $con_str .= ", ".$actiondata->content1; $con_str .= "}"; }else{ $con_str .= "}"; } ob_start(); ?> window.addEvent('load', function() { new (); }); form_params->get('dynamic_files', 0) === false){ $document->addScriptDeclaration("//"); }else{ //load the action class $form->loadActionHelper('load_js'); $CfactionLoadJsHelper = new CfactionLoadJsHelper(); $JSactiondata = new stdClass(); $JSactiondata->content1 = $script; $JSParams = new JParameter(''); $JSParams->set('dynamic_file', $form->form_params->get('dynamic_files', 0)); $JSactiondata->params = $JSParams->toString(); $CfactionLoadJsHelper->load($form, $JSactiondata); } } } ?>image_resize/image_resize.php000066600000025407151374535400012406 0ustar00 'form_utilities', 'title' => 'Utilities'); var $details = array('title' => 'Image Resize', 'tooltip' => 'Do some images resizing operations.'); function run($form, $actiondata){ $params = new JParameter($actiondata->params); $mainframe = JFactory::getApplication(); //set the images path $upload_path = $params->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 = str_replace("JOOMLA_PATH", JPATH_SITE, $upload_path).DS; $params->set('upload_path', $upload_path); }else{ $upload_path = JPATH_SITE.DS.'components'.DS.'com_chronoforms'.DS.'uploads'.DS.$form->form_details->name.DS; } $image_file_name = $params->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['Image_Resize'][$actiondata->order]['thumb_big'] = $form->files[$image_file_name][$k]['thumb_big'] = $this->processSize('big', $form, $actiondata, $photo, $filein, $upload_path, $file_info); // treatment of the medium image $form->debug['Image_Resize'][$actiondata->order]['thumb_med'] = $form->files[$image_file_name][$k]['thumb_med'] = $this->processSize('med', $form, $actiondata, $photo, $filein, $upload_path, $file_info); // treatment of the small image $form->debug['Image_Resize'][$actiondata->order]['thumb_small'] = $form->files[$image_file_name][$k]['thumb_small'] = $this->processSize('small', $form, $actiondata, $photo, $filein, $upload_path, $file_info); if($params->get('delete_original')){ unlink($filein); } } if($reset){ $form->files[$image_file_name] = $form->files[$image_file_name][0]; } } } function processSize($size = 'big', $form, $actiondata, $photo, $filein, $upload_path, $file_info){ $params = new JParameter($actiondata->params); $quality = $params->get('quality', 90); $dir = ''; if($params->get($size.'_directory', '')){ $dir .= $params->get($size.'_directory', ''); } else { $dir .= $upload_path; } // add a final slash if needed if(substr($dir, -1) != DS){ $dir .= DS; } $fileout = $dir.$params->get($size.'_image_prefix', '').str_replace('.'.$file_info['extension'], '', $photo).$params->get($size.'_image_suffix', '').'.'.$file_info['extension']; $crop = $params->get($size.'_image_method', 0); $imagethumbsize_w = $params->get($size.'_image_width', 400); $imagethumbsize_h = $params->get($size.'_image_height', 300); $red = $params->get($size.'_image_r', 255); $green = $params->get($size.'_image_g', 255); $blue = $params->get($size.'_image_b', 255); $use = $params->get($size.'_image_use', 0); if($size == 'big'){ $use = true; } if($use){ if($crop){ $this->resizeThenCrop($filein, $fileout, $imagethumbsize_w, $imagethumbsize_h, $red, $green, $blue, $quality); }else{ $this->resize($filein, $fileout, $imagethumbsize_w, $imagethumbsize_h, $red, $green, $blue, $quality); } return $params->get($size.'_image_prefix', '').str_replace('.'.$file_info['extension'], '', $photo).$params->get($size.'_image_suffix', '').'.'.$file_info['extension']; } return null; } function resizeThenCrop( $filein, $fileout, $imagethumbsize_w, $imagethumbsize_h, $red, $green, $blue, $quality ) { // Cacul des nouvelles dimensions list($width, $height) = getimagesize($filein); //$new_width = $width * $percent; //$new_height = $height * $percent; if ( preg_match("/.jpg/i", "$filein") || preg_match("/.jpeg/i", "$filein") ) { $format = 'image/jpeg'; } elseif ( preg_match("/.gif/i", "$filein") ) { $format = 'image/gif'; } else if( preg_match("/.png/i", "$filein") ) { $format = 'image/png'; } switch($format) { case 'image/jpeg': $image = imagecreatefromjpeg($filein); break; case 'image/gif'; $image = imagecreatefromgif($filein); break; case 'image/png': $image = imagecreatefrompng($filein); break; } $width = $imagethumbsize_w ; $height = $imagethumbsize_h ; list($width_orig, $height_orig) = getimagesize($filein); if ( $width_orig < $height_orig ) { $height = ($imagethumbsize_w / $width_orig) * $height_orig; } else { $width = ($imagethumbsize_h / $height_orig) * $width_orig; } if ( $width < $imagethumbsize_w ) { // If the image width is less than the thumbnail $width = $imagethumbsize_w; $height = ($imagethumbsize_w / $width_orig) * $height_orig; } if ( $height < $imagethumbsize_h ) { // If the image height is less than the thumbnail $height = $imagethumbsize_h; $width = ($imagethumbsize_h / $height_orig) * $width_orig; } $thumb = imagecreatetruecolor($width , $height); $bgcolor = imagecolorallocate($thumb, $red, $green, $blue); ImageFilledRectangle($thumb, 0, 0, $width, $height, $bgcolor); imagealphablending($thumb, true); imagecopyresampled($thumb, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig); $thumb2 = imagecreatetruecolor($imagethumbsize_w , $imagethumbsize_h); // true color for better quality $bgcolor = imagecolorallocate($thumb2, $red, $green, $blue); ImageFilledRectangle($thumb2, 0, 0, $imagethumbsize_w, $imagethumbsize_h, $bgcolor); imagealphablending($thumb2, true); $w1 = ($width / 2) - ($imagethumbsize_w / 2); $h1 = ($height / 2) - ($imagethumbsize_h / 2); imagecopyresampled($thumb2, $thumb, 0, 0, $w1, $h1,$imagethumbsize_w, $imagethumbsize_h, $imagethumbsize_w, $imagethumbsize_h); // create the file switch($format) { case 'image/jpeg': imagejpeg($thumb2, $fileout, $quality); break; case 'image/gif'; imagegif($thumb2, $fileout); break; case 'image/png': imagepng($thumb2, $fileout); break; } } function resize( $filein, $fileout, $imagethumbsize_w, $imagethumbsize_h, $red, $green, $blue, $quality ) { // Cacul des nouvelles dimensions list($width_orig, $height_orig) = getimagesize($filein); if ( preg_match("/.jpg/i", "$filein") || preg_match("/.jpeg/i", "$filein") ) { $format = 'image/jpeg'; } if ( preg_match("/.gif/i", "$filein") ) { $format = 'image/gif'; } if ( preg_match("/.png/i", "$filein") ) { $format = 'image/png'; } switch ( $format ) { case 'image/jpeg': $image = imagecreatefromjpeg($filein); break; case 'image/gif'; $image = imagecreatefromgif($filein); break; case 'image/png': $image = imagecreatefrompng($filein); break; } $ratio_orig = $width_orig/$height_orig; if ($imagethumbsize_w/$imagethumbsize_h > $ratio_orig) { $imagethumbsize_w = $imagethumbsize_h*$ratio_orig; } else { $imagethumbsize_h = $imagethumbsize_w/$ratio_orig; } // Redimensionnement $thumb3 = imagecreatetruecolor($imagethumbsize_w, $imagethumbsize_h); $bgcolor = imagecolorallocate($thumb3, $red, $green, $blue); ImageFilledRectangle($thumb3, 0 ,0 ,$imagethumbsize_w, $imagethumbsize_h, $bgcolor); imagealphablending($thumb3, true); imagecopyresampled($thumb3, $image, 0, 0, 0, 0, $imagethumbsize_w, $imagethumbsize_h, $width_orig, $height_orig); switch ( $format ) { case 'image/jpeg': imagejpeg($thumb3, $fileout, $quality); // on cree le fichier break; case 'image/gif'; imagegif($thumb3, $fileout); // on cree le fichier break; case 'image/png': imagepng($thumb3, $fileout); // on cree le fichier break; } } function load($clear){ if($clear){ $action_params = array( 'photo' => '', 'delete_original' => 0, 'quality' => 90, 'big_directory' => '', 'big_image_use' => '1', 'big_image_prefix' => '', 'big_image_suffix' => '_big', 'big_image_height' => '300', 'big_image_width' => '400', 'big_image_r' => '255', 'big_image_g' => '255', 'big_image_b' => '255', 'big_image_method' => '0', 'med_directory' => '', 'med_image_use' => '0', 'med_image_prefix' => '', 'med_image_suffix' => '_med', 'med_image_height' => '300', 'med_image_width' => '400', 'med_image_r' => '255', 'med_image_g' => '255', 'med_image_b' => '255', 'med_image_method' => '0', 'small_image_use' => '0', 'small_directory' => '', 'small_image_prefix' => '', 'small_image_suffix' => '_small', 'small_image_height' => '300', 'small_image_width' => '400', 'small_image_r' => '255', 'small_image_g' => '255', 'small_image_b' => '255', 'small_image_method' => '0' ); } return array('action_params' => $action_params); } } ?>image_resize/.htaccess000066600000000177151374535400011025 0ustar00 Order allow,deny Deny from all image_resize/index.html000066600000000035151374535400011215 0ustar00 image_resize/image_resize.ctp000066600000035415151374535400012405 0ustar00
Image Resize
Header(array('settings' => 'General', 'medium_image' => 'Medium Image', 'small_image' => 'Small Image'), 'image_resize_config_{n}'); ?> tabStart('settings'); ?> input('action_image_resize_{n}_delete_original_config', array('type' => 'select', 'label' => 'Delete Original', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Delete the original image from the upload directory')); ?> input('action_image_resize_{n}_photo_config', array('type' => 'text', 'label' => 'Image field name', 'class' => 'medium_input', 'value' => '')); ?> input('action_image_resize_{n}_quality_config', array('type' => 'text', 'label' => 'Output image(s) quality', 'class' => 'medium_input', 'smalldesc' => 'set the quality of ouput jpg images')); ?> input('action_image_resize_{n}_big_directory_config', array('type' => 'text', 'label' => 'Big image directory', 'class' => 'medium_input', 'smalldesc' => 'Directory where the file will be stored. Don\'t forget the slash at the end ;-) e.g. images/stories/
If you leave this empty it will default to the Form file uploads folder.')); ?> input('action_image_resize_{n}_big_image_prefix_config', array('type' => 'text', 'label' => 'Big image name prefix', 'class' => 'medium_input', 'smalldesc' => 'The prefix for the created image name e.g. big_')); ?> input('action_image_resize_{n}_big_image_suffix_config', array('type' => 'text', 'label' => 'Big image name suffix', 'class' => 'medium_input', 'smalldesc' => 'The suffix for the created image name e.g. _big')); ?> input('action_image_resize_{n}_big_image_height_config', array('type' => 'text', 'label' => 'Big image height', 'class' => 'medium_input', 'value' => '')); ?> input('action_image_resize_{n}_big_image_width_config', array('type' => 'text', 'label' => 'Big image width', 'class' => 'medium_input', 'value' => '')); ?> input('action_image_resize_{n}_big_image_r_config', array('type' => 'text', 'label' => 'Big image R color', 'class' => 'medium_input', 'smalldesc' => 'Alpha channel for png transparency. RGB color of the background.')); ?> input('action_image_resize_{n}_big_image_g_config', array('type' => 'text', 'label' => 'Big image G color', 'class' => 'medium_input', 'smalldesc' => 'Alpha channel for png transparency. RGB color of the background.')); ?> input('action_image_resize_{n}_big_image_b_config', array('type' => 'text', 'label' => 'Big image B color', 'class' => 'medium_input', 'smalldesc' => 'Alpha channel for png transparency. RGB color of the background.')); ?> input('action_image_resize_{n}_big_image_method_config', array('type' => 'select', 'label' => 'Big image processing method', 'options' => array(0 => 'Resize', 1 => 'Resize & Crop'), 'smalldesc' => 'The way your images will be generated (either scale or crop)')); ?> tabEnd(); ?> tabStart('medium_image'); ?> input('action_image_resize_{n}_med_image_use_config', array('type' => 'select', 'label' => 'Enable Medium image', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Should we generate a medium sized image ?')); ?> input('action_image_resize_{n}_med_directory_config', array('type' => 'text', 'label' => 'Medium image directory', 'class' => 'medium_input', 'smalldesc' => 'Directory where the file will be stored. Don\'t forget the slash at the end ;-) e.g. images/stories/
If you leave this empty it will default to the Form file uploads folder.')); ?> input('action_image_resize_{n}_med_image_prefix_config', array('type' => 'text', 'label' => 'Medium image name prefix', 'class' => 'medium_input', 'smalldesc' => 'The prefix for the created image name e.g. med_')); ?> input('action_image_resize_{n}_med_image_suffix_config', array('type' => 'text', 'label' => 'Medium image name suffix', 'class' => 'medium_input', 'smalldesc' => 'The suffix for the created image name e.g. _med')); ?> input('action_image_resize_{n}_med_image_height_config', array('type' => 'text', 'label' => 'Medium image height', 'class' => 'medium_input', 'value' => '')); ?> input('action_image_resize_{n}_med_image_width_config', array('type' => 'text', 'label' => 'Medium image width', 'class' => 'medium_input', 'value' => '')); ?> input('action_image_resize_{n}_med_image_r_config', array('type' => 'text', 'label' => 'Medium image R color', 'class' => 'medium_input', 'smalldesc' => 'Alpha channel for png transparency. RGB color of the background.')); ?> input('action_image_resize_{n}_med_image_g_config', array('type' => 'text', 'label' => 'Medium image G color', 'class' => 'medium_input', 'smalldesc' => 'Alpha channel for png transparency. RGB color of the background.')); ?> input('action_image_resize_{n}_med_image_b_config', array('type' => 'text', 'label' => 'Medium image B color', 'class' => 'medium_input', 'smalldesc' => 'Alpha channel for png transparency. RGB color of the background.')); ?> input('action_image_resize_{n}_med_image_method_config', array('type' => 'select', 'label' => 'Medium image processing method', 'options' => array(0 => 'Resize', 1 => 'Resize & Crop'), 'smalldesc' => 'The way your images will be generated (either scale or crop)')); ?> tabEnd(); ?> tabStart('small_image'); ?> input('action_image_resize_{n}_small_image_use_config', array('type' => 'select', 'label' => 'Enable Small image', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Should we generate a small sized image ?')); ?> input('action_image_resize_{n}_small_directory_config', array('type' => 'text', 'label' => 'Small image directory', 'class' => 'medium_input', 'smalldesc' => 'Directory where the file will be stored. Don\'t forget the slash at the end ;-) e.g. images/stories/
If you leave this empty it will default to the Form file uploads folder.')); ?> input('action_image_resize_{n}_small_image_prefix_config', array('type' => 'text', 'label' => 'Small image name prefix', 'class' => 'medium_input', 'smalldesc' => 'The prefix for the created image name e.g. small_')); ?> input('action_image_resize_{n}_small_image_suffix_config', array('type' => 'text', 'label' => 'Small image name suffix', 'class' => 'medium_input', 'smalldesc' => 'The suffix for the created image name e.g. _small')); ?> input('action_image_resize_{n}_small_image_height_config', array('type' => 'text', 'label' => 'Small image height', 'class' => 'medium_input', 'value' => '')); ?> input('action_image_resize_{n}_small_image_width_config', array('type' => 'text', 'label' => 'Small image width', 'class' => 'medium_input', 'value' => '')); ?> input('action_image_resize_{n}_small_image_r_config', array('type' => 'text', 'label' => 'Small image R color', 'class' => 'medium_input', 'smalldesc' => 'Alpha channel for png transparency. RGB color of the background.')); ?> input('action_image_resize_{n}_small_image_g_config', array('type' => 'text', 'label' => 'Small image G color', 'class' => 'medium_input', 'smalldesc' => 'Alpha channel for png transparency. RGB color of the background.')); ?> input('action_image_resize_{n}_small_image_b_config', array('type' => 'text', 'label' => 'Small image B color', 'class' => 'medium_input', 'smalldesc' => 'Alpha channel for png transparency. RGB color of the background.')); ?> input('action_image_resize_{n}_small_image_method_config', array('type' => 'select', 'label' => 'Small image processing method', 'options' => array(0 => 'Resize', 1 => 'Resize & Crop'), 'smalldesc' => 'The way your images will be generated (either scale or crop)')); ?> tabEnd(); ?>
index.html000066600000000035151374535400006552 0ustar00 check_token/index.html000066600000000035151374535400011027 0ustar00 check_token/check_token.ctp000066600000001373151374535400012025 0ustar00
Check Token
check_token/.htaccess000066600000000177151374535400010637 0ustar00 Order allow,deny Deny from all check_token/check_token.php000066600000001741151374535400012025 0ustar00 'form_security', 'title' => 'Security'); var $events = array('success' => 0, 'fail' => 0); var $details = array('title' => 'Check Token', 'tooltip' => "Checks the form's security token, simple but a bit effecient security check against low level automated SPAM bots."); function run($form, $actiondata){ $params = new JParameter($actiondata->params); if((!JRequest::checkToken())){ $this->events['fail'] = 1; }else{ $this->events['success'] = 1; } } function load($clear){ if($clear){ $action_params = array( ); } return array('action_params' => $action_params); } } ?>session_to_data/.htaccess000066600000000177151374535400011540 0ustar00 Order allow,deny Deny from all session_to_data/session_to_data.ctp000066600000003737151374535400013635 0ustar00
Session To Data
input('action_session_to_data_{n}_namespace_config', array('type' => 'text', 'label' => 'Session Namespace', 'class' => 'medium_input', 'smalldesc' => 'The name space to save this session data at, may be useful if you need to save multiple data instances of the same form without being overwritten, leave empty if you dont know what is this.')); ?> input('action_session_to_data_{n}_key_config', array('type' => 'text', 'label' => 'Session Key', 'class' => 'medium_input', 'smalldesc' => 'Load the data stored under this key, leave empty if you did not enter a key in the Data to Session action, it will use the form name by default.')); ?> input('action_session_to_data_{n}_clear_config', array('type' => 'select', 'label' => 'Clear after', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => "Should this session data get cleared after the load.")); ?>
session_to_data/index.html000066600000000035151374535400011730 0ustar00 session_to_data/session_to_data.php000066600000002612151374535400013625 0ustar00 'data_operations', 'title' => 'Data/DB Operations'); var $details = array('title' => 'Session To Data', 'tooltip' => 'Load the form data array values from session.'); function run($form, $actiondata){ $params = new JParameter($actiondata->params); $mainframe = JFactory::getApplication(); $session = JFactory::getSession(); $session_ns = $params->get('namespace', ''); $session_key = $params->get('key', ''); if(empty($session_key)){ $session_key = $form->form_details->name; } if(empty($session_ns)){ $session_ns = 'default'; } $form->data = array_merge($form->data, $session->get('_chronoform_data_'.$session_key, array(), $session_ns)); //clear the session if the clear option is set to yes if((int)$params->get('clear', 0) == 1){ $session->clear('_chronoform_data_'.$session_key, $session_ns); } } function load($clear){ if($clear){ $action_params = array( 'namespace' => '', 'key' => '', 'clear' => 0 ); } return array('action_params' => $action_params); } } ?>xls_export/index.html000066600000000040151374535400010755 0ustar00 xls_export/.htaccess000066600000000177151374535400010571 0ustar00 Order allow,deny Deny from all xls_export/xls_export.php000066600000010224151374535400011705 0ustar00 'data_export', 'title' => 'Data Export'); var $details = array('title' => 'XLS Export', 'tooltip' => 'Exports the data to XLS sheet (Actually HTML) which is supported by MS Excel.'); function run($form, $actiondata){ $mainframe = JFactory::getApplication(); $session = JFactory::getSession(); $params = new JParameter($actiondata->params); $data_path = trim($params->get('data_path', '')); $data = $form->get_array_value($form->data, explode('.', $data_path)); if(!empty($data) && is_array($data)){ $data = array_values($data); $first_data_record = $data[0]; $list_fields = strlen(trim($params->get('list_fields', ''))) ? explode(',', trim($params->get('list_fields', ''))) : array_keys($first_data_record); $list_headers = strlen(trim($params->get('list_headers', ''))) ? explode(',', trim($params->get('list_headers', ''))) : array_keys($first_data_record); $table_rows = ''; //add headers $table_rows .= ''."\n"; foreach($list_headers as $k => $v){ $table_rows .= ''.$v.''."\n"; } $table_rows .= ''."\n"; //add data rows foreach($data as $record){ $table_rows .= ''."\n"; foreach($record as $k => $v){ if(!in_array($k, $list_fields)){ continue; } $table_rows .= ''.$v.''."\n"; } $table_rows .= ''."\n"; } //finalize table $excel_table = "".$table_rows."
"; if($params->get('save_file', 0) == 1){ $save_path = JPATH_SITE.DS.'components'.DS.'com_chronoforms'.DS.'exports'.DS.$form->form_details->name.DS; jimport('joomla.filesystem.file'); if (!JFile::exists($save_path.'index.html')){ if(!JFolder::create($save_path)){ $form->debug['XLS Export'][] = "Couldn't create save folder: {$save_path}"; JError::raiseWarning(100, "Couldn't create save folder: {$save_path}"); return; } } if((bool)$params->get('add_bom', 0) === true){ $excel_table = "\xEF\xBB\xBF".$excel_table; } $file_name = $params->get('file_name', 'cf_export.xls'); $saved = file_put_contents($save_path.$file_name, $excel_table); if(empty($saved)){ $form->debug['XLS Export'][] = "Couldn't create XLS file"; JError::raiseWarning(100, "Couldn't create XLS file"); return; } if(strlen($params->get('post_file_name', '')) > 0){ $post_file_name = $params->get('post_file_name', ''); $form->data[$post_file_name] = $file_name; $form->files[$post_file_name] = array('name' => $file_name, 'path' => $save_path.$file_name, 'size' => filesize($save_path.$file_name)); //$form->files[$post_file_name]['link'] = $save_url.$file_name; } }else{ //set headers header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header("Content-Type: application/download");; header("Content-Disposition: attachment;filename=".$params->get('file_name', 'cf_export.xls')); header("Content-Transfer-Encoding: binary"); header('Content-Encoding: UTF-8'); //output data if((bool)$params->get('add_bom', 0) === true){ echo "\xEF\xBB\xBF"; } echo $excel_table; $mainframe = JFactory::getApplication(); $mainframe->close(); } } } function load($clear){ if($clear){ $action_params = array( 'content1' => '', 'enabled' => 1, 'data_path' => '', 'list_fields' => '', 'list_headers' => '', 'add_bom' => 0, 'save_file' => 0, 'post_file_name' => '', 'file_name' => 'cf_export.xls', ); } return array('action_params' => $action_params); } } ?>xls_export/xls_export.ctp000066600000010057151374535400011710 0ustar00
XLS Export
Header(array('settings' => 'Settings', 'help' => 'Help'), 'xls_export_config_{n}'); ?> tabStart('settings'); ?> input('action_xls_export_{n}_data_path_config', array('type' => 'text', 'label' => 'Data Path', 'class' => 'medium_input', 'smalldesc' => 'The path to the Data list in the $form->data array, e.g: MODEL_ID')); ?> input('action_xls_export_{n}_list_fields_config', array('type' => 'text', 'label' => 'Fields list', 'class' => 'big_input', 'smalldesc' => 'Comma separated list of fields to be included, no spaces, leave empty and all fields will be added.')); ?> input('action_xls_export_{n}_list_headers_config', array('type' => 'text', 'label' => 'Headers list', 'class' => 'big_input', 'smalldesc' => 'Comma separated list of headers labels to be included, no spaces, leave empty and data list keys will be used.')); ?> input('action_xls_export_{n}_add_bom_config', array('type' => 'select', 'label' => 'Add BOM', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Add the UTF-8 BOM characters to the output ? this helps MS Excel detect the file as UTF-8 if you have any special characters inside.')); ?> input('action_xls_export_{n}_file_name_config', array('type' => 'text', 'label' => 'File Name', 'class' => 'medium_input', 'smalldesc' => 'The export file name.')); ?> input('action_xls_export_{n}_save_file_config', array('type' => 'select', 'label' => 'Save File', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Should we save the file instead of sending it for download ?')); ?> input('action_xls_export_{n}_post_file_name_config', array('type' => 'text', 'label' => 'Post field Name', 'class' => 'medium_input', 'smalldesc' => 'The saved file field name which can be used in the email attachments.')); ?> tabEnd(); ?> tabStart('help'); ?>

  • The action will generate XLS file contains HTML table which is importable by MS Excel (tested on Excel 2003,2007 and 2010).
  • The records list array should be in your $form->data array, using a DB Multi record loader for example.

tabEnd(); ?>
csv_export_gh/index.html000066600000000000151374535400011414 0ustar00csv_export_gh/csv_export_gh.ctp000066600000036672151374535400013031 0ustar00
CSV Export [GH]
Header(array('settings' => 'Settings', 'download' => 'Download', 'mysql' => 'MySQL', 'columns' => 'Columns', 'help' => 'Help'), 'csv_export_gh_config_{n}'); echo $PluginTabsHelper->tabStart('settings'); $database = JFactory::getDBO(); $tables = $database->getTableList(); $options = array(); foreach($tables as $table){ $options[$table] = $table; } echo $HtmlHelper->input('action_csv_export_gh_{n}_table_name_config', array( 'type' => 'select', 'label' => 'Table', 'options' => $options, 'empty' => " - ", 'class' => 'medium_input', 'smalldesc' => 'The table to be used for the export.' ) ); echo $HtmlHelper->input('action_csv_export_gh_{n}_data_path_config', array( 'type' => 'text', 'label' => "Data path", 'class' => 'medium_input', 'value' => '', 'smalldesc' => 'The path to the data list in the form->data array, use this if you already have the data in your form data array through a DBMRL action for example. e.g. MODEL_ID' )); echo $HtmlHelper->input('action_csv_export_gh_{n}_save_path_config', array( 'type' => 'text', 'label' => "Save path", 'class' => 'big_input', 'value' => '', 'smalldesc' => 'The path to the folder where the csv file will be saved e.g. '.JPATH_SITE.DS.'components'.DS.'com_chronocontact'.DS.'exports'.DS )); echo $HtmlHelper->input('action_csv_export_gh_{n}_file_name_config', array( 'type' => 'text', 'label' => "File name", 'class' => 'big_input', 'value' => '', 'smalldesc' => 'The name of the csv file. You may include valid input values as {input_name}' )); echo $HtmlHelper->input('action_csv_export_gh_{n}_post_file_name_config', array( 'type' => 'text', 'label' => "Post File name", 'class' => 'medium_input', 'value' => '', 'smalldesc' => 'The name of the post data/files arrays key under which the CSV file data will exist (in case the file is saved to the server)' )); echo $HtmlHelper->input('action_csv_export_gh_{n}_delimiter_config', array( 'type' => 'text', 'label' => "Delimiter", 'class' => 'small_input', 'value' => '', 'smalldesc' => 'The delimiter to be used for the CSV file, a single character only, defaults to comma ,. Use ##tab## for a tab character.' )); echo $HtmlHelper->input('action_csv_export_gh_{n}_enclosure_config', array( 'type' => 'text', 'label' => "Enclosure", 'class' => 'small_input', 'value' => '', 'smalldesc' => 'The enclosure to be used for the CSV file, a single character only, defaults to double quote "' )); echo $PluginTabsHelper->tabEnd(); echo $PluginTabsHelper->tabStart('download'); echo $HtmlHelper->input('action_csv_export_gh_{n}_download_export_config', array( 'type' => 'checkbox', 'label' => 'Immediate download', 'class' => 'checkbox', 'value' => '1', 'rule' => 'bool', 'smalldesc' => 'If you check this box then the file will be downloaded immediately and your form or thank you page will not be displayed.' ) ); echo $HtmlHelper->input('action_csv_export_gh_{n}_download_nosave_config', array( 'type' => 'checkbox', 'label' => 'Do not save the file on the server', 'class' => 'checkbox', 'value' => '1', 'rule' => "bool", 'smalldesc' => 'If you check this box then the file will be created in the server memory and downloaded immediately.' ) ); echo $HtmlHelper->input('action_csv_export_gh_{n}_download_mime_type_config', array( 'type' => 'checkbox', 'label' => 'Set mime type to \'octet\'', 'class' => 'checkbox', 'value' => '1', 'rule' => 'bool', 'smalldesc' => 'If you check this box then the file type will be set to \'application/octet-stream\' instead of \'text/csv\'.' ) ); echo $PluginTabsHelper->tabEnd(); echo $PluginTabsHelper->tabStart('mysql'); echo $HtmlHelper->input('action_csv_export_gh_{n}_where_config', array( 'type' => 'text', 'label' => "MySQL WHERE clause", 'class' => 'big_input', 'value' => '', 'smalldesc' => 'A valid MySQL WHERE clause to filter the results.' )); echo $HtmlHelper->input('action_csv_export_gh_{n}_order_by_config', array( 'type' => 'text', 'label' => "MySQL ORDER BY clause", 'class' => 'big_input', 'value' => '', 'smalldesc' => 'A valid MySQL ORDER BY clause to sort the results.' )); echo $PluginTabsHelper->tabEnd(); echo $PluginTabsHelper->tabStart('columns'); echo $HtmlHelper->input('action_csv_export_gh_{n}_include_config', array( 'type' => 'text', 'label' => "Include columns", 'class' => 'big_input', 'value' => '', 'smalldesc' => 'You can enter a comma separated list of column names to be exported' )); echo $HtmlHelper->input('action_csv_export_gh_{n}_exclude_config', array( 'type' => 'text', 'label' => "Exclude columns", 'class' => 'big_input', 'value' => '', 'smalldesc' => 'You can enter a comma separated list of column names *not* to be exported' )); echo $HtmlHelper->input('action_csv_export_gh_{n}_add_titles_config', array( 'type' => 'checkbox', 'label' => 'Add Titles', 'class' => 'checkbox', 'value' => '1', 'rule' => 'bool', 'smalldesc' => 'If you check this box then the titles will be added to the first row in the output file.' ) ); echo $HtmlHelper->input('action_csv_export_gh_{n}_content1_config', array( 'type' => 'textarea', 'label' => "Column details", 'rows' => 20, 'cols' => 70, 'smalldesc' => 'For each database column to be exported add a new row using Column Title=column_name e.g. ID=id or User Name=name or Visible From=created_date. If you make any entry here then only columns included here will be exported; any \included\' or \'excluded\' entries above will be ignored.' )); echo $PluginTabsHelper->tabEnd(); echo $PluginTabsHelper->tabStart('help'); $style = " div.tabs-panel { font-size: 100%; } div.tabs-panel tt{ font-size: 120%; } "; $doc = JFactory::getDocument(); $doc->addStyleDeclaration($style); ?>
This action helps you export some or all of the entries from a database table into a CSV file that can be downloaded and used for other purposes.

Settings

  • Select the Database table that you want to export data from. This is the only required input in the configuration.
  • Enter a valid full path to the folder where the csv file should be saved. You may use form inputs e.g. {input_name} in the path*.
    Defaults to
  • Enter a name for the file to be saved. You may use form inputs e.g. {input_name} in the file name*. The file suffix will be .csv, if this isn't set here it will be added after any existing suffix.
    Defaults to csv_export_{$table_name}_{datetime}.csv
  • You can set values for the path or file name by creating file inputs with appropriate values. If {form_path} or {file_name} are set before this action in the form data or in a Custom Code action those values will replace any entries here.
  • You can set a delimiter that will be placed between each value in a row. The default is a comma value1,value2. Use ##tab## for a tab delimited file.
  • You can set an enclosure character that will be used to enclose individual values where necessary. The default is a double quote "value 1".

Downloads

  • The checkboxes on this tab allow you to control the way your file is downloaded.
  • If you leave them all un-checked then the file will be saved to the server and you can use the entries added to the $form_>data array to display or email a download link or to leave the file for future reference.
  • If you check the 'Immediate download' then the form will be downloaded when the either the form (if the action is in the On Load event) or the Thank You page loads. The file is still saved to the server but the download will act as a 'Show stopper' and no further actions will run.
  • If you check the 'No Save' checkbox then the form will be downloaded when the either the form (if the action is in the On Load event) or the Thank You page loads. The file is not saved to the server. In this case the file is created in memory if it is less than 5Mb,or in a temporary file if it is larger than this. This may be useful if you do not want to save the files, or if you have limited permission on the server.
  • If you check the 'Set mimtype to 'octet'' checkbox then the form will be downloaded with a type of 'application/octet-stream' instead of 'text/csv'. This may be useful if you want to prevent the file diplaying in the browser.

MySQL

This tab allows you to specify the records to be exported and the order of the export. Both use standard MySQL syntax.
  • The MySQL WHERE clause will take a valid WHERE clause to filter the result to be exported e.g. `id` < 25 The word WHERE is optional.
  • The MySQL ORDER BY clause will take a valid ORDER BY clause to sort the results to be exported e.g. `id` DESC The words ORDER BY are optional.
Paths and file names can include the special {table_name}, {datetime} and {rand} values. The value {datetime} inserts string in the form 'YmdHi' e.g. 201105101543; {rand} inserts a six digit random number e.g. 857943.

Columns

This tab offers two different ways to specify the columns to be exported. You may leave all the boxes empty in which case all the columns will be exported in the order they appear in the table and the column names will be shown in the first row of the exported file.
  • In the Include Columns box you can enter a comma separated list of columns to be included. If there is an entry here only these columns will be exported, and the order of columns will be the order of this list.
  • In the Exclude Columns box you can enter a comma separated list of columns to be excluded. If the Include Columns box is empty all columns except these will be exported. If there are entries in the Included Columns box then any columns shown here will be removed from that list.
  • The column Details box overrides the Included and Excluded lists; if there are any entries here then they will be ignored. You can enter any number of rows here each of which specifies one column to be exported. Each row takes the form Column Title=column_name. The Column Title will be shown in the first row of the exported file and the columns will be exported in the order that they are shown here. You can also add valid MySQL clauses in the place of the column_name e.g. Column Title=`value` + 7. If a row has no = character then the entry will be used for both the Column Title and the Column Name e.g. Languages.
    Note: take care with these entries, they are very flexible but are not verified and mistakes may break the export.

Results

The Action generates several outputs: a file saved to the server in the specified folder; and three new form data items {csv_link}, {csv_count} and {csv_size}. These give you a full URL for the new file and the number of records exported. You can use these in later actions like Emails or Thank You messages to allow access to the file.
You can use the success (or fail) events to do whatever you need after the response is processed.
tabEnd(); ?>
csv_export_gh/csv_export_gh.php000066600000027172151374535400013025 0ustar00 'data_export', 'title' => 'Data Export'); var $events = array('success' => 0, 'fail' => 0); var $details = array('title' => 'CSV Export [GH]', 'tooltip' => 'Exports selected records from a table to a CSV file'); function load($clear) { if ( $clear ) { $action_params = array( 'table_name' => '', 'include' => '', 'exclude' => '', 'save_path' => '', 'file_name' => '', 'delimiter' => '', 'enclosure' => '', 'download_mime_type' => '', 'download_export' => '', 'download_nosave' => '', 'where' => '', 'data_path' => '', 'add_titles' => 1, 'post_file_name' => '', 'order_by' => '', 'content1' => '' ); } return array('action_params' => $action_params); } function run($form, $actiondata) { $mainframe = JFactory::getApplication(); $params = new JParameter($actiondata->params); $user = JFactory::getUser(); jimport('joomla.filesystem.file'); $variables = array( 'table_name', 'include', 'exclude', 'save_path', 'file_name', 'delimiter', 'enclosure', 'download_export', 'download_mime_type', 'download_nosave', 'where', 'order_by' ); foreach ( $variables as $v ) { $$v = trim($params->get($v)); // Allow over-ride from form data for registered users if ( $user->id ) { if ( isset($form->data[$v]) && $form->data[$v] ) { $$v = $form->data[$v]; } } } $form->debug['CSV Export'][] = '$download_export: '.print_r($download_export, true); $form->debug['CSV Export'][] = '$download_nosave: '.print_r($download_nosave, true); $columns = $actiondata->content1; $columns = $this->paramsToArray($columns, 'Columns'); $curly_array = array( 'form_name' => $form->form_details->name, 'table_name' => $table_name, 'random' => rand(111111, 999999), 'datetime' => date('YmdHi') ); if ( $download_nosave ) { $form->debug['CSV Export'][] = 'Download \'No Save\' is set so no folder is created.'; } else { if ( $save_path ) { $save_path = $form->curly_replacer($save_path, array_merge($form->data, $curly_array)); $save_path = str_replace(array("/", "\\"), DS, $save_path).DS; $save_path = str_replace(DS.DS, DS, $save_path); } else { $save_path = JPATH_SITE.DS.'components'.DS.'com_chronoforms'.DS.'exports'.DS.$form->form_details->name.DS; } if ( !JFile::exists($save_path.'index.html') ) { if (!JFolder::create($save_path) ) { $form->debug['CSV Export'][] = "Couldn't create save folder: {$save_path}"; JError::raiseWarning(100, "Couldn't create save folder: {$save_path}"); $this->events['fail'] = 1; return; } } $form->debug['CSV Export'][] = 'Save folder is:
'.$save_path; $form->debug['CSV Export'][] = '$download_export: xxx'; $form->debug['CSV Export'][] = '$download_export: '.print_r($download_export, true); $buffer = ""; if ( !JFile::write($save_path.'index.html', $buffer) ) { $form->debug['CSV Export'][] = "Couldn't write to save folder: {$save_path}"; JError::raiseWarning(100, "Couldn't write to save folder: {$save_path}"); $this->events['fail'] = 1; return; } } if ( $file_name ) { $file_name = $form->curly_replacer($file_name, array_merge($form->data, $curly_array)); } else { $file_name = "csv_export_{$table_name}_".date('YmdHi').".csv"; } if ( JFile::getExt($file_name) != 'csv' || JFile::getExt($file_name) == $file_name ) { $file_name .= '.csv'; } $form->debug['CSV Export'][] = 'File name is:
'.$file_name; // get the data to export $db = JFactory::getDBO(); $titles = array(); if(strlen(trim($params->get('data_path', ''))) == 0){ $fields_array = $db->getTableFields($table_name); $fields_array = array_keys($fields_array[$table_name]); if ( is_array($columns) && count($columns) ) { $include = array(); foreach ( $columns as $k => $v ) { $titles[] = $k; $include[] = $v; } $include = implode(', ', $include); $exclude = array(); } else { if ( $exclude ) { $exclude = explode(',', $exclude); foreach ( $exclude as $k => $v ) { $exclude[$k] = trim($v); } } else { $exclude = array(); } if ( $include ) { $include = explode(',', $include); // check the columns and drop any that are 'excluded' // or are not in the table columns list. foreach ( $include as $k => $v ) { $v = trim($v); if ( in_array($v, $exclude) || !in_array($v, $fields_array) ) { unset($include[$k]); continue; } $include[$k] = $db->nameQuote(trim($v)); } $include = implode(', ', $include); $exclude = array(); } elseif ( count($exclude) ) { $include = array(); foreach ( $fields_array as $k => $v ) { if ( !in_array($v, $exclude) ) { $include[] = $db->nameQuote(trim($v)); } } $include = implode(', ', $include); } else { $include = '*'; } } if ( $where ) { // strip off anything after a ; $sc_found = strpos($where, ';'); if ( $sc_found ) { $where = substr($where, 0, $sc_found); } // clean up WHERE $where = str_ireplace('where ', '', $where); $where = 'WHERE '.$where; } if ( $order_by ) { // strip off anything after a ; $sc_found = strpos($order_by, ';'); if ( $sc_found ) { $order_by = substr($order_by, 0, $sc_found); } // clean up ORDER BY $order_by = str_ireplace("ORDER BY ", '', $order_by); $order_by = 'ORDER BY '.$order_by; } $query = " SELECT {$include} FROM `{$table_name}` {$where} {$order_by}; "; $form->debug['CSV Export'][] = '$query: '.print_r($query, true); } $data = array(); if(trim($params->get('data_path', ''))){ $data_found = $form->get_array_value($form->data, explode('.', trim($params->get('data_path', '')))); if(!empty($data_found) && is_array($data_found)){ //check if this is an indexed array if($data_found === array_values($data_found)){ $data = $data_found; } } }else{ $db->setQuery($query); $data = $db->loadAssocList(); } if ( !count($data) ) { $this->events['fail'] = 1; $form->validation_errors['CSV Export'] = 'No records were found to export.'; return; } $form->debug['CSV Export'][] = count($data).' records were found to export.'; // drop excluded columns if all were selected if ( !count($columns) && is_array($exclude) && count($exclude) ) { $exclude = array_flip($exclude); foreach ( $data as $k => $v ) { $data[$k] = array_diff_key($data[$k], $exclude); } } if ( $delimiter == '##tab##' ) { $delimiter = chr(9); } elseif ( $delimiter == '##squote##' ) { $delimiter = chr(39); } elseif ( $delimiter ) { $delimiter = substr($delimiter, 0, 1); } else { $delimiter = ','; } if ( $enclosure ) { $enclosure = substr($enclosure, 0, 1); } else { $enclosure = '"'; } // Build titles array if ( !count($titles) ) { $titles = array_keys($data[0]); } $output = ''; if ( $download_nosave ) { // output up to 5MB is kept in memory, if it becomes bigger // it will automatically be written to a temporary file $csv = fopen('php://temp/maxmemory:'. (5*1024*1024), 'r+'); if((bool)$params->get('add_titles', 1) === true){ fputcsv($csv, $titles); } foreach ( $data as $d ) { fputcsv($csv, $d, $delimiter, $enclosure); } rewind($csv); // put it all in a variable $output = stream_get_contents($csv); $filesize = strlen($output); } else { // Open file for writing $file = fopen($save_path.$file_name, 'w'); if ( $file === false ) { $form->validation_errors['CSV Export'] = 'Unable to open the file.'; return; } if((bool)$params->get('add_titles', 1) === true){ fputcsv($file, $titles); } // add data rows to the file foreach ( $data as $d ) { fputcsv($file, $d, $delimiter, $enclosure); } fclose($file); // Get file URL and save to the form data $save_url = str_replace(JPATH_SITE.DS, JURI::root(), $save_path); $save_url = str_replace(DS, '/', $save_url); $form->debug['CSV Export'][] = 'Save link is:
'.$save_url.$file_name; $form->data['csv_link'] = $save_url.$file_name; $form->data['csv_count'] = count($data); $filesize = filesize($save_path.$file_name); $form->data['csv_size'] = $filesize/1000; if ( $form->data['csv_size'] > 0 && $form->data['csv_size'] < 1 ) { $form->data['csv_size'] = number_format($form->data['csv_size'], 1); } else { $form->data['csv_size'] = number_format($form->data['csv_size'], 0); } //add details under the post file name if(!$download_nosave && (strlen(trim($params->get('post_file_name', ''))) > 0)){ $post_file_name = $params->get('post_file_name', ''); $form->data[$post_file_name] = $file_name; $form->files[$post_file_name] = array('name' => $file_name, 'path' => $save_path.$file_name, 'size' => $form->data['csv_size']); $form->files[$post_file_name]['link'] = $save_url.$file_name; } $form->debug['CSV Export'][] = 'File size is: '.$form->data['csv_size'].' kb'; } if ( $download_export || $download_nosave ) { // if Immediate download is checked jimport('joomla.environment.browser'); $browser = JBrowser::getInstance(); switch ($browser->getBrowser() ) { case 'msie': $inline = 'inline'; $pragma = 'public'; break; default: $inline = 'attachment'; $pragma = 'no-cache'; break; } $mimetype = 'text/csv'; if ( $download_mime_type ) { switch ($browser->getBrowser() ) { case 'msie': $mimetype = 'application/octetstream'; case 'opera': $mimetype = 'application/octetstream'; break; default: $mimetype = 'application/octet-stream'; break; } } @ob_end_clean(); ob_start(); header("Content-Type: {$mimetype}; charset=UTF-8"); header('Expires: '.gmdate('D, d M Y H:i:s').' GMT'); header("Content-Disposition: {$inline}; filename={$file_name}"); header("Content-Length: ".$filesize); if ( $browser->getBrowser() == 'msie' ) { header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); } header("Pragma: {$pragma}"); ob_clean(); flush(); if ( $download_nosave ) { print($output); } else { readfile($save_path.$file_name); } exit(); } } function paramsToArray($params='', $name='Parameter') { if ( !$params ) { return false; } $list = explode("\n", trim($params)); $return = array(); foreach ( $list as $item ) { $item = trim($item); if ( !$item ) { $form->debug['Export CSV [GH]'][] = "Empty string found in the {$name} box"; continue; } $fields_data = explode("=", $item, 2); if ( !isset($fields_data[1]) || !$fields_data[1] ) { $fields_data[1] = $fields_data[0]; } $param = trim($fields_data[0]); $value = trim($fields_data[1]); $return[$param] = $value; } return $return; } } ?>csv_export_gh/.htaccess000066600000000177151374535400011234 0ustar00 Order allow,deny Deny from all joomla_registration/joomla_registration.ctp000066600000022133151374535400015416 0ustar00
Joomla User Registration
Header(array('fields' => 'Fields', 'settings' => 'Settings', 'cb' => 'CB', 'help' => 'Help'), 'joomla_registration_config_{n}'); ?> tabStart('fields'); ?> input('action_joomla_registration_{n}_name_config', array('type' => 'text', 'label' => 'Name field name', 'class' => 'medium_input', 'smalldesc' => 'The name of the field which is going to hold the Name data')); ?> input('action_joomla_registration_{n}_username_config', array('type' => 'text', 'label' => 'Username field name', 'class' => 'medium_input', 'smalldesc' => 'The name of the field which is going to hold the Username data')); ?> input('action_joomla_registration_{n}_email_config', array('type' => 'text', 'label' => 'Email field name', 'class' => 'medium_input', 'smalldesc' => 'The name of the field which is going to hold the Email data')); ?> input('action_joomla_registration_{n}_password_config', array('type' => 'text', 'label' => 'Password field name', 'class' => 'medium_input', 'smalldesc' => 'The name of the field which is going to hold the Password data')); ?> input('action_joomla_registration_{n}_password2_config', array('type' => 'text', 'label' => 'Verify Password field name', 'class' => 'medium_input', 'smalldesc' => 'The name of the field which is going to hold the Verify Password data')); ?> tabEnd(); ?> tabStart('settings'); ?> input('action_joomla_registration_{n}_override_allow_user_registration_config', array('type' => 'select', 'label' => 'Override the Joomla Allow user registration', 'label_over' => true, 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Its advised that you disable the Joomla allow user registration setting and enable this one so that users are forced to register here.')); ?> setQuery($query); $options = array(); $groups = $database->loadObjectList(); foreach($groups as $group){ $options[$group->id] = $group->title; } ?> input('action_joomla_registration_{n}_new_usertype_config', array('type' => 'select', 'label' => 'Usertype', 'options' => $options, 'size' => 6, 'multiple' => 'multiple', 'rule' => "split", 'splitter' => ",", 'smalldesc' => 'The new user type/group.')); ?> input('action_joomla_registration_{n}_useractivation_config', array('type' => 'select', 'label' => 'User activation', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Should the user require activation ?')); ?> input('action_joomla_registration_{n}_send_joo_activation_config', array('type' => 'select', 'label' => 'Send activation', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => "Send Joomla's activation email after registration ?")); ?> input('action_joomla_registration_{n}_activation_link_config', array('type' => 'text', 'label' => 'Activation Link', 'class' => 'big_input', 'smalldesc' => 'Use this ONLY if your "Allow User Registration" is set to "NO" in the Joomla Users Manager, add a link to a form event with the "Joomla User Activation" action.')); ?> input('action_joomla_registration_{n}_random_password_config', array('type' => 'select', 'label' => 'Random Password', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Generate Random password for the user ? if yes then you do not have to supply password/verify password fields.')); ?> input('action_joomla_registration_{n}_auto_login_config', array('type' => 'select', 'label' => 'Auto Login', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Auto Login the user after registration ?')); ?> input('action_joomla_registration_{n}_display_reg_complete_config', array('type' => 'select', 'label' => 'Display status', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Display the Joomla registration status message after successfull one ?')); ?> input('action_joomla_registration_{n}_user_data_path_config', array('type' => 'text', 'label' => 'User Data Path', 'class' => 'medium_input', 'smalldesc' => 'The data array path under which the created user data will be set.')); ?> tabEnd(); ?> tabStart('cb'); ?> input('action_joomla_registration_{n}_enable_cb_support_config', array('type' => 'select', 'label' => 'Enable CB Support', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Enable Community Builder support, this will save the data to community builder table, your form fields names should match the CB fields names definded for registration.')); ?> tabEnd(); ?> tabStart('help'); ?>

  • Assign your form field's names to the required fields names under the "Fields" tab.
  • Configure the settings under the "Settings" tab.

tabEnd(); ?>
joomla_registration/.htaccess000066600000000177151374535400012435 0ustar00 Order allow,deny Deny from all joomla_registration/joomla_registration.php000066600000026534151374535400015430 0ustar00 'joomla_functions', 'title' => 'Joomla Functions'); var $events = array('success' => 0, 'fail' => 0); var $details = array('title' => 'Joomla Registration', 'tooltip' => 'Replace your Joomla frontend registration feature using this action.'); var $params = null; function run($form, $actiondata){ $this->params = $params = new JParameter($actiondata->params); $mainframe = JFactory::getApplication(); //set activation link if(trim($this->params->get('activation_link', '')) == ''){ $this->params->set('activation_link', 'index.php?option=com_users&task=registration.activate'); } // 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_users'); // If user registration is not allowed, show 403 not authorized. $usersConfig = &JComponentHelper::getParams( 'com_users' ); if($usersConfig->get('allowUserRegistration') == '0' && !$params->get('override_allow_user_registration', 0)){ JError::raiseError( 403, JText::_( 'Access Forbidden' )); return; } // Initialize new usertype setting $userConfig = JComponentHelper::getParams('com_users'); // Default to Registered. $defaultUserGroup = $params->get('new_usertype', ''); if(empty($defaultUserGroup)){ $defaultUserGroup = $userConfig->get('new_usertype', array(2)); }else{ $_groups = explode(",", trim($defaultUserGroup)); $defaultUserGroup = array(); foreach($_groups as $_group){ $defaultUserGroup[] = (int)$_group; } } //set the post fields values $form->data['name'] = $form->data($params->get('name', ''), ''); $form->data['username'] = $form->data($params->get('username', ''), ''); $form->data['email'] = $form->data($params->get('email', ''), ''); $form->data['password'] = $form->data($params->get('password', ''), ''); $form->data['password2'] = $form->data($params->get('password2', ''), ''); //generate the random pass if enabled if((int)$params->get('random_password', 0) == 1){ jimport('joomla.user.helper'); $random_pass = JUserHelper::genRandomPassword(); $form->data['password'] = $random_pass; $form->data['password2'] = $random_pass; } //check empty fields $checks = array('name', 'username', 'email', 'password'); foreach($checks as $check){ if(!trim($form->data[$check])){ $this->events['fail'] = 1; $form->validation_errors[$params->get($check)] = 'You must provide your '.$check.'.'; //return false; } } if($this->events['fail'] == 1){ return false; } //check the 2 passwords if($form->data['password'] != $form->data['password2']){ $this->events['fail'] = 1; $form->validation_errors[$params->get('password2')] = 'Passwords do NOT match.'; $form->debug[] = "Couldn't create new user, Passwords do NOT match."; return false; } // Bind the post array to the user object $post_data = $form->data; if(!$user->bind($post_data, 'usertype')){ //JError::raiseError( 500, $user->getError()); $this->events['fail'] = 1; $form->validation_errors[] = $user->getError(); $form->debug[] = "Couldn't bind new user, Joomla returned this error : ".$user->getError(); return false; } // Set some initial user values $user->set('id', 0); $user->set('usertype', 'deprecated'); $user->set('groups', $defaultUserGroup); $date = JFactory::getDate(); $user->set('registerDate', $date->toMySQL()); // If user activation is turned on, we need to set the activation information $useractivation = $params->get('useractivation', $usersConfig->get('useractivation')); if (($useractivation == 1) || ($useractivation == 2)) { 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()){ /*JError::raiseWarning('', JText::_( $user->getError())); $this->register();*/ $this->events['fail'] = 1; $form->validation_errors[] = $user->getError(); $form->debug[] = "Couldn't save new user, Joomla returned this error : ".$user->getError(); return false; }else{ $this->events['success'] = 1; } //store user data $user_data = (array)$user; $removes = array('params', '_params', 'guest', '_errorMsg', '_errors'); foreach($removes as $remove){ unset($user_data[$remove]); } $form->data['_PLUGINS_']['joomla_registration'] = $user_data; //inject user data under the correct data path if(strlen(trim($params->get('user_data_path', ''))) > 0){ $form->data = $form->set_array_value($form->data, explode('.', trim($params->get('user_data_path', ''))), $user_data); } //CB support if((bool)$params->get('enable_cb_support', 0) === true){ /********************CB part*************************/ $database = JFactory::getDBO(); $database->setQuery( "SELECT * FROM #__comprofiler_fields WHERE `table`='#__comprofiler' AND name <>'NA' AND registration = '1'" ); $fields = $database->loadObjectList(); $default_fields_names = array('id', 'user_id'); $default_fields_values = array($user_data['id'], $user_data['id']); foreach($fields as $field){ $default_fields_names[] = $field->name; $fieldname = $field->name; $default_fields_values[] = $form->data[$fieldname]; } $database->setQuery( "INSERT INTO #__comprofiler (".implode(",", $default_fields_names).") VALUES ('".implode("','", $form->escapeVar($default_fields_values))."');" ); if (!$database->query()) { JError::raiseWarning(100, $database->getErrorMsg()); } /**********************************************/ } // Send registration confirmation mail $password = $form->data['password'];//JRequest::getString('password', '', 'post', JREQUEST_ALLOWRAW); $password = preg_replace('/[\x00-\x1F\x7F]/', '', $password); //Disallow control chars in the email if((int)$params->get('send_joo_activation', 0) == 1){ $this->_sendMail($user, $password); } // Everything went fine, set relevant message depending upon user activation state and display message if((int)$useractivation == 2){ $message = JText::_('COM_USERS_REGISTRATION_COMPLETE_VERIFY'); }else if((int)$useractivation == 1){ $message = JText::_('COM_USERS_REGISTRATION_COMPLETE_ACTIVATE'); }else{ $message = JText::_('COM_USERS_REGISTRATION_SAVE_SUCCESS'); } if($params->get('display_reg_complete', 0) == 1){ echo $message; } if((int)$params->get('auto_login', 0) == 1){ $credentials = array(); $credentials['username'] = $form->data['username']; $credentials['password'] = $form->data['password']; $mainframe->login($credentials); } } function _sendMail(&$user, $password) { $mainframe = JFactory::getApplication(); $db = JFactory::getDBO(); $name = $user->get('name'); $email = $user->get('email'); $username = $user->get('username'); $usersConfig = &JComponentHelper::getParams( 'com_users' ); $sitename = $mainframe->getCfg( 'sitename' ); $useractivation = $usersConfig->get( 'useractivation' ); $mailfrom = $mainframe->getCfg( 'mailfrom' ); $fromname = $mainframe->getCfg( 'fromname' ); $siteURL = JURI::base(); $config = JFactory::getConfig(); // Compile the notification mail values. $data = $user->getProperties(); $data['fromname'] = $config->get('fromname'); $data['mailfrom'] = $config->get('mailfrom'); $data['sitename'] = $config->get('sitename'); $data['siteurl'] = JUri::base(); // Handle account activation/confirmation emails. if ($useractivation == 2) { // Set the link to confirm the user email. $uri = JURI::getInstance(); $base = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port')); $data['activate'] = $base.JRoute::_(trim($this->params->get('activation_link', '')).'&token='.$data['activation'], false); $emailSubject = JText::sprintf( 'COM_USERS_EMAIL_ACCOUNT_DETAILS', $data['name'], $data['sitename'] ); $emailBody = JText::sprintf( 'COM_USERS_EMAIL_REGISTERED_WITH_ADMIN_ACTIVATION_BODY', $data['name'], $data['sitename'], $data['siteurl'].trim($this->params->get('activation_link', '')).'&token='.$data['activation'], $data['siteurl'], $data['username'], $data['password_clear'] ); } else if ($useractivation == 1) { // Set the link to activate the user account. $uri = JURI::getInstance(); $base = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port')); $data['activate'] = $base.JRoute::_(trim($this->params->get('activation_link', '')).'&token='.$data['activation'], false); $emailSubject = JText::sprintf( 'COM_USERS_EMAIL_ACCOUNT_DETAILS', $data['name'], $data['sitename'] ); $emailBody = JText::sprintf( 'COM_USERS_EMAIL_REGISTERED_WITH_ACTIVATION_BODY', $data['name'], $data['sitename'], $data['siteurl'].trim($this->params->get('activation_link', '')).'&token='.$data['activation'], $data['siteurl'], $data['username'], $data['password_clear'] ); } else { $emailSubject = JText::sprintf( 'COM_USERS_EMAIL_ACCOUNT_DETAILS', $data['name'], $data['sitename'] ); $emailBody = JText::sprintf( 'COM_USERS_EMAIL_REGISTERED_BODY', $data['name'], $data['sitename'], $data['siteurl'] ); } // Send the registration email. $return = JUtility::sendMail($data['mailfrom'], $data['fromname'], $data['email'], $emailSubject, $emailBody); // Check for an error. if ($return !== true) { JError::raiseNotice(100, JText::_('COM_USERS_REGISTRATION_SEND_MAIL_FAILED')); // Send a system message to administrators receiving system mails $db = JFactory::getDBO(); $q = "SELECT id FROM #__users WHERE block = 0 AND sendEmail = 1"; $db->setQuery($q); $sendEmail = $db->loadResultArray(); if (count($sendEmail) > 0) { $jdate = new JDate(); // Build the query to add the messages $q = "INSERT INTO `#__messages` (`user_id_from`, `user_id_to`, `date_time`, `subject`, `message`) VALUES "; $messages = array(); foreach ($sendEmail as $userid) { $messages[] = "(".$userid.", ".$userid.", '".$jdate->toMySQL()."', '".JText::_('COM_USERS_MAIL_SEND_FAILURE_SUBJECT')."', '".JText::sprintf('COM_USERS_MAIL_SEND_FAILURE_BODY', $return, $data['username'])."')"; } $q .= implode(',', $messages); $db->setQuery($q); $db->query(); } return false; } } function load($clear){ if($clear){ $action_params = array( 'content1' => '', 'name' => '', 'username' => '', 'email' => '', 'password' => '', 'password2' => '', 'override_allow_user_registration' => 1, 'new_usertype' => 'Registered', 'useractivation' => 1, 'activation_link' => '', 'random_password' => 0, 'auto_login' => 0, 'send_joo_activation' => 0, 'enable_cb_support' => 0, 'user_data_path' => '', 'display_reg_complete' => 0 ); } return array('action_params' => $action_params); } } ?>joomla_registration/index.html000066600000000035151374535400012625 0ustar00 data_to_session/.htaccess000066600000000177151374535400011540 0ustar00 Order allow,deny Deny from all data_to_session/index.html000066600000000035151374535400011730 0ustar00 data_to_session/data_to_session.ctp000066600000004034151374535400013624 0ustar00
Data To Session
input('action_data_to_session_{n}_namespace_config', array('type' => 'text', 'label' => 'Session Namespace', 'class' => 'medium_input', 'smalldesc' => 'The name space to load this session data from, may be useful if you have multiple data instances of the same form loaded in different session namespaces, leave empty if you dont know what is this.')); ?> input('action_data_to_session_{n}_key_config', array('type' => 'text', 'label' => 'Session Key', 'class' => 'medium_input', 'smalldesc' => 'Leave empty to set the key using the form name, but if you want to exchange data between multiple forms then you will need to set this to some constant.')); ?> input('action_data_to_session_{n}_merge_config', array('type' => 'select', 'label' => 'Merge data', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Merge similar key data if the same key was found at the session ? if no then data will be overwritten.')); ?>
data_to_session/data_to_session.php000066600000003156151374535400013631 0ustar00 'data_operations', 'title' => 'Data/DB Operations'); var $details = array('title' => 'Data To Session', 'tooltip' => 'Save form data array into session.'); function run($form, $actiondata){ $params = new JParameter($actiondata->params); $mainframe = JFactory::getApplication(); $session = JFactory::getSession(); $session_ns = $params->get('namespace', ''); $session_key = $params->get('key', ''); if(empty($session_key)){ $session_key = $form->form_details->name; } if(empty($session_ns)){ $session_ns = 'default'; } if($session->has('_chronoform_data_'.$session_key, $session_ns)){ $stored = $session->get('_chronoform_data_'.$session_key, array(), $session_ns); if(!empty($stored) && is_array($stored) && (int)$params->get('merge', 0) == 1){ $session->set('_chronoform_data_'.$session_key, array_merge($stored, $form->data), $session_ns); }else{ $session->set('_chronoform_data_'.$session_key, $form->data, $session_ns); } }else{ $session->set('_chronoform_data_'.$session_key, $form->data, $session_ns); } } function load($clear){ if($clear){ $action_params = array( 'namespace' => '', 'key' => '', 'merge' => 0 ); } return array('action_params' => $action_params); } } ?>submit_article/submit_article.php000066600000004251151374535400013306 0ustar00 'joomla_functions', 'title' => 'Joomla Functions'); var $details = array('title' => 'Submit Article', 'tooltip' => 'Create a new Joomla article using your form.'); function run($form, $actiondata){ $params = new JParameter($actiondata->params); $mainframe = JFactory::getApplication(); //save the data to db $db_save_details = $actiondata; $db_save_details->type = 'db_save'; //create params $db_save_details_params = new JParameter(''); $db_save_details_params->set('table_name', $mainframe->getCfg('dbprefix').'content'); $db_save_details_params->set('model_id', 'Article'); $db_save_details->params = $db_save_details_params->toString(); //set data $user = JFactory::getUser(); $form->data['created_by'] = $user->id; $form->data['created'] = date("Y-m-d H:i:s"); $form->data['catid'] = $params->get('catid', ''); $form->data['sectionid'] = $params->get('sectionid', 0); $form->data['state'] = $params->get('state', 0); $form->data['title'] = $form->data[$params->get('title', '')]; $form->data['fulltext'] = $form->data[$params->get('fulltext', '')]; $form->data['introtext'] = isset($form->data[$params->get('introtext', '')]) ? $form->data[$params->get('introtext', '')] : ''; $form->data['created_by_alias'] = $form->data[$params->get('created_by_alias', '')]; $form->data['language'] = '*'; //alias $form->data['alias'] = JFilterOutput::stringURLSafe($form->data['title']); $form->data['id'] = null; //$form->data['alias'] = null; $form->runAction($db_save_details); } function load($clear){ if($clear){ $action_params = array( 'title' => '', 'fulltext' => '', 'introtext' => '', 'created_by_alias' => '', 'state' => 0, 'catid' => 0, 'sectionid' => 0 ); } return array('action_params' => $action_params); } } ?>submit_article/index.html000066600000000035151374535400011560 0ustar00 submit_article/.htaccess000066600000000177151374535400011370 0ustar00 Order allow,deny Deny from all submit_article/submit_article.ctp000066600000010215151374535400013302 0ustar00
Submit Article
Header(array('fields' => 'Fields', 'settings' => 'Settings', 'help' => 'Help'), 'submit_article_config_{n}'); ?> tabStart('fields'); ?> input('action_submit_article_{n}_title_config', array('type' => 'text', 'label' => "Article Title Field", 'class' => 'medium_input', 'smalldesc' => "The field name which will hold the article's title.")); ?> input('action_submit_article_{n}_fulltext_config', array('type' => 'text', 'label' => "Full Text Field", 'class' => 'medium_input', 'smalldesc' => "The field name which will hold the article's full text.")); ?> input('action_submit_article_{n}_introtext_config', array('type' => 'text', 'label' => "Intro Text Field", 'class' => 'medium_input', 'smalldesc' => "The field name which will hold the article's intro text.")); ?> input('action_submit_article_{n}_created_by_alias_config', array('type' => 'text', 'label' => "Author Alias Field", 'class' => 'medium_input', 'smalldesc' => "The field name which will hold the Author's alias name.")); ?> tabEnd(); ?> tabStart('settings'); ?> input('action_submit_article_{n}_state_config', array('type' => 'select', 'label' => 'Published ?', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'If enabled it will set the article status to published.')); ?> setQuery($query); $options = array(); $cats = $database->loadObjectList(); foreach($cats as $cat){ $options[$cat->id] = $cat->title; } ?> input('action_submit_article_{n}_catid_config', array('type' => 'select', 'label' => 'Category', 'options' => $options, 'empty' => " - ", 'class' => 'medium_input', 'smalldesc' => "Select the article's category.")); ?> tabEnd(); ?> tabStart('help'); ?>

  • This plugin will Save a new article to the content table in your Joomla database.

tabEnd(); ?>
autocomplete_processor/index.html000066600000000035151374535400013352 0ustar00 autocomplete_processor/autocomplete_processor.ctp000066600000012045151374535400016671 0ustar00
Autocomplete Processor
Header(array('settings' => 'Settings', 'other' => 'Other', 'help' => 'Help'), 'autocomplete_processor_config_{n}'); ?> tabStart('settings'); ?> getTableList(); $options = array(); foreach($tables as $table){ $options[$table] = $table; } ?> input('action_autocomplete_processor_{n}_table_name_config', array('type' => 'select', 'label' => 'Table', 'options' => $options, 'empty' => " - ", 'class' => 'medium_input', 'smalldesc' => "The table name to load the data from.")); ?> input('action_autocomplete_processor_{n}_field_name_config', array('type' => 'text', 'label' => "Field Name", 'smalldesc' => 'The name of the field which will be sent and its value will be queried against the table.')); ?> input('action_autocomplete_processor_{n}_column_name_config', array('type' => 'text', 'label' => "Column name(s)", 'class' => 'medium_input', 'smalldesc' => 'The column name which will be searched for the data (should exist in the table selected above), you may enter more than 1 separated by comma and all of them will be searched.')); ?> input('action_autocomplete_processor_{n}_content1_config', array('type' => 'textarea', 'label' => "Code", 'rows' => 20, 'cols' => 70, 'smalldesc' => 'You can place PHP code(with tags) here to override the results, check the help tab for how to.')); ?> tabEnd(); ?> tabStart('other'); ?> input('action_autocomplete_processor_{n}_minLength_config', array('type' => 'text', 'label' => "Minimum length", 'smalldesc' => 'Minimum number of characters before a request is initiated.')); ?> input('action_autocomplete_processor_{n}_maxChoices_config', array('type' => 'text', 'label' => "Max choice", 'smalldesc' => 'Maximum number of choices to load.')); ?> input('action_autocomplete_processor_{n}_maxLength_config', array('type' => 'text', 'label' => "Max Length", 'smalldesc' => 'Maximum number for the string length.')); ?> tabEnd(); ?> tabStart('help'); ?>

  • Fill the necessary fields and select your table, make sure that the field name matches the same field on the Autocomplete loader action.
  • The column name is one of your selected table's columns.
  • The code box can override the results loaded:
    $form->data['_PLUGINS_']['autocomplete_processor']['data'] will hold the whole data association loaded from the database.
    $form->data['_PLUGINS_']['autocomplete_processor']['result'] will hold the final 1 dimension array results which will be sent to the view.
    You can use both variables to filter and/or add your own results.
  • This action requires PHP5.

tabEnd(); ?>
autocomplete_processor/.htaccess000066600000000177151374535400013162 0ustar00 Order allow,deny Deny from all autocomplete_processor/autocomplete_processor.php000066600000006223151374535400016673 0ustar00 'Autocomplete Processor', 'tooltip' => 'Process the auto complete request for some field and send back the results.'); var $group = array('id' => 'power_fields', 'title' => 'Power Fields'); function load($clear){ if($clear){ $action_params = array( 'table_name' => '', 'field_name' => '', 'minLength' => 3, 'maxChoices' => 10, 'maxLength' => 50, 'content1' => '', 'column_name' => '' ); } return array('action_params' => $action_params); } function run($form, $actiondata){ $params = new JParameter($actiondata->params); $mainframe = JFactory::getApplication(); //settings, vars $min = $params->get('minLength', 3); $max = $params->get('maxLength', 50); $choices = $params->get('maxChoices', 10); $search = (string)$form->get_array_value($form->data, explode('.', $params->get('field_name', 'search'))); $result = array(); //quick validation if(strlen($search) >= $min && strlen($search) <= $max && $params->get('table_name', '') && $params->get('column_name', '')){ $database = JFactory::getDBO(); if(strpos($params->get('column_name', ''), ",") !== false){ $fields = explode(",", $params->get('column_name', '')); $where = array(); foreach($fields as $field){ $where[] = "`".trim($field)."` LIKE '%".$search."%'"; } $where = implode(" OR ", $where); }else{ $fields = array($params->get('column_name', '')); $where = "`".$params->get('column_name', '')."` LIKE '%".$search."%'"; } //echo "SELECT DISTINCT * FROM `".$params->get('table_name', '')."` WHERE ".$where." LIMIT ".$choices; $database->setQuery("SELECT DISTINCT ".$params->get('column_name', '*')." FROM `".$params->get('table_name', '')."` WHERE ".$where." LIMIT ".$choices); $data = $database->loadAssocList(); if(!is_array($data)){ $form->data['_PLUGINS_']['autocomplete_processor']['data'] = $form->data['_PLUGINS_']['autocomplete_processor']['result'] = $result = $data = array(); }else{ $form->data['_PLUGINS_']['autocomplete_processor']['data'] = $data; foreach($fields as $field){ foreach($data as $elem){ $result[] = $elem[$field]; } } $form->data['_PLUGINS_']['autocomplete_processor']['result'] = $result; } //allow custom data control $custom = $actiondata->content1; eval('?>'.$custom); //sleep(4); // delay if you want //push the JSON out header('Content-type: application/json'); echo json_encode($form->data['_PLUGINS_']['autocomplete_processor']['result']); $mainframe->close(); }else{ $form->data['_PLUGINS_']['autocomplete_processor']['result'] = array(); //push the JSON out header('Content-type: application/json'); echo json_encode($form->data['_PLUGINS_']['autocomplete_processor']['result']); $mainframe->close(); } } } ?>handle_arrays/.htaccess000066600000000177151374535400011176 0ustar00 Order allow,deny Deny from all handle_arrays/handle_arrays.ctp000066600000003540151374535400012721 0ustar00
Handle Arrays
input('action_handle_arrays_{n}_delimiter_config', array('type' => 'text', 'label' => "Delimiter", 'class' => 'small_input', 'smalldesc' => 'The delimiter which will be used to concatenate the array values.')); ?> input('action_handle_arrays_{n}_skipped_config', array('type' => 'text', 'label' => "Skipped fields names", 'class' => 'medium_input', 'smalldesc' => 'Any fields names to be skipped from the concatenation process ? use comma delimited list:
field1,field4')); ?> input('action_handle_arrays_{n}_fields_list_config', array('type' => 'text', 'label' => "White fields list", 'class' => 'medium_input', 'smalldesc' => 'Only fields in this list will be handled, you can use fields names with dots (sub arrays).')); ?>
handle_arrays/index.html000066600000000035151374535400011366 0ustar00 handle_arrays/handle_arrays.php000066600000003373151374535400012726 0ustar00 'Handle Arrays', 'tooltip' => 'Concatenate any array values using some delimiter.'); function run($form, $actiondata){ $params = new JParameter($actiondata->params); $skipped = $params->get('skipped', ''); if(!empty($skipped)){ $skipped = explode(',', $skipped); }else{ $skipped = array(); } $del = $params->get('delimiter', ","); //handle specific fields only ? if(strlen($params->get('fields_list', ''))){ $fields_list = explode(',', $params->get('fields_list', '')); foreach($fields_list as $field){ $field = trim($field); //get field value $field_value = $form->get_array_value($form->data, explode('.', $field)); if(is_array($field_value)){ $form->data = $form->set_array_value($form->data, explode('.', $field), implode($del, $field_value)); } } }else{ $form->data = $this->array_handler($form->data, $skipped, $del); } } function array_handler($data = array(), $skipped = array(), $del = ","){ foreach($data as $name => $value){ if(is_array($value) && !in_array($name, $skipped)){ $value = $this->array_handler($value, $skipped, $del); $data[$name] = implode($del, $value); } } return $data; } function load($clear){ if($clear){ $action_params = array( 'delimiter' => ",", 'fields_list' => '', 'skipped' => '' ); } return array('action_params' => $action_params); } } ?>widget_multi_upload/.htaccess000066600000000177151374535400012423 0ustar00 Order allow,deny Deny from all widget_multi_upload/index.html000066600000000035151374535400012613 0ustar00 widget_multi_upload/widget_multi_upload.php000066600000014521151374535400015375 0ustar00 'widgets_processors', 'title' => 'Widgets Processors'); var $events = array('success' => 0, 'fail' => 0); var $details = array('title' => 'Multi Upload', 'tooltip' => 'Processes the files sent using the Multi Upload Widget.'); function run($form, $actiondata){ $params = new JParameter($actiondata->params); if(trim($params->get('fields', ''))){ jimport('joomla.utilities.error'); jimport('joomla.filesystem.file'); //get upload path $upload_path = $params->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 = str_replace("JOOMLA_PATH", JPATH_SITE, $upload_path).DS; $params->set('upload_path', $upload_path); }else{ $upload_path = JPATH_SITE.DS.'components'.DS.'com_chronoforms'.DS.'uploads'.DS.$form->form_details->name.DS; } $fields = explode(',', trim($params->get('fields', ''))); $array_fields = $fields; foreach($array_fields as $k => $v){ $first = explode(':', $v); $array_fields[$k] = $first[0]; } //Try to generate an auto file link $site_link = JURI::Base(); if(substr($site_link, -1) == "/"){ $site_link = substr_replace($site_link, '', -1); } //check if there are some checkboxes old fields foreach($array_fields as $k => $field){ if(!empty($form->data[$field]) && is_array($form->data[$field])){ //cut any extra files over the limit if(strlen(trim($params->get('limit', ''))) > 0 && is_numeric(trim($params->get('limit', '')))){ $limit = (int)trim($params->get('limit', '')); if(count($form->data[$field]) > $limit){ $this->events['fail'] = 1; $form->validation_errors[$field] = "You have exceeded the maximum number of allowed files."; return false; } } foreach($form->data[$field] as $kk => $file_real_name){ if(file_exists($upload_path.DS.$file_real_name)){ //$file_info = pathinfo($upload_path.DS.$file_real_name); $form->files[$field][$kk]['size'] = filesize($upload_path.DS.$file_real_name); $form->files[$field][$kk]['path'] = $upload_path.$file_real_name; if(!empty($form->data['cf_file_orig_name_'.$field][$kk])){ $form->files[$field][$kk]['original_name'] = $form->data['cf_file_orig_name_'.$field][$kk]; } if(!empty($form->data['cf_file_id_'.$field][$kk])){ $form->files[$field][$kk]['file_id'] = $form->data['cf_file_id_'.$field][$kk]; } $form->files[$field][$kk]['name'] = $file_real_name; $form->files[$field][$kk]['link'] = str_replace(array(JPATH_SITE, DS), array($site_link, "/"), $upload_path.$file_real_name); //set extra paths if(strlen(trim($params->get('target_path_name', ''))) > 0){ $form->files[$field][$kk][trim($params->get('target_path_name', ''))] = $form->files[$field][$kk]['name']; } if((strlen(trim($params->get('target_path_original_name', ''))) > 0) && !empty($form->files[$field][$kk]['original_name'])){ $form->files[$field][$kk][trim($params->get('target_path_original_name', ''))] = $form->files[$field][$kk]['original_name']; } if((strlen(trim($params->get('target_path_id', ''))) > 0) && !empty($form->files[$field][$kk]['file_id'])){ $form->files[$field][$kk][trim($params->get('target_path_id', ''))] = $form->files[$field][$kk]['file_id']; } } } //set target path if enabled if(strlen(trim($params->get('target_path', ''))) > 0){ $form->data = $form->set_array_value($form->data, explode('.', trim($params->get('target_path', ''))), $form->files[$field]); } } } //process the new uploaded files $upload_files_details = $form->createAction('upload_files', array( 'upload_path' => $upload_path, 'files' => $params->get('fields', ''), 'array_fields' => implode(',', $array_fields), 'max_size' => $params->get('max_size', 1000), )); $form->runAction($upload_files_details); //cut any extra files over the limit if(strlen(trim($params->get('limit', ''))) > 0 && is_numeric(trim($params->get('limit', '')))){ $limit = (int)trim($params->get('limit', '')); foreach($array_fields as $k => $field){ if(count($form->files[$field]) >= $limit){ $form->files[$field] = array_slice($form->files[$field], 0, $limit); $form->data[$field] = array_slice($form->data[$field], 0, $limit); } } } if($form->last_action_result === false){ $this->events['fail'] = 1; }else{ $this->events['success'] = 1; //set target path if enabled if(strlen(trim($params->get('target_path', ''))) > 0){ foreach($array_fields as $k => $field){ //$form->data = $form->set_array_value($form->data, explode('.', trim($params->get('target_path', ''))), $form->files[$field]); foreach($form->files[$field] as $f => $file){ if(strlen(trim($params->get('target_path_name', ''))) > 0){ $form->files[$field][$f][trim($params->get('target_path_name', ''))] = $file['name']; } if((strlen(trim($params->get('target_path_original_name', ''))) > 0) && !empty($file['original_name'])){ $form->files[$field][$f][trim($params->get('target_path_original_name', ''))] = $file['original_name']; } if((strlen(trim($params->get('target_path_id', ''))) > 0) && !empty($file['file_id'])){ $form->files[$field][$f][trim($params->get('target_path_id', ''))] = $file['file_id']; } $form->data = $form->set_array_value($form->data, explode('.', trim($params->get('target_path', ''))), $form->files[$field]); } } } } } } function load($clear){ if($clear){ $action_params = array( 'fields' => '', 'limit' => 3, 'max_size' => 1000, 'upload_path' => '', 'target_path' => '', 'target_path_name' => '', 'target_path_original_name' => '', 'target_path_id' => '', ); } return array('action_params' => $action_params); } } ?>widget_multi_upload/widget_multi_upload.ctp000066600000011261151374535400015372 0ustar00
Multi Upload
Header(array('settings' => 'Settings', 'help' => 'Help'), 'widget_multi_upload_config_{n}'); ?> tabStart('settings'); ?> input('action_widget_multi_upload_{n}_fields_config', array('type' => 'text', 'label' => "Fields Configuration", 'class' => 'medium_input', 'smalldesc' => 'The fields configuration in this format:field_name:extensions,e.g:field1:zip-pdf')); ?> input('action_widget_multi_upload_{n}_limit_config', array('type' => 'text', 'label' => "Maximum Limit", 'smalldesc' => 'Maximum number of files accepted through the widget.')); ?> input('action_widget_multi_upload_{n}_max_size_config', array('type' => 'text', 'label' => "Max Size", 'smalldesc' => 'Maximum accepted file size in KB.')); ?> input('action_widget_multi_upload_{n}_upload_path_config', array('type' => 'text', 'label' => "Upload Path", 'class' => 'big_input', 'smalldesc' => 'Absolute path for files uploaded, leave empty to use the default uploads folder.')); ?> input('action_widget_multi_upload_{n}_target_path_config', array('type' => 'text', 'label' => "Target Data Path", 'smalldesc' => 'The data array key under which the files data will be stored after submission.')); ?> input('action_widget_multi_upload_{n}_target_path_name_config', array('type' => 'text', 'label' => "File Name", 'smalldesc' => 'The data array key under which the file name will be stored after submission.')); ?> input('action_widget_multi_upload_{n}_target_path_original_name_config', array('type' => 'text', 'label' => "Original File Name", 'smalldesc' => 'The data array key under which the file original name will be stored after submission.')); ?> input('action_widget_multi_upload_{n}_target_path_id_config', array('type' => 'text', 'label' => "File ID", 'smalldesc' => 'The data array key under which the file id will be stored after submission.')); ?> tabEnd(); ?> tabStart('help'); ?>

  • Don't forget to set your form method to "File" under the form "Edit" screen.

tabEnd(); ?>
show_form/show_form.php000066600000002760151374535400011303 0ustar00 'form_utilities', 'title' => 'Utilities'); //var $events = array('confirm' => 0, 'back' => 0); var $details = array('title' => 'Show Form', 'tooltip' => 'Displays a different form.'); function run($form, $actiondata){ $params = new JParameter($actiondata->params); //get the form name $formname = $params->get('form_name', ''); if(!empty($formname)){ $method = $params->get('action_taken', ''); //get the event to load $event = $params->get('form_event', 'load'); if(!trim($event)){ $event = 'load'; } //switch the showing method if($method == 'load'){ $MyForm = CFChronoForm::getInstance($formname); $MyForm->process($event); HTML_ChronoForms::processView($MyForm); }else{ $mainframe = JFactory::getApplication(); $form_url = "index.php?option=com_chronoforms&chronoform=".$formname."&event=".$event; $mainframe->redirect($form_url); } } } function load($clear){ if($clear){ $action_params = array( 'action_taken' => 'load', 'form_name' => '', 'form_event' => '' ); } return array('action_params' => $action_params); } } ?>show_form/show_form.ctp000066600000004562151374535400011304 0ustar00
Show Form
Header(array('settings' => 'Settings', 'help' => 'Help'), 'show_form_config_{n}'); ?> tabStart('settings'); ?> input('action_show_form_{n}_action_taken_config', array('type' => 'select', 'label' => 'Action', 'options' => array('load' => 'Load Form', 'redirect' => 'Redirect to Form'), 'smalldesc' => 'How the other form will be loaded ?
1- the form will just be loaded (shown) at the currect page.
2- the page will be redirected to the url of the other form.')); ?> input('action_show_form_{n}_form_name_config', array('type' => 'text', 'label' => "Form Name", 'class' => 'medium_input', 'smalldesc' => 'The name of the form to load.')); ?> input('action_show_form_{n}_form_event_config', array('type' => 'text', 'label' => "Form Event", 'class' => 'medium_input', 'smalldesc' => 'The loaded form event which will be executed.')); ?> tabEnd(); ?> tabStart('help'); ?>

  • Select how the form will be shown.
  • Write the name of the form to be loaded.
  • Write the form event to be executed when the form is loaded, e.g: "load" OR "submit", if left empty then the "load" event will be used.

tabEnd(); ?>
show_form/index.html000066600000000035151374535400010555 0ustar00 show_form/.htaccess000066600000000177151374535400010365 0ustar00 Order allow,deny Deny from all authorize_net/.htaccess000066600000000177151374535400011242 0ustar00 Order allow,deny Deny from all authorize_net/index.html000066600000000000151374535400011422 0ustar00authorize_net/authorize_net.ctp000066600000024577151374535400013046 0ustar00
Authorize.net - Trial
Header(array('fields' => 'Fields', 'settings' => 'Settings', 'help' => 'Help'), 'authorize_net_config_{n}'); ?> tabStart('fields'); ?> input('action_authorize_net_{n}_x_card_num_config', array('type' => 'text', 'label' => "Card's number field", 'class' => 'medium_input', 'value' => '')); ?> input('action_authorize_net_{n}_x_exp_date_m_config', array('type' => 'text', 'label' => "Card's expiry month field", 'class' => 'medium_input', 'value' => '')); ?> input('action_authorize_net_{n}_x_exp_date_y_config', array('type' => 'text', 'label' => "Card's expiry year field", 'class' => 'medium_input', 'value' => '')); ?> input('action_authorize_net_{n}_x_description_config', array('type' => 'text', 'label' => "Transaction description field", 'class' => 'medium_input', 'value' => '')); ?> input('action_authorize_net_{n}_x_amount_config', array('type' => 'text', 'label' => "Customer's amount field", 'class' => 'medium_input', 'value' => '')); ?> input('action_authorize_net_{n}_x_first_name_config', array('type' => 'text', 'label' => "Customer's first name field", 'class' => 'medium_input', 'value' => '')); ?> input('action_authorize_net_{n}_x_last_name_config', array('type' => 'text', 'label' => "Customer's last name field", 'class' => 'medium_input', 'value' => '')); ?> input('action_authorize_net_{n}_x_address_config', array('type' => 'text', 'label' => "Customer's address field", 'class' => 'medium_input', 'value' => '')); ?> input('action_authorize_net_{n}_x_city_config', array('type' => 'text', 'label' => "Customer's city field", 'class' => 'medium_input', 'value' => '')); ?> input('action_authorize_net_{n}_x_state_config', array('type' => 'text', 'label' => "Customer's state field", 'class' => 'medium_input', 'value' => '')); ?> input('action_authorize_net_{n}_x_zip_config', array('type' => 'text', 'label' => "Customer's zip code field", 'class' => 'medium_input', 'value' => '')); ?> input('action_authorize_net_{n}_x_country_config', array('type' => 'text', 'label' => "Customer's country field", 'class' => 'medium_input', 'value' => '')); ?> input('action_authorize_net_{n}_x_phone_config', array('type' => 'text', 'label' => "Customer's phone field", 'class' => 'medium_input', 'value' => '')); ?> input('action_authorize_net_{n}_x_email_config', array('type' => 'text', 'label' => "Customer's email field", 'class' => 'medium_input', 'value' => '')); ?> input('action_authorize_net_{n}_x_invoice_num_config', array('type' => 'text', 'label' => 'Invoice # field', 'class' => 'medium_input', 'value' => '')); ?> input('action_authorize_net_{n}_content1_config', array('type' => 'textarea', 'label' => 'Extra fields', 'rows' => 5, 'cols' => 50)); ?> tabEnd(); ?> tabStart('settings'); ?> input('action_authorize_net_{n}_loginid_config', array('type' => 'text', 'label' => "API Login ID", 'class' => 'medium_input', 'value' => '')); ?> input('action_authorize_net_{n}_transkey_config', array('type' => 'text', 'label' => "Transaction Key", 'class' => 'medium_input', 'value' => '')); ?> input('action_authorize_net_{n}_debugging_config', array('type' => 'select', 'label' => 'Debugging', 'options' => array(0 => 'No', 1 => 'Yes'))); ?> input('action_authorize_net_{n}_testing_config', array('type' => 'select', 'label' => 'Testing', 'options' => array(0 => 'No', 1 => 'Yes'))); ?> input('action_authorize_net_{n}_auto_add_error_config', array('type' => 'select', 'label' => 'Auto Set Error', 'options' => array(0 => 'No', 1 => 'Yes'))); ?> input('action_authorize_net_{n}_error_retires_config', array('type' => 'text', 'label' => "Error Retires", 'class' => 'small_input', 'value' => '')); ?> tabEnd(); ?> tabStart('help'); ?>

  • Map your form fields names to the fields required by Authorize.net, no spaces should be in the fields name.
  • You may map extra fields through the "Extra fields" box, use multi line format, each line should be in this form: authorize.net_field_name=form_field_name
  • Enter your authorize.net account settings.
  • If you enable the debugging then you will see the Authorize.net response in the same event page.
  • Map your form fields names to the fields required by Authorize.net, no spaces should be in the fields name.
  • Some response data will be stored after the response is received under the $form->data['_PLUGINS_']['authorize_net'].
  • You can add a "Custom code" action after this one and use this code to check/user the response data stored : print_r2($form->data['_PLUGINS_']['authorize_net']);

tabEnd(); ?>
authorize_net/authorize_net.php000066600000043445151374535400013042 0ustar00 'payments', 'title' => 'Payment Gateways'); var $events = array('approved' => 0, 'declined' => 0, 'error' => 0, 'held' => 0); var $details = array('title' => 'Authorize.net', 'tooltip' => 'Communicate with the Authorize.net payment gateway.'); function run($form, $actiondata){ $params = new JParameter($actiondata->params); $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" => $form->data($params->get('x_card_num'), ''), "x_exp_date" => $form->data($params->get('x_exp_date_m'), '').$form->data($params->get('x_exp_date_y'), ''), "x_description" => $form->data($params->get('x_description'), ''), "x_first_name" => $form->data($params->get('x_first_name'), ''), "x_last_name" => $form->data($params->get('x_last_name'), ''), "x_amount" => $form->data($params->get('x_amount'), ''), "x_address" => $form->data($params->get('x_address'), ''), "x_city" => $form->data($params->get('x_city'), ''), "x_state" => $form->data($params->get('x_state'), ''), "x_zip" => $form->data($params->get('x_zip'), ''), "x_invoice_num" => isset($form->data[$params->get('x_invoice_num')]) ? $form->data[$params->get('x_invoice_num')] : '', "x_cust_id" => isset($form->data[$params->get('x_cust_id')]) ? $form->data[$params->get('x_cust_id')] : '', "x_company" => isset($form->data[$params->get('x_company')]) ? $form->data[$params->get('x_company')] : '', "x_country" => isset($form->data[$params->get('x_country')]) ? $form->data[$params->get('x_country')] : '', "x_phone" => isset($form->data[$params->get('x_phone')]) ? $form->data[$params->get('x_phone')] : '', "x_fax" => isset($form->data[$params->get('x_fax')]) ? $form->data[$params->get('x_fax')] : '', "x_email" => isset($form->data[$params->get('x_email')]) ? $form->data[$params->get('x_email')] : '', ); if(!empty($actiondata->content1)){ $extras = explode("\n", $actiondata->content1); foreach($extras as $extra){ $values = array(); $values = explode("=", $extra); if(isset($form->data[trim($values[1])])){ $authnet_values[$values[0]] = $form->data[trim($values[1])]; }else{ $authnet_values[$values[0]] = ''; } } } $authnet_values['x_amount'] = rand(1,4)* (int)$form->data($params->get('x_amount'), ''); if($params->get('testing', 0) == 1){ $authnet_values['x_test_request'] = "TRUE"; } $fields = ""; foreach($authnet_values as $key => $value) $fields .= "$key=" . urlencode( $value ) . "&"; $nvpstr = $fields; if($params->get('debugging', 0)){ echo $nvpstr; } if($params->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, $params); } function load($clear){ if($clear){ $action_params = array( 'x_card_num' => '', 'x_exp_date_m' => '', 'x_exp_date_y' => '', 'x_description' => '', 'x_amount' => '', 'x_first_name' => '', 'x_last_name' => '', 'x_address' => '', 'x_city' => '', 'x_state' => '', 'x_zip' => '', 'x_invoice_num' => '', 'x_country' => '', 'x_phone' => '', 'x_email' => '', 'error_retires' => '2', 'testing' => '', 'debugging' => '', 'transkey' => '', 'loginid' => '', 'auto_add_error' => 1, 'content1' => '' ); } return array('action_params' => $action_params); } function _processResp($resp, $form, $params){ $debugger = ""; $debugger .= ""; $text = $resp; $h = substr_count($text, "|"); $h++; for($j=1; $j <= $h; $j++){ $p = strpos($text, "|"); if ($p === false) { // note: three equal signs $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; }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 .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; $debugger .= ""; // remove the part that we identified and work with the rest of the string $text = substr($text, $p); } } $debugger .= "
"; // x_delim_char is obviously not found in the last go-around if($j>=69){ $debugger .= "Merchant-defined (".$j."): "; $debugger .= ": "; $debugger .= ""; $debugger .= $text; $debugger .= "
"; } else { $debugger .= $j; $debugger .= ": "; $debugger .= "
"; $debugger .= $text; $debugger .= "
"; } $debugger .= "
"; switch($j){ case 1: $debugger .= "Response Code: "; $debugger .= ""; $fval=""; if($pstr_trimmed == "1"){ $form->data['_PLUGINS_']['authorize_net']['response_code'] = $fval = "Approved"; $this->events['approved'] = 1; }elseif($pstr_trimmed == "2"){ $form->data['_PLUGINS_']['authorize_net']['response_code'] = $fval = "Declined"; $this->events['declined'] = 1; }elseif($pstr_trimmed == "3"){ $form->data['_PLUGINS_']['authorize_net']['response_code'] = $fval = "Error"; $this->events['error'] = 1; }elseif($pstr_trimmed == "4"){ $form->data['_PLUGINS_']['authorize_net']['response_code'] = $fval = "Held"; $this->events['held'] = 1; } $debugger .= $fval; $debugger .= "
"; break; case 2: $debugger .= "Response Subcode: "; $debugger .= "
"; $form->data['_PLUGINS_']['authorize_net']['response_subcode'] = $pstr_trimmed; $debugger .= $pstr_trimmed; $debugger .= "
"; break; case 3: $debugger .= "Response Reason Code: "; $debugger .= "
"; $form->data['_PLUGINS_']['authorize_net']['response_reason_code'] = $pstr_trimmed; $debugger .= $pstr_trimmed; $debugger .= "
"; break; case 4: $debugger .= "Response Reason Text: "; $debugger .= "
"; $form->data['_PLUGINS_']['authorize_net']['response_reason_text'] = $pstr_trimmed; //add Error if($params->get('auto_add_error', 1) == 1 && ($this->events['declined'] == 1 || $this->events['error'] = 1)){ $form->validation_errors[] = $form->data['_PLUGINS_']['authorize_net']['response_reason_text']; } $debugger .= $pstr_trimmed; $debugger .= "
"; break; case 5: $debugger .= "Approval Code: "; $debugger .= "
"; $form->data['_PLUGINS_']['authorize_net']['approval_code'] = $pstr_trimmed; $debugger .= $pstr_trimmed; $debugger .= "
"; break; case 6: $debugger .= "AVS Result Code: "; $debugger .= "
"; $form->data['_PLUGINS_']['authorize_net']['avs_result_code'] = $pstr_trimmed; $debugger .= $pstr_trimmed; $debugger .= "
"; break; case 7: $debugger .= "Transaction ID: "; $debugger .= "
"; $form->data['_PLUGINS_']['authorize_net']['transaction_id'] = $pstr_trimmed; $debugger .= $pstr_trimmed; $debugger .= "
"; break; case 8: $debugger .= "Invoice Number (x_invoice_num): "; $debugger .= "
"; $debugger .= $pstr_trimmed; $debugger .= "
"; break; case 9: $debugger .= "Description (x_description): "; $debugger .= "
"; $debugger .= $pstr_trimmed; $debugger .= "
"; break; case 10: $debugger .= "Amount (x_amount): "; $debugger .= "
"; $debugger .= $pstr_trimmed; $debugger .= "
"; break; case 11: $debugger .= "Method (x_method): "; $debugger .= "
"; $debugger .= $pstr_trimmed; $debugger .= "
"; break; case 12: $debugger .= "Transaction Type (x_type): "; $debugger .= "
"; $debugger .= $pstr_trimmed; $debugger .= "
"; break; case 13: $debugger .= "Customer ID (x_cust_id): "; $debugger .= "
"; $debugger .= $pstr_trimmed; $debugger .= "
"; break; case 14: $debugger .= "Cardholder First Name (x_first_name): "; $debugger .= "
"; $debugger .= $pstr_trimmed; $debugger .= "
"; break; case 15: $debugger .= "Cardholder Last Name (x_last_name): "; $debugger .= "
"; $debugger .= $pstr_trimmed; $debugger .= "
"; break; case 16: $debugger .= "Company (x_company): "; $debugger .= "
"; $debugger .= $pstr_trimmed; $debugger .= "
"; break; case 17: $debugger .= "Billing Address (x_address): "; $debugger .= "
"; $debugger .= $pstr_trimmed; $debugger .= "
"; break; case 18: $debugger .= "City (x_city): "; $debugger .= "
"; $debugger .= $pstr_trimmed; $debugger .= "
"; break; case 19: $debugger .= "State (x_state): "; $debugger .= "
"; $debugger .= $pstr_trimmed; $debugger .= "
"; break; case 20: $debugger .= "ZIP (x_zip): "; $debugger .= "
"; $debugger .= $pstr_trimmed; $debugger .= "
"; break; case 21: $debugger .= "Country (x_country): "; $debugger .= "
"; $debugger .= $pstr_trimmed; $debugger .= "
"; break; case 22: $debugger .= "Phone (x_phone): "; $debugger .= "
"; $debugger .= $pstr_trimmed; $debugger .= "
"; break; case 23: $debugger .= "Fax (x_fax): "; $debugger .= "
"; $debugger .= $pstr_trimmed; $debugger .= "
"; break; case 24: $debugger .= "E-Mail Address (x_email): "; $debugger .= "
"; $debugger .= $pstr_trimmed; $debugger .= "
"; break; case 25: $debugger .= "Ship to First Name (x_ship_to_first_name): "; $debugger .= "
"; $debugger .= $pstr_trimmed; $debugger .= "
"; break; case 26: $debugger .= "Ship to Last Name (x_ship_to_last_name): "; $debugger .= "
"; $debugger .= $pstr_trimmed; $debugger .= "
"; break; case 27: $debugger .= "Ship to Company (x_ship_to_company): "; $debugger .= "
"; $debugger .= $pstr_trimmed; $debugger .= "
"; break; case 28: $debugger .= "Ship to Address (x_ship_to_address): "; $debugger .= "
"; $debugger .= $pstr_trimmed; $debugger .= "
"; break; case 29: $debugger .= "Ship to City (x_ship_to_city): "; $debugger .= "
"; $debugger .= $pstr_trimmed; $debugger .= "
"; break; case 30: $debugger .= "Ship to State (x_ship_to_state): "; $debugger .= "
"; $debugger .= $pstr_trimmed; $debugger .= "
"; break; case 31: $debugger .= "Ship to ZIP (x_ship_to_zip): "; $debugger .= "
"; $debugger .= $pstr_trimmed; $debugger .= "
"; break; case 32: $debugger .= "Ship to Country (x_ship_to_country): "; $debugger .= "
"; $debugger .= $pstr_trimmed; $debugger .= "
"; break; case 33: $debugger .= "Tax Amount (x_tax): "; $debugger .= "
"; $debugger .= $pstr_trimmed; $debugger .= "
"; break; case 34: $debugger .= "Duty Amount (x_duty): "; $debugger .= "
"; $debugger .= $pstr_trimmed; $debugger .= "
"; break; case 35: $debugger .= "Freight Amount (x_freight): "; $debugger .= "
"; $debugger .= $pstr_trimmed; $debugger .= "
"; break; case 36: $debugger .= "Tax Exempt Flag (x_tax_exempt): "; $debugger .= "
"; $debugger .= $pstr_trimmed; $debugger .= "
"; break; case 37: $debugger .= "PO Number (x_po_num): "; $debugger .= "
"; $debugger .= $pstr_trimmed; $debugger .= "
"; break; case 38: $debugger .= "MD5 Hash: "; $debugger .= "
"; $debugger .= $pstr_trimmed; $debugger .= "
"; break; case 39: $debugger .= "Card Code Response: "; $debugger .= "
"; $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 .= "
"; 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 .= "
"; $debugger .= $pstr_trimmed; $debugger .= "
"; break; default: if($j>=69){ $debugger .= "Merchant-defined (".$j."): "; $debugger .= ": "; $debugger .= "
"; $debugger .= $pstr_trimmed; $debugger .= "
"; } else { $debugger .= $j; $debugger .= ": "; $debugger .= "
"; $debugger .= $pstr_trimmed; $debugger .= "
"; } break; } $debugger .= "
"; if($params->get('debugging', 0)){ echo $debugger; } } } ?>debugger/debugger.php000066600000001410151374535400010634 0ustar00 'Debugger', 'tooltip' => 'Display the form debug data.'); function run($form, $actiondata){ echo "Data Array:
"; print_r2($form->data); echo "Validation Errors:
"; print_r2($form->validation_errors); } function load($clear){ if($clear){ $action_params = array( 'reset_after_display' => 0 ); } return array('action_params' => $action_params); } } ?>debugger/cfaction_debugger.ctp000066600000000201151374535400012476 0ustar00display_debug_block($form->debug); ?>debugger/debugger.ctp000066600000001711151374535400010637 0ustar00
Debugger
input('action_debugger_{n}_reset_after_display_config', array('type' => 'select', 'label' => 'Reset after display', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Reset the debug data after they are displayed ?')); ?>
debugger/cfaction_debugger.php000066600000001611151374535400012505 0ustar00
    $data): ?>
  1. display_debug_block($data, $k); }else{ if(is_numeric($k)){ echo $data; }else{ ?>
debugger/index.html000066600000000035151374535400010336 0ustar00 debugger/.htaccess000066600000000177151374535400010146 0ustar00 Order allow,deny Deny from all auto_serverside_validation/auto_serverside_validation.ctp000066600000031130151374535400020317 0ustar00
Auto Server Side Validation
Header(array('fields' => 'Fields', 'errors' => 'Error Messages', 'help' => 'Help'), 'auto_serverside_validation_config_{n}'); ?> tabStart('fields'); ?> input('action_auto_serverside_validation_{n}_required_config', array('type' => 'text', 'label' => "Required", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "Comma delimited list of required fields names, these fields should exist in the data array in order to pass this check.")); ?> input('action_auto_serverside_validation_{n}_not_empty_config', array('type' => 'text', 'label' => "Not Empty", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "Comma delimited list of fields names which should not be empty.")); ?> input('action_auto_serverside_validation_{n}_empty_config', array('type' => 'text', 'label' => "Empty", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "Comma delimited list of fields names which should be empty.")); ?> input('action_auto_serverside_validation_{n}_alpha_config', array('type' => 'text', 'label' => "Alpha", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "Comma delimited list of fields names which should only contain an alpha value.")); ?> input('action_auto_serverside_validation_{n}_alphanumeric_config', array('type' => 'text', 'label' => "Alpha Numeric", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "Comma delimited list of fields names which should only contain an alpha numeric value.")); ?> input('action_auto_serverside_validation_{n}_digit_config', array('type' => 'text', 'label' => "Digit", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "Comma delimited list of fields names which should only contain a digit value.")); ?> input('action_auto_serverside_validation_{n}_nodigit_config', array('type' => 'text', 'label' => "No Digit", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "Comma delimited list of fields names which should only contain a non digit value.")); ?> input('action_auto_serverside_validation_{n}_number_config', array('type' => 'text', 'label' => "Number", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "Comma delimited list of fields names which should only contain a number value.")); ?> input('action_auto_serverside_validation_{n}_email_config', array('type' => 'text', 'label' => "Email", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "Comma delimited list of fields names which should only contain an email value.")); ?> input('action_auto_serverside_validation_{n}_phone_config', array('type' => 'text', 'label' => "Phone", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "Comma delimited list of fields names which should only contain a phone value.")); ?> input('action_auto_serverside_validation_{n}_phone_inter_config', array('type' => 'text', 'label' => "International Phone", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "Comma delimited list of fields names which should only contain an international phone value.")); ?> input('action_auto_serverside_validation_{n}_url_config', array('type' => 'text', 'label' => "URL", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "Comma delimited list of fields names which should only contain URLs.")); ?> tabEnd(); ?> tabStart('errors'); ?> input('action_auto_serverside_validation_{n}_required_error_config', array('type' => 'text', 'label' => "Required", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "Error message for required fields.")); ?> input('action_auto_serverside_validation_{n}_not_empty_error_config', array('type' => 'text', 'label' => "Not Empty", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "Error message for not empty fields.")); ?> input('action_auto_serverside_validation_{n}_empty_error_config', array('type' => 'text', 'label' => "Empty", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "Error message for empty fields.")); ?> input('action_auto_serverside_validation_{n}_alpha_error_config', array('type' => 'text', 'label' => "Alpha", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "Error message for alpha fields.")); ?> input('action_auto_serverside_validation_{n}_alphanumeric_error_config', array('type' => 'text', 'label' => "Alpha Numeric", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "Error message for alpha numeric fields.")); ?> input('action_auto_serverside_validation_{n}_digit_error_config', array('type' => 'text', 'label' => "Digit", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "Error message for digit fields.")); ?> input('action_auto_serverside_validation_{n}_nodigit_error_config', array('type' => 'text', 'label' => "No Digit", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "Error message for non digit fields.")); ?> input('action_auto_serverside_validation_{n}_number_error_config', array('type' => 'text', 'label' => "Number", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "Error message for number fields.")); ?> input('action_auto_serverside_validation_{n}_email_error_config', array('type' => 'text', 'label' => "Email", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "Error message for email fields.")); ?> input('action_auto_serverside_validation_{n}_phone_error_config', array('type' => 'text', 'label' => "Phone", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "Error message for phone fields.")); ?> input('action_auto_serverside_validation_{n}_phone_inter_error_config', array('type' => 'text', 'label' => "International Phone", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "Error message for international phone fields.")); ?> input('action_auto_serverside_validation_{n}_url_error_config', array('type' => 'text', 'label' => "URL", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "Error message for URL fields.")); ?> tabEnd(); ?> tabStart('help'); ?>

  • Enter the fields names you want to check in the text field for the rule you want them to be checked against.
  • If a field failed the check, the fail event will be fired and the error will be shown.

tabEnd(); ?>
auto_serverside_validation/auto_serverside_validation.php000066600000012420151374535400020321 0ustar00 0, 'fail' => 0); var $group = array('id' => '1_validation', 'title' => 'Validation'); var $details = array('title' => 'Auto Server Side Validation', 'tooltip' => 'Validate your fields data on the server, more secure and browser "Independent", but requires a form submission first.'); function run($form, $actiondata){ $params = new JParameter($actiondata->params); $rules = array('required', 'not_empty', 'empty', 'alpha', 'alphanumeric', 'digit', 'nodigit', 'number', 'email', 'phone', 'phone_inter', 'url'); foreach($rules as $rule){ $fields_string = trim($params->get($rule, '')); if(!empty($fields_string)){ $fields = explode(",", $fields_string); foreach($fields as $field){ $function = 'validate_'.$rule; $result = $this->$function(trim($field), $form); if(!$result){ $this->events['fail'] = 1; if(!isset($form->validation_errors[trim($field)])){ $form->validation_errors[trim($field)] = $params->get($rule.'_error'); }else{ if(is_array($form->validation_errors[trim($field)])){ $form->validation_errors[trim($field)][] = $params->get($rule.'_error'); }else{ $form->validation_errors[trim($field)] = array($form->validation_errors[trim($field)], $params->get($rule.'_error')); } } //return false; } } } } if($this->events['fail'] == 0){ $this->events['success'] = 1; } } function validate_required($str, $form){ if(!isset($form->data[$str])){ return false; }else{ return true; } } function validate_not_empty($str, $form){ if(isset($form->data[$str])){ return preg_match('/[^.*]/', $form->data[$str]); } } function validate_empty($str, $form){ if(isset($form->data[$str])){ if(is_array($form->data[$str])){ return !(bool)count($form->data[$str]); }else{ return !(bool)strlen($form->data[$str]); } } } function validate_alpha($str, $form){ if(isset($form->data[$str]) && strlen($form->data[$str]) > 0){ return preg_match('/^[a-z ._-]+$/i', $form->data[$str]); } return true; } function validate_alphanumeric($str, $form){ if(isset($form->data[$str]) && strlen($form->data[$str]) > 0){ return preg_match('/^[a-z0-9 ._-]+$/i', $form->data[$str]); } return true; } function validate_digit($str, $form){ if(isset($form->data[$str]) && strlen($form->data[$str]) > 0){ return preg_match('/^[-+]?[0-9]+$/', $form->data[$str]); } return true; } function validate_nodigit($str, $form){ if(isset($form->data[$str]) && strlen($form->data[$str]) > 0){ return preg_match('/^[^0-9]+$/', $form->data[$str]); } return true; } function validate_number($str, $form){ if(isset($form->data[$str]) && strlen($form->data[$str]) > 0){ return preg_match('/^[-+]?\d*\.?\d+$/', $form->data[$str]); } return true; } function validate_email($str, $form){ if(isset($form->data[$str]) && strlen($form->data[$str]) > 0){ return preg_match('/^([a-zA-Z0-9_\.\-\+%])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/', $form->data[$str]); } return true; } function validate_phone($str, $form){ if(isset($form->data[$str]) && strlen($form->data[$str]) > 0){ return preg_match('/^\+{0,1}[0-9 \(\)\.\-]+$/', $form->data[$str]); } return true; } function validate_phone_inter($str, $form){ if(isset($form->data[$str]) && strlen($form->data[$str]) > 0){ return preg_match('/^\+{0,1}[0-9 \(\)\.\-]+$/', $form->data[$str]); } return true; } function validate_url($str, $form){ if(isset($form->data[$str]) && strlen($form->data[$str]) > 0){ return preg_match('/^(http|https|ftp)\:\/\/[a-z0-9\-\.]+\.[a-z]{2,3}(:[a-z0-9]*)?\/?([a-z0-9\-\._\?\,\'\/\\\+&%\$#\=~])*$/i', $form->data[$str]); } return true; } function load($clear){ if($clear){ $action_params = array( 'content1' => '', 'required' => '', 'not_empty' => '', 'empty' => '', 'alpha' => '', 'alphanumeric' => '', 'digit' => '', 'nodigit' => '', 'number' => '', 'email' => '', 'phone' => '', 'phone_inter' => '', 'url' => '', 'required_error' => 'This field is required.', 'not_empty_error' => 'This field should NOT be empty.', 'empty_error' => 'This field should be empty.', 'alpha_error' => 'This field should contain alphabetic characters only.', 'alphanumeric_error' => 'This field should contain alphabetic characters or digits only.', 'digit_error' => 'This field should contain digits only.', 'nodigit_error' => 'This field should NOT contain any digits.', 'number_error' => 'This field should contain a number.', 'email_error' => 'This field should contain an email address.', 'phone_error' => 'This field should contain a phone number.', 'phone_inter_error' => 'This field should contain an international phone number.', 'url_error' => 'This field should contain a URL.' ); } return array('action_params' => $action_params); } } ?>auto_serverside_validation/.htaccess000066600000000177151374535400013777 0ustar00 Order allow,deny Deny from all auto_serverside_validation/index.html000066600000000035151374535400014167 0ustar00 email/.htaccess000066600000000177151374535400007451 0ustar00 Order allow,deny Deny from all email/index.html000066600000000035151374535400007641 0ustar00 email/email.php000066600000040122151374535400007445 0ustar00 'Email', 'tooltip' => 'Send an E-mail message.'); function load($clear){ if($clear){ $action_params = array( 'to' => '', 'cc' => '', 'bcc' => '', 'subject' => '', 'fromname' => '', 'fromemail' => '', 'replytoname' => '', 'replytoemail' => '', 'enabled' => 0, 'action_label' => '', 'recordip' => 1, 'replace_nulls' => 0, 'attachments' => '', 'sendas' => 'html', 'content1' => 'Enter your email message content here manually or use the auto template generation button.', 'dto' => '', 'dcc' => '', 'dbcc' => '', 'dsubject' => '', 'dfromname' => '', 'dfromemail' => '', 'dreplytoname' => '', 'dreplytoemail' => '', 'encrypt_enabled' => 0, 'gpg_sec_key' => '' ); } return array('action_params' => $action_params); } function run($form, $actiondata){ $email_params = new JParameter($actiondata->params); $email_body = $actiondata->content1; ob_start(); eval("?>".$email_body); $email_body = ob_get_clean(); //build email template from defined fields and posted fields $replace_nulls = (bool)$email_params->get('replace_nulls', 0); $email_body = $form->curly_replacer($email_body, $form->data, '.', $replace_nulls); //add the IP if so if($email_params->get('recordip', 1)){ if(strpos($email_body, '{IPADDRESS}') !== false){ }else{ $email_body .= "

\n\nSubmitted by {IPADDRESS}"; } $email_body = str_replace('{IPADDRESS}', $_SERVER['REMOTE_ADDR'], $email_body); } if($email_params->get('sendas', "html") == "html"){ $email_body = " Email $email_body "; } //$fromname = (trim($email_params->get('fromname', ''))) ? trim($email_params->get('fromname', '')) : $form->data[trim($email_params->get('dfromname', ''))]; if(trim($email_params->get('fromname', ''))){ $fromname = trim($email_params->get('fromname', '')); }else{ if(isset($form->data[trim($email_params->get('dfromname', ''))])){ $fromname = $form->data[trim($email_params->get('dfromname', ''))]; }else{ $fromname = 'admin'; } } //$from = (trim($email_params->get('fromemail', ''))) ? trim($email_params->get('fromemail', '')) : $form->data[trim($email_params->get('dfromemail', ''))]; if(trim($email_params->get('fromemail', ''))){ $from = trim($email_params->get('fromemail', '')); }else{ if(isset($form->data[trim($email_params->get('dfromemail', ''))])){ $from = $form->data[trim($email_params->get('dfromemail', ''))]; }else{ $from = 'admin@admin.com'; } } //$subject = (trim($email_params->get('subject', ''))) ? trim($email_params->get('subject', '')) : $form->data[trim($email_params->get('dsubject', ''))]; if(trim($email_params->get('subject', ''))){ $subject = trim($email_params->get('subject', '')); }else{ if(isset($form->data[trim($email_params->get('dsubject', ''))])){ $subject = $form->data[trim($email_params->get('dsubject', ''))]; }else{ $subject = 'DEFAULT SUBJECT'; } } // Recepients $recipients = array(); if(trim($email_params->get('to', ''))){ $recipients = explode(",", trim($email_params->get('to', ''))); } if(trim($email_params->get('dto', ''))){ $dynamic_recipients = explode(",", trim($email_params->get('dto', ''))); foreach($dynamic_recipients as $dynamic_recipient){ if(isset($form->data[trim($dynamic_recipient)])){ $recipients[] = $form->data[trim($dynamic_recipient)]; } } } // CCs $ccemails = array(); if(trim($email_params->get('cc', ''))){ $ccemails = explode(",", trim($email_params->get('cc', ''))); } if(trim($email_params->get('dcc', ''))){ $dynamic_ccemails = explode(",", trim($email_params->get('dcc', ''))); foreach($dynamic_ccemails as $dynamic_ccemail){ if($form->data[trim($dynamic_ccemail)]){ $ccemails[] = $form->data[trim($dynamic_ccemail)]; } } } // BCCs $bccemails = array(); if(trim($email_params->get('bcc', ''))){ $bccemails = explode(",", trim($email_params->get('bcc', ''))); } if(trim($email_params->get('dbcc', ''))){ $dynamic_bccemails = explode(",", trim($email_params->get('dbcc', ''))); foreach($dynamic_bccemails as $dynamic_bccemail){ if($form->data[trim($dynamic_bccemail)]){ $bccemails[] = $form->data[trim($dynamic_bccemail)]; } } } // ReplyTo Names $replytonames = array(); if(trim($email_params->get('replytoname', ''))){ $replytonames = explode(",", trim($email_params->get('replytoname', ''))); } if(trim($email_params->get('dreplytoname', ''))){ $dynamic_replytonames = explode(",", trim($email_params->get('dreplytoname', ''))); foreach($dynamic_replytonames as $dynamic_replytoname){ if($form->data[trim($dynamic_replytoname)]){ $replytonames[] = $form->data[trim($dynamic_replytoname)]; } } } // ReplyTo Emails $replytoemails = array(); if(trim($email_params->get('replytoemail', ''))){ $replytoemails = explode(",", trim($email_params->get('replytoemail', ''))); } if(trim($email_params->get('dreplytoemail', ''))){ $dynamic_replytoemails = explode(",", trim($email_params->get('dreplytoemail', ''))); foreach($dynamic_replytoemails as $dynamic_replytoemail){ if($form->data[trim($dynamic_replytoemail)]){ $replytoemails[] = $form->data[trim($dynamic_replytoemail)]; } } } // Replies $replyto_email = $replytoemails; $replyto_name = $replytonames; $mode = ($email_params->get('sendas', "html") == 'html') ? true : false; if(!$mode){ $filter = JFilterInput::getInstance(); if($email_params->get('sendas', "html") == 'both'){ $email_body = ""."\n\n\n".$email_body; }else{ $email_body = $filter->clean($email_body, 'STRING'); } }else{ //$email_body = nl2br($email_body); } //encrypt the email if($email_params->get('encrypt_enabled', 0) == 1 && class_exists('Crypt_GPG')){ $mySecretKeyId = trim($email_params->get('gpg_sec_key', '')); //Add Encryption key here $gpg = new Crypt_GPG(); $gpg->addEncryptKey($mySecretKeyId); $email_body = $gpg->encrypt($email_body); } $email_attachments = array(); if(strlen(trim($email_params->get("attachments", ""))) && !empty($form->files)){ $attachments = explode(",", $email_params->get("attachments", "")); foreach($attachments as $attachment){ if(isset($form->files[$attachment]['path'])){ $email_attachments[] = $form->files[$attachment]['path']; }else{ if($form->files[$attachment] === array_values($form->files[$attachment])){ foreach($form->files[$attachment] as $m_file){ if(isset($m_file['path'])){ $email_attachments[] = $m_file['path']; } } } } } } $email_sent = JUtility::sendMail($from, $fromname, $recipients, $subject, $email_body, $mode, $ccemails, $bccemails, $email_attachments, $replyto_email, $replyto_name); if($email_sent){ $form->debug['email'][$actiondata->order]['Result'] = 'An email has been SENT successfully from ('.$fromname.')'.$from.' to '.implode(',', $recipients); }else{ $form->debug['email'][$actiondata->order]['Result'] = 'An email has failed to be sent from ('.$fromname.')'.$from.' to '.implode(',', $recipients); } $form->debug['email'][$actiondata->order]['Body'] = $email_body; $form->debug['email'][$actiondata->order]['Attachments'] = var_export($email_attachments, true); } function generate_table_list($elements_code = ''){ $output = ''; $output .= "\n"; eval('?>'.''); foreach($wizardcode as $k => $field){ $field_id = str_replace('field_', '', $k); if($field['type'] == 'custom' || $field['type'] == 'header'){ $output .= "\t\n\t\t\n\t\n"; }else if($field['type'] == 'hidden'){ $output .= "\t\n\t\t\n\t\t\n\t\n"; }else if($field['type'] == 'submit'){ }else{ $output .= "\t\n\t\t\n\t\t\n\t\n"; } } $output .= '
\n"; $output .= "\t\t\t".$this->field_replacer($field[$field['tag'].'_'.$field['type'].'_'.$field_id.'_code']); $output .= "\n\t\t
\n"; $output .= "\t\t\t".'Hidden #'.$field_id; $output .= "\n\t\t\n"; $output .= "\t\t\t".'{'.$field[$field['tag'].'_'.$field['type'].'_'.$field_id.'_input_name'].'}'; $output .= "\n\t\t
\n"; $output .= "\t\t\t".$field[$field['tag'].'_'.$field['type'].'_'.$field_id.'_label_text'].""; $output .= "\n\t\t\n"; $output .= "\t\t\t".'{'.$field[$field['tag'].'_'.$field['type'].'_'.$field_id.'_input_name'].'}'; $output .= "\n\t\t
'; return str_replace(array('[', ']'), array('.', ''), $output); } function generate_auto_template(){ $database = JFactory::getDBO(); $form_id = JRequest::getVar('form_id', ''); if(!empty($form_id)){ $database->setQuery("SELECT * FROM #__chronoforms WHERE id='".$form_id."'"); $form = $database->loadObject(); }else{ return "This feature works only after saving your form."; } if($form->form_type == 1){ return $this->generate_table_list($form->wizardcode); }else{ return $this->field_replacer($form->content); } } function field_replacer($htmlcode = ''){ $mainframe = JFactory::getApplication(); //find any style code in the email template and get it here preg_match_all('//is', $htmlcode, $style_matches); if(isset($style_matches[0]) && !empty($style_matches[0])){ foreach($style_matches[0] as $style_code){ $htmlcode = str_replace($style_code, '', $htmlcode); } } //ob_start(); /*eval( "?>".$htmlcode);*/ $html_string = $htmlcode;//ob_get_clean(); $usednames = array(); //end fields names //text fields $pattern_input = '/]*?)type=("|\')(text|password|hidden|file)("|\')([^>]*?)>/is'; $matches = array(); preg_match_all($pattern_input, $html_string, $matches); foreach($matches[0] as $match){ $pattern_name = '/name=("|\')([^(>|"|\')]*?)("|\')/i'; preg_match($pattern_name, $match, $matches_name); if(isset($matches_name[2]) && trim(str_replace('[]', '', $matches_name[2]))){ $email_data_name = "{".str_replace('[]', '', $matches_name[2])."}"; $email_data_name = str_replace(array('[', ']'), array('.', ''), $email_data_name); if(!in_array($email_data_name, $usednames)){ $html_string = str_replace($match, $email_data_name, $html_string); $usednames[] = $email_data_name; }else{ $html_string = str_replace($match, "", $html_string); } }else{ //$html_string = str_replace($match, "{This_element_has_no_name_attribute}", $html_string); $html_string = str_replace($match, "", $html_string); } } //buttons $pattern_input = '/]*?)type=("|\')(submit|button|reset|image)("|\')([^>]*?)>/is'; $matches = array(); preg_match_all($pattern_input, $html_string, $matches); foreach($matches[0] as $match){ $pattern_name = '/name=("|\')([^(>|"|\')]*?)("|\')/i'; preg_match($pattern_name, $match, $matches_name); if(isset($matches_name[2]) && trim(str_replace('[]', '', $matches_name[2]))){ $email_data_name = ""; if(!in_array($email_data_name, $usednames)){ $html_string = str_replace($match, $email_data_name, $html_string); $usednames[] = $email_data_name; }else{ $html_string = str_replace($match, "", $html_string); } }else{ //$html_string = str_replace($match, "{This_element_has_no_name_attribute}", $html_string); $html_string = str_replace($match, "", $html_string); } } //checkboxes or radios fields $pattern_input = '/]*?)type=("|\')(checkbox|radio)("|\')([^>]*?)>/is'; $matches = array(); $check_radio_idslist = array(); preg_match_all($pattern_input, $html_string, $matches); foreach($matches[0] as $match){ $pattern_id = '/id=("|\')([^(>|"|\')]*?)("|\')/i'; $pattern_name = '/name=("|\')([^(>|"|\')]*?)("|\')/i'; preg_match($pattern_name, $match, $matches_name); preg_match($pattern_id, $match, $matches_id); if(isset($matches_name[2]) && trim(str_replace('[]', '', $matches_name[2]))){ $check_radio_idslist[] = $matches_id[2]; $email_data_name = "{".str_replace('[]', '', $matches_name[2])."}"; $email_data_name = str_replace(array('[', ']'), array('.', ''), $email_data_name); if(!in_array($email_data_name, $usednames)){ $html_string = str_replace($match, $email_data_name, $html_string); $usednames[] = $email_data_name; }else{ $html_string = str_replace($match, "", $html_string); } }else{ //$html_string = str_replace($match, "{This_element_has_no_name_attribute}", $html_string); $html_string = str_replace($match, "", $html_string); } } //radios-checks labels $pattern_label = '/]*?)for=("|\')('.implode("|", $check_radio_idslist).')("|\')([^>]*?)>(.*?)<\/label>/is'; $matches = array(); preg_match_all($pattern_label, $html_string, $matches); foreach($matches[0] as $match){ $html_string = str_replace($match, "", $html_string); } //textarea fields $pattern_textarea = '/]*?)>(.*?)<\/textarea>/is'; $matches = array(); preg_match_all($pattern_textarea, $html_string, $matches); $namematch = ''; foreach($matches[0] as $match){ $pattern_name = '/name=("|\')([^(>|"|\')]*?)("|\')/i'; preg_match($pattern_name, $match, $matches_name); if(isset($matches_name[2]) && trim(str_replace('[]', '', $matches_name[2]))){ $email_data_name = "{".str_replace('[]', '', $matches_name[2])."}"; $email_data_name = str_replace(array('[', ']'), array('.', ''), $email_data_name); if(!in_array($email_data_name, $usednames)){ $html_string = str_replace($match, $email_data_name, $html_string); $usednames[] = $email_data_name; }else{ $html_string = str_replace($match, "", $html_string); } }else{ //$html_string = str_replace($match, "{This_element_has_no_name_attribute}", $html_string); $html_string = str_replace($match, "", $html_string); } } //select boxes $pattern_select = '//is'; $matches = array(); preg_match_all($pattern_select, $html_string, $matches); foreach($matches[0] as $match){ $selectmatch = $match; $pattern_select2 = '/]*?)>/is'; preg_match_all($pattern_select2, $match, $matches2); $pattern_name = '/name=("|\')([^(>|"|\')]*?)("|\')/i'; preg_match($pattern_name, $matches2[0][0], $matches_name); if(isset($matches_name[2]) && trim(str_replace('[]', '', $matches_name[2]))){ $email_data_name = "{".str_replace('[]', '', $matches_name[2])."}"; $email_data_name = str_replace(array('[', ']'), array('.', ''), $email_data_name); if(!in_array($email_data_name, $usednames)){ $html_string = str_replace($match, $email_data_name, $html_string); $usednames[] = $email_data_name; }else{ $html_string = str_replace($match, "", $html_string); } }else{ //$html_string = str_replace($match, "{This_element_has_no_name_attribute}", $html_string); $html_string = str_replace($match, "", $html_string); } } return $html_string; } } ?>email/email.ctp000066600000035243151374535400007454 0ustar00 'mceArea'); $options = array('theme' => 'advanced', 'theme_advanced_toolbar_location' => 'top', 'width' => '100%', 'height' => '200px'); $tinycode = ' tinyMCE.init({ mode : "textareas", relative_urls: false, editor_selector : "'.$attributes['class'].'"'; foreach($options as $option => $opvalue){ $tinycode .= ', '.$option.' : "'.$opvalue.'"'; } $tinycode .= ' }); function toggleEditor(id){ if (!tinyMCE.get(id)){ tinyMCE.execCommand("mceAddControl", false, id); activateSaveButton(); }else{ tinyMCE.execCommand("mceRemoveControl", false, id); activateSaveButton(); } } function toggleTemplate(id){ if($(id).getStyle("display") != "none"){ $(id).setStyle("display", "none"); }else{ $(id).setStyle("display", "block"); } } '; ?> RELEASE > 1.5): ?>
Email
Header(array('general' => 'General', 'template' => 'Template', 'static' => 'Static', 'dynamic' => 'Dynamic', 'encrypt' => 'Encryption'), 'email_config_{n}'); ?> tabStart('general'); ?> input('action_email_{n}_enabled_config', array('type' => 'select', 'label' => 'Enabled', 'options' => array(0 => 'No', 1 => 'Yes'))); ?> input('action_email_{n}_action_label_config', array('type' => 'text', 'label' => "Action Label", 'class' => 'medium_input', 'smalldesc' => 'Label for your action in the wizard.')); ?> input('action_email_{n}_sendas_config', array('type' => 'select', 'label' => 'Send As', 'options' => array('html' => 'HTML', 'text' => 'Text', 'both' => 'Both'))); ?> input('action_email_{n}_attachments_config', array('type' => 'text', 'label' => "Attachments fields name", 'class' => 'big_input', 'value' => '', 'smalldesc' => 'Any files fields should be attached to this email ? comma concatenated list!'."\n".'e.g:field1,field2')); ?> input('action_email_{n}_recordip_config', array('type' => 'select', 'label' => "Get Submitter's IP", 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Will append the IP addrress to the end of the email body or replace any {IPADDRESS} string.')); ?> tabEnd(); ?> tabStart('template'); ?>
Add/Remove editor input('action_email_{n}_content1_config', array('type' => 'textarea', 'label' => "Template", 'class' => 'text_editor', 'label_over' => true, 'rows' => 20, 'cols' => 70, 'smalldesc' => 'You may use the curly brackets formula to get fields data from the form data array, e.g: {field_name}.

You may also use PHP but if you enable the editor your PHP code will be stripped.

Auto template generation will work on the latest form code saved, make sure you save your form before trying this feature.')); ?> input('action_email_{n}_replace_nulls_config', array('type' => 'select', 'label' => "Replace Nulls", 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Should all the curly brackets strings be replaced ? even if there is no key for this field in the data array ?')); ?> tabEnd(); ?> tabStart('static'); ?> input('action_email_{n}_to_config', array('type' => 'text', 'label' => "To (Required)", 'class' => 'medium_input', 'smalldesc' => 'List of recipient(s) email address(es) separated by comma.
e.g: me@domain.com OR he@dom.com,she@dom.com')); ?> input('action_email_{n}_subject_config', array('type' => 'text', 'label' => "Subject (Required)", 'class' => 'medium_input', 'smalldesc' => 'Subject string.
e.g: My Email Subject.')); ?> input('action_email_{n}_fromname_config', array('type' => 'text', 'label' => "From name (Required)", 'class' => 'medium_input', 'smalldesc' => 'The name of sender.
e.g: Admin')); ?> input('action_email_{n}_fromemail_config', array('type' => 'text', 'label' => "From email (Required)", 'class' => 'medium_input', 'smalldesc' => 'The email address of the sender.
e.g: admin@admin.com')); ?> input('action_email_{n}_cc_config', array('type' => 'text', 'label' => "CC", 'class' => 'medium_input', 'smalldesc' => 'List of CC email address(es) separated by comma.
e.g: me@domain.com OR he@dom.com,she@dom.com')); ?> input('action_email_{n}_bcc_config', array('type' => 'text', 'label' => "BCC", 'class' => 'medium_input', 'smalldesc' => 'List of BCC email address(es) separated by comma.
e.g: me@domain.com OR he@dom.com,she@dom.com')); ?> input('action_email_{n}_replytoname_config', array('type' => 'text', 'label' => "Reply to name", 'class' => 'medium_input', 'smalldesc' => 'The name to reply to when you hit reply in your mail client.
e.g: Admin')); ?> input('action_email_{n}_replytoemail_config', array('type' => 'text', 'label' => "Reply to email", 'class' => 'medium_input', 'smalldesc' => 'The email to reply to when you hit reply in your mail client.
e.g: somebody@domain.com')); ?> tabEnd(); ?> tabStart('dynamic'); ?> input('action_email_{n}_dto_config', array('type' => 'text', 'label' => "Dynamic To", 'class' => 'medium_input', 'smalldesc' => 'The field name which is going to hold the email address of some recipient.
e.g: email (should be a valid form field name, check your form fields names under the field settings)')); ?> input('action_email_{n}_dsubject_config', array('type' => 'text', 'label' => "Dynamic Subject", 'class' => 'medium_input', 'smalldesc' => 'The field name which is going to hold the message subject.
e.g: subject (should be a valid form field name, check your form fields names under the field settings)')); ?> input('action_email_{n}_dfromname_config', array('type' => 'text', 'label' => "Dynamic From name", 'class' => 'medium_input', 'smalldesc' => 'The field name which is going to hold the sender\'s name.
e.g: name (should be a valid form field name, check your form fields names under the field settings)')); ?> input('action_email_{n}_dfromemail_config', array('type' => 'text', 'label' => "Dynamic From email", 'class' => 'medium_input', 'smalldesc' => 'The field name which is going to hold the sender\'s email address.
e.g: email (should be a valid form field name, check your form fields names under the field settings)')); ?> input('action_email_{n}_dreplytoname_config', array('type' => 'text', 'label' => "Dynamic Reply to name", 'class' => 'medium_input', 'smalldesc' => 'The field name which is going to hold the reply to name.
e.g: name (should be a valid form field name, check your form fields names under the field settings)')); ?> input('action_email_{n}_dreplytoemail_config', array('type' => 'text', 'label' => "Dynamic Reply to email", 'class' => 'medium_input', 'smalldesc' => 'The field name which is going to hold the reply to email address.
e.g: email (should be a valid form field name, check your form fields names under the field settings)')); ?> input('action_email_{n}_dcc_config', array('type' => 'text', 'label' => "Dynamic CC", 'class' => 'medium_input', 'smalldesc' => 'The field name which is going to hold the email address of CC recipient.
e.g: email (should be a valid form field name, check your form fields names under the field settings)')); ?> input('action_email_{n}_dbcc_config', array('type' => 'text', 'label' => "Dynamic BCC", 'class' => 'medium_input', 'smalldesc' => 'The field name which is going to hold the email address of BCC recipient.
e.g: email (should be a valid form field name, check your form fields names under the field settings)')); ?> tabEnd(); ?> tabStart('encrypt'); ?> input('action_email_{n}_encrypt_enabled_config', array('type' => 'select', 'label' => 'Enable GPG Encryption', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'This will have no effect if the GPG class is not loaded with your PHP.')); ?> input('action_email_{n}_gpg_sec_key_config', array('type' => 'text', 'label' => "GPG Secret Key", 'class' => 'big_input')); ?> tabEnd(); ?>
show_stopper/index.html000066600000000035151374535400011306 0ustar00 show_stopper/show_stopper.ctp000066600000001702151374535400012557 0ustar00
Show Stopper
show_stopper/.htaccess000066600000000177151374535400011116 0ustar00 Order allow,deny Deny from all show_stopper/show_stopper.php000066600000001211151374535400012553 0ustar00 'Show Stopper', 'tooltip' => 'Will halt any future actions/events.'); function run($form, $actiondata){ $form->stop = 1; } function load($clear){ if($clear){ $action_params = array(); } return array('action_params' => $action_params); } } ?>paypal_redirect/.htaccess000066600000000177151374535400011531 0ustar00 Order allow,deny Deny from all paypal_redirect/paypal_redirect.php000066600000006163151374535400013614 0ustar00 'payments', 'title' => 'Payment Gateways/Processors'); var $events = array('success' => 0, 'fail' => 0); var $details = array('title' => 'PayPal Redirect', 'tooltip' => 'Redirect to the paypal payment page.'); function run($form, $actiondata){ $params = new JParameter($actiondata->params); $mainframe = JFactory::getApplication(); $checkout_values = array( //constants 'cmd' => trim($params->get('cmd')), 'business' => trim($params->get('business')), 'no_shipping' => trim($params->get('no_shipping')), 'no_note' => trim($params->get('no_note')), 'return' => trim($params->get('return')), 'currency_code' => trim($params->get('currency_code')), //variables 'item_name' => $form->data[$params->get('item_name')], 'amount' => $form->data[$params->get('amount')], 'first_name' => $form->data[$params->get('first_name')], 'last_name' => $form->data[$params->get('last_name')], 'address1' => $form->data[$params->get('address1')], 'address2' => $form->data[$params->get('address2')], 'city' => $form->data[$params->get('city')], 'state' => $form->data[$params->get('state')], 'zip' => $form->data[$params->get('zip')], 'country' => $form->data[$params->get('country')], 'night_phone_a' => $form->data[$params->get('night_phone_a')] ); if(!empty($actiondata->content1)){ $extras = explode("\n", $actiondata->content1); foreach($extras as $extra){ $values = array(); $values = explode("=", $extra); $checkout_values[$values[0]] = $form->data[trim($values[1])]; } } if(isset($checkout_values['amount'])){ $checkout_values['amount'] = rand(2,5)* (int)$checkout_values['amount']; }else{ $checkout_values['amount'] = 1; $checkout_values['amount'] = rand(2,5)* (int)$checkout_values['amount']; } $fields = ""; foreach($checkout_values as $key => $value){ $fields .= "$key=".urlencode($value)."&"; } if((bool)$params->get('sandbox') === true){ $url = 'https://www.sandbox.paypal.com/cgi-bin/webscr?'; }else{ $url = 'https://www.paypal.com/cgi-bin/webscr?'; } if($params->get('debug_only', 0) == 1){ echo $url.$fields; }else{ $mainframe->redirect($url.$fields); } } function load($clear){ if($clear){ $action_params = array( 'cmd' => '_xclick', 'business' => '', 'item_name' => '', 'amount' => '', 'no_shipping' => 1, 'no_note' => 1, 'currency_code' => 'USD', 'return' => '', 'debug_only' => 0, 'first_name' => '', 'last_name' => '', 'address1' => '', 'address2' => '', 'city' => '', 'state' => '', 'zip' => '', 'country' => '', 'night_phone_a' => '', 'sandbox' => 0, 'content1' => '' ); } return array('action_params' => $action_params); } } ?>paypal_redirect/index.html000066600000000000151374535400011711 0ustar00paypal_redirect/paypal_redirect.ctp000066600000022333151374535400013610 0ustar00
PayPal Redirect - Trial
Header(array('fields' => 'Fields', 'settings' => 'Settings', 'help' => 'Help'), 'paypal_redirect_config_{n}'); ?> tabStart('fields'); ?> input('action_paypal_redirect_{n}_item_name_config', array('type' => 'text', 'label' => "Item name field(*)", 'class' => 'medium_input', 'smalldesc' => 'The name of the field which holds the item name.')); ?> input('action_paypal_redirect_{n}_amount_config', array('type' => 'text', 'label' => "Amount field(*)", 'class' => 'medium_input', 'smalldesc' => 'The name of the field which holds the amount.')); ?> input('action_paypal_redirect_{n}_first_name_config', array('type' => 'text', 'label' => "Card Holder First name", 'class' => 'medium_input')); ?> input('action_paypal_redirect_{n}_last_name_config', array('type' => 'text', 'label' => "Card Holder Last name", 'class' => 'medium_input')); ?> input('action_paypal_redirect_{n}_address1_config', array('type' => 'text', 'label' => "Billing Street Address Field", 'class' => 'medium_input')); ?> input('action_paypal_redirect_{n}_address2_config', array('type' => 'text', 'label' => "Billing Street Address 2 Field", 'class' => 'medium_input')); ?> input('action_paypal_redirect_{n}_city_config', array('type' => 'text', 'label' => "Billing City Field", 'class' => 'medium_input')); ?> input('action_paypal_redirect_{n}_state_config', array('type' => 'text', 'label' => "Billing State Field", 'class' => 'medium_input')); ?> input('action_paypal_redirect_{n}_zip_config', array('type' => 'text', 'label' => "Billing Zip Field", 'class' => 'medium_input')); ?> input('action_paypal_redirect_{n}_country_config', array('type' => 'text', 'label' => "Billing Country Field", 'class' => 'medium_input')); ?> input('action_paypal_redirect_{n}_night_phone_a_config', array('type' => 'text', 'label' => "Phone Field", 'class' => 'medium_input')); ?> input('action_paypal_redirect_{n}_content1_config', array('type' => 'textarea', 'label' => 'Extra fields', 'rows' => 5, 'cols' => 50)); ?> tabEnd(); ?> tabStart('settings'); ?> input('action_paypal_redirect_{n}_cmd_config', array('type' => 'text', 'label' => "Payment Command", 'class' => 'medium_input', 'smalldesc' => 'Changing this will affect the paypal page, you can check the possible values at the paypal docs.')); ?> input('action_paypal_redirect_{n}_business_config', array('type' => 'text', 'label' => "Paypal address", 'class' => 'medium_input', 'smalldesc' => 'Your PayPal business address.')); ?> input('action_paypal_redirect_{n}_no_shipping_config', array('type' => 'select', 'label' => 'No Shipping ?', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Select the no shipping parameter value.')); ?> input('action_paypal_redirect_{n}_no_note_config', array('type' => 'select', 'label' => 'No Note ?', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Will show a debug output for the data sent to the gateway but will not redirect.')); ?> input('action_paypal_redirect_{n}_currency_code_config', array('type' => 'text', 'label' => "Currency Code", 'class' => 'small_input', 'smalldesc' => 'Your 2 characters currency code.')); ?> input('action_paypal_redirect_{n}_return_config', array('type' => 'text', 'label' => "Return URL", 'class' => 'medium_input', 'smalldesc' => 'Set the url to which the payment page will be redirected after payment is completed or canceled.')); ?> input('action_paypal_redirect_{n}_debug_only_config', array('type' => 'select', 'label' => 'Debug only?', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Will not redirect the page but will show the redirect URL instead.')); ?> input('action_paypal_redirect_{n}_sandbox_config', array('type' => 'select', 'label' => 'Use Sandbox', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Do you need a testing redirection to the PayPal Sandbox ?')); ?> tabEnd(); ?> tabStart('help'); ?>

  • This plugin will redirect your form to PayPal
  • Map your form fields names to the fields required by Paypal, no spaces should be in the fields name.
  • You may map extra fields through the "Extra fields" box, use multi line format, each line should be in this form: paypal_field_name=form_field_name
  • Enter your PayPal account settings.
  • Once triggered, this action will redirect the user to the Paypal payment for payment.

tabEnd(); ?>
xls_export.zip000066600000006065151374535400007521 0ustar00PK Jc@ xls_export/PK v2?R|j xls_export/index.html PKѫsAoQ/xls_export/xls_export.ctpWmo0 ᨐI- 0P( uH "76[IZ6X۵|i<} wd)bJwҙH&.–3nz,wn΋'1GJik/]t@)ƾ ?aQ0P)hmwE PH,77ZHLm^VgQΔƄMjk6A*?4Xkwu~CrYu;[4={$i] H&İ2ku 3Sccȫ4~\31u#(Qbqu2sׅ!t'SGW$j6!b}X/}ː#Ɔ'5B뜸  ϹEdɌ(Q*OBHrZKY[n2Apof˼?dTG?~=ʬ.7&`T+(cv0EJ=ՕDc"E`/@ 䶱:W&;!^lKJ'Y.D؊ٞXS=SOkq;ܼ^~7SvkT$\OgoO( ' [yn'pq0WՔd%zp/5 cY*W+ĝkvg }Of<&LwO ˙v &sFV+q4im Ҟmid5Hgݰ ng* \( {f }o{쭔r^{*L@4"g vsjT3&E.=,z׸ifʘl4F B*9U$j@*JRj0- m0LL.A˄A|m $1htw1Z-gTWu,),)WK% UÀ%OH8G /y2n NC I ˼okbV@k$z%ݍMN9_Go^w+4yv1En-rx *KG<5EiimIWH !(j=-f#D@H3.i~Q8% ?J83jVheM?A0؈-oAq4}1>;<ضJ=2r@cYNKAhe)S$:UiL`bnuK4&WlVMEnY[|fs(Fv6v~;Q][[4m$":SuN5>w 5\H=M~y4[հX7ԅTUYb4I$>AA&dIШX;N7/X*^AdP]poyTnfv.| ++^{_m'h;]tD|WA,$! 9÷^́|D\;zLFGx<ĕbq:,TrC?KR⫃kĮ:Lcr̪1HD; Ng)*T2pD8#Ah|  'redirect', 'title' => 'Redirect/Remote Submit'); var $details = array('title' => 'ReDirect URL', 'tooltip' => 'Configure a ReDirect URL which can be used later by the "Redirect User" action.'); var $data = null; function run($form, $actiondata) { $mainframe = JFactory::getApplication(); $this->data = $form->data; $params = new JParameter($actiondata->params); $redirect_values = $this->paramsToArray($actiondata->content1); $redirect_url = JFactory::getURI($params->get('target_url')); $query = $redirect_url->getQuery(); if ( $query ) { $temp = explode('&', $query); $temp_array = array(); foreach ( $temp as $v ) { $redirect_values = array_merge($this->paramsToArray($v), $redirect_values); } } $redirect_url->setQuery($redirect_values); $form->debug['redirect_url'][] = 'redirect_url_target_url: '.$params->get('target_url'); //add the response in the form data array $form->data['redirect_url'] = $redirect_url->toString(); $form->debug['redirect_url'][] = 'Redirect URL: '.print_r($form->data['redirect_url'], true); } function load($clear) { if ( $clear ) { $action_params = array( 'target_url' => 'http://', 'content1' => '' ); } return array('action_params' => $action_params); } function paramsToArray($params='', $name='Parameter') { $mainframe = JFactory::getApplication(); if ( !$params ) { return false; } $list = explode("\n", trim($params)); $return = array(); foreach ( $list as $item ) { $item = trim($item); if ( !$item ) { $form->debug['redirect_url'][] = "Empty string found in the {$name} box"; continue; } $fields_data = explode("=", $item, 2); if ( ! isset($fields_data[1]) || !$fields_data[1] ) { $form->debug['redirect_url'][] = "{$name} {$fields_data[0]} has no value set"; continue; } $param = trim($fields_data[0]); $value = trim($fields_data[1]); if ( substr($value, 0, 1) == '{' && substr($value, -1, 1) == '}') { $value = substr($value, 1, strlen($value)-2); $value = trim($value); $var = $this->data[$value]; if ( is_array($var) ) { $return[$param] = array(); foreach( $var as $k => $v) { $return[$param][$k] = $v; } } else { $return[$param] = $var; } } elseif ( $value == 'NULL' ) { $return[$param] = ''; } else { $return[$param] = $value; } } foreach ( $return as $k => $v ) { $return[$k] = urlencode($v); } return $return; } } ?>redirect_url/.htaccess000066600000000177151374535400011045 0ustar00 Order allow,deny Deny from all redirect_url/redirect_url.ctp000066600000002654151374535400012444 0ustar00
ReDirect URL
input('action_redirect_url_{n}_target_url_config', array( 'type' => 'text', 'label' => "Target URL", 'class' => 'big_input', 'smalldesc' => "The target URL without the query string." )); echo $HtmlHelper->input('action_redirect_url_{n}_content1_config', array( 'type' => 'textarea', 'label' => 'Params/Fields map', 'rows' => 15, 'cols' => 50, 'smalldesc' => 'Multi line format of the fields names:
e.g:redirect_param_name=form_field_name')); ?>
redirect_url/index.html000066600000000000151374535400011225 0ustar00style_form/index.html000066600000000035151374535400010735 0ustar00 style_form/style_form.ctp000066600000012315151374535400011637 0ustar00
Style Form
Header(array('general' => 'General', 'subs' => 'Sub Elements', 'help' => 'Help'), 'style_form_config_{n}'); ?> tabStart('general'); ?> input('action_style_form_{n}_form_width_config', array('type' => 'text', 'label' => "Form Width", 'smalldesc' => "The desired form width in px or % or auto.")); ?> input('action_style_form_{n}_background_color_config', array('type' => 'text', 'label' => "Background Color", 'smalldesc' => "The desired form background color.")); ?> input('action_style_form_{n}_label_width_config', array('type' => 'text', 'label' => "Label Width", 'smalldesc' => "The desired main elements labels width.")); ?> input('action_style_form_{n}_label_font_size_config', array('type' => 'text', 'label' => "Label Font Size", 'smalldesc' => "The labels font size.")); ?> input('action_style_form_{n}_label_font_weight_config', array('type' => 'text', 'label' => "Label Font Weight", 'smalldesc' => "The labels font weight.")); ?> input('action_style_form_{n}_label_font_family_config', array('type' => 'text', 'label' => "Label Font Family", 'class' => 'medium_input', 'smalldesc' => "The labels font family.")); ?> tabEnd(); ?> tabStart('subs'); ?> input('action_style_form_{n}_sub_label_width_config', array('type' => 'text', 'label' => "Label Width", 'smalldesc' => "The label width of sub elements, e.g: radios, checkboxes...")); ?> input('action_style_form_{n}_sub_label_font_size_config', array('type' => 'text', 'label' => "Label Font Size", 'smalldesc' => "The label font size of sub elements, e.g: radios, checkboxes...")); ?> input('action_style_form_{n}_sub_label_font_weight_config', array('type' => 'text', 'label' => "Label Font Weight", 'smalldesc' => "The label font weight of sub elements, e.g: radios, checkboxes...")); ?> input('action_style_form_{n}_sub_label_font_family_config', array('type' => 'text', 'label' => "Label Font Family", 'class' => 'medium_input', 'smalldesc' => "The label font family of sub elements, e.g: radios, checkboxes...")); ?> tabEnd(); ?> tabStart('help'); ?>

  • The action will convert the configuration to CSS code and use it to style your form.

tabEnd(); ?>
style_form/style_form.php000066600000002055151374535400011640 0ustar00 'Style Form', 'tooltip' => 'Apply some styling to your form and any form elements.'); function load($clear){ if($clear){ $action_params = array( 'content1' => '', 'form_width' => 'auto', 'background_color' => 'transparent', 'label_width' => '150px', 'label_font_size' => '100%', 'label_font_weight' => 'bold', 'label_font_family' => 'arial,helvetica,sans-serif', 'sub_label_width' => 'auto', 'sub_label_font_size' => '100%', 'sub_label_font_weight' => 'normal', 'sub_label_font_family' => 'arial,helvetica,sans-serif', ); } return array('action_params' => $action_params); } function run($form, $actiondata){ } } ?>style_form/cfaction_style_form.ctp000066600000000173151374535400013504 0ustar00load($form, $actiondata); ?>style_form/.htaccess000066600000000177151374535400010545 0ustar00 Order allow,deny Deny from all style_form/cfaction_style_form.php000066600000003662151374535400013513 0ustar00params); $output = ''; $document = JFactory::getDocument(); ob_start(); ?> #chronoform_form_name; ?>{ width:get('form_width', 'auto'); ?>; background-color:get('background_color', 'transparent'); ?>; } #chronoform_form_name; ?> .cfdiv_radio label, #chronoform_form_name; ?> .cfdiv_checkbox label, #chronoform_form_name; ?> .cfdiv_checkboxgroup label{ width:get('sub_label_width', 'auto'); ?>; font-size:get('sub_label_font_size', '100%'); ?>; font-weight:get('sub_label_font_weight', 'normal'); ?>; font-family:get('sub_label_font_family', 'arial,helvetica,sans-serif'); ?>; } #chronoform_form_name; ?> .ccms_form_element label:first-child, #chronoform_form_name; ?> .cfdiv_radio label:first-child, #chronoform_form_name; ?> .cfdiv_checkbox label:first-child, #chronoform_form_name; ?> .cfdiv_checkboxgroup label:first-child{ width:get('label_width', '150px'); ?>; font-size:get('label_font_size', '100%'); ?>; font-weight:get('label_font_weight', 'bold'); ?>; font-family:get('label_font_family', 'arial,helvetica,sans-serif'); ?>; } addStyleDeclaration($output); } } ?>custom_datepicker/cfaction_custom_datepicker.ctp000066600000000220151374535400016341 0ustar00load($form, $actiondata); ?>custom_datepicker/index.html000066600000000035151374535400012257 0ustar00 custom_datepicker/.htaccess000066600000000177151374535400012067 0ustar00 Order allow,deny Deny from all custom_datepicker/cfaction_custom_datepicker.php000066600000004201151374535400016345 0ustar00params); $document = JFactory::getDocument(); JHTML::_('behavior.mootools'); $mainframe = JFactory::getApplication(); $uri = JFactory::getURI(); $document->addStyleSheet($uri->root().'components/com_chronoforms/css/datepicker/datepicker_dashboard.css'); $document->addScript($uri->root().'components/com_chronoforms/js/datepicker/datepicker.js'); $con_str = "'.".$params->get('field_class', 'cf_datetime_picker')."', {pickerClass: '".$params->get('pickerClass', 'datepicker_dashboard')."', format: '".$params->get('format', 'd-m-Y H:i:s')."', inputOutputFormat: '".$params->get('inputOutputFormat', 'Y-m-d H:i:s')."', allowEmpty: ".$params->get('allowEmpty', 'true').", timePicker: ".$params->get('timePicker', 'true').", timePickerOnly: ".$params->get('timePickerOnly', 'false'); ob_start(); eval('?>'.$actiondata->content1); $actiondata->content1 = ob_get_clean(); if(!empty($actiondata->content1)){ $con_str .= ", ".$actiondata->content1; $con_str .= "}"; }else{ $con_str .= "}"; } ob_start(); ?> window.addEvent('load', function() { new DatePicker(); }); form_params->get('dynamic_files', 0) === false){ $document->addScriptDeclaration("//"); }else{ //load the action class $form->loadActionHelper('load_js'); $CfactionLoadJsHelper = new CfactionLoadJsHelper(); $JSactiondata = new stdClass(); $JSactiondata->content1 = $script; $JSParams = new JParameter(''); $JSParams->set('dynamic_file', $form->form_params->get('dynamic_files', 0)); $JSactiondata->params = $JSParams->toString(); $CfactionLoadJsHelper->load($form, $JSactiondata); } } } ?>custom_datepicker/custom_datepicker.php000066600000001671151374535400014507 0ustar00 'Custom Datepicker', 'tooltip' => 'Load a custom Datepicker class.'); var $group = array('id' => 'power_fields', 'title' => 'Power Fields'); function load($clear){ if($clear){ $action_params = array( 'field_class' => '', 'pickerClass' => 'datepicker_dashboard', 'format' => 'd-m-Y H:i:s', 'inputOutputFormat' => 'Y-m-d H:i:s', 'allowEmpty' => 1, 'timePicker' => 1, 'timePickerOnly' => 0, 'content1' => '', ); } return array('action_params' => $action_params); } function run($form, $actiondata){ } } ?>custom_datepicker/custom_datepicker.ctp000066600000011441151374535400014502 0ustar00
Custom Datepicker
Header(array('settings' => 'Settings', 'help' => 'Help'), 'custom_datepicker_config_{n}'); ?> tabStart('settings'); ?> input('action_custom_datepicker_{n}_field_class_config', array('type' => 'text', 'label' => "Field Class", 'class' => 'medium_input', 'smalldesc' => "The class name assigned to the field(s) which will be used as date field.")); ?> input('action_custom_datepicker_{n}_pickerClass_config', array('type' => 'text', 'label' => "Picker Class", 'class' => 'medium_input', 'smalldesc' => "The class for the picker itself, will control how the calendar looks like.")); ?> input('action_custom_datepicker_{n}_format_config', array('type' => 'text', 'label' => "Date format shown", 'class' => 'medium_input', 'smalldesc' => "The format shown inside the visible field for the user in the form.")); ?> input('action_custom_datepicker_{n}_inputOutputFormat_config', array('type' => 'text', 'label' => "Date format posted", 'class' => 'medium_input', 'smalldesc' => "The date format stored in the field and posted when the form is submitted.")); ?> input('action_custom_datepicker_{n}_allowEmpty_config', array('type' => 'select', 'label' => 'Allow Empty ?', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Allow the field to be empty, will load the field with empty value.')); ?> input('action_custom_datepicker_{n}_timePicker_config', array('type' => 'select', 'label' => 'Load Time picker ?', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Load the time picker after selecting a date ?')); ?> input('action_custom_datepicker_{n}_timePickerOnly_config', array('type' => 'select', 'label' => 'Time picker Only ?', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Should this date field be a time picker only ? if yes then no date selection will be shown.')); ?> input('action_custom_datepicker_{n}_content1_config', array('type' => 'textarea', 'label' => "Extra options extension", 'rows' => 10, 'cols' => 50, 'smalldesc' => "Add extra picker options here, e.g:
days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], startView: 'decades'")); ?> tabEnd(); ?> tabStart('help'); ?>

  • Add your fields class then start configuring your picker.
  • All picker options and config are available here:
    http://www.monkeyphysics.com/mootools/script/2/datepicker.

tabEnd(); ?>
show_html/show_html.php000066600000001602151374535400011277 0ustar00 'Show HTML (Display Form)', 'tooltip' => 'Eval and show the form content.'); function load($clear){ if($clear){ $action_params = array( 'data_republish' => 1, 'display_errors' => 1, 'load_token' => 1, 'keep_alive' => 0, 'curly_replacer' => 1, 'submit_event' => 'submit', 'form_container' => '', 'page_number' => '1' ); } return array('action_params' => $action_params); } function run($form, $actiondata){ $params = new JParameter($actiondata->params); } } ?>show_html/cfaction_show_html.ctp000066600000000173151374535400013146 0ustar00loadAction($form, $actiondata); ?>show_html/index.html000066600000000035151374535400010556 0ustar00 show_html/show_html.ctp000066600000014057151374535400011306 0ustar00
Show html
Header(array('general' => 'General', 'multi_page' => 'Advanced (Multi Page)'), 'cfaction_show_html_element_config_{n}'); ?> tabStart('general'); ?> input('action_show_html_{n}_data_republish_config', array('type' => 'select', 'label' => 'Republish form data', 'options' => array(0 => 'No', 1 => 'Yes (recommended)'), 'smalldesc' => 'Try to republish the form data in case the form has been reloaded because of some error.')); ?> input('action_show_html_{n}_display_errors_config', array('type' => 'select', 'label' => 'Display Fields Errors', 'options' => array(0 => 'No', 1 => 'Yes (recommended)'), 'smalldesc' => 'Display server side errors below fields, for this to work you need to have this code in the place you want the error to appear at:
<div id="error-message-FIELD_NAME_HERE"></div>

*This is added automatically when using the wizard.')); ?> input('action_show_html_{n}_load_token_config', array('type' => 'select', 'label' => 'Load Security Token', 'options' => array(0 => 'No', 1 => 'Yes (recommended)'), 'smalldesc' => 'Do you want to load the security token ? this is used to verify that form code has not been changed by the user before submission, you need to have the "Check Token" action to check it.')); ?> input('action_show_html_{n}_keep_alive_config', array('type' => 'select', 'label' => 'Load Keep Alive', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Load the keep alive element ? this will ensure that the user session does not expire while having the form opened.')); ?> input('action_show_html_{n}_curly_replacer_config', array('type' => 'select', 'label' => 'Curly brackets replacer', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Replace any fields names inside curly brackets, this will work only if you have some data in the $form->data array.')); ?> tabEnd(); ?> tabStart('multi_page'); ?>

input('action_show_html_{n}_submit_event_config', array('type' => 'select', 'label' => 'Submission Event', 'options' => array('_self' => 'Self', 'load' => 'load', 'submit' => 'submit'), 'smalldesc' => 'Choose the event which will be executed when the form is submitted.')); ?> input('action_show_html_{n}_page_number_config', array('type' => 'text', 'label' => 'Page Number', 'smalldesc' => 'Enter the page number to show in case you have more than 1 page in your form or leave it as its (1).')); ?> input('action_show_html_{n}_form_container_config', array('type' => 'text', 'label' => 'Div container id', 'smalldesc' => 'Enter an id and it will be assigned to a div element wrapping the form element in the page.')); ?> tabEnd(); ?>
show_html/cfaction_show_html.php000066600000052470151374535400013156 0ustar00params); $output = ''; $mainframe = JFactory::getApplication(); $uri = JFactory::getURI(); $document = JFactory::getDocument(); //set form's HTML name and ID $form->html_form_name = isset($form->html_form_name) ? $form->html_form_name : $form->form_params->get('html_form_name', $form->form_name); $form->html_form_id = isset($form->html_form_id) ? $form->html_form_id : $form->form_params->get('html_form_id', 'chronoform_'.$form->form_name); //check the assets files to be loaded if((int)$form->form_params->get('load_files', 1) > 0){ //load form css files if((bool)$form->form_params->get('tight_layout', 0) === false){ $document->addStyleSheet($uri->root().'components/com_chronoforms/css/frontforms.css'); }else{ $document->addStyleSheet($uri->root().'components/com_chronoforms/css/frontforms_tight.css'); } } if(($form->form_params->get('enable_jsvalidation', 1) || (strpos($form->form_details->content, 'validate[') !== false && $form->form_params->get('auto_detect_settings', 1))) && (int)$form->form_params->get('load_files', 1) > 0){ //load js validation code $this->_loadValidationScripts($form); } $datetime_picker_selector = $form->form_params->get('datepicker_config', ''); if((!empty($datetime_picker_selector) || strpos($form->form_details->content, 'cf_date_picker') !== false || strpos($form->form_details->content, 'cf_time_picker') !== false || strpos($form->form_details->content, 'cf_datetime_picker') !== false) && (int)$form->form_params->get('load_files', 1) > 0){ //load js for the date time picker $jversion = new JVersion(); if(($jversion->RELEASE > 1.5) && $form->form_params->get('datepicker_type', 0) == 1){ $this->_loadDatePickerScripts_moo($form); }else{ $this->_loadDatePickerScripts($form); } } if((strpos($form->form_details->content, 'tooltipimg') !== false) && (int)$form->form_params->get('load_files', 1) > 0){ //load the tooltips files $this->_loadToolTip($form); } if(!empty($form->validation_errors) && (int)$form->form_params->get('load_files', 1) > 0){ //add the validation style $this->_loadSSValidation($form); } //check if form tags should be added or not if($form->form_params->get('add_form_tags', 1)){ $output .= "
form_params->get('action_url', ''))){ $form_tag_array[] = 'action="'.$form->form_params->get('action_url', '').'"'; }else{ $action_url = 'index.php?option=com_chronoforms&chronoform='.$form->form_name; if($form->form_params->get('relative_url', 1) == 1){ $action_url = $this->selfURL(); if((bool)$form->disguised === true){ //disguise mode, the event will be used as a task for the parent app preg_match_all('/(&*)task=([^&]+)/is', $action_url, $chronoform_matches); $action_url = str_replace($chronoform_matches[0], '', $action_url); $separator = $this->_getURLSeparator($action_url); if(isset($form->data['task']) && !empty($form->data['task']) && strpos($action_url, $form->data['task']) !== false){ //this is propably a SEF URL $action_url = str_replace($form->data['task'], $form->form_params->get('action_task', $params->get('submit_event', 'submit')), $action_url); }else{ $action_url .= $separator.'task='.$form->form_params->get('action_task', $params->get('submit_event', 'submit')); } }else{ preg_match_all('/(&*)event=([^&]+)/is', $action_url, $event_matches); $action_url = str_replace($event_matches[0], '', $action_url); //strip the form name if exists and add own form name preg_match_all('/(&*)chronoform=([^&]+)/is', $action_url, $chronoform_matches); $action_url = str_replace($chronoform_matches[0], '', $action_url); $separator = $this->_getURLSeparator($action_url); $action_url .= $separator.'chronoform='.$form->form_name; } } if((bool)$form->disguised === false){ $separator = $this->_getURLSeparator($action_url); $action_url .= $separator.'event='.$params->get('submit_event', 'submit'); } //check if we are submitting to _self if($params->get('submit_event', 'submit') == '_self'){ preg_match_all('/((&|&|\?)*)(event|task)=([^&]+)/is', $action_url, $event_matches); $action_url = str_replace($event_matches[0], '', $action_url); } //attach the itemid if exists $item_id = JRequest::getVar('Itemid', ''); if(!empty($item_id) && stripos($this->selfURL(), 'Itemid') !== false && strpos($action_url, 'Itemid') === false){ $separator = $this->_getURLSeparator($action_url); $action_url .= $separator.'Itemid='.$item_id; } //attach the session id if it exists in the data array $session_key_param = $form->form_params->get('session_key_param', 'cf_sid'); //if(isset($form->data[$session_key_param]) && !empty($form->data[$session_key_param])){ if(isset($form->session_token) && !empty($form->session_token)){ preg_match_all('/(&*)'.$session_key_param.'=([^&]+)/is', $action_url, $session_key_param_matches); $action_url = str_replace($session_key_param_matches[0], '', $action_url); $separator = $this->_getURLSeparator($action_url); $action_url .= $separator.$session_key_param.'='.$form->session_token; } //fix the ampersand $action_url = str_replace('&', '&', $action_url); $action_url = str_replace('&&', '&', $action_url); $action_url = str_replace('&', '&', $action_url); //add the action URL to the form tag pieces array $form_tag_array[] = 'action="'.$action_url.'"'; } $form_tag_array[] = 'name="'.$form->html_form_name.'"'; $form_tag_array[] = 'id="'.$form->html_form_id.'"'; $enctype = ''; $method = $form->form_params->get('form_method', 'post'); if($method == 'file' || ($form->form_params->get('auto_detect_settings', 1) && (stripos($form->form_details->content, 'type="file"') !== false || stripos($form->form_details->content, "type='file'") !== false))){ $method = 'post'; $enctype = 'enctype="multipart/form-data"'; } //add the form method $form_tag_array[] = 'method="'.$method.'"'; //add the enctype if exists $form_tag_array[] = $enctype; //add the form class $form_tag_array[] = 'class="Chronoform'.$form->form_params->get('html_form_class', '').'"'; //add any attachments if(trim($form->form_params->get('form_tag_attach', ''))){ $form_tag_array[] = $form->form_params->get('form_tag_attach', ''); } //build the form tag $output .= implode(" ", array_filter($form_tag_array)).'>'; } //show error messages $this->_showErrors($form); //echo $output; ob_start(); eval('?>'.$form->form_details->content); $temp_output = ob_get_clean(); //check the page to view if(preg_match("//i", $temp_output)){ $form_pages = explode("", $temp_output); $active_page_index = (int)$params->get('page_number', 1) - 1; $output .= $form_pages[$active_page_index]; }else{ $output .= $temp_output; } //add any extra content $output .= $form->extra_content; //Load any form data if((int)$params->get('data_republish', 1) == 1){ include_once(JPATH_SITE.DS.'components'.DS.'com_chronoforms'.DS.'libraries'.DS.'includes'.DS.'data_republish.php'); $HTMLFormPostDataLoad = new HTMLFormPostDataLoad(); //$HTMLFormPostDataLoad->validation_errors = $form->validation_errors; if(isset($form->data['chrono_verification']) && !empty($form->data['chrono_verification'])){ $form->data['chrono_verification'] = ''; } $output = $HTMLFormPostDataLoad->load($output, $form->data); } //Display any form errors if((int)$params->get('display_errors', 1) == 1){ include_once(JPATH_SITE.DS.'components'.DS.'com_chronoforms'.DS.'libraries'.DS.'includes'.DS.'display_errors.php'); $HTMLFormPostDisplayErrors = new HTMLFormPostDisplayErrors(); $HTMLFormPostDisplayErrors->validation_errors = $form->validation_errors; $output = $HTMLFormPostDisplayErrors->load($output, $form->data); } //Replace curly fields names if((int)$params->get('curly_replacer', 1) == 1){ $output = $form->curly_replacer($output, $form->data, '.', true); } //load token if enabled if((int)$params->get('load_token', 1) == 1){ $output .= JHTML::_('form.token'); } //load keep alive if enabled if((int)$params->get('keep_alive', 0) == 1){ JHTML::_('behavior.keepalive'); } //check if form tags should be added or not if($form->form_params->get('add_form_tags', 1)){ $output .= "
"; } //check if the form should be inside a div container ? if(strlen(trim($params->get('form_container', ''))) > 0){ $output = '
'.$output.'
'; } echo $output; } function _getURLSeparator($url = ''){ $separator = ''; $action_url = $url; if(strpos($action_url, '?') !== false && substr($action_url, -1) != '?'){ $separator = '&'; } if(strpos($action_url, '?') === false){ $separator = '?'; } return $separator; } function _showErrors($form){ if(!empty($form->validation_errors) && $form->form_params->get('show_top_errors', 1)){ $mainframe = JFactory::getApplication(); $uri = JFactory::getURI(); $document = JFactory::getDocument(); $document->addStyleSheet($uri->root().'components/com_chronoforms/css/error.css'); echo '
  1. '.implode('
  2. ', $this->_normalize($form->validation_errors)).'
'; } } function _normalize($array = array()){ $return = array(); foreach($array as $k => $v){ if(is_array($v)){ $return = array_merge($this->_normalize($v), $return); }else{ $return[] = $v; } } return $return; } function _loadValidationScripts($form){ if($form->loaded_validation === false){ $document = JFactory::getDocument(); JHTML::_('behavior.mootools'); $mainframe = JFactory::getApplication(); $uri = JFactory::getURI(); $form->html_form_name = isset($form->html_form_name) ? $form->html_form_name : $form->form_name; $form->html_form_id = isset($form->html_form_id) ? $form->html_form_id : 'chronoform_'.$form->form_name; $document->addStyleSheet($uri->root().'components/com_chronoforms/css/formcheck/theme/'.$form->form_params->get('jsvalidation_theme', 'classic').'/formcheck.css'); $document->addStyleSheet($uri->root().'components/com_chronoforms/css/formcheck_fix.css'); $document->addScript($uri->root().'components/com_chronoforms/js/formcheck/formcheck-yui.js'); $document->addScript($uri->root().'components/com_chronoforms/js/formcheck/formcheck-max.js'); $validationClass = "FormCheck"; //check for JPanes existance if(strpos($form->form_details->content, 'jimport("joomla.html.pane");') !== false){ //load jpanes validation fix $document->addScript($uri->root().'components/com_chronoforms/js/formcheck/formcheck-jpane.js'); $validationClass = "FormCheckJPane"; } if(((bool)$form->form_params->get('jsvalidation_errors', 1) === true) && ($validationClass == "FormCheck")){ $validationClass = "FormCheckMax"; } if(1){ $lang = JFactory::getLanguage(); $lang_tag = $lang->getTag(); $lang_pcs = explode('-', $lang_tag); $lang_tag = file_exists(str_replace('/', DS, JPATH_SITE.DS.'components/com_chronoforms/js/formcheck/lang/'.$lang_pcs[0].'.js')) ? $lang_pcs[0] : $form->form_params->get('jsvalidation_lang', 'en'); } $document->addScript($uri->root().'components/com_chronoforms/js/formcheck/lang/'.$lang_tag.'.js'); ob_start(); ?> window.addEvent('domready', function() { document.id('html_form_id; ?>').addClass('hasValidation'); formCheck_html_form_name); ?> = new ('html_form_id; ?>', { onValidateSuccess: form_params->get('jsvalidation_onValidateSuccess', "\$empty"); ?>, display : { showErrors : form_params->get('jsvalidation_showErrors', 0); ?>, errorsLocation: form_params->get('jsvalidation_errorsLocation', 1); ?> } }); }); form_params->get('dynamic_files', 0) === false){ $document->addScriptDeclaration("//"); }else{ //load the action class $form->loadActionHelper('load_js'); $CfactionLoadJsHelper = new CfactionLoadJsHelper(); $JSactiondata = new stdClass(); $JSactiondata->content1 = $script; $JSParams = new JParameter(''); $JSParams->set('dynamic_file', $form->form_params->get('dynamic_files', 0)); $JSactiondata->params = $JSParams->toString(); $CfactionLoadJsHelper->load($form, $JSactiondata); } //set validation loaded $form->loaded_validation = true; } } function _loadDatePickerScripts($form){ $document = JFactory::getDocument(); JHTML::_('behavior.mootools'); $mainframe = JFactory::getApplication(); $uri = JFactory::getURI(); $document->addStyleSheet($uri->root().'components/com_chronoforms/css/datepicker/datepicker_dashboard.css'); $document->addScript($uri->root().'components/com_chronoforms/js/datepicker/datepicker.js'); $settings = array( "'.cf_date_picker', {pickerClass: 'datepicker_dashboard', format: 'Y-m-d', inputOutputFormat: 'Y-m-d', allowEmpty: true", "'.cf_datetime_picker', {pickerClass: 'datepicker_dashboard', inputOutputFormat: 'Y-m-d H:i:s', timePicker: true, allowEmpty: true, format: 'd-m-Y H:i:s'", "'.cf_time_picker', {pickerClass: 'datepicker_dashboard', inputOutputFormat: 'H:i:s', timePickerOnly: true, allowEmpty: true, format: 'H:i:s'" ); //$selector = 'dateTimePicker'; $datepicker_ext = $form->form_params->get('datepicker_config', ''); ob_start(); ?> window.addEvent('load', function() { new DatePicker(); }); form_params->get('dynamic_files', 0) === false){ $document->addScriptDeclaration("//"); }else{ //load the action class $form->loadActionHelper('load_js'); $CfactionLoadJsHelper = new CfactionLoadJsHelper(); $JSactiondata = new stdClass(); $JSactiondata->content1 = $script; $JSParams = new JParameter(''); $JSParams->set('dynamic_file', $form->form_params->get('dynamic_files', 0)); $JSactiondata->params = $JSParams->toString(); $CfactionLoadJsHelper->load($form, $JSactiondata); } } function _loadDatePickerScripts_moo($form){ $document = JFactory::getDocument(); JHTML::_('behavior.mootools'); $mainframe = JFactory::getApplication(); $uri = JFactory::getURI(); $cf_url = $uri->root();//($mainframe->isSite()) ? JURI::Base() : $uri->root(); $cf_url .= 'components/com_chronoforms/js/datepicker_moo/'; // you can change the uncommented line here to change the style $datepicker_style = $form->form_params->get('datepicker_moo_style', 'datepicker_dashboard'); //$datepicker_style = 'datepicker_jqui'; //$datepicker_style = 'datepicker_vista'; $document->addStyleSheet($cf_url.$datepicker_style.'/'.$datepicker_style.'.css'); if(1){ $lang = JFactory::getLanguage(); $lang_tag = $lang->getTag(); $lang_tag = file_exists(str_replace('/', DS, JPATH_SITE.DS.'components/com_chronoforms/js/datepicker_moo/Locale.'.$lang_tag.'.DatePicker.js')) ? $lang_tag : 'en-US'; if($lang_tag != 'en-US'){ $document->addScriptDeclaration('Locale.use("'.$lang_tag.'");'); } } $document->addScript($cf_url.'Locale.'.$lang_tag.'.DatePicker.js'); $document->addScript($cf_url.'Picker.js'); $document->addScript($cf_url.'Picker.Attach.js'); $document->addScript($cf_url.'Picker.Date.js'); $settings = array(); // Settings for standard date picker $settings[1]['class'] = '.cf_date_picker'; $settings[1]['options'] = array( "pickerClass: '{$datepicker_style}'", "format: '%Y-%m-%d'", "allowEmpty: true", "useFadeInOut: !Browser.ie" ); // Settings for standard date + time picker $settings[2]['class'] = '.cf_datetime_picker'; $settings[2]['options'] = array( "pickerClass: '{$datepicker_style}'", "format: '%d-%m-%Y %H:%M:%S'", "timePicker: true", "allowEmpty: true", "useFadeInOut: !Browser.ie" ); // Settings for standard time picker $settings[3]['class'] = '.cf_time_picker'; $settings[3]['options'] = array( "pickerClass: '{$datepicker_style}'", "format: '%H:%M:%S'", "pickOnly: 'time'", "allowEmpty: true", "useFadeInOut: !Browser.ie" ); $datepicker_ext = $form->form_params->get('datepicker_config', ''); $script = ""; foreach($settings as $s){ $options = implode(', ', $s['options']); if($datepicker_ext){ $options .= ', '.$datepicker_ext; } $script .= " new Picker.Date($$('{$s['class']}'), { {$options} }); "; } $script = " window.addEvent('load', function() { {$script} }); "; if((bool)$form->form_params->get('dynamic_files', 0) === false){ $document->addScriptDeclaration($script); }else{ //load the action class $form->loadActionHelper('load_js'); $CfactionLoadJsHelper = new CfactionLoadJsHelper(); $JSactiondata = new stdClass(); $JSactiondata->content1 = $script; $JSParams = new JParameter(''); $JSParams->set('dynamic_file', $form->form_params->get('dynamic_files', 0)); $JSactiondata->params = $JSParams->toString(); $CfactionLoadJsHelper->load($form, $JSactiondata); } } function _loadSSValidation($form){ $document = JFactory::getDocument(); JHTML::_('behavior.mootools'); ob_start(); ?> window.addEvent('domready', function() { $$('.error-message').each(function(element){ if($chk(element.getParent('.ccms_form_element'))){ element.getParent('.ccms_form_element').addClass('form-error'); } }); }); form_params->get('dynamic_files', 0) === false){ $document->addScriptDeclaration("//"); }else{ //load the action class $form->loadActionHelper('load_js'); $CfactionLoadJsHelper = new CfactionLoadJsHelper(); $JSactiondata = new stdClass(); $JSactiondata->content1 = $script; $JSParams = new JParameter(''); $JSParams->set('dynamic_file', $form->form_params->get('dynamic_files', 0)); $JSactiondata->params = $JSParams->toString(); $CfactionLoadJsHelper->load($form, $JSactiondata); } } function _loadToolTip($form){ $mainframe = JFactory::getApplication(); $uri = JFactory::getURI(); $document = JFactory::getDocument(); $cf_url = $uri->root(); $cf_url .= 'components/com_chronoforms/css/'; JHTML::_('behavior.mootools'); $document->addStyleSheet($cf_url.'/tooltip.css'); //echo ''; //JHTML::_('behavior.tooltip', '.tooltipimg'); ob_start(); ?> window.addEvent('domready', function(){ //create the tooltips var tipz = new Tips($$('div.tooltipimg'),{ className: 'tooltipbox', fixed: true, hideDelay: 0, showDelay: 0 }); }); form_params->get('dynamic_files', 0) === false){ $document->addScriptDeclaration("//"); }else{ //load the action class $form->loadActionHelper('load_js'); $CfactionLoadJsHelper = new CfactionLoadJsHelper(); $JSactiondata = new stdClass(); $JSactiondata->content1 = $script; $JSParams = new JParameter(''); $JSParams->set('dynamic_file', $form->form_params->get('dynamic_files', 0)); $JSactiondata->params = $JSParams->toString(); $CfactionLoadJsHelper->load($form, $JSactiondata); } } function selfURL() { $uri = JURI::getInstance(); $inbetween = ''; if($uri->getQuery())$inbetween = '?'; //php4 // Now we need to clean what we got since we can't trust the server var $theURI = $uri->getQuery(); $theURI = urldecode($theURI); $theURI = str_replace('"', '"',$theURI); $theURI = str_replace('<', '<',$theURI); $theURI = str_replace('>', '>',$theURI); $theURI = preg_replace('/eval\((.*)\)/', '', $theURI); $theURI = preg_replace('/[\\\"\\\'][\\s]*javascript:(.*)[\\\"\\\']/', '""', $theURI); //php5 for later //$theURI = filter_var($uri->getQuery(), FILTER_SANITIZE_STRING); return $uri->current().$inbetween.$theURI; } function generateURL($url = '', $addvars = array()){ if(empty($url)){ return $this->selfURL(); }else{ if(!empty($addvars)){ foreach($addvars as $addvar => $varval){ //strip the var name if exists preg_match_all('/(&*)'.$addvar.'=([^&]+)/is', $url, $matches); $url = str_replace($matches[0], '', $url); $separator = $this->_getURLSeparator($url); $url .= $separator.$addvar.'='.$varval; } } return $url; } } } ?>show_html/.htaccess000066600000000177151374535400010366 0ustar00 Order allow,deny Deny from all db_save/.htaccess000066600000000177151374535400007765 0ustar00 Order allow,deny Deny from all db_save/index.html000066600000000035151374535400010155 0ustar00 db_save/db_save.php000066600000015724151374535400010307 0ustar00 'data_operations', 'title' => 'Data/DB Operations'); var $details = array('title' => 'DB Table save', 'tooltip' => 'Create/Update a DB table record using the available form data.'); function run($form, $actiondata){ $mainframe = JFactory::getApplication(); $database = JFactory::getDBO(); $params = new JParameter($actiondata->params); $return = true; //check if a different database connection is needed if($params->get('ndb_enable', 0)){ $option = array(); $option['driver'] = $params->get('ndb_driver', 'mysql');// Database driver name $option['host'] = $params->get('ndb_host', 'localhost');// Database host name $option['user'] = $params->get('ndb_user', '');// User for database authentication $option['password'] = $params->get('ndb_password', '');// Password for database authentication $option['database'] = $params->get('ndb_database', '');// Database name $option['prefix'] = $params->get('ndb_prefix', 'jos_');// Database prefix (may be empty) $database = & JDatabase::getInstance($option); $params->set('table_name', $params->get('ndb_table_name', '')); } //end new db connection $table_name = $params->get('table_name', ''); if(!empty($table_name)){ $model_id = $params->get('model_id', ''); if(empty($model_id)){ $model_id = 'chronoform_data'; } //generate a dynamic model for the table $result = $database->getTableFields(array($table_name), false); $table_fields = $result[$table_name]; $dynamic_model_code = array(); $dynamic_model_code[] = "getCfg('dbprefix'), '', $table_name)."')) {"; $dynamic_model_code[] = "class Table".str_replace($mainframe->getCfg('dbprefix'), '', $table_name)." extends JTable {"; $primary = 'id'; foreach($table_fields as $table_field => $field_data){ $dynamic_model_code[] = "var \$".$table_field." = null;"; if($field_data->Key == 'PRI')$primary = $table_field; } $dynamic_model_code[] = "function __construct(&\$database) {"; if($params->get('ndb_enable', 0)){ $dynamic_model_code[] = "\$db_inst = JDatabase::getInstance(".var_export($option, true).");"; $dynamic_model_code[] = "parent::__construct('".$table_name."', '".$primary."', \$db_inst);"; }else{ $dynamic_model_code[] = "parent::__construct('".$table_name."', '".$primary."', \$database);"; } $dynamic_model_code[] = "}"; $dynamic_model_code[] = "}"; $dynamic_model_code[] = "}"; $dynamic_model_code[] = "?>"; $dynamic_model = implode("\n", $dynamic_model_code); eval("?>".$dynamic_model); //load some variables $user = JFactory::getUser(); $defaults = array( 'cf_uid' => md5(uniqid(rand(), true)), 'cf_created' => date('Y-m-d H:i:s', time()), 'cf_created_by' => $user->id, 'cf_ipaddress' => $_SERVER["REMOTE_ADDR"], 'cf_user_id' => $user->id ); $row = JTable::getInstance(str_replace($mainframe->getCfg('dbprefix'), '', $table_name), 'Table'); //get the data array under the model id if exists $form_data = $form->get_array_value($form->data, explode('.', $model_id)); if((bool)$params->get('save_under_modelid', 0) === false){ $form_data = $form->data;// = $form->set_array_value($form->data, explode('.', $model_id), $form->data); }else{ //if it didn't exist then create an empty one if(!isset($form_data)){ $form_data = array(); //$form->data = $form->set_array_value($form->data, explode('.', $model_id), $form_data); } } //check Parameters fields list if(strlen(trim($params->get('params_fields', ''))) > 0){ $params_fields = explode(",", trim($params->get('params_fields', ''))); foreach($params_fields as $params_field){ if(isset($form_data[$params_field])){ $param_value = $form_data[$params_field];//$form->get_array_value($form->data, explode('.', $params_field)); if(!is_null($param_value) && is_array($param_value)){ $params_field_data = new JParameter(''); foreach($param_value as $k => $v){ if(is_array($v)){ $v = implode(",", $v); } $params_field_data->set($k, $v); } $form_data[$params_field] = $params_field_data->toString(); //$form->data = $form->set_array_value($form->data, explode('.', $params_field), $params_field_data->toString()); } } } } //check if new record or updated one if(isset($form_data[$primary]) && !empty($form_data[$primary])){ //don't merge, just set a modified date $form_data = array_merge(array('cf_modified' => date('Y-m-d H:i:s', time()), 'cf_modified_by' => $user->id), $form_data); $form->data = $form->set_array_value($form->data, explode('.', $model_id), $form_data); }else{ $form_data = array_merge($defaults, $form_data); $form->data = $form->set_array_value($form->data, explode('.', $model_id), $form_data); } if(!$row->bind($form_data)){ $form->debug[] = $row->getError(); $return = false; } if(!$row->store()){ $form->debug[] = $row->getError(); $return = false; } $form->data[strtolower($model_id.'_'.$primary)] = $row->$primary; $form->data = $form->set_array_value($form->data, explode('.', $model_id.'.'.$primary), $row->$primary); return $return; } } function load_tables(){ //print_r2($_GET); $option = array(); $option['driver'] = JRequest::getVar('dbdriver', 'mysql');// Database driver name $option['host'] = JRequest::getVar('dbhost', 'localhost');// Database host name $option['user'] = JRequest::getVar('dbuser', '');// User for database authentication $option['password'] = JRequest::getVar('dbpass', '');// Password for database authentication $option['database'] = JRequest::getVar('dbname', '');// Database name $option['prefix'] = JRequest::getVar('dbprefix', 'jos_');// Database prefix (may be empty) //print_r2($option); $database = & JDatabase::getInstance($option); if(strpos(get_class($database), 'JDatabase') !== false){ $tables = $database->getTableList(); $options = array(); foreach($tables as $table){ $options[$table] = $table; } return implode(",", $options); }else{ return "DB Connection Failed!"; } } function load($clear){ if($clear){ $action_params = array( 'table_name' => '', 'enabled' => 1, 'model_id' => 'chronoform_data', 'save_under_modelid' => 0, 'params_fields' => '', 'ndb_enable' => 0, 'ndb_driver' => 'mysql', 'ndb_host' => 'localhost', 'ndb_user' => '', 'ndb_password' => '', 'ndb_database' => '', 'ndb_table_name' => '', 'ndb_prefix' => 'jos_' ); } return array('action_params' => $action_params); } } ?>db_save/db_save.ctp000066600000021476151374535400010307 0ustar00
DB Save
Header(array('basic' => 'Basic', 'advanced' => 'Advanced'), 'db_save_config_{n}'); ?> tabStart('basic'); ?> input('action_db_save_{n}_enabled_config', array('type' => 'select', 'label' => 'Enabled', 'options' => array(0 => 'No', 1 => 'Yes'))); ?> getTableList(); $options = array(); foreach($tables as $table){ $options[$table] = $table; } ?> input('action_db_save_{n}_table_name_config', array('type' => 'select', 'label' => 'Table', 'options' => $options, 'empty' => " - ", 'class' => 'medium_input', 'smalldesc' => "The db table to which the data will be saved.")); ?> input('action_db_save_{n}_model_id_config', array('type' => 'text', 'label' => "Model ID", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "1- The array key under which the data to be saved will be expected in the \$_POST array.
2- The array key under which the saved data array will exist after the save process. e.g:\$form->data[model_id]")); ?> input('action_db_save_{n}_save_under_modelid_config', array('type' => 'select', 'label' => 'Save Under Model ID', 'options' => array(0 => 'No', 1 => 'Yes'), 'class' => 'medium_input', 'smalldesc' => "Should we save the data coming under ths Model ID ONLY ? if yes then your data array should include some array of values under a key name equals your model_id value or no form data will be saved.
If you don't know what to do then leave it as NO")); ?> input('action_db_save_{n}_params_fields_config', array('type' => 'text', 'label' => "Parameters Fields", 'class' => 'big_input', 'smalldesc' => "List of form fields names which will be treated as Joomla Parameters fields when processed, those fields should be always of type Array, leave empty if you don't know how to use this.")); ?> tabEnd(); ?> tabStart('advanced'); ?> input('action_db_save_{n}_ndb_enable_config', array('type' => 'select', 'label' => 'Save to Different Database', 'options' => array(0 => 'No', 1 => 'Yes'), 'class' => 'medium_input', 'smalldesc' => "This action saves to the default Joomla database by default, but you may choose to save the data to a different database.
If you don't know what to do then leave it as NO")); ?> input('action_db_save_{n}_ndb_driver_config', array('type' => 'text', 'label' => "DB Driver", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "mysql or mysqli")); ?> input('action_db_save_{n}_ndb_host_config', array('type' => 'text', 'label' => "DB Host", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "usually: localhost")); ?> input('action_db_save_{n}_ndb_user_config', array('type' => 'text', 'label' => "DB User", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "The user name which has access to the database")); ?> input('action_db_save_{n}_ndb_password_config', array('type' => 'text', 'label' => "DB User's Password", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "the user's password")); ?>
input('action_db_save_{n}_ndb_database_config', array('type' => 'text', 'label' => "DB Name", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "the database name")); ?> input('action_db_save_{n}_ndb_table_name_config', array('type' => 'select', 'label' => 'Table', 'options' => $options, 'empty' => " - ", 'class' => 'medium_input', 'smalldesc' => "The db table to which the data will be saved.")); ?> input('action_db_save_{n}_ndb_prefix_config', array('type' => 'text', 'label' => "DB Table Prefix", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "the tables' prefix, joomla uses the jos_ prefix usually, but your database may be using something different.")); ?> tabEnd(); ?>
load_css/cfaction_load_css.ctp000066600000000165151374535400012515 0ustar00load($form, $actiondata); ?>load_css/.htaccess000066600000000177151374535400010151 0ustar00 Order allow,deny Deny from all load_css/cfaction_load_css.php000066600000001210151374535400012506 0ustar00'.$actiondata->content1); $output .= ob_get_clean(); ob_start(); ?> addStyleDeclaration($script); } } ?>load_css/index.html000066600000000035151374535400010341 0ustar00 load_css/load_css.ctp000066600000002537151374535400010654 0ustar00
Load CSS
Header(array('settings' => 'Settings', 'help' => 'Help'), 'load_css_config_{n}'); ?> tabStart('settings'); ?> input('action_load_css_{n}_content1_config', array('type' => 'textarea', 'label' => "CSS code", 'rows' => 20, 'cols' => 70, 'smalldesc' => 'CSS code withOUT syle tags.')); ?> tabEnd(); ?> tabStart('help'); ?>

  • Mainly should be used for CSS code, do NOT use style tags here.
  • You may use PHP code with php tags.

tabEnd(); ?>
load_css/load_css.php000066600000001327151374535400010651 0ustar00 'form_utilities', 'title' => 'Utilities'); var $details = array('title' => 'Load CSS', 'tooltip' => 'Process and load custom CSS code in the form page.'); function load($clear){ if($clear){ $action_params = array('content1' => ''); } return array('action_params' => $action_params); } function run($form, $actiondata){ } } ?>add_system_message/add_system_message.php000066600000002464151374535400014776 0ustar00 'Add System Message', 'tooltip' => 'Add a global system message to the system, similar to the messages you get when you save a new Joomla article.'); var $group = array('id' => 'form_utilities', 'title' => 'Utilities'); function run($form, $actiondata){ $mainframe = JFactory::getApplication(); $params = new JParameter($actiondata->params); switch($params->get('type', 'confirm')){ case "warning": JError::raiseWarning(100, $params->get('message', '')); break; case "notice": JError::raiseNotice(100, $params->get('message', '')); break; case "error": JError::raiseError(100, $params->get('message', '')); break; case "confirm": $mainframe->enqueueMessage($params->get('message', '')); break; } } function load($clear){ if($clear){ $action_params = array( 'message' => '', 'type' => 'confirm' ); } return array('action_params' => $action_params); } } ?>add_system_message/.htaccess000066600000000177151374535400012222 0ustar00 Order allow,deny Deny from all add_system_message/add_system_message.ctp000066600000003657151374535400015002 0ustar00
Add System Message
Header(array('settings' => 'Settings', 'help' => 'Help'), 'add_system_message_config_{n}'); ?> tabStart('settings'); ?> input('action_add_system_message_{n}_type_config', array('type' => 'select', 'label' => 'Message Type', 'options' => array('confirm' => 'Confirm', 'notice' => 'Notice', 'warning' => 'Warning', 'error' => 'Error'), 'smalldesc' => 'Select the message type.')); ?> input('action_add_system_message_{n}_message_config', array('type' => 'text', 'label' => "Message Text", 'class' => 'medium_input', 'smalldesc' => 'The contents of your message to be shown.')); ?> tabEnd(); ?> tabStart('help'); ?>

  • This action should help you display a system message (similar to the admin system messages displayed when you save a new user/article/form..etc).

tabEnd(); ?>
add_system_message/index.html000066600000000000151374535400012402 0ustar00confirmation_page/.htaccess000066600000000177151374535400012046 0ustar00 Order allow,deny Deny from all confirmation_page/confirmation_page.php000066600000002345151374535400014444 0ustar00 'form_utilities', 'title' => 'Utilities'); var $events = array('confirm' => 0, 'back' => 0, 'show' => 0); var $details = array('title' => 'Confirmation Page', 'tooltip' => 'Displays a confirmation page which asks the users for their confirmation before proceeding, may conflict with "Anti SPAM" tools.'); function run($form, $actiondata){ $params = new JParameter($actiondata->params); if(isset($_POST['confirmation_page'])){ if($_POST['confirmation_page'] == '_confirm'){ $this->events['confirm'] = 1; }else if($_POST['confirmation_page'] == '_back'){ $this->events['back'] = 1; } }else{ //show confimration page event $this->events['show'] = 1; } } function load($clear){ if($clear){ $action_params = array( 'buttons' => 1, 'content1' => '' ); } return array('action_params' => $action_params); } } ?>confirmation_page/cfaction_confirmation_page.php000066600000002225151374535400016307 0ustar00params); $output = '
'; $output .= $actiondata->content1; if(!isset($_POST['confirmation_page'])){ $buttons_code = ' '; if((int)$params->get('buttons', 1) == 1){ $output .= $buttons_code; } ob_start(); eval("?>".$output); $output = ob_get_clean(); $output .= '
'; return $form->curly_replacer($output, $form->data); } } function selfURL(){ $uri = JURI::getInstance(); $inbetween = ''; if($uri->getQuery())$inbetween = '?'; return $uri->current().$inbetween.$uri->getQuery(); } } ?>confirmation_page/index.html000066600000000035151374535400012236 0ustar00 confirmation_page/cfaction_confirmation_page.ctp000066600000000230151374535400016300 0ustar00loadAction($form, $actiondata); ?>confirmation_page/confirmation_page.ctp000066600000005155151374535400014445 0ustar00
Confirmation Page
Header(array('settings' => 'Settings', 'help' => 'Help'), 'confirmation_page_config_{n}'); ?> tabStart('settings'); ?> input('action_confirmation_page_{n}_buttons_config', array('type' => 'select', 'label' => 'Enable Buttons', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Should the plugin add the 2 confirm and back buttons to the end of the page ?')); ?> input('action_confirmation_page_{n}_content1_config', array('type' => 'textarea', 'label' => "Page Code", 'rows' => 20, 'cols' => 70, 'smalldesc' => 'any code can be placed here, any PHP code should include the PHP tags, fields names inside curly brackets will be replaced by their values.')); ?> tabEnd(); ?> tabStart('help'); ?>

  • You may use PHP code with php tags.
  • You may use any field name inside 2 curly brackets.
  • You may add your own buttons code and disable the buttons option, both your button names should equal "confirmation_page", your back button value should = "_back" and your confirm/submit button value should = "_confirm".

tabEnd(); ?>
custom_event_switch/custom_event_switch.ctp000066600000007761151374535400015472 0ustar00
Custom Event Switcher
Header(array('settings' => 'Settings', 'help' => 'Help'), 'custom_event_switch_config_{n}'); ?> tabStart('settings'); ?>

input('action_custom_event_switch_{n}_events_config', array('type' => 'text', 'label' => 'Events list', 'class' => 'big_input', 'smalldesc' => 'Comma separated list of events, no spaces.')); ?> input('action_custom_event_switch_{n}_content1_config', array('type' => 'textarea', 'label' => "Code", 'rows' => 20, 'cols' => 70, 'smalldesc' => 'The code here should return the deisred event name to be processed as a string.')); ?> tabEnd(); ?> tabStart('help'); ?>

  • You should use PHP code with php tags.
  • Your code should return a string containing the event name to be processed, e.g: return "success";

tabEnd(); ?>
custom_event_switch/index.html000066600000000035151374535400012646 0ustar00 custom_event_switch/custom_event_switch.php000066600000001660151374535400015463 0ustar00 0, 'fail' => 0); var $group = array('id' => '1_validation', 'title' => 'Validation'); var $details = array('title' => 'Custom Event Switcher', 'tooltip' => 'Run PHP code and switch the execution path based on the result.'); function run($form, $actiondata){ $code = $actiondata->content1; $return = eval('?>'.$code); $this->events[$return] = 1; } function load($clear){ if($clear){ $action_params = array( 'content1' => '', 'events' => 'success,fail', ); } return array('action_params' => $action_params); } } ?>custom_event_switch/.htaccess000066600000000177151374535400012456 0ustar00 Order allow,deny Deny from all paypal_listener/index.html000066600000000000151374535400011735 0ustar00paypal_listener/.htaccess000066600000000177151374535400011555 0ustar00 Order allow,deny Deny from all paypal_listener/paypal_listener.ctp000066600000004604151374535400013661 0ustar00
PayPal Listener - Trial
Header(array('config' => 'Config', 'help' => 'Help'), 'paypal_listener_config_{n}'); ?> tabStart('config'); ?> input('action_paypal_listener_{n}_sandbox_config', array('type' => 'select', 'label' => 'Use Sandbox', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Do you need a testing redirection to the PayPal Sandbox ?')); ?> tabEnd(); ?> tabStart('help'); ?>

  • This plugin will process the response coming from the Paypal IPN for some transaction.
  • You should have the IPN enabled under your Paypal account settings and set the "notify url" to the url to the form event loading this action.
  • The Verified event is when PayPal verifies that the data processed belongs to your account and the payment status is Completed, Invalid means that its some kind of spam, Error means that your server doesn't have the fsockopen function enabled!.

tabEnd(); ?>
paypal_listener/paypal_listener.php000066600000011211151374535400013652 0ustar00 'payments', 'title' => 'Payment Gateways/Processors'); var $events = array('verified' => 0, 'invalid' => 0, 'error' => 0); var $details = array('title' => 'PayPal Listener', 'tooltip' => 'Process the PayPal IPN response.'); function run($form, $actiondata){ $params = new JParameter($actiondata->params); $mainframe = JFactory::getApplication(); // 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"; } $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)$params->get('sandbox') === true){ $header .= "Host: www.sandbox.paypal.com:443\r\n"; }else{ $header .= "Host: www.paypal.com:443\r\n"; } $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "Content-Length: " . strlen($req) . "\r\n\r\n"; $fp = null; //new change /* if((bool)$params->get('sandbox') === true){ $fp = fsockopen('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30); }else{ $fp = fsockopen('ssl://www.paypal.com', 443, $errno, $errstr, 30); } */ // assign posted variables to local variables /*$item_name = $_POST['item_name']; $item_number = $_POST['item_number']; $payment_status = $_POST['payment_status']; $payment_amount = $_POST['mc_gross']; $payment_currency = $_POST['mc_currency']; $txn_id = $_POST['txn_id']; $receiver_email = $_POST['receiver_email']; $payer_email = $_POST['payer_email'];*/ if(!$fp){ // HTTP ERROR //user CURL $curl_result = $curl_err = ''; $ch = curl_init(); if((bool)$params->get('sandbox') === true){ curl_setopt($ch, CURLOPT_URL, 'https://www.sandbox.paypal.com/cgi-bin/webscr'); }else{ curl_setopt($ch, CURLOPT_URL, 'https://www.paypal.com/cgi-bin/webscr'); } //new change curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); /* curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $req); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/x-www-form-urlencoded", "Content-Length: " . strlen($req))); curl_setopt($ch, CURLOPT_HEADER , 0); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($ch, CURLOPT_TIMEOUT, 30); */ //curl_setopt($ch, CURLOPT_URL, 'https://www.paypal.com/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); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Host: www.paypal.com')); $curl_result = @curl_exec($ch); $curl_err = curl_error($ch); curl_close($ch); //Set validation flag if(!$curl_result){ //both fsock and curl failed! $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); } } }else{ fputs ($fp, $header . $req); while(!feof($fp)){ $res = fgets ($fp, 1024); if(strcmp($res, "VERIFIED") == 0){ // 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 $valid = true; $this->set_events($valid, $form); }else if(strcmp ($res, "INVALID") == 0){ // log for manual investigation $valid = false; $this->set_events($valid, $form); }else{ //$this->events['invalid'] = 1;//delete } } fclose($fp); } } function set_events($valid = false, $form){ if($valid){ if($form->data['payment_status'] == 'Completed'){ $this->events['verified'] = 1; } //$this->events['invalid'] = 1;//delete }else{ $this->events['invalid'] = 1; } } function load($clear){ if($clear){ $action_params = array( 'content1' => '', 'sandbox' => 0 ); } return array('action_params' => $action_params); } } ?>http_request/http_request.php000066600000002667151374535400012561 0ustar00 'redirect', 'title' => 'Redirect/Remote Submit'); var $details = array('title' => 'HTTP Request', 'tooltip' => 'Initiate an HTTP request call.'); function load($clear){ if($clear){ $action_params = array( 'enabled' => 0, 'http_request_url' => '', 'request_event' => 'submit', 'response_element_id' => '', 'event_element_id' => '', 'onrequest_fn' => '', 'onsuccess_fn' => '', 'onfailure_fn' => '', ); } return array('action_params' => $action_params); } function run($form, $actiondata){ ob_start(); ?> function(){ $('chronoform_form_name; ?>').removeClass('hasValidation'); request_caller_id; ?>(); } form_details->params); $form_params->set('jsvalidation_onValidateSuccess', $jsvalidation_onValidateSuccess); $form->form_params->set('jsvalidation_onValidateSuccess', $jsvalidation_onValidateSuccess); $form->form_details->params = $form_params->toString(); } } ?>http_request/http_request.ctp000066600000012774151374535400012560 0ustar00
HTTP Request
Header(array('settings' => 'Settings', 'advanced' => 'Advanced', 'help' => 'Help'), 'http_request_config_{n}'); ?> tabStart('settings'); ?> input('action_http_request_{n}_enabled_config', array('type' => 'select', 'label' => 'Enabel HTTP Request', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Enable the form to initiate an HTTP request before its submitted, example, the form atcion may be set to PayPal but you want to run the submission routine before moving to PayPal.')); ?> input('action_http_request_{n}_http_request_url_config', array('type' => 'text', 'label' => "HTTP Request URL", 'class' => 'big_input', 'smalldesc' => "The url to which the HTTP request call will be made, usually the same form url but ends with &event=submit")); ?> input('action_http_request_{n}_request_event_config', array('type' => 'select', 'label' => 'Request Event', 'options' => array('submit' => "Form's onSubmit", 'click' => 'onClick', 'change' => 'onChange'), 'smalldesc' => 'The event at which the request will be triggered, this is a browser side event, please do not mix with server side forms events.')); ?> input('action_http_request_{n}_event_element_id_config', array('type' => 'text', 'label' => "Event Element ID", 'class' => 'medium_input', 'smalldesc' => "The id of the element which will have the event to be used, leave empty iof you select the onSubmit.")); ?> input('action_http_request_{n}_response_element_id_config', array('type' => 'text', 'label' => "Response Element ID", 'class' => 'medium_input', 'smalldesc' => "The id of the element which will be loaded with the response string when the request is completed with success.")); ?> tabEnd(); ?> tabStart('advanced'); ?> input('action_http_request_{n}_onrequest_fn_config', array('type' => 'text', 'label' => "On Request Function name", 'class' => 'medium_input', 'smalldesc' => "A JS function name to run when the request is sent, please add the 2 brackets at the end, e.g: myfn()")); ?> input('action_http_request_{n}_onsuccess_fn_config', array('type' => 'text', 'label' => "On Success Function name", 'class' => 'medium_input', 'smalldesc' => "A JS function name to run when the request is completed successfully, please add the 2 brackets at the end, e.g: myfn()")); ?> input('action_http_request_{n}_onfailure_fn_config', array('type' => 'text', 'label' => "On Failure Function name", 'class' => 'medium_input', 'smalldesc' => "A JS function name to run when the request has failed, please add the 2 brackets at the end, e.g: myfn()")); ?> tabEnd(); ?> tabStart('help'); ?>

  • Sometimes we need to submit our form to 2 different URLs, this was hard to do, the only way to do this was to use the CURL library, however, this action should allow this to be done now.
  • For example, set your form's action URL to PayPal, Moneybookers or SugarCRM..etc and use this HTTP Request to communicate with one of your form events, or vice versa.
  • If you want to disable the form submission, add this code to the "Form tag attachment" field: onSubmit="return false;"

tabEnd(); ?>
http_request/index.html000066600000000035151374535400011301 0ustar00 http_request/cfaction_http_request.php000066600000004705151374535400014422 0ustar00params); $document = JFactory::getDocument(); //create the JS function ob_start(); ?> //id; ?> = function(){ var myForm = $('chronoform_form_name; ?>'); if(myForm.hasClass('hasValidation') == get('request_event', 'submit') == 'submit') ? "false" : "true"; ?>){ myForm.set('send', { url: 'get('http_request_url', ''); ?>', method: 'post', async: false, onRequest: function(){ get('onrequest_fn'))) > 0){ echo trim($params->get('onrequest_fn')).";"; } ?> }, onSuccess: function(responseText, responseXML){ get('response_element_id', ''))): ?> $('get('response_element_id', '')); ?>').set('html', responseText); get('onsuccess_fn'))) > 0){ echo trim($params->get('onsuccess_fn')).";"; } ?> }, onFailure: function(xhr){ get('onfailure_fn'))) > 0){ echo trim($params->get('onfailure_fn')).";"; } ?> } }); myForm.send('get('http_request_url', ''); ?>'); } } window.addEvent('domready', function() { get('request_event', 'submit') == 'submit'): ?> if($('chronoform_form_name; ?>').hasClass('hasValidation') == false){ $('chronoform_form_name; ?>').addEvent('submit', request_caller_id; ?>); } $('get('event_element_id', ''); ?>').addEvent('get('request_event', 'submit'); ?>', request_caller_id; ?>); }); //]]> addScriptDeclaration($script); } } ?>http_request/.htaccess000066600000000177151374535400011111 0ustar00 Order allow,deny Deny from all http_request/cfaction_http_request.ctp000066600000000204151374535400014407 0ustar00loadAction($form, $actiondata); ?>chrono_connectivity_return/chrono_connectivity_return.ctp000066600000004247151374535400020450 0ustar00
Chrono Connectivity Return to App
Header(array('settings' => 'Settings', 'help' => 'Help'), 'chrono_connectivity_return_config_{n}'); ?> tabStart('settings'); ?> input('action_chrono_connectivity_return_{n}_purge_old_data_config', array('type' => 'select', 'label' => "Purge Old Data", 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Should the action remove the session data of the current last executed action before redirecting back to the main connection page ?')); ?> input('action_chrono_connectivity_return_{n}_connection_name_config', array('type' => 'text', 'label' => "Connection Name", 'class' => 'medium_input', 'smalldesc' => 'Leave empty for auto integration, if no connection name is passed for this action then this will be used.')); ?> tabEnd(); ?> tabStart('help'); ?>

  • This action will return the user to last page where they left the connection.

tabEnd(); ?>
chrono_connectivity_return/.htaccess000066600000000177151374535400014047 0ustar00 Order allow,deny Deny from all chrono_connectivity_return/chrono_connectivity_return.php000066600000003642151374535400020447 0ustar00 'Chrono Connectivity Return', 'tooltip' => 'Return to the Connection listing page.'); var $group = array('id' => 'x_chronoforms_apps', 'title' => 'ChronoForms Apps'); function run($form, $actiondata){ $mainframe = JFactory::getApplication(); $params = new JParameter($actiondata->params); if(trim($params->get('connection_name', '')) != ''){ $received_data = array( 'connection_name' => $params->get('connection_name', '') ); $this->processData($received_data); }else if(isset($form->data['apps_data']['ChronoConnectivity']['action_'.$actiondata->order])){ $received_data = $form->data['apps_data']['ChronoConnectivity']['action_'.$actiondata->order]; if(isset($received_data['connection_name'])){ $this->processData($received_data); } } } function processData($received_data = array()){ $mainframe = JFactory::getApplication(); $connection_name = $received_data['connection_name']; require_once(JPATH_SITE.DS.'components'.DS.'com_chronoconnectivity'.DS.'libraries'.DS.'chronoconnection.php'); $MyConnection = CFChronoConnection::getInstance($connection_name); /*$redirect = $MyConnection->connection_url; if($MyConnection->connection_area != 'admin'){ //$redirect = JRoute::_($MyConnection->connection_url, true); }*/ $mainframe->redirect(JRoute::_($MyConnection->connection_url, false)); } function load($clear){ if($clear){ $action_params = array( 'connection_name' => '', 'purge_old_data' => 1, ); } return array('action_params' => $action_params); } } ?>chrono_connectivity_return/index.html000066600000000035151374535400014237 0ustar00 chrono_connectivity_task/chrono_connectivity_task.php000066600000014106151374535400017512 0ustar00 'Chrono Connectivity Task', 'tooltip' => 'Run a Chrono Connectivity Task.'); var $group = array('id' => 'x_chronoforms_apps', 'title' => 'ChronoForms Apps'); var $events = array('success' => 0, 'fail' => 0); var $params = null; function run($form, $actiondata){ $mainframe = JFactory::getApplication(); $this->params = $params = new JParameter($actiondata->params); if(trim($params->get('connection_name', '')) != '' && trim($params->get('task', '')) != ''){ $received_data = array( 'connection_name' => $params->get('connection_name', ''), 'task' => $params->get('task', ''), 'field_name' => $params->get('field_name', ''), ); if(trim($params->get('data', '')) != '' && isset($form->data[$params->get('data', '')])){ $received_data['data'] = $form->data[$params->get('data', '')]; } $this->processData($form, $actiondata, $received_data); }else if(isset($form->data['apps_data']['ChronoConnectivity']['action_'.$actiondata->order])){ $received_data = $form->data['apps_data']['ChronoConnectivity']['action_'.$actiondata->order]; //print_r2($session_data); if(isset($received_data['task']) && !empty($received_data['task'])){ $this->processData($form, $actiondata, $received_data); }else{ $this->events['fail'] = 1; if((bool)$params->get('show_returned_errors', 0) === true){ $form->validation_errors[] = "Error occurred, session data couldn't be found."; }else{ $form->validation_errors[] = $params->get('error_message', ''); $form->debug['Chrono Connectivity Task'][$actiondata->order] = "Error occurred, session data couldn't be found."; } } } } function processData($form, $actiondata, $received_data = array()){ $params = $this->params; require_once(JPATH_SITE.DS.'components'.DS.'com_chronoconnectivity'.DS.'libraries'.DS.'chronoconnection.php'); $task = $received_data['task']; $connection_name = $received_data['connection_name']; //get the data $data = array(); if(isset($received_data['data'])){ $data = $received_data['data']; } $return = true; //connection instance $MyConnection = CFChronoConnection::getInstance($connection_name); //print_r2(array('task' => $task, 'name' => $connection_name, 'data' => $data)); switch($task){ case 'delete_data': //check permissions $acl_result = $MyConnection->check_permissions('delete', $data); if($acl_result === false){ $MyConnection->permission_deny(); $return = false; break; }else if(is_array($acl_result)){ $data = $acl_result; } //delete records code here $return = $MyConnection->delete_record_data($data); break; case 'save_data': //check permissions $r_id = null; if(is_array($data)){ $form->data = array_merge($form->data, $data); } if(strlen($MyConnection->connection_model_id) > 0){ if(isset($form->data[$MyConnection->connection_model_id][$MyConnection->connection_table_primary]) && !empty($form->data[$MyConnection->connection_model_id][$MyConnection->connection_table_primary])){ $r_id = $form->data[$MyConnection->connection_model_id][$MyConnection->connection_table_primary]; } }else{ if(isset($form->data[$MyConnection->connection_table_primary]) && !empty($form->data[$MyConnection->connection_table_primary])){ $r_id = $form->data[$MyConnection->connection_table_primary]; } } $acl_result = $MyConnection->check_permissions('save', $r_id); if($acl_result === false){ $MyConnection->permission_deny(); $return = false; break; }else if(is_array($acl_result)){ $r_id = $acl_result[0]; } //save/update data $return = $MyConnection->save_action($data); break; case 'edit_data': //check permissions $acl_result = $MyConnection->check_permissions('edit', $data); if($acl_result === false){ $MyConnection->permission_deny(); $return = false; break; }else if(is_array($acl_result)){ $data = $acl_result[0]; } //edit/load record here $row_data = $MyConnection->read_record_data($data); if(is_array($row_data)){ $form->data = array_merge($row_data, $form->data); } $form = $MyConnection->addFormExtension($form, 'edit'); break; /*case 'binary_data': //check permissions $acl_result = $MyConnection->check_permissions('binary', $data); if($acl_result === false){ $MyConnection->permission_deny(); $return = false; break; }else if(is_array($acl_result)){ $data = $acl_result; } //binary records code here $field_name = $received_data['field_name']; $return = $MyConnection->binary_record_data($field_name, $data); break;*/ case 'list_data': default: //check permissions if($MyConnection->check_permissions('list', $data) === false){ $this->permission_deny(); $return = false; break; } //list records code here $actiondata->content1 = $MyConnection->get_list_output(); break; } //check events if($return === true){ $this->events['success'] = 1; }else{ $this->events['fail'] = 1; if(is_string($return)){ if((bool)$params->get('show_returned_errors', 0) === true){ $form->validation_errors[] = $return; }else{ $form->validation_errors[] = $params->get('error_message', ''); $form->debug['Chrono Connectivity Task'][$actiondata->order] = $return; } } } } function load($clear){ if($clear){ $action_params = array( 'task' => '', 'field_name' => '', 'data' => '', 'connection_name' => '', 'error_message' => 'An error has occurred.', 'show_returned_errors' => 0, 'purge_old_data' => 1, 'purge_data_lifetime' => 15 ); } return array('action_params' => $action_params); } } ?>chrono_connectivity_task/.htaccess000066600000000177151374535400013472 0ustar00 Order allow,deny Deny from all chrono_connectivity_task/chrono_connectivity_task.ctp000066600000013122151374535400017506 0ustar00
Chrono Connectivity Task
Header(array('settings' => 'Settings', 'help' => 'Help'), 'chrono_connectivity_task_config_{n}'); ?> tabStart('settings'); ?> input('action_chrono_connectivity_task_{n}_connection_name_config', array('type' => 'text', 'label' => "Connection Name", 'class' => 'medium_input', 'smalldesc' => 'Leave empty for auto integration, if no connection name is passed for this action then this will be used.')); ?> input('action_chrono_connectivity_task_{n}_task_config', array('type' => 'select', 'label' => "Task", 'options' => array('list_data' => 'List Data', 'edit_data' => 'Edit/Read Data', 'delete_data' => 'Delete Data', 'save_data' => 'Save Data', 'binary_data' => 'Binary Data'), 'smalldesc' => 'Leave empty for auto integration, if no task is passed for this action then this will be used.')); ?> input('action_chrono_connectivity_task_{n}_data_config', array('type' => 'text', 'label' => "Data field name", 'class' => 'medium_input', 'smalldesc' => 'Leave empty for auto integration, if no data is passed for this action then the value of this field will be used.')); ?> input('action_chrono_connectivity_task_{n}_field_name_config', array('type' => 'text', 'label' => "Field Name", 'class' => 'medium_input', 'smalldesc' => 'Leave empty for auto integration, if no field name is passed for this action then this will be used, useful for "binary" tasks only.')); ?> input('action_chrono_connectivity_task_{n}_error_message_config', array('type' => 'text', 'label' => "Error Message", 'class' => 'medium_input', 'smalldesc' => 'The error message which will be added to the errors/debug (see below) array in case some problem occurred.')); ?> input('action_chrono_connectivity_task_{n}_show_returned_errors_config', array('type' => 'select', 'label' => "Show errors", 'options' => array(0 => 'No (Add to debug only!)', 1 => 'Yes'), 'smalldesc' => 'Should the errors be added to the Errors array (visible to user) or to the Debug messages array ?')); ?> input('action_chrono_connectivity_task_{n}_purge_old_data_config', array('type' => 'select', 'label' => "Purge Old Data", 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Should the action check and remove any old session data ?')); ?> input('action_chrono_connectivity_task_{n}_purge_data_lifetime_config', array('type' => 'text', 'label' => "Session Data Lifetime", 'class' => 'medium_input', 'smalldesc' => 'The session data life time which will be used to decide if the data is old enough or not.')); ?> tabEnd(); ?> tabStart('help'); ?>

  • This action will execute a Chrono Connectivity task, e.g: list data, edit, save, delete...etc, the task executed depends on your connection configuration.

tabEnd(); ?>
chrono_connectivity_task/cfaction_chrono_connectivity_task.ctp000066600000000245151374535400021356 0ustar00runCode($form, $actiondata); ?>chrono_connectivity_task/cfaction_chrono_connectivity_task.php000066600000000727151374535400021364 0ustar00params); echo $actiondata->content1; } } ?>chrono_connectivity_task/index.html000066600000000035151374535400013662 0ustar00 load_fields_hash/index.html000066600000000035151374535400012022 0ustar00 load_fields_hash/load_fields_hash.ctp000066600000004450151374535400014012 0ustar00
Load Fields Hash
Header(array('settings' => 'Settings', 'help' => 'Help'), 'load_fields_hash_config_{n}'); ?> tabStart('settings'); ?> input('action_load_fields_hash_{n}_fields_config', array('type' => 'text', 'label' => 'Fields list', 'class' => 'big_input', 'smalldesc' => 'Comma separated list of fields, no spaces, you can use dots to get sub arrays values.')); ?> input('action_load_fields_hash_{n}_hash_field_name_config', array('type' => 'text', 'label' => 'Hash field name', 'smalldesc' => '')); ?> tabEnd(); ?> tabStart('help'); ?>

  • This action will generate a security hash of some fields values, you can check the hash back in the "on submit" event using the "check fields hash" action.
  • The goal here is to make sure that these fields values have not been changed by the end user after they have been sent by the server.
  • Insert a list of fields names to be hashed.
  • The order of this action in the load routine, should only be when the fields data exist in the $form->data array.
  • Only fields values in the $form->data array will be used, default fields values will NOT be checked and WILL generate a fail error if checked.

tabEnd(); ?>
load_fields_hash/.htaccess000066600000000177151374535400011632 0ustar00 Order allow,deny Deny from all load_fields_hash/load_fields_hash.php000066600000003157151374535400014016 0ustar00 'form_security', 'title' => 'Security'); var $details = array('title' => 'Load Fields Hash', 'tooltip' => 'Injects a security hash representing the values of specific fields values.'); function run($form, $actiondata){ $mainframe = JFactory::getApplication(); $session = JFactory::getSession(); $params = new JParameter($actiondata->params); //get secret $secret = $mainframe->getCfg('secret'); $fields = array(); if(strlen(trim($params->get('fields', '')))){ $fields = explode(',', trim($params->get('fields', ''))); } $hashed_values = array(); foreach($fields as $k => $field){ $hashed_values[$field] = $form->get_array_value($form->data, explode('.', $field)); } $form->debug['Load Fields Hash'][$actiondata->order] = $hashed_values; $hash = serialize($hashed_values); $hash = md5($hash); $hash = md5($hash.':'.$secret); $form->extra_content .= ''; } function load($clear){ if($clear){ $action_params = array( 'content1' => '', 'enabled' => 1, 'hash_field_name' => 'cf_fields_hash', 'fields' => '' ); } return array('action_params' => $action_params); } } ?>paypal_pro/.htaccess000066600000000177151374535400010530 0ustar00 Order allow,deny Deny from all paypal_pro/paypal_pro.php000066600000024252151374535400011611 0ustar00 'payments', 'title' => 'Payment Gateways'); var $events = array('success' => 0, 'fail' => 0); var $details = array('title' => 'Paypal Pro', 'tooltip' => 'Communicate with the Paypal payment gateway.'); //some variables for the paypal functions usage var $_DEBUGGING; var $_TESTING; var $_API_UserName; var $_API_Password; var $_API_Signature; var $_API_Endpoint; var $_USE_PROXY; var $_PROXY_HOST; var $_PROXY_PORT; var $_version; function run($form, $actiondata){ $params = new JParameter($actiondata->params); $this->_DEBUGGING = $params->get('debugging', 0); # Display additional information to track down problems $this->_TESTING = $params->get('testing', 0); # Set the testing flag so that transactions are not live $this->_API_UserName = $params->get('API_USERNAME'); $this->_API_Password = $params->get('API_PASSWORD'); $this->_API_Signature = $params->get('API_SIGNATURE'); //$API_ENDPOINT = $params->get('API_ENDPOINT'); if((int)$params->get('testing', 0) == 1){ $this->_API_Endpoint = 'https://api-3t.sandbox.paypal.com/nvp'; }else{ $this->_API_Endpoint = 'https://api-3t.paypal.com/nvp'; } if((int)$params->get('USE_PROXY') == 1){ $this->_USE_PROXY = TRUE; }else{ $this->_USE_PROXY = FALSE; } $this->_PROXY_HOST = $params->get('PROXY_HOST', ''); $this->_PROXY_PORT = $params->get('PROXY_PORT', ''); //$PAYPAL_URL = $params->get('PAYPAL_URL; $this->_version = '56.0'; $paypal_values = array( "PAYMENTACTION" => urlencode($params->get('PAYMENTACTION') ), "EXPDATE" => str_pad(urlencode($form->data[$params->get('EXPDATE_m')]), 2, '0', STR_PAD_LEFT).urlencode($form->data[$params->get('EXPDATE_y')]), "AMT" => urlencode($form->data[$params->get('AMT')]), "CREDITCARDTYPE" => urlencode($form->data[$params->get('CREDITCARDTYPE')]), "ACCT" => urlencode($form->data[$params->get('ACCT')]), "CVV2" => urlencode($form->data[$params->get('CVV2')]), "FIRSTNAME" => urlencode($form->data[$params->get('FIRSTNAME')]), "LASTNAME" => urlencode($form->data[$params->get('LASTNAME')]), "STREET" => urlencode($form->data[$params->get('STREET')]), "CITY" => urlencode($form->data[$params->get('CITY')]), "STATE" => urlencode($form->data[$params->get('STATE')]), "ZIP" => urlencode($form->data[$params->get('ZIP')]), "COUNTRYCODE" => urlencode($form->data[$params->get('COUNTRYCODE')]), "CURRENCYCODE" => urlencode($form->data[$params->get('CURRENCYCODE')]) ); if(trim($actiondata->content1)){ $extras = explode("\n", trim($actiondata->content1)); if(!empty($extras)){ foreach($extras as $extra){ $values = array(); $values = explode("=", $extra); $paypal_values[$values[0]] = $values[0].": ".urlencode($form->data[trim($values[1])]); } } } $paypal_values["AMT"] = rand(1,4)* (int)$form->data($params->get("AMT"), ''); $fields = ""; foreach($paypal_values as $key => $value ){ $fields .= "&$key=" .$value; } if((int)$params->get('testing', 0)){ $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', 0) == 1){ 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); $form->data['_PLUGINS_']['paypal_pro']['transaction_id'] = $resArray['TRANSACTIONID']; $form->data['_PLUGINS_']['paypal_pro']['error_message'] = $resArray['L_LONGMESSAGE0']; $form->data['_PLUGINS_']['paypal_pro']['error_code'] = $resArray['L_ERRORCODE0']; $form->data['_PLUGINS_']['paypal_pro']['correlation_id'] = $resArray['CORRELATIONID']; $form->data['_PLUGINS_']['paypal_pro']['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"]); $form->data['_PLUGINS_']['paypal_pro']['payment_status'] = $ack; //set the events if($ack != "SUCCESS"){ $this->events['fail'] = 1; }else{ $this->events['success'] = 1; } //do the debug if((int)$params->get('debugging', 0) == 1){ if($ack!="SUCCESS"){ $_SESSION['reshash'] = $resArray; $this->APIERROR($resArray); }else{ $_SESSION['reshash'] = $resArray; $this->APISUCCESS($resArray); } } } function hash_call($methodName,$nvpStr){ //setting the curl parameters. $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $this->_API_Endpoint); curl_setopt($ch, CURLOPT_VERBOSE, 1); //turning off the server and peer verification(TrustManager Concept). curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_POST, 1); //if USE_PROXY constant set to TRUE in Constants.php, then only proxy will be enabled. //Set proxy name to PROXY_HOST and port number to PROXY_PORT in constants.php if($this->_USE_PROXY) curl_setopt ($ch, CURLOPT_PROXY, $this->_PROXY_HOST.":".$this->_PROXY_PORT); //NVPRequest for submitting to server $nvpreq="METHOD=".urlencode($methodName)."&VERSION=".urlencode($this->_version)."&PWD=".urlencode($this->_API_Password)."&USER=".urlencode($this->_API_UserName)."&SIGNATURE=".urlencode($this->_API_Signature).$nvpStr; //setting the nvpreq as POST FIELD to curl curl_setopt($ch,CURLOPT_POSTFIELDS,$nvpreq); //getting response from server $response = curl_exec($ch); //convrting NVPResponse to an Associative Array $nvpResArray=$this->deformatNVP($response); $nvpReqArray=$this->deformatNVP($nvpreq); $_SESSION['nvpReqArray']=$nvpReqArray; if(curl_errno($ch)){ // moving to display page to display curl errors $_SESSION['curl_error_no']=curl_errno($ch) ; $_SESSION['curl_error_msg']=curl_error($ch); //$this->APIERROR($resArray); } else { //closing the curl curl_close($ch); } return $nvpResArray; } /** This function will take NVPString and convert it to an Associative Array and it will decode the response. * It is usefull to search for a particular key and displaying arrays. * @nvpstr is NVPString. * @nvpArray is Associative Array. */ function deformatNVP($nvpstr){ $intial = 0; $nvpArray = array(); while(strlen($nvpstr)){ //postion of Key $keypos = strpos($nvpstr,'='); //position of value $valuepos = strpos($nvpstr,'&') ? strpos($nvpstr,'&'): strlen($nvpstr); /*getting the Key and Value values and storing in a Associative Array*/ $keyval=substr($nvpstr,$intial,$keypos); $valval=substr($nvpstr,$keypos+1,$valuepos-$keypos-1); //decoding the respose $nvpArray[urldecode($keyval)] =urldecode( $valval); $nvpstr=substr($nvpstr,$valuepos+1,strlen($nvpstr)); } return $nvpArray; } function APIERROR($resArray){ ?>
The PayPal API has returned an error!
Error Number:
Error Message:
Ack: Correlation ID: Version: Error Number: Short Message: Long Message:
Transaction ID:
Amount:
AVS:
CVV2:
'', 'PAYMENTACTION' => 'Sale', 'CREDITCARDTYPE' => '', 'ACCT' => '', 'EXPDATE_m' => '', 'EXPDATE_y' => '', 'CVV2' => '', 'FIRSTNAME' => '', 'LASTNAME' => '', 'STREET' => '', 'CITY' => '', 'STATE' => '', 'ZIP' => '', 'COUNTRYCODE' => '', 'CURRENCYCODE' => '', 'API_USERNAME' => '', 'API_PASSWORD' => '', 'API_SIGNATURE' => '', 'USE_PROXY' => 0, 'PROXY_HOST' => '', 'PROXY_PORT' => '', 'testing' => 0, 'debugging' => 0, 'content1' => '' ); } return array('action_params' => $action_params); } } ?>paypal_pro/index.html000066600000000035151374535400010720 0ustar00 paypal_pro/paypal_pro.ctp000066600000024402151374535400011605 0ustar00
Paypal Pro - Trial
Header(array('fields' => 'Fields', 'settings' => 'Settings', 'help' => 'Help'), 'paypal_pro_config_{n}'); ?> tabStart('fields'); ?> input('action_paypal_pro_{n}_PAYMENTACTION_config', array('type' => 'hidden')); ?> input('action_paypal_pro_{n}_AMT_config', array('type' => 'text', 'label' => "Amount Field", 'class' => 'medium_input')); ?> input('action_paypal_pro_{n}_CREDITCARDTYPE_config', array('type' => 'text', 'label' => "Credit Card type Field", 'class' => 'medium_input')); ?> input('action_paypal_pro_{n}_ACCT_config', array('type' => 'text', 'label' => "Credit Card Number Field", 'class' => 'medium_input')); ?> input('action_paypal_pro_{n}_EXPDATE_m_config', array('type' => 'text', 'label' => "Credit Card Expiry month field", 'class' => 'medium_input')); ?> input('action_paypal_pro_{n}_EXPDATE_y_config', array('type' => 'text', 'label' => "Credit Card Expiry year field", 'class' => 'medium_input')); ?> input('action_paypal_pro_{n}_CVV2_config', array('type' => 'text', 'label' => "CVV2 field", 'class' => 'medium_input')); ?> input('action_paypal_pro_{n}_FIRSTNAME_config', array('type' => 'text', 'label' => "First Name Field", 'class' => 'medium_input')); ?> input('action_paypal_pro_{n}_LASTNAME_config', array('type' => 'text', 'label' => "Last Name Field", 'class' => 'medium_input')); ?> input('action_paypal_pro_{n}_STREET_config', array('type' => 'text', 'label' => "Street Field", 'class' => 'medium_input')); ?> input('action_paypal_pro_{n}_CITY_config', array('type' => 'text', 'label' => "City Field", 'class' => 'medium_input')); ?> input('action_paypal_pro_{n}_STATE_config', array('type' => 'text', 'label' => "State Field", 'class' => 'medium_input')); ?> input('action_paypal_pro_{n}_ZIP_config', array('type' => 'text', 'label' => "Zip Field", 'class' => 'medium_input')); ?> input('action_paypal_pro_{n}_COUNTRYCODE_config', array('type' => 'text', 'label' => "Country Code Field", 'class' => 'medium_input', 'smalldesc' => "2 Characters value, e.g: US, CA, UK..etc")); ?> input('action_paypal_pro_{n}_CURRENCYCODE_config', array('type' => 'text', 'label' => "Currency Code Field", 'class' => 'medium_input', 'smalldesc' => 'e.g: USD, GBP, EUR..etc')); ?> input('action_paypal_pro_{n}_content1_config', array('type' => 'textarea', 'label' => 'Extra fields', 'rows' => 5, 'cols' => 50)); ?> tabEnd(); ?> tabStart('settings'); ?> input('action_paypal_pro_{n}_API_USERNAME_config', array('type' => 'text', 'label' => "API Username", 'class' => 'medium_input', 'value' => '')); ?> input('action_paypal_pro_{n}_API_PASSWORD_config', array('type' => 'text', 'label' => "API Password", 'class' => 'medium_input', 'value' => '')); ?> input('action_paypal_pro_{n}_API_SIGNATURE_config', array('type' => 'text', 'label' => "API Signature", 'class' => 'medium_input', 'value' => '')); ?> input('action_paypal_pro_{n}_USE_PROXY_config', array('type' => 'select', 'label' => 'Use Proxy ?', 'options' => array(0 => 'No', 1 => 'Yes'))); ?> input('action_paypal_pro_{n}_PROXY_HOST_config', array('type' => 'text', 'label' => "Proxy host IP", 'class' => 'small_input', 'value' => '')); ?> input('action_paypal_pro_{n}_PROXY_PORT_config', array('type' => 'text', 'label' => "Proxy Port", 'class' => 'medium_input', 'value' => '')); ?> input('action_paypal_pro_{n}_debugging_config', array('type' => 'select', 'label' => 'Debugging', 'options' => array(0 => 'No', 1 => 'Yes'))); ?> input('action_paypal_pro_{n}_testing_config', array('type' => 'select', 'label' => 'Testing', 'options' => array(0 => 'No', 1 => 'Yes'))); ?> tabEnd(); ?> tabStart('help'); ?>

  • This plugin will work only with web payments pro enabled Paypal account, this is available to Paypal users at the US, UK and Canada only at the moment according to Paypal.
  • Map your form fields names to the fields required by Paypal Pro, no spaces should be in the fields name.
  • You may map extra fields through the "Extra fields" box, use multi line format, each line should be in this form: paypal_field_name=form_field_name
  • Enter your Paypal pro api account settings.
  • If you enable the debugging then you will see the Paypal Pro response in the same event page.
  • Some response data will be stored after the response is received under the $form->data['_PLUGINS_']['paypal_pro'].
  • You can add a "Custom code" action after this one and use this code to check/user the response data stored : print_r2($form->data['_PLUGINS_']['paypal_pro']);

tabEnd(); ?>
email_verification_sender/email_verification_sender.php000066600000003650151374535400017656 0ustar00 '1_validation', 'title' => 'Validation'); var $details = array('title' => 'Email Verification', 'tooltip' => 'Sends the email and saves the data into DB.'); function run($form, $actiondata){ $mainframe = JFactory::getApplication(); $uri = JFactory::getURI(); $params = new JParameter($actiondata->params); //save the data to db $db_save_details = $actiondata; $db_save_details->type = 'db_save'; $db_save_Params = new JParameter(''); $db_save_Params->set('table_name', $params->get('table_name')); $db_save_details->params = $db_save_Params->toString(); $form->data[trim($params->get('verify_field', 'verify'))] = md5(uniqid(rand(), true)); $form->data[trim($params->get('verification_status_field', 'verified'))] = 0; if(trim($params->get('files_array_field', ''))){ $form->data[trim($params->get('files_array_field'))] = var_export($form->files, true); } $form->runAction($db_save_details); //add the verification link value to the data array $form->data['verification_link'] = $params->get('verification_link_path', $uri->root().'index.php?option=com_chronoforms&chronoform='.$form->form_name); $form->data['verification_link'] .= '&action=verify&hash='.$form->data[trim($params->get('verify_field', 'verify'))]; } function load($clear){ if($clear){ $action_params = array( 'table_name' => '', 'verify_field' => '', 'verification_status_field' => '', 'files_array_field' => '', 'verification_link_path' => '' ); } return array('action_params' => $action_params); } } ?>email_verification_sender/email_verification_sender.ctp000066600000011303151374535400017647 0ustar00
Email Verification Sender
Header(array('settings' => 'Settings', 'help' => 'Help'), 'email_verification_sender_config_{n}'); ?> tabStart('settings'); ?> getTableList(); $options = array(); foreach($tables as $table){ $options[$table] = $table; } ?> input('action_email_verification_sender_{n}_table_name_config', array('type' => 'select', 'label' => 'Table', 'options' => $options, 'empty' => " - ", 'class' => 'medium_input', 'smalldesc' => 'The table to which the form data will be stored, form fields names should match the table columns names.')); ?> input('action_email_verification_sender_{n}_verify_field_config', array('type' => 'text', 'label' => "Verification code field name", 'class' => 'medium_input', 'smalldesc' => 'The field name at which the verification code will be stored.')); ?> input('action_email_verification_sender_{n}_verification_status_field_config', array('type' => 'text', 'label' => "Verification status field name", 'class' => 'medium_input', 'smalldesc' => 'The field name at which the verification status (0 or 1) will be stored. (a TINYINT(1) field is perfect)')); ?> input('action_email_verification_sender_{n}_files_array_field_config', array('type' => 'text', 'label' => "Files array field name", 'class' => 'medium_input', 'smalldesc' => 'The field name at which the form files array is going to be saved, this is necessary only if your form is uploading some files, should be of type TEXT')); ?> input('action_email_verification_sender_{n}_verification_link_path_config', array('type' => 'text', 'label' => "Verification link path", 'class' => 'big_input', 'value' => '', 'smalldesc' => 'The verification link path, this is typically the link to your form event which has the "Email verification response" action.')); ?> tabEnd(); ?> tabStart('help'); ?>

  • Select the db table where you want your form data to be stored at along with the verification code.
  • Your table should have some field to store the verification code.
  • Enter the name of your verification code field without any spaces.(preferably a VARCHAR(255) field)(e.g: verify)
  • Enter the name of your verification status field without any spaces.(preferably a TINYINT(1) field)()e.g: verified
  • Enter the path to your "Email verification response" processor action, this is usually the link to your form in the frontend (you can add it to any other form you want).
  • Add an Email action after this action to send the verification email, you can use {verification_link} to display the link in your email, you can use {verify} to display the verification code only.

tabEnd(); ?>
email_verification_sender/.htaccess000066600000000177151374535400013553 0ustar00 Order allow,deny Deny from all email_verification_sender/index.html000066600000000035151374535400013743 0ustar00 file_downloader/.htaccess000066600000000177151374535400011517 0ustar00 Order allow,deny Deny from all file_downloader/file_downloader.ctp000066600000006014151374535400013562 0ustar00
File Downloader
Header(array('settings' => 'Settings', 'help' => 'Help'), 'file_downloader_config_{n}'); ?> tabStart('settings'); ?> input('action_file_downloader_{n}_display_config', array('type' => 'select', 'label' => "Download Type", 'options' => array('D' => 'Download', 'I' => 'Inline'), 'smalldesc' => "Select what the user is going to get.")); ?> input('action_file_downloader_{n}_downloads_path_config', array('type' => 'text', 'label' => "Downloads Path", 'class' => 'big_input', 'smalldesc' => "The absolute path to the downloads directory on the server.
You can use \"JOOMLA_PATH\" in the path, it will be replaced by the website path in runtime.")); ?> input('action_file_downloader_{n}_file_name_config', array('type' => 'text', 'label' => "File name", 'class' => 'medium_input', 'smalldesc' => "The file name.")); ?> input('action_file_downloader_{n}_file_name_path_config', array('type' => 'text', 'label' => "File Name Path", 'class' => 'medium_input', 'smalldesc' => "The path to the file name in the data array, helpful when processing dynamic data.")); ?> tabEnd(); ?> tabStart('help'); ?>

  • This plugin will display a download dialogue for a specific file or will display it inline based on your configuration.
  • If this doesn't work then please use a "Debugger" action to check for any problems.

tabEnd(); ?>
file_downloader/index.html000066600000000035151374535400011707 0ustar00 file_downloader/file_downloader.php000066600000026003151374535400013563 0ustar00 'form_utilities', 'title' => 'Utilities'); var $details = array('title' => 'File Downloader', 'tooltip' => "Sends the specified file data to the browser, prompting a file download on the end user's machine."); var $_headers = array(); function run($form, $actiondata){ $params = new JParameter($actiondata->params); $mainframe = JFactory::getApplication(); //check download type $dest = $params->get('display', 'D'); $file_name = $params->get('file_name', ''); $file_name_path = $params->get('file_name_path', ''); if(!empty($file_name_path)){ $file_name = $form->get_array_value($form->data, explode('.', $file_name_path)); } $download_file_name = $params->get('download_file_name', $file_name); $extension = strtolower(array_pop(explode('.', $file_name))); $downloads_path = $params->get('downloads_path', ''); if(!empty($downloads_path)){ $downloads_path = str_replace(array("/", "\\"), DS, $downloads_path); if(substr($downloads_path, -1) == DS){ $downloads_path = substr_replace($downloads_path, '', -1); } $downloads_path = str_replace("JOOMLA_PATH", JPATH_SITE, $downloads_path).DS; $params->set('downloads_path', $downloads_path); }else{ //file name is empty $form->debug['file_downloader'][] = "File path provided is empty(wrong)!"; } $file_path = $downloads_path.$params->get('file_name', ''); if(!file_exists($file_path)){ //file doesn't exist $form->debug['file_downloader'][] = "The file path doesn't exist: ".$file_path; } $mime = $this->get_mimes($file_path, $extension); if ($mime !== false && connection_status() == 0) { $chunkSize = 8192; $buffer = ''; $fileSize = @filesize($file_path); $handle = fopen($file_path, 'rb'); if ($handle === false) { return false; } //change later $modified = null; if (!empty($modified)) { $modified = gmdate('D, d M Y H:i:s', strtotime($modified, time())) . ' GMT'; } else { $modified = gmdate('D, d M Y H:i:s') . ' GMT'; } if ($dest == 'D') { $contentTypes = array('application/octet-stream'); $agent = $_SERVER['HTTP_USER_AGENT']; if (preg_match('%Opera(/| )([0-9].[0-9]{1,2})%', $agent)) { $contentTypes[0] = 'application/octetstream'; } else if (preg_match('/MSIE ([0-9].[0-9]{1,2})/', $agent)) { $contentTypes[0] = 'application/force-download'; array_merge($contentTypes, array( 'application/octet-stream', 'application/download' )); } foreach($contentTypes as $contentType) { $this->_header('Content-Type: ' . $contentType); } $this->_header(array( 'Content-Disposition: attachment; filename="' . $download_file_name . '";', 'Expires: 0', 'Accept-Ranges: bytes', 'Cache-Control: private' => false, 'Pragma: private')); $httpRange = $_SERVER['HTTP_RANGE']; if (isset($httpRange)) { list($toss, $range) = explode('=', $httpRange); $size = $fileSize - 1; $length = $fileSize - $range; $this->_header(array( 'HTTP/1.1 206 Partial Content', 'Content-Length: ' . $length, 'Content-Range: bytes ' . $range . $size . '/' . $fileSize)); fseek($handle, $range); } else { $this->_header('Content-Length: ' . $fileSize); } } else { $this->_header('Date: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT'); if ($cache) { if (!is_numeric($cache)) { $cache = strtotime($cache) - time(); } $this->_header(array( 'Cache-Control: max-age=' . $cache, 'Expires: ' . gmdate('D, d M Y H:i:s', time() + $cache) . ' GMT', 'Pragma: cache')); } else { $this->_header(array( 'Cache-Control: must-revalidate, post-check=0, pre-check=0', 'Pragma: no-cache')); } $this->_header(array( 'Last-Modified: ' . $modified, 'Content-Type: ' . $mime, 'Content-Length: ' . $fileSize)); } $this->_output(); $this->_clearBuffer(); while (!feof($handle)) { if (!$this->_isActive()) { fclose($handle); return false; } set_time_limit(0); $buffer = fread($handle, $chunkSize); echo $buffer; $this->_flushBuffer(); } fclose($handle); return; } return false; } function get_mimes($filename, $ext){ $mimeType = array( 'ai' => 'application/postscript', 'bcpio' => 'application/x-bcpio', 'bin' => 'application/octet-stream', 'ccad' => 'application/clariscad', 'cdf' => 'application/x-netcdf', 'class' => 'application/octet-stream', 'cpio' => 'application/x-cpio', 'cpt' => 'application/mac-compactpro', 'csh' => 'application/x-csh', 'csv' => 'application/csv', 'dcr' => 'application/x-director', 'dir' => 'application/x-director', 'dms' => 'application/octet-stream', 'doc' => 'application/msword', 'drw' => 'application/drafting', 'dvi' => 'application/x-dvi', 'dwg' => 'application/acad', 'dxf' => 'application/dxf', 'dxr' => 'application/x-director', 'eot' => 'application/vnd.ms-fontobject', 'eps' => 'application/postscript', 'exe' => 'application/octet-stream', 'ez' => 'application/andrew-inset', 'flv' => 'video/x-flv', 'gtar' => 'application/x-gtar', 'gz' => 'application/x-gzip', 'bz2' => 'application/x-bzip', '7z' => 'application/x-7z-compressed', 'hdf' => 'application/x-hdf', 'hqx' => 'application/mac-binhex40', 'ico' => 'image/vnd.microsoft.icon', 'ips' => 'application/x-ipscript', 'ipx' => 'application/x-ipix', 'js' => 'application/x-javascript', 'latex' => 'application/x-latex', 'lha' => 'application/octet-stream', 'lsp' => 'application/x-lisp', 'lzh' => 'application/octet-stream', 'man' => 'application/x-troff-man', 'me' => 'application/x-troff-me', 'mif' => 'application/vnd.mif', 'ms' => 'application/x-troff-ms', 'nc' => 'application/x-netcdf', 'oda' => 'application/oda', 'otf' => 'font/otf', 'pdf' => 'application/pdf', 'pgn' => 'application/x-chess-pgn', 'pot' => 'application/mspowerpoint', 'pps' => 'application/mspowerpoint', 'ppt' => 'application/mspowerpoint', 'ppz' => 'application/mspowerpoint', 'pre' => 'application/x-freelance', 'prt' => 'application/pro_eng', 'ps' => 'application/postscript', 'roff' => 'application/x-troff', 'scm' => 'application/x-lotusscreencam', 'set' => 'application/set', 'sh' => 'application/x-sh', 'shar' => 'application/x-shar', 'sit' => 'application/x-stuffit', 'skd' => 'application/x-koan', 'skm' => 'application/x-koan', 'skp' => 'application/x-koan', 'skt' => 'application/x-koan', 'smi' => 'application/smil', 'smil' => 'application/smil', 'sol' => 'application/solids', 'spl' => 'application/x-futuresplash', 'src' => 'application/x-wais-source', 'step' => 'application/STEP', 'stl' => 'application/SLA', 'stp' => 'application/STEP', 'sv4cpio' => 'application/x-sv4cpio', 'sv4crc' => 'application/x-sv4crc', 'svg' => 'image/svg+xml', 'svgz' => 'image/svg+xml', 'swf' => 'application/x-shockwave-flash', 't' => 'application/x-troff', 'tar' => 'application/x-tar', 'tcl' => 'application/x-tcl', 'tex' => 'application/x-tex', 'texi' => 'application/x-texinfo', 'texinfo' => 'application/x-texinfo', 'tr' => 'application/x-troff', 'tsp' => 'application/dsptype', 'ttf' => 'font/ttf', 'unv' => 'application/i-deas', 'ustar' => 'application/x-ustar', 'vcd' => 'application/x-cdlink', 'vda' => 'application/vda', 'xlc' => 'application/vnd.ms-excel', 'xll' => 'application/vnd.ms-excel', 'xlm' => 'application/vnd.ms-excel', 'xls' => 'application/vnd.ms-excel', 'xlw' => 'application/vnd.ms-excel', 'zip' => 'application/zip', 'aif' => 'audio/x-aiff', 'aifc' => 'audio/x-aiff', 'aiff' => 'audio/x-aiff', 'au' => 'audio/basic', 'kar' => 'audio/midi', 'mid' => 'audio/midi', 'midi' => 'audio/midi', 'mp2' => 'audio/mpeg', 'mp3' => 'audio/mpeg', 'mpga' => 'audio/mpeg', 'ra' => 'audio/x-realaudio', 'ram' => 'audio/x-pn-realaudio', 'rm' => 'audio/x-pn-realaudio', 'rpm' => 'audio/x-pn-realaudio-plugin', 'snd' => 'audio/basic', 'tsi' => 'audio/TSP-audio', 'wav' => 'audio/x-wav', 'asc' => 'text/plain', 'c' => 'text/plain', 'cc' => 'text/plain', 'css' => 'text/css', 'etx' => 'text/x-setext', 'f' => 'text/plain', 'f90' => 'text/plain', 'h' => 'text/plain', 'hh' => 'text/plain', 'htm' => 'text/html', 'html' => 'text/html', 'm' => 'text/plain', 'rtf' => 'text/rtf', 'rtx' => 'text/richtext', 'sgm' => 'text/sgml', 'sgml' => 'text/sgml', 'tsv' => 'text/tab-separated-values', 'tpl' => 'text/template', 'txt' => 'text/plain', 'xml' => 'text/xml', 'avi' => 'video/x-msvideo', 'fli' => 'video/x-fli', 'mov' => 'video/quicktime', 'movie' => 'video/x-sgi-movie', 'mpe' => 'video/mpeg', 'mpeg' => 'video/mpeg', 'mpg' => 'video/mpeg', 'qt' => 'video/quicktime', 'viv' => 'video/vnd.vivo', 'vivo' => 'video/vnd.vivo', 'gif' => 'image/gif', 'ief' => 'image/ief', 'jpe' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'jpg' => 'image/jpeg', 'pbm' => 'image/x-portable-bitmap', 'pgm' => 'image/x-portable-graymap', 'png' => 'image/png', 'pnm' => 'image/x-portable-anymap', 'ppm' => 'image/x-portable-pixmap', 'ras' => 'image/cmu-raster', 'rgb' => 'image/x-rgb', 'tif' => 'image/tiff', 'tiff' => 'image/tiff', 'xbm' => 'image/x-xbitmap', 'xpm' => 'image/x-xpixmap', 'xwd' => 'image/x-xwindowdump', 'ice' => 'x-conference/x-cooltalk', 'iges' => 'model/iges', 'igs' => 'model/iges', 'mesh' => 'model/mesh', 'msh' => 'model/mesh', 'silo' => 'model/mesh', 'vrml' => 'model/vrml', 'wrl' => 'model/vrml', 'mime' => 'www/mime', 'pdb' => 'chemical/x-pdb', 'xyz' => 'chemical/x-pdb'); if(function_exists('mime_content_type')){ return mime_content_type($filename); }else{ //check file extension if(isset($mimeType[$ext])){ return $mimeType[$ext]; }elseif(function_exists('finfo_open')){ $finfo = finfo_open(FILEINFO_MIME); $mimetype = finfo_file($finfo, $filename); finfo_close($finfo); return $mimetype; }else{ return 'application/octet-stream'; } } } function _header($header, $boolean = true) { if (is_array($header)) { foreach ($header as $string => $boolean) { if (is_numeric($string)) { $this->_headers[] = array($boolean => true); } else { $this->_headers[] = array($string => $boolean); } } return; } $this->_headers[] = array($header => $boolean); return; } function _output() { foreach ($this->_headers as $key => $value) { $header = key($value); header($header, $value[$header]); } } function _isActive() { return connection_status() == 0 && !connection_aborted(); } function _clearBuffer() { return @ob_end_clean(); } function _flushBuffer() { @flush(); @ob_flush(); } function load($clear){ if($clear){ $action_params = array( 'display' => 'D', 'downloads_path' => '', 'download_file_name' => '', 'file_name_path' => '', 'file_name' => '' ); } return array('action_params' => $action_params); } } ?>check_fields_hash/index.html000066600000000035151374535400012160 0ustar00 check_fields_hash/check_fields_hash.php000066600000003626151374535400014313 0ustar00 'form_security', 'title' => 'Security'); var $events = array('success' => 0, 'fail' => 0); var $details = array('title' => 'Check Fields Hash', 'tooltip' => "Generates a new hash based on the new fields values and compares it to the existing one.
Your fields list here should match the list in the load action, and should be in the SAME ORDER."); function run($form, $actiondata){ $mainframe = JFactory::getApplication(); $session = JFactory::getSession(); $params = new JParameter($actiondata->params); //get secret $secret = $mainframe->getCfg('secret'); $fields = array(); if(strlen(trim($params->get('fields', '')))){ $fields = explode(',', trim($params->get('fields', ''))); } $hashed_values = array(); foreach($fields as $k => $field){ $hashed_values[$field] = $form->get_array_value($form->data, explode('.', $field)); } $form->debug['Check Fields Hash'][$actiondata->order] = $hashed_values; $hash = serialize($hashed_values); $hash = md5($hash); $hash = md5($hash.':'.$secret); $hash_field_name = trim($params->get('hash_field_name', 'cf_fields_hash')); if(!empty($form->data[$hash_field_name]) && ($form->data[$hash_field_name] == $hash)){ $this->events['success'] = 1; return true; }else{ $this->events['fail'] = 1; return false; } } function load($clear){ if($clear){ $action_params = array( 'content1' => '', 'enabled' => 1, 'hash_field_name' => 'cf_fields_hash', 'fields' => '' ); } return array('action_params' => $action_params); } } ?>check_fields_hash/check_fields_hash.ctp000066600000005127151374535400014310 0ustar00
Check Fields Hash
Header(array('settings' => 'Settings', 'help' => 'Help'), 'check_fields_hash_config_{n}'); ?> tabStart('settings'); ?> input('action_check_fields_hash_{n}_fields_config', array('type' => 'text', 'label' => 'Fields list', 'class' => 'big_input', 'smalldesc' => 'Comma separated list of fields, no spaces, you can use dots to get sub arrays values.')); ?> input('action_check_fields_hash_{n}_hash_field_name_config', array('type' => 'text', 'label' => 'Hash field name', 'smalldesc' => '')); ?> tabEnd(); ?> tabStart('help'); ?>

  • This action will generate a security hash of some fields values, you can check the hash back in the "on submit" event using the "check fields hash" action.
  • The goal here is to make sure that these fields values have not been changed by the end user after they have been sent by the server.
  • Insert a list of fields names to be hashed.
  • The order of this action in the load routine, should only be when the fields data exist in the $form->data array.
  • Only fields values in the $form->data array will be used, default fields values will NOT be checked and WILL generate a fail error if checked.

tabEnd(); ?>
check_fields_hash/.htaccess000066600000000177151374535400011770 0ustar00 Order allow,deny Deny from all joomla_login/index.html000066600000000035151374535400011223 0ustar00 joomla_login/.htaccess000066600000000177151374535400011033 0ustar00 Order allow,deny Deny from all joomla_login/joomla_login.php000066600000003176151374535400012421 0ustar00 'joomla_functions', 'title' => 'Joomla Functions'); var $events = array('success' => 0, 'fail' => 0); var $details = array('title' => 'Joomla Login', 'tooltip' => 'Tries to login some user to the Joomla system based on the credentials provided.'); function run($form, $actiondata){ $params = new JParameter($actiondata->params); $mainframe = JFactory::getApplication(); // Get required system objects JRequest::setVar('username', JRequest::getVar($params->get('username', ''))); JRequest::setVar('password', JRequest::getVar($params->get('password', ''))); $credentials = array(); $credentials['username'] = JRequest::getVar('username'); $credentials['password'] = JRequest::getVar('password'); if($mainframe->login($credentials) === true){ $this->events['success'] = 1; //redirect if so $redirect = $params->get('redirect_url', ''); if(!empty($redirect)){ $mainframe->redirect($redirect); } }else{ $this->events['fail'] = 1; $form->validation_errors[] = 'Invalid username or password.'; return false; } } function load($clear){ if($clear){ $action_params = array( 'username' => '', 'password' => '', 'redirect_url' => 'index.php' ); } return array('action_params' => $action_params); } } ?>joomla_login/joomla_login.ctp000066600000005211151374535400012410 0ustar00
Joomla Login
Header(array('fields' => 'Fields', 'settings' => 'Settings', 'help' => 'Help'), 'joomla_login_config_{n}'); ?> tabStart('fields'); ?> input('action_joomla_login_{n}_username_config', array('type' => 'text', 'label' => 'Username field name', 'class' => 'medium_input', 'smalldesc' => 'The name of the field which is going to hold the Username data')); ?> input('action_joomla_login_{n}_password_config', array('type' => 'text', 'label' => 'Password field name', 'class' => 'medium_input', 'smalldesc' => 'The name of the field which is going to hold the Password data')); ?> tabEnd(); ?> tabStart('settings'); ?> input('action_joomla_login_{n}_redirect_url_config', array('type' => 'text', 'label' => 'Redirect URL', 'class' => 'big_input', 'smalldesc' => 'The URL to redirect to after login.')); ?> tabEnd(); ?> tabStart('help'); ?>

  • Assign your form field's names to the required fields names under the "Fields" tab.
  • Configure the settings under the "Settings" tab.

tabEnd(); ?>
iframe_request/cfaction_iframe_request.php000066600000003136151374535400015167 0ustar00params); $document = JFactory::getDocument(); JHTML::_('behavior.mootools'); $mainframe = JFactory::getApplication(); $uri = JFactory::getURI(); $cf_url = $uri->root(); $cf_url .= 'administrator/components/com_chronoforms/form_actions/iframe_request/'; $document->addScript($cf_url.'iFrameFormRequest.js'); //create the JS function ob_start(); ?> //form_name; ?> = new iFrameFormRequest('chronoform_form_name; ?>',{ onRequest: function(){ get('onrequest_fn'))) > 0){ echo trim($params->get('onrequest_fn')).";"; } ?> }, onComplete: function(response){ get('response_element_id'))) > 0): ?> document.id('get('response_element_id')); ?>').set('html',response); get('onsuccess_fn'))) > 0){ echo trim($params->get('onsuccess_fn')).";"; } ?> } }); }); //]]> addScriptDeclaration($script); } } ?>iframe_request/index.html000066600000000035151374535400011565 0ustar00 iframe_request/cfaction_iframe_request.ctp000066600000000212151374535400015156 0ustar00loadAction($form, $actiondata); ?>iframe_request/iframe_request.php000066600000001550151374535400013317 0ustar00 'redirect', 'title' => 'Redirect/Remote Submit'); var $details = array('title' => 'iFrame Request', 'tooltip' => 'Submit the form using a hidden iFrame, similar to AJAX and supports file uploading.'); function load($clear){ if($clear){ $action_params = array( 'enabled' => 0, 'response_element_id' => '', 'onrequest_fn' => '', 'onsuccess_fn' => '', ); } return array('action_params' => $action_params); } function run($form, $actiondata){ } } ?>iframe_request/iframe_request.ctp000066600000006266151374535400013327 0ustar00
iFrame Request
Header(array('settings' => 'Settings', 'advanced' => 'Advanced', 'help' => 'Help'), 'iframe_request_config_{n}'); ?> tabStart('settings'); ?> input('action_iframe_request_{n}_enabled_config', array('type' => 'select', 'label' => 'Enabel iFrame Request', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Enable the form to be submitted using a hidden iFrame.')); ?> input('action_iframe_request_{n}_response_element_id_config', array('type' => 'text', 'label' => "Response Element ID", 'class' => 'medium_input', 'smalldesc' => "The id of the element which will be loaded with the response string when the request is completed with success.")); ?> tabEnd(); ?> tabStart('advanced'); ?> input('action_iframe_request_{n}_onrequest_fn_config', array('type' => 'text', 'label' => "On Request Function name", 'class' => 'medium_input', 'smalldesc' => "A JS function name to run when the request is sent, please add the 2 brackets at the end, e.g: myfn()")); ?> input('action_iframe_request_{n}_onsuccess_fn_config', array('type' => 'text', 'label' => "On Success Function name", 'class' => 'medium_input', 'smalldesc' => "A JS function name to run when the request is completed successfully, please add the 2 brackets at the end, e.g: myfn()")); ?> tabEnd(); ?> tabStart('help'); ?>

  • If you want the user to submit the form without leaving the current page then this action should do what you need.
  • You may wrap the form into a div and use the div's id as the "Response Element ID" to display the submission result.

tabEnd(); ?>
iframe_request/iFrameFormRequest.js000066600000003505151374535400013533 0ustar00/* --- description: This class gives you a method to upload files 'the ajax way' license: MIT-style authors: - Arian Stolwijk requires: [Class, Options, Events, Element, Element.Event, Element.Style] provides: [Element.iFrameFormRequest, iFrameFormRequest] ... */ /** * @author Arian Stolwijk * Idea taken from http://www.webtoolkit.info/ajax-file-upload.html */ var iFrameFormRequest = new Class({ Implements: [Options, Events], options: { /* onRequest: function(){}, onComplete: function(data){}, onFailure: function(){}, */ eventName: 'submit' }, initialize: function(form, options){ this.setOptions(options); var frameId = this.frameId = String.uniqueID(); var loading = false; this.form = document.id(form); this.formEvent = function(){ loading = true; this.fireEvent('request'); }.bind(this); this.iframe = new IFrame({ name: frameId, styles: { display: 'none' }, src: 'about:blank', events: { load: function(){ if (loading){ var doc = this.iframe.contentWindow.document; if (doc && doc.location.href != 'about:blank'){ this.fireEvent('complete', doc.body.innerHTML); } else { this.fireEvent('failure'); } loading = false; } }.bind(this) } }).inject(document.body); this.attach(); }, send: function(){ this.form.submit(); }, attach: function(){ this.target = this.form.get('target'); this.form.set('target', this.frameId) .addEvent(this.options.eventName, this.formEvent); }, detach: function(){ this.form.set('target', this.target) .removeEvent(this.options.eventName, this.formEvent); }, toElement: function(){ return this.iframe; } }); Element.implement('iFrameFormRequest', function(options){ this.store('iFrameFormRequest', new iFrameFormRequest(this, options)); return this; }); iframe_request/.htaccess000066600000000177151374535400011375 0ustar00 Order allow,deny Deny from all upload_files/upload_files.php000066600000021267151374535400012414 0ustar00 0, 'fail' => 0); var $fail = array('actions' => array('show_HTML')); var $details = array('title' => 'Upload Files', 'tooltip' => "Control the files uploaded through your form's files fields."); var $upload_path = ''; var $params = null; function run($form, $actiondata){ $this->params = $params = new JParameter($actiondata->params); $files_config = $this->params->get('files', ''); if($actiondata->enabled == 1 && !empty($files_config)){ jimport('joomla.utilities.error'); jimport('joomla.filesystem.file'); $upload_path = $this->params->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 = str_replace("JOOMLA_PATH", JPATH_SITE, $upload_path).DS; $this->params->set('upload_path', $upload_path); }else{ $upload_path = JPATH_SITE.DS.'components'.DS.'com_chronoforms'.DS.'uploads'.DS.$form->form_details->name.DS; } $this->upload_path = $upload_path; if(!JFile::exists($this->upload_path.DS.'index.html')){ if(!JFolder::create($this->upload_path)){ JError::raiseWarning(100, 'Couldn\'t create upload directroy 1'); $this->events['fail'] = 1; return; } $dummy_c = ''; if(!JFile::write($this->upload_path.DS.'index.html', $dummy_c)){ JError::raiseWarning(100, 'Couldn\'t create upload directroy 2'); $this->events['fail'] = 1; return; } } $files_array = explode(",", trim($this->params->get('files', ''))); //get array fields $array_fields = array(); if(trim($this->params->get('array_fields', ''))){ $array_fields = explode(",", trim($this->params->get('array_fields', ''))); } foreach($files_array as $file_string){ if(strpos($file_string, ':') !== false){ $file_data = explode(':', trim($file_string)); $file_extensions = explode('-', $file_data[1]); //convert all extensions to lower case foreach($file_extensions as $k => $file_extension){ $file_extensions[$k] = strtolower($file_extension); } //get the posted file details $field_name = $file_data[0]; $file_post = JRequest::getVar($field_name, array('error' => 99999), 'files', 'array'); if(in_array($field_name, $array_fields) && !empty($file_post['name']) && ($file_post['name'] === array_values($file_post['name']))){ foreach($file_post['name'] as $k => $v){ $uploaded_file_data = $this->processUpload($form, array('name' => $file_post['name'][$k], 'tmp_name' => $file_post['tmp_name'][$k], 'error' => $file_post['error'][$k], 'size' => $file_post['size'][$k]), $file_data[0], $file_extensions); if(is_array($uploaded_file_data)){ $form->files[$field_name][] = $uploaded_file_data; $form->data[$field_name][] = $uploaded_file_data['name']; }elseif($uploaded_file_data === false){ return false; } } }else{ $uploaded_file_data = $this->processUpload($form, $file_post, $file_data[0], $file_extensions); if(is_array($uploaded_file_data)){ $form->files[$field_name] = $uploaded_file_data; $form->data[$field_name] = $uploaded_file_data['name']; }elseif($uploaded_file_data === false){ return false; } } } } //add the data key if(!isset($form->data['_PLUGINS_']['upload_files'])){ $form->data['_PLUGINS_']['upload_files'] = array(); } $form->data['_PLUGINS_']['upload_files'] = array_merge($form->data['_PLUGINS_']['upload_files'], $form->files); } } function processUpload($form, $file_post = array(), $field_name, $file_extensions){ //check errors if(isset($file_post['error']) && !empty($file_post['error'])){ if($file_post['error'] == 99999){ //the file field type is not present in the posted data //continue; return; }else if($file_post['error'] == 4 && isset($file_post['name']) && empty($file_post['name']) && isset($file_post['size']) && ($file_post['size'] == 0)){ //No file has been selected //continue; return; } $form->debug[] = 'PHP returned this error for file upload by : '.$field_name.', PHP error is: '.$file_post['error']; $form->validation_errors[$field_name] = $file_post['error']; $this->events['fail'] = 1; return false; }else{ $form->debug[] = 'Upload routine started for file upload by : '.$field_name; } if((bool)$this->params->get('safe_file_name', 1) === true){ $file_name = JFile::makeSafe($file_post['name']); }else{ $file_name = utf8_decode($file_post['name']); } $real_file_name = $file_name; $file_tmp_name = $file_post['tmp_name']; $file_info = pathinfo($file_name); //mask the file name if(strlen($this->params->get('forced_file_name', '')) > 0){ $file_name = str_replace('FILE_NAME', $file_name, $this->params->get('forced_file_name', '')); }else{ $file_name = date('YmdHis').'_'.$file_name; } //check the file size if($file_tmp_name){ //check max size if(($file_post["size"] / 1024) > (int)$this->params->get('max_size', 100)){ $form->debug[] = 'File : '.$field_name.' size is over the max limit.'; $form->validation_errors[$field_name] = $this->params->get('max_error', 'Sorry, Your uploaded file size ('.($file_post["size"] / 1024).' KB) exceeds the allowed limit.'); $this->events['fail'] = 1; return false; }else if(($file_post["size"] / 1024) < (int)$this->params->get('min_size', 0)){ $form->debug[] = 'File : '.$field_name.' size is less than the minimum limit.'; $form->validation_errors[$field_name] = $this->params->get('min_error', 'Sorry, Your uploaded file size ('.($file_post["size"] / 1024).' KB) is less than the minimum limit.'); $this->events['fail'] = 1; return false; }else if(!in_array(strtolower($file_info['extension']), $file_extensions)){ $form->debug[] = 'File : '.$field_name.' extension is not allowed.'; $form->validation_errors[$field_name] = $this->params->get('type_error', 'Sorry, Your uploaded file type is not allowed.'); $this->events['fail'] = 1; return false; }else{ //$this->upload_path = $this->params->get('upload_path', JPATH_SITE.DS.'components'.DS.'com_chronoforms'.DS.'uploads'.DS.$form->form_details->name.DS); $uploaded_file = JFile::upload($file_tmp_name, $this->upload_path.$file_name); if($uploaded_file){ if((bool)$this->params->get('zip_file', 0) === true){ $zipped = new ZipArchive(); if($zipped->open($this->upload_path.$file_name.'.zip', ZIPARCHIVE::CREATE) !== true){ $form->debug[] = "Couldn't compress the uploaded file."; }else{ $zipped->addFile($this->upload_path.$file_name, $file_name); $zipped->close(); if((bool)$this->params->get('zip_delete_file', 0) === true){ unlink($this->upload_path.$file_name); $file_name = $file_name.'.zip'; } } } $uploaded_file_data = array(); $uploaded_file_data = array('name' => $file_name, 'original_name' => $real_file_name, 'path' => $this->upload_path.$file_name, 'size' => $file_post["size"]); //Try to generate an auto file link $site_link = JURI::Base(); if(substr($site_link, -1) == "/"){ $site_link = substr_replace($site_link, '', -1); } $uploaded_file_data['link'] = str_replace(array(JPATH_SITE, DS), array($site_link, "/"), $this->upload_path.$file_name); //$form->data[$field_name] = $file_name; $form->debug[] = $this->upload_path.$file_name.' has been uploaded successfully.'; $this->events['success'] = 1; return $uploaded_file_data; }else{ $form->debug[] = $this->upload_path.$file_name.' could not be uploaded!!'; $this->events['fail'] = 1; return false; } } } } function load($clear){ if($clear){ $action_params = array( 'files' => '', 'array_fields' => '', 'upload_path' => '', 'forced_file_name' => '', 'max_size' => '100', 'min_size' => '0', 'enabled' => 1, 'safe_file_name' => 1, 'zip_file' => 0, 'zip_delete_file' => 0, 'max_error' => 'Sorry, Your uploaded file size exceeds the allowed limit.', 'min_error' => 'Sorry, Your uploaded file size is less than the minimum limit.', 'type_error' => 'Sorry, Your uploaded file type is not allowed.', ); } return array('action_params' => $action_params); } } ?>upload_files/upload_files.ctp000066600000015006151374535400012405 0ustar00
Upload Files
Header(array('settings' => 'Settings', 'advanced' => 'Advanced', 'help' => 'Help'), 'upload_files_config_{n}'); ?> tabStart('settings'); ?> input('action_upload_files_{n}_enabled_config', array('type' => 'select', 'label' => 'Enabled', 'options' => array(0 => 'No', 1 => 'Yes'))); ?> input('action_upload_files_{n}_files_config', array('type' => 'text', 'label' => "Fields Configuration", 'class' => 'big_input', 'value' => '', 'smalldesc' => 'Config string, e.g: field1:jpg-png-gif,field2:zip-rar,field3:doc-docx-pdf')); ?> input('action_upload_files_{n}_upload_path_config', array('type' => 'text', 'label' => "Upload Path", 'class' => 'big_input', 'smalldesc' => 'The files upload path, if left empty, files will be uploaded under this path:
JOOMLA_PATH/components/com_chronoforms/uploads/FORM_NAME/
You can use "JOOMLA_PATH" in the path, it will be replaced by the website path in runtime.')); ?> input('action_upload_files_{n}_max_size_config', array('type' => 'text', 'label' => "Max Size in KB", 'class' => 'medium_input', 'value' => '')); ?> input('action_upload_files_{n}_min_size_config', array('type' => 'text', 'label' => "Min Size in KB", 'class' => 'medium_input', 'value' => '')); ?> input('action_upload_files_{n}_max_error_config', array('type' => 'text', 'label' => "Max Size Error Message", 'class' => 'medium_input', 'value' => '')); ?> input('action_upload_files_{n}_min_error_config', array('type' => 'text', 'label' => "Min Size Error Message", 'class' => 'medium_input', 'value' => '')); ?> input('action_upload_files_{n}_type_error_config', array('type' => 'text', 'label' => "File type Error Message", 'class' => 'medium_input', 'value' => '')); ?> input('action_upload_files_{n}_safe_file_name_config', array('type' => 'select', 'label' => 'Safe File name', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'This will remove any special characters from the file name.')); ?> tabEnd(); ?> tabStart('advanced'); ?> input('action_upload_files_{n}_array_fields_config', array('type' => 'text', 'label' => "Array Fields", 'class' => 'medium_input', 'value' => '', 'smalldesc' => 'Fields names of type array []')); ?> input('action_upload_files_{n}_zip_file_config', array('type' => 'select', 'label' => 'Compress file', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Would you like to compress the uploaded file ? only .zip compression is supported and this option requires PHP 5.2 or later')); ?> input('action_upload_files_{n}_zip_delete_file_config', array('type' => 'select', 'label' => 'Delete original', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Delete original file after compression ?')); ?> tabEnd(); ?> tabStart('help'); ?>

  • All configured fields share the same max and minimux size check, if you have different sizes then add another "Files upload" action.
  • Files data will be stored after processing under the $form->files AND $form->data['_PLUGINS_']['upload_files'].
  • You can add a "Custom code" action after this one and use this code to check/user the response data stored : print_r2($form->data['_PLUGINS_']['upload_files']);

tabEnd(); ?>
upload_files/index.html000066600000000035151374535400011220 0ustar00 upload_files/.htaccess000066600000000177151374535400011030 0ustar00 Order allow,deny Deny from all 2co_listener/index.html000066600000000000151374535400011132 0ustar002co_listener/2co_listener.ctp000066600000005515151374535400012255 0ustar00
2CO Listener
Header(array('settings' => 'Settings', 'help' => 'Help'), '2co_listener_config_{n}'); ?> tabStart('settings'); ?> input('action_2co_listener_{n}_sid_config', array('type' => 'text', 'label' => "Vendor/Seller ID", 'class' => 'medium_input', 'smalldesc' => 'Enter your 2CO Vendor ID here')); ?> input('action_2co_listener_{n}_secret_config', array('type' => 'text', 'label' => "Secret Word", 'class' => 'medium_input', 'smalldesc' => 'The secret word choosen by the vendor in their 2CO account, used to verify that the response is coming from 2CO')); ?> tabEnd(); ?> tabStart('help'); ?>

  • This plugin will process the INS response coming from the 2CO server, you must be a registered 2CO vendor in order to be able to use this one.
  • enter your Vendor id and the secret word choosen by the vendor at the 2CO account area.
  • All the data returned will be stored in the $form->data array
  • For more documentation about the 2CO parameters, please search the 2CO website for "INS".

tabEnd(); ?>
2co_listener/2co_listener.php000066600000003121151374535400012245 0ustar00 'payments', 'title' => 'Payment Gateways/Processors'); var $events = array('hack' => 0, 'new_order' => 0, 'fraud_status' => 0, 'refund' => 0, 'other' => 0); var $details = array('title' => '2CO Listener', 'tooltip' => 'Get the response from the 2CO payment processor.'); function run($form, $actiondata){ $params = new JParameter($actiondata->params); $mainframe = JFactory::getApplication(); $vendorid = $params->get('sid'); $secretword = $params->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 load($clear){ if($clear){ $action_params = array( 'sid' => '', 'secret' => '' ); } return array('action_params' => $action_params); } } ?>2co_listener/.htaccess000066600000000177151374535400010752 0ustar00 Order allow,deny Deny from all load_recaptcha/.htaccess000066600000000177151374535400011313 0ustar00 Order allow,deny Deny from all load_recaptcha/cfaction_load_recaptcha.php000066600000000600151374535400015014 0ustar00load_recaptcha/load_recaptcha.php000066600000007121151374535400013153 0ustar00 'anti_spam', 'title' => 'Anti SPAM'); var $details = array('title' => 'Load Recaptcha', 'tooltip' => 'Renders the ReCaptcha display, you need the "{ReCaptcha}" string in your form code, possibly using a "Custom Element".'); function run($form, $actiondata) { $mainframe = JFactory::getApplication(); $params = new JParameter($actiondata->params); if(!defined('RECAPTCHA_API_SERVER')){ define('RECAPTCHA_API_SERVER', $params->get('api_server')); } if(!defined('RECAPTCHA_API_SECURE_SERVER')){ define('RECAPTCHA_API_SECURE_SERVER', $params->get('api_secure_server')); } $recaptcha_load = "
".$this->recaptcha_get_html($params->get('public_key'))."
"; $script = " var RecaptchaOptions = { theme : '".$params->get('theme', 'red')."', lang : '".$params->get('lang', 'en')."' }; "; $doc = JFactory::getDocument(); $doc->addScriptDeclaration($script); //add CSS fix to the recaptcha input field $doc->addStyleDeclaration('label.recaptcha_input_area_text{line-height: 12px !important;}'); //replace the string $form->form_details->content = str_replace('{ReCaptcha}', $recaptcha_load, $form->form_details->content); } /** * Gets the challenge HTML (javascript and non-javascript version). * This is called from the browser, and the resulting reCAPTCHA HTML widget * is embedded within the HTML form it was called from. * @param string $pubkey A public key for reCAPTCHA * @param string $error The error given by reCAPTCHA (optional, default is null) * @param boolean $use_ssl Should the request be made over ssl? (optional, default is false) * @return string - The HTML to be embedded in the user's form. */ function recaptcha_get_html($pubkey, $error = null, $use_ssl = false) { if ( $pubkey == null || $pubkey == '' ) { die ("To use reCAPTCHA you must get an API key from https://www.google.com/recaptcha/admin/create"); } if ( $use_ssl ) { $server = RECAPTCHA_API_SECURE_SERVER; } else { $server = RECAPTCHA_API_SERVER; } $errorpart = ""; if ( $error ) { $errorpart = "&error=" . $error; } return ' '; } function load($clear) { if ( $clear ) { $action_params = array( 'public_key' => '6LfNoAUAAAAAAKi8QZmjv-QHOvlGtyh509SG3FzG', 'ssl_server' => '0', 'theme' => 'red', 'lang' => 'en', 'api_server' => 'http://www.google.com/recaptcha/api', 'api_secure_server' => 'https://www.google.com/recaptcha/api' ); } return array('action_params' => $action_params); } } ?>load_recaptcha/index.html000066600000000035151374535400011503 0ustar00 load_recaptcha/load_recaptcha.ctp000066600000005672151374535400013163 0ustar00
Load ReCaptcha
Header(array('settings' => 'Settings', 'advanced' => 'Advanced'), 'load_recaptcha_config_{n}'); ?> tabStart('settings'); ?> input('action_load_recaptcha_{n}_theme_config', array( 'type' => 'select', 'label' => 'Theme', 'options' => array( 'clean' => 'Clean', 'red' => 'Red', 'white' => 'White', 'blackglass' => 'Blackglass', 'custom' => 'Custom' ) ) ); ?> input('action_load_recaptcha_{n}_lang_config', array( 'type' => 'select', 'label' => 'Language', 'options' => array( 'en' => 'English', 'nt' => 'Dutch', 'fr' => 'French', 'de' => 'German', 'pt' => 'Portuguese', 'ru' => 'Russian', 'es' => 'Spanish', 'tr' => 'Turkish' ) ) ); ?> input('action_load_recaptcha_{n}_public_key_config', array('type' => 'text', 'label' => "ReCaptcha public key", 'class' => 'big_input', 'value' => '')); ?> tabEnd(); ?> tabStart('advanced'); ?> input('action_load_recaptcha_{n}_api_server_config', array('type' => 'text', 'label' => "ReCaptcha server", 'class' => 'big_input', 'value' => '')); ?> input('action_load_recaptcha_{n}_api_secure_server_config', array('type' => 'text', 'label' => "ReCaptcha secure server", 'class' => 'big_input', 'value' => '')); ?> tabEnd(); ?>
auto_javascript_validation/assets/.htaccess000066600000000177151374535400015274 0ustar00 Order allow,deny Deny from all auto_javascript_validation/assets/auto_javascript_validation.js000066600000002016151374535400021436 0ustar00var AutoJavascriptValidation = new Class({ initialize: function(form_name, rules) { this.run(form_name, rules); }, run: function(form_name, rules) { var check_group = 1; for(rule in rules){ rules[rule].each(function(field){ var k = 0; if($chk($$("input[name='"+field+"']")[k]) && $$("input[name='"+field+"']")[k].get('type') == 'hidden'){ k = 1; } if($chk($$("input[name='"+field+"']")[k])){ $$("input[name='"+field+"']")[k].addClass("validate['"+rule+"']"); } if($chk($$("select[name='"+field+"']")[k])){ $$("select[name='"+field+"']")[k].addClass("validate['"+rule+"']"); } if($chk($$("textarea[name='"+field+"']")[k])){ $$("textarea[name='"+field+"']")[k].addClass("validate['"+rule+"']"); } if($chk($$("input[name='"+field+"[]']")[0])){ $$("input[name='"+field+"[]']").each(function(check){ check.addClass("validate['group["+check_group+"]']"); }); check_group = check_group + 1; } }); }; } });auto_javascript_validation/assets/index.html000066600000000000151374535400015454 0ustar00auto_javascript_validation/auto_javascript_validation.ctp000066600000014413151374535400020312 0ustar00
Auto JavaScript Validation
Header(array('fields' => 'Fields', 'help' => 'Help'), 'auto_javascript_validation_config_{n}'); ?> tabStart('fields'); ?> input('action_auto_javascript_validation_{n}_required_config', array('type' => 'text', 'label' => "Required", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "Comma delimited list of required fields names, these fields should exist in the data array in order to pass this check.")); ?> input('action_auto_javascript_validation_{n}_alpha_config', array('type' => 'text', 'label' => "Alpha", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "Comma delimited list of fields names which should only contain an alpha value.")); ?> input('action_auto_javascript_validation_{n}_alphanum_config', array('type' => 'text', 'label' => "Alpha Numeric", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "Comma delimited list of fields names which should only contain an alpha numeric value.")); ?> input('action_auto_javascript_validation_{n}_digit_config', array('type' => 'text', 'label' => "Digit", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "Comma delimited list of fields names which should only contain a digit value.")); ?> input('action_auto_javascript_validation_{n}_nodigit_config', array('type' => 'text', 'label' => "No Digit", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "Comma delimited list of fields names which should only contain a non digit value.")); ?> input('action_auto_javascript_validation_{n}_number_config', array('type' => 'text', 'label' => "Number", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "Comma delimited list of fields names which should only contain a number value.")); ?> input('action_auto_javascript_validation_{n}_email_config', array('type' => 'text', 'label' => "Email", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "Comma delimited list of fields names which should only contain an email value.")); ?> input('action_auto_javascript_validation_{n}_phone_config', array('type' => 'text', 'label' => "Phone", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "Comma delimited list of fields names which should only contain a phone value.")); ?> input('action_auto_javascript_validation_{n}_phone_inter_config', array('type' => 'text', 'label' => "International Phone", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "Comma delimited list of fields names which should only contain an international phone value.")); ?> input('action_auto_javascript_validation_{n}_url_config', array('type' => 'text', 'label' => "URL", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "Comma delimited list of fields names which should only contain URLs.")); ?> input('action_auto_javascript_validation_{n}_image_config', array('type' => 'text', 'label' => "Image", 'class' => 'medium_input', 'value' => '', 'smalldesc' => "Comma delimited list of fields names which should only contain images (jpg, jpeg, png, gif, bmp).")); ?> tabEnd(); ?> tabStart('help'); ?>

  • Enter the fields names you want to check in the text field for the rule you want them to be checked against.

tabEnd(); ?>
auto_javascript_validation/index.html000066600000000000151374535400014152 0ustar00auto_javascript_validation/auto_javascript_validation.php000066600000001741151374535400020313 0ustar00 '1_validation', 'title' => 'Validation'); var $details = array('title' => 'Auto JavaScript Validation', 'tooltip' => 'Auto validate specific fields, useful only when your form has custom code.'); function run($form, $actiondata){ } function load($clear){ if($clear){ $action_params = array( 'required' => '', 'alpha' => '', 'alphanum' => '', 'digit' => '', 'nodigit' => '', 'number' => '', 'email' => '', 'phone' => '', 'phone_inter' => '', 'url' => '', 'image' => '' ); } return array('action_params' => $action_params); } } ?>auto_javascript_validation/cfaction_auto_javascript_validation.php000066600000004406151374535400022162 0ustar00params); $output = ''; $mainframe = JFactory::getApplication(); $document = JFactory::getDocument(); JHTML::_('behavior.mootools'); $uri = JFactory::getURI(); $document->addScript($uri->root().'administrator/components/com_chronoforms/form_actions/auto_javascript_validation/assets/auto_javascript_validation.js'); $rules = array('required', 'alpha', 'alphanum', 'digit', 'nodigit', 'number', 'email', 'phone', 'phone_inter', 'url', 'image'); ob_start(); ?> window.addEvent('domready', function() { get($rule, ''))){ $fields_list = explode(',', trim($params->get($rule, ''))); } foreach($fields_list as $k => $field){ $fields_list[$k] = "'".$field."'"; } $n_fields_list = implode(',', $fields_list); $object_list[] = "'".$rule."': [".$n_fields_list."]"; endforeach; ?> new AutoJavascriptValidation('form_name; ?>', ); }); form_params->get('dynamic_files', 0) === false){ $document->addScriptDeclaration("//"); }else{ //load the action class $form->loadActionHelper('load_js'); $CfactionLoadJsHelper = new CfactionLoadJsHelper(); $JSactiondata = new stdClass(); $JSactiondata->content1 = $script; $JSParams = new JParameter(''); $JSParams->set('dynamic_file', $form->form_params->get('dynamic_files', 0)); $JSactiondata->params = $JSParams->toString(); $CfactionLoadJsHelper->load($form, $JSactiondata); } //load validation files $form->loadActionHelper('show_html'); $CfactionShowHtmlHelper = new CfactionShowHtmlHelper(); $CfactionShowHtmlHelper->_loadValidationScripts($form); } } ?>auto_javascript_validation/.htaccess000066600000000177151374535400013772 0ustar00 Order allow,deny Deny from all auto_javascript_validation/cfaction_auto_javascript_validation.ctp000066600000000253151374535400022155 0ustar00loadAction($form, $actiondata); ?>