• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP utf8_htmlspecialchars函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中utf8_htmlspecialchars函数的典型用法代码示例。如果您正苦于以下问题:PHP utf8_htmlspecialchars函数的具体用法?PHP utf8_htmlspecialchars怎么用?PHP utf8_htmlspecialchars使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了utf8_htmlspecialchars函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: filespec

 /**
  * File Class
  * @access private
  */
 function filespec($upload_ary, $upload_namespace)
 {
     if (!isset($upload_ary)) {
         $this->init_error = true;
         return;
     }
     $this->filename = $upload_ary['tmp_name'];
     $this->filesize = $upload_ary['size'];
     $name = STRIP ? stripslashes($upload_ary['name']) : $upload_ary['name'];
     $name = trim(utf8_htmlspecialchars(utf8_basename($name)));
     $this->realname = $this->uploadname = $name;
     $this->mimetype = $upload_ary['type'];
     // Opera adds the name to the mime type
     $this->mimetype = strpos($this->mimetype, '; name') !== false ? str_replace(strstr($this->mimetype, '; name'), '', $this->mimetype) : $this->mimetype;
     if (!$this->mimetype) {
         $this->mimetype = 'application/octetstream';
     }
     $this->extension = strtolower($this->get_extension($this->realname));
     // Try to get real filesize from temporary folder (not always working) ;)
     $this->filesize = @filesize($this->filename) ? @filesize($this->filename) : $this->filesize;
     $this->width = $this->height = 0;
     $this->file_moved = false;
     $this->local = isset($upload_ary['local_mode']) ? true : false;
     $this->upload = $upload_namespace;
 }
开发者ID:danielheyman,项目名称:EazySubs,代码行数:29,代码来源:functions_upload.php


示例2: main

 function main($id, $mode)
 {
     global $config, $template, $phpbb_admin_path, $phpEx;
     $collect_url = "http://www.phpbb.com/stats/receive_stats.php";
     $this->tpl_name = 'acp_send_statistics';
     $this->page_title = 'ACP_SEND_STATISTICS';
     // generate a unique id if necessary
     if (!isset($config['questionnaire_unique_id'])) {
         $install_id = unique_id();
         set_config('questionnaire_unique_id', $install_id);
     } else {
         $install_id = $config['questionnaire_unique_id'];
     }
     $collector = new phpbb_questionnaire_data_collector($install_id);
     // Add data provider
     $collector->add_data_provider(new phpbb_questionnaire_php_data_provider());
     $collector->add_data_provider(new phpbb_questionnaire_system_data_provider());
     $collector->add_data_provider(new phpbb_questionnaire_phpbb_data_provider($config));
     $template->assign_vars(array('U_COLLECT_STATS' => $collect_url, 'RAW_DATA' => $collector->get_data_for_form(), 'U_ACP_MAIN' => append_sid("{$phpbb_admin_path}index.{$phpEx}")));
     $raw = $collector->get_data_raw();
     foreach ($raw as $provider => $data) {
         if ($provider == 'install_id') {
             $data = array($provider => $data);
         }
         $template->assign_block_vars('providers', array('NAME' => htmlspecialchars($provider)));
         foreach ($data as $key => $value) {
             if (is_array($value)) {
                 $value = utf8_wordwrap(serialize($value), 75, "\n", true);
             }
             $template->assign_block_vars('providers.values', array('KEY' => utf8_htmlspecialchars($key), 'VALUE' => utf8_htmlspecialchars($value)));
         }
     }
 }
开发者ID:ahmatjan,项目名称:Crimson,代码行数:33,代码来源:acp_send_statistics.php


示例3: main

 function main($id, $mode)
 {
     global $template, $request, $phpbb_root_path, $phpbb_admin_path, $user, $cache, $config, $phpEx;
     $user->add_lang_ext('marttiphpbb/customcode', 'acp');
     add_form_key('marttiphpbb/customcode');
     $customcode_directory = new customcode_directory($user, $phpbb_root_path);
     $filenames = $customcode_directory->get_filenames();
     if ($config['tpl_allow_php']) {
         $params = array('i' => 'acp_board', 'mode' => 'security');
         $link = append_sid($phpbb_admin_path . 'index.' . $phpEx, $params, true, $user->session_id) . '#tpl_allow_php';
         $template->assign_var('ACP_CUSTOMCODE_INCLUDEPHP_WARNING', sprintf($user->lang('ACP_CUSTOMCODE_INCLUDEPHP_WARNING'), '<a href="' . $link . '">', '</a>'));
     }
     switch ($mode) {
         case 'edit':
             $this->tpl_name = 'edit';
             $this->page_title = $user->lang('ACP_CUSTOMCODE_EDIT');
             $file = $request->variable('filename', '', true);
             $editor_rows = max(5, min(999, $request->variable('editor_rows', 8)));
             $save = $request->is_set_post('save');
             $save_purge_cache = $request->is_set_post('save_purge_cache');
             if ($save || $save_purge_cache) {
                 $data = utf8_normalize_nfc($request->variable('file_data', '', true));
                 $data = htmlspecialchars_decode($data);
                 if (confirm_box(true)) {
                     $customcode_directory->save_to_file($file, $data);
                     if ($save_purge_cache) {
                         $config->increment('assets_version', 1);
                         $cache->purge();
                         trigger_error(sprintf($user->lang('ACP_CUSTOMCODE_FILE_SAVED_CACHE_PURGED'), $file) . adm_back_link($this->u_action . '&amp;filename=' . $file));
                     }
                     trigger_error(sprintf($user->lang('ACP_CUSTOMCODE_FILE_SAVED'), $file) . adm_back_link($this->u_action . '&amp;filename=' . $file));
                 }
                 if (!in_array($file, $filenames)) {
                     trigger_error(sprintf($user->lang('ACP_CUSTOMCODE_FILE_DOES_NOT_EXIST'), $file) . adm_back_link($this->u_action), E_USER_WARNING);
                 }
                 $confirm_message = $save_purge_cache ? 'ACP_CUSTOMCODE_SAVE_PURGE_CACHE_CONFIRM' : 'ACP_CUSTOMCODE_SAVE_CONFIRM';
                 $s_hidden_fields = array('filename' => $file, 'file_data' => utf8_htmlspecialchars($data), 'mode' => 'edit');
                 $submit_field = $save_purge_cache ? 'save_purge_cache' : 'save';
                 $s_hidden_fields[$submit_field] = 1;
                 confirm_box(false, sprintf($user->lang($confirm_message), $file), build_hidden_fields($s_hidden_fields));
             } else {
                 reset($filenames);
                 $file = $file == '' ? current($filenames) : $file;
             }
             $data = $customcode_directory->file_get_contents($file);
             $options = '';
             $event_file_indicator = $user->lang('ACP_CUSTOMCODE_EVENT_FILE_INDICATOR');
             foreach ($filenames as $filename) {
                 $options .= '<option value="' . $filename . '"';
                 $options .= $filename == $file ? ' selected="selected"' : '';
                 $options .= '>' . $filename;
                 $options .= $customcode_directory->is_event($filename) ? ' ' . $event_file_indicator : '';
                 $options .= '</option>';
             }
             $template->assign_vars(array('U_ACTION' => $this->u_action, 'EDITOR_ROWS' => $editor_rows, 'FILENAME' => $file, 'S_IS_EVENT' => $customcode_directory->is_event($file), 'FILE_DATA' => utf8_htmlspecialchars($data), 'S_FILENAMES' => $options, 'INCLUDE_EXAMPLE' => sprintf($user->lang('ACP_CUSTOMCODE_INCLUDE_EXAMPLE', $customcode_directory->get_dir()))));
             break;
         case 'files':
             $this->tpl_name = 'files';
             $this->page_title = $user->lang('ACP_CUSTOMCODE_FILES');
             $new_file = $request->variable('new_file', '');
             $file_to_delete = array_keys($request->variable('delete', array('' => '')));
             $file_to_delete = sizeof($file_to_delete) ? $file_to_delete[0] : false;
             if ($request->is_set_post('create')) {
                 if (!check_form_key('marttiphpbb/customcode')) {
                     trigger_error('FORM_INVALID');
                 }
                 if (!$new_file) {
                     trigger_error($user->lang('ACP_CUSTOMCODE_FILENAME_EMPTY') . adm_back_link($this->u_action), E_USER_WARNING);
                 }
                 if (in_array($new_file, $filenames)) {
                     trigger_error(sprintf($user->lang('ACP_CUSTOMCODE_FILE_ALREADY_EXISTS'), $new_file) . adm_back_link($this->u_action), E_USER_WARNING);
                 }
                 $customcode_directory->create_file($new_file);
                 trigger_error(sprintf($user->lang('ACP_CUSTOMCODE_FILE_CREATED'), $new_file) . adm_back_link($this->u_action));
             }
             if ($request->is_set_post('delete')) {
                 if (!in_array($file_to_delete, $filenames)) {
                     trigger_error(sprintf($user->lang('ACP_CUSTOMCODE_FILE_DOES_NOT_EXIST'), $file_to_delete) . adm_back_link($this->u_action), E_USER_WARNING);
                 }
                 if (confirm_box(true)) {
                     $customcode_directory->delete_file($file_to_delete);
                     trigger_error(sprintf($user->lang('ACP_CUSTOMCODE_FILE_DELETED'), $file_to_delete) . adm_back_link($this->u_action));
                 }
                 $s_hidden_fields = array('mode' => 'files', 'delete' => array($file_to_delete => 1));
                 confirm_box(false, sprintf($user->lang('ACP_CUSTOMCODE_DELETE_FILE_CONFIRM'), $file_to_delete), build_hidden_fields($s_hidden_fields));
             }
             $u_edit = str_replace('mode=files', 'mode=edit', $this->u_action);
             foreach ($filenames as $filename) {
                 $template->assign_block_vars('files', array('S_IS_EVENT' => $customcode_directory->is_event($filename), 'NAME' => $filename, 'U_EDIT' => $u_edit . '&amp;filename=' . $filename, 'SIZE' => $customcode_directory->get_filesize($filename), 'COMMENT' => $customcode_directory->get_comment($filename), 'DELETE_FILE_NAME' => sprintf($user->lang('ACP_CUSTOMCODE_DELETE_FILE_NAME'), $filename)));
             }
             $template->assign_vars(array('U_ACTION' => $this->u_action, 'NEW_FILE' => $new_file, 'FILES_EXPLAIN' => sprintf($user->lang('ACP_CUSTOMCODE_FILES_EXPLAIN'), $user->lang('ACP_CUSTOMCODE_EVENT_FILE_INDICATOR'), $customcode_directory->get_dir())));
             if ($request->variable('customcode_show_events', 0)) {
                 $template->assign_var('U_CUSTOMCODE_HIDE_EVENTS', append_sid($phpbb_root_path . 'index.' . $phpEx, array('customcode_hide_events' => 1)));
             } else {
                 $template->assign_var('U_CUSTOMCODE_SHOW_EVENTS', append_sid($phpbb_root_path . 'index.' . $phpEx, array('customcode_show_events' => 1)));
             }
             break;
     }
 }
开发者ID:ezpz-cz,项目名称:web-plugins,代码行数:99,代码来源:main_module.php


示例4: add_backtrace

 /**
  * Add backtrace message for debugging
  */
 function add_backtrace($message)
 {
     if ($this->backtrace) {
         $this->backtrace_log[] = utf8_htmlspecialchars($message);
     }
 }
开发者ID:jvinhit,项目名称:php,代码行数:9,代码来源:functions_messenger.php


示例5: gym_rss

 /**
  * constuctor
  */
 function gym_rss()
 {
     global $phpbb_seo, $phpEx, $config, $user;
     global $db, $auth;
     $this->gym_sitemaps('rss');
     // init output
     $this->output_data['showstats'] = (bool) ($this->gym_config['gym_showstats'] || $this->gym_config['rss_showstats']);
     // Check the main vars
     $this->init_get_vars();
     // url without IDs like forum feed url in case the phpBB SEO mod are used and set so
     // and basic parameter for url such as blabla/news/digest/long/module-rss.xml => gymrss.php?module=blabla&news&digest&long
     if (isset($_GET['nametoid']) && !empty($_GET['nametoid']) && isset($_GET['modulename']) && !empty($_GET['modulename']) && empty($this->actions['module_main']) && empty($this->actions['module_sub'])) {
         $module_name = trim(strtolower($_GET['modulename']));
         // is the module available ?
         if (in_array($module_name, $this->actions['action_modules'])) {
             $this->actions['module_main'] = $module_name;
             // Do we get an id (?module=id)
             if ($id = @array_search(trim($_GET['nametoid']), $phpbb_seo->cache_config[$module_name])) {
                 $this->actions['module_sub'] = intval($id);
             } else {
                 // Pass the variable to the script ?module_name=$_GET['nametoid']
                 $this->actions['module_sub'] = trim(utf8_htmlspecialchars(str_replace(array("\n", "\r"), '', $_GET['nametoid'])));
             }
         }
     }
     if (empty($this->actions['action_modules'])) {
         $this->gym_error(404, '', __FILE__, __LINE__);
     }
     // Set last mod time from DB, will only be used as his for general feeds and channel lists
     // put it into phpbb config for the dynamic property.
     $config_name = $this->actions['action_type'] . '_' . (!empty($this->actions['module_main']) ? $this->actions['module_main'] . '_' : '') . 'last_mod_time';
     if (@$config[$config_name] < $config['board_startdate']) {
         set_config($config_name, $user->time_now, 1);
     }
     $this->output_data['last_mod_time'] = intval($config[$config_name]);
     // Init the output class
     $this->gym_init_output();
     // Setup the output
     $this->cache_config = array_merge($this->cache_config, array('cache_enable' => (bool) $this->set_module_option('cache_on', $this->override['cache']), 'cache_auto_regen' => (bool) $this->set_module_option('cache_auto_regen', $this->override['cache']), 'cache_force_gzip' => (bool) $this->set_module_option('cache_force_gzip', $this->override['cache']), 'cache_born' => $this->output_data['last_mod_time'], 'cache_max_age' => round($this->set_module_option('cache_max_age', $this->override['cache']), 2) * 3600, 'cache_file_ext' => $this->gym_output->gzip_config['gzip'] || $this->gym_config['rss_cache_force_gzip'] ? '.xml.gz' : '.xml'));
     // Can you believe it, sprintf is faster than straight parsing.
     $this->style_config = array('rss_header' => '<' . '?xml version="1.0" encoding="utf-8"?' . '>%s' . "\n" . '<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"' . "\n\t" . 'xmlns:content="http://purl.org/rss/1.0/modules/content/"' . "\n\t" . 'xmlns:atom="http://www.w3.org/2005/Atom">' . "\n" . '<!-- Generated by Google Yahoo MSN Sitemaps and RSS %s - &#169; 2006, ' . date('Y') . ' www.phpBB-SEO.com -->', 'rss_footer' => "\n\t" . '</channel>' . "\n" . '</rss>', 'rss_item_tpl' => "\n\t\t" . '<item>' . "\n\t\t\t" . '<title>%1$s</title>' . "\n\t\t\t" . '<link>%2$s</link>%3$s' . "\n\t\t\t" . '<description>%4$s</description>%8$s' . "\n\t\t\t" . '<source url="%5$s">%6$s</source>' . "\n\t\t\t" . '<guid isPermaLink="true">%7$s</guid>' . "\n\t\t" . '</item>', 'rsschan_tpl' => "\n\t" . '<channel>' . "\n\t\t" . '<title>%1$s</title>' . "\n\t\t" . '<link>%2$s</link>' . "\n\t\t" . '<description>%3$s</description>%4$s' . "\n\t\t" . '%5$s' . "\n\t\t" . '<docs>http://blogs.law.harvard.edu/tech/rss</docs>' . "\n\t\t" . '<generator>Google Yahoo MSN Sitemaps and RSS ' . $this->gym_config['gym_version'] . ' - &#169; 2006, ' . date('Y') . ' www.phpBB-SEO.com</generator>%6$s' . "\n\t\t" . '<atom:link href="%7$s" rel="self" type="application/rss+xml" />%8$s', 'rsschan_input_tpl' => "\n\t\t" . '<textInput>' . "\n\t\t\t" . '<title>%1$s</title>' . "\n\t\t\t" . '<description>%2$s</description>' . "\n\t\t\t" . '<link>%3$s</link>' . "\n\t\t\t" . '<name>%4$s</name>' . "\n\t\t" . '</textInput>' . "\n", 'rsschan_img_tpl' => '<image>' . "\n\t\t\t" . '<title>%1$s</title>' . "\n\t\t\t" . '<url>%2$s</url>' . "\n\t\t\t" . '<link>%3$s</link>' . "\n\t\t" . '</image>', 'chan_lastbuildate_tpl' => "\n\t\t" . '<lastBuildDate>%1$s</lastBuildDate>', 'chan_ttl_tpl' => "\n\t\t" . '<ttl>%1$s</ttl>', 'item_pubdate_tpl' => "\n\t\t\t" . '<pubDate>%1$s</pubDate>', 'item_creator_tpl' => "\n\t\t\t" . '<dc:creator>%1$s</dc:creator>', 'xslt_style' => '', 'stats_genlist' => "\n" . '<!-- URL list generated in  %s s %s - %s sql - %s URLs listed -->', 'stats_start' => "\n" . '<!--  Output started from cache after %s s - %s sql -->', 'stats_nocache' => "\n" . '<!--  Output ended after %s s %s -->', 'stats_end' => "\n" . '<!--  Output from cache ended up after %s s - %s sql -->');
     $rss_limit_time = (int) $this->set_module_option('limit_time', $this->override['limit']);
     $rss_lang = trim($this->set_module_option('lang', $this->gym_config['rss_override']));
     $this->rss_config = array('rss_c_info' => !empty($this->gym_config['rss_c_info']) ? "\n\t\t" . '<copyright>' . $this->xml_encode($this->gym_config['rss_c_info']) . '</copyright>' : '', 'rss_xslt' => $this->gym_config['rss_xslt'] ? true : false, 'rss_force_xslt' => $this->gym_config['rss_xslt'] && $this->gym_config['rss_force_xslt'] ? true : false, 'rss_lang' => !empty($rss_lang) ? "\n\t\t" . '<language>' . $this->xml_encode($rss_lang) . '</language>' : '', 'rss_url' => $phpbb_seo->sslify($this->gym_config['rss_url'], $phpbb_seo->ssl['use'], false), 'rss_yahoo_appid' => !empty($this->gym_config['rss_yahoo_appid']) ? trim($this->gym_config['rss_yahoo_appid']) : '', 'rss_url_limit' => (int) $this->set_module_option('url_limit', $this->override['limit']), 'rss_sql_limit' => (int) $this->set_module_option('sql_limit', $this->override['limit']), 'rss_limit_time' => $rss_limit_time >= 0 ? $rss_limit_time * 3600 * 24 : 0, 'rss_modrewrite' => (int) $this->set_module_option('modrewrite', $this->override['modrewrite']), 'rss_modrtype' => (int) $this->set_module_option('modrtype', $this->override['modrewrite']), 'rss_sitename' => $this->set_module_option('sitename'), 'rss_site_desc' => $this->set_module_option('site_desc'), 'rss_logo_url' => $this->path_config['gym_img_url'] . trim($this->set_module_option('logo_url'), '/'), 'rss_image_url' => $this->path_config['gym_img_url'] . trim($this->set_module_option('image_url'), '/'), 'rss_sort' => $this->set_module_option('sort', $this->override['sort']), 'rss_allow_auth' => (bool) $this->set_module_option('allow_auth', $this->gym_config['rss_override']), 'rss_cache_auth' => (bool) $this->set_module_option('cache_auth', $this->gym_config['rss_override']), 'rss_allow_content' => (bool) $this->set_module_option('allow_content', $this->gym_config['rss_override']), 'rss_allow_news' => (bool) $this->set_module_option('allow_news', $this->gym_config['rss_override']), 'rss_news_update' => round($this->set_module_option('news_update', $this->gym_config['rss_override']), 2) * 3600, 'rss_allow_profile' => (bool) $this->set_module_option('allow_profile', $this->gym_config['rss_override']), 'rss_allow_profile_links' => (bool) $this->set_module_option('allow_profile_links', $this->gym_config['rss_override']), 'rss_sumarize' => (int) $this->set_module_option('sumarize', $this->gym_config['rss_override']), 'rss_sumarize_method' => trim($this->set_module_option('sumarize_method', $this->gym_config['rss_override'])), 'rss_allow_short' => (bool) $this->set_module_option('allow_short', $this->gym_config['rss_override']), 'rss_allow_long' => (bool) $this->set_module_option('allow_long', $this->gym_config['rss_override']), 'rss_allow_bbcode' => (bool) $this->set_module_option('allow_bbcode', $this->gym_config['rss_override']), 'rss_strip_bbcode' => trim($this->set_module_option('strip_bbcode', $this->gym_config['rss_override'])), 'rss_allow_links' => (bool) $this->set_module_option('allow_links', $this->gym_config['rss_override']), 'rss_allow_emails' => (bool) $this->set_module_option('allow_emails', $this->gym_config['rss_override']), 'rss_allow_smilies' => (bool) $this->set_module_option('allow_smilies', $this->gym_config['rss_override']), 'rss_yahoo_notify' => (bool) $this->set_module_option('yahoo_notify', $this->gym_config['rss_override']), 'rss_nohtml' => (bool) $this->set_module_option('nohtml', $this->gym_config['rss_override']), 'rss_display_author' => true, 'rss_yahoo_notify_url' => '', 'rss_msg_filters' => array(), 'rss_auth_msg' => '', 'rss_do_explain' => false);
     $this->rss_config['rss_auth_guest'] = $this->rss_config['rss_allow_auth'] && $user->data['is_registered'] ? false : true;
     $this->cache_config['do_cache'] = $this->rss_config['rss_auth_guest'] ? true : $this->rss_config['rss_cache_auth'];
     // remind for later
     $this->rss_config['rss_profile_mode'] = $this->rss_config['rss_allow_profile_links'] ? 'full' : 'no_profile';
     // Check the rss specific vars and do basic set_up for msg output
     $this->init_rss_vars();
     if (!$this->rss_config['rss_auth_guest']) {
         $this->rss_config['rss_auth_msg'] = "\n" . ($this->actions['rss_channel_list'] || empty($this->actions['module_sub']) || $this->actions['module_sub'] == 'channels' ? sprintf($user->lang['RSS_AUTH_SOME_USER'], $user->data['username']) : sprintf($user->lang['RSS_AUTH_THIS_USER'], $user->data['username'])) . "\n";
     }
     // Are we going to explain ?
     if (!empty($_REQUEST['explain']) && $auth->acl_get('a_') && defined('DEBUG_EXTRA') && method_exists($db, 'sql_report')) {
         $this->rss_config['rss_do_explain'] = true;
         $this->cache_config['do_cache'] = false;
     }
     $this->rss_output();
     if ($this->rss_config['rss_do_explain']) {
         $db->sql_report('display');
     } else {
         $this->gym_output->do_output();
     }
     return;
 }
开发者ID:Ibrahim-Abdelkader,项目名称:phpbb3,代码行数:69,代码来源:gym_rss.php


示例6: split_keywords

 /**
  * Splits keywords entered by a user into an array of words stored in $this->split_words
  * Stores the tidied search query in $this->search_query
  *
  * @param	string	&$keywords	Contains the keyword as entered by the user
  * @param	string	$terms	is either 'all' or 'any'
  * @return	bool	false	if no valid keywords were found and otherwise true
  */
 public function split_keywords(&$keywords, $terms)
 {
     if ($terms == 'all') {
         $match = array('#\\sand\\s#iu', '#\\sor\\s#iu', '#\\snot\\s#iu', '#(^|\\s)\\+#', '#(^|\\s)-#', '#(^|\\s)\\|#');
         $replace = array(' +', ' |', ' -', ' +', ' -', ' |');
         $keywords = preg_replace($match, $replace, $keywords);
     }
     // Filter out as above
     $split_keywords = preg_replace("#[\"\n\r\t]+#", ' ', trim(htmlspecialchars_decode($keywords)));
     // Split words
     $split_keywords = preg_replace('#([^\\p{L}\\p{N}\'*"()])#u', '$1$1', str_replace('\'\'', '\' \'', trim($split_keywords)));
     $matches = array();
     preg_match_all('#(?:[^\\p{L}\\p{N}*"()]|^)([+\\-|]?(?:[\\p{L}\\p{N}*"()]+\'?)*[\\p{L}\\p{N}*"()])(?:[^\\p{L}\\p{N}*"()]|$)#u', $split_keywords, $matches);
     $this->split_words = $matches[1];
     foreach ($this->split_words as $i => $word) {
         $clean_word = preg_replace('#^[+\\-|"]#', '', $word);
         // check word length
         $clean_len = utf8_strlen(str_replace('*', '', $clean_word));
         if ($clean_len < $this->config['fulltext_postgres_min_word_len'] || $clean_len > $this->config['fulltext_postgres_max_word_len']) {
             $this->common_words[] = $word;
             unset($this->split_words[$i]);
         }
     }
     if ($terms == 'any') {
         $this->search_query = '';
         $this->tsearch_query = '';
         foreach ($this->split_words as $word) {
             if (strpos($word, '+') === 0 || strpos($word, '-') === 0 || strpos($word, '|') === 0) {
                 $word = substr($word, 1);
             }
             $this->search_query .= $word . ' ';
             $this->tsearch_query .= '|' . $word . ' ';
         }
     } else {
         $this->search_query = '';
         $this->tsearch_query = '';
         foreach ($this->split_words as $word) {
             if (strpos($word, '+') === 0) {
                 $this->search_query .= $word . ' ';
                 $this->tsearch_query .= '&' . substr($word, 1) . ' ';
             } else {
                 if (strpos($word, '-') === 0) {
                     $this->search_query .= $word . ' ';
                     $this->tsearch_query .= '&!' . substr($word, 1) . ' ';
                 } else {
                     if (strpos($word, '|') === 0) {
                         $this->search_query .= $word . ' ';
                         $this->tsearch_query .= '|' . substr($word, 1) . ' ';
                     } else {
                         $this->search_query .= '+' . $word . ' ';
                         $this->tsearch_query .= '&' . $word . ' ';
                     }
                 }
             }
         }
     }
     $this->tsearch_query = substr($this->tsearch_query, 1);
     $this->search_query = utf8_htmlspecialchars($this->search_query);
     if ($this->search_query) {
         $this->split_words = array_values($this->split_words);
         sort($this->split_words);
         return true;
     }
     return false;
 }
开发者ID:phpbb,项目名称:phpbb-core,代码行数:73,代码来源:fulltext_postgres.php


示例7: restore_config

/**
* Transfers the relevant configuration information from the source forum
* The mapping of fields is specified in $config_schema, see convert_phpbb20.php for more details
*/
function restore_config($schema)
{
    global $db, $config;
    $convert_config = get_config();
    foreach ($schema['settings'] as $config_name => $src) {
        if (preg_match('/(.*)\\((.*)\\)/', $src, $m)) {
            $var = empty($m[2]) || empty($convert_config[$m[2]]) ? "''" : "'" . addslashes($convert_config[$m[2]]) . "'";
            $exec = '$config_value = ' . $m[1] . '(' . $var . ');';
            eval($exec);
        } else {
            $config_value = isset($convert_config[$src]) ? $convert_config[$src] : '';
        }
        if ($config_value !== '') {
            // Most are...
            if (is_string($config_value)) {
                $config_value = truncate_string(utf8_htmlspecialchars($config_value), 255, 255, false);
            }
            set_config($config_name, $config_value);
        }
    }
}
开发者ID:jvinhit,项目名称:php,代码行数:25,代码来源:functions_convert.php


示例8: phpbb_disallowed_username

/**
* Adjust 2.0.x disallowed names to 3.0.x format
*/
function phpbb_disallowed_username($username)
{
	// Replace * with %
	$username = phpbb_set_default_encoding(str_replace('*', '%', $username));
	return utf8_htmlspecialchars($username);
}
开发者ID:BackupTheBerlios,项目名称:phpbb-hu-svn,代码行数:9,代码来源:functions_phpbb20.php


示例9: inject_post_num

 /**
  * Injects a post's number into the row's POST_NUMBER and MINI_POST_IMG fields
  */
 protected function inject_post_num($post_row, $post_num)
 {
     $bold_open = $bold_close = '';
     if ($this->cfg('bold')) {
         $bold_open = '<strong>';
         $bold_close = '</strong>';
     }
     $lang_copy_title = utf8_htmlspecialchars($this->user->lang('POSTNUMBERS_COPY_TITLE'));
     $lang_copied = utf8_htmlspecialchars($this->user->lang('POSTNUMBERS_COPIED'));
     $lang_copy_manually = utf8_htmlspecialchars($this->user->lang('POSTNUMBERS_COPY_MANUALLY'));
     $post_row['POST_NUMBER'] = sprintf('<span class="post-number" title="%s" data-tooltip="%s" data-copy-manually="%s">%s#%d%s</span>', $lang_copy_title, $lang_copied, $lang_copy_manually, $bold_open, $post_num, $bold_close);
     $href = isset($post_row['U_MINI_POST']) ? $post_row['U_MINI_POST'] : '#pr' . $post_row['POST_ID'];
     $post_row['MINI_POST_IMG'] = sprintf('%s</a><a href="%s"> %s ', $post_row['MINI_POST_IMG'], $href, $post_row['POST_NUMBER']);
     return $post_row;
 }
开发者ID:phpbb-addons,项目名称:phpbb-ext-postnumbers,代码行数:18,代码来源:listener.php


示例10: sitemap

 /**
  * sitemap, builds the sitemap
  * @access private
  */
 function sitemap()
 {
     global $cache, $phpEx, $config;
     if (!empty($this->txt_files[$this->options['module_sub']])) {
         // Check robots.txt ?
         if ($this->module_config['google_check_robots']) {
             $this->gym_master->obtain_robots_disallows();
         }
         $sitemap_txt_url = sprintf($this->url_settings['google_txt_tpl'], $this->options['module_sub']);
         $this->gym_master->seo_kill_dupes($sitemap_txt_url);
         $txt_file = $this->txt_files[$this->options['module_sub']];
         // Grab data
         if (($txt_data = @file($txt_file)) && is_array($txt_data)) {
             $last_mod = (int) @filemtime($txt_file);
             $url_count = count($txt_data);
             $this->outputs['last_mod_time'] = $last_mod > $config['board_startdate'] ? $last_mod : time() - rand(500, 10000);
             // Randomize ?
             if ($this->module_config['google_randomize']) {
                 shuffle($txt_data);
             }
             // Limit ?
             if ($this->module_config['google_url_limit'] > 0 && $this->module_config['google_url_limit'] < $url_count) {
                 $txt_data = array_slice($txt_data, 0, $this->module_config['google_url_limit']);
             }
             // Force last mod  ?
             $last_mod = $this->module_config['google_force_lastmod'] ? $this->outputs['last_mod_time'] : 0;
             // Parse URLs
             $dt = rand(0, 3600);
             $url_check = array();
             foreach ($txt_data as $key => $url) {
                 $url = trim($url);
                 if (empty($url) || $this->module_config['google_check_robots'] && $this->gym_master->is_robots_disallowed($url)) {
                     continue;
                 }
                 // Check unique ?
                 if ($this->module_config['google_unique']) {
                     if (isset($url_check[$url])) {
                         continue;
                     }
                     $url_check[$url] = 1;
                 }
                 if ($this->module_config['google_force_lastmod']) {
                     $_last_mod = $last_mod - $dt;
                     $priority = $this->gym_master->get_priority($_last_mod);
                     $changefreq = $this->gym_master->get_changefreq($_last_mod);
                 } else {
                     $_last_mod = $priority = $changefreq = 0;
                 }
                 $this->gym_master->parse_item(utf8_htmlspecialchars($url), $priority, $changefreq, $_last_mod);
                 $dt += rand(30, 3600 * 12);
                 unset($txt_data[$key]);
             }
         } else {
             // Clear the cache to make sure the guilty url is not shown in the sitemapIndex
             $cache->destroy('_gym_config_google_txt');
             $this->gym_master->gym_error(404, '', __FILE__, __LINE__);
         }
     } else {
         $this->gym_master->gym_error(404, '', __FILE__, __LINE__);
     }
     return;
 }
开发者ID:Ibrahim-Abdelkader,项目名称:phpbb3,代码行数:66,代码来源:google_txt.php


示例11: whereTerm

 protected function whereTerm($compareMode, $property, $value)
 {
     global $db;
     $column = $this->propertyToColumn($property);
     if (empty($column) || empty($value) && $value !== '0') {
         return '';
     }
     // Because we decoded the search restriction but phpBB always stores speciachar'd content we need to specialchar all values before we use them
     $value = utf8_htmlspecialchars($value);
     $where = $column . ' ';
     // remove alias to get plain column name
     $plain_column = strpos($column, '.') !== false ? substr($column, strpos($column, '.') + 1) : $column;
     // Adjust value if we need to search for group name.
     if ($plain_column == 'group_name') {
         // Define true as second parameter to reverse the mapping (English name to name stored in database)
         $value = $this->api->get_group_name($value, true);
         $where = 'LOWER(' . $column . ') ';
         $value = strtolower($value);
     }
     // Make sure usernames are always "cleaned" up
     if ($plain_column == 'username_clean') {
         $value = utf8_clean_string($value);
     }
     switch ($compareMode) {
         case 'CONTAINS':
             $where .= $db->sql_like_expression($db->any_char . $value . $db->any_char);
             break;
         case 'EXACTLY_MATCHES':
             if ($plain_column == 'user_type') {
                 if ($value == 'true') {
                     $where .= ' <> ';
                 } else {
                     $where .= ' = ';
                 }
                 $where .= USER_INACTIVE;
             } else {
                 $where .= '= \'' . $db->sql_escape($value) . '\'';
             }
             break;
         case 'GREATER_THAN':
             $where .= '> \'' . (int) $value . '\'';
             break;
         case 'LESS_THAN':
             $where .= '< \'' . (int) $value . '\'';
             break;
         case 'STARTS_WITH':
             $where .= $db->sql_like_expression($value . $db->any_char);
             break;
     }
     return $where;
 }
开发者ID:acydburn,项目名称:crowd-phpbb-auth,代码行数:51,代码来源:auth_api.php


示例12: link_to_admin_home_page

<?php 
if ($success) {
    ?>
            <p><?php 
    echo link_to_admin_home_page(__('Return to Dashboard'));
    ?>
</p>
<?php 
} else {
    ?>
            <p class="error_text"><?php 
    echo html_escape($error);
    ?>
</p>
            <pre id="backtrace"><?php 
    echo utf8_htmlspecialchars($exception);
    ?>
</pre>
            <p class="instruction">
                <?php 
    echo __('Please restore from your database backup and try again.');
    ?>
                <?php 
    echo __('If you have any questions please refer to <a href="http://omeka.org/codex">Omeka documentation</a> or post a message on the <a href="http://omeka.org/forums">Omeka forums</a>.');
    ?>
            </p>
<?php 
}
?>
        </section>
    </div>
开发者ID:lchen01,项目名称:STEdwards,代码行数:31,代码来源:migrate.php


示例13: build_meta

 /**
  * assign / retrun meta tag code
  */
 public function build_meta($page_title = '', $return = false)
 {
     // If meta robots was not manually set
     if (empty($this->meta['robots'])) {
         // Full request URI (e.g. phpBB/app.php/foo/bar)
         $request_uri = $this->symfony_request->getRequestUri();
         // Deny indexing for any url ending with htm(l) or / aznd with a qs (?)
         if (preg_match('`(\\.html?|/)\\?[^\\?]*$`i', $request_uri)) {
             $this->meta['robots'] = 'noindex,follow';
         } else {
             // lets still add some more specific ones
             $this->config['get_filter'] = array_merge($this->config['get_filter'], array('st', 'sk', 'sd', 'ch'));
         }
         // Do we allow indexing based on physical script file name
         if (empty($this->meta['robots'])) {
             if (!empty($this->user->page['page_name']) && strpos($this->config['file_filter'], str_replace(".{$this->php_ext}", '', $this->user->page['page_name'])) !== false) {
                 $this->meta['robots'] = 'noindex,follow';
             }
         }
         // Do we allow indexing based on get variable
         if (empty($this->meta['robots'])) {
             foreach ($this->config['get_filter'] as $get) {
                 if (isset($_GET[$get])) {
                     $this->meta['robots'] = 'noindex,follow';
                     break;
                 }
             }
         }
         // fallback to default if necessary
         if (empty($this->meta['robots'])) {
             $this->meta['robots'] = $this->meta_def['robots'];
         }
     }
     if (!empty($this->config['seo_meta_noarchive'])) {
         $forum_id = isset($_GET['f']) ? max(0, request_var('f', 0)) : 0;
         if ($forum_id) {
             $forum_ids = @explode(',', preg_replace('`[\\s]+`', '', trim($this->config['seo_meta_noarchive'], ', ')));
             if (in_array($forum_id, $forum_ids)) {
                 $this->meta['robots'] .= (!empty($this->meta['robots']) ? ',' : '') . 'noarchive';
             }
         }
     }
     // deal with titles, assign the tag if a default is set
     if (empty($this->meta['title']) && !empty($this->meta_def['title'])) {
         $this->meta['title'] = $page_title;
     }
     $meta_code = '';
     foreach ($this->tpl as $key => $value) {
         if (isset($this->meta[$key])) {
             // do like this so we can deactivate one particular tag on a given page,
             // by just setting the meta to an empty string
             if (trim($this->meta[$key])) {
                 $this->meta[$key] = isset($this->filters[$key]) ? $this->{$this->filters[$key]}($this->meta[$key]) : $this->meta[$key];
             }
         } else {
             if (!empty($this->meta_def[$key])) {
                 $this->meta[$key] = isset($this->filters[$key]) ? $this->{$this->filters[$key]}($this->meta_def[$key]) : $this->meta_def[$key];
             }
         }
         if (trim($this->meta[$key])) {
             $meta_code .= sprintf($value, utf8_htmlspecialchars($this->meta[$key])) . "\n";
         }
     }
     if (!$return) {
         $this->template->assign_var('SEO_META_TAGS', $meta_code);
     } else {
         return $meta_code;
     }
 }
开发者ID:nowlena,项目名称:meta,代码行数:72,代码来源:core.php


示例14: siteAction

 /**
  * Generate RSS for specified site
  */
 function siteAction($siteId)
 {
     if (!Config::get("rssSitesEnabled")) {
         $this->return404();
     }
     //get category data
     $site = $this->site->findByPk($siteId);
     if (empty($site)) {
         return $this->return404();
     }
     $this->site->attachParents($site);
     $rawSiteTitle = $site['siteTitle'];
     $doc = new XmlGenerator();
     $rssNode = $doc->createElement('rss');
     $doc->appendChild($rssNode);
     $rssNode->setAttribute('version', '2.0');
     $channelNode = new XmlElement('channel');
     $rssNode->appendChild($channelNode);
     //add channel properties
     $channelNode->addProperty('title', utf8_htmlspecialchars($rawSiteTitle));
     $channelNode->addProperty('link', AppRouter::getObjectUrl($site, "siteDetails", true));
     $channelNode->addProperty('description', _t('Site') . ' ' . utf8_htmlspecialchars($rawSiteTitle));
     $channelNode->addProperty('language', 'fr-fr');
     $channelNode->addProperty('lastBuildDate', date('D, j M Y H:i:s O'));
     $channelNode->addProperty('generator', 'RSS Generator');
     $sites = array($site);
     $this->appendSites($channelNode, $sites);
     $this->set("doc", $doc);
     $this->viewClass = "XmlView";
 }
开发者ID:reinfire,项目名称:arfooo,代码行数:33,代码来源:RssController.php


示例15: login

    /**
     * {@inheritdoc}
     */
    public function login($username, $password)
    {
        // do not allow empty password
        if (!$password) {
            return array('status' => LOGIN_ERROR_PASSWORD, 'error_msg' => 'NO_PASSWORD_SUPPLIED', 'user_row' => array('user_id' => ANONYMOUS));
        }
        if (!$username) {
            return array('status' => LOGIN_ERROR_USERNAME, 'error_msg' => 'LOGIN_ERROR_USERNAME', 'user_row' => array('user_id' => ANONYMOUS));
        }
        if (!@extension_loaded('ldap')) {
            return array('status' => LOGIN_ERROR_EXTERNAL_AUTH, 'error_msg' => 'LDAP_NO_LDAP_EXTENSION', 'user_row' => array('user_id' => ANONYMOUS));
        }
        $this->config['ldap_port'] = (int) $this->config['ldap_port'];
        if ($this->config['ldap_port']) {
            $ldap = @ldap_connect($this->config['ldap_server'], $this->config['ldap_port']);
        } else {
            $ldap = @ldap_connect($this->config['ldap_server']);
        }
        if (!$ldap) {
            return array('status' => LOGIN_ERROR_EXTERNAL_AUTH, 'error_msg' => 'LDAP_NO_SERVER_CONNECTION', 'user_row' => array('user_id' => ANONYMOUS));
        }
        @ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);
        @ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0);
        if ($this->config['ldap_user'] || $this->config['ldap_password']) {
            if (!@ldap_bind($ldap, htmlspecialchars_decode($this->config['ldap_user']), htmlspecialchars_decode($this->config['ldap_password']))) {
                return array('status' => LOGIN_ERROR_EXTERNAL_AUTH, 'error_msg' => 'LDAP_NO_SERVER_CONNECTION', 'user_row' => array('user_id' => ANONYMOUS));
            }
        }
        $search = @ldap_search($ldap, htmlspecialchars_decode($this->config['ldap_base_dn']), $this->ldap_user_filter($username), empty($this->config['ldap_email']) ? array(htmlspecialchars_decode($this->config['ldap_uid'])) : array(htmlspecialchars_decode($this->config['ldap_uid']), htmlspecialchars_decode($this->config['ldap_email'])), 0, 1);
        $ldap_result = @ldap_get_entries($ldap, $search);
        if (is_array($ldap_result) && sizeof($ldap_result) > 1) {
            if (@ldap_bind($ldap, $ldap_result[0]['dn'], htmlspecialchars_decode($password))) {
                @ldap_close($ldap);
                $sql = 'SELECT user_id, username, user_password, user_passchg, user_email, user_type
					FROM ' . USERS_TABLE . "\n\t\t\t\t\tWHERE username_clean = '" . $this->db->sql_escape(utf8_clean_string($username)) . "'";
                $result = $this->db->sql_query($sql);
                $row = $this->db->sql_fetchrow($result);
                $this->db->sql_freeresult($result);
                if ($row) {
                    unset($ldap_result);
                    // User inactive...
                    if ($row['user_type'] == USER_INACTIVE || $row['user_type'] == USER_IGNORE) {
                        return array('status' => LOGIN_ERROR_ACTIVE, 'error_msg' => 'ACTIVE_ERROR', 'user_row' => $row);
                    }
                    // Successful login... set user_login_attempts to zero...
                    return array('status' => LOGIN_SUCCESS, 'error_msg' => false, 'user_row' => $row);
                } else {
                    // retrieve default group id
                    $sql = 'SELECT group_id
						FROM ' . GROUPS_TABLE . "\n\t\t\t\t\t\tWHERE group_name = '" . $this->db->sql_escape('REGISTERED') . "'\n\t\t\t\t\t\t\tAND group_type = " . GROUP_SPECIAL;
                    $result = $this->db->sql_query($sql);
     

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP utf8_ireplace函数代码示例发布时间:2022-05-23
下一篇:
PHP utf8_from_unicode函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap