function display($tpl = null) { FCP_Admin::make_title('COM_FLEXICONTACT_LOG'); JToolBarHelper::cancel('display'); // get the filter states $app = JFactory::getApplication(); $filter_date = $app->getUserStateFromRequest(LAFC_COMPONENT . '.filter_date', 'filter_date', LAFC_LOG_ALL, 'int'); // make the filter lists $date_filters = array(LAFC_LOG_ALL => JText::_('COM_FLEXICONTACT_LOG_ALL'), LAFC_LOG_LAST_12_MONTHS => JText::_('COM_FLEXICONTACT_LOG_LAST_12_MONTHS')); $lists['date'] = FCP_Common::make_list('filter_date', $filter_date, $date_filters, 0, 'onchange="submitform( );"'); // show the chart ?> <form action="index.php" method="get" name="adminForm" id="adminForm"> <input type="hidden" name="option" value="<?php echo LAFC_COMPONENT; ?> " /> <input type="hidden" name="task" value="stats" /> <input type="hidden" name="controller" value="log" /> <table> <tr> <td align="left" width="100%"> <?php echo '<strong>' . $this->title . '</strong>'; ?> </td> <td nowrap="nowrap"> <?php echo $lists['date']; echo ' '; echo '<button class="fcp_button" onclick="' . "\n\t\t\t\t\tthis.form.getElementById('filter_date').value='" . LAFC_LOG_ALL . "';\n\t\t\t\t\tthis.form.submit();" . '">' . JText::_('COM_FLEXICONTACT_RESET') . '</button>'; ?> </td> </tr> </table> </form> <?php if (strpos($this->data, 'script type')) { $document = JFactory::getDocument(); $document->addScript("https://www.google.com/jsapi"); // load the Google jsapi $document->addCustomTag($this->data); // load the chart script echo '<div id="chart_1"></div>'; // create an element for the chart to be drawn in } else { echo $this->data; } echo '<h3>' . JText::sprintf('COM_FLEXICONTACT_LOG_ROWS', $this->num_rows) . '</h3>'; ?> <div align="right"><?php echo JText::_('COM_FLEXICONTACT_POWERED_BY') . ' ' . JHTML::link(PLOTALOT_LINK, "Plotalot", 'target="_blank"'); ?> </div> <?php }
function display($tpl = null) { FCP_Admin::make_title('COM_FLEXICONTACT_LOG'); JToolBarHelper::deleteList('', 'delete_log'); JToolBarHelper::custom('stats', 'chart.png', 'chart.png', JText::_('COM_FLEXICONTACT_STATS'), false); if ($this->free_log_info != null and $this->free_log_info->count > 0) { JToolBarHelper::custom('import', 'upload.png', 'upload.png', JText::_('COM_FLEXICONTACT_IMPORT'), false); } JToolBarHelper::custom('download', 'download.png', 'download.png', JText::_('COM_FLEXICONTACT_DOWNLOAD'), false); // get the order states $app = JFactory::getApplication(); $filter_order = $app->getUserStateFromRequest(LAFC_COMPONENT . '.filter_order', 'filter_order', 'date_time'); $filter_order_Dir = $app->getUserStateFromRequest(LAFC_COMPONENT . '.filter_order_Dir', 'filter_order_Dir', 'desc'); $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; $search = $app->getUserStateFromRequest(LAFC_COMPONENT . '.search', 'search', '', 'string'); $lists['search'] = JString::strtolower($search); // get the current filters $filter_date = $app->getUserStateFromRequest(LAFC_COMPONENT . '.filter_date', 'filter_date', LAFC_LOG_LAST_28_DAYS, 'int'); $filter_config = $app->getUserStateFromRequest(LAFC_COMPONENT . '.filter_config', 'filter_config', 'all', 'string'); // make the filter lists $date_filters = array(LAFC_LOG_ALL => JText::_('COM_FLEXICONTACT_LOG_ALL'), LAFC_LOG_LAST_7_DAYS => JText::_('COM_FLEXICONTACT_LOG_LAST_7_DAYS'), LAFC_LOG_LAST_28_DAYS => JText::_('COM_FLEXICONTACT_LOG_LAST_28_DAYS'), LAFC_LOG_LAST_12_MONTHS => JText::_('COM_FLEXICONTACT_LOG_LAST_12_MONTHS')); $lists['date_filters'] = FCP_Common::make_list('filter_date', $filter_date, $date_filters, 0, 'onchange="this.form.task.value=\'log_list\';submitform( );"'); $lists['config_filters'] = FCP_Common::make_list('filter_config', $filter_config, $this->config_list, ' ', 'onchange="this.form.task.value=\'log_list\';submitform( );"'); // Joomla 3.0 took away the Javascript checkAll() function. Joomla.checkAll() first appeared in 1.7 $numrows = count($this->log_list); $check_all = 'onclick="Joomla.checkAll(this);"'; // Show the list ?> <form action="index.php" method="post" name="adminForm" id="adminForm"> <input type="hidden" name="option" value="<?php echo LAFC_COMPONENT; ?> " /> <input type="hidden" name="controller" value="log" /> <input type="hidden" name="task" value="log_list" /> <input type="hidden" name="boxchecked" value="0" /> <input type="hidden" name="view" value="log_list" /> <input type="hidden" name="filter_order" value="<?php echo $lists['order']; ?> " /> <input type="hidden" name="filter_order_Dir" value="<?php echo $lists['order_Dir']; ?> " /> <table> <tr> <td align="left" width="100%"> <?php echo ' ' . JText::_('COM_FLEXICONTACT_SEARCH') . ':'; echo '<input type="text" size="60" name="search" id="search" value="'; echo $lists['search']; echo '" class="text_area" />'; echo ' <button class="fcp_button" onclick="this.form.task.value=\'log_list\';this.form.submit();">' . JText::_('COM_FLEXICONTACT_GO') . '</button>'; ?> </td> <td nowrap="nowrap"> <?php echo JText::_('COM_FLEXICONTACT_CONFIGURATION') . $lists['config_filters'] . ' '; echo $lists['date_filters']; echo ' '; echo '<button class="fcp_button" onclick="' . "\n\t\t\t\t\tthis.form.filter_date.value='" . LAFC_LOG_LAST_28_DAYS . "';\n\t\t\t\t\tthis.form.search.value='';\n\t\t\t\t\tthis.form.filter_config.value='all';\n\t\t\t\t\tthis.form.task.value='log_list';\n\t\t\t\t\tthis.form.submit();" . '">' . JText::_('COM_FLEXICONTACT_RESET') . '</button>'; ?> </td> </tr> </table> <table class="adminlist table table-striped"> <thead> <tr> <th width="20"><input type="checkbox" name="toggle" value="" <?php echo $check_all; ?> /></th> <th class="title" nowrap="nowrap"> <?php echo JHTML::_('grid.sort', 'COM_FLEXICONTACT_DATE_TIME', 'datetime', $lists['order_Dir'], $lists['order']); ?> </th> <th class="title" nowrap="nowrap"> <?php echo JHTML::_('grid.sort', 'COM_FLEXICONTACT_NAME', 'name', $lists['order_Dir'], $lists['order']); ?> </th> <th class="title" nowrap="nowrap"> <?php echo JHTML::_('grid.sort', 'COM_FLEXICONTACT_EMAIL', 'email', $lists['order_Dir'], $lists['order']); ?> </th> <th class="title" nowrap="nowrap"> <?php echo JHTML::_('grid.sort', 'COM_FLEXICONTACT_SUBJECT', 'subject', $lists['order_Dir'], $lists['order']); ?> </th> <th class="title" nowrap="nowrap"><?php echo JText::_('COM_FLEXICONTACT_OTHER_DATA'); ?> </th> <th class="title" nowrap="nowrap"><?php echo JText::_('COM_FLEXICONTACT_STATUS'); ?> </th> </tr> </thead> <tfoot> <tr> <td colspan="15"> <?php echo $this->pagination->getListFooter(); ?> </td> </tr> </tfoot> <tbody> <?php $k = 0; for ($i = 0; $i < $numrows; $i++) { $row = $this->log_list[$i]; $link = JRoute::_(LAFC_COMPONENT_LINK . '&controller=log&task=log_detail&log_id=' . $row->id); $checked = JHTML::_('grid.id', $i, $row->id); $date = JHTML::link($link, $row->datetime); $name = preg_replace('/[^(a-zA-Z \\x27)]*/', '', $row->name); // remove all except a-z, A-Z, and ' $subject = preg_replace('/[^(a-zA-Z1-9 \\x27)]*/', '', $row->subject); $other_data = str_replace('<br />', ' ', $row->short_message); // $other_data = preg_replace('/[^(a-zA-Z1-9 :\x27)]*/','', $other_data); $status_main = $this->_status($row->status_main); $status_copy = $this->_status($row->status_copy); $attachment = $this->_attachment($row->attached_file); echo "\n" . '<tr class="row' . $k . '">'; echo "\n " . '<td align="center">' . $checked . '</td>'; echo "\n " . '<td nowrap="nowrap">' . $date . '</td>'; echo "\n " . '<td>' . $name . '</td>'; if ($row->email != '') { $email_link = 'mailto:' . $row->email . '?Subject=' . $subject; echo "\n " . '<td>' . JHTML::link($email_link, $row->email, 'target="_blank"') . '</td>'; } else { echo "\n " . '<td>' . $row->email . '</td>'; } echo "\n " . '<td>' . $subject . '</td>'; echo "\n " . '<td>' . $other_data . '</td>'; echo "\n " . '<td>' . $status_main . ' ' . $status_copy . ' ' . $attachment . '</td>'; echo "\n" . '</tr>'; $k = 1 - $k; } ?> </tbody> </table> </form> <?php }
function validate_fields($config_data, &$response_array) { $valid = true; foreach ($this->data as $field_id => $field_value) { if (substr($field_id, 0, 5) != 'field') { // we only look at user defined fields here continue; } $field_index = intval(substr($field_id, 5, 3)); // field id's are 'fieldnnn' or 'fieldnnnmm' for multiple checkboxes $field =& $config_data->all_fields[$field_index]; // point to the field configuration $error_id = sprintf('fcp_err%03d', $field_index); if (FCP_trace::tracing()) { if (strlen($field_id) == 8) { $trace_field_id = $field_id; } else { $trace_field_id = substr($field_id, 0, 8) . '-' . substr($field_id, 8); } // multiple checkbox FCP_trace::trace(" validating {$trace_field_id} ({$field->prompt}) => [{$field_value}]"); } // don't validate hidden fields if (!$field->visible) { continue; } // valid unless found otherwise $response = array(); $response['f_valid'] = $field_id; $response['e_valid'] = $error_id; // if the field is mandatory and empty, that's the only error we will report for this field if ($field->mandatory and empty($field_value)) { $response = array(); $response['f_error'] = $field_id; $response['e_error'] = $error_id; $response[$error_id] = $this->make_error($config_data, JText::_('COM_FLEXICONTACT_REQUIRED')); $valid = false; $response_array[] = $response; continue; } // if the field is mandatory and not empty, we must clear its error if ($field->mandatory and !empty($field_value)) { $response_array[] = $response; } // if the field is not mandatory and is empty, we must not validate it and we must clear its error if (!$field->mandatory and empty($field_value)) { $response_array[] = $response; continue; } // checkboxes and radio buttons don't need to be validated if (in_array($field->field_type, array(LAFC_FIELD_CHECKBOX_L, LAFC_FIELD_CHECKBOX_H, LAFC_FIELD_CHECKBOX_R, LAFC_FIELD_CHECKBOX_M, LAFC_FIELD_RADIO_V, LAFC_FIELD_RADIO_H))) { continue; } // now the field type specific validation switch ($field->field_type) { case LAFC_FIELD_SUBJECT: $bad_subject_chars = "|<>`"; // characters we don't allow if (strpbrk($field_value, $bad_subject_chars) === false) { break; } $response = array(); $response['f_error'] = $field_id; $response['e_error'] = $error_id; $response[$error_id] = $this->make_error($config_data, JText::_('COM_FLEXICONTACT_INVALID')); $valid = false; break; case LAFC_FIELD_FROM_ADDRESS: jimport('joomla.mail.helper'); if (JMailHelper::isEmailAddress($field_value)) { break; } $response = array(); $response['f_error'] = $field_id; $response['e_error'] = $error_id; $response[$error_id] = $this->make_error($config_data, JText::_('COM_FLEXICONTACT_BAD_EMAIL')); $valid = false; break; case LAFC_FIELD_TEXT_NUMERIC: if (FCP_Common::is_posint($field_value)) { break; } $response = array(); $response['f_error'] = $field_id; $response['e_error'] = $error_id; $response[$error_id] = $this->make_error($config_data, JText::_('COM_FLEXICONTACT_INVALID')); $valid = false; break; case LAFC_FIELD_DATE: $yyyy_mm_dd = self::reformat_date($field_value, $config_data->date_format); if (!self::validate_date($yyyy_mm_dd)) { $date_string = self::get_date_string($config_data->date_format); $response = array(); $response['f_error'] = $field_id; $response['e_error'] = $error_id; $response[$error_id] = $this->make_error($config_data, JText::_('COM_FLEXICONTACT_INVALID') . ' (' . $date_string . ')'); $valid = false; break; } switch ($field->validation_type) { case VALTYPE_PAST: FCP_trace::trace(" must be in the past"); $today = date('Y-m-d'); if ($yyyy_mm_dd > $today) { $response = array(); $response['f_error'] = $field_id; $response['e_error'] = $error_id; $response[$error_id] = $this->make_error($config_data, JText::_('COM_FLEXICONTACT_DATE_PAST')); $valid = false; FCP_trace::trace(" - invalid, not in the past"); } break; case VALTYPE_FUTURE: FCP_trace::trace(" must be in the future"); $today = date('Y-m-d'); if ($yyyy_mm_dd < $today) { $response = array(); $response['f_error'] = $field_id; $response['e_error'] = $error_id; $response[$error_id] = $this->make_error($config_data, JText::_('COM_FLEXICONTACT_DATE_FUTURE')); $valid = false; FCP_trace::trace(" - invalid, not in the future"); } break; case VALTYPE_GREATER: FCP_trace::trace(" must be greater than the previous field"); if ($field_index == 0) { break; } // no previous field - forget it $previous_field_index = $field_index - 1; // previous field index $previous_field_config =& $config_data->all_fields[$previous_field_index]; if ($previous_field_config->field_type != LAFC_FIELD_DATE) { break; } // not a date field - forget it $previous_field_id = sprintf('field%03d', $previous_field_index); // form the ID of the previous field FCP_trace::trace(" previous field ID:" . $previous_field_id); if (!isset($this->data[$previous_field_id])) { break; } // no value - forget it $previous_field_value = $this->data[$previous_field_id]; $previous_field_yyyy_mm_dd = self::reformat_date($previous_field_value, $config_data->date_format); $previous_field_prompt = $previous_field_config->prompt; FCP_trace::trace(" previous field [" . $previous_field_prompt . '] value: ' . $previous_field_value . ' (current field value: ' . $yyyy_mm_dd . ')'); if ($yyyy_mm_dd <= $previous_field_yyyy_mm_dd) { $response = array(); $response['f_error'] = $field_id; $response['e_error'] = $error_id; $response[$error_id] = $this->make_error($config_data, JText::sprintf('COM_FLEXICONTACT_DATE_GREATER', $previous_field_prompt)); $valid = false; FCP_trace::trace(" - invalid, not greater than previous field"); } break; } break; case LAFC_FIELD_ADVANCED: if (!empty($field->regex)) { FCP_trace::trace(" validate regex: " . $field->regex); if (@preg_match($field->regex, $field_value) == 0) { $response = array(); $response['f_error'] = $field_id; $response['e_error'] = $error_id; if ($field->error_msg == '') { $response[$error_id] = $this->make_error($config_data, JText::_('COM_FLEXICONTACT_INVALID')); } else { $response[$error_id] = $this->make_error($config_data, $field->error_msg); } $valid = false; } } if (!empty($field->sql)) { $escaped_value = $this->_db->escape($field_value); $query = str_replace('%VALUE%', $escaped_value, $field->sql); $result = $this->ladb_loadResult($query); FCP_trace::trace(" validate sql: " . $query); FCP_trace::trace(" sql result: " . $result); if ($result === false) { FCP_trace::trace(" " . $this->ladb_error_text); } if ($result == 0) { $response = array(); $response['f_error'] = $field_id; $response['e_error'] = $error_id; if ($field->error_msg == '') { $response[$error_id] = $this->make_error($config_data, JText::_('COM_FLEXICONTACT_INVALID')); } else { $response[$error_id] = $this->make_error($config_data, $field->error_msg); } $valid = false; } } break; case LAFC_FIELD_ATTACHMENT: FCP_trace::trace(" validate file: " . $field_value); // it's ok, we won't get here if the filename is blank (the field size variable would not be set) ... $file_size_variable_name = sprintf('filesize%03d', $field_index); $jinput = JFactory::getApplication()->input; $file_size = $jinput->get($file_size_variable_name, '0', 'STRING'); $file_extension = pathinfo($field_value, PATHINFO_EXTENSION); FCP_trace::trace(" file_size: " . $file_size . ", extension = " . $file_extension); $white_list_array = explode(',', $config_data->white_list); if (!in_array(strtolower($file_extension), $white_list_array)) { $error_message = JText::sprintf('COM_FLEXICONTACT_FILES_ALLOWED', $config_data->white_list); $response = array(); $response['f_error'] = $field_id; $response['e_error'] = $error_id; $response[$error_id] = $this->make_error($config_data, $error_message); $valid = false; } if ($file_size > $config_data->max_file_size * 1024) { $error_message = JText::sprintf('COM_FLEXICONTACT_FILE_TOO_BIG', $config_data->max_file_size); $response = array(); $response['f_error'] = $field_id; $response['e_error'] = $error_id; $response[$error_id] = $this->make_error($config_data, $error_message); $valid = false; } if ($file_size == 0) { $error_message = JText::_('COM_FLEXICONTACT_FILE_EMPTY'); $response = array(); $response['f_error'] = $field_id; $response['e_error'] = $error_id; $response[$error_id] = $this->make_error($config_data, $error_message); $valid = false; } break; } // end switch $response_array[] = $response; } // end foreach return $valid; }
function display($tpl = null) { if ($this->new_flag == 1) { FCP_Admin::make_title('COM_FLEXICONTACT_NEW_CONFIG'); } else { FCP_Admin::make_title('COM_FLEXICONTACT_CONFIG_EDIT', $this->config_data, $this->config_count); } JToolBarHelper::apply(); JToolBarHelper::save(); JToolBarHelper::cancel(); $langs = FCP_Admin::make_lang_list(); $cur_lang = JFactory::getLanguage(); $lang_text = JText::_('JFIELD_LANGUAGE_LABEL'); ?> <form action="index.php" method="post" name="adminForm" id="adminForm" > <input type="hidden" name="option" value="<?php echo LAFC_COMPONENT; ?> " /> <input type="hidden" name="controller" value="multiconfig" /> <input type="hidden" name="task" value="add" /> <input type="hidden" name="view" value="config_edit" /> <input type="hidden" name="new_flag" value="<?php echo $this->new_flag; ?> " /> <input type="hidden" name="copy_flag" value="<?php echo $this->copy_flag; ?> " /> <table class="fc_table"> <?php // if we are creating a new configuration, show the "base" config selector if ($this->new_flag == 1 and $this->copy_flag == 0) { echo '<tr><td class="prompt">' . JText::_('COM_FLEXICONTACT_BASE_CONFIG') . '</td>'; if ($this->config_count > 1) { $config_list = FCP_Common::make_list('config_id', $this->config_data->id, $this->config_names); $info = FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_BASE_CONFIG_DESC')); echo '<td>' . $config_list . ' ' . $info . '</td></tr>'; } else { echo '<input type="hidden" name="config_id" value="0" />'; echo '<td>' . JText::_('COM_FLEXICONTACT_DEFAULT') . '</td></tr>'; } echo '<tr><td colspan="2"><h3>' . JText::_('COM_FLEXICONTACT_NEW_CONFIG') . '</h3></td></tr>'; } else { echo '<input type="hidden" name="config_id" value="' . $this->config_data->id . '" />'; } // edit mode // the new configuration name echo '<tr><td class="prompt">' . JText::_('COM_FLEXICONTACT_CONFIG_NAME') . '</td>'; if ($this->copy_flag == 1) { echo '<input type="hidden" name="name" value="' . $this->config_data->name . '" />'; echo '<td>' . $this->config_data->name . '</td></tr>'; } else { echo '<td><input type="text" size="40" name="name" value = "' . $this->config_data->name . '" /></td></tr>'; } // the new configuration language echo '<tr><td class="prompt">' . $lang_text . '</td>'; if (count($langs) > 1) { $lang_list = FCP_Common::make_list('config_lang', $this->config_data->language, $langs); echo '<td>' . $lang_list . '</td></tr>'; } else { echo '<input type="hidden" name="config_lang" value="' . $cur_lang->getTag() . '" />'; echo '<td>' . $cur_lang->getTag() . '</td></tr>'; } // a description for the new config echo '<tr><td class="prompt">' . JText::_('COM_FLEXICONTACT_CONFIG_DESC') . '</td>'; echo '<td><input type="text" size="120" name="description" value = "' . $this->config_data->description . '" /></td></tr>'; echo '</table>'; echo '</form>'; }
function check($view) { $ret = true; switch ($view) { case 'config_confirm': if ($this->_data->config_data->confirm_link == '' and $this->_data->config_data->confirm_text == '') { $msg = JText::_('COM_FLEXICONTACT_ALL_BLANK'); $this->_app->enqueueMessage($msg, 'error'); return false; } break; // case 'config_confirm' // case 'config_confirm' case 'config_text': if (stristr($this->_data->config_data->top_text, "{flexicontactplus") != false) { $msg = JText::_('COM_FLEXICONTACT_INVALID') . ' - {flexicontactplus...}'; $this->_app->enqueueMessage($msg, 'error'); return false; } if (stristr($this->_data->config_data->bottom_text, "{flexicontactplus") != false) { $msg = JText::_('COM_FLEXICONTACT_INVALID') . ' - {flexicontactplus...}'; $this->_app->enqueueMessage($msg, 'error'); return false; } break; // case 'config_text' if ($this->_data->config_data->confirm_link == '' and $this->_data->config_data->confirm_text == '') { $msg = JText::_('COM_FLEXICONTACT_ALL_BLANK'); $this->_app->enqueueMessage($msg, 'error'); return false; } break; // case 'config_text' // case 'config_text' case 'config_edit': FCP_Common::strip_quotes($this->_data->name); if (!FCP_Common::clean_string($this->_data->name, false)) { $msg = JText::_('COM_FLEXICONTACT_INVALID') . ' (' . JText::_('COM_FLEXICONTACT_CONFIG_NAME') . ')'; $this->_app->enqueueMessage($msg, 'error'); return false; } if (strstr($this->_data->name, ' ') != false) { $msg = JText::_('COM_FLEXICONTACT_NO_SPACE') . ' (' . JText::_('COM_FLEXICONTACT_CONFIG_NAME') . ')'; $this->_app->enqueueMessage($msg, 'error'); return false; } if ($this->_exists($this->_data->name, $this->_data->language, $this->_data->id)) { $msg = JText::_('COM_FLEXICONTACT_CONFIG_DUP'); $this->_app->enqueueMessage($msg, 'error'); return false; } break; // case 'config_edit' // case 'config_edit' case 'config_general': $msg = JText::_('COM_FLEXICONTACT_INVALID'); if (!FCP_Common::clean_string($this->_data->config_data->send_text)) { $msg .= ' (' . JText::_('COM_FLEXICONTACT_INVALID') . ' ' . JText::_('COM_FLEXICONTACT_SEND_TEXT') . ')'; $ret = false; } if (!FCP_Common::clean_string($this->_data->config_data->email_from)) { $msg .= ' (' . JText::_('COM_FLEXICONTACT_FIELD_FROM_ADDRESS') . ')'; $ret = false; } else { $check_msg = FCP_Admin::validate_email_address($this->_data->config_data->email_from, true); if ($check_msg != '') { $msg .= ' (' . JText::_('COM_FLEXICONTACT_FIELD_FROM_ADDRESS') . ' ' . $check_msg . ')'; $ret = false; } } if (!FCP_Common::clean_string($this->_data->config_data->email_to)) { $msg .= ' (' . JText::_('COM_FLEXICONTACT_V_EMAIL_TO') . ')'; $ret = false; } else { $check_msg = FCP_Admin::validate_email_address($this->_data->config_data->email_to, false); if ($check_msg != '') { $msg .= ' (' . JText::_('COM_FLEXICONTACT_V_EMAIL_TO') . ' ' . $check_msg . ')'; $ret = false; } } if (!FCP_Common::clean_string($this->_data->config_data->email_cc)) { $msg .= ' (' . JText::_('COM_FLEXICONTACT_V_EMAIL_CC') . ')'; $ret = false; } else { $check_msg = FCP_Admin::validate_email_list($this->_data->config_data->email_cc); if ($check_msg != '') { $msg .= ' (' . JText::_('COM_FLEXICONTACT_V_EMAIL_CC') . ' ' . $check_msg . ')'; $ret = false; } } if (!FCP_Common::clean_string($this->_data->config_data->email_bcc)) { $msg .= ' (' . JText::_('COM_FLEXICONTACT_V_EMAIL_BCC') . ')'; $ret = false; } else { $check_msg = FCP_Admin::validate_email_list($this->_data->config_data->email_bcc); if ($check_msg != '') { $msg .= ' (' . JText::_('COM_FLEXICONTACT_V_EMAIL_BCC') . ' ' . $check_msg . ')'; $ret = false; } } if (!FCP_Common::clean_string($this->_data->config_data->email_from_name)) { $msg .= ' (' . JText::_('COM_FLEXICONTACT_FIELD_FROM_NAME') . ')'; $ret = false; } if (!FCP_Common::clean_string($this->_data->config_data->agreement_prompt)) { $msg .= ' (' . JText::_('COM_FLEXICONTACT_AGREEMENT_REQUIRED') . ' ' . JText::_('COM_FLEXICONTACT_V_PROMPT') . ')'; $ret = false; } if (!FCP_Common::clean_string($this->_data->config_data->agreement_name)) { $msg .= ' (' . JText::_('COM_FLEXICONTACT_AGREEMENT_REQUIRED') . ' ' . JText::_('COM_FLEXICONTACT_NAME') . ')'; $ret = false; } if (!FCP_Common::clean_string($this->_data->config_data->white_list)) { $msg .= ' (' . JText::_('COM_FLEXICONTACT_INVALID') . ' ' . JText::_('COM_FLEXICONTACT_ATTACHMENT_WHITE_LIST') . ' (' . $this->_data->config_data->white_list . ')'; $ret = false; } if (!FCP_Common::is_posint($this->_data->config_data->max_file_size) or $this->_data->config_data->max_file_size == 0) { $msg .= ' (' . JText::_('COM_FLEXICONTACT_INVALID') . ' ' . JText::_('COM_FLEXICONTACT_ATTACHMENT_MAX_SIZE') . ' (' . $this->_data->config_data->max_file_size . ')'; $ret = false; } $max_size = FCP_Admin::get_max_file_size(); if ($max_size > LAFC_MAX_FILE_SIZE) { // Maximum file size must be the lesser of our constant or PHP INI setting $max_size = LAFC_MAX_FILE_SIZE; } if ($this->_data->config_data->max_file_size > $max_size) { $msg .= ' (' . JText::sprintf('COM_FLEXICONTACT_MAX_SIZE_EXCEEDED', $max_size) . ' (' . $this->_data->config_data->max_file_size . ')'; $ret = false; } if (!$ret) { $this->_app->enqueueMessage($msg, 'error'); return false; } break; // case 'config_general' // case 'config_general' case 'config_captcha': $ret = true; $check_string = JText::_('COM_FLEXICONTACT_INVALID'); $msg = $check_string; if (!FCP_Common::clean_string($this->_data->config_data->magic_word)) { $msg .= ' (' . JText::_('COM_FLEXICONTACT_V_MAGIC_WORD') . ')'; $ret = false; } if (!FCP_Common::clean_string($this->_data->config_data->magic_word_prompt)) { $msg .= ' (' . JText::_('COM_FLEXICONTACT_MAGIC_WORD_LABEL') . ')'; $ret = false; } if ($this->_data->config_data->magic_word != '' and $this->_data->config_data->magic_word_prompt == '') { $this->_app->enqueueMessage(JText::_('COM_FLEXICONTACT_REQUIRED') . ' (' . JText::_('COM_FLEXICONTACT_MAGIC_WORD_LABEL') . ')', 'error'); $ret = false; } if (!FCP_Common::is_posint($this->_data->config_data->num_images)) { $msg .= ' (' . JText::_('COM_FLEXICONTACT_V_CAPTCHA_NUMBER') . ')'; $ret = false; } if (!FCP_Common::is_posint($this->_data->config_data->image_height, true)) { $msg .= ' (' . JText::_('COM_FLEXICONTACT_V_HEIGHT') . ')'; $ret = false; } elseif ($this->_data->config_data->image_height > 150) { $this->_data->config_data->image_height = 150; } if (!FCP_Common::is_posint($this->_data->config_data->image_width, true)) { $msg .= ' (' . JText::_('COM_FLEXICONTACT_V_WIDTH') . ')'; $ret = false; } elseif ($this->_data->config_data->image_width > 150) { $this->_data->config_data->image_width = 150; } if (!FCP_Common::is_posint($this->_data->config_data->captcha_height, true)) { $msg .= ' (' . JText::_('COM_FLEXICONTACT_SECURE_CAPTCHA') . ' ' . JText::_('COM_FLEXICONTACT_V_HEIGHT') . ')'; $ret = false; } if (!FCP_Common::is_posint($this->_data->config_data->captcha_width, true)) { $msg .= ' (' . JText::_('COM_FLEXICONTACT_SECURE_CAPTCHA') . ' ' . JText::_('COM_FLEXICONTACT_V_WIDTH') . ')'; $ret = false; } if (!FCP_Common::clean_string($this->_data->config_data->secure_captcha_prompt)) { $msg .= ' (' . JText::_('COM_FLEXICONTACT_SECURE_CAPTCHA_LABEL') . ')'; $ret = false; } if ($this->_data->config_data->recaptcha_theme != 0) { if (strlen($this->_data->config_data->recaptcha_public_key) != 40) { $msg .= ' (' . JText::_('COM_FLEXICONTACT_RECAPTCHA') . ' ' . JText::_('COM_FLEXICONTACT_RECAPTCHA_PUBLIC_KEY') . ')'; $ret = false; } if (strlen($this->_data->config_data->recaptcha_private_key) != 40) { $msg .= ' (' . JText::_('COM_FLEXICONTACT_RECAPTCHA') . ' ' . JText::_('COM_FLEXICONTACT_RECAPTCHA_PRIVATE_KEY') . ')'; $ret = false; } } if (!$ret) { if ($msg != $check_string) { $this->_app->enqueueMessage($msg, 'error'); } return false; } break; // case 'config_captcha' // case 'config_captcha' case 'config_field': $field =& $this->_data->config_data->all_fields[$this->_data->field_index]; if ($field->field_type == LAFC_FIELD_CHECKBOX_H) { $msg = JText::sprintf('COM_FLEXICONTACT_FIELD_TYPE_DEPRECATED', JText::_('COM_FLEXICONTACT_FIELD_CHECKBOX_M')); $this->_app->enqueueMessage($msg, 'error'); return false; } if ($field->field_type == LAFC_FIELD_NONE) { $msg = JText::_('COM_FLEXICONTACT_INVALID') . ' (' . JText::_('COM_FLEXICONTACT_FIELD_TYPE') . ')'; $this->_app->enqueueMessage($msg, 'error'); return false; } if (!FCP_Common::clean_string($field->prompt)) { $msg = JText::_('COM_FLEXICONTACT_INVALID') . ' (' . JText::_('COM_FLEXICONTACT_V_PROMPT') . ')'; $this->_app->enqueueMessage($msg, 'error'); return false; } if (strlen($field->prompt) > LAFC_MAX_PROMPT_LENGTH) { $msg = JText::_('COM_FLEXICONTACT_MAX_LENGTH') . ' (' . JText::_('COM_FLEXICONTACT_V_PROMPT') . ')'; $this->_app->enqueueMessage($msg, 'error'); return false; } if (!FCP_Common::clean_string($field->css_class)) { $msg = JText::_('COM_FLEXICONTACT_INVALID') . ' (' . JText::_('COM_FLEXICONTACT_CSS_CLASS') . ')'; $this->_app->enqueueMessage($msg, 'error'); return false; } // Default value does not need to be verified at all since this allows for default to be a POST data variable // If the subject contains a variable, then the subject MUST be invisible. if ($field->field_type == LAFC_FIELD_SUBJECT) { $num_vars = substr_count(strtoupper($field->default_value), "%V_"); $ret_title = true; // Visible? if ($num_vars > 0 and $field->visible == 1) { $ret_title = false; } if (!$ret_title) { $msg = JText::_('COM_FLEXICONTACT_PAGE_TITLE_ERROR'); $this->_app->enqueueMessage($msg, 'error'); return false; } } if ($field->field_type == LAFC_FIELD_SUBJECT or $field->field_type == LAFC_FIELD_FROM_NAME or $field->field_type == LAFC_FIELD_FROM_ADDRESS or $field->field_type == LAFC_FIELD_RECIPIENT) { $count = 0; foreach ($this->_data->config_data->all_fields as $one_field) { if ($one_field->field_type == $field->field_type) { $count++; } } if ($count > 1) { switch ($field->field_type) { case LAFC_FIELD_SUBJECT: $fieldname = JText::_('COM_FLEXICONTACT_FIELD_SUBJECT'); break; case LAFC_FIELD_FROM_NAME: $fieldname = JText::_('COM_FLEXICONTACT_FIELD_FROM_NAME'); break; case LAFC_FIELD_FROM_ADDRESS: $fieldname = JText::_('COM_FLEXICONTACT_FIELD_FROM_ADDRESS'); break; case LAFC_FIELD_RECIPIENT: $fieldname = JText::_('COM_FLEXICONTACT_FIELD_RECIPIENT'); break; default: $fieldname = ''; } $msg = JText::sprintf('COM_FLEXICONTACT_ONLY_ONE_FIELD', $fieldname); $this->_app->enqueueMessage($msg, 'error'); return false; } } if ($field->field_type == LAFC_FIELD_LIST) { if ($field->delimiter == '') { $field->delimiter = ','; } return true; } if ($field->field_type == LAFC_FIELD_RECIPIENT) { $list_array = FCP_Common::split_list($field->list_list, ';', $field->delimiter); foreach ($list_array['RAW'] as $raw_string) { if (substr_count($raw_string, ',') != 1) { $msg = JText::_('COM_FLEXICONTACT_INVALID') . ': ' . htmlentities($raw_string); $this->_app->enqueueMessage($msg, 'error'); return false; // must return here to avoid "Undefined offset" errors } } foreach ($list_array['LEFT'] as $recipient_name) { if (!FCP_Common::clean_string($recipient_name, false)) { $msg = JText::_('COM_FLEXICONTACT_INVALID') . ' ' . JText::_('COM_FLEXICONTACT_NAME') . ': ' . $recipient_name; $this->_app->enqueueMessage($msg, 'error'); $ret = false; } } foreach ($list_array['RIGHT'] as $email_address) { $check_msg = FCP_Admin::validate_email_address($email_address, false); if ($check_msg != '') { $msg = JText::_('COM_FLEXICONTACT_INVALID') . ' ' . JText::_('COM_FLEXICONTACT_EMAIL') . ': ' . htmlentities($email_address); $this->_app->enqueueMessage($msg, 'error'); $ret = false; } } if (!$ret) { return false; } } if ($field->field_type == LAFC_FIELD_RADIO_V or $field->field_type == LAFC_FIELD_RADIO_H) { if ($field->delimiter == '') { $field->delimiter = ','; } $list_array = FCP_Common::split_list($field->list_list, ';', $field->delimiter); foreach ($list_array['RAW'] as $raw_string) { if (substr_count($raw_string, $field->delimiter) > 1) { $msg = JText::_('COM_FLEXICONTACT_INVALID') . ': ' . htmlentities($raw_string); $this->_app->enqueueMessage($msg, 'error'); return false; // must return here to avoid "Undefined offset" errors } } foreach ($list_array['RIGHT'] as $description) { if (!FCP_Common::clean_string($description)) { $msg = JText::_('COM_FLEXICONTACT_INVALID') . ' ' . JText::_('COM_FLEXICONTACT_TEXT') . ': ' . htmlentities($description); $this->_app->enqueueMessage($msg, 'error'); $ret = false; } } $num_buttons = count($list_array['LEFT']); if (!FCP_Common::is_posint($field->default_button) or $field->default_button > $num_buttons) { $msg = JText::_('COM_FLEXICONTACT_INVALID') . ' ' . JText::_('COM_FLEXICONTACT_DEFAULT_BUTTON') . ' (' . $field->default_button . ')'; $this->_app->enqueueMessage($msg, 'error'); $ret = false; } if (!$ret) { return false; } } if ($field->field_type == LAFC_FIELD_CHECKBOX_M) { if ($field->delimiter == '') { $field->delimiter = ','; } } if ($field->field_type == LAFC_FIELD_ADVANCED) { if (!empty($field->regex)) { if (@preg_match($field->regex, 'x') === false) { $msg = JText::_('COM_FLEXICONTACT_INVALID') . ' ' . JText::_('COM_FLEXICONTACT_REGEX'); $this->_app->enqueueMessage($msg, 'error'); return false; } } if (!empty($field->sql)) { $result = $this->ladb_loadResult($field->sql); if ($result === false) { $msg = JText::_('COM_FLEXICONTACT_INVALID') . ' ' . JText::_('COM_FLEXICONTACT_SQL_QUERY') . '<br />' . $this->ladb_error_text; $this->_app->enqueueMessage($msg, 'error'); return false; } if (!is_numeric($result)) { $msg = JText::_('COM_FLEXICONTACT_INVALID') . ' ' . JText::_('COM_FLEXICONTACT_SQL_QUERY') . '<br />' . JText::_('COM_FLEXICONTACT_SQL_NUMERIC'); $this->_app->enqueueMessage($msg, 'error'); return false; } } } // Visible property ONLY applies to the Subject field if ($field->field_type != LAFC_FIELD_SUBJECT) { $field->visible = 1; } if ($field->height < LAFC_FIELD_HEIGHT_MIN) { $field->height = LAFC_FIELD_HEIGHT_MIN; } if ($field->height > LAFC_FIELD_HEIGHT_MAX) { $field->height = LAFC_FIELD_HEIGHT_MAX; } // don't allow the tooltip field to include double quotes - change them to single quotes $field->tooltip = str_replace('"', "'", $field->tooltip); // don't allow the default_value field to include double quotes - change them to single quotes $field->default_value = str_replace('"', "'", $field->default_value); break; //case 'config_field' } return true; }
function display($tpl = null) { FCP_Admin::make_title('COM_FLEXICONTACT_CONFIG_GENERAL_NAME', $this->config_data, $this->config_count); JToolBarHelper::apply(); JToolBarHelper::save(); JToolBarHelper::cancel(); // setup the three pre-populate options $options = array(); $options['off'] = JText::_('COM_FLEXICONTACT_V_NO'); $options['username'] = JText::_('COM_FLEXICONTACT_V_AUTOFILL_USERNAME'); $options['name'] = JText::_('COM_FLEXICONTACT_NAME'); $autofill_list = FCP_Common::make_list('autofill', $this->config_data->config_data->autofill, $options, 0, 'style="margin-bottom:0"'); // setup the "copy me" options $copy_options = array(); $copy_options[LAFC_COPYME_NEVER] = JText::_('COM_FLEXICONTACT_COPYME_NEVER'); $copy_options[LAFC_COPYME_CHECKBOX] = JText::_('COM_FLEXICONTACT_COPYME_CHECKBOX'); $copy_options[LAFC_COPYME_ALWAYS] = JText::_('COM_FLEXICONTACT_COPYME_ALWAYS'); // setup the date format list $date_format_list = array(); $date_format_list[1] = JText::_('COM_FLEXICONTACT_DATE_FORMAT_OPT1'); $date_format_list[2] = JText::_('COM_FLEXICONTACT_DATE_FORMAT_OPT2'); $date_format_list[3] = JText::_('COM_FLEXICONTACT_DATE_FORMAT_OPT3'); $date_format_list[4] = JText::_('COM_FLEXICONTACT_DATE_FORMAT_OPT4'); $date_format_list[5] = JText::_('COM_FLEXICONTACT_DATE_FORMAT_OPT5'); $date_format_list[6] = JText::_('COM_FLEXICONTACT_DATE_FORMAT_OPT6'); $date_format_list[7] = JText::_('COM_FLEXICONTACT_DATE_FORMAT_OPT7'); // setup the days list $days_list = FCP_Common::makeDayNames(0); // setup the date picker list require_once LAFC_HELPER_PATH . '/date_pickers.php'; $date_picker_onchange = 'onchange="fcp_date_fields(this.value)"'; $date_picker_list = FCP_date_picker::date_picker_list(); // make the Javascript that hides and enables the date format and start day when the date picker is HTML5 // it is called by the 'domready' function and the 'onchange' function of the date picker list selector $js = "function fcp_date_fields(picker_type) {\n\t\tif (picker_type == '001')\n\t\t\t{\n\t\t\tdocument.getElementById('date_format').selectedIndex = 0;\n\t\t\tdocument.getElementById('date_format').disabled=true;\n\t\t\tdocument.getElementById('start_day').disabled=true;\n\t\t\tdocument.getElementById('start_day').selectedIndex = 1;\n\t\t\t}\n\t\telse\n\t\t\t{\n\t\t\tdocument.getElementById('date_format').disabled=false;\n\t\t\tdocument.getElementById('start_day').disabled=false;\n\t\t\t}}"; $document = JFactory::getDocument(); $document->addScriptDeclaration($js); $dom_ready = "\nwindow.addEvent('domready', function() {fcp_date_fields(" . $this->config_data->config_data->date_picker . ");});\n"; $document->addScriptDeclaration($dom_ready); // setup the css files list $css_list = FCP_Admin::get_css_list(); ?> <form action="index.php" method="post" name="adminForm" id="adminForm" > <input type="hidden" name="option" value="<?php echo LAFC_COMPONENT; ?> " /> <input type="hidden" name="controller" value="menu" /> <input type="hidden" name="task" value="" /> <input type="hidden" name="view" value="config_general" /> <?php echo "\n" . '<table class="fc_table">'; // css files selector echo "\n<tr>"; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_CSS_FILE') . '</td>'; if ($css_list == false) { echo '<td>' . JText::_('COM_FLEXICONTACT_NO_CSS'); } else { echo '<td>' . FCP_Common::make_list('css_file', $this->config_data->config_data->css_file, $css_list, 0, 'style="margin-bottom:0"'); } echo ' ' . FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_CSS_FILE_DESC')) . '</td>'; echo "\n</tr>"; // Send button text echo "\n<tr>"; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_SEND_TEXT') . '</td>'; echo '<td><input type="text" size="50" name="send_text" value="' . $this->config_data->config_data->send_text . '" />'; echo ' ' . FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_SEND_TEXT_DESC')) . '</td>'; echo "\n</tr>"; // email From (name) echo "\n" . '<tr><td colspan="3"><hr /></td></tr>'; echo "\n<tr>"; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_FIELD_FROM_NAME') . '</td>'; echo '<td><input type="text" size="50" name="email_from_name" value="' . $this->config_data->config_data->email_from_name . '" />'; echo ' ' . FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_EMAIL_FROM_NAME_DESC')) . '</td>'; echo "\n</tr>"; // email From (address) echo "\n<tr>"; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_FIELD_FROM_ADDRESS') . '</td>'; echo '<td><input type="text" size="50" name="email_from" value="' . $this->config_data->config_data->email_from . '" />'; echo ' ' . FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_EMAIL_FROM_ADDRESS_DESC')) . '</td>'; echo "\n</tr>"; // email To echo "\n<tr>"; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_V_EMAIL_TO') . '</td>'; echo '<td><input type="text" size="50" name="email_to" value="' . $this->config_data->config_data->email_to . '" />'; echo ' ' . FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_EMAIL_TO_ADDRESS_DESC')) . '</td>'; echo "\n</tr>"; // email CC echo "\n<tr>"; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_V_EMAIL_CC') . '</td>'; echo '<td><input type="text" size="50" name="email_cc" value="' . $this->config_data->config_data->email_cc . '" />'; echo ' ' . FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_V_EMAIL_DESC')) . '</td>'; echo "\n</tr>"; // email Bcc echo "\n<tr>"; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_V_EMAIL_BCC') . '</td>'; echo '<td><input type="text" size="50" name="email_bcc" value="' . $this->config_data->config_data->email_bcc . '" />'; echo ' ' . FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_V_EMAIL_DESC')) . '</td>'; echo "\n</tr>"; echo "\n" . '<tr><td colspan="3"><hr /></td></tr>'; // Date picker echo "\n<tr>"; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_DATE_PICKER') . '</td>'; echo '<td>' . FCP_Common::make_list('date_picker', $this->config_data->config_data->date_picker, $date_picker_list, 0, 'style="margin-bottom:0"' . $date_picker_onchange) . '</td>'; echo "\n</tr>"; // Input date format echo "\n<tr>"; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_DATE_FORMAT') . '</td>'; echo '<td>' . FCP_Common::make_list('date_format', $this->config_data->config_data->date_format, $date_format_list, 0, 'style="margin-bottom:0"') . '</td>'; echo "\n</tr>"; // Start day of week echo "\n<tr>"; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_STARTDAY') . '</td>'; echo '<td>' . FCP_Common::make_list('start_day', $this->config_data->config_data->start_day, $days_list, 0, 'style="margin-bottom:0"') . '</td>'; echo "\n</tr>"; // logging echo "\n<tr>"; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_LOGGING') . '</td>'; echo '<td>' . FCP_Common::make_radio('logging', $this->config_data->config_data->logging) . '</td>'; echo "\n</tr>"; // send html, yes/no echo "\n<tr>"; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_HTML') . '</td>'; echo '<td>' . FCP_Common::make_radio('email_html', $this->config_data->config_data->email_html) . '</td>'; echo "\n</tr>"; // auto fill echo "\n<tr>"; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_V_AUTOFILL') . '</td>'; echo '<td>' . $autofill_list . ' ' . FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_V_AUTOFILL_DESC')) . '</td>'; echo "\n</tr>"; // send a copy to the user choices echo "\n<tr>"; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_CONFIG_USER_EMAIL_NAME') . '</td>'; echo '<td colspan="3">' . FCP_Common::make_list('show_copy', $this->config_data->config_data->show_copy, $copy_options, 0, 'style="margin-bottom:0"') . '</td>'; echo "\n</tr>"; // agreement required echo "\n" . '<tr><td colspan="3"><hr /></td></tr>'; echo "\n<tr>"; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_AGREEMENT_REQUIRED') . '<br />' . JText::_('COM_FLEXICONTACT_V_PROMPT') . '</td>'; echo '<td><input type="text" size="40" name="agreement_prompt" value="' . $this->config_data->config_data->agreement_prompt . '" /></td>'; echo "\n</tr>"; echo "\n<tr>"; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_NAME') . '</td>'; echo '<td><input type="text" size="40" name="agreement_name" value="' . $this->config_data->config_data->agreement_name . '" /></td>'; echo "\n</tr>"; echo "\n<tr>"; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_LINK') . '</td>'; $info = FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_AGREEMENT_REQUIRED_DESC')); echo '<td><input type="text" size="60" name="agreement_link" value="' . $this->config_data->config_data->agreement_link . '" /> ' . $info . '</td>'; echo "\n</tr>"; // white list for attachment field type echo "\n" . '<tr><td colspan="3"><hr /></td></tr>'; echo "\n" . "<tr>"; echo ' <td class="prompt">' . JText::_('COM_FLEXICONTACT_ATTACHMENT_WHITE_LIST') . '</td>'; echo ' <td valign="top"><textarea rows="2" cols="50" name="white_list">' . $this->config_data->config_data->white_list . '</textarea>'; echo ' ' . FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_ATTACHMENT_WHITE_LIST_DESC')) . '</td>'; // echo "\n".' <td valign="top">'.$info.'</td>'; echo "\n" . "</tr>"; // max file size for attachment field type echo "\n" . "<tr>"; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_ATTACHMENT_MAX_SIZE') . '</td>'; echo '<td><input type="text" size="50" name="max_file_size" value="' . $this->config_data->config_data->max_file_size . '" />'; echo ' ' . FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_ATTACHMENT_MAX_SIZE_DESC')) . '</td>'; echo "\n" . "</tr>"; echo '</table></form>'; }
function display($tpl = null) { FCP_Admin::make_title('COM_FLEXICONTACT_TOOLBAR_IMAGES'); if (JFactory::getUser()->authorise('core.admin', 'com_flexicontactplus')) { JToolBarHelper::deleteList('', 'delete_image'); } // Get the list of themes $app = JFactory::getApplication(); $filter_theme = $app->getUserStateFromRequest(LAFC_COMPONENT . '.filter_theme', 'filter_theme', THEME_ALL, 'word'); $theme_list = FCP_Admin::make_theme_list(); $theme_list_html = FCP_Common::make_list('filter_theme', $filter_theme, $theme_list, 0, 'onchange="submitform( );"'); // load the front end Flexicontact language file for the current language $lang = JFactory::getLanguage(); $language = $lang->get('tag'); if (file_exists(JPATH_SITE . '/language/' . $language . '/' . $language . '.com_flexicontact_captcha.ini')) { $lang->load('com_flexicontact_captcha', JPATH_SITE); } else { $lang->load('com_flexicontactplus', JPATH_SITE); } // get an array of filenames $imageFiles = array(); // create array $handle = opendir(LAFC_SITE_IMAGES_PATH); if (!$handle) { echo JText::_('COM_FLEXICONTACT_NO_IMAGES_DIRECTORY'); return; } while (($filename = readdir($handle)) != false) { if ($filename == '.' or $filename == '..') { continue; } $imageInfo = @getimagesize(LAFC_SITE_IMAGES_PATH . '/' . $filename); if ($imageInfo === false) { continue; } // not an image if ($imageInfo[3] > 3) { // only support gif, jpg or png continue; } if ($imageInfo[0] > 150) { // if X size > 150 pixels .. continue; } // .. it's too big so skip it // Do we display it? $prefix = substr($filename, 0, 2); switch ($filter_theme) { case THEME_ALL: $imageFiles[] = $filename; break; case THEME_STANDARD: if (substr($prefix, 0, 1) == '0') { $imageFiles[] = $filename; } break; case THEME_TOYS: if ($prefix == 'A_' or $prefix == 'B_') { $imageFiles[] = $filename; } break; case THEME_NEON: if ($prefix == 'C_') { $imageFiles[] = $filename; } break; case THEME_WHITE: if ($prefix == 'D_') { $imageFiles[] = $filename; } break; case THEME_BLACK: if ($prefix == 'E_') { $imageFiles[] = $filename; } break; } } closedir($handle); if (empty($imageFiles) and $filter_theme == THEME_ALL) { echo JText::_('COM_FLEXICONTACT_NO_IMAGES'); return; } $image_count = count($imageFiles); sort($imageFiles); // start the form echo '<form action="index.php" method="post" name="adminForm" id="adminForm" >'; echo '<input type="hidden" name="option" value="com_flexicontactplus" />'; echo '<input type="hidden" name="controller" value="menu" />'; echo '<input type="hidden" name="task" value="" />'; echo '<input type="hidden" name="view" value="config_images" />'; echo '<input type="hidden" name="boxchecked" value="0" />'; echo '<input type="hidden" name="hidemainmenu" value="0" />'; // filters echo "\n" . '<div>'; echo $image_count . ' ' . JText::_('COM_FLEXICONTACT_IMAGES') . ' '; // Joomla 3.0 took away the Javascript checkAll() function. Joomla.checkAll() first appeared in 1.7 $check_all = 'onclick="Joomla.checkAll(this);"'; echo '<input type="checkbox" name="toggle" value="" ' . $check_all . ' /> '; echo $theme_list_html; echo "\n</div>"; // draw the images $i = 0; foreach ($imageFiles as $filename) { $imageInfo = getimagesize(LAFC_SITE_IMAGES_PATH . '/' . $filename); if ($imageInfo !== false) { $imageX = $imageInfo[0]; $imageY = $imageInfo[1]; } $text_name = 'COM_FLEXICONTACT_IMAGE_' . strtoupper($filename); $description = JText::_($text_name); // resolved by front end language file if ($text_name == $description) { // highlight if not resolved $description = '<span style="color: red">' . self::max_length($description, 17) . '</span>'; } echo "\n" . '<div style="display:inline-block;width:190px;border:1px solid gray;margin:1px;padding:5px;">'; echo "\n" . ' <img src="' . JURI::root() . 'components/com_flexicontactplus/images/' . $filename . '" alt="" style="float:left; border:none; margin:0 5px 0 0;"/>'; echo "\n" . '<b>' . utf8_encode($filename) . '</b><br />'; echo $description . '<br />'; echo $imageX . 'x' . $imageY . '<br />'; echo "\n" . JHTML::_('grid.id', $i++, $filename); echo '</div>'; } echo '</form>'; }
function display_embedded($config_name) { // get the specified configuration $config_name = trim($config_name); $config_name = htmlspecialchars_decode($config_name, ENT_QUOTES); // convert html entities to characters FCP_Common::strip_quotes($config_name); // remove all quotes jimport('joomla.application.component.model'); $config_data = $this->config_model->getConfigData($config_name); if ($config_data === false) { JPlugin::loadLanguage(); // load the plugin's own language file $html = JText::_('PLG_CONTENT_FLEXICONTACTPLUS_NO_CONFIG'); FCP_trace::trace("PLUGIN: No config data"); return $html; } $this->data_model->init_data($config_data); $html = FlexicontactplusViewContact::draw_page($config_data, $this->data_model->data); return $html; }
function display($tpl = null) { FCP_Admin::make_title('COM_FLEXICONTACT_CONFIG_FIELDS_NAME', $this->config_data, $this->config_count); JToolBarHelper::apply(); JToolBarHelper::save(); JToolBarHelper::cancel(); // make the Javascript that hides and enables the fcp_divs for the current field type // it is called by the 'domready' function and the 'onchange' function of the field type list selector $js = self::javascript(); $document = JFactory::getDocument(); $document->addScriptDeclaration($js); $dom_ready = "\nwindow.addEvent('domready', function() {fcp_show_fields(" . $this->field->field_type . ");});\n"; $document->addScriptDeclaration($dom_ready); // make the field type list $field_types = FCP_Admin::make_field_type_list(); $field_type_list = FCP_Common::make_list('field_type', $this->field->field_type, $field_types, 0, 'class="field_type" onchange="fcp_show_fields(this.value)"'); // make the validation type list require_once LAFC_HELPER_PATH . '/date_pickers.php'; $validation_types = FCP_date_picker::validation_type_list(); $validation_type_list = FCP_Common::make_list('validation_type', $this->field->validation_type, $validation_types); // setup the key panel $keypanel = FCP_Admin::make_key_panel($this->config_data->config_data); // draw the form ?> <div style="float:left"> <form action="index.php" method="post" name="adminForm" id="adminForm" > <input type="hidden" name="option" value="<?php echo LAFC_COMPONENT; ?> " /> <input type="hidden" name="controller" value="field" /> <input type="hidden" name="task" value="" /> <input type="hidden" name="view" value="config_field" /> <input type="hidden" name="field_index" value="<?php echo $this->field_index; ?> " /> <?php if (!isset($this->new_flag)) { echo '<input type="hidden" name="new_flag" value="0" />'; } else { echo '<input type="hidden" name="new_flag" value="' . $this->new_flag . '" />'; } echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td class="prompt"><strong>' . JText::_('COM_FLEXICONTACT_FIELD_TYPE') . '</strong></td>'; echo "\n" . ' <td>' . $field_type_list; echo "\n" . '<img src="' . LAFC_ADMIN_ASSETS_URL . 'blank.gif" id="field_type_img" border="0" style="vertical-align:middle;padding:0 0 3px 15px;" alt="" />'; echo "\n" . "</td></tr>"; echo "\n" . '</table>'; // prompt echo "\n" . '<div class="fcp_div" id="fcp_prompt">'; echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td class="prompt">' . JText::_('COM_FLEXICONTACT_V_PROMPT') . '</td>'; echo "\n" . ' <td><input type="text" size="40" name="prompt" value="' . $this->field->prompt . '" /></td>'; echo "\n" . "</tr>"; echo "\n" . '</table>'; echo "\n" . '</div>'; // placeholder echo "\n" . '<div class="fcp_div" id="fcp_placeholder">'; echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td class="prompt">' . JText::_('COM_FLEXICONTACT_V_PLACEHOLDER') . '</td>'; echo "\n" . ' <td><input type="text" size="40" name="placeholder" value="' . $this->field->placeholder . '" /></td>'; echo "\n" . "</tr>"; echo "\n" . '</table>'; echo "\n" . '</div>'; // delimeter echo "\n" . '<div class="fcp_div" id="fcp_delim">'; echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td valign="top" class="prompt">' . JText::_('COM_FLEXICONTACT_DELIMITER') . '</td>'; $info = FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_DELIMITER_DESC')); echo "\n" . ' <td><input type="text" size="2" name="delimiter" value="' . $this->field->delimiter . '" /> ' . $info . '</td>'; echo "\n" . "</tr>"; echo "\n" . '</table>'; echo "\n" . '</div>'; // width echo "\n" . '<div class="fcp_div" id="fcp_width">'; echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td class="prompt">' . JText::_('COM_FLEXICONTACT_V_WIDTH') . '</td>'; $info = FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_WIDTH_DESC')); echo "\n" . ' <td><input type="text" size="6" name="width" value="' . $this->field->width . '" /> ' . $info . '</td>'; echo "\n" . "</tr>"; echo "\n" . '</table>'; echo "\n" . '</div>'; // height echo "\n" . '<div class="fcp_div" id="fcp_height">'; echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td class="prompt">' . JText::_('COM_FLEXICONTACT_V_HEIGHT') . '</td>'; echo "\n" . ' <td><input type="text" size="6" name="height" value="' . $this->field->height . '" /></td>'; echo "\n" . "</tr>"; echo "\n" . '</table>'; echo "\n" . '</div>'; // default value (text) echo "\n" . '<div class="fcp_div" id="fcp_default">'; echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td class="prompt">' . JText::_('COM_FLEXICONTACT_DEFAULT') . '</td>'; echo "\n" . ' <td><input type="text" size="80" name="default_value" value="' . $this->field->default_value . '" /></td>'; echo "\n" . "</tr>"; echo "\n" . '</table>'; echo "\n" . '</div>'; // validation type (date picker only) echo "\n" . '<div class="fcp_div" id="fcp_validation">'; echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td class="prompt">' . JText::_('COM_FLEXICONTACT_VALIDATION') . '</td>'; echo "\n" . ' <td>' . $validation_type_list . '</td>'; echo "\n" . "</tr>"; echo "\n" . '</table>'; echo "\n" . '</div>'; // default button (radio buttons only) echo "\n" . '<div class="fcp_div" id="fcp_default_button">'; echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td class="prompt">' . JText::_('COM_FLEXICONTACT_DEFAULT_BUTTON') . '</td>'; echo "\n" . ' <td><input type="text" size="2" name="default_button" value="' . $this->field->default_button . '" /></td>'; echo "\n" . "</tr>"; echo "\n" . '</table>'; echo "\n" . '</div>'; // fixed text echo "\n" . '<div class="fcp_div" id="fcp_fixed_text">'; echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td class="prompt">' . JText::_('COM_FLEXICONTACT_FIELD_FIXED_TEXT') . '</td>'; echo "\n" . ' <td><input type="text" size="80" name="fixed_text" value="' . $this->field->default_value . '" /></td>'; echo "\n" . "</tr>"; echo "\n" . '</table>'; echo "\n" . '</div>'; // list items echo "\n" . '<div class="fcp_div" id="fcp_list">'; echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td valign="top" class="prompt">' . JText::_('COM_FLEXICONTACT_V_LIST_ITEMS') . '</td>'; echo "\n" . ' <td valign="top"><textarea rows="10" cols="80" name="list_list">' . $this->field->list_list . '</textarea>' . '</td>'; $info = FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_V_LIST_ITEMS_DESC')); echo "\n" . ' <td valign="top">' . $info . '</td>'; echo "\n" . "</tr>"; echo "\n" . '</table>'; // echo '<pre>'.htmlentities(print_r(FCP_Common::split_list($this->field->list_list, $this->field->delimiter),true)).'</pre>'; echo "\n" . '</div>'; // radio buttons echo "\n" . '<div class="fcp_div" id="fcp_radio">'; echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td valign="top" class="prompt">' . JText::_('COM_FLEXICONTACT_BUTTON_TEXTS') . '</td>'; echo "\n" . ' <td valign="top"><textarea rows="10" cols="80" name="radio_list">' . $this->field->list_list . '</textarea>' . '</td>'; $info = FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_RADIO_LIST_DESC1') . ' :: ' . JText::_('COM_FLEXICONTACT_RADIO_LIST_DESC2') . JText::_('COM_FLEXICONTACT_RADIO_LIST_DESC3')); echo "\n" . ' <td valign="top">' . $info . '</td>'; echo "\n" . "</tr>"; echo "\n" . '</table>'; // echo '<pre>'.htmlentities(print_r(FCP_Common::split_list($this->field->list_list, ';', $this->field->delimiter),true)).'</pre>'; echo "\n" . '</div>'; // multiple checkboxes echo "\n" . '<div class="fcp_div" id="fcp_checkbox_m">'; echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td valign="top" class="prompt">' . JText::_('COM_FLEXICONTACT_CHECKBOX_TEXTS') . '</td>'; echo "\n" . ' <td valign="top"><textarea rows="10" cols="80" name="checkbox_list">' . $this->field->list_list . '</textarea>' . '</td>'; $info = FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_CHECKBOX_LIST_DESC')); echo "\n" . ' <td valign="top">' . $info . '</td>'; echo "\n" . "</tr>"; echo "\n" . '</table>'; // echo '<pre>'.htmlentities(print_r(FCP_Common::split_list($this->field->list_list, ';', $this->field->delimiter),true)).'</pre>'; echo "\n" . '</div>'; // recipient list echo "\n" . '<div class="fcp_div" id="fcp_recipient">'; echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td valign="top" class="prompt">' . JText::_('COM_FLEXICONTACT_RECIPIENTS') . '</td>'; echo "\n" . ' <td valign="top"><textarea rows="10" cols="80" name="recipient_list">' . $this->field->list_list . '</textarea>' . '</td>'; $info = FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_RECIPIENTS_DESC') . " :: Name1, email1@x.com;<br>Name2, email2@y.com;<br>Name3, email3@z.com"); echo "\n" . ' <td valign="top">' . $info . '</td>'; echo "\n" . "</tr>"; echo "\n" . '</table>'; // echo '<pre>'.htmlentities(print_r(FCP_Common::split_list($this->field->list_list, ';', $this->field->delimiter),true)).'</pre>'; echo "\n" . '</div>'; // mandatory echo "\n" . '<div class="fcp_div" id="fcp_mandatory">'; echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td class="prompt">' . JText::_('COM_FLEXICONTACT_V_MANDATORY') . '</td>'; echo "\n" . ' <td>' . FCP_Common::make_radio('mandatory', $this->field->mandatory) . '</td>'; echo "\n" . "</tr>"; echo "\n" . '</table>'; echo "\n" . '</div>'; // visible echo "\n" . '<div class="fcp_div" id="fcp_visible">'; echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td class="prompt">' . JText::_('COM_FLEXICONTACT_VISIBLE') . '</td>'; echo "\n" . ' <td>' . FCP_Common::make_radio('visible', $this->field->visible) . '</td>'; echo "\n" . "</tr>"; echo "\n" . '</table>'; echo "\n" . '</div>'; // advanced validation fields echo "\n" . '<div class="fcp_div" id="fcp_advanced">'; echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td class="prompt">' . JText::_('COM_FLEXICONTACT_REGEX') . '</td>'; echo "\n" . ' <td><input type="text" size="80" name="regex" value="' . $this->field->regex . '" /></td>'; echo "\n" . "</tr>"; $info = FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_SQL_NUMERIC')); echo "\n" . "<tr>"; echo "\n" . ' <td class="prompt">' . JText::_('COM_FLEXICONTACT_SQL_QUERY') . '</td>'; echo "\n" . ' <td><input type="text" size="80" name="sql" value="' . $this->field->sql . '" /> ' . $info . '</td>'; echo "\n" . "</tr>"; echo "\n" . '</table>'; echo "\n" . '</div>'; // error message echo "\n" . '<div class="fcp_div" id="fcp_errormsg">'; echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td class="prompt">' . JText::_('COM_FLEXICONTACT_ERRORMSG') . '</td>'; echo "\n" . ' <td><input type="text" size="80" name="error_msg" value="' . $this->field->error_msg . '" /></td>'; echo "\n" . "</tr>"; echo "\n" . '</table>'; echo "\n" . '</div>'; // tooltip echo "\n" . '<div class="fcp_div" id="fcp_tooltip">'; echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td class="prompt">' . JText::_('COM_FLEXICONTACT_TOOLTIP') . '</td>'; echo "\n" . ' <td><textarea rows="3" cols="80" name="tooltip">' . htmlspecialchars($this->field->tooltip) . '</textarea>'; echo "\n" . ' ' . JText::_('COM_FLEXICONTACT_TOOLTIP_TYPE') . ' '; echo "\n" . FCP_Common::make_radio('tooltip_type', $this->field->tooltip_type) . '</td>'; echo "\n" . "</tr>"; echo "\n" . '</table>'; echo "\n" . '</div>'; // CSS Class echo "\n" . '<div class="fcp_div" id="fcp_css_class">'; echo "\n" . '<table class="fc_table">'; echo "\n" . "<tr>"; echo "\n" . ' <td class="prompt">' . JText::_('COM_FLEXICONTACT_CSS_CLASS') . '</td>'; echo "\n" . ' <td><input type="text" size="40" name="css_class" value="' . $this->field->css_class . '" /></td>'; $info = FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_CSS_CLASS_INFO')); echo "\n" . ' <td valign="top">' . $info . '</td>'; echo "\n" . "</tr>"; echo "\n" . '</table>'; echo "\n" . '</div>'; echo "\n" . '</form>'; echo "\n" . '</div>'; // float:left // Key Panel echo "\n" . '<div class="fcp_div" id="fcp_keypanel_class" style="float:left">'; echo $keypanel; echo "\n" . '</div>'; }
function display($tpl = null) { FCP_Admin::make_title('COM_FLEXICONTACT_CONFIG_CAPTCHA_NAME', $this->config_data, $this->config_count); JToolBarHelper::apply(); JToolBarHelper::save(); JToolBarHelper::cancel(); // load the colour picker $document = JFactory::getDocument(); $document->addScript(LAFC_ADMIN_ASSETS_URL . 'jscolor.js'); // setup the captcha types $none_text = JText::_('JNONE'); $noise_types = array(); $noise_types[NOISE_NO] = JText::_('COM_FLEXICONTACT_NOISE_NO'); $noise_types[NOISE_1] = JText::_('COM_FLEXICONTACT_NOISE_MODE') . ' 1'; $noise_types[NOISE_2] = JText::_('COM_FLEXICONTACT_NOISE_MODE') . ' 2'; $noise_types[NOISE_3] = JText::_('COM_FLEXICONTACT_NOISE_MODE') . ' 3'; $noise_types[NOISE_4] = JText::_('COM_FLEXICONTACT_NOISE_MODE') . ' 4'; $noise_types[NOISE_5] = JText::_('COM_FLEXICONTACT_NOISE_MODE') . ' 5'; $noise_types[NOISE_RAW] = JText::_('COM_FLEXICONTACT_NOISE_RAW'); $captcha_types = array(); $captcha_types[CAPTCHA_NONE] = $none_text; $captcha_types[CAPTCHA_WORDS_EASY] = JText::_('COM_FLEXICONTACT_CAPTCHA_WORDS_EASY'); $captcha_types[CAPTCHA_WORDS_HARD] = JText::_('COM_FLEXICONTACT_CAPTCHA_WORDS_HARD'); $captcha_types[CAPTCHA_MATHS_EASY] = JText::_('COM_FLEXICONTACT_CAPTCHA_MATHS_EASY'); $captcha_types[CAPTCHA_MATHS_HARD] = JText::_('COM_FLEXICONTACT_CAPTCHA_MATHS_HARD'); $recaptcha_themes = array(); $recaptcha_themes[RECAPTCHA_NONE] = $none_text; $recaptcha_themes[RECAPTCHA_RED] = JText::_('COM_FLEXICONTACT_RECAPTCHA_RED'); $recaptcha_themes[RECAPTCHA_WHITE] = JText::_('COM_FLEXICONTACT_RECAPTCHA_WHITE'); $recaptcha_themes[RECAPTCHA_BLACKGLASS] = JText::_('COM_FLEXICONTACT_RECAPTCHA_BLACKGLASS'); $recaptcha_themes[RECAPTCHA_CLEAN] = JText::_('COM_FLEXICONTACT_RECAPTCHA_CLEAN'); ?> <form action="index.php" method="post" name="adminForm" id="adminForm" > <input type="hidden" name="option" value="<?php echo LAFC_COMPONENT; ?> " /> <input type="hidden" name="controller" value="menu" /> <input type="hidden" name="task" value="" /> <input type="hidden" name="view" value="config_captcha" /> <?php // Show Captcha if User Logged In echo "\n" . '<table class="fc_table">'; echo "\n<tr>"; echo '<td colspan="2" class="prompt">' . JText::_('COM_FLEXICONTACT_SHOW_CAPTCHA') . '</td>'; echo '<td>' . FCP_Common::make_radio('show_captcha', $this->config_data->config_data->show_captcha) . '</td>'; echo "\n</tr>"; echo "\n" . '<tr><td colspan="3"><hr /></td></tr>'; // Magic Word echo "\n<tr>"; echo '<td><img src="' . LAFC_ADMIN_ASSETS_URL . 'captcha3.gif" alt="" style="vertical-align:middle;" /></td>'; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_V_MAGIC_WORD') . '</td>'; echo '<td><input type="text" size="30" name="magic_word" value="' . $this->config_data->config_data->magic_word . '" />'; echo ' ' . FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_V_MAGIC_WORD_DESC')) . '</td>'; echo "\n</tr>"; echo "\n<tr>"; echo '<td></td>'; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_MAGIC_WORD_LABEL') . '</td>'; echo '<td><input type="text" size="40" name="magic_word_prompt" value="' . $this->config_data->config_data->magic_word_prompt . '" /></td>'; echo "\n</tr>"; echo "\n" . '<tr><td colspan="3"><hr /></td></tr>'; // Our Image Captcha $noise_type_list = FCP_Common::make_list('noise', $this->config_data->config_data->noise, $noise_types); echo "\n<tr>"; echo '<td><img src="' . LAFC_ADMIN_ASSETS_URL . 'captcha2.gif" alt="" style="vertical-align:middle;" /></td>'; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_V_CAPTCHA_NUMBER') . '</td>'; echo '<td>'; echo '<input type="text" size="4" name="num_images" value="' . $this->config_data->config_data->num_images . '" />'; echo ' ' . FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_V_CAPTCHA_DESC')); echo ' ' . JText::_('COM_FLEXICONTACT_V_HEIGHT'); echo ' <input type="text" size="4" name="image_height" value="' . $this->config_data->config_data->image_height . '" />'; echo ' ' . JText::_('COM_FLEXICONTACT_V_WIDTH'); echo ' <input type="text" size="4" name="image_width" value="' . $this->config_data->config_data->image_width . '" />'; echo '</td>'; echo "\n</tr>"; echo "\n<tr>"; echo '<td></td>'; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_CONFIG_NOISE') . '</td>'; echo '<td>' . $noise_type_list . '</td>'; echo "\n</tr>"; if (!function_exists('imagecreate')) { echo "\n" . '<tr><td colspan="3" class="fcp_error">' . JText::_('COM_FLEXICONTACT_ENV_GD_LIBRARY') . '</td></tr>'; } echo "\n" . '<tr><td colspan="3"><hr /></td></tr>'; // SecureImage Captcha $captcha_type_list = FCP_Common::make_list('secure_captcha', $this->config_data->config_data->secure_captcha, $captcha_types); echo "\n<tr>"; echo '<td><img src="' . LAFC_ADMIN_ASSETS_URL . 'captcha1.gif" alt="" style="vertical-align:middle;" /></td>'; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_SECURE_CAPTCHA') . '</td>'; echo '<td>'; echo $captcha_type_list; echo ' ' . JText::_('COM_FLEXICONTACT_V_HEIGHT'); echo ' <input type="text" size="4" name="captcha_height" value="' . $this->config_data->config_data->captcha_height . '" />'; echo ' ' . JText::_('COM_FLEXICONTACT_V_WIDTH'); echo ' <input type="text" size="4" name="captcha_width" value="' . $this->config_data->config_data->captcha_width . '" />'; echo '</td>'; echo "\n</tr>"; echo "\n<tr>"; echo '<td></td>'; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_COLOURS') . '</td>'; echo '<td>'; echo JText::_('COM_FLEXICONTACT_TEXT'); echo ' <input type="text" class="color {required:false}" size="6" name="captcha_colour_text" value="' . $this->config_data->config_data->captcha_colour_text . '" />'; echo ' ' . JText::_('COM_FLEXICONTACT_LINES'); echo ' <input type="text" class="color {required:false}" size="6" name="captcha_colour_lines" value="' . $this->config_data->config_data->captcha_colour_lines . '" />'; echo ' ' . JText::_('COM_FLEXICONTACT_BACKGROUND'); echo ' <input type="text" class="color {required:false}" size="6" name="captcha_colour_background" value="' . $this->config_data->config_data->captcha_colour_background . '" />'; echo '</td>'; echo "\n</tr>"; echo "\n<tr>"; echo '<td></td>'; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_SECURE_CAPTCHA_LABEL') . '</td>'; echo '<td><input type="text" size="40" name="secure_captcha_prompt" value="' . $this->config_data->config_data->secure_captcha_prompt . '" /></td>'; echo "\n</tr>"; if (!function_exists('imagecreate')) { echo "\n" . '<tr><td colspan="3" class="fcp_error">' . JText::_('COM_FLEXICONTACT_ENV_GD_LIBRARY') . '</td></tr>'; } echo "\n" . '<tr><td colspan="3"><hr /></td></tr>'; // ReCaptcha $recaptcha_theme_list = FCP_Common::make_list('recaptcha_theme', $this->config_data->config_data->recaptcha_theme, $recaptcha_themes); echo "\n<tr>"; echo '<td><img src="' . LAFC_ADMIN_ASSETS_URL . 'captcha4.gif" alt="" style="vertical-align:middle;" /></td>'; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_RECAPTCHA') . '</td>'; echo '<td>'; echo $recaptcha_theme_list; echo ' ' . JText::_('JFIELD_LANGUAGE_LABEL'); echo ' <input type="text" size="6" name="recaptcha_language" value="' . $this->config_data->config_data->recaptcha_language . '" />'; echo '</td>'; echo "\n</tr>"; echo "\n<tr>"; echo '<td></td>'; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_RECAPTCHA_PUBLIC_KEY') . '</td>'; echo '<td><input type="text" size="60" name="recaptcha_public_key" value="' . $this->config_data->config_data->recaptcha_public_key . '" /> '; $link = 'https://www.google.com/recaptcha/admin/create'; echo FCP_Admin::make_info(JText::_('COM_FLEXICONTACT_GET_KEY'), $link) . '</td>'; echo "\n</tr>"; echo "\n<tr>"; echo '<td></td>'; echo '<td class="prompt">' . JText::_('COM_FLEXICONTACT_RECAPTCHA_PRIVATE_KEY') . '</td>'; echo '<td><input type="text" size="60" name="recaptcha_private_key" value="' . $this->config_data->config_data->recaptcha_private_key . '" /></td>'; echo "\n</tr>"; echo '</table>'; echo '</form>'; }
static function draw_field($field, $data, $config_data) { $html = ''; $div_id = $field->div_id; $field_id = $field->id; $error_id = $field->error_id; if (!$field->visible) { $html = ''; return $html; } // Tooltip or Info button? $title = ''; $field_class = ''; $info_button = ''; if ($field->tooltip_type == TOOLTIP_TIP) { if (!empty($field->tooltip)) { $title = ' title="' . self::tooltipText($field->tooltip) . '" '; $field_class = ' class="hasTooltip"'; } } else { if (!empty($field->tooltip)) { $info_button = ' ' . self::make_info($field->tooltip); } } // Placeholder if (empty($field->placeholder)) { $placeholder = ''; } else { $placeholder = ' placeholder="' . $field->placeholder . '"'; } switch ($field->field_type) { case LAFC_FIELD_FROM_ADDRESS: case LAFC_FIELD_FROM_NAME: case LAFC_FIELD_SUBJECT: case LAFC_FIELD_TEXT: case LAFC_FIELD_ADVANCED: if ($field->css_class == '') { $html .= "\n" . '<div class="fcp_line fcp_text" id="' . $div_id . '">'; } else { $html .= "\n" . '<div class="fcp_line ' . $field->css_class . '" id="' . $div_id . '">'; } $html .= self::draw_label($field); $size = self::size($field->width); $html .= "\n" . '<input type="text" ' . $field_class . $size . ' name="' . $field_id . '" id="' . $field_id . '"' . $placeholder . ' value="' . $data->{$field_id} . '"' . $title . ' />'; $html .= $info_button; $html .= '<span id="' . $error_id . '"></span>'; $html .= "\n" . '</div>'; break; case LAFC_FIELD_TEXT_NUMERIC: if ($field->css_class == '') { $html .= "\n" . '<div class="fcp_line fcp_text fcp_numeric" id="' . $div_id . '">'; } else { $html .= "\n" . '<div class="fcp_line ' . $field->css_class . '" id="' . $div_id . '">'; } $html .= self::draw_label($field); $size = self::size($field->width); $html .= "\n" . '<input type="text" ' . $field_class . $size . ' name="' . $field_id . '" id="' . $field_id . '"' . $placeholder . ' value="' . $data->{$field_id} . '" onkeypress="return numbersOnly(event)"' . $title . ' />'; $html .= $info_button; $html .= '<span id="' . $error_id . '"></span>'; $html .= "\n" . '</div>'; break; case LAFC_FIELD_TEXTAREA: if ($field->css_class == '') { $html .= "\n" . '<div class="fcp_line fcp_textarea" id="' . $div_id . '">'; } else { $html .= "\n" . '<div class="fcp_line ' . $field->css_class . '" id="' . $div_id . '">'; } $html .= self::draw_label($field); $size = self::size($field->width, 'cols'); $html .= "\n" . '<textarea name="' . $field_id . '"' . ' id="' . $field_id . '" ' . $field_class . $title . $placeholder . ' rows="' . $field->height . '"' . $size . '>' . $data->{$field_id} . '</textarea>'; $html .= $info_button; $html .= '<span id="' . $error_id . '"></span>'; $html .= "\n" . '</div>'; break; case LAFC_FIELD_LIST: if ($field->css_class == '') { $html .= "\n" . '<div class="fcp_line fcp_list" id="' . $div_id . '">'; } else { $html .= "\n" . '<div class="fcp_line ' . $field->css_class . '" id="' . $div_id . '">'; } $html .= self::draw_label($field); $list_array = FCP_Common::split_list($field->list_list, $field->delimiter); $list_html = FCP_Common::make_list($field_id, $data->{$field_id}, $list_array['LEFT'], 0, $field_class . $title); $html .= "\n" . $list_html; $html .= $info_button; $html .= '<span id="' . $error_id . '"></span>'; $html .= "\n" . '</div>'; break; case LAFC_FIELD_RECIPIENT: if ($field->css_class == '') { $html .= "\n" . '<div class="fcp_line fcp_list" id="' . $div_id . '">'; } else { $html .= "\n" . '<div class="fcp_line ' . $field->css_class . '" id="' . $div_id . '">'; } $html .= self::draw_label($field); $list_array = FCP_Common::split_list($field->list_list, ';', $field->delimiter); $list_html = FCP_Common::make_list($field_id, $data->{$field_id}, $list_array['LEFT'], 0, $field_class . $title); $html .= "\n" . $list_html; $html .= $info_button; $html .= '<span id="' . $error_id . '"></span>'; $html .= "\n" . '</div>'; break; case LAFC_FIELD_CHECKBOX_L: if ($field->css_class == '') { $html .= "\n" . '<div class="fcp_line fcp_checkbox fcp_checkbox_l" id="' . $div_id . '">'; } else { $html .= "\n" . '<div class="fcp_line ' . $field->css_class . '" id="' . $div_id . '">'; } if ($data->{$field_id}) { $checked = 'checked = "checked"'; } else { $checked = ''; } $checkbox = '<input type="checkbox" class="fcp_lcb"' . $title . ' name="' . $field_id . '" id="' . $field_id . '" value="1" ' . $checked . '/>'; $html .= "\n" . $checkbox; $html .= self::draw_label($field, 'fcp_lcb', $title); $html .= $info_button; $html .= '<span id="' . $error_id . '"></span>'; $html .= "\n" . '</div>'; break; case LAFC_FIELD_CHECKBOX_R: if ($field->css_class == '') { $html .= "\n" . '<div class="fcp_line fcp_checkbox fcp_checkbox_r" id="' . $div_id . '">'; } else { $html .= "\n" . '<div class="fcp_line ' . $field->css_class . '" id="' . $div_id . '">'; } $html .= self::draw_label($field, '', $title); if ($data->{$field_id}) { $checked = 'checked = "checked"'; } else { $checked = ''; } $html .= "\n" . '<input type="checkbox" ' . $field_class . $title . ' name="' . $field_id . '" id="' . $field_id . '" value="1" ' . $checked . '/>'; $html .= $info_button; $html .= '<span id="' . $error_id . '"></span>'; $html .= "\n" . '</div>'; break; case LAFC_FIELD_CHECKBOX_H: if ($field->css_class == '') { $html .= "\n" . '<span class="fcp_checkbox fcp_checkbox_h" id="' . $div_id . '">'; } else { $html .= "\n" . '<span class="fcp_ufield ' . $field->css_class . '" id="' . $div_id . '">'; } if ($data->{$field_id}) { $checked = 'checked = "checked"'; } else { $checked = ''; } $checkbox = '<input type="checkbox" ' . $field_class . ' name="' . $field_id . '" id="' . $field_id . '" value="1" ' . $checked . '/>'; $html .= "\n" . $checkbox; if ($field->mandatory) { $html .= "\n" . '<span class="fcp_mandatory"><span ' . $field_class . '>' . $field->prompt . '</span></span>'; } else { $html .= "\n" . '<span>' . $field->prompt . '</span>'; } $html .= $info_button; $html .= '<span id="' . $error_id . '"></span>'; $html .= "\n" . '</span>'; break; case LAFC_FIELD_CHECKBOX_M: if ($field->css_class == '') { $html .= "\n" . '<div class="fcp_line fcp_checkbox fcp_checkbox_m" id="' . $div_id . '">'; } else { $html .= "\n" . '<div class="fcp_line ' . $field->css_class . '" id="' . $div_id . '">'; } $html .= self::draw_label($field, '', $title); $html .= "\n" . '<div class="fcp_checkbox_inner">'; $list_array = FCP_Common::split_list($field->list_list, $field->delimiter); $html .= self::make_checkbox_list($field_id, $list_array['LEFT'], $title); $html .= "\n" . '</div>'; $html .= $info_button; $html .= '<span id="' . $error_id . '"></span>'; $html .= "\n" . '</div>'; break; case LAFC_FIELD_FIXED_TEXT: if ($field->css_class == '') { $html .= "\n" . '<div class="fcp_line fcp_fixed_text" id="' . $div_id . '">'; } else { $html .= "\n" . '<div class="fcp_line ' . $field->css_class . '" id="' . $div_id . '">'; } $html .= self::draw_label($field); $html .= "\n" . '<span>' . $field->default_value . '</span>'; // note that we do not end the div // because there might be horizontal checkboxes that need to go in it break; case LAFC_FIELD_DATE: require_once LAFC_HELPER_PATH . '/date_pickers.php'; if ($field->css_class == '') { $html .= "\n" . '<div class="fcp_line fcp_date" id="' . $div_id . '">'; } else { $html .= "\n" . '<div class="fcp_line ' . $field->css_class . '" id="' . $div_id . '">'; } $html .= self::draw_label($field); $html .= FCP_date_picker::make_date_field($config_data, $field_id, $data->{$field_id}); $html .= '<span id="' . $error_id . '"></span>'; $html .= "\n" . '</div>'; break; case LAFC_FIELD_FIELDSET_START: if ($field->prompt == '') { $legend = ''; } else { $legend = '<legend>' . $field->prompt . '</legend>'; } $size = self::size($field->width); if ($field->css_class == '') { $html .= "\n" . '<fieldset class="fcp_fieldset"' . $size . '>' . $legend; } else { $html .= "\n" . '<fieldset class="fcp_fieldset ' . $field->css_class . $size . '">' . $legend; } break; case LAFC_FIELD_FIELDSET_END: $html .= "\n" . '</fieldset>'; break; case LAFC_FIELD_RADIO_H: if ($field->css_class == '') { $html .= "\n" . '<div class="fcp_line fcp_radio" id="' . $div_id . '">'; } else { $html .= "\n" . '<div class="fcp_line ' . $field->css_class . '" id="' . $div_id . '">'; } $html .= self::draw_label($field); $html .= "\n" . '<div class="fcp_radio_h_inner">'; $list_array = FCP_Common::split_list($field->list_list, ';', $field->delimiter); $html .= self::make_radio_list($field_id, $data->{$field_id}, $list_array['LEFT'], 'fcp_radio_h', $title); $html .= "\n" . '</div>'; $html .= $info_button; $html .= '<span id="' . $error_id . '"></span>'; $html .= "\n" . '</div>'; break; case LAFC_FIELD_RADIO_V: if ($field->css_class == '') { $html .= "\n" . '<div class="fcp_line fcp_radio" id="' . $div_id . '">'; } else { $html .= "\n" . '<div class="fcp_line ' . $field->css_class . '" id="' . $div_id . '">'; } $html .= self::draw_label($field); $html .= "\n" . '<div class="fcp_radio_v_inner">'; $list_array = FCP_Common::split_list($field->list_list, ';', $field->delimiter); $html .= self::make_radio_list($field_id, $data->{$field_id}, $list_array['LEFT'], 'fcp_radio_v', $title); $html .= "\n" . '</div>'; $html .= $info_button; $html .= '<span id="' . $error_id . '"></span>'; $html .= "\n" . '</div>'; break; case LAFC_FIELD_PASSWORD: if ($field->css_class == '') { $html .= "\n" . '<div class="fcp_line fcp_password" id="' . $div_id . '">'; } else { $html .= "\n" . '<div class="fcp_line ' . $field->css_class . '" id="' . $div_id . '">'; } $html .= self::draw_label($field); $size = self::size($field->width); $html .= "\n" . '<input type="password" ' . $field_class . $size . ' name="' . $field_id . '" id="' . $field_id . '"' . $placeholder . ' value="' . $data->{$field_id} . '"' . $title . ' />'; $html .= $info_button; $html .= '<span id="' . $error_id . '"></span>'; $html .= "\n" . '</div>'; break; case LAFC_FIELD_ATTACHMENT: if ($field->css_class == '') { $html .= "\n" . '<div class="fcp_line fcp_attachment" id="' . $div_id . '">'; } else { $html .= "\n" . '<div class="fcp_line ' . $field->css_class . '" id="' . $div_id . '">'; } $html .= self::draw_label($field); $size = self::size($field->width); $html .= "\n" . '<input type="file" ' . $field_class . $size . ' name="' . $field_id . '" id="' . $field_id . '"' . $title . ' />'; $html .= $info_button; $html .= '<span id="' . $error_id . '"></span>'; $html .= "\n" . '</div>'; break; } return $html; }
function display($tpl = null) { FCP_Admin::make_title('COM_FLEXICONTACT_CONFIG_CSS_NAME'); JToolBarHelper::apply('apply_css'); JToolBarHelper::save('save_css'); JToolBarHelper::cancel(); $css_files = FCP_Admin::get_css_list(); if ($css_files == false) { $app = JFactory::getApplication(); $app->redirect(LAFC_COMPONENT_LINK . '&task=display', JText::sprintf('COM_FLEXICONTACT_NO_CSS', LAFC_SITE_ASSETS_PATH), 'error'); return; } $fail = false; $path = LAFC_SITE_ASSETS_PATH . '/'; $css_file_name = $this->config_data->config_data->css_file; // set the css name to be used by the view. Assume that the specified one is ok // Check the current CSS file if (!file_exists($path . $css_file_name)) { $app = JFactory::getApplication(); $app->enqueueMessage(JText::_('COM_FLEXICONTACT_CSS_MISSING') . ' (' . $path . $css_file_name . ')', 'error'); FCP_trace::trace("Config_CSS View: " . $path . $css_file_name . " missing"); $fail = true; } else { if (!is_readable($path . $css_file_name)) { $app = JFactory::getApplication(); $app->enqueueMessage(JText::_('COM_FLEXICONTACT_CSS_NOT_READABLE') . ' (' . $path . $css_file_name . ')', 'error'); FCP_trace::trace("Config_CSS View: " . $path . $css_file_name . " not readable"); $fail = true; } if (!is_writable($path . $css_file_name)) { $app = JFactory::getApplication(); $app->enqueueMessage(JText::_('COM_FLEXICONTACT_CSS_NOT_WRITEABLE') . ' (' . $path . $css_file_name . ')', 'error'); FCP_trace::trace("Config_CSS View: " . $path . $css_file_name . " not writeable"); $fail = true; } } // Do we have a problem with the selected CSS file? If so, try the default if ($fail) { if ($css_file_name !== LAFC_FRONT_CSS_NAME) { $fail = false; $css_file_name = LAFC_FRONT_CSS_NAME; FCP_trace::trace("-------------------->: Attempting to use default CSS file"); if (!file_exists($path . $css_file_name)) { FCP_trace::trace("-------------------->: " . $path . $css_file_name . " missing"); $fail = true; } else { if (!is_readable($path . $css_file_name)) { FCP_trace::trace("-------------------->: " . $path . $css_file_name . " not readable"); $fail = true; } if (!is_writable($path . $css_file_name)) { FCP_trace::trace("-------------------->: " . $path . $css_file_name . " not writeable"); $fail = true; } } } } // If we still have a problem, find the first valid css file in the files list if ($fail) { foreach ($css_files as $key => $value) { $css_file_name = $key; $fail = false; if (!file_exists($path . $css_file_name)) { $fail = true; } if (!$fail and !is_readable($path . $css_file_name)) { $fail = true; } if (!$fail and !is_writable($path . $css_file_name)) { $fail = true; } if (!$fail) { // Found a functioning css file break; } } } // Still got a problem? if ($fail) { $app = JFactory::getApplication(); $app->redirect(LAFC_COMPONENT_LINK . '&task=display', JText::sprintf('COM_FLEXICONTACT_NO_VALID_CSS', LAFC_SITE_ASSETS_PATH), 'error'); return; } $css_contents = @file_get_contents($path . $css_file_name); ?> <form action="index.php" method="post" name="adminForm" id="adminForm" > <input type="hidden" name="option" value="<?php echo LAFC_COMPONENT; ?> " /> <input type="hidden" name="controller" value="menu" /> <input type="hidden" name="task" value="" /> <input type="hidden" name="view" value="config_css" /> <?php echo '<table>'; echo '<tr><td>' . FCP_Common::make_list('css_file_name', $css_file_name, $css_files, 0, 'onchange="submitform( );"') . '</td></tr>'; echo '<tr><td class="css_file_path">' . JText::_('COM_FLEXICONTACT_CSS_FILE'), ': (' . $path . $css_file_name . ')'; echo '<tr><td>'; echo '<textarea name="css_contents" rows="25" cols="125" style="width:auto;">' . $css_contents . '</textarea>'; echo '</td><td valign="top">'; echo FCP_Admin::make_info('www.w3schools.com/css', 'http://www.w3schools.com/css/default.asp'); echo '</td></tr></table>'; ?> </form> <?php }
function display($tpl = null) { FCP_Admin::make_title('COM_FLEXICONTACT_CONFIGURATION', $this->config_data, $this->config_count); if (JFactory::getUser()->authorise('core.admin', 'com_flexicontactplus')) { JToolBarHelper::preferences('com_flexicontactplus'); } // Set up the configuration links $config_table = array(array('link' => LAFC_COMPONENT_LINK . '&controller=menu&task=display&view=config_general', 'icon' => 'config_general.gif', 'name' => 'COM_FLEXICONTACT_CONFIG_GENERAL_NAME', 'desc' => 'COM_FLEXICONTACT_CONFIG_GENERAL_DESC'), array('link' => LAFC_COMPONENT_LINK . '&controller=menu&task=display&view=config_template¶m1=admin_template', 'icon' => 'config_email_a.gif', 'name' => 'COM_FLEXICONTACT_CONFIG_ADMIN_EMAIL_NAME', 'desc' => 'COM_FLEXICONTACT_CONFIG_ADMIN_EMAIL_DESC'), array('link' => LAFC_COMPONENT_LINK . '&controller=menu&task=display&view=config_template¶m1=user_template', 'icon' => 'config_email_u.gif', 'name' => 'COM_FLEXICONTACT_CONFIG_USER_EMAIL_NAME', 'desc' => 'COM_FLEXICONTACT_CONFIG_USER_EMAIL_DESC'), array('link' => LAFC_COMPONENT_LINK . '&controller=menu&task=display&view=config_confirm', 'icon' => 'config_text.gif', 'name' => 'COM_FLEXICONTACT_CONFIG_CONFIRM_NAME', 'desc' => 'COM_FLEXICONTACT_CONFIG_CONFIRM_DESC'), array('link' => LAFC_COMPONENT_LINK . '&controller=menu&task=display&view=config_field_list', 'icon' => 'config_fields.gif', 'name' => 'COM_FLEXICONTACT_CONFIG_FIELDS_NAME', 'desc' => 'COM_FLEXICONTACT_CONFIG_FIELDS_DESC'), array('link' => LAFC_COMPONENT_LINK . '&controller=menu&task=display&view=config_text¶m1=top_text', 'icon' => 'config_text_top.gif', 'name' => 'COM_FLEXICONTACT_V_TOP_TEXT', 'desc' => 'COM_FLEXICONTACT_CONFIG_TEXT_DESC'), array('link' => LAFC_COMPONENT_LINK . '&controller=menu&task=display&view=config_text¶m1=bottom_text', 'icon' => 'config_text_bottom.gif', 'name' => 'COM_FLEXICONTACT_V_BOTTOM_TEXT', 'desc' => 'COM_FLEXICONTACT_CONFIG_TEXT_DESC'), array('link' => LAFC_COMPONENT_LINK . '&controller=menu&task=display&view=config_captcha&', 'icon' => 'config_captcha.gif', 'name' => 'COM_FLEXICONTACT_CONFIG_CAPTCHA_NAME', 'desc' => 'COM_FLEXICONTACT_CONFIG_CAPTCHA_DESC'), array('link' => LAFC_COMPONENT_LINK . '&controller=multiconfig&task=config_list&view=config_list', 'icon' => 'config_list.gif', 'name' => 'COM_FLEXICONTACT_CONFIG_MANAGE', 'desc' => 'COM_FLEXICONTACT_CONFIG_MANAGE_DESC')); // show the list ?> <form action="index.php" method="post" name="adminForm" id="adminForm"> <input type="hidden" name="option" value="<?php echo LAFC_COMPONENT; ?> " /> <input type="hidden" name="controller" value="menu" /> <input type="hidden" name="task" value="display" /> <input type="hidden" name="view" value="config_menu" /> <?php if (count($this->config_names) > 1) { $config_name_list = FCP_Common::make_list('current_config', $this->current_config, $this->config_names, 0, 'onchange="submitform( );"'); } else { $config_name_list = ''; } ?> <table class="adminlist table table-striped"> <thead> <tr> <th width = "5%"></th> <th width = "20%" nowrap="nowrap"><?php echo JText::_('COM_FLEXICONTACT_CONFIG_NAME'); ?> </th> <th width = "80%" nowrap="nowrap"> <?php echo JText::_('COM_FLEXICONTACT_CONFIG_DESC'); if ($config_name_list != '') { echo '<span style="float:right">' . JText::_('COM_FLEXICONTACT_CONFIGURATION') . ': ' . $config_name_list . '</span>'; } ?> </th> </tr> </thead> <?php $k = 0; foreach ($config_table as $config) { $link = JRoute::_($config['link']); echo "\n" . '<tr class="row' . $k . '"> <td><img src="' . LAFC_ADMIN_ASSETS_URL . $config['icon'] . '" alt="" /></td> <td>' . JHTML::link($link, JText::_($config['name'])) . '</td> <td>' . JText::_($config['desc']) . '</td> </tr>'; $k = 1 - $k; } ?> </table> </form> <?php }
function email_resolve($config_data, $variable) { // field prompts if (strncmp($variable, LAFC_T_FIELD_PROMPT, LAFC_T_OFFSET_P_XX) == 0) { $field_number = substr($variable, LAFC_T_OFFSET_P_XX, 2); // 1-based field number if (!FCP_Common::is_posint($field_number, false)) { return ''; } $field_index = $field_number - 1; // 0-based array index if (!isset($config_data->all_fields[$field_index]->prompt)) { return ''; } return $config_data->all_fields[$field_index]->prompt; // get the prompt from the config data } // field values if (strncmp($variable, LAFC_T_FIELD_VALUE, LAFC_T_OFFSET_V_XX) == 0) { $field_number = substr($variable, LAFC_T_OFFSET_V_XX, 2); // 1-based field number if (!FCP_Common::is_posint($field_number, false)) { return ''; } $field_index = $field_number - 1; // 0-based array index return $this->get_field_value($config_data, $field_index); } // other variables switch ($variable) { case LAFC_T_FROM_NAME: if (isset($this->data->from_name)) { return $this->data->from_name; } else { return ''; } case LAFC_T_FROM_EMAIL: if (isset($this->data->from_email)) { return $this->data->from_email; } else { return ''; } case LAFC_T_SUBJECT: return $this->data->subject; case LAFC_T_ALL_DATA: return $this->data->all_data; case LAFC_T_OTHER_DATA: return $this->data->other_data; case LAFC_T_BROWSER: return $this->data->browser_string; case LAFC_T_IP_ADDRESS: return $this->data->ip; case LAFC_T_URL_PATH: $app = JFactory::getApplication(); return $app->getUserState(LAFC_COMPONENT . "_url_path", ''); // we stored it earlier // we stored it earlier case LAFC_T_SITE_URL: return $this->data->site_url; case LAFC_T_SITE_NAME: return $this->data->site_name; case LAFC_T_PAGE_TITLE: $app = JFactory::getApplication(); return $app->getUserState(LAFC_COMPONENT . "_page_title", ''); // we stored it earlier // we stored it earlier default: return ''; } }
function display($tpl = null) { $order_text = ucfirst(JText::_('JFIELD_ORDERING_LABEL')); $id_text = ucfirst(JText::_('JGLOBAL_FIELD_ID_LABEL')); $yes_text = ucfirst(JText::_('JYES')); $no_text = ucfirst(JText::_('JNO')); FCP_Admin::make_title('COM_FLEXICONTACT_CONFIG_FIELDS_NAME', $this->config_data, $this->config_count); JToolBarHelper::custom('add_default_fields', 'default.png', 'default_f2.png', 'COM_FLEXICONTACT_RESTORE_DEFAULT_FIELDS', false); $num_fields = count($this->config_data->config_data->all_fields); if ($num_fields < LAFC_MAX_FIELDS) { JToolBarHelper::addNew(); } JToolBarHelper::editList(); JToolBarHelper::deleteList(); JToolBarHelper::cancel(); $field_types = FCP_Admin::make_field_type_list(); require_once LAFC_HELPER_PATH . '/date_pickers.php'; $validation_types = FCP_date_picker::validation_type_list(); $pagination = new JPagination($num_fields, 0, 1000); // we don't actually use pagination but we need this for the ordering tools // Joomla 3.0 took away the Javascript checkAll() function. Joomla.checkAll() first appeared in 1.7 $check_all = 'onclick="Joomla.checkAll(this);"'; // draw the form ?> <form action="index.php" method="post" name="adminForm" id="adminForm" > <input type="hidden" name="option" value="<?php echo LAFC_COMPONENT; ?> " /> <input type="hidden" name="controller" value="field" /> <input type="hidden" name="task" value="" /> <input type="hidden" name="view" value="config_field_list" /> <input type="hidden" name="boxchecked" value="0" /> <?php echo '<table>'; echo '<table class="adminlist table table-striped">'; echo '<thead>'; echo ' <th width="1">' . $id_text . '</th>'; echo ' <th width="1"><input type="checkbox" name="toggle" value="" ' . $check_all . ' /></th>'; echo ' <th width="1"></th>'; echo ' <th width="1"></th>'; echo ' <th width="1" nowrap="nowrap">' . $order_text . ' ' . JHTML::_('grid.order', $this->config_data->config_data->all_fields) . '</th>'; echo ' <th nowrap="nowrap" width="20%">' . JText::_('COM_FLEXICONTACT_V_PROMPT') . '</th>'; echo ' <th nowrap="nowrap" width="10%" colspan="2">' . JText::_('COM_FLEXICONTACT_FIELD_TYPE') . '</th>'; echo ' <th nowrap="nowrap" width="5%" >' . JText::_('COM_FLEXICONTACT_V_MANDATORY') . '</th>'; echo ' <th nowrap="nowrap" width="5%" >' . JText::_('COM_FLEXICONTACT_V_WIDTH') . '</th>'; echo ' <th nowrap="nowrap" width="5%" >' . JText::_('COM_FLEXICONTACT_V_HEIGHT') . '</th>'; echo ' <th nowrap="nowrap">' . JText::_('COM_FLEXICONTACT_DETAILS') . '</th>'; echo ' </tr>'; echo '</thead>'; for ($i = 0; $i < $num_fields; $i++) { $field =& $this->config_data->config_data->all_fields[$i]; $field_type_name = $field_types[$field->field_type]; $checked = JHTML::_('grid.id', $i, $i); if ($field->mandatory == 1) { $mandatory = $yes_text; } else { $mandatory = $no_text; } if ($field->visible == 1) { $visible = $yes_text; } else { $visible = $no_text; } $width = ''; $height = ''; $details = ''; switch ($field->field_type) { case LAFC_FIELD_FROM_ADDRESS: $width = $field->width; break; case LAFC_FIELD_FROM_NAME: case LAFC_FIELD_TEXT: case LAFC_FIELD_PASSWORD: case LAFC_FIELD_TEXT_NUMERIC: case LAFC_FIELD_FIELDSET_START: $width = $field->width; if ($field->default_value != '') { $details = JText::_('COM_FLEXICONTACT_DEFAULT') . ': ' . $field->default_value; } break; case LAFC_FIELD_SUBJECT: $width = $field->width; if ($field->default_value != '') { $details = JText::_('COM_FLEXICONTACT_DEFAULT') . ': ' . $field->default_value . ', ' . JText::_('COM_FLEXICONTACT_VISIBLE') . ': ' . $visible; } else { $details = JText::_('COM_FLEXICONTACT_VISIBLE') . ': ' . $visible; } break; case LAFC_FIELD_TEXTAREA: $width = $field->width; $height = $field->height; break; case LAFC_FIELD_LIST: $list_array = FCP_Common::split_list($field->list_list, $field->delimiter); $field_id = sprintf('field%03d', $i); $list_html = FCP_Common::make_list($field_id, 0, $list_array['LEFT']); $details = $list_html; break; case LAFC_FIELD_FIXED_TEXT: $details = $field->default_value; break; case LAFC_FIELD_ADVANCED: $width = $field->width; $details = $field->regex; if (!empty($field->sql)) { if (!empty($details)) { $details .= '<br />'; } $details .= $field->sql; } if ($field->error_msg != '') { $details .= ' [' . $field->error_msg . ']'; } break; case LAFC_FIELD_RECIPIENT: $list_array = FCP_Common::split_list($field->list_list, ';', $field->delimiter); $field_id = sprintf('field%03d', $i); $list_html = FCP_Common::make_list($field_id, 0, $list_array['LEFT']); $details = $list_html; break; case LAFC_FIELD_RADIO_V: case LAFC_FIELD_RADIO_H: $list_array = FCP_Common::split_list($field->list_list, ';', $field->delimiter); $details = implode(", ", $list_array['RIGHT']); break; case LAFC_FIELD_CHECKBOX_M: $list_array = FCP_Common::split_list($field->list_list, $field->delimiter); $details = implode(", ", $list_array['LEFT']); break; case LAFC_FIELD_DATE: $details = $validation_types[$field->validation_type]; } $image = FCP_Admin::get_icon_image($field->field_type); $link = JRoute::_(LAFC_COMPONENT_LINK . '&controller=field&task=edit&cid[]=' . $i); $field_id = sprintf('%02d', $i + 1); echo "\n<tr>"; echo ' <td>' . JHTML::link($link, $field_id) . '</td>'; echo ' <td align="center">' . $checked . '</td>'; echo ' <td>' . $pagination->orderUpIcon($i, true) . '</td>'; echo ' <td>' . $pagination->orderDownIcon($i, true) . '</td>'; echo ' <td><input type="text" name="order[]" size="5" value="' . ($i + 1) . '" class="text_area" style="text-align: center" /></td>'; echo ' <td nowrap="nowrap">' . JHTML::link($link, $field->prompt) . '</td>'; echo ' <td align="center">' . $image . '</td>'; echo ' <td nowrap="nowrap">' . $field_type_name . '</td>'; echo ' <td align="center">' . $mandatory . '</td>'; echo ' <td align="center">' . $width . '</td>'; echo ' <td align="center">' . $height . '</td>'; echo ' <td align="left">' . $details . '</td>'; echo "\n</tr>"; } echo '</table></form>'; }