CURRENT_TIMESTAMP) ORDER BY date DESC"; } $db->query( $sql ); if( $db->num_rows() ){ $data = $db->fetch(); }else{ header("Location: ../"); exit; } // ファイルダウンロード if( $data['type'] == 2 ){ $filename = $data['file1']; header("Content-Type: application/octet-stream"); header("Content-Disposition: attachment; filename=$filename" ); readfile( "../system/files/" . $data['id'] ); } // 年リスト switch( $data['category'] ){ case 2: $smarty->assign('title_img', 'news_head_floor.gif'); $index = $_GET['index']; $sql = "SELECT DISTINCT year FROM D_NEWS WHERE status = '1' AND category = 2 AND (st_time IS NULL OR st_time < CURRENT_TIMESTAMP ) AND (ed_time IS NULL OR ed_time > CURRENT_TIMESTAMP) "; break; case 3: $smarty->assign('title_img', 'news_head_neo.gif'); $index = $_GET['index']; $sql = "SELECT DISTINCT year FROM D_NEWS WHERE status = '1' AND category = 3 AND (st_time IS NULL OR st_time < CURRENT_TIMESTAMP ) AND (ed_time IS NULL OR ed_time > CURRENT_TIMESTAMP) "; break; default: $smarty->assign('title_img', 'news_head_federation.gif'); $index = ''; $sql = "SELECT DISTINCT year FROM D_NEWS WHERE status = '1' AND (st_time IS NULL OR st_time < CURRENT_TIMESTAMP ) AND (ed_time IS NULL OR ed_time > CURRENT_TIMESTAMP) "; } $db->query( $sql ); $yearlist = array(); while( $row = $db->fetch() ){ $yearlist[] = $row['year']; } $smarty->assign('icon_img', array( 1 => 'icon_federation.gif', 2 => 'icon_floor.gif', 3 => 'icon_neo.gif') ); $smarty->assign('icon_alt', array( 1 => '連盟からのお知らせ', 2 => 'フロアボール', 3 => 'ネオホッケー') ); $smarty->assign('index', $index ); $smarty->assign('year', $year ); $smarty->assign('yearlist', $yearlist ); $smarty->assign('data', $data ); $smarty->display('topics/detail.html'); ?>