diff --git a/search.php b/search.php
index 575c0e7c..fc84ebfe 100644
--- a/search.php
+++ b/search.php
@@ -1,104 +1,168 @@
- 0 ) {
- $TopicsArray = $DB->query('SELECT t.`ID`, `Topic`, `Tags`, t.`UserID`, t.`UserName`, t.`LastName`, `LastTime`, `Replies`
- , p.Content, p.ID as pID, p.PostTime
- FROM ' . PREFIX . 'topics t, '. PREFIX . 'posts p
- WHERE t.ID=p.TopicID and p.ID in (?) and t.IsDel=0
- ORDER BY p.PostTime DESC',
- $postIds);
- foreach( $TopicsArray as &$row ) {
- $excerpts = SearchClient::callProxy( 'buildExcerpts', array(
- array($row['Topic'], $row['Content']), 'PostsIndexes'
- , $Keyword, array(
- "before_match" => '',
- "after_match"=> "" ) ) );
- $row['MinContent'] = $excerpts[1];
- }
- }
- }
- }catch( Exception $e ) {
- $Error = $e->getMessage();
- }
-} else {
-//if($CurUserID && $Config['NumTopics'] <= FullTableScanTopicLimit){
- if($Config['NumTopics'] <= FullTableScanTopicLimit){
- $QueryString = str_repeat('or Topic LIKE ? or Tags LIKE ? ', $KeywordNum-1);
- $SQLKeywordArray = array();
- foreach ($KeywordArray as $Value) {
- $SQLKeywordArray[] = '%'.$Value.'%';
- $SQLKeywordArray[] = '%'.$Value.'%';
- }
- $TopicsArray = $DB->query('SELECT `ID`, `Topic`, `Tags`, `UserID`, `UserName`, `LastName`, `LastTime`, `Replies` FROM ' . PREFIX . 'topics
- WHERE Topic LIKE ? or Tags LIKE ? '.$QueryString.'
- ORDER BY LastTime DESC
- LIMIT ' . ($Page - 1) * $Config['TopicsPerPage'] . ',' . $Config['TopicsPerPage'],
- $SQLKeywordArray
- );
- }else{
- $QueryString = str_repeat('or Name LIKE ? ', $KeywordNum-1);
- $SQLKeywordArray = array();
- foreach ($KeywordArray as $Value) {
- $SQLKeywordArray[] = '%'.$Value.'%';
- }
- $TagIDList = $DB->column('SELECT ID FROM ' . PREFIX . 'tags
- WHERE Name like ? '.$QueryString,
- $SQLKeywordArray
- );
- if (!$TagIDList)
- AlertMsg('404 Not Found', '404 Not Found');
- $TagIDArray = $DB->column('SELECT TopicID FROM ' . PREFIX . 'posttags
- WHERE TagID in (?)
- ORDER BY TopicID DESC
- LIMIT ' . ($Page - 1) * $Config['TopicsPerPage'] . ',' . $Config['TopicsPerPage'],
- $TagIDList);
- $TopicsArray = array();
- if($TagIDArray){
- $TopicsArray = $DB->query('SELECT `ID`, `Topic`, `Tags`, `UserID`, `UserName`, `LastName`, `LastTime`, `Replies` FROM ' . PREFIX . 'topics
- force index(PRI)
- WHERE ID in (?) and IsDel=0
- ORDER BY LastTime DESC',
- $TagIDArray);
- }
- }
-}
-/*
-if($Page == 1 && !$TopicsArray){
- AlertMsg('404 Not Found', '404 Not Found', 404);
-}
-*/
-$DB->CloseConnection();
-$PageTitle = $Lang['Search'].' '.$Keyword.' ';
-$PageTitle .= $Page > 1 ? ' Page' . $Page : '';
-$ContentFile = $TemplatePath . 'search.php';
-include($TemplatePath . 'layout.php');
+ $KeywordToken) {
+ //匹配用户名限制条件
+ preg_match('/user:(.*)/i', $KeywordToken, $SearchUserTopics);
+ if (!empty($SearchUserTopics[1]) && IsName($SearchUserTopics[1])){
+ $AdvancedSearch = true;
+ break;
+ }
+}
+
+// 禁止普通用户使用无索引的全文搜索
+if (!$AdvancedSearch && $CurUserRole < 2) {
+ $PostsSearch = false;
+}
+foreach ($KeywordArray as $Key => $KeywordToken) {
+ //匹配用户名限制条件
+ preg_match('/user:(.*)/i', $KeywordToken, $SearchUserTopics);
+ if (!empty($SearchUserTopics[1]) && IsName($SearchUserTopics[1])){
+ if ($PostsSearch) {
+ $AdvancedQuery[] = 'p.UserName = :PostUser';
+ $SQLKeywordArray['PostUser'] = $SearchUserTopics[1];
+ } else {
+ $AdvancedQuery[] = 't.UserName = :TopicUser';
+ $SQLKeywordArray['TopicUser'] = $SearchUserTopics[1];
+ }
+ } else {
+ $ParamName = substr(md5($KeywordToken), 0, 8);
+ if ($PostsSearch) {
+ $NormalQuery[] = 'p.Subject LIKE :Subject' . $ParamName . ' or p.Content LIKE :Content' . $ParamName;
+ $SQLKeywordArray['Subject' . $ParamName] = '%' . $KeywordToken . '%';
+ $SQLKeywordArray['Content' . $ParamName] = '%' . $KeywordToken . '%';
+ } else {
+ $NormalQuery[] = 't.Topic LIKE :Topic' . $ParamName . ' or t.Tags LIKE :Tag' . $ParamName;
+ $SQLKeywordArray['Topic' . $ParamName] = '%' . $KeywordToken . '%';
+ $SQLKeywordArray['Tag' . $ParamName] = '%' . $KeywordToken . '%';
+ }
+ }
+}
+
+$SearchCondition = array();
+$Temp = implode(' AND ', $AdvancedQuery);
+if (!empty($Temp)) {
+ $SearchCondition[] = $Temp;
+}
+$Temp = implode(' OR ', $NormalQuery);
+if (!empty($Temp)) {
+ $SearchCondition[] = '(' . $Temp . ')';
+}
+unset($Temp);
+$SearchConditionQuery = implode(' AND ', $SearchCondition);
+
+//如果定义了搜索服务器,并且不是高级搜索,就走搜索服务
+if (defined('SearchServer') && SearchServer && !$AdvancedSearch) {
+ try {
+ $finds = SearchClient::searchLike($Keyword, 'PostsIndexes' //关键字及索引
+ , ($Page - 1) * $Config['TopicsPerPage'], $Config['TopicsPerPage']
+ , "" //过滤条件
+ , 'PostTime desc' //排序规则
+ );
+ if (!empty($finds)) {
+ $num = $finds[1];
+ $PostIdList = isset($finds[0]['id']) ? $finds[0]['id'] : null;
+ if (count($PostIdList) > 0) {
+ $TopicsArray = $DB->query('SELECT
+ t.`ID`,
+ t.`Topic`,
+ t.`Tags`,
+ t.`LastName`,
+ t.`Replies`,
+ p.`UserID`,
+ p.`UserName`,
+ p.`Content`,
+ p.`ID` AS PostID,
+ p.`PostTime` AS LastTime
+ FROM ' . PREFIX . 'topics t, ' . PREFIX . 'posts p
+ WHERE t.ID=p.TopicID and p.ID in (?) and t.IsDel=0
+ ORDER BY p.PostTime DESC', $PostIdList);
+ foreach ($TopicsArray as &$row) {
+ $excerpts = SearchClient::callProxy('buildExcerpts', array(
+ array(
+ $row['Topic'],
+ $row['Content']
+ ),
+ 'PostsIndexes',
+ $Keyword,
+ array(
+ "before_match" => '',
+ "after_match" => ""
+ )
+ ));
+ $row['MinContent'] = $excerpts[1];
+ }
+ }
+ }
+ }
+ catch (Exception $e) {
+ $Error = $e->getMessage();
+ }
+} else {
+ if ($PostsSearch) {
+ $SearchFields = 'SELECT
+ t.`ID`,
+ t.`Topic`,
+ t.`Tags`,
+ t.`LastName`,
+ t.`Replies`,
+ p.`UserID`,
+ p.`UserName`,
+ p.`Content`,
+ p.`ID` AS PostID,
+ p.`PostTime` AS LastTime
+ FROM ' . PREFIX . 'posts p
+ LEFT JOIN ' . PREFIX . 'topics t
+ ON t.ID=p.TopicID';
+ } else {
+ $SearchFields = 'SELECT t.`ID`, t.`Topic`, t.`Tags`, t.`UserID`, t.`UserName`, t.`LastName`, t.`LastTime`, t.`Replies`
+ FROM ' . PREFIX . 'topics t ';
+ }
+ $TopicsArray = $DB->query($SearchFields . '
+ WHERE ' . $SearchConditionQuery . '
+ ORDER BY LastTime DESC
+ LIMIT ' . ($Page - 1) * $Config['TopicsPerPage'] . ', ' . $Config['TopicsPerPage'], $SQLKeywordArray);
+ if ($PostsSearch) {
+ foreach ($TopicsArray as &$Topic) {
+ $Topic['MinContent'] = strip_tags(mb_substr($Topic['Content'], 0, 300, 'utf-8'),'
');
+ }
+ }
+}
+/*
+if($Page == 1 && !$TopicsArray){
+AlertMsg('404 Not Found', '404 Not Found', 404);
+}
+*/
+$DB->CloseConnection();
+$PageTitle = $Lang['Search'] . ' ' . $Keyword . ' ';
+$PageTitle .= $Page > 1 ? ' Page' . $Page : '';
+$ContentFile = $TemplatePath . 'search.php';
+include($TemplatePath . 'layout.php');
diff --git a/static/editor/dialogs/video/video.js b/static/editor/dialogs/video/video.js
index 5069b5d3..7e8a23b6 100644
--- a/static/editor/dialogs/video/video.js
+++ b/static/editor/dialogs/video/video.js
@@ -74,16 +74,13 @@
dialog.onok = function(){
$G("preview").innerHTML = "";
var currentTab = findFocus("tabHeads","tabSrc");
- switch(currentTab){
+ switch(currentTab) {
case "video":
return insertSingle();
- break;
case "videoSearch":
return insertSearch("searchList");
- break;
case "upload":
return insertUpload();
- break;
}
};
dialog.oncancel = function(){
@@ -139,8 +136,8 @@
if(img.getAttribute("selected")){
videoObjs.push({
url:img.getAttribute("ue_video_url"),
- width:420,
- height:280,
+ width:650,
+ height:380,
align:"none"
});
}
@@ -273,8 +270,8 @@
$G("preview").innerHTML = '
'+lang.urlError+'
'+
'';
}
@@ -284,8 +281,8 @@
function insertUpload(){
var videoObjs=[],
uploadDir = editor.getOpt('videoUrlPrefix'),
- width = $G('upload_width').value || 420,
- height = $G('upload_height').value || 280,
+ width = $G('upload_width').value || 650,
+ height = $G('upload_height').value || 380,
align = findFocus("upload_alignment","name") || 'none';
for(var key in uploadVideoList) {
var file = uploadVideoList[key];
diff --git a/styles/default/template/layout.php b/styles/default/template/layout.php
index af43817d..de1ee5f9 100644
--- a/styles/default/template/layout.php
+++ b/styles/default/template/layout.php
@@ -1,5 +1,8 @@
-
+
@@ -63,9 +63,9 @@
-
-
-
+
+
+
+
';
- echo $CurUserID && $CurUserInfo['NewMessage']?str_replace('{{NewMessage}}', $CurUserInfo['NewMessage'], $Lang['New_Message']):'';
- echo $PageTitle;
- echo $UrlPath=='index'?'':' - '.$Config['SiteName'];
- echo '';
+?>
+
+
+
+
+
+
@@ -150,13 +155,6 @@
Powered By © 2006-2016 Carbon Forum V
-
-
-
' . $Value . '';
+ $KeywordHighlightArray[] = '' . $Value . '';
}
return str_ireplace($KeywordArray, $KeywordHighlightArray, $Content);
} else {
@@ -38,11 +38,23 @@ function KeywordHighlight($Content)
-
+
diff --git a/styles/default/template/sider.php b/styles/default/template/sider.php
index c39f399c..e57cec4f 100644
--- a/styles/default/template/sider.php
+++ b/styles/default/template/sider.php
@@ -47,13 +47,13 @@
-
+
-
-
+
+
diff --git a/styles/default/template/tags.php b/styles/default/template/tags.php
index 6c4d32c7..b3e64a2a 100644
--- a/styles/default/template/tags.php
+++ b/styles/default/template/tags.php
@@ -42,7 +42,7 @@
-
60 ? mb_substr($Tag['Description'], 0, 60, 'utf-8').'……' : $Tag['Description'] : '' ); ?>
+
60 ? mb_substr($Tag['Description'], 0, 60, 'utf-8').'……' : $DescStr : '' ); ?>
()
-
60 ? mb_substr($Tag['Description'], 0, 60, 'utf-8').'……' : $Tag['Description'] : '' ); ?>
+
60 ? mb_substr($Tag['Description'], 0, 60, 'utf-8').'……' : $DescStr : '' ); ?>