mirror of
https://github.com/e107inc/e107.git
synced 2025-08-04 21:57:51 +02:00
Search Fixes, Forum Search fixes.
This commit is contained in:
@@ -57,7 +57,7 @@ if(!isset($SEARCH_CATS))
|
|||||||
{SEARCH_MAIN_CHECKALL} {SEARCH_MAIN_UNCHECKALL}
|
{SEARCH_MAIN_CHECKALL} {SEARCH_MAIN_UNCHECKALL}
|
||||||
</td>
|
</td>
|
||||||
<td style='width:70%' class='forumheader3'>
|
<td style='width:70%' class='forumheader3'>
|
||||||
{SEARCH_MAIN_CHECKBOXES}{SEARCH_DROPDOWN} {SEARCH_ADVANCED}
|
{SEARCH_MAIN_CHECKBOXES}{SEARCH_DROPDOWN} <table>{SEARCH_ADVANCED}</table>
|
||||||
<br />
|
<br />
|
||||||
</td>
|
</td>
|
||||||
</tr>";
|
</tr>";
|
||||||
@@ -181,9 +181,11 @@ $SEARCH_TEMPLATE['form']['category'] = '
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="inputPassword3" class="col-sm-3 control-label">'.LAN_SEARCH_19.'</label>
|
<label for="inputPassword3" class="col-sm-3 control-label">'.LAN_SEARCH_19.'</label>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
{SEARCH_MAIN_CHECKBOXES}{SEARCH_DROPDOWN} {SEARCH_ADVANCED}
|
{SEARCH_MAIN_CHECKBOXES}{SEARCH_DROPDOWN}
|
||||||
</div>
|
</div>
|
||||||
</div>';
|
|
||||||
|
</div>
|
||||||
|
{SEARCH_ADVANCED}';
|
||||||
|
|
||||||
$SEARCH_TEMPLATE['form']['end'] = "
|
$SEARCH_TEMPLATE['form']['end'] = "
|
||||||
</form>
|
</form>
|
||||||
|
@@ -26,6 +26,7 @@ class e_search
|
|||||||
var $keywords;
|
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_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 $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 = '')
|
function __construct($query = '')
|
||||||
{
|
{
|
||||||
@@ -46,6 +47,8 @@ class e_search
|
|||||||
$this->bullet = '<img src="'.THEME_ABS.'images/bullet2.gif" alt="bullet" class="icon" />';
|
$this->bullet = '<img src="'.THEME_ABS.'images/bullet2.gif" alt="bullet" class="icon" />';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->bullet = ''; // Use CSS instead.
|
||||||
|
|
||||||
preg_match_all('/(\W?".*?")|(.*?)(\s|$)/', $this->query, $boolean_keys);
|
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])))));
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function parsesearch($table, $return_fields, $search_fields, $weights, $handler, $no_results, $where, $order)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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;
|
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 ($ps['results'] = $sql->gen($sql_query))
|
||||||
{
|
{
|
||||||
if (!$search_prefs['mysql_sort'])
|
if (!$search_prefs['mysql_sort'])
|
||||||
@@ -311,7 +325,7 @@ class e_search
|
|||||||
{
|
{
|
||||||
$matches = array($res['title'], $res['summary']);
|
$matches = array($res['title'], $res['summary']);
|
||||||
$endcrop = FALSE;
|
$endcrop = FALSE;
|
||||||
$output = '<!-- Start Search Results -->';
|
$output = ''; // <!-- Start Search Block -->';
|
||||||
$title = TRUE;
|
$title = TRUE;
|
||||||
|
|
||||||
if(!empty($matches))
|
if(!empty($matches))
|
||||||
@@ -371,7 +385,7 @@ class e_search
|
|||||||
$pre_title_output = $pre_title;
|
$pre_title_output = $pre_title;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this -> text = $this -> bullet." <b><a class='visit' href='".$res['link']."'>".$pre_title_output.$this -> text."</a></b><br />".$res['pre_summary'];
|
$this -> text = $this -> bullet."<h4><a class='title visit' href='".$res['link']."'>".$pre_title_output.$this -> text."</a></h4>{DETAILS}<div>".$res['pre_summary'];
|
||||||
}
|
}
|
||||||
elseif (!$endcrop)
|
elseif (!$endcrop)
|
||||||
{
|
{
|
||||||
@@ -383,7 +397,8 @@ class e_search
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$display_rel = $search_prefs['relevance'] ? " | ".LAN_SEARCH_69.": ".round($row['relevance'], 1) : "";
|
$display_rel = $search_prefs['relevance'] ? " | ".LAN_SEARCH_69.": ".round($row['relevance'], 1) : "";
|
||||||
$output_array['text'][] = $output.$res['post_summary']."<br /><small>".$res['detail'].$display_rel."</small><br /><br />";
|
$output_array['text'][] = "<li>".str_replace('{DETAILS}',"<span class='text-muted'>".$res['detail'].$display_rel."</span>", $output).$tp->toText($res['post_summary'])."</div></li>\n\n";
|
||||||
|
// $ps['data'][] = $res;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -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),
|
'forum' => array('type' => 'dropdown', 'text' => FOR_SCH_LAN_2, 'list'=>$catList),
|
||||||
'date' => array('type' => 'date', 'text' => LAN_DATE_POSTED),
|
'date' => array('type' => 'date', 'text' => LAN_DATE_POSTED),
|
||||||
'author'=> array('type' => 'author', 'text' => LAN_SEARCH_61),
|
'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'),
|
'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'
|
'refpage' => 'forum'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$params = $this->getParams(); // retrieve URL query values.
|
||||||
|
|
||||||
|
if(!empty($params['match']))
|
||||||
|
{
|
||||||
|
$search['search_fields'] = array('t.thread_name'=>'1.5');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return $search;
|
return $search;
|
||||||
}
|
}
|
||||||
@@ -61,16 +68,7 @@ class forum_search extends e_search // include plugin-folder in the name.
|
|||||||
{
|
{
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$res = array();
|
$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");
|
$datestamp = $tp->toDate($row['thread_datestamp'], "long");
|
||||||
|
|
||||||
if ($row['thread_parent'])
|
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'];
|
$link_id = $row['thread_id'];
|
||||||
|
|
||||||
//<a href='user.php?id.".$row['user_id']."'>".$row['user_name']."</a>
|
|
||||||
$uparams = array('id' => $row['user_id'], 'name' => $row['user_name']);
|
$uparams = array('id' => $row['user_id'], 'name' => $row['user_name']);
|
||||||
$link = e107::getUrl()->create('user/profile/view', $uparams);
|
$link = e107::getUrl()->create('user/profile/view', $uparams);
|
||||||
$userlink = "<a href='".$link."'>".$row['user_name']."</a>";
|
$userlink = "<a href='".$link."'>".$row['user_name']."</a>";
|
||||||
|
|
||||||
$row['thread_sef'] = eHelper::title2sef($row['thread_name'],'dashl');
|
$row['thread_sef'] = eHelper::title2sef($row['thread_name'],'dashl');
|
||||||
|
|
||||||
|
$forumTitle = "<a href='".e107::url('forum','forum',$row)."'>".$row['forum_name']."</a>";
|
||||||
|
|
||||||
$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['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['pre_title'] = ''; // $title ? FOR_SCH_LAN_5.": " : "";
|
||||||
$res['title'] = $title ? $title : LAN_SEARCH_9;
|
$res['title'] = $title ? $forumTitle . " | ". $title : LAN_SEARCH_9;
|
||||||
$res['pre_summary'] = "<div class='smalltext'><a href='".e107::url('forum','forum',$row)."'>".$row['forum_name']."</a></div>";
|
$res['pre_summary'] = "";
|
||||||
$res['summary'] = $row['post_entry'];
|
$res['summary'] = $row['post_entry'];
|
||||||
$res['detail'] = LAN_SEARCH_7.$userlink.LAN_SEARCH_8.$datestamp;
|
$res['detail'] = LAN_SEARCH_7.$userlink.LAN_SEARCH_8.$datestamp;
|
||||||
|
|
||||||
|
@@ -189,7 +189,8 @@ $fVars->SEARCH = "
|
|||||||
<button class='btn btn-default button' type='submit' name='s' value='search' />".$srchIcon."</button>
|
<button class='btn btn-default button' type='submit' name='s' value='search' />".$srchIcon."</button>
|
||||||
</span>
|
</span>
|
||||||
<input type='hidden' name='r' value='0' />
|
<input type='hidden' name='r' value='0' />
|
||||||
<input type='hidden' name='ref' value='forum' />
|
<input type='hidden' name='t' value='forum' />
|
||||||
|
<input type='hidden' name='forum' value='all' />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</form>\n";
|
</form>\n";
|
||||||
|
@@ -16,4 +16,6 @@
|
|||||||
a.btn { }
|
a.btn { }
|
||||||
.s-message .s-message-title
|
.s-message .s-message-title
|
||||||
{ margin-top: 0; background: transparent none no-repeat scroll 0 50%; font-size:150% }
|
{ margin-top: 0; background: transparent none no-repeat scroll 0 50%; font-size:150% }
|
||||||
mark {text-decoration: underline; color:#FF0000; font-weight:bold; } /* .searchhighlight */
|
|
||||||
|
mark { text-decoration: underline; color:#FF0000; font-weight:bold; } /* .searchhighlight */
|
||||||
|
.list-unstyled { list-style: outside none none; }
|
@@ -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);
|
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 }
|
136
search.php
136
search.php
@@ -205,8 +205,8 @@ class search extends e_shortcode
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
return "<input type='radio' name='adv' value='0' ".(vartrue($_GET['adv']) ? "" : "checked='checked'")." /> ".LAN_SEARCH_29."
|
// return "<input type='radio' name='adv' value='0' ".(vartrue($_GET['adv']) ? "" : "checked='checked'")." /> ".LAN_SEARCH_29."
|
||||||
<input type='radio' name='adv' value='1' ".(vartrue($_GET['adv']) ? "checked='checked'" : "" )." /> ".LAN_SEARCH_30;
|
// <input type='radio' name='adv' value='1' ".(vartrue($_GET['adv']) ? "checked='checked'" : "" )." /> ".LAN_SEARCH_30;
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_search_dropdown($parm = '')
|
function sc_search_dropdown($parm = '')
|
||||||
@@ -328,7 +328,17 @@ class search extends e_shortcode
|
|||||||
return ($this->enhanced !== true) ? "style='display: none'" : "" ;
|
return ($this->enhanced !== true) ? "style='display: none'" : "" ;
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_search_advanced_block($parm='')
|
function sc_search_advanced($parm='')
|
||||||
|
{
|
||||||
|
$hiddenBlock = (!empty($_GET['t'])) ? "" : "class='e-hideme'";
|
||||||
|
$text = "<div {$hiddenBlock} id='search-advanced' >";
|
||||||
|
$text .= $this->sc_search_advanced_block(vartrue($_GET['t']));
|
||||||
|
$text .= "</div>";
|
||||||
|
return $text;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private function sc_search_advanced_block($parm='')
|
||||||
{
|
{
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
$sql = e107::getDb();
|
$sql = e107::getDb();
|
||||||
@@ -337,7 +347,7 @@ class search extends e_shortcode
|
|||||||
|
|
||||||
if(!$parm)
|
if(!$parm)
|
||||||
{
|
{
|
||||||
// return;
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -466,11 +476,14 @@ class search extends e_shortcode
|
|||||||
|
|
||||||
if($obj = e107::getAddon($id,'e_search'))
|
if($obj = e107::getAddon($id,'e_search'))
|
||||||
{
|
{
|
||||||
|
$obj->setParams($_GET);
|
||||||
|
|
||||||
if(!$ret = $obj->config())
|
if(!$ret = $obj->config())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$ret['qtype'] = $ret['name'];
|
$ret['qtype'] = $ret['name'];
|
||||||
|
|
||||||
if(!isset($ret['id']))
|
if(!isset($ret['id']))
|
||||||
@@ -758,10 +771,11 @@ class search extends e_shortcode
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// print_a($ps);
|
||||||
|
|
||||||
$text .= '<div class="search-block">';
|
$text .= '<ul id="search-results" class="list-unstyled search-block">';
|
||||||
$text .= $ps['text'];
|
$text .= $ps['text'];
|
||||||
$text .= '</div>';
|
$text .= '</ul>';
|
||||||
$results = $ps['results'];
|
$results = $ps['results'];
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -831,6 +845,8 @@ class search extends e_shortcode
|
|||||||
function searchQuery()
|
function searchQuery()
|
||||||
{
|
{
|
||||||
global $perform_search;
|
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']))
|
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'])
|
elseif ($this->search_prefs['time_restrict'])
|
||||||
{
|
{
|
||||||
$time = time() - $this->search_prefs['time_secs'];
|
$time = time() - $this->search_prefs['time_secs'];
|
||||||
$query_check = $tp -> toDB($full_query);
|
$query_check = $tp->toDB($full_query);
|
||||||
$ip = e107::getIPHandler()->getIP(FALSE);
|
$ip = e107::getIPHandler()->getIP(FALSE);
|
||||||
|
|
||||||
if ($sql->select("tmp", "tmp_ip, tmp_time, tmp_info", "tmp_info LIKE 'type_search%' AND tmp_ip='".$ip."'"))
|
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))
|
if (($row['tmp_time'] > $time) && ($row['tmp_info'] != 'type_search '.$query_check))
|
||||||
{
|
{
|
||||||
$perform_search = false;
|
$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
|
else
|
||||||
{
|
{
|
||||||
@@ -1230,15 +1246,9 @@ if(deftrue('BOOTSTRAP'))
|
|||||||
$SEARCH_ADV_COMBO = $tmp['advanced-combo'];
|
$SEARCH_ADV_COMBO = $tmp['advanced-combo'];
|
||||||
|
|
||||||
$srchObj->template = $tmp;
|
$srchObj->template = $tmp;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
unset($tmp);
|
unset($tmp);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
|
||||||
|
|
||||||
if (!isset($SEARCH_TOP_TABLE))
|
|
||||||
{
|
{
|
||||||
if (file_exists(THEME."search_template.php"))
|
if (file_exists(THEME."search_template.php"))
|
||||||
{
|
{
|
||||||
@@ -1253,104 +1263,22 @@ if (!isset($SEARCH_TOP_TABLE))
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//$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 = "<select name='t' id='t' class='tbox' onchange=\"ab()\">";
|
|
||||||
if ($search_prefs['multisearch']) {
|
|
||||||
$SEARCH_VARS->SEARCH_DROPDOWN .= "<option value='all'>".LAN_SEARCH_22."</option>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$SEARCH_VARS->SEARCH_MAIN_CHECKBOXES = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach($search_info as $key => $value)
|
|
||||||
{
|
|
||||||
if ($search_prefs['selector'] == 2) {
|
|
||||||
$sel = (isset($searchtype[$key]) && $searchtype[$key]) ? " selected='selected'" : "";
|
|
||||||
} else {
|
|
||||||
$sel = (isset($searchtype[$key]) && $searchtype[$key]) ? " checked='checked'" : "";
|
|
||||||
}
|
|
||||||
$google_js = check_class($search_prefs['google']) ? "onclick=\"uncheckG();\" " : "";
|
|
||||||
if ($search_prefs['selector'] == 2) {
|
|
||||||
$SEARCH_VARS->SEARCH_DROPDOWN .= "<option value='".$key."' ".$sel.">".$value['qtype']."</option>";
|
|
||||||
} else if ($search_prefs['selector'] == 1) {
|
|
||||||
$SEARCH_VARS->SEARCH_MAIN_CHECKBOXES .= $PRE_CHECKBOXES."<input ".$google_js." type='checkbox' name='t[".$key."]' ".$sel." />".$value['qtype'].$POST_CHECKBOXES;
|
|
||||||
} else {
|
|
||||||
$SEARCH_VARS->SEARCH_MAIN_CHECKBOXES .= $PRE_CHECKBOXES."<input type='radio' name='t' value='".$key."' ".$sel." />".$value['qtype'].$POST_CHECKBOXES;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (check_class($search_prefs['google']))
|
|
||||||
{
|
|
||||||
if ($search_prefs['selector'] == 2) {
|
|
||||||
$SEARCH_VARS->SEARCH_DROPDOWN .= "<option value='".$google_id."'>Google</option>";
|
|
||||||
} else if ($search_prefs['selector'] == 1) {
|
|
||||||
$SEARCH_VARS->SEARCH_MAIN_CHECKBOXES .= $PRE_CHECKBOXES."<input id='google' type='checkbox' name='t[".$google_id."]' onclick='uncheckAll(this)' />Google".$POST_CHECKBOXES;
|
|
||||||
} else {
|
|
||||||
$SEARCH_VARS->SEARCH_MAIN_CHECKBOXES .= $PRE_CHECKBOXES."<input id='google' type='radio' name='t' value='".$google_id."' />Google".$POST_CHECKBOXES;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($search_prefs['selector'] == 2)
|
|
||||||
{
|
|
||||||
$SEARCH_VARS->SEARCH_DROPDOWN .= "</select>";
|
|
||||||
}
|
|
||||||
// end of standard search config
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
//$text = preg_replace("/\{(.*?)\}/e", '$\1', $SEARCH_TOP_TABLE);
|
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
|
|
||||||
|
|
||||||
// $text = $tp->simpleParse($SEARCH_TOP_TABLE, $SEARCH_VARS);
|
|
||||||
|
|
||||||
$text = $tp->parseTemplate($SEARCH_TOP_TABLE,true,$srchObj);
|
$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 = "<input class='tbox' type='text' id='".$en_id."' name='".$en_id."' size='35' value='".$tp->post_toForm($_GET[$en_id])."' maxlength='50' />";
|
|
||||||
//$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'])
|
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 .= $tp->parseTemplate($SEARCH_CATS,true, $srchObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
//$text .= preg_replace("/\{(.*?)\}/e", '$\1', $SEARCH_TYPE);
|
// $text .= $tp->parseTemplate($SEARCH_TYPE,true, $srchObj);
|
||||||
// $text .= $tp->simpleParse($SEARCH_TYPE, $SEARCH_VARS);
|
/*
|
||||||
$text .= $tp->parseTemplate($SEARCH_TYPE,true, $srchObj);
|
$hiddenBlock = (!empty($_GET['t'])) ? "" : "class='e-hideme'";
|
||||||
|
$text .= "<div {$hiddenBlock} id='search-advanced' >";
|
||||||
|
$text .= $tp->parseTemplate("{SEARCH_ADVANCED_BLOCK=".vartrue($_GET['t'])."}",true, $srchObj);
|
||||||
$text .= "<div class='e-hideme' id='search-advanced' >";
|
$text .= "</div>";*/
|
||||||
$text .= $tp->parseTemplate("{SEARCH_ADVANCED_BLOCK=".vartrue($_GET['t'])."}",true, $srchObj);
|
|
||||||
$text .= "</div>";
|
|
||||||
|
|
||||||
|
|
||||||
|
//print_a($search_prefs);
|
||||||
//$
|
//$
|
||||||
|
|
||||||
$text .= $SEARCH_MESSAGE ? preg_replace("/\{(.*?)\}/e", '$\1', $SEARCH_TABLE_MSG) : "";
|
$text .= $SEARCH_MESSAGE ? preg_replace("/\{(.*?)\}/e", '$\1', $SEARCH_TABLE_MSG) : "";
|
||||||
|
Reference in New Issue
Block a user