Мне нужно что бы в поиске jdownloads искал как по названию файла, так и по автору.
По названию ищет, а вот по автору... ни в какую...
В конечном итоге. По автору не ищет...
function showSearchForm($option){
global $Itemid, $jlistConfig, $my, $mainframe;
$mainframe->setPageTitle( $jlistConfig['jd.header.title'].' - '._JLIST_FRONTEND_SEARCH_LINKTEXT );
$html_form = makeHeader($html_form, false, false, false, 0, false, true, false, false, false, 0, 0, 0, 0, 0);
echo $html_form;
$html_form = '';
$html_form = '<form name="jdsearch" action="index.php?option=com_jdownloads&Itemid='.$Itemid.'&task=search.result" method="post">';
$html_form .= '<table class="jd_div_content" border="0" cellpadding="0" cellspacing="5" width="99%">
<tr><td><br /></td></tr>
<tr>
<td width="100" valign="middle">'._JLIST_FRONTEND_SEARCH_TEXT_TITLE.'
</td>
<td width="200" valign="middle">
<input class="jd_inputbox" type="text" name="jdsearchtext" id="jdsearchtext" maxlength="80" size="30" value=""> <input type="submit" name="searchsubmit" value="'._JLIST_FRONTEND_SEARCH_BUTTON_TEXT.'"/>
</td>
</tr>
<tr>
<td width="100" valign="middle">'._JLIST_FRONTEND_SEARCH_IN_TITLE.'
</td>
<td width="200">
<input class="jd_inputbox" type="checkbox" name="jdsearchintitle" id="jdsearchintitle" value="1" checked="checked">
</td>
</tr>
<tr>
<td width="100" valign="middle">'._JLIST_FRONTEND_SEARCH_AUTHOR.'
</td>
<td width="200">
<input class="jd_inputbox" type="checkbox" name="jdsearchauthor" id="jdsearchauthor" value="1" checked="checked">
</td>
</tr>
<tr>
<td width="100" valign="middle">'._JLIST_FRONTEND_SEARCH_NUMBERS.'
</td>
<td width="200">
<input class="jd_inputbox" type="text" name="jdsearchnumber" id="jdsearchnumber" maxlength="3" size="3" value="30">
</td>
</tr>
<tr><td><br /><br /></td></tr>
</table>
</form>';
$html_form .= makeFooter(true, false, false, 0, 0, 0, 0);
if ( !$jlistConfig['offline'] ) {
echo $html_cat;
} else {
if ($my->gid == 2) {
echo _JLIST_BACKEND_OFFLINE_ADMIN_MESSAGE_TEXT;
echo $html_cat;
} else {
$html_off = '<br /><br />'.$jlistConfig['offline.text'].'<br /><br />';
echo $html_off;
}
}
echo $html_form;
?>
<script type="text/Javascript" language="JavaScript">
<!--
document.getElementById("jdsearchtext").focus();
-->
</script>
<?php
}
function showSearchResult($option){
global $database, $Itemid, $mosConfig_absolute_path, $jlistConfig, $mainframe;
$mainframe->setPageTitle( $jlistConfig['jd.header.title'].' - '._JLIST_FRONTEND_SEARCH_RESULT_TITLE );
$html_form = makeHeader($html_form, false, false, false, 0, false, true, false, false, false, 0, 0, 0, 0, 0);
$searchtext = $database->getEscaped(mosGetParam($_POST, 'jdsearchtext', ''));
$searchintitle = $database->getEscaped(mosGetParam($_POST, 'jdsearchintitle', ''));
$searchintext = $database->getEscaped(mosGetParam($_POST, 'jdsearchindesc', ''));
$searchauthor = $database->getEscaped (mosGetParam( $_POST, 'jdsearchauthor', '' ));
$searchnumber = intval($database->getEscaped(mosGetParam($_POST, 'jdsearchnumber', 30)));
if (!$searchnumber) $searchnumber = 30;
if (strlen($searchtext) < 3){
echo "<script> alert('"._JLIST_FRONTEND_SEARCH_RESULT_TEXT_TO_SHORT."'); window.history.go(-1); </script>\n";
}
if (!$searchintitle && !$searchintext){
echo "<script> alert('"._JLIST_FRONTEND_SEARCH_RESULT_NO_OPTION."'); window.history.go(-1); </script>\n";
}
if ($searchintitle && $searchintext){
$database->setQuery("SELECT * FROM #__jdownloads_files WHERE file_title LIKE '%$searchtext%' OR description LIKE '%$searchtext%' OR description_long LIKE '%$searchtext%' AND published = 1 ORDER BY date_added LIMIT $searchnumber");
}
if ($searchintitle && !$searchintext){
$database->setQuery("SELECT * FROM #__jdownloads_files WHERE file_title LIKE '%$searchtext%' AND published = 1 ORDER BY date_added LIMIT $searchnumber");
}
if (!$searchintitle && $searchintext){
$database->setQuery("SELECT * FROM #__jdownloads_files WHERE description LIKE '%$searchtext%' OR description_long LIKE '%$searchtext%' AND published = 1 ORDER BY date_added LIMIT $searchnumber");
}
if (!$searchauthor && $searchintext){
$database->setQuery("SELECT * FROM #__jdownloads_files WHERE author LIKE '$%searchtext%' OR description LIKE '%$searchtext%' OR description_long LIKE '%$searchtext%' AND published = 1 ORDER BY date_added LIMIT $searchnumber");
}
$files = $database->loadObjectList();
if ($files) {
// files gefunden
// cat der files holen und auf access beschrдnken
$access = checkAccess_JD();
$output = array();
foreach($files as $file) {
if ($file->published) {
$database->setQuery("SELECT * FROM #__jdownloads_cats WHERE cat_id = '$file->cat_id'");
$cat = $database->loadObjectList();
if ($cat[0]->cat_access <= $access){
$output[] = $file;
}
}
}
if ($output) {
$files_found = true;
// result header
$html_form .= '<table class="jd_search_form" border="0" cellpadding="0" cellspacing="5" width="99%">
<tr>
<td class="jd_search_result_title" width="100%"><b>'._JLIST_FRONTEND_SEARCH_RESULT_TITLE.'</b><br />'
._JLIST_FRONTEND_SEARCH_RESULT_SEARCH_TEXT.': <b>'.$searchtext.'</b><br />'
._JLIST_FRONTEND_SEARCH_RESULT_AUTHOR.': <b>'.$searchauthor.'</b><br />'
._JLIST_FRONTEND_SEARCH_RESULT_SUM_FILES.': <b>'.count($output).'</b></td>
</tr>
<tr>
</tr>';
foreach ($output as $out){
// suchtext farblich hervorheben
if ($searchintitle && $searchintext){
$out->description = eregi_replace($searchtext, '<font color="#CC3300">'.$searchtext.'</font>', $out->description);
$out->file_title = eregi_replace($searchtext, '<font color="#CC3300">'.$searchtext.'</font>', $out->file_title);
}
if ($searchintitle && !$searchintext){
$out->file_title = eregi_replace($searchtext, '<font color="#CC3300">'.$searchtext.'</font>', $out->file_title);
}
if (!$searchintitle && $searchintext){
$out->description = eregi_replace($searchtext, '<font color="#CC3300">'.$searchtext.'</font>', $out->description);
}
if (!$searchauthor && $searchintext){
$out->author = eregi_replace($searchtext, '<font color="#cc3300">'.$searchtext.'</font>', $out->author);
}
$titel_link = sefRelToAbs('index.php?option='.$option.'&Itemid='.$Itemid.'&task=view.download&cid='.$out->file_id);
$titel_link_text = '<a href="'.$titel_link.'">'.$out->file_title.'</a>';
$titel_link_author = '<a herf="'.$link_author.'">'.$out->author.'</a>';
$detail_link_text = '<a href="'.$titel_link.'">'._JLIST_FE_DETAILS_LINK_TEXT_TO_DETAILS.'</a>';
$html_form .= '<tr width="100%"><td class="jd_search_results"><b>'.$titel_link_text.' '.$out->author.' '.$out->release.'</b><br />'.substr($out->description, 0, 400).'...<br />'.$detail_link_text.'</td></tr>';
}
$html_form .= '</table>';
} else {
$files_found = false;
}
} else {
$files_found = false;
}
if (!$files_found) {
// keine files gefunden - oder falsche berechtigung
// result header
$html_form .= '<table class="jd_search_form" border="0" cellpadding="0" cellspacing="5" width="99%">
<tr>
<td class="jd_search_result_title" width="100%"><b>'._JLIST_FRONTEND_SEARCH_RESULT_TITLE.'</b><br />'
._JLIST_FRONTEND_SEARCH_RESULT_SEARCH_TEXT.': <b>'.$searchtext.'</b><br />'
._JLIST_FRONTEND_SEARCH_RESULT_NO_SUM_FILES.'</td>
</tr>
<tr>
</tr></table>';
}
$html_form .= makeFooter(true, false, false, 0, 0, 0, 0);
echo $html_form;
}
//end of class
}