diff --git a/e107_core/templates/search_template.php b/e107_core/templates/search_template.php
index 544e68ca6..f8e467208 100644
--- a/e107_core/templates/search_template.php
+++ b/e107_core/templates/search_template.php
@@ -57,7 +57,7 @@ if(!isset($SEARCH_CATS))
{SEARCH_MAIN_CHECKALL} {SEARCH_MAIN_UNCHECKALL}
";
@@ -181,9 +181,11 @@ $SEARCH_TEMPLATE['form']['category'] = '
';
+
+
+ {SEARCH_ADVANCED}';
$SEARCH_TEMPLATE['form']['end'] = "
diff --git a/e107_handlers/search_class.php b/e107_handlers/search_class.php
index 6c135f906..970ae9022 100644
--- a/e107_handlers/search_class.php
+++ b/e107_handlers/search_class.php
@@ -26,7 +26,8 @@ class e_search
var $keywords;
var $stopwords_php = "|a|about|an|and|are|as|at|be|by|com|edu|for|from|how|i|in|is|it|of|on|or|that|the|this|to|was|what|when|where|who|will|with|the|www|";
var $stopwords_mysql = "|a|a's|able|about|above|according|accordingly|across|actually|after|afterwards|again|against|ain't|all|allow|allows|almost|alone|along|already|also|although|always|am|among|amongst|an|and|another|any|anybody|anyhow|anyone|anything|anyway|anyways|anywhere|apart|appear|appreciate|appropriate|are|aren't|around|as|aside|ask|asking|associated|at|available|away|awfully|be|became|because|become|becomes|becoming|been|before|beforehand|behind|being|believe|below|beside|besides|best|better|between|beyond|both|brief|but|by|c'mon|c's|came|can|can't|cannot|cant|cause|causes|certain|certainly|changes|clearly|co|com|come|comes|concerning|consequently|consider|considering|contain|containing|contains|corresponding|could|couldn't|course|currently|definitely|described|despite|did|didn't|different|do|does|doesn't|doing|don't|done|down|downwards|during|each|edu|eg|eight|either|else|elsewhere|enough|entirely|especially|et|etc|even|ever|every|everybody|everyone|everything|everywhere|ex|exactly|example|except|far|few|fifth|first|five|followed|following|follows|for|former|formerly|forth|four|from|further|furthermore|get|gets|getting|given|gives|go|goes|going|gone|got|gotten|greetings|had|hadn't|happens|hardly|has|hasn't|have|haven't|having|he|he's|hello|help|hence|her|here|here's|hereafter|hereby|herein|hereupon|hers|herself|hi|him|himself|his|hither|hopefully|how|howbeit|however|i|i'd|i'll|i'm|i've|ie|if|ignored|immediate|in|inasmuch|inc|indeed|indicate|indicated|indicates|inner|insofar|instead|into|inward|is|isn't|it|it'd|it'll|it's|its|itself|just|keep|keeps|kept|know|knows|known|last|lately|later|latter|latterly|least|less|lest|let|let's|like|liked|likely|little|look|looking|looks|ltd|mainly|many|may|maybe|me|mean|meanwhile|merely|might|more|moreover|most|mostly|much|must|my|myself|name|namely|nd|near|nearly|necessary|need|needs|neither|never|nevertheless|new|next|nine|no|nobody|non|none|noone|nor|normally|not|nothing|novel|now|nowhere|obviously|of|off|often|oh|ok|okay|old|on|once|one|ones|only|onto|or|other|others|otherwise|ought|our|ours|ourselves|out|outside|over|overall|own|particular|particularly|per|perhaps|php|placed|please|plus|possible|presumably|probably|provides|que|quite|qv|rather|rd|re|really|reasonably|regarding|regardless|regards|relatively|respectively|right|said|same|saw|say|saying|says|second|secondly|see|seeing|seem|seemed|seeming|seems|seen|self|selves|sensible|sent|serious|seriously|seven|several|shall|she|should|shouldn't|since|six|so|some|somebody|somehow|someone|something|sometime|sometimes|somewhat|somewhere|soon|sorry|specified|specify|specifying|still|sub|such|sup|sure|t's|take|taken|tell|tends|th|than|thank|thanks|thanx|that|that's|thats|the|their|theirs|them|themselves|then|thence|there|there's|thereafter|thereby|therefore|therein|theres|thereupon|these|they|they'd|they'll|they're|they've|think|third|this|thorough|thoroughly|those|though|three|through|throughout|thru|thus|to|together|too|took|toward|towards|tried|tries|truly|try|trying|twice|two|un|under|unfortunately|unless|unlikely|until|unto|up|upon|us|use|used|useful|uses|using|usually|value|various|very|via|viz|vs|want|wants|was|wasn't|way|we|we'd|we'll|we're|we've|welcome|well|went|were|weren't|what|what's|whatever|when|whence|whenever|where|where's|whereafter|whereas|whereby|wherein|whereupon|wherever|whether|which|while|whither|who|who's|whoever|whole|whom|whose|why|will|willing|wish|with|within|without|won't|wonder|would|would|wouldn't|yes|yet|you|you'd|you'll|you're|you've|your|yours|yourself|yourselves|zero|";
-
+ var $params;
+
function __construct($query = '')
{
$tp = e107::getParser();
@@ -46,6 +47,8 @@ class e_search
$this->bullet = '
';
}
+ $this->bullet = ''; // Use CSS instead.
+
preg_match_all('/(\W?".*?")|(.*?)(\s|$)/', $this->query, $boolean_keys);
sort($this -> keywords['split'] = array_unique(array_filter(str_replace('"', '', array_merge($boolean_keys[1], $boolean_keys[2])))));
@@ -79,13 +82,18 @@ class e_search
}
+ function setParams($get = array())
+ {
+ $this->params = $get;
+ }
+
+ function getParams()
+ {
+ return $this->params;
+ }
-
-
-
-
- function parsesearch($table, $return_fields, $search_fields, $weights, $handler, $no_results, $where, $order)
+ public function parsesearch($table, $return_fields, $search_fields, $weights, $handler, $no_results, $where, $order)
{
global $query, $search_prefs, $pre_title, $search_chars, $search_res, $result_flag;
@@ -240,6 +248,12 @@ class e_search
}
+ if(E107_DBG_SQLQUERIES)
+ {
+ echo e107::getMessage()->addDebug($sql_query)->render();
+ }
+
+
if ($ps['results'] = $sql->gen($sql_query))
{
if (!$search_prefs['mysql_sort'])
@@ -311,7 +325,7 @@ class e_search
{
$matches = array($res['title'], $res['summary']);
$endcrop = FALSE;
- $output = '';
+ $output = ''; // ';
$title = TRUE;
if(!empty($matches))
@@ -371,7 +385,7 @@ class e_search
$pre_title_output = $pre_title;
}
- $this -> text = $this -> bullet." ".$pre_title_output.$this -> text."
".$res['pre_summary'];
+ $this -> text = $this -> bullet."{DETAILS}".$res['pre_summary'];
}
elseif (!$endcrop)
{
@@ -383,7 +397,8 @@ class e_search
}
}
$display_rel = $search_prefs['relevance'] ? " | ".LAN_SEARCH_69.": ".round($row['relevance'], 1) : "";
- $output_array['text'][] = $output.$res['post_summary']."
".$res['detail'].$display_rel."
";
+ $output_array['text'][] = "
".str_replace('{DETAILS}',"".$res['detail'].$display_rel."", $output).$tp->toText($res['post_summary'])."\n\n";
+ // $ps['data'][] = $res;
}
else
{
diff --git a/e107_plugins/forum/e_search.php b/e107_plugins/forum/e_search.php
index b4d6ed6b5..b3acadd1d 100644
--- a/e107_plugins/forum/e_search.php
+++ b/e107_plugins/forum/e_search.php
@@ -40,7 +40,7 @@ class forum_search extends e_search // include plugin-folder in the name.
'forum' => array('type' => 'dropdown', 'text' => FOR_SCH_LAN_2, 'list'=>$catList),
'date' => array('type' => 'date', 'text' => LAN_DATE_POSTED),
'author'=> array('type' => 'author', 'text' => LAN_SEARCH_61),
- 'match'=> array('type' => 'dropdown', 'text' => LAN_SEARCH_61, 'list'=>$matchList)
+ 'match'=> array('type' => 'dropdown', 'text' => LAN_SEARCH_52, 'list'=>$matchList) // not functional yet.
),
'return_fields' => array('t.thread_id', 't.thread_name', 'p.post_id', 'p.post_entry', 't.thread_forum_id', 't.thread_datestamp', 't.thread_user', 'u.user_id', 'u.user_name', 'f.forum_class', 'f.forum_id', 'f.forum_name', 'f.forum_sef'),
@@ -50,6 +50,13 @@ class forum_search extends e_search // include plugin-folder in the name.
'refpage' => 'forum'
);
+ $params = $this->getParams(); // retrieve URL query values.
+
+ if(!empty($params['match']))
+ {
+ $search['search_fields'] = array('t.thread_name'=>'1.5');
+ }
+
return $search;
}
@@ -61,16 +68,7 @@ class forum_search extends e_search // include plugin-folder in the name.
{
$tp = e107::getParser();
-
-
$res = array();
-
- /* $res['link'] = e_PLUGIN."chatbox_menu/chat.php?".$row['cb_id'].".fs";
- $res['pre_title'] = LAN_SEARCH_7;
- $res['title'] = $user[2];
- $res['summary'] = $row['cb_message'];
- $res['detail'] = $tp->toDate($row['cb_datestamp'], "long");*/
-
$datestamp = $tp->toDate($row['thread_datestamp'], "long");
if ($row['thread_parent'])
@@ -84,17 +82,18 @@ class forum_search extends e_search // include plugin-folder in the name.
$link_id = $row['thread_id'];
- //".$row['user_name']."
$uparams = array('id' => $row['user_id'], 'name' => $row['user_name']);
$link = e107::getUrl()->create('user/profile/view', $uparams);
$userlink = "".$row['user_name']."";
$row['thread_sef'] = eHelper::title2sef($row['thread_name'],'dashl');
+ $forumTitle = "".$row['forum_name']."";
+
$res['link'] = e107::url('forum','topic', $row, array('query'=>array('f'=>'post','id'=>$row['post_id']))); // e_PLUGIN."forum/forum_viewtopic.php?".$link_id.".post";
- $res['pre_title'] = $title ? FOR_SCH_LAN_5.": " : "";
- $res['title'] = $title ? $title : LAN_SEARCH_9;
- $res['pre_summary'] = "";
+ $res['pre_title'] = ''; // $title ? FOR_SCH_LAN_5.": " : "";
+ $res['title'] = $title ? $forumTitle . " | ". $title : LAN_SEARCH_9;
+ $res['pre_summary'] = "";
$res['summary'] = $row['post_entry'];
$res['detail'] = LAN_SEARCH_7.$userlink.LAN_SEARCH_8.$datestamp;
diff --git a/e107_plugins/forum/forum.php b/e107_plugins/forum/forum.php
index 829802ede..bbf3f9294 100644
--- a/e107_plugins/forum/forum.php
+++ b/e107_plugins/forum/forum.php
@@ -189,7 +189,8 @@ $fVars->SEARCH = "
".$srchIcon."
-
+
+
\n";
diff --git a/e107_web/css/backcompat.css b/e107_web/css/backcompat.css
index 79910ca0a..bf334ff56 100644
--- a/e107_web/css/backcompat.css
+++ b/e107_web/css/backcompat.css
@@ -16,4 +16,6 @@
a.btn { }
.s-message .s-message-title
{ margin-top: 0; background: transparent none no-repeat scroll 0 50%; font-size:150% }
-mark {text-decoration: underline; color:#FF0000; font-weight:bold; } /* .searchhighlight */
\ No newline at end of file
+
+mark { text-decoration: underline; color:#FF0000; font-weight:bold; } /* .searchhighlight */
+.list-unstyled { list-style: outside none none; }
\ No newline at end of file
diff --git a/e107_web/css/e107.css b/e107_web/css/e107.css
index 4af0f1784..97a50c32c 100644
--- a/e107_web/css/e107.css
+++ b/e107_web/css/e107.css
@@ -256,3 +256,6 @@ border-radius: 4px;
box-shadow: 0px 1px 0px rgba(255, 255, 255, 0.2) inset, 0px 1px 2px rgba(0, 0, 0, 0.05);
}
+
+#search-results li { margin-top:5px; padding: 10px 0; }
+#search-results li h4 { margin-bottom:0 !important }
\ No newline at end of file
diff --git a/search.php b/search.php
index 66ce59eae..8862e13ef 100644
--- a/search.php
+++ b/search.php
@@ -65,7 +65,7 @@ class search extends e_shortcode
{
$this->search_prefs = e107::getConfig('search')->getPref();
$this->search_info = $this->searchConfig();
-
+
if(deftrue('BOOTSTRAP'))
{
@@ -110,7 +110,7 @@ class search extends e_shortcode
$this->template = $tmp;
}
-
+
@@ -205,8 +205,8 @@ class search extends e_shortcode
- return " ".LAN_SEARCH_29."
- ".LAN_SEARCH_30;
+ // return " ".LAN_SEARCH_29."
+ // ".LAN_SEARCH_30;
}
function sc_search_dropdown($parm = '')
@@ -327,8 +327,18 @@ class search extends e_shortcode
{
return ($this->enhanced !== true) ? "style='display: none'" : "" ;
}
+
+ function sc_search_advanced($parm='')
+ {
+ $hiddenBlock = (!empty($_GET['t'])) ? "" : "class='e-hideme'";
+ $text = "";
+ $text .= $this->sc_search_advanced_block(vartrue($_GET['t']));
+ $text .= "
";
+ return $text;
+
+ }
- function sc_search_advanced_block($parm='')
+ private function sc_search_advanced_block($parm='')
{
$tp = e107::getParser();
$sql = e107::getDb();
@@ -337,13 +347,13 @@ class search extends e_shortcode
if(!$parm)
{
- // return;
+ return '';
}
-
+
if (isset($this->search_info[$parm]['advanced']))
{
-
+
if(is_array($this->search_info[$parm]['advanced']))
{
$advanced = ($this->search_info[$parm]['advanced']);
@@ -466,11 +476,14 @@ class search extends e_shortcode
if($obj = e107::getAddon($id,'e_search'))
{
+ $obj->setParams($_GET);
+
if(!$ret = $obj->config())
{
return false;
}
-
+
+
$ret['qtype'] = $ret['name'];
if(!isset($ret['id']))
@@ -758,10 +771,11 @@ class search extends e_shortcode
}
+ // print_a($ps);
- $text .= '';
+ $text .= '
';
$text .= $ps['text'];
- $text .= '
';
+ $text .= '';
$results = $ps['results'];
}
@@ -831,6 +845,8 @@ class search extends e_shortcode
function searchQuery()
{
global $perform_search;
+ $tp = e107::getParser();
+ $sql = e107::getDb();
if (isset($_GET['q']) || isset($_GET['in']) || isset($_GET['ex']) || isset($_GET['ep']) || isset($_GET['beg']))
{
@@ -893,7 +909,7 @@ class search extends e_shortcode
elseif ($this->search_prefs['time_restrict'])
{
$time = time() - $this->search_prefs['time_secs'];
- $query_check = $tp -> toDB($full_query);
+ $query_check = $tp->toDB($full_query);
$ip = e107::getIPHandler()->getIP(FALSE);
if ($sql->select("tmp", "tmp_ip, tmp_time, tmp_info", "tmp_info LIKE 'type_search%' AND tmp_ip='".$ip."'"))
@@ -902,7 +918,7 @@ class search extends e_shortcode
if (($row['tmp_time'] > $time) && ($row['tmp_info'] != 'type_search '.$query_check))
{
$perform_search = false;
- $this->message = LAN_SEARCH_17.$search_prefs['time_secs'].LAN_SEARCH_18;
+ $this->message = LAN_SEARCH_17.$this->search_prefs['time_secs'].LAN_SEARCH_18;
}
else
{
@@ -1230,15 +1246,9 @@ if(deftrue('BOOTSTRAP'))
$SEARCH_ADV_COMBO = $tmp['advanced-combo'];
$srchObj->template = $tmp;
-
-
-
unset($tmp);
}
-
-
-
-if (!isset($SEARCH_TOP_TABLE))
+else
{
if (file_exists(THEME."search_template.php"))
{
@@ -1248,109 +1258,27 @@ if (!isset($SEARCH_TOP_TABLE))
{
require(e_CORE."templates/search_template.php");
}
-
+
$SEARCH_TOP_TABLE .= "{SEARCH_ENHANCED}";
}
-
-
-
-
-//$SEARCH_TOP_TABLE = $tp->parseTemplate($SEARCH_TOP_TABLE,true,$srchObj);
-//$SEARCH_TYPE = $tp->parseTemplate($SEARCH_TYPE,true, $srchObj);
-
-
-
-/*
-
-// standard search config
-if ($search_prefs['selector'] == 2)
-{
- $SEARCH_VARS->SEARCH_DROPDOWN = "";
-}
-// end of standard search config
-
-*/
-
-//$text = preg_replace("/\{(.*?)\}/e", '$\1', $SEARCH_TOP_TABLE);
$tp = e107::getParser();
-
-
-// $text = $tp->simpleParse($SEARCH_TOP_TABLE, $SEARCH_VARS);
-
$text = $tp->parseTemplate($SEARCH_TOP_TABLE,true,$srchObj);
-/*
-foreach ($enhanced_types as $en_id => $ENHANCED_TEXT)
-{
- $SEARCH_VARS->ENHANCED_TEXT = $ENHANCED_TEXT;
- $SEARCH_VARS->ENHANCED_DISPLAY_ID = "en_".$en_id;
- $SEARCH_VARS->ENHANCED_FIELD = "";
- //$text .= preg_replace("/\{(.*?)\}/e", '$\1', $SEARCH_ENHANCED);
- $text .= $tp->simpleParse($SEARCH_ENHANCED, $SEARCH_VARS);
-}
-$SEARCH_VARS->ENHANCED_TEXT = $SEARCH_VARS->ENHANCED_DISPLAY_ID = $SEARCH_VARS->ENHANCED_FIELD = null;
-*/
-
-
if ($search_prefs['user_select'])
{
- //$text .= preg_replace("/\{(.*?)\}/e", '$\1', $SEARCH_CATS);
-// $text .= $tp->simpleParse($SEARCH_CATS, $SEARCH_VARS);
$text .= $tp->parseTemplate($SEARCH_CATS,true, $srchObj);
}
-//$text .= preg_replace("/\{(.*?)\}/e", '$\1', $SEARCH_TYPE);
-// $text .= $tp->simpleParse($SEARCH_TYPE, $SEARCH_VARS);
-$text .= $tp->parseTemplate($SEARCH_TYPE,true, $srchObj);
-
-
- $text .= "";
- $text .= $tp->parseTemplate("{SEARCH_ADVANCED_BLOCK=".vartrue($_GET['t'])."}",true, $srchObj);
- $text .= "
";
-
+// $text .= $tp->parseTemplate($SEARCH_TYPE,true, $srchObj);
+/*
+$hiddenBlock = (!empty($_GET['t'])) ? "" : "class='e-hideme'";
+$text .= "";
+$text .= $tp->parseTemplate("{SEARCH_ADVANCED_BLOCK=".vartrue($_GET['t'])."}",true, $srchObj);
+$text .= "
";*/
+ //print_a($search_prefs);
//$
$text .= $SEARCH_MESSAGE ? preg_replace("/\{(.*?)\}/e", '$\1', $SEARCH_TABLE_MSG) : "";