AAAAload_js.php000066600000001366151374451760006717 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){ } } ?>.htaccess000066600000000177151374451760006370 0ustar00 Order allow,deny Deny from all index.html000066600000000035151374451760006560 0ustar00 load_js.ctp000066600000003761151374451760006717 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(); ?>
cfaction_load_js.php000066600000004253151374451760010563 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, '-_,', '+/='))))); } } ?>cfaction_load_js.ctp000066600000000162151374451760010555 0ustar00load($form, $actiondata); ?>