当前位置: 首页>>代码示例>>PHP>>正文


PHP phpbb_clean_search_string函数代码示例

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


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

示例1: phpbb_clean_search_string

		FROM ' . POSTS_TABLE . "\n\t\tWHERE topic_id = {$topic_id}\n\t\t\tAND post_time >= {$min_post_time}\n\t\t\t\tAND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id);
    $result = $db->sql_query($sql);
    $total_posts = (int) $db->sql_fetchfield('num_posts');
    $db->sql_freeresult($result);
    $limit_posts_time = "AND p.post_time >= {$min_post_time} ";
    if (isset($_POST['sort'])) {
        $start = 0;
    }
} else {
    $total_posts = $topic_replies + 1;
    $limit_posts_time = '';
}
// Was a highlight request part of the URI?
$highlight_match = $highlight = '';
if ($hilit_words) {
    $highlight_match = phpbb_clean_search_string($hilit_words);
    $highlight = urlencode($highlight_match);
    $highlight_match = str_replace('\\*', '\\w+?', preg_quote($highlight_match, '#'));
    $highlight_match = preg_replace('#(?<=^|\\s)\\\\w\\*\\?(?=\\s|$)#', '\\w+?', $highlight_match);
    $highlight_match = str_replace(' ', '|', $highlight_match);
}
// Make sure $start is set to the last page if it exceeds the amount
$start = $pagination->validate_start($start, $config['posts_per_page'], $total_posts);
// General Viewtopic URL for return links
$viewtopic_url = append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", "f={$forum_id}&amp;t={$topic_id}" . ($start == 0 ? '' : "&amp;start={$start}") . (strlen($u_sort_param) ? "&amp;{$u_sort_param}" : '') . ($highlight_match ? "&amp;hilit={$highlight}" : ''));
// Are we watching this topic?
$s_watching_topic = array('link' => '', 'link_toggle' => '', 'title' => '', 'title_toggle' => '', 'is_watching' => false);
if ($config['allow_topic_notify']) {
    $notify_status = isset($topic_data['notify_status']) ? $topic_data['notify_status'] : null;
    watch_topic_forum('topic', $s_watching_topic, $user->data['user_id'], $forum_id, $topic_id, $notify_status, $start, $topic_data['topic_title']);
    // Reset forum notification if forum notify is set
开发者ID:ramukumar555,项目名称:phpbb,代码行数:31,代码来源:viewtopic.php

示例2: test_phpbb_clean_search_string

 /**
  * @dataProvider phpbb_clean_search_string_data
  */
 public function test_phpbb_clean_search_string($search_string, $expected)
 {
     $this->assertEquals($expected, phpbb_clean_search_string($search_string));
 }
开发者ID:phpbb,项目名称:phpbb,代码行数:7,代码来源:phpbb_clean_search_string_test.php

示例3: array_filter

				while ($row = $db->sql_fetchrow($result))
				{
					$attachments[$row['post_msg_id']][] = $row;
				}
				$db->sql_freeresult($result);
			}
		}

		if ($hilit)
		{
			// Remove bad highlights
			$hilit_array = array_filter(explode('|', $hilit), 'strlen');
			foreach ($hilit_array as $key => $value)
			{
				$hilit_array[$key] = phpbb_clean_search_string($value);
				$hilit_array[$key] = str_replace('\*', '\w*?', preg_quote($hilit_array[$key], '#'));
				$hilit_array[$key] = preg_replace('#(^|\s)\\\\w\*\?(\s|$)#', '$1\w+?$2', $hilit_array[$key]);
			}
			$hilit = implode('|', $hilit_array);
		}

		/**
		* Modify the rowset data
		*
		* @event core.search_modify_rowset
		* @var	array	attachments				Array with posts attachments data
		* @var	string	hilit					String to highlight
		* @var	array	rowset					Array with the search results data
		* @var	string	show_results			String indicating the show results mode
		* @var	array	topic_tracking_info		Array with the topics tracking data
开发者ID:abhinay100,项目名称:phpbb_app,代码行数:30,代码来源:search.php

示例4: core_user_setup


//.........这里部分代码省略.........
                     $this->core->seo_redirect($this->core->seo_path['phpbb_url']);
                 } else {
                     send_status_line(404, 'Not Found');
                 }
                 return;
             }
             $this->topic_id = $topic_id = (int) $topic_data['topic_id'];
             $this->forum_id = $forum_id;
             $this->core->set_parent_urls($topic_data);
             if (!empty($topic_data['topic_url']) || isset($topic_data['topic_url']) && !empty($this->core->seo_opt['sql_rewrite'])) {
                 if ($topic_data['topic_type'] == POST_GLOBAL) {
                     // Let's make sure user will see global annoucements
                     // $this->auth->cache[$forum_id]['f_read'] = 1;
                     $_parent = $this->core->seo_static['global_announce'];
                 } else {
                     $this->core->prepare_forum_url($topic_data);
                     $_parent = $this->core->seo_url['forum'][$forum_id];
                 }
                 if (!$this->core->check_url('topic', $topic_data['topic_url'], $_parent)) {
                     if (!empty($topic_data['topic_url'])) {
                         // Here we get rid of the seo delim (-t) and put it back even in simple mod
                         // to be able to handle all cases at once
                         $_url = preg_replace('`' . $this->core->seo_delim['topic'] . '$`i', '', $topic_data['topic_url']);
                         $_title = $this->core->get_url_info('topic', $_url . $this->core->seo_delim['topic'] . $topic_id, 'title');
                     } else {
                         $_title = $this->core->modrtype > 2 ? censor_text($topic_data['topic_title']) : '';
                     }
                     unset($this->core->seo_url['topic'][$topic_id]);
                     $topic_data['topic_url'] = $this->core->get_url_info('topic', $this->core->prepare_url('topic', $_title, $topic_id, $_parent, empty($_title) || $_title == $this->core->seo_static['topic'] ? true : false), 'url');
                     unset($this->core->seo_url['topic'][$topic_id]);
                     if ($topic_data['topic_url']) {
                         // Update the topic_url field for later re-use
                         $sql = "UPDATE " . TOPICS_TABLE . " SET topic_url = '" . $this->db->sql_escape($topic_data['topic_url']) . "'\n\t\t\t\t\t\t\t\tWHERE topic_id = {$topic_id}";
                         $this->db->sql_query($sql);
                     }
                 }
             } else {
                 $topic_data['topic_url'] = '';
             }
             $this->core->prepare_topic_url($topic_data, $this->forum_id);
             if (!$this->request->is_set('start')) {
                 if (!empty($post_id)) {
                     $this->start = floor($topic_data['prev_posts'] / $this->config['posts_per_page']) * $this->config['posts_per_page'];
                 }
             }
             $start = $this->core->seo_chk_start($this->start, $this->config['posts_per_page']);
             if ($this->start != $start) {
                 $this->start = (int) $start;
                 if (empty($post_id)) {
                     $this->request->overwrite('start', $this->start);
                 }
             }
             $this->core->seo_path['canonical'] = $this->core->drop_sid(append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", "f={$this->forum_id}&amp;t={$topic_id}&amp;start={$this->start}"));
             if ($this->core->seo_opt['zero_dupe']['on']) {
                 $highlight_match = $highlight = '';
                 if ($this->hilit_words) {
                     $highlight_match = phpbb_clean_search_string($this->hilit_words);
                     $highlight = urlencode($highlight_match);
                     $highlight_match = str_replace('\\*', '\\w+?', preg_quote($highlight_match, '#'));
                     $highlight_match = preg_replace('#(?<=^|\\s)\\\\w\\*\\?(?=\\s|$)#', '\\w+?', $highlight_match);
                     $highlight_match = str_replace(' ', '|', $highlight_match);
                 }
                 if ($post_id && !$view && !$this->core->set_do_redir_post()) {
                     $this->core->seo_opt['zero_dupe']['redir_def'] = array('p' => array('val' => $post_id, 'keep' => true, 'force' => true, 'hash' => "p{$post_id}"), 'hilit' => array('val' => $highlight_match ? $highlight : '', 'keep' => !empty($highlight_match)));
                 } else {
                     $default_sort_days = !empty($user_data['user_topic_show_days']) ? $user_data['user_topic_show_days'] : 0;
                     $default_sort_key = !empty($user_data['user_topic_sortby_type']) ? $user_data['user_topic_sortby_type'] : 't';
                     $default_sort_dir = !empty($user_data['user_topic_sortby_dir']) ? $user_data['user_topic_sortby_dir'] : 'd';
                     $sort_days = $this->request->variable('st', $default_sort_days);
                     $sort_key = $this->request->variable('sk', $default_sort_key);
                     $sort_dir = $this->request->variable('sd', $default_sort_dir);
                     $seo_watch = $this->request->variable('watch', '');
                     $seo_unwatch = $this->request->variable('unwatch', '');
                     $seo_bookmark = $this->request->variable('bookmark', 0);
                     $keep_watch = (bool) ($seo_watch == 'topic' && $user_data['is_registered']);
                     $keep_unwatch = (bool) ($seo_unwatch == 'topic' && $user_data['is_registered']);
                     $keep_hash = (bool) ($keep_watch || $keep_unwatch || $seo_bookmark);
                     $seo_uid = max(0, $this->request->variable('uid', 0));
                     $this->core->seo_opt['zero_dupe']['redir_def'] = array('uid' => array('val' => $seo_uid, 'keep' => (bool) ($keep_hash && $seo_uid)), 'f' => array('val' => $forum_id, 'keep' => true, 'force' => true), 't' => array('val' => $topic_id, 'keep' => true, 'force' => true, 'hash' => $post_id ? "p{$post_id}" : ''), 'p' => array('val' => $post_id, 'keep' => $post_id && $view == 'show' ? true : false, 'hash' => "p{$post_id}"), 'watch' => array('val' => $seo_watch, 'keep' => $keep_watch), 'unwatch' => array('val' => $seo_unwatch, 'keep' => $keep_unwatch), 'bookmark' => array('val' => $seo_bookmark, 'keep' => (bool) ($user_data['is_registered'] && $this->config['allow_bookmarks'] && $seo_bookmark)), 'start' => array('val' => $this->start, 'keep' => true, 'force' => true), 'hash' => array('val' => $this->request->variable('hash', ''), 'keep' => $keep_hash), 'st' => array('val' => $sort_days, 'keep' => true), 'sk' => array('val' => $sort_key, 'keep' => true), 'sd' => array('val' => $sort_dir, 'keep' => true), 'view' => array('val' => $view, 'keep' => $view == 'print' ? (bool) $this->auth->acl_get('f_print', $forum_id) : ($view == 'viewpoll' || $view == 'show' ? true : false)), 'hilit' => array('val' => $highlight_match ? $highlight : '', 'keep' => (bool) (!(!$user_data['is_registered'] && $this->core->seo_opt['rem_hilit']))));
                     if ($this->core->seo_opt['zero_dupe']['redir_def']['bookmark']['keep']) {
                         // Prevent unessecary redirections
                         // Note : bookmark, watch and unwatch cases could just not be handled by the zero dupe (no redirect at all when used),
                         // but the handling as well acts as a security shield so, it's worth it ;)
                         unset($this->core->seo_opt['zero_dupe']['redir_def']['start']);
                     }
                 }
                 $this->core->zero_dupe();
             }
             break;
         case 'memberlist':
             if ($this->request->is_set('un')) {
                 $un = rawurldecode($this->request->variable('un', '', true));
                 if (!$this->core->is_utf8($un)) {
                     $un = utf8_normalize_nfc(utf8_recode($un, 'ISO-8859-1'));
                 }
                 $this->request->overwrite('un', $un);
             }
             break;
     }
 }
开发者ID:kinecto,项目名称:usu,代码行数:101,代码来源:listener.php


注:本文中的phpbb_clean_search_string函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。