コード例 #1
0
 protected function load_lang(HTTPRequestCustom $request)
 {
     $locale = TextHelper::htmlspecialchars($request->get_string('lang', UpdateController::DEFAULT_LOCALE));
     LangLoader::set_locale($locale);
     UpdateUrlBuilder::set_locale($locale);
     $this->lang = LangLoader::get('update', 'update');
 }
コード例 #2
0
 protected function load_lang(HTTPRequestCustom $request)
 {
     $locale = TextHelper::htmlspecialchars($request->get_string('lang', self::DEFAULT_LOCALE));
     $locale = in_array($locale, InstallationServices::get_available_langs()) ? $locale : self::DEFAULT_LOCALE;
     LangLoader::set_locale($locale);
     InstallUrlBuilder::set_locale($locale);
     $this->lang = LangLoader::get('install', 'install');
 }
コード例 #3
0
 public static function update_extended_field(ExtendedField $extended_field)
 {
     self::change_extended_field_to_member($extended_field);
     $data_field = self::select_data_field_by_id($extended_field);
     $former_field_type = $data_field['field_type'];
     $new_field_type = $extended_field->get_field_type();
     self::$db_querier->inject("UPDATE " . DB_TABLE_MEMBER_EXTENDED_FIELDS_LIST . " SET \r\n\t\t\tname = :name, field_name = :field_name, description = :description, field_type = :field_type, possible_values = :possible_values, default_value = :default_value, required = :required, display = :display, regex = :regex, freeze = :freeze, auth = :auth\r\n\t\t\tWHERE id = :id", array('name' => TextHelper::htmlspecialchars($extended_field->get_name()), 'field_name' => $extended_field->get_field_name(), 'description' => TextHelper::htmlspecialchars($extended_field->get_description()), 'field_type' => $extended_field->get_field_type(), 'possible_values' => serialize($extended_field->get_possible_values()), 'default_value' => TextHelper::htmlspecialchars($extended_field->get_default_value()), 'required' => (string) $extended_field->get_required(), 'display' => (string) $extended_field->get_display(), 'regex' => TextHelper::htmlspecialchars($extended_field->get_regex()), 'freeze' => (string) $extended_field->get_is_freeze(), 'auth' => serialize($extended_field->get_authorization()), 'id' => $extended_field->get_id()));
     // If change field type, delete old informations
     if ($former_field_type !== $new_field_type) {
         self::delete_empty_fields_member($extended_field);
     }
 }
コード例 #4
0
ファイル: MarkUpParser.class.php プロジェクト: DrJoey/MarkUp
 private function protect_content()
 {
     //Breaking the HTML code
     $this->content = TextHelper::htmlspecialchars($this->content, ENT_NOQUOTES);
     $this->content = strip_tags($this->content);
     //While we aren't in UTF8 encoding, we have to use HTML entities to display some special chars, we accept them.
     $this->content = preg_replace('`&((?:#[0-9]{2,5})|(?:[a-z0-9]{2,8}));`i', "&\$1;", $this->content);
     //Treatment of the Word pasted characters
     $array_str = array('?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?');
     $array_str_replace = array('€', '‚', 'ƒ', '„', '…', '†', '‡', 'ˆ', '‰', 'Š', '‹', 'Œ', 'Ž', '‘', '’', '“', '”', '•', '–', '—', '˜', '™', 'š', '›', 'œ', 'ž', 'Ÿ');
     $this->content = str_replace($array_str, $array_str_replace, $this->content);
 }
コード例 #5
0
 public function retrieve_value()
 {
     $request = AppContext::get_request();
     $values = array();
     for ($i = 1; $i <= $this->max_input; $i++) {
         $field_label_id = 'field_label_' . $this->get_html_id() . '_' . $i;
         if ($request->has_postparameter($field_label_id)) {
             $field_answers_id = 'field_answers_' . $this->get_html_id() . '_' . $i;
             $field_label = $request->get_poststring($field_label_id);
             $field_answers = $request->get_poststring($field_answers_id);
             if (!empty($field_label) && !empty($field_answers)) {
                 $values[$i] = array('label' => TextHelper::htmlspecialchars($field_label), 'answers' => TextHelper::htmlspecialchars($field_answers));
             }
         }
     }
     $this->set_value($values);
 }
コード例 #6
0
 private function add_language_bar()
 {
     $lang = TextHelper::htmlspecialchars(AppContext::get_request()->get_string('lang', InstallController::DEFAULT_LOCALE));
     $lang = in_array($lang, InstallationServices::get_available_langs()) ? $lang : InstallController::DEFAULT_LOCALE;
     $lang_dir = new Folder(PATH_TO_ROOT . '/lang');
     $langs = array();
     foreach ($lang_dir->get_folders('`^[a-z_-]+$`i') as $folder) {
         $info_lang = load_ini_file(PATH_TO_ROOT . '/lang/', $folder->get_name());
         if (!empty($info_lang['name'])) {
             $langs[] = array('LANG' => $folder->get_name(), 'LANG_NAME' => $info_lang['name'], 'SELECTED' => $folder->get_name() == $lang ? 'selected="selected"' : '');
             if ($folder->get_name() == $lang) {
                 $this->full_view->put('LANG_IDENTIFIER', $info_lang['identifier']);
             }
         }
     }
     $this->full_view->put('lang', $langs);
 }
コード例 #7
0
 /**
  * @desc Highlights the content of the parser.
  * @param bool $inline_code If you want that the code make a new HTML paragraph, use BBCODE_HIGHLIGHTER_BLOCK_CODE
  * (default parameter) and if you want that it would be integrated in a line, use BBCODE_HIGHLIGHTER_INLINE_CODE
  * @return void You can get the result by calling the get_content method
  */
 public function parse($inline_code = self::BBCODE_HIGHLIGHTER_BLOCK_CODE)
 {
     //Protection of html code
     $this->content = TextHelper::htmlspecialchars($this->content);
     //Line tag
     $this->content = str_replace('[line]', '<span style="color:' . self::$bbcode_tag_color . ';">[line]</span>', $this->content);
     $this->content = str_replace('[*]', '<span style="color:' . self::$bbcode_list_item_color . ';">[*]</span>', $this->content);
     //Simple tags (whitout parameter)
     $simple_tags = array('b', 'i', 'u', 's', 'sup', 'sub', 'pre', 'math', 'quote', 'block', 'fieldset', 'sound', 'url', 'img', 'mail', 'code', 'tr', 'html', 'row', 'indent', 'hide', 'mail');
     foreach ($simple_tags as $tag) {
         while (preg_match('`\\[' . $tag . '\\](.*)\\[/' . $tag . '\\]`isU', $this->content)) {
             $this->content = preg_replace('`\\[' . $tag . '\\](.*)\\[/' . $tag . '\\]`isU', '<span style="color:' . self::$bbcode_tag_color . ';">/[/' . $tag . '/]/</span>$1<span style="color:' . self::$bbcode_tag_color . ';">/[//' . $tag . '/]/</span>', $this->content);
         }
     }
     //Tags which take a parameter : [tag=parameter]content[/tag]
     $tags_with_simple_property = array('img', 'color', 'bgcolor', 'size', 'font', 'align', 'float', 'anchor', 'acronym', 'title', 'stitle', 'style', 'url', 'mail', 'code', 'quote', 'movie', 'swf', 'mail');
     foreach ($tags_with_simple_property as $tag) {
         while (preg_match('`\\[' . $tag . '=([^\\]]+)\\](.*)\\[/' . $tag . '\\]`isU', $this->content)) {
             $this->content = preg_replace('`\\[' . $tag . '=([^\\]]+)\\](.*)\\[/' . $tag . '\\]`isU', '<span style="color:' . self::$bbcode_tag_color . ';">/[/' . $tag . '</span>=<span style="color:' . self::$bbcode_param_color . ';">$1</span><span style="color:' . self::$bbcode_tag_color . ';">/]/</span>$2<span style="color:' . self::$bbcode_tag_color . ';">/[//' . $tag . '/]/</span>', $this->content);
         }
     }
     //Tags which take several parameters. The syntax is the same as XML parameters
     $tags_with_many_parameters = array('table', 'col', 'head', 'list', 'fieldset', 'block', 'wikipedia');
     foreach ($tags_with_many_parameters as $tag) {
         while (preg_match('`\\[(' . $tag . ')([^\\]]*)\\](.*)\\[/' . $tag . '\\]`isU', $this->content)) {
             $this->content = preg_replace_callback('`\\[(' . $tag . ')([^\\]]*)\\](.*)\\[/' . $tag . '\\]`isU', array($this, 'highlight_bbcode_tag_with_many_parameters'), $this->content);
         }
     }
     if ($inline_code == self::BBCODE_HIGHLIGHTER_BLOCK_CODE) {
         $this->content = '<pre>' . $this->content . '</pre>';
     } else {
         $this->content = '<pre style="display:inline;">' . $this->content . '</pre>';
     }
     //Te be able to handle the nested tags, we replaced [ by /[/, we do the reverse replacement now
     $this->content = str_replace(array('/[/', '/]/'), array('[', ']'), $this->content);
 }
コード例 #8
0
 private function exists($name)
 {
     return $this->db_querier->row_exists(DB_TABLE_KEYWORDS, 'WHERE name=:name OR rewrited_name=:rewrited_name', array('name' => TextHelper::htmlspecialchars($name), 'rewrited_name' => TextHelper::htmlspecialchars(Url::encode_rewrite($name))));
 }
コード例 #9
0
ファイル: Sitemap.class.php プロジェクト: AroundPBT/PHPBoost
 /**
  * @desc Exports a Sitemap. You will be able to use the following variables into the templates used to export:
  * <ul>
  * 	<li>C_SITE_MAP which is a condition indicating if it's a site map (useful if you want to use a sigle template
  * for the whole export configuration)</li>
  * 	<li>SITE_NAME which contains the name of the site</li>
  * 	<li>A loop "element" in which the code of each element is in the variable CODE</li>
  * </ul>
  * @param SitemapExportConfig $export_config Export configuration
  * @return Template The exported code of the Sitemap
  */
 public function export(SitemapExportConfig $export_config)
 {
     //We get the stream in which we are going to write
     $template = $export_config->get_site_map_stream();
     $template->put_all(array('C_SITE_MAP' => true, 'SITE_NAME' => TextHelper::htmlspecialchars($this->site_name, ENT_QUOTES)));
     //Let's export all the element it contains
     foreach ($this->elements as $element) {
         $template->assign_block_vars('element', array(), array('ELEMENT' => $element->export($export_config)));
     }
     return $template;
 }
コード例 #10
0
 /**
  * @desc Exports the section according to the given configuration. You will use the following template variables:
  * <ul>
  * 	<li>LOC containing the URL of the link</li>
  * 	<li>TEXT containing the name of the target page</li>
  * 	<li>C_DISPLAY_DATE indicating if the date is not empty</li>
  * 	<li>DATE containing the date of the last modification of the target page, formatted for the sitemap.xml file</li>
  * 	<li>ACTUALIZATION_FREQUENCY corresponding to the code needed in the sitemap.xml file</li>
  * 	<li>PRIORITY corresponding to the code needed in the sitemap.xml file to indicate the priority of the target page.</li>
  * 	<li>C_LINK indicating that we are displaying a link (useful if you want to use a signe template export configuration)</li>
  * </ul>
  * @param SitemapExportConfig $export_config Export configuration
  * @return Template the exported link
  */
 public function export(SitemapExportConfig $export_config)
 {
     $display_date = $this->last_modification_date !== null;
     //We get the stream in which we are going to write
     $template = $export_config->get_link_stream();
     $template->put_all(array('LOC' => $this->get_url(), 'TEXT' => TextHelper::htmlspecialchars($this->name, ENT_QUOTES), 'C_DISPLAY_DATE' => $display_date, 'DATE' => $display_date ? $this->last_modification_date->to_date() : '', 'ACTUALIZATION_FREQUENCY' => $this->change_freq, 'PRIORITY' => $this->priority, 'C_LINK' => true));
     return $template;
 }
コード例 #11
0
ファイル: Category.class.php プロジェクト: AroundPBT/PHPBoost
 public function get_properties()
 {
     return array('id' => $this->get_id(), 'name' => TextHelper::htmlspecialchars($this->get_name()), 'rewrited_name' => TextHelper::htmlspecialchars($this->get_rewrited_name()), 'c_order' => $this->get_order(), 'special_authorizations' => (int) $this->has_special_authorizations(), 'auth' => !$this->auth_is_empty() ? serialize($this->get_authorizations()) : '', 'id_parent' => $this->get_id_parent());
 }
コード例 #12
0
 private function prepare_controller()
 {
     $title = LangLoader::get_message('error', 'status-messages-common');
     if ($this->exception !== null && Debug::is_debug_mode_enabled()) {
         $message = TextHelper::htmlspecialchars($this->exception->getMessage()) . '<br /><br /><i>' . $this->exception->getFile() . ':' . $this->exception->getLine() . '</i><div class="spacer"></div>' . Debug::get_stacktrace_as_string(0, $this->exception);
         $title .= ' ' . $this->exception->getCode();
     } else {
         $message = TextHelper::htmlspecialchars(LangLoader::get_message('process.error', 'status-messages-common'));
     }
     $controller = new UserErrorController($title, $message, UserErrorController::FATAL);
     return $controller;
 }
コード例 #13
0
ファイル: wiki_functions.php プロジェクト: AroundPBT/PHPBoost
function wiki_display_menu($menu_list)
{
    if (count($menu_list) == 0) {
        return '';
    }
    $menu = '';
    $last_level = 0;
    foreach ($menu_list as $title) {
        $current_level = $title[0];
        $title_name = stripslashes($title[1]);
        $title_link = '<a href="#paragraph_' . Url::encode_rewrite($title_name) . '">' . TextHelper::htmlspecialchars($title_name) . '</a>';
        if ($current_level > $last_level) {
            $menu .= '<ol class="wiki_list_' . $current_level . '"><li>' . $title_link;
        } elseif ($current_level == $last_level) {
            $menu .= '</li><li>' . $title_link;
        } else {
            if (substr($menu, strlen($menu) - 4, 4) == '<li>') {
                $menu = substr($menu, 0, strlen($menu) - 4);
            }
            $menu .= str_repeat('</li></ol>', $last_level - $current_level) . '</li><li>' . $title_link;
        }
        $last_level = $title[0];
    }
    //End
    if (substr($menu, strlen($menu) - 4, 4) == '<li>') {
        $menu = substr($menu, 0, strlen($menu) - 4);
    }
    $menu .= str_repeat('</li></ol>', $last_level);
    return $menu;
}
コード例 #14
0
ファイル: Feed.class.php プロジェクト: AroundPBT/PHPBoost
 /**
  * @desc Exports the feed as a string parsed by the <$tpl> template
  * @param mixed $template If false, uses de default tpl. If an associative array,
  * uses the default tpl but assigns it the array vars first.
  * It could also be a Template object
  * @param int $number the number of item to display
  * @param int $begin_at the first item to display
  * @return string The exported feed
  */
 public function export($template = false, $number = 10, $begin_at = 0)
 {
     if ($template === false) {
         // A specific template is used
         $tpl = clone $this->tpl;
     } else {
         $tpl = clone $template;
     }
     if (!empty($this->data)) {
         $desc = TextHelper::htmlspecialchars($this->data->get_desc());
         $tpl->put_all(array('DATE' => $this->data->get_date(), 'DATE_RFC822' => $this->data->get_date_rfc2822(), 'DATE_RFC3339' => $this->data->get_date_iso8601(), 'DATE_TEXT' => $this->data->get_date_text(), 'THIS_YEAR' => date('Y'), 'TITLE' => $this->data->get_title(), 'U_LINK' => $this->data->get_link(), 'HOST' => $this->data->get_host(), 'DESC' => ContentSecondParser::export_html_text($desc), 'RAW_DESC' => $desc, 'LANG' => $this->data->get_lang()));
         $items = $this->data->subitems($number, $begin_at);
         foreach ($items as $item) {
             $desc = TextHelper::htmlspecialchars($item->get_desc());
             $enclosure = $item->get_enclosure();
             $tpl->assign_block_vars('item', array('TITLE' => $item->get_title(), 'U_LINK' => $item->get_link(), 'U_GUID' => $item->get_guid(), 'DESC' => ContentSecondParser::export_html_text($desc), 'RAW_DESC' => $desc, 'DATE' => $item->get_date(), 'DATE_RFC822' => $item->get_date_rfc2822(), 'DATE_RFC3339' => $item->get_date_iso8601(), 'DATE_TEXT' => $item->get_date_text(), 'C_IMG' => $item->get_image_url() != '' ? true : false, 'U_IMG' => $item->get_image_url(), 'C_ENCLOSURE' => $enclosure !== null, 'ENCLOSURE_LENGHT' => $enclosure !== null ? $enclosure->get_lenght() : '', 'ENCLOSURE_TYPE' => $enclosure !== null ? $enclosure->get_type() : '', 'ENCLOSURE_URL' => $enclosure !== null ? $enclosure->get_url() : ''));
         }
     }
     return $tpl->render();
 }
コード例 #15
0
 public static function add_comment($id_topic, $message, $user_id, $pseudo, $user_ip)
 {
     $columns = array('id_topic' => $id_topic, 'user_id' => $user_id, 'pseudo' => TextHelper::htmlspecialchars($pseudo), 'user_ip' => TextHelper::htmlspecialchars($user_ip), 'timestamp' => time(), 'message' => $message);
     $result = self::$db_querier->insert(DB_TABLE_COMMENTS, $columns);
     return $result->get_last_inserted_id();
 }
コード例 #16
0
 /**
  * @desc applies htmlspecialchars php function to the given string
  * @param $string A String 
  * @return string the string without html special chars
  */
 public function escape($string)
 {
     return TextHelper::htmlspecialchars($string);
 }
コード例 #17
0
 /**
  * @desc Prepares the content of the parser. Treats the HTML entities contained by the content, most of them has been added by TinyMCE.
  * It also authorizes the non-utf-8 characters by accepting their HTML entity.
  */
 private function prepare_content()
 {
     //On enlève toutes les entités HTML rajoutées par TinyMCE
     $this->content = TextHelper::html_entity_decode($this->content);
     //On casse toutes les balises HTML (sauf celles qui ont été prélevées dans le code et la balise HTML)
     $this->content = TextHelper::htmlspecialchars($this->content, ENT_NOQUOTES);
     //While we aren't in UTF8 encoding, we have to use HTML entities to display some special chars, we accept them.
     $this->content = preg_replace('`&amp;((?:#[0-9]{2,5})|(?:[a-z0-9]{2,8}));`i', "&\$1;", $this->content);
 }
コード例 #18
0
 private function add_parameter($key, $value)
 {
     $value_to_display = '';
     if (is_array($value)) {
         $value_to_display = '<ul>';
         foreach ($value as $a_value) {
             $value_to_display .= '<li>' . TextHelper::htmlspecialchars($a_value) . '</li>';
         }
         $value_to_display .= '</ul>';
     } else {
         $value_to_display = TextHelper::htmlspecialchars($value);
     }
     $row_class = $this->is_row_odd ? 'oddRow' : 'evenRow';
     $this->is_row_odd = !$this->is_row_odd;
     return '<tr class="' . $row_class . '">' . '<td class="parameterName">' . $key . '</td>' . '<td class="parameterValue">' . str_replace("\n", '<br />', $value_to_display) . '</td>' . '</tr>';
 }
コード例 #19
0
 public static function get_args($call)
 {
     $args = $call['args'];
     $trace = '<ul>';
     foreach ($args as $arg) {
         $trace .= '<li><pre>' . TextHelper::htmlspecialchars(print_r($arg, true)) . '</pre></li>';
     }
     $trace .= '</ul>';
     return $trace;
 }
コード例 #20
0
 /**
  * @desc Exports the section according to the given configuration. You will use the following template variables:
  * <ul>
  * 	<li>SECTION_NAME which contains the name of the section</li>
  * 	<li>SECTION_URL which contains the URL of the link associated to the section</li>
  * 	<li>DEPTH which contains the depth of the section in the site map tree (useful for CSS classes names)</li>
  * 	<li>LINK_CODE which contains the code got by the associated link export</li>
  * 	<li>C_SECTION, boolean meaning that it's a section (useful if you want to use a sigle template for the whole export configuration)</li>
  * 	<li>A loop "element" containing evert element of the section (their code is available in the CODE variable of the loop)</li>
  * </ul>
  * @param SitemapExportConfig $export_config Export configuration
  * @return Template the exported section
  */
 public function export(SitemapExportConfig $export_config)
 {
     //We get the stream in which we are going to write
     $template = $export_config->get_section_stream();
     $template->put_all(array('SECTION_NAME' => TextHelper::htmlspecialchars($this->get_name(), ENT_QUOTES), 'SECTION_URL' => !empty($this->link) ? $this->link->get_url() : '', 'DEPTH' => $this->depth, 'C_SECTION' => true));
     if ($this->link != null) {
         $template->put('LINK', $this->link->export($export_config));
     }
     foreach ($this->elements as $element) {
         $template->assign_block_vars('element', array(), array('ELEMENT' => $element->export($export_config)));
     }
     return $template;
 }
コード例 #21
0
 /**
  * @desc Update user
  * @param User $user 
  * @param string $condition the SQL condition update user
  * @param array $parameters 
  */
 public static function update(User $user, $extended_fields = null)
 {
     $condition = 'WHERE user_id=:user_id';
     $parameters = array('user_id' => $user->get_id());
     self::$querier->update(DB_TABLE_MEMBER, array('display_name' => TextHelper::htmlspecialchars($user->get_display_name()), 'level' => $user->get_level(), 'groups' => implode('|', $user->get_groups()), 'email' => $user->get_email(), 'show_email' => (int) $user->get_show_email(), 'locale' => $user->get_locale(), 'timezone' => $user->get_timezone(), 'theme' => $user->get_theme(), 'editor' => $user->get_editor()), $condition, $parameters);
     if ($extended_fields !== null) {
         if ($extended_fields instanceof MemberExtendedFieldsService) {
             $fields_data = $extended_fields->get_data($user->get_id());
         } elseif (is_array($extended_fields)) {
             $fields_data = $extended_fields;
         } else {
             $fields_data = array();
         }
         self::$querier->update(DB_TABLE_MEMBER_EXTENDED_FIELDS, $fields_data, $condition, $parameters);
     }
     SessionData::recheck_cached_data_from_user_id($user->get_id());
     self::regenerate_cache();
 }
 private function save($id)
 {
     $extended_field = new ExtendedField();
     $extended_field->set_id($id);
     $extended_field = ExtendedFieldsService::data_field($extended_field);
     $freeze = $extended_field->get_is_freeze();
     if (!$freeze) {
         $extended_field->set_field_name(ExtendedField::rewrite_field_name($this->form->get_value('name', $extended_field->get_field_name())));
         $extended_field->set_field_type($this->form->get_value('field_type', $extended_field->get_field_type())->get_raw_value());
     } else {
         $extended_field->set_field_name(TextHelper::htmlspecialchars($extended_field->get_field_name()));
         $extended_field->set_field_type($extended_field->get_field_type());
     }
     $extended_field->set_name(TextHelper::htmlspecialchars($this->form->get_value('name')));
     $extended_field->set_position(PersistenceContext::get_querier()->get_column_value(DB_TABLE_MEMBER_EXTENDED_FIELDS_LIST, 'MAX(position) + 1', ''));
     $extended_field->set_description(TextHelper::htmlspecialchars($this->form->get_value('description', $extended_field->get_description())));
     if (!$this->form->field_is_disabled('possible_values')) {
         $extended_field->set_possible_values($this->form->get_value('possible_values'));
     }
     if (!$this->form->field_is_disabled('default_value')) {
         $extended_field->set_default_value($this->form->get_value('default_value'));
     }
     $extended_field->set_is_required((bool) $this->form->get_value('field_required'));
     $extended_field->set_display((bool) $this->form->get_value('display'));
     $regex = 0;
     if (!$this->form->field_is_disabled('regex_type')) {
         $regex = is_numeric($this->form->get_value('regex_type', '')->get_raw_value()) ? $this->form->get_value('regex_type', '')->get_raw_value() : $this->form->get_value('regex', '');
     }
     $extended_field->set_regex($regex);
     $extended_field->set_authorization($this->form->get_value('authorizations', $extended_field->get_authorization())->build_auth_array());
     ExtendedFieldsService::update($extended_field);
     return $extended_field;
 }
コード例 #23
0
 /**
  * {@inheritdoc}
  */
 public function get_data(HTMLForm $form, MemberExtendedField $member_extended_field)
 {
     $field_name = $member_extended_field->get_field_name();
     return TextHelper::htmlspecialchars($form->get_value($field_name, ''));
 }
コード例 #24
0
 private static function sanitize_html(array $array)
 {
     $proper_array = array();
     foreach ($array as $key => $value) {
         if (is_array($value)) {
             $proper_array[$key] = self::sanitize_html($value);
         } else {
             $proper_array[$key] = TextHelper::htmlspecialchars($value);
         }
     }
     return $proper_array;
 }
コード例 #25
0
 public static function load_static_constants()
 {
     //Path from the server root
     define('SCRIPT', TextHelper::htmlspecialchars($_SERVER['PHP_SELF']));
     define('REWRITED_SCRIPT', TextHelper::htmlspecialchars($_SERVER['REQUEST_URI']));
     //Get parameters
     define('QUERY_STRING', addslashes($_SERVER['QUERY_STRING']));
     define('PHPBOOST', true);
     ### Authorizations ###
     define('AUTH_FLOOD', 'auth_flood');
     define('PM_GROUP_LIMIT', 'pm_group_limit');
     define('DATA_GROUP_LIMIT', 'data_group_limit');
 }
コード例 #26
0
 public function i18n($key, $parameters)
 {
     return TextHelper::htmlspecialchars($this->i18nraw($key, $parameters));
 }
コード例 #27
0
 /**
  * @desc Exports the sitemap (according to a configuration of templates).
  * In your template, you will be able to use the following variables:
  * <ul>
  * 	<li>MODULE_ID which contains the id of the module</li>
  *  <li>C_MODULE_ID tells whether the module identifier is known</li>
  * 	<li>MODULE_NAME which contains the name of the module</li>
  *  <li>MODULE_DESCRIPTION which contains the description of the module</li>
  *  <li>MODULE_URL which contains the URL of the module root page</li>
  *  <li>DEPTH which is the depth of the module map in the sitemap (generally 1).
  *  It might be usefull to apply different CSS styles to each level of depth.</li>
  *  <li>LINK_CODE which contains the code of the link associated to the module root exported with the same configuration.</li>
  *  <li>C_MODULE_MAP which is a boolean whose value is true, this will enable you to use a single template for the whole export configuration</li>
  *  <li>The loop "element" for which the variable CODE contains the code of each sub element of the module (for example categories)</li>
  *  </ul>
  * @param SitemapExportConfig $export_config export configuration
  * @return Template the template
  */
 public function export(SitemapExportConfig $export_config)
 {
     //We get the stream in which we are going to write
     $template = $export_config->get_module_map_stream();
     $template->put_all(array('MODULE_ID' => $this->get_module_id(), 'C_MODULE_ID' => $this->get_module_id() != '', 'MODULE_NAME' => TextHelper::htmlspecialchars($this->get_name(), ENT_QUOTES), 'MODULE_DESCRIPTION' => FormatingHelper::second_parse($this->description), 'MODULE_URL' => !empty($this->link) ? $this->link->get_url() : '', 'DEPTH' => $this->depth, 'C_MODULE_MAP' => true));
     if ($this->link != null) {
         $template->put('LINK', $this->link->export($export_config));
     }
     //We export all the elements contained by the module map
     foreach ($this->elements as $element) {
         $template->assign_block_vars('element', array(), array('ELEMENT' => $element->export($export_config)));
     }
     return $template;
 }