query("SET NAMES 'utf8'"); /* Specifies whatever or not there should be a right menu on this page! */ $show_right_menu = false; /* Create the class object in order to manage the site cookie */ $coo = new Cookies_Manager_Class("UserCookie"); /* Start session management! Make at the following global variables available: SESSION_VERIFIED_USER[] (profile_id, username, password, user_level, first_name, middel_name, last_name) SESSION_VERIFIED_ADMIN[] (admin_id, username, password, admin_level, first_name, middel_name, last_name) */ start_page_session(); /* Call this method in order to check for auto login and so if auto_login is set! NOTICE that this method must have a pointer to the cookie as an argument!*/ check_for_autologin($coo); /* Call the method get_language in order to find out what language the page scould be in! NOTICE! that the method take one argument (the pointer og the cookie object)*/ $page_language = get_language($coo); /* Include the listpictures function!*/ require_once("./include/listpictures.php"); /* Get left/right sitemenu picture url*/ $left_sitemenu_picture_id = get_left_sitemenu_picture_id(); if ($show_right_menu) { $right_sitemenu_picture_id = get_right_sitemenu_picture_id($left_sitemenu_picture_id); } /* Get standard "GET" variables */ if (!$page_id = @$_GET['id']) { $page_id = 'index';} if (!$page_mode = @$_GET['mode']) { $page_mode = '';} if (!$page_option = @$_GET['op']) { $page_option = '';} if (!$referer_url = @$_GET['rurl']) { $referer_url = ''; } /**********************************************************************************/ /****************************** Special Initialising ******************************/ /**********************************************************************************/ if (!$page_nr = @$_GET['page_nr']) { $page_nr = '1'; } else { if (!is_numeric($page_nr) Or (((int) $page_nr) < 1)) {$page_nr = '1';} } if (!$page_size = @$_GET['page_size']) { $page_size = '25'; } else { if (!is_numeric($page_size) Or (((int) $page_size) < 1)) {$page_size = '25';} if (((int) $page_size) > 100) {$page_size = '100';} } if (!$order_by = @$_GET['order_by']) { $order_by = '';} if (!$order = @$_GET['order']) { $order = '';} if (!$species_id = (INT) @$_GET['species_id']) { $species_id = '';} if (!$photographer_id = (INT) @$_GET['photographer_id']) { $photographer_id = '';} if (!$pic_title = @$_GET['pic_title']) { $pic_title = ''; }else { $pic_title = str_replace('"', '', $pic_title); } if (!$withcomments = (INT) @$_GET['withcomments']) {$withcomments = 0;} if (!$picture_id = (INT) @$_GET['picture_id']) { $picture_id = '';} if (!$country_id = (INT) @$_GET['country_id']) { $country_id = '';} if (!$pics_section = @$_GET['pics_section']) { $pics_section = '';} if (!$picture_category_id = @$_GET['picture_category_id']) { $picture_category_id = '';} if (!$picture_theme_id = (INT) @$_GET['theme_id']) { $picture_theme_id = '';} if (!$picture_theme_sp = @$_GET['theme_sp']) { $picture_theme_sp = 0;} if (!$rare_bird_id = @$_GET['rare_bird']) { $rare_bird_id = '';} if (!$enable_upload_functionality = @$_GET['enable_upload_functionality']) { $enable_upload_functionality = '';} if (!$picdate_day = (INT) @$_GET['picdate_day']) { $picdate_day = ''; } else { if (!is_numeric($picdate_day) Or (((int) $picdate_day) < 1) Or (((int) $picdate_day) > 31)) {$picdate_day = '';} } if (!$picdate_month = (INT) @$_GET['picdate_month']) { $picdate_month = ''; } else { if (!is_numeric($picdate_month) Or (((int) $picdate_month) < 1) Or (((int) $picdate_month) > 12)) {$picdate_month = '';} } if (!$picdate_year = (INT) @$_GET['picdate_year']) { $picdate_year = ''; } else { if (!is_numeric($picdate_year) Or (((int) $picdate_year) < 1900)) {$picdate_year = '';} } if (!$search = @$_GET['search']) { $search = 0;} if (!$birdid = (INT) @$_GET['birdid']) { $birdid = 0;} if (!$subspecies = (INT) @$_GET['subspecies']) { $subspecies = 0;} /**********************************************************************************/ /************************************ Functions ***********************************/ /**********************************************************************************/ if($page_id == 'search_result') { $search_value = str_replace('"', '', @$_GET['search_value']); if($search_value) { update_statistic_language('pictures.php?id=search_result'); /************************************ SPECIES ************************************/ $sql_search_species = "Select species.category_id, species." . $page_language . "_name AS bird_name, species.latin_name, species.species_id, COUNT(*) As number_of_photo, SUM(pictures.hits) As number_of_hits, MAX(pictures.upload_date) As latest_picture From tbl_bird_species AS species, tbl_pictures AS pictures Where pictures.species_id = species.species_id"; $sql_search_species .= " AND (species.dk_name LIKE \"%" . $search_value . "%\" OR species.uk_name LIKE \"%" . $search_value . "%\" OR species.latin_name LIKE \"%" . $search_value . "%\" OR species.uk_name_alt LIKE \"%" . $search_value . "%\" OR species.dk_name_alt LIKE \"%" . $search_value . "%\")"; $sql_search_species .= " Group by species.species_id Order by species.category_id, species.placement"; $db->query($sql_search_species, "search_species"); $number_of_species = $db->db_num_rows("search_species"); /************************************ COUNTRIES ************************************/ $sql_search_countries = "Select country." . $page_language . "_country_name AS country_name, country.country_id, COUNT(*) As number_of_photo, SUM(pictures.hits) As number_of_hits, MAX(pictures.hits) As max_hits, MAX(pictures.upload_date) As latest_picture From tbl_country AS country, tbl_pictures AS pictures Where pictures.country_id = country.country_id"; $sql_search_countries .= " AND (country.dk_country_name LIKE \"%" . $search_value . "%\" OR country.uk_country_name LIKE \"%" . $search_value . "%\")"; $sql_search_countries .= " Group by country.country_id Order by country_name"; $db->query($sql_search_countries, "search_countries"); $number_of_countries = $db->db_num_rows("search_countries"); /************************************ PHOTOGRAPHERS ************************************/ $sql_search_photographers = "Select country." . $page_language . "_country_name As country_name, photographer.photographer_name, photographer.photographer_id, COUNT(*) As number_of_photo, SUM(pictures.hits) As number_of_hits, MAX(pictures.hits) As max_hits, MAX(pictures.upload_date) As latest_picture From tbl_country AS country, tbl_photographers AS photographer, tbl_pictures AS pictures Where country.country_id = photographer.country_id AND pictures.photographer_id = photographer.photographer_id"; $sql_search_photographers .= " AND (photographer.photographer_name LIKE \"%" . $search_value . "%\")"; $sql_search_photographers .= " Group by photographer.photographer_id Order by photographer.photographer_name"; $db->query($sql_search_photographers, "search_photographers"); $number_of_photographers = $db->db_num_rows("search_photographers"); } else { $number_of_species = 0; $number_of_countries = 0; $number_of_photographers = 0; } /************************************ RESULT ************************************/ if(($number_of_species + $number_of_countries + $number_of_photographers) == 1) { if($number_of_species == 1) { $species_info_row = $db->row("search_species"); header('Location: pictures.php?id=listpictures&species_id=' . $species_info_row['species_id']); exit; } elseif($number_of_countries == 1) { $country_info_row = $db->row("search_countries"); header('Location: pictures.php?id=listpictures&country_id=' . $country_info_row['country_id']); exit; } else { $photographer_info_row = $db->row("search_photographers"); header('Location: pictures.php?id=listpictures&photographer_id=' . $photographer_info_row['photographer_id']); exit; } } } /**********************************************************************************/ /*********************************** Page Start ***********************************/ /**********************************************************************************/ ?>
| "; echo ""; echo " | |
| "; echo "["; echo ($page_language == "dk") ? "Avanceret søgning" : "Advanced Search"; echo "]"; echo " |
$page_nr,
"page_size" => $page_size,
"order_by" => $order_by,
"order" => $order,
"species_id" => $species_id,
"birdid" => $birdid,
"subspecies" => $subspecies,
"photographer_id" => $photographer_id,
"country_id" => $country_id,
"picdate_day" => $picdate_day,
"picdate_month" => $picdate_month,
"picdate_year" => $picdate_year,
"pic_title" => $pic_title,
"withcomments" => $withcomments,
"pics_section" => $pics_section,
"picture_category_id" => $picture_category_id,
"picture_theme_id" => $picture_theme_id,
"rare_bird_id" => $rare_bird_id,
"enable_year_functionality" => true,
"enable_species_name_functionality" => true,
"enable_upload_functionality" => $enable_upload_functionality,
"enable_order_by_functionality" => true,
"enable_page_overview_functionality" => true,
"enable_search_criteria_functionality" => true,
"show_all_pictures" => false,
"search" => $search,
);
listpictures($initializing_array);
break;
case 'search_result' :
include("./include/pictures/gallery_search_result.php");
break;
case 'search' :
include("./include/pictures/gallery_search.php");
break;
case 'listphotographers' :
include("./include/pictures/gallery_listphotographers.php");
break;
case 'showphotographer' :
include("./include/pictures/gallery_showphotographer.php");
break;
case 'specieslist' :
include("./include/pictures/gallery_specieslist.php");
break;
case 'specieslist_wp' :
include("./include/pictures/gallery_specieslist_wp_missing.php");
break;
case 'sendpics' :
include("./include/pictures/gallery_sendpics.php");
break;
case 'latestcomments' :
include("./include/pictures/gallery_latestcomments.php");
break;
case 'latestcommentsadmin' :
include("./include/pictures/gallery_latestcommentsadmin.php");
break;
case 'comments_statistics' :
include("./include/pictures/gallery_comments_statistics.php");
break;
default :
include("./include/pictures/gallery_index.php");
break;
}
echo " "; echo " ";
echo " ";
echo "
"; gui_backbutton(); ?> |