public function __construct($error_message = '')
 {
     if (empty($error_message)) {
         $error_message = LangLoader::get_message('form.doesnt_match_tel_regex', 'status-messages-common');
     }
     $this->set_validation_error_message($error_message);
     parent::__construct(self::$regex, TextHelper::to_js_string(self::$js_regex), $error_message);
 }
 public function __construct($label, $link, $img = '')
 {
     $full_label = '';
     if (!empty($img)) {
         $full_label = '<img src="' . $img . '" alt="' . $label . '" title="' . $label . '" />';
     } else {
         $full_label = $label;
     }
     parent::__construct('button', $full_label, '', 'window.location=' . TextHelper::to_js_string(Url::to_rel($link)), !empty($img) ? 'image' : '');
 }
 public function __construct($label, $link, $css_class_image = '')
 {
     $full_label = '';
     if (!empty($css_class_image)) {
         $full_label = '<i class="' . $css_class_image . '" title="' . $label . '"></i>';
     } else {
         $full_label = $label;
     }
     parent::__construct('button', $full_label, '', 'window.location=' . TextHelper::to_js_string(Url::to_rel($link)), 'image');
 }
 public function __construct($field_id = 0, $error_message = '')
 {
     if (!empty($field_id)) {
         $this->field_id = $field_id;
     }
     if (empty($error_message)) {
         $error_message = LangLoader::get_message('message.field_name_already_used', 'common', 'contact');
     }
     $this->set_validation_error_message($error_message);
     $this->error_message = TextHelper::to_js_string($error_message);
 }
 public function __construct($bug_id = 0, $bug_status = '', $error_message = '')
 {
     if (!empty($bug_id)) {
         $this->bug_id = $bug_id;
     }
     if (!empty($bug_status)) {
         $this->bug_status = $bug_status;
     }
     if (empty($error_message)) {
         $error_message = LangLoader::get_message('error.e_status_not_changed', 'common', 'bugtracker');
     }
     $this->set_validation_error_message($error_message);
     $this->error_message = TextHelper::to_js_string($error_message);
 }
 public function i18njsraw($key, $parameters)
 {
     return TextHelper::to_js_string($this->i18nraw($key, $parameters));
 }
 public function get_js_validation(FormField $field)
 {
     return 'UserExistValidator(' . TextHelper::to_js_string($field->get_id()) . ', ' . $this->error_message . ')';
 }
 public function get_js_validation()
 {
     return 'equalityFormFieldValidator(' . TextHelper::to_js_string($this->first_field->get_id()) . ', ' . TextHelper::to_js_string($this->second_field->get_id()) . ', ' . TextHelper::to_js_string($this->get_validation_error_message()) . ')';
 }
    public function get_js_validation(FormField $field)
    {
        return 'integerMaxFormFieldValidator(' . TextHelper::to_js_string($field->get_id()) . ', 
		' . (int) $this->upper_bound . ', ' . TextHelper::to_js_string($this->error_message) . ')';
    }
Beispiel #10
0
$unsecure_search = stripslashes(retrieve(REQUEST, 'q', ''));
$search_in = retrieve(POST, 'search_in', 'all');
$selected_modules = retrieve(POST, 'searched_modules', array());
$query_mode = retrieve(POST, 'query_mode', true);
if ($search_in !== 'all') {
    $selected_modules = array($search_in);
} else {
    if (count($selected_modules) == 1) {
        $module = $selected_modules['0'];
        $search_in = $module;
    }
}
//--------------------------------------------------------------------- Header
define('TITLE', $LANG['title_search']);
require_once '../kernel/header.php';
$tpl->assign_vars(array('L_TITLE_SEARCH' => TITLE, 'L_SEARCH' => $LANG['title_search'], 'TEXT_SEARCHED' => $unsecure_search, 'L_SEARCH_ALL' => $LANG['search_all'], 'L_SEARCH_KEYWORDS' => $LANG['search_keywords'], 'L_SEARCH_MIN_LENGTH' => $LANG['search_min_length'], 'L_SEARCH_IN_MODULES' => $LANG['search_in_modules'], 'L_SEARCH_IN_MODULES_EXPLAIN' => $LANG['search_in_modules_explain'], 'L_SEARCH_SPECIALIZED_FORM' => $LANG['search_specialized_form'], 'L_SEARCH_SPECIALIZED_FORM_EXPLAIN' => $LANG['search_specialized_form_explain'], 'L_WARNING_LENGTH_STRING_SEARCH' => TextHelper::to_js_string($LANG['warning_length_string_searched']), 'L_FORMS' => $LANG['forms'], 'L_ADVANCED_SEARCH' => $LANG['advanced_search'], 'L_SIMPLE_SEARCH' => $LANG['simple_search'], 'U_FORM_VALID' => url('../search/search.php#results'), 'C_SIMPLE_SEARCH' => $search_in == 'all' ? true : false, 'SEARCH_MODE_MODULE' => $search_in));
//------------------------------------------------------------- Other includes
require_once '../search/search.inc.php';
//----------------------------------------------------------------------- Main
$config = SearchConfig::load();
$modules_args = array();
$used_modules = array();
// Génération des formulaires précomplétés et passage aux templates
$provider_service = AppContext::get_extension_provider_service();
$search_extensions_point_modules = array_keys($provider_service->get_extension_point(SearchableExtensionPoint::EXTENSION_POINT));
$search_extensions_point = $provider_service->get_extension_point(SearchableExtensionPoint::EXTENSION_POINT);
foreach (ModulesManager::get_installed_modules_map_sorted_by_localized_name() as $id => $module) {
    if (in_array($module->get_id(), $search_extensions_point_modules)) {
        $module_configuration = $module->get_configuration();
        if (!in_array($module->get_id(), $config->get_all_unauthorized_providers())) {
            // Ajout du paramètre search à tous les modules
 public function get_js_validation(FormField $field)
 {
     return 'lengthIntervalFormFieldValidator(' . TextHelper::to_js_string($field->get_id()) . ', ' . $this->lower_bound . ', ' . $this->upper_bound . ', ' . TextHelper::to_js_string($this->error_message) . ')';
 }
 /**
  * @desc Exports a variable to be used in a javascript script.
  * @param string $string A PHP string to convert to a JS one
  * @param string $add_quotes If true, returned string will be bounded by quotes
  * @return string The js equivalent string
  */
 public function escapejs($string, $add_quotes = true)
 {
     return TextHelper::to_js_string($string, $add_quotes);
 }
 public function get_js_validation(FormField $field)
 {
     return 'regexFormFieldValidator(' . TextHelper::to_js_string($field->get_id()) . ', ' . $this->js_regex . ', ' . $this->js_options . ', ' . TextHelper::to_js_string($this->error_message) . ')';
 }
 public function get_js_validation(FormField $field)
 {
     return 'notEmptyFormFieldValidator(' . TextHelper::to_js_string($field->get_id()) . ', ' . TextHelper::to_js_string(StringVars::replace_vars($this->error_message, array('name' => strtolower($field->get_label())))) . ')';
 }
Beispiel #15
0
        // When enabling it, the menu will be moved to this block location
        $block = $menu->get_block();
        // Disable the menu and move it to the disabled position computing new positions
        MenuService::move($menu, Menu::BLOCK_POSITION__NOT_ENABLED);
        // Restore its position and save it
        $menu->set_block($block);
        MenuService::save($menu);
    }
    MenuService::generate_cache();
    AppContext::get_response()->redirect('menus.php#m' . $menu->get_id());
}
// Display the Menu administration
include 'lateral_menu.php';
lateral_menu();
$tpl = new FileTemplate('admin/menus/links.tpl');
$tpl->put_all(array('L_NAME' => $LANG['name'], 'L_URL' => $LANG['url'], 'L_IMAGE' => LangLoader::get_message('form.picture', 'common'), 'L_STATUS' => $LANG['status'], 'L_HIDDEN_WITH_SMALL_SCREENS' => $LANG['hidden_with_small_screens'], 'L_AUTHS' => $LANG['auths'], 'L_ENABLED' => LangLoader::get_message('enabled', 'common'), 'L_DISABLED' => LangLoader::get_message('disabled', 'common'), 'L_GUEST' => $LANG['guest'], 'L_USER' => $LANG['member'], 'L_MODO' => $LANG['modo'], 'L_ADMIN' => $LANG['admin'], 'L_LOCATION' => $LANG['location'], 'L_ACTION_MENUS' => $menu_id > 0 ? $LANG['menus_edit'] : LangLoader::get_message('add', 'common'), 'L_ACTION' => $menu_id > 0 ? $LANG['update'] : $LANG['submit'], 'L_RESET' => $LANG['reset'], 'ACTION' => 'save', 'L_TYPE' => $LANG['type'], 'L_CONTENT' => $LANG['content'], 'L_AUTHORIZATIONS' => $LANG['authorizations'], 'L_ADD' => LangLoader::get_message('add', 'common'), 'L_REQUIRE_NAME' => $LANG['require_name'], 'J_AUTH_FORM' => str_replace(array("&quot;", "<!--", "-->"), array('"', "", ""), TextHelper::to_js_string(Authorizations::generate_select(Menu::MENU_AUTH_BIT, array('r-1' => Menu::MENU_AUTH_BIT, 'r0' => Menu::MENU_AUTH_BIT, 'r1' => Menu::MENU_AUTH_BIT), array(), 'menu_element_##UID##_auth'))), 'JL_AUTHORIZATIONS' => TextHelper::to_js_string($LANG['authorizations']), 'JL_PROPERTIES' => TextHelper::to_js_string($LANG['properties']), 'JL_NAME' => TextHelper::to_js_string($LANG['name']), 'JL_URL' => TextHelper::to_js_string($LANG['url']), 'JL_IMAGE' => TextHelper::to_js_string(LangLoader::get_message('form.picture', 'common')), 'JL_DELETE_ELEMENT' => TextHelper::to_js_string(LangLoader::get_message('confirm.delete', 'status-messages-common')), 'JL_MORE' => TextHelper::to_js_string($LANG['more_details']), 'JL_DELETE' => TextHelper::to_js_string(LangLoader::get_message('delete', 'common')), 'JL_ADD_SUB_ELEMENT' => TextHelper::to_js_string($LANG['add_sub_element']), 'JL_ADD_SUB_MENU' => TextHelper::to_js_string($LANG['add_sub_menu'])));
//Localisation possibles.
$block = retrieve(GET, 's', Menu::BLOCK_POSITION__HEADER, TINTEGER);
$array_location = array(Menu::BLOCK_POSITION__HEADER => $LANG['menu_header'], Menu::BLOCK_POSITION__SUB_HEADER => $LANG['menu_subheader'], Menu::BLOCK_POSITION__LEFT => $LANG['menu_left'], Menu::BLOCK_POSITION__TOP_CENTRAL => $LANG['menu_top_central'], Menu::BLOCK_POSITION__BOTTOM_CENTRAL => $LANG['menu_bottom_central'], Menu::BLOCK_POSITION__RIGHT => $LANG['menu_right'], Menu::BLOCK_POSITION__TOP_FOOTER => $LANG['menu_top_footer'], Menu::BLOCK_POSITION__FOOTER => $LANG['menu_footer']);
$edit_menu_tpl = new FileTemplate('admin/menus/menu_edition.tpl');
$edit_menu_tpl->put_all(array('L_NAME' => $LANG['name'], 'L_IMAGE' => LangLoader::get_message('form.picture', 'common'), 'L_URL' => $LANG['url'], 'L_PROPERTIES' => $LANG['properties'], 'L_AUTHORIZATIONS' => $LANG['authorizations'], 'L_ADD_SUB_ELEMENT' => $LANG['add_sub_element'], 'L_ADD_SUB_MENU' => $LANG['add_sub_menu'], 'L_MORE' => $LANG['more_details'], 'L_DELETE' => LangLoader::get_message('delete', 'common')));
$menu = null;
if ($menu_id > 0) {
    $menu = MenuService::load($menu_id);
    if (!$menu instanceof LinksMenu) {
        AppContext::get_response()->redirect('menus.php');
    }
    $block = $menu->get_block();
} else {
    // Create a new generic menu
    $menu = new LinksMenu('', '', '', LinksMenu::AUTOMATIC_MENU);
    private function build_form(HTTPRequestCustom $request)
    {
        $form = new HTMLForm(__CLASS__);
        $fieldset = new FormFieldsetHTML('articles', $this->lang['articles']);
        $form->add_fieldset($fieldset);
        $fieldset->add_field(new FormFieldTextEditor('title', $this->common_lang['form.title'], $this->get_article()->get_title(), array('required' => true)));
        if (!$this->is_contributor_member()) {
            $fieldset->add_field(new FormFieldCheckbox('personalize_rewrited_title', $this->common_lang['form.rewrited_name.personalize'], $this->get_article()->rewrited_title_is_personalized(), array('events' => array('click' => '
					if (HTMLForms.getField("personalize_rewrited_title").getValue()) {
						HTMLForms.getField("rewrited_title").enable();
					} else { 
						HTMLForms.getField("rewrited_title").disable();
					}'))));
            $fieldset->add_field(new FormFieldTextEditor('rewrited_title', $this->common_lang['form.rewrited_name'], $this->get_article()->get_rewrited_title(), array('description' => $this->common_lang['form.rewrited_name.description'], 'hidden' => !$this->get_article()->rewrited_title_is_personalized()), array(new FormFieldConstraintRegex('`^[a-z0-9\\-]+$`i'))));
        }
        $search_category_children_options = new SearchCategoryChildrensOptions();
        $search_category_children_options->add_authorizations_bits(Category::READ_AUTHORIZATIONS);
        $search_category_children_options->add_authorizations_bits(Category::CONTRIBUTION_AUTHORIZATIONS);
        $fieldset->add_field(ArticlesService::get_categories_manager()->get_select_categories_form_field('id_category', $this->common_lang['form.category'], $this->get_article()->get_id_category(), $search_category_children_options));
        $fieldset->add_field(new FormFieldCheckbox('enable_description', $this->lang['articles.form.description_enabled'], $this->get_article()->get_description_enabled(), array('description' => StringVars::replace_vars($this->lang['articles.form.description_enabled.description'], array('number' => ArticlesConfig::load()->get_number_character_to_cut())), 'events' => array('click' => '
					if (HTMLForms.getField("enable_description").getValue()) {
						HTMLForms.getField("description").enable();
					} else { 
						HTMLForms.getField("description").disable();
					}'))));
        $fieldset->add_field(new FormFieldRichTextEditor('description', StringVars::replace_vars($this->lang['articles.form.description'], array('number' => ArticlesConfig::load()->get_number_character_to_cut())), $this->get_article()->get_description(), array('rows' => 3, 'hidden' => !$this->get_article()->get_description_enabled())));
        $fieldset->add_field(new FormFieldRichTextEditor('contents', $this->common_lang['form.contents'], $this->get_article()->get_contents(), array('rows' => 15, 'required' => true)));
        $onclick_action = 'javascript:bbcode_page();';
        $fieldset->add_field(new FormFieldActionLink('add_page', $this->lang['articles.form.add_page'], $onclick_action, PATH_TO_ROOT . '/articles/templates/images/pagebreak.png'));
        $other_fieldset = new FormFieldsetHTML('other', $this->common_lang['form.other']);
        $form->add_fieldset($other_fieldset);
        $other_fieldset->add_field(new FormFieldCheckbox('author_name_displayed', LangLoader::get_message('config.author_displayed', 'admin-common'), $this->get_article()->get_author_name_displayed()));
        $other_fieldset->add_field(new FormFieldCheckbox('notation_enabled', LangLoader::get_message('config.notation_enabled', 'admin-common'), $this->get_article()->get_notation_enabled()));
        $other_fieldset->add_field(new FormFieldUploadPictureFile('picture', $this->common_lang['form.picture'], $this->get_article()->get_picture()->relative()));
        $other_fieldset->add_field(ArticlesService::get_keywords_manager()->get_form_field($this->get_article()->get_id(), 'keywords', $this->common_lang['form.keywords'], array('description' => $this->common_lang['form.keywords.description'])));
        $other_fieldset->add_field(new ArticlesFormFieldSelectSources('sources', $this->common_lang['form.sources'], $this->get_article()->get_sources()));
        if (!$this->is_contributor_member()) {
            $publication_fieldset = new FormFieldsetHTML('publication', $this->common_lang['form.approbation']);
            $form->add_fieldset($publication_fieldset);
            $publication_fieldset->add_field(new FormFieldDateTime('date_created', $this->common_lang['form.date.creation'], $this->get_article()->get_date_created(), array('required' => true)));
            $publication_fieldset->add_field(new FormFieldSimpleSelectChoice('publishing_state', $this->common_lang['form.approbation'], $this->get_article()->get_publishing_state(), array(new FormFieldSelectChoiceOption($this->common_lang['form.approbation.not'], Article::NOT_PUBLISHED), new FormFieldSelectChoiceOption($this->common_lang['form.approbation.now'], Article::PUBLISHED_NOW), new FormFieldSelectChoiceOption($this->common_lang['status.approved.date'], Article::PUBLISHED_DATE)), array('events' => array('change' => '
				if (HTMLForms.getField("publishing_state").getValue() == 2) {
					jQuery("#' . __CLASS__ . '_publishing_start_date_field").show();
					HTMLForms.getField("end_date_enable").enable();
				} else { 
					jQuery("#' . __CLASS__ . '_publishing_start_date_field").hide();
					HTMLForms.getField("end_date_enable").disable();
				}'))));
            $publication_fieldset->add_field(new FormFieldDateTime('publishing_start_date', $this->common_lang['form.date.start'], $this->get_article()->get_publishing_start_date() === null ? new Date() : $this->get_article()->get_publishing_start_date(), array('hidden' => $this->get_article()->get_publishing_state() != Article::PUBLISHED_DATE)));
            $publication_fieldset->add_field(new FormFieldCheckbox('end_date_enable', $this->common_lang['form.date.end.enable'], $this->get_article()->end_date_enabled(), array('hidden' => $this->get_article()->get_publishing_state() != Article::PUBLISHED_DATE, 'events' => array('click' => '
						if (HTMLForms.getField("end_date_enable").getValue()) {
							HTMLForms.getField("publishing_end_date").enable();
						} else { 
							HTMLForms.getField("publishing_end_date").disable();
						}'))));
            $publication_fieldset->add_field(new FormFieldDateTime('publishing_end_date', $this->common_lang['form.date.end'], $this->get_article()->get_publishing_end_date() === null ? new date() : $this->get_article()->get_publishing_end_date(), array('hidden' => !$this->get_article()->end_date_enabled())));
        }
        $this->build_contribution_fieldset($form);
        $fieldset->add_field(new FormFieldHidden('referrer', $request->get_url_referrer()));
        $this->submit_button = new FormButtonDefaultSubmit();
        $form->add_button($this->submit_button);
        $form->add_button(new FormButtonReset());
        $this->form = $form;
        // Positionnement à la bonne page quand on édite un article avec plusieurs pages
        if ($this->get_article()->get_id() !== null) {
            $current_page = $request->get_getstring('page', '');
            $this->tpl->put('C_PAGE', !empty($current_page));
            if (!empty($current_page)) {
                $article_contents = $this->article->get_contents();
                //If article doesn't begin with a page, we insert one
                if (substr(trim($article_contents), 0, 6) != '[page]') {
                    $article_contents = '[page]&nbsp;[/page]' . $article_contents;
                }
                //Removing [page] bbcode
                $article_contents_clean = preg_split('`\\[page\\].+\\[/page\\](.*)`Us', $article_contents, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
                //Retrieving pages
                preg_match_all('`\\[page\\]([^[]+)\\[/page\\]`U', $article_contents, $array_page);
                $page_name = isset($array_page[1][$current_page - 1]) && $array_page[1][$current_page - 1] != '&nbsp;' ? $array_page[1][$current_page - 1] : '';
                $this->tpl->put('PAGE', TextHelper::to_js_string($page_name));
            }
        }
    }
Beispiel #17
0
    if ($menu->is_enabled()) {
        $menu->set_block(retrieve(POST, 'location', Menu::BLOCK_POSITION__NOT_ENABLED));
    }
    $menu->set_auth(Authorizations::build_auth_array_from_form(Menu::MENU_AUTH_BIT));
    //Filters
    MenuAdminService::set_retrieved_filters($menu);
    MenuService::move($menu, $menu->get_block());
    MenuService::generate_cache();
    AppContext::get_response()->redirect('menus.php#m' . $menu->get_id());
}
// Display the Menu administration
$edit = !empty($id);
include 'lateral_menu.php';
lateral_menu();
$tpl = new FileTemplate('admin/menus/feed.tpl');
$tpl->put_all(array('L_REQUIRE' => LangLoader::get_message('form.explain_required_fields', 'status-messages-common'), 'JL_REQUIRE_NAME' => TextHelper::to_js_string($LANG['require_name']), 'JL_REQUIRE_FEED' => TextHelper::to_js_string($LANG['choose_feed_in_list']), 'JL_REQUIRE_ITEMS_NUMBER' => TextHelper::to_js_string($LANG['require_items_number']), 'L_FEED' => $LANG['feed'], 'L_AVAILABLES_FEEDS' => $LANG['availables_feeds'], 'L_NAME' => $LANG['name'], 'L_STATUS' => $LANG['status'], 'L_HIDDEN_WITH_SMALL_SCREENS' => $LANG['hidden_with_small_screens'], 'L_AUTHS' => $LANG['auths'], 'L_ENABLED' => LangLoader::get_message('enabled', 'common'), 'L_DISABLED' => LangLoader::get_message('disabled', 'common'), 'L_GUEST' => $LANG['guest'], 'L_USER' => $LANG['member'], 'L_MODO' => $LANG['modo'], 'L_ADMIN' => $LANG['admin'], 'L_LOCATION' => $LANG['location'], 'L_ACTION_MENUS' => $edit ? $LANG['menus_edit'] : LangLoader::get_message('add', 'common'), 'L_ACTION' => $edit ? $LANG['update'] : $LANG['submit'], 'L_RESET' => $LANG['reset'], 'ACTION' => 'save'));
//Localisation possibles.
$block = retrieve(GET, 's', Menu::BLOCK_POSITION__HEADER, TINTEGER);
$array_location = array(Menu::BLOCK_POSITION__HEADER => $LANG['menu_header'], Menu::BLOCK_POSITION__SUB_HEADER => $LANG['menu_subheader'], Menu::BLOCK_POSITION__LEFT => $LANG['menu_left'], Menu::BLOCK_POSITION__TOP_CENTRAL => $LANG['menu_top_central'], Menu::BLOCK_POSITION__BOTTOM_CENTRAL => $LANG['menu_bottom_central'], Menu::BLOCK_POSITION__RIGHT => $LANG['menu_right'], Menu::BLOCK_POSITION__TOP_FOOTER => $LANG['menu_top_footer'], Menu::BLOCK_POSITION__FOOTER => $LANG['menu_footer']);
$feed_url = '';
if ($edit) {
    $menu = MenuService::load($id);
    if (!$menu instanceof FeedMenu) {
        AppContext::get_response()->redirect('menus.php');
    }
    $block = $menu->get_block();
    $feed_url = $menu->get_url(true);
    $tpl->put_all(array('IDMENU' => $id, 'NAME' => $menu->get_title(), 'ITEMS_NUMBER' => $menu->get_number(), 'AUTH_MENUS' => Authorizations::generate_select(Menu::MENU_AUTH_BIT, $menu->get_auth()), 'C_MENU_HIDDEN_WITH_SMALL_SCREENS' => $menu->is_hidden_with_small_screens(), 'C_ENABLED' => $menu->is_enabled(), 'C_EDIT' => true));
} else {
    $tpl->put_all(array('C_NEW' => true, 'C_ENABLED' => true, 'ITEMS_NUMBER' => 10, 'AUTH_MENUS' => Authorizations::generate_select(Menu::MENU_AUTH_BIT, array(), array(-1 => true, 0 => true, 1 => true, 2 => true))));
    // Create a new generic menu
Beispiel #18
0
    $menu->set_display_title(retrieve(POST, 'display_title', false));
    $menu->set_content(retrieve(POST, 'contents', '', TSTRING_UNCHANGE));
    //Filters
    MenuAdminService::set_retrieved_filters($menu);
    MenuService::move($menu, $menu->get_block());
    MenuService::generate_cache();
    AppContext::get_response()->redirect('menus.php#m' . $menu->get_id());
}
// Display the Menu administration
$edit = !empty($id);
include 'lateral_menu.php';
lateral_menu();
$tpl = new FileTemplate('admin/menus/content.tpl');
$editor = AppContext::get_content_formatting_service()->get_default_editor();
$editor->set_identifier('contents');
$tpl->put_all(array('KERNEL_EDITOR' => $editor->display(), 'L_REQUIRE' => LangLoader::get_message('form.explain_required_fields', 'status-messages-common'), 'L_REQUIRE_NAME' => TextHelper::to_js_string($LANG['require_name']), 'L_REQUIRE_TEXT' => TextHelper::to_js_string($LANG['require_text']), 'L_NAME' => $LANG['name'], 'L_CONTENT' => $LANG['content'], 'L_STATUS' => $LANG['status'], 'L_HIDDEN_WITH_SMALL_SCREENS' => $LANG['hidden_with_small_screens'], 'L_AUTHS' => $LANG['auths'], 'L_ENABLED' => LangLoader::get_message('enabled', 'common'), 'L_DISABLED' => LangLoader::get_message('disabled', 'common'), 'L_GUEST' => $LANG['guest'], 'L_USER' => $LANG['member'], 'L_MODO' => $LANG['modo'], 'L_ADMIN' => $LANG['admin'], 'L_LOCATION' => $LANG['location'], 'L_ACTION_MENUS' => $edit ? $LANG['menus_edit'] : LangLoader::get_message('add', 'common'), 'L_ACTION' => $edit ? $LANG['update'] : $LANG['submit'], 'L_RESET' => $LANG['reset'], 'L_PREVIEW' => $LANG['preview'], 'ACTION' => 'save', 'L_DISPLAY_TITLE' => $LANG['display_title']));
//Localisation possibles.
$block = retrieve(GET, 's', Menu::BLOCK_POSITION__HEADER, TINTEGER);
$array_location = array(Menu::BLOCK_POSITION__HEADER => $LANG['menu_header'], Menu::BLOCK_POSITION__SUB_HEADER => $LANG['menu_subheader'], Menu::BLOCK_POSITION__LEFT => $LANG['menu_left'], Menu::BLOCK_POSITION__TOP_CENTRAL => $LANG['menu_top_central'], Menu::BLOCK_POSITION__BOTTOM_CENTRAL => $LANG['menu_bottom_central'], Menu::BLOCK_POSITION__RIGHT => $LANG['menu_right'], Menu::BLOCK_POSITION__TOP_FOOTER => $LANG['menu_top_footer'], Menu::BLOCK_POSITION__FOOTER => $LANG['menu_footer']);
if ($edit) {
    $menu = MenuService::load($id);
    if (!$menu instanceof ContentMenu) {
        AppContext::get_response()->redirect('menus.php');
    }
    $block = $menu->get_block();
    $content = $menu->get_content();
    $tpl->put_all(array('IDMENU' => $id, 'NAME' => $menu->get_title(), 'AUTH_MENUS' => Authorizations::generate_select(Menu::MENU_AUTH_BIT, $menu->get_auth()), 'C_MENU_HIDDEN_WITH_SMALL_SCREENS' => $menu->is_hidden_with_small_screens(), 'C_ENABLED' => $menu->is_enabled(), 'CONTENTS' => !empty($content) ? FormatingHelper::unparse($content) : '', 'DISPLAY_TITLE_CHECKED' => $menu->get_display_title() ? 'checked="checked"' : ''));
} else {
    $tpl->put_all(array('C_ENABLED' => true, 'AUTH_MENUS' => Authorizations::generate_select(Menu::MENU_AUTH_BIT, array(), array(-1 => true, 0 => true, 1 => true, 2 => true))));
    // Create a new generic menu
    $menu = new ContentMenu('');