Exemplo n.º 1
0
 /**
  * Execute and display a template script.
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  mixed  A string if successful, otherwise a JError object.
  *
  * @see     fetch()
  * @since   11.1
  */
 public function display($tpl = null)
 {
     // Initialize variables
     $session = JFactory::getSession();
     $seesionQueue = $session->get('application.queue');
     $input = JFactory::getApplication()->input;
     $this->urlAction = $input->getString('tmpl', '');
     $this->_document = JFactory::getDocument();
     $this->_item = $this->get('Item');
     $emailModel = JModelForm::getInstance('EmailSettings', 'JSNUniformModel');
     $this->checkSubmitModal = false;
     if ($seesionQueue[0]['type'] != "warning") {
         unset($_SESSION["__form-design-" . $this->_item->form_id]);
         unset($_SESSION["__form-design-"]);
         if ($seesionQueue[0]) {
             if ($this->urlAction == "component") {
                 $this->checkSubmitModal = true;
             }
         }
     }
     $this->_listFontType = array(" Verdana, Geneva, sans-serif", "\"Times New Roman\", Times, serif", "\"Courier New\", Courier, monospace", "Tahoma, Geneva, sans-serif", "Arial, Helvetica, sans-serif", "\"Trebuchet MS\", Arial, Helvetica, sans-serif", "\"Arial Black\", Gadget, sans-serif", "\"Lucida Sans Unicode\", \"Lucida Grande\", sans-serif", "\"Palatino Linotype\", \"Book Antiqua\", Palatino, serif", "\"Comic Sans MS\", cursive");
     $formContent = $this->_item->form_content;
     $this->_listPage = JSNUniformHelper::getListPage($formContent, $this->_item->form_id);
     $this->_form = $this->get('Form');
     $this->_fromEmail = array();
     if (empty($this->_item->form_id)) {
         $this->_fromConfig = $this->get('DataConfig');
         $this->formAction = 0;
         $this->formActionData = '';
         foreach ($this->_fromConfig as $formConfig) {
             if (isset($formConfig->name) && $formConfig->name == 'email_notification') {
                 $this->_fromEmail = json_decode($formConfig->value);
             }
             if (isset($formConfig->name) && $formConfig->name == 'form_action') {
                 $this->formAction = $formConfig->value;
             }
         }
         foreach ($this->_fromConfig as $formConfig) {
             if ($this->formAction == 1 && $formConfig->name == 'form_action_url') {
                 $this->formActionData = $formConfig->value;
             }
             if ($this->formAction == 2 && $formConfig->name == 'form_action_menu') {
                 $this->formActionData = json_decode($formConfig->value);
             }
             if ($this->formAction == 3 && $formConfig->name == 'form_action_article') {
                 $this->formActionData = json_decode($formConfig->value);
             }
             if ($this->formAction == 4 && $formConfig->name == 'form_action_message') {
                 $this->formActionData = $formConfig->value;
             }
         }
     } else {
         $this->_fromEmail = $this->get('FormEmail');
     }
     $this->form_page = isset($formContent[0]->page_content) ? $formContent[0]->page_content : "";
     $this->actionForm = array('redirect_to_url' => "", 'menu_item' => "", 'menu_item_title' => "", 'article' => "", 'article_title' => "", 'message' => "", 'action' => "1");
     $this->actionForm = JSNUniformHelper::actionFrom($this->_item->form_post_action, $this->_item->form_post_action_data);
     $this->globalFormStyle = JSNUniformHelper::getDataConfig("form_style");
     $this->formStyle = new stdClass();
     if (!empty($this->_item->form_style)) {
         $this->formStyle = json_decode($this->_item->form_style);
     } else {
         $this->formStyle->themes_style->light = '{"background_color":"","background_active_color":"#FCF8E3","border_thickness":"0","border_color":"","border_active_color":"#FBEED5","rounded_corner_radius":"0","padding_space":"10","margin_space":"0","text_color":"#333333","font_type":" Verdana, Geneva, sans-serif","font_size":"14","field_background_color":"#ffffff","field_border_color":"","field_shadow_color":"","field_text_color":"#666666","message_error_background_color":"#B94A48","message_error_text_color":"#FFFFFF"}';
         $this->formStyle->themes_style->dark = '{"background_color":"","background_active_color":"#444444","border_thickness":"0","border_color":"","border_active_color":"#666666","rounded_corner_radius":"0","padding_space":"10","margin_space":"0","text_color":"#C6C6C6","font_type":" Verdana, Geneva, sans-serif","font_size":"14","field_background_color":"#000000","field_border_color":"#111111","field_shadow_color":"#000000","field_text_color":"#333333","message_error_background_color":"#B94A48","message_error_text_color":"#FFFFFF"}';
         $this->formStyle->themes = array('light', 'dark');
     }
     if (!empty($this->globalFormStyle)) {
         $globalFormStyle = json_decode($this->globalFormStyle->value);
         if (!empty($globalFormStyle->themes_style)) {
             foreach ($globalFormStyle->themes_style as $key => $value) {
                 $this->formStyle->themes_style->{$key} = $value;
             }
         }
         if (!empty($globalFormStyle->themes)) {
             foreach ($globalFormStyle->themes as $key => $value) {
                 $this->formStyle->themes[] = $value;
             }
         }
     }
     if (!empty($this->formStyle->theme) && !empty($this->formStyle->themes_style) && $this->formStyle->theme != "jsn-style-light" && $this->formStyle->theme != "jsn-style-dark") {
         $theme = str_replace("jsn-style-", "", $this->formStyle->theme);
         if (!empty($this->formStyle->themes_style->{$theme})) {
             $styles = json_decode($this->formStyle->themes_style->{$theme});
         }
         $this->formStyle->background_color = !empty($styles->background_color) ? $styles->background_color : "";
         $this->formStyle->background_active_color = !empty($styles->background_active_color) ? $styles->background_active_color : "";
         $this->formStyle->border_active_color = !empty($styles->border_active_color) ? $styles->border_active_color : "";
         $this->formStyle->border_thickness = !empty($styles->border_thickness) ? $styles->border_thickness : "";
         $this->formStyle->border_color = !empty($styles->border_color) ? $styles->border_color : "";
         $this->formStyle->rounded_corner_radius = !empty($styles->rounded_corner_radius) ? $styles->rounded_corner_radius : "";
         $this->formStyle->padding_space = !empty($styles->padding_space) ? $styles->padding_space : "";
         $this->formStyle->margin_space = !empty($styles->margin_space) ? $styles->margin_space : "";
         $this->formStyle->text_color = !empty($styles->text_color) ? $styles->text_color : "";
         $this->formStyle->font_type = !empty($styles->font_type) ? $styles->font_type : "";
         $this->formStyle->font_size = !empty($styles->font_size) ? $styles->font_size : "";
     } else {
         $this->formStyle->background_color = !empty($this->formStyle->background_color) ? $this->formStyle->background_color : "";
         $this->formStyle->background_active_color = !empty($this->formStyle->background_active_color) ? $this->formStyle->background_active_color : "";
         $this->formStyle->border_active_color = !empty($this->formStyle->border_active_color) ? $this->formStyle->border_active_color : "";
         $this->formStyle->border_thickness = !empty($this->formStyle->border_thickness) ? $this->formStyle->border_thickness : "";
         $this->formStyle->border_color = !empty($this->formStyle->border_color) ? $this->formStyle->border_color : "";
         $this->formStyle->rounded_corner_radius = !empty($this->formStyle->rounded_corner_radius) ? $this->formStyle->rounded_corner_radius : "";
         $this->formStyle->padding_space = !empty($this->formStyle->padding_space) ? $this->formStyle->padding_space : "";
         $this->formStyle->margin_space = !empty($this->formStyle->margin_space) ? $this->formStyle->margin_space : "";
         $this->formStyle->text_color = !empty($this->formStyle->text_color) ? $this->formStyle->text_color : "";
         $this->formStyle->font_type = !empty($this->formStyle->font_type) ? $this->formStyle->font_type : "";
         $this->formStyle->font_size = !empty($this->formStyle->font_size) ? $this->formStyle->font_size : "";
         if (empty($this->formStyle->background_active_color) && empty($this->formStyle->border_active_color) && empty($this->formStyle->border_thickness) && empty($this->formStyle->border_color) && empty($this->formStyle->rounded_corner_radius) && empty($this->formStyle->background_color) && empty($this->formStyle->font_size) && empty($this->formStyle->text_color) && empty($this->formStyle->margin_space) && empty($this->formStyle->padding_space)) {
             $this->formStyle->theme = "";
             $this->formStyle->themes_style->light = '{"background_color":"","background_active_color":"#FCF8E3","border_thickness":"0","border_color":"","border_active_color":"#FBEED5","rounded_corner_radius":"0","padding_space":"10","margin_space":"0","text_color":"#333333","font_type":" Verdana, Geneva, sans-serif","font_size":"14","field_background_color":"#ffffff","field_border_color":"","field_shadow_color":"","field_text_color":"#666666","message_error_background_color":"#B94A48","message_error_text_color":"#FFFFFF"}';
             $this->formStyle->themes_style->dark = '{"background_color":"","background_active_color":"#444444","border_thickness":"0","border_color":"","border_active_color":"#666666","rounded_corner_radius":"0","padding_space":"10","margin_space":"0","text_color":"#C6C6C6","font_type":" Verdana, Geneva, sans-serif","font_size":"14","field_background_color":"#000000","field_border_color":"#111111","field_shadow_color":"#000000","field_text_color":"#333333","message_error_background_color":"#B94A48","message_error_text_color":"#FFFFFF"}';
             $this->formStyle->themes = array('light', 'dark');
         }
     }
     // Hide the main menu
     $input->set('hidemainmenu', true);
     // Initialize toolbar
     $this->initToolbar();
     // Get config
     $config = JSNConfigHelper::get();
     $msgs = '';
     if (!$config->get('disable_all_messages')) {
         $msgs = JSNUtilsMessage::getList('FORMS');
         $msgs = count($msgs) ? JSNUtilsMessage::showMessages($msgs) : '';
     }
     // Assign variables for rendering
     $this->assignRef('msgs', $msgs);
     // Display the template
     parent::display($tpl);
     // Load assets
     JSNUniformHelper::addAssets();
     $this->addAssets();
 }
Exemplo n.º 2
0
 /**
  * Override save method to save form fields to database
  *
  * @param   array  $data  Data form
  *
  * @return boolean
  */
 public function save($data)
 {
     $user = JFactory::getUser();
     $post = $_POST;
     $emailModel = JModelForm::getInstance('EmailSettings', 'JSNUniformModel');
     if (isset($post['jform']['email-settings']['administrator'])) {
         $emailModel->saveForm($post['jform']['email-settings']['administrator']);
     }
     if (isset($post['jform']['email-settings']['submiter'])) {
         $emailModel->saveForm($post['jform']['email-settings']['submiter']);
     }
     $checkCreate = true;
     $data['form_submitter'] = isset($post['form_submitter']) ? json_encode($post['form_submitter']) : '';
     $data['form_post_action_data'] = isset($post['form_post_action_data' . $data['form_post_action']]) ? $post['form_post_action_data' . $data['form_post_action']] : '';
     if ($data['form_post_action_data']) {
         $data['form_post_action_data'] = get_magic_quotes_gpc() == true || get_magic_quotes_runtime() == true ? stripslashes($data['form_post_action_data']) : $data['form_post_action_data'];
     }
     $data['form_notify_submitter'] = isset($data['form_notify_submitter']) ? "1" : "0";
     $globalStyle = array();
     if (!empty($post['form_style']['themes_style'])) {
         $themeStyle = array();
         $themes = array();
         foreach ($post['form_style']['themes_style'] as $key => $value) {
             if ($key == "light" || $key == "dark") {
                 $themeStyle[$key] = $value;
                 $themes[] = $key;
             } else {
                 $globalStyle['themes_style'][$key] = $value;
                 $globalStyle['themes'][] = $key;
             }
         }
         $post['form_style']['themes_style'] = $themeStyle;
         $post['form_style']['themes'] = $themes;
     }
     $formSettings = new stdClass();
     $plgName = JSNUniformHelper::getPluginUniform();
     if (isset($plgName) && !empty($plgName)) {
         if (is_array($plgName)) {
             foreach ($plgName as $k => $v) {
                 $v = (array) $v;
                 $name = form_ . '' . $v['value'];
                 $formSettings->{$name} = !empty($post[$name]) ? $post[$name] : '';
                 JSNUniformControllerForm::do_ajax('saveBackEnd', $v['value'], $post[$name]);
             }
         }
     }
     $formSettings->form_show_mailchimp_subcriber = !empty($_POST['jsn_form_mailchimp_subcriber']['form_show_mailchimp_subcriber']) ? $_POST['jsn_form_mailchimp_subcriber']['form_show_mailchimp_subcriber'] : "No";
     $formSettings->form_mailchimp_subcriber_text = !empty($_POST['jsn_form_mailchimp_subcriber']['form_mailchimp_subcriber_text']) ? $_POST['jsn_form_mailchimp_subcriber']['form_mailchimp_subcriber_text'] : JText::_('JSN_UNIFORM_CUSTOM_MESSAGE_FOR_MAILCHIMP_SUBCRIBER');
     $formSettings->form_payment_money_value_text = !empty($_POST['jsn_form_total_money']['form_payment_money_value_text']) ? $_POST['jsn_form_total_money']['form_payment_money_value_text'] : JText::_('JSN_UNIFORM_TOTAL_MONEY');
     $formSettings->form_payment_money_value = !empty($_POST['jsn_form_total_money']['form_payment_money_value']) ? $_POST['jsn_form_total_money']['form_payment_money_value'] : '';
     $formSettings->form_show_total_money_text = !empty($_POST['jsn_form_total_money']['form_show_total_money_text']) ? $_POST['jsn_form_total_money']['form_show_total_money_text'] : "Yes";
     $formSettings->form_btn_next_text = !empty($_POST['jsn_form_button']['form_btn_next_text']) ? $_POST['jsn_form_button']['form_btn_next_text'] : JText::_('NEXT');
     $formSettings->form_btn_prev_text = !empty($_POST['jsn_form_button']['form_btn_prev_text']) ? $_POST['jsn_form_button']['form_btn_prev_text'] : JText::_('PREV');
     $formSettings->form_btn_submit_text = !empty($_POST['jsn_form_button']['form_btn_submit_text']) ? $_POST['jsn_form_button']['form_btn_submit_text'] : JText::_('SUBMIT');
     $formSettings->form_btn_submit_custom_class = !empty($_POST['jsn_form_button']['form_btn_submit_custom_class']) ? $_POST['jsn_form_button']['form_btn_submit_custom_class'] : '';
     $formSettings->form_btn_reset_text = !empty($_POST['jsn_form_button']['form_btn_reset_text']) ? $_POST['jsn_form_button']['form_btn_reset_text'] : JText::_('RESET');
     $formSettings->form_state_btn_reset_text = !empty($_POST['jsn_form_button']['form_state_btn_reset_text']) ? $_POST['jsn_form_button']['form_state_btn_reset_text'] : "No";
     $formSettings->action_save_submissions = !empty($_POST['jsn_uniform_settings']['action_save_submissions']) ? $_POST['jsn_uniform_settings']['action_save_submissions'] : 0;
     $data['form_settings'] = json_encode($formSettings);
     $data['form_style'] = !empty($post['form_style']) ? json_encode($post['form_style']) : "";
     $data['form_style'] = get_magic_quotes_gpc() == true || get_magic_quotes_runtime() == true ? stripslashes($data['form_style']) : $data['form_style'];
     $globalStyle = !empty($globalStyle) ? json_encode($globalStyle) : "";
     $globalStyle = get_magic_quotes_gpc() == true || get_magic_quotes_runtime() == true ? stripslashes($globalStyle) : $globalStyle;
     $db = JFactory::getDBO();
     $query = "REPLACE INTO `#__jsn_uniform_config` (name, value) VALUES ('form_style'," . $db->quote($globalStyle) . ")";
     $db->setQuery($query);
     if (!$db->execute()) {
         JError::raiseWarning(500, $db->getErrorMsg());
     }
     if (empty($data['form_id']) || $data['form_id'] == 0) {
         $data['form_created_by'] = $user->id;
         $data['form_created_at'] = date('Y-m-d H:i:s');
         $edition = defined('JSN_UNIFORM_EDITION') ? JSN_UNIFORM_EDITION : "free";
         if (strtolower($edition) == "free") {
             $dataListForm = JSNUniformHelper::getForms();
             if (count($dataListForm) >= 3) {
                 $checkCreate = false;
             }
         }
     } else {
         $data['form_modified_by'] = $user->id;
         $data['form_modified_at'] = date('Y-m-d H:i:s');
     }
     if ($checkCreate) {
         if ($result = parent::save($data)) {
             $formId = $this->getState($this->getName() . '.id');
             $this->saveField($data['form_id'], $data['form_layout']);
             $this->saveListEmail($post, $formId);
             $this->EmailTepmplates($formId, $data['form_id']);
         }
         return $result;
     } else {
         $msg = JText::sprintf('JSN_UNIFORM_YOU_HAVE_REACHED_THE_LIMITATION_OF_3_FORM_IN_FREE_EDITION', 0) . ' <a class="jsn-link-action" href="index.php?option=com_uniform&view=upgrade">' . JText::_("JSN_UNIFORM_UPGRADE_EDITION") . '</a>';
         $this->setError($msg);
         return false;
     }
 }
Exemplo n.º 3
0
    } elseif ($integrated_com == 'option') {
        $moduleRender = scloginHelper::loadModuleById($params->get('module_option'));
        $linkOption = $params->get('link_option');
    }
    $linkOption = JRoute::_($linkOption);
}
$user = JFactory::getUser();
$name = $params->get('name');
// LOAD MODEL FROM COM_USERS
$app = JFactory::getApplication();
$params_user = $app->getParams('com_users');
JLoader::import('joomla.application.component.model');
JLoader::import('registration', JPATH_SITE . '/components/com_users/models');
JForm::addFormPath(JPATH_SITE . '/components/com_users/models/forms');
JForm::addFieldPath(JPATH_SITE . '/components/com_users/models/fields');
$userModel = JModelForm::getInstance('Registration', 'UsersModel');
$form = $userModel->getForm();
//setting display type
if ($params->get("display_type") == 1) {
    $effect = 'btl-dropdown';
} else {
    $effect = 'btl-modal';
}
//setting for registration
$usersConfig = JComponentHelper::getParams('com_users');
$enabledRegistration = false;
$viewName = JRequest::getVar('view', 'registry');
$enabledCaptcha = 'none';
if ($usersConfig->get('allowUserRegistration') && $params->get("enabled_registration_tab", 1) == 1 && ($viewName != "registration" || $integrated_com != '')) {
    $enabledRegistration = true;
    $enabledCaptcha = $params->get('use_captcha', 1) == 1 ? JFactory::getConfig()->get('captcha') : $params->get('use_captcha', 0);
Exemplo n.º 4
0
							<?php 
echo JText::_('JSN_UNIFORM_SEND_TO_SUBMITTER');
?>
					</legend>
					<?php 
echo '<p class="alert alert-info">' . JText::_('JSN_UNIFORM_EMAIL_USUALLY_SENT_TO_THE_PERSON') . '</p>';
?>
					<div class="control-group jsn-items-list-container">
						<div class="controls">
							<div class="email-submitters">
								<ul id="emailSubmitters" class="jsn-items-list ui-sortable"></ul>
							</div>
						</div>
					</div>
					<?php 
$emailModel = JModelForm::getInstance('EmailSettings', 'JSNUniformModel');
$action = JFactory::getApplication()->input->getVar('action', 0);
$item = $emailModel->getItem($action);
$form = $emailModel->getForm();
?>
					<div class="jsn-bootstrap emailsettings email-submiter">
						<fieldset style="border: none;margin: 0;padding: 0;">
							<div class="control-group">
								<label class="control-label jsn-label-des-tipsy" original-title="<?php 
echo JText::_('JSN_UNIFORM_EMAIL_SPECIFY_THE_NAME_' . $action);
?>
"><?php 
echo JText::_('JSN_UNIFORM_EMAIL_SETTINGS_FROM');
?>
</label>
								<div id="from" class="controls">