ok, here u go
:
open
search.phpFind:
$search_id = array();
Add after:
if (isset($HTTP_POST_VARS['search_by']) || isset($HTTP_GET_VARS['search_by'])) {
$search_by = (isset($HTTP_POST_VARS['search_by'])) ? $HTTP_POST_VARS['search_by'] : $HTTP_GET_VARS['search_by'];
if ($search_by != "") {
$search_by_check = array("votes", "downloads", "hits", "comments");
if (in_array($search_by, $search_by_check)){
$show_result = 1;
$sql = "SELECT image_id
FROM ".IMAGES_TABLE."
WHERE image_".$search_by." > 0";
$result = $site_db->query($sql);
if ($result) {
while ($row = $site_db->fetch_array($result)) {
$search_id['image_ids'] .= (($search_id['image_ids'] != "") ? ", " : "").$row['image_id'];
}
$site_db->free_result($result);
}
}else{
$search_by = "";
}
}
}
else {
$search_by = "";
}
then, there is a little bug (atleast it didnt work right for me).
Find:
if (isset($HTTP_POST_VARS['search_new_images']) || isset($HTTP_GET_VARS['search_new_images'])) {
Replace with:
if (isset($HTTP_POST_VARS['search_new_images']) || isset($HTTP_GET_VARS['search_new_images']) && ($HTTP_POST_VARS['search_new_images']) != 0 || $HTTP_GET_VARS['search_new_images'] != 0) {
This "bug" was turning on "show new images only" on next page, even thought in the address bar it was set to 0.
next, find:
if ($search_new_images && $show_result == 1) {
$search_id['search_new_images'] = 1;
}
Add after:
if ($search_by && $show_result == 1) {
$search_id['search_by'] = $search_by;
}
Find next:
if (!empty($sql_where_query)) {
Add before:
if (!empty($search_id['search_by'])) {
$sql_where_query .= "AND i.image_".$search_id['search_by']." > 0";
}
now u have this options:
search.php?search_by=votes
search.php?search_by=downloads
search.php?search_by=comments
search.php?search_by=hits
yes, last one is kind of....
Good luck