array ("value" => 1, "display_en" => '30-Dec Morning 6:00-11:59', "display_zh-hant" => '12月30日 上午 6:00-11:59', "start" => "2017-12-30 06:00:00", "end" => "2017-12-30 11:59:59"), "2" => array ("value" => 2, "display_en" => '30-Dec Afternoon 12:00-17:59', "display_zh-hant" => '12月30日 下午 12:00-17:59', "start" => "2017-12-30 12:00:00", "end" => "2017-12-30 17:59:59"), "3" => array ("value" => 3, "display_en" => '30-Dec Night 18:00-23:59', "display_zh-hant" => '12月30日 晚上 18:00-23:59', "start" => "2017-12-30 18:00:00", "end" => "2017-12-30 23:59:59"), "4" => array ("value" => 4, "display_en" => '31-Dec Morning 6:00-11:59', "display_zh-hant" => '12月31日 上午 6:00-11:59', "start" => "2016-12-31 06:00:00", "end" => "2016-12-31 11:59:59"), "5" => array ("value" => 5, "display_en" => '31-Dec Afternoon 12:00-17:59', "display_zh-hant" => '12月31日 下午 12:00-17:59', "start" => "2016-12-31 12:00:00", "end" => "2016-12-31 17:59:59"), "6" => array ("value" => 6, "display_en" => '31-Dec Night 18:00-23:59', "display_zh-hant" => '12月31日 晚上 18:00-23:59', "start" => "2016-12-31 18:00:00", "end" => "2016-12-31 23:59:59"), "7" => array ("value" => 7, "display_en" => '1-Jan Before dawn 00:00-05:59', "display_zh-hant" => '1月1日 凌晨 00:00-05:59', "start" => "2018-01-01 00:00:00", "end" => "2018-01-01 05:59:59"), "EMPTY" => array ("value" => "EMPTY", "display_en" => 'Photo without timestamp', "display_zh-hant" => '沒有時間資料的相片') ); //https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fweb.sportsystem.hk%2Fttnh2016%2Fgallery%2F%23%26gid%3D1%26pid%3D9 $bibno = getpostval('bibno'); if ($bibno != "v" && $bibno != "volunteer" && $bibno != "EMPTY") { $bibno = str_pad($bibno, 4, "0", STR_PAD_LEFT); } if ($bibno == "0000" || $bibno == "" ) { $bibno = ""; } $location_select = $_REQUEST['locationbuttons']; $timerange_select = $_REQUEST['timerangbuttons']; $credit_select = $_REQUEST['creditbuttons']; //d($location_select); $sql = "select count(*) as c from " . $table_prefix . "gallery"; $stmt = $db->prepare($sql); $stmt->execute(); $totalphotos = $stmt->fetch(PDO::FETCH_ASSOC); $sql = "select location, count(*) as c from " . $table_prefix . "gallery group by location order by c desc"; $stmt = $db->prepare($sql); $stmt->execute(); $locations = $stmt->fetchAll(PDO::FETCH_ASSOC); $sql = "select credit, count(*) as c from " . $table_prefix . "gallery group by credit order by c desc"; $stmt = $db->prepare($sql); $stmt->execute(); $credits = $stmt->fetchAll(PDO::FETCH_ASSOC); //d($credits); if ($bibno || $location_select || $timerange_select || $credit_select ) { if ($bibno == "volunteer") { $bibno = "v"; } if (strtolower($bibno) != "EMPTY" && strtolower($bibno) != "all" && strtolower($bibno) != "v" && strtolower($bibno) != "empty" && ctype_alpha(substr($bibno,0,1))) { $bibno = substr($bibno,1); } $sql = 'select distinct gallery.* from ' . $table_prefix . 'gallery gallery left join ' . $table_prefix . 'gallery_tag gallery_tag on gallery.id = gallery_tag.gallery_id where 1=1 '; if (intval($bibno) > 0 ) { $sql .= 'and CAST(gallery_tag.bibno AS UNSIGNED) = ' . $bibno . '' ; } if (strtolower($bibno)== "v") { $sql .= 'and gallery_tag.bibno = "v"' ; } if ($bibno == "EMPTY") { $sql .= 'and (gallery_tag.bibno = "" or gallery_tag.bibno is null)' ; } $l = null; if ($location_select) { foreach ($location_select as $lx) { if (trim($lx) != "EMPTY" && trim($lx) != "") { $l[] = mysql_escape_mimic($lx); } } $sql .= " and ( location in ('" . implode("','",$l) . "')"; foreach ($location_select as $l) { if ($l == "EMPTY") $sql .= " or location is null"; } $sql .= ") "; } $l = array(); if ($credit_select) { foreach ($credit_select as $lx) { if (trim($lx) != "EMPTY" && trim($lx) != "") { $l[] = mysql_escape_mimic($lx); } } $sql .= " and ( credit in ('" . implode("','",$l) . "')"; foreach ($credit_select as $l) { if ($l == "EMPTY") $sql .= " or credit is null"; } $sql .= ") "; } if ($timerange_select) { //$sql .= " and location in ('" . implode("','",$location_select) . "')"; $sql .= " and ( 1=2 "; foreach ($timerange_select as $s) { if ( $timeranges[$s]['start'] ) { $sql .= " or (taketime >= '" . mysql_escape_mimic($timeranges[$s]['start']) . "' and taketime <= '" . mysql_escape_mimic($timeranges[$s]['end']) ."')"; } } foreach ($timerange_select as $l) { if ($l == "EMPTY") $sql .= " or taketime = '0000-00-00 00:00:00' or taketime = '' or taketime is null"; } $sql .= " ) "; } $sql .= " order by taketime limit " . $photomax ; } else { if(intval($_GET['pid'])) { $sql = ' select * from ' . $table_prefix . 'gallery gallery order by case when id=' . intval($_GET['pid']) . ' then -1 else RAND() end asc limit 200'; } else { $sql = 'select * from ' . $table_prefix . 'gallery ORDER BY RAND() limit 200'; } } //$sql = "select * from gallery limit 20"; //d($_GET); //exit(); //echo $sql; $stmt = $db->prepare($sql); $stmt->execute(); $images = $stmt->fetchAll(PDO::FETCH_ASSOC); if(intval($_GET['pid'])) { $sql = ' select * from ' . $table_prefix . 'gallery where id=' . intval($_GET['pid']) ; $stmt = $db->prepare($sql); $stmt->execute(); $odimages = $stmt->fetch(PDO::FETCH_ASSOC); } ?> 環大帽山越野跑 Ultra Trail Tai Mo Shan 2017-18 - 照片庫 Photo Gallery
'; echo i18n_text("Cannot find your photo? Some photo maybe not shown here."); echo '
'; ?> "Gediminas Grinius", "3" => "Romain Olivier", "369" => "Noriaki Yokouchi", "2" => "Andrea Huser", "73" => "Hoi Wah Cheng", "68" => "Peng Chung Chen", "168" => "Ishida Kensei", "128" => "Lim Cho Har", //"501" => "Marie Mcnaughton", //"875" => "Bogdan Onyschenko", //"502" => "Shing Yip Lam", //"1109" => "Ching Chou", //"1002" => "Hiroaki Matsunaga", //"1012" => "Kam Yuen Lau" ); if (!$bibno || array_key_exists(intval($bibno), $highlight)) { ?>
$name ){?>

' . i18n_field($timerange,display) . ''; } ?>
= $photomax ) { ?>