\n";
if (!defined("SAFEMODE")) {
define("SAFEMODE", @ini_get("safe_mode") ? TRUE : FALSE);
}
$sort_by = [
'datestamp' => "photo_datestamp",
'subject' => "photo_title",
'author' => "photo_user",
];
$order_by = [
'0' => ' DESC',
'1' => ' ASC',
];
$sortby = !empty(Search_Engine::get_param('sort')) ? "ORDER BY ".$sort_by[Search_Engine::get_param('sort')].$order_by[Search_Engine::get_param('order')] : '';
$limit = (Search_Engine::get_param('stype') != "all" ? " LIMIT ".Search_Engine::get_param('rowstart').",10" : '');
$date_search = (Search_Engine::get_param('datelimit') != 0 ? ' AND photo_datestamp>='.(TIME - Search_Engine::get_param('datelimit').' OR album_datestamp>='.(TIME - Search_Engine::get_param('datelimit'))).' ' : '');
switch (Search_Engine::get_param('fields')) {
case 2:
Search_Engine::search_column('photo_title', 'gallery');
Search_Engine::search_column('photo_description', 'gallery');
Search_Engine::search_column('album_title', 'gallery');
Search_Engine::search_column('album_description', 'gallery');
break;
case 1:
Search_Engine::search_column('photo_description', 'gallery');
Search_Engine::search_column('album_description', 'gallery');
break;
default:
Search_Engine::search_column('photo_title', 'gallery');
Search_Engine::search_column('album_title', 'gallery');
}
$query = '';
$param = '';
if (!empty(Search_Engine::get_param('search_param'))) {
$query = "
SELECT tp.*,ta.*
FROM ".DB_PHOTOS." tp
INNER JOIN ".DB_PHOTO_ALBUMS." ta ON tp.album_id=ta.album_id
".(multilang_table("PG") ? "WHERE ".in_group('ta.album_language', LANGUAGE)." AND " : "WHERE ").groupaccess('album_access')." AND
".Search_Engine::search_conditions('gallery');
$param = Search_Engine::get_param('search_param');
$result = dbquery($query, $param);
$rows = dbrows($result);
} else {
$rows = 0;
}
if ($rows != 0) {
$item_count = "".$rows." ".($rows == 1 ? $locale['p401'] : $locale['p402'])." ".$locale['522']."
\n";
$result = dbquery($query.$date_search.$sortby.$limit, $param);
$search_result = '';
while ($data = dbarray($result)) {
$search_result = "";
$timeoffset = timezone_offset_get(timezone_open($settings['timeoffset']), new \DateTime());
if ($data['photo_datestamp'] + 604800 > time() + ($timeoffset * 3600)) {
$new = " ".$locale['p403']."";
} else {
$new = "";
}
$text_all = $data['photo_description'];
$text_all = Search_Engine::search_striphtmlbbcodes($text_all);
$text_frag = Search_Engine::search_textfrag($text_all);
// $subj_c = Search_Engine::search_stringscount($data['photo_title']) + Search_Engine::search_stringscount($data['album_title']);
// $text_c = Search_Engine::search_stringscount($data['photo_description']) + Search_Engine::search_stringscount($data['album_description']);
$image_link = INFUSIONS.'gallery/gallery.php?photo_id='.$data['photo_id'];
if ($data['photo_thumb1'] != "" && file_exists(IMAGES_G_T.$data['photo_thumb1'])) {
$image = "";
} else {
if ($data['photo_thumb2'] != "" && file_exists(IMAGES_G_T.$data['photo_thumb2'])) {
$image = "";
} else {
$image = "";
}
}
$desc = '';
if ($text_frag != "") {
$desc .= "