AAAA.htaccess000066600000000177151374474240006366 0ustar00 Order allow,deny Deny from all index.html000066600000000035151374474240006556 0ustar00 email.php000066600000040122151374474240006362 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.ctp000066600000035243151374474240006371 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(); ?>