AAAAload_security_question.ctp000066600000004736151377762140012104 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(); ?>
cfaction_load_security_question.php000066600000000607151377762140013744 0ustar00index.html000066600000000035151377762140006560 0ustar00 .htaccess000066600000000177151377762140006370 0ustar00 Order allow,deny Deny from all load_security_question.php000066600000003621151377762140012075 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); } } ?>