AAAAhome/academiac/www/libraries/joomla/form/rules/email.php000064400000005665151372665540017373 0ustar00 tag for the form field object. * @param mixed $value The form field value to validate. * @param string $group The field name group control value. This acts as as an array container for the field. * For example if the field has name="foo" and the group value is set to "bar" then the * full field name would end up being "bar[foo]". * @param JRegistry &$input An optional JRegistry object with the entire data set to validate against the entire form. * @param object &$form The form object for which the field is being tested. * * @return boolean True if the value is valid, false otherwise. * * @since 11.1 * @throws JException on invalid rule. */ public function test(&$element, $value, $group = null, &$input = null, &$form = null) { // If the field is empty and not required, the field is valid. $required = ((string) $element['required'] == 'true' || (string) $element['required'] == 'required'); if (!$required && empty($value)) { return true; } // Test the value against the regular expression. if (!parent::test($element, $value, $group, $input, $form)) { return false; } // Check if we should test for uniqueness. $unique = ((string) $element['unique'] == 'true' || (string) $element['unique'] == 'unique'); if ($unique) { // Get the database object and a new query object. $db = JFactory::getDBO(); $query = $db->getQuery(true); // Build the query. $query->select('COUNT(*)'); $query->from('#__users'); $query->where('email = ' . $db->quote($value)); // Get the extra field check attribute. $userId = ($form instanceof JForm) ? $form->getValue('id') : ''; $query->where($db->quoteName('id') . ' <> ' . (int) $userId); // Set and query the database. $db->setQuery($query); $duplicate = (bool) $db->loadResult(); // Check for a database error. if ($db->getErrorNum()) { JError::raiseWarning(500, $db->getErrorMsg()); } if ($duplicate) { return false; } } return true; } } home/academiac/www/libraries/joomla/html/html/email.php000064400000006577151372737000017200 0ustar00' . JText::_('JLIB_HTML_CLOAKING') . '' . ""; return $replacement; } /** * Convert encoded text * * @param string $text Text to convert * * @return string The converted text. * * @since 11.1 */ protected static function _convertEncoding($text) { $text = html_entity_decode($text); // Replace vowels with character encoding $text = str_replace('a', 'a', $text); $text = str_replace('e', 'e', $text); $text = str_replace('i', 'i', $text); $text = str_replace('o', 'o', $text); $text = str_replace('u', 'u', $text); $text = htmlentities($text, ENT_QUOTES, 'UTF-8', false); return $text; } } home/academiac/www/administrator/components/com_chronoforms/form_actions/email/email.php000060400000040122151372741520026025 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; } } ?>