Файловый менеджер - Редактировать - /var/www/html/administrator/components/com_flexicontact/views/config/view.html.php
Ðазад
<?php /******************************************************************** Product : Flexicontact Date : 24 August 2024 Copyright : Les Arbres Design 2010-2024 Contact : https://www.lesarbresdesign.info Licence : GNU General Public License *********************************************************************/ defined('_JEXEC') or die('Restricted access'); use Joomla\CMS\MVC\View\HtmlView; use Joomla\CMS\Language\Text; use Joomla\CMS\Factory; use Joomla\CMS\Form\Form; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Editor\Editor; use Joomla\CMS\Toolbar\ToolbarHelper; class FlexicontactViewConfig extends HtmlView { function display($tpl = null) { Flexicontact_Utility::addSubMenu('config'); Flexicontact_Utility::viewStart(); ToolBarHelper::title(LAFC_COMPONENT_NAME.': '.Text::_('COM_FLEXICONTACT_CONFIGURATION'), 'lad.png'); ToolBarHelper::custom('email_test', 'mail.png', '', 'COM_FLEXICONTACT_TEST_EMAIL', false); $user = Factory::getApplication()->getIdentity(); if ($user->authorise('core.admin', 'com_flexicontact')) ToolBarHelper::preferences('com_flexicontact'); // Set up the configuration links $config_table = array( array( 'link' => LAFC_COMPONENT_LINK.'&task=config&function=edit_form¶m1=config_general', 'icon' => 'config_general.png', 'name' => 'COM_FLEXICONTACT_CONFIG_GENERAL_NAME', 'desc' => 'COM_FLEXICONTACT_CONFIG_GENERAL_DESC'), array( 'link' => LAFC_COMPONENT_LINK.'&task=config&function=edit_form¶m1=admin_template', 'icon' => 'config_email_a.png', 'name' => 'COM_FLEXICONTACT_EMAIL_TO_ADMIN', 'desc' => 'COM_FLEXICONTACT_CONFIG_ADMIN_EMAIL_DESC'), array( 'link' => LAFC_COMPONENT_LINK.'&task=config&function=edit_form¶m1=user_template', 'icon' => 'config_email_u.png', 'name' => 'COM_FLEXICONTACT_EMAIL_TO_USER', 'desc' => 'COM_FLEXICONTACT_CONFIG_USER_EMAIL_DESC'), array( 'link' => LAFC_COMPONENT_LINK.'&task=config&function=edit_form¶m1=confirm_text', 'icon' => 'config_confirm.png', 'name' => 'COM_FLEXICONTACT_CONFIG_CONFIRM_NAME', 'desc' => 'COM_FLEXICONTACT_CONFIG_CONFIRM_DESC'), array( 'link' => LAFC_COMPONENT_LINK.'&task=config&function=edit_form¶m1=config_fields', 'icon' => 'config_fields.png', 'name' => 'COM_FLEXICONTACT_CONFIG_FIELDS_NAME', 'desc' => 'COM_FLEXICONTACT_CONFIG_FIELDS_DESC'), array( 'link' => LAFC_COMPONENT_LINK.'&task=config&function=edit_form¶m1=page_text', 'icon' => 'config_text_top.png', 'name' => 'COM_FLEXICONTACT_V_TOP_TEXT', 'desc' => 'COM_FLEXICONTACT_CONFIG_TOP_BOTTOM_TEXT_DESC'), array( 'link' => LAFC_COMPONENT_LINK.'&task=config&function=edit_form¶m1=bottom_text', 'icon' => 'config_text_bottom.png', 'name' => 'COM_FLEXICONTACT_V_BOTTOM_TEXT', 'desc' => 'COM_FLEXICONTACT_CONFIG_TOP_BOTTOM_TEXT_DESC'), array( 'link' => LAFC_COMPONENT_LINK.'&task=config&function=edit_form¶m1=config_captcha', 'icon' => 'config_captcha.png', 'name' => 'COM_FLEXICONTACT_CAPTCHA_CONFIG', 'desc' => 'COM_FLEXICONTACT_CAPTCHA_CONFIG_DESC'), array( 'link' => LAFC_COMPONENT_LINK.'&task=config&function=edit_form¶m1=config_wordblock', 'icon' => 'config_wordblock.png', 'name' => 'COM_FLEXICONTACT_CONFIG_WORDBLOCK_NAME', 'desc' => 'COM_FLEXICONTACT_CONFIG_WORDBLOCK_DESC'), array( 'link' => LAFC_COMPONENT_LINK.'&task=config&function=edit_css', 'icon' => 'config_css.png', 'name' => 'COM_FLEXICONTACT_CONFIG_CSS_NAME', 'desc' => 'COM_FLEXICONTACT_CONFIG_CSS_DESC') ); $this->form(); echo '<table class="table table-striped"><thead><tr>'; echo '<th></th>'; echo '<th>'.Text::_('COM_FLEXICONTACT_CONFIG_NAME').'</th>'; echo '<th>'.Text::_('COM_FLEXICONTACT_CONFIG_DESC').'</th>'; echo '</tr></thead>'; foreach ($config_table as $config) { $icon = '<img src="'.LAFC_ADMIN_ASSETS_URL.$config['icon'].'" alt="">'; echo "<tr> <td>$icon</td> <td>".HTMLHelper::link($config['link'], Text::_($config['name']))."</td> <td>".Text::_($config['desc'])."</td> </tr>"; } echo '</table></form>'; Flexicontact_Utility::viewEnd(); } //------------------------------------------------------------------------------- // Handle form-based config pages // function edit_form() { Flexicontact_Utility::addSubMenu('config'); Flexicontact_Utility::viewStart(); ToolBarHelper::title(LAFC_COMPONENT_NAME.': '.Text::_(self::get_title($this->param1)), 'lad.png'); ToolBarHelper::apply(); ToolBarHelper::save(); ToolBarHelper::cancel(); $this->form(); Form::addFieldPath(LAFC_FORM_FIELD_PATH); $form = Form::getInstance($this->param1, LAFC_FORMS_PATH.'/'.$this->param1.'.xml'); $form->bind($this->config_data); $field_sets = $form->getFieldsets(); // any tabs? $form_has_tabs = false; foreach ($field_sets as $fieldset_name => $fieldset) { if (!isset($fieldset->class)) $fieldset->class = ''; if (strstr($fieldset->class,'lad-fieldset-tab')) $form_has_tabs = true; } if ($form_has_tabs) { echo HTMLHelper::_('uitab.startTabSet','config_tabs', array('active' => 'main', 'recall' => true)); } foreach ($field_sets as $fieldset_name => $fieldset) { if (strstr($fieldset->class,'lad-fieldset-tab')) { echo HTMLHelper::_('uitab.addTab', 'config_tabs', $fieldset_name, Text::_($fieldset->label)); switch ($fieldset_name) { case 'variables': echo $this->make_key_table(); break; case 'opt_fields': echo $this->render_opt_fields($form); break; default: echo $this->renderFieldset($form, $fieldset_name); } echo HTMLHelper::_('uitab.endTab'); } else { echo '<fieldset class="'.$fieldset->class.'">'; if (!empty($fieldset->label)) echo '<legend>'.Text::_($fieldset->label).'</legend>'; echo $this->renderFieldset($form, $fieldset_name); echo '</fieldset>'; } } if ($form_has_tabs) echo HTMLHelper::_('uitab.endTabSet'); echo '</form>'; Flexicontact_Utility::viewEnd(); } //------------------------------------------------------------------------------- // Render a fieldset with a couple of extra features // function renderFieldset($form, $fieldset_name) { $html = ''; $fields = $form->getFieldset($fieldset_name); foreach ($fields as $field) { if ($field->getAttribute('label','') == '_') { $html .= $form->getInput($field->name); continue; } if ($field->getAttribute('type','') == 'editor') { $html .= $form->getLabel($field->name); $html .= $form->getInput($field->name); continue; } $html .= $field->renderField(); } return $html; } //------------------------------------------------------------------------------- // Render the config fields for the one line text fields // function render_opt_fields($form) { $html = '<table class="fc_field_table"><thead>'; $html .= '<tr><td colspan="2">'.Text::_('COM_FLEXICONTACT_V_TEXT_FIELD_DESC').'</td><td>'.Text::_('COM_FLEXICONTACT_V_PROMPT').'</td></tr>'; $html .= '</thead><tbody>'; $html .= '<tr><td>'.Text::_('COM_FLEXICONTACT_FIELD_1').'</td><td>'.$form->getInput('field_opt1').'</td><td>'.$form->getInput('field_prompt1').'</td></tr>'; $html .= '<tr><td>'.Text::_('COM_FLEXICONTACT_FIELD_2').'</td><td>'.$form->getInput('field_opt2').'</td><td>'.$form->getInput('field_prompt2').'</td></tr>'; $html .= '<tr><td>'.Text::_('COM_FLEXICONTACT_FIELD_3').'</td><td>'.$form->getInput('field_opt3').'</td><td>'.$form->getInput('field_prompt3').'</td></tr>'; $html .= '<tr><td>'.Text::_('COM_FLEXICONTACT_FIELD_4').'</td><td>'.$form->getInput('field_opt4').'</td><td>'.$form->getInput('field_prompt4').'</td></tr>'; $html .= '<tr><td>'.Text::_('COM_FLEXICONTACT_FIELD_5').'</td><td>'.$form->getInput('field_opt5').'</td><td>'.$form->getInput('field_prompt5').'</td></tr>'; $html .= '</tbody></table>'; return $html; } //------------------------------------------------------------------------------- // Create the variables table // function make_key_table() { HTMLHelper::_('bootstrap.tooltip', 'span.hasTooltip', ['trigger' => 'hover focus']); Text::script('COM_FLEXICONTACT_COPY'); Text::script('COM_FLEXICONTACT_COPIED'); $span_start = '<span class="hasTooltip lad-key ladj-copy_to_clipboard" title="'.Text::_('COM_FLEXICONTACT_COPY').'">'; $html = '<h5>'.Text::_('COM_FLEXICONTACT_CLICK_TO_COPY').'</h5>'; $html .= '<table class="fc_key_table table table-striped table-bordered width-auto">'; $html .= '<thead>'; $html .= '<tr><th>'.Text::_('COM_FLEXICONTACT_FIELD').'</th><th>'.Text::_('COM_FLEXICONTACT_STATUS').'</th><th>'.Text::_('COM_FLEXICONTACT_V_PROMPT').'</th><th>'.Text::_('COM_FLEXICONTACT_FIELD_VALUE').'</th></tr>'; $html .= '</thead><tbody>'; $html .= '<tr><td>'.Text::_('COM_FLEXICONTACT_NAME').'</td><td>'.$this->field_status().'</td><td></td><td class="lad-key-cell">'.$span_start.LAFC_T_FROM_NAME.'</span></td></tr>'; $html .= '<tr><td>'.Text::_('COM_FLEXICONTACT_EMAIL').'</td><td>'.$this->field_status().'</td><td></td><td class="lad-key-cell">'.$span_start.LAFC_T_FROM_EMAIL.'</span></td></tr>'; $html .= '<tr><td>'.Text::_('COM_FLEXICONTACT_MESSAGE').$this->field_name('area_prompt').'</td><td>'.$this->field_status('area_opt').'</td><td class="lad-key-cell">'.$span_start.LAFC_T_MESSAGE_PROMPT.'</span></td><td class="lad-key-cell">'.$span_start.LAFC_T_MESSAGE_DATA.'</span></td></tr>'; $html .= '<tr><td>'.Text::_('COM_FLEXICONTACT_BACK_END_SUBJECT').'</td><td>'.$this->field_status('show_subject').'</td><td></td><td class="lad-key-cell">'.$span_start.LAFC_T_SUBJECT.'</span></td></tr>'; $html .= '<tr><td>'.Text::_('COM_FLEXICONTACT_LIST').$this->field_name('list_prompt').'</td><td>'.$this->field_status('list_opt').'</td><td class="lad-key-cell">'.$span_start.LAFC_T_LIST_PROMPT.'</span></td><td class="lad-key-cell">'.$span_start.LAFC_T_LIST_DATA.'</span></td></tr>'; $html .= '<tr><td>'.Text::_('COM_FLEXICONTACT_FIELD_1').$this->field_name('field_prompt1').'</td><td>'.$this->field_status('field_opt1').'</td><td class="lad-key-cell">'.$span_start.LAFC_T_FIELD1_PROMPT.'</span></td><td class="lad-key-cell">'.$span_start.LAFC_T_FIELD1_DATA.'</span></td></tr>'; $html .= '<tr><td>'.Text::_('COM_FLEXICONTACT_FIELD_2').$this->field_name('field_prompt2').'</td><td>'.$this->field_status('field_opt2').'</td><td class="lad-key-cell">'.$span_start.LAFC_T_FIELD2_PROMPT.'</span></td><td class="lad-key-cell">'.$span_start.LAFC_T_FIELD2_DATA.'</span></td></tr>'; $html .= '<tr><td>'.Text::_('COM_FLEXICONTACT_FIELD_3').$this->field_name('field_prompt3').'</td><td>'.$this->field_status('field_opt3').'</td><td class="lad-key-cell">'.$span_start.LAFC_T_FIELD3_PROMPT.'</span></td><td class="lad-key-cell">'.$span_start.LAFC_T_FIELD3_DATA.'</span></td></tr>'; $html .= '<tr><td>'.Text::_('COM_FLEXICONTACT_FIELD_4').$this->field_name('field_prompt4').'</td><td>'.$this->field_status('field_opt4').'</td><td class="lad-key-cell">'.$span_start.LAFC_T_FIELD4_PROMPT.'</span></td><td class="lad-key-cell">'.$span_start.LAFC_T_FIELD4_DATA.'</span></td></tr>'; $html .= '<tr><td>'.Text::_('COM_FLEXICONTACT_FIELD_5').$this->field_name('field_prompt5').'</td><td>'.$this->field_status('field_opt5').'</td><td class="lad-key-cell">'.$span_start.LAFC_T_FIELD5_PROMPT.'</span></td><td class="lad-key-cell">'.$span_start.LAFC_T_FIELD5_DATA.'</span></td></tr>'; $html .= '<tr><td>'.Text::_('COM_FLEXICONTACT_BROWSER').'</td><td></td><td></td><td class="lad-key-cell">'.$span_start.LAFC_T_BROWSER.'</span></td></tr>'; $html .= '<tr><td>'.Text::_('COM_FLEXICONTACT_IP_ADDRESS').'</td><td></td><td></td><td class="lad-key-cell">'.$span_start.LAFC_T_IP_ADDRESS.'</span></td></tr>'; $html .= '<tr><td>'.Text::_('COM_FLEXICONTACT_SITE_NAME').'</td><td></td><td></td><td class="lad-key-cell">'.$span_start.LAFC_T_SITE_NAME.'</span></td></tr>'; $html .= '</tbody></table>'; return $html; } //------------------------------------------------------------------------------- // Format a field name // function field_name($field_label) { $name = $this->config_data->$field_label; if (empty($name)) return ''; return ' ('.$name.')'; } //------------------------------------------------------------------------------- // Get the translated configuration option for a field // function field_status($option = '') { if (empty($option)) $value = 'mandatory'; else $value = $this->config_data->$option; switch ($value) { case '0': // subject field only return '<span class="icon-eye-close"></span> '.Text::_('COM_FLEXICONTACT_HIDDEN'); case 'disabled': return '<span class="icon-delete" style="color:gray"></span> '.Text::_('COM_FLEXICONTACT_V_DISABLED'); case '1': // subject field only case 'mandatory': return '<span class="icon-checkmark" style="color:green"></span> '.Text::_('COM_FLEXICONTACT_V_MANDATORY'); case 'optional': return '<span class="icon-checkmark" style="color:orange"></span> '.Text::_('COM_FLEXICONTACT_V_OPTIONAL'); default: return ''; } } //------------------------------------------------------------------------------- // Edit the front end CSS file // function edit_css() { Flexicontact_Utility::addSubMenu('config'); ToolBarHelper::title(LAFC_COMPONENT_NAME.': '.Text::_('COM_FLEXICONTACT_CONFIG_CSS_NAME'), 'lad.png'); ToolBarHelper::apply('apply_css'); ToolBarHelper::save('save_css'); ToolBarHelper::cancel(); $error = ''; if (!is_writable(LAFC_SITE_CSS_PATH)) $error = Text::_('COM_FLEXICONTACT_CSS_NOT_WRITEABLE'); if (!is_readable(LAFC_SITE_CSS_PATH)) $error = Text::_('COM_FLEXICONTACT_CSS_NOT_READABLE'); if (!file_exists(LAFC_SITE_CSS_PATH)) $error = Text::_('COM_FLEXICONTACT_CSS_MISSING'); if ($error != '') { Factory::getApplication()->redirect(LAFC_COMPONENT_LINK.'&task=config', $error.'<br>('.LAFC_SITE_CSS_PATH.')', 'error'); return; } $editor = Editor::getInstance('codemirror'); Flexicontact_Utility::viewStart(); $this->form(); $css_contents = @file_get_contents(LAFC_SITE_CSS_PATH); $default_css_contents = false; if (file_exists(JPATH_SITE.'/media/com_flexicontact/css/default.css')) $default_css_contents = @file_get_contents(JPATH_SITE.'/media/com_flexicontact/css/default.css'); if ($default_css_contents) { echo HTMLHelper::_('uitab.startTabSet','css_tabs', array('active' => 'tab1')); echo HTMLHelper::_('uitab.addTab', 'css_tabs', 'tab1', 'com_flexicontact.css'); } echo '<div>'; echo $editor->display('css_contents', $css_contents,'','','','',false,'','','',array('syntax' => 'css')); echo '</div>'; if ($default_css_contents) { echo HTMLHelper::_('uitab.endTab'); echo HTMLHelper::_('uitab.addTab', 'css_tabs', 'tab2', 'default.css'); echo '<div class="lad-border-pad"><pre>'.$default_css_contents.'</pre></div>'; echo HTMLHelper::_('uitab.endTab'); echo HTMLHelper::_('uitab.endTabSet'); } echo '</form>'; Flexicontact_Utility::viewEnd(); } //------------------------------------------------------------------------------- // Output the form common to all config pages // function form() { echo '<form method="post" name="adminForm" id="adminForm" class="form-horizontal">'; echo HTMLHelper::_('form.token'); echo '<input type="hidden" name="option" value="com_flexicontact">'; echo '<input type="hidden" name="task" value="">'; echo '<input type="hidden" name="function" value="'.$this->function.'">'; echo '<input type="hidden" name="param1" value="'.$this->param1.'">'; } //------------------------------------------------------------------------------- // Map config functions to language strings for the page title // static function get_title($function) { switch ($function) { case 'config_general': return 'COM_FLEXICONTACT_CONFIG_GENERAL_NAME'; case 'config_captcha': return 'COM_FLEXICONTACT_CAPTCHA_CONFIG'; case 'config_fields': return 'COM_FLEXICONTACT_CONFIG_FIELDS_NAME'; case 'user_template': return 'COM_FLEXICONTACT_EMAIL_TO_USER'; case 'admin_template': return 'COM_FLEXICONTACT_EMAIL_TO_ADMIN'; case 'confirm_text': return 'COM_FLEXICONTACT_CONFIG_CONFIRM_NAME'; case 'page_text': return 'COM_FLEXICONTACT_V_TOP_TEXT'; case 'bottom_text': return 'COM_FLEXICONTACT_V_BOTTOM_TEXT'; return $function; } } }
| ver. 1.1 | |
.
| PHP 8.4.18 | Ð“ÐµÐ½ÐµÑ€Ð°Ñ†Ð¸Ñ Ñтраницы: 0 |
proxy
|
phpinfo
|
ÐаÑтройка