function hot_block($type = 0, $target = "_blank") { switch ($type) { //case 1: // $maps = map_get_lastest(30); // $size = "1.0em"; // $name = "最新地圖"; // break; case 1: $maps1 = map_get_gpx(15); $maps2 = map_get_lastest(20); $maps = array_merge($maps1, $maps2); $size = "1.0em"; $name = "最新地圖(gpx)"; break; default: $maps = map_get_hot(20); $size = "1.2em"; $name = "熱門地圖"; break; } $ret[0] = "<table style='width: 330px; '><tr>"; $ret[] = "<th>{$name}<tr><td>"; //error_log(print_r($maps, true)); foreach ($maps as $map) { $link = sprintf("show.php?mid=%d&info=%dx%d-%dx%d", $map['mid'], $map['locX'], $map['locY'], $map['shiftX'], $map['shiftY']); if ($map['gpx'] == 1) { $ret[] = sprintf("<img src='%s' /><img src='%s' /><a href='%s' target=%s style='font-size: %s'>%s</a> ", name_to_icon($map), "imgs/gpx.png", $link, $target, $size, $map['title']); // error_log("mid=".$map['mid']); } else { $ret[] = sprintf("<img src='%s' /><a href='%s' target=%s style='font-size: %s'>%s</a> ", name_to_icon($map), $link, $target, $size, $map['title']); } } $ret[] = "</table>"; return implode("\n", $ret); }
session_start(); } if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] == 1) { if (isset($_SESSION['redirto'])) { unset($_SESSION['redirto']); header("Location: " . $_SESSION['redirto']); } else { header("Location: main.php"); } exit; } if (isset($_GET['mid'])) { // 從 show.php 登入 $lastest_mid = "&mid=" . $_GET['mid']; } else { // 若沒參數就取最新的 $row = map_get_gpx(1); if (count($row) == 1) { $lastest_mid = "&mid=" . $row[0]['mid']; } } $config = (include "config-hybridauth.php"); $smarty->assign("fb_appid", $config['providers']['Facebook']['keys']['id']); $smarty->assign("login_fb", "lib/Hybrid/auth.php?provider=facebook"); $smarty->assign("loggedin", 0); $smarty->assign("user_icon", "imgs/icon-map.png"); $smarty->assign("lastest_mid", $lastest_mid); $smarty->assign("site_root_url", $site_url . $site_html_root); $smarty->assign("title", "登入"); echo $smarty->fetch('header.html'); $smarty->display("main.html");