/*************************************************************
ファイル名:index.php
--------------------------------------------------------------
内 容:カツ代の家庭料理トップページ
--------------------------------------------------------------
作成者:Aida
作成日:2005.05.10
--------------------------------------------------------------
備 考:
**************************************************************/
require_once('prepare.php');
require_once('config.php');
require_once('new_diary/lib/diary_function.php');
require_once('jouzu/lib/jouzu_function.php');
//-- uid 取得のため Location
switch($p['carrier']){
case "i":
if(empty($p['uid']) || $p['uid'] == "LLGWDOCOMO" || $p['uid'] == 'NULLGWDOCOMO'){
header("Location: ".KTY_BASE_URL."/index.php?uid=NULLGWDOCOMO");
exit;
}
break;
case "e":
chdir(dirname(__FILE__) . "/authcheck");
require_once("../authcheck/authcheck.php");
chdir(dirname(__FILE__));
break;
case "v":
if(empty($p['uid'])){
header("Location: ".KTY_BASE_URL."/index.php?uid=1&sid=".V_SID);
exit;
}
break;
}
//-- 非会員の場合、非有料メンバー用TOPへ
$db = u4user_open();
if(!get_UserDetail_uid($db, $p['uid'], '0', '1')){
header("Location: ".KTY_BASE_URL."/v_index_free.php");
exit;
}
u4user_close($db);
function index($p){
$db = cs4_open();
//- 表示用日付取得
$today_str = get_showdate();
//- 今日の日記タイトル取得
$todays_diary = get_DiaryDetail("","0","1");
//- 今日の料理上手タイトル取得
$todays_jouzu = get_JouzuDetail("","0","1");
//- 本日のレシピcsv取得
$csv_today = get_csvdata('today');
//- 写真付き日替わりレシピ取得
$top_today = get_rcpList($db, $csv_today);
$img_filename = sprintf("%s.gif",$top_today['today'][0]['uniq_id']);
$img_path = sprintf("/home/www/public/image/today/%s",$img_filename);
cs4_close($db);
if("e" == $p['carrier'] && ("HI31" == $p['device'] || "KC31" == $p['device'])){
$p['version'] = "2";
}
$p['template_path'] = "template_v3_ext";
//-- テンプレートへセット
$template =& loadTemplate_Test( $p );
//- 日記タイトルセット
if(!empty($todays_diary[0])){
$template->setCurrentBlock('__DiaryTitle__');
$template->setVariable('diary_title',$todays_diary[0]['title']);
$template->parseCurrentBlock();
}
//- 料理上手タイトルセット
if(!empty($todays_jouzu[0])){
$template->setCurrentBlock('__JouzuTitle__');
$template->setVariable('jouzu_title',$todays_jouzu[0]['title']);
$template->parseCurrentBlock();
}
//- 本日の新レシピ
if(!empty($top_today['today'])){
if(("3" == $p['version']) || ("2" == $p['version'] && "i" == $p['carrier']) || "w" == $p['carrier'] || "g" == $p['carrier']){
$template->setCurrentBlock('__ShowImage__');
if(file_exists($img_path)){
$template->setVariable('recipe_image',sprintf("
",str_replace(KTY_SERVER_ROOT,"",$img_path)));
}
$template->parseCurrentBlock();
}
$template->setCurrentBlock('__TopRecipe__');
$template->setVariable('date',sprintf("%d/%d",substr($top_today['today_date'],4,2),substr($top_today['today_date'],6,2)));
$template->setVariable('rcp_no',$top_today['today'][0]['uniq_id']);
$template->setVariable('title',$top_today['today'][0]['rcp_nm']);
$template->parseCurrentBlock();
}
//- xhtml
if("i" == $p['carrier'] && $p['xhtml'])
{
ini_set('default_mimetype', 'application/xhtml+xml');
/*
if(ereg("F900i\(",$p['agent']))
{
var_dump($p);
header("Content-Type: application/xhtml+xml;charset=Shift_JIS");
}
*/
}
elseif("i" == $p['carrier'] && ereg("F900i\(",$p['agent']))
{
ini_set('default_mimetype', 'application/xhtml+xml');
header("Content-Type: application/xhtml+xml;charset=Shift_JIS");
}
elseif("w" == $p['carrier'] && $p['xhtml'])
{
// header("Content-Type: application/xhtml+xml;charset=Shift_JIS");
// header("Content-Type: application/xhtml+xml;charset=EUC-JP");
/*
if("test.katsuyo.net" == $_SERVER['HTTP_HOST']){
print "Load -> ".$template_dir."/".$p['template']."
";
print "Version -> ".$p['version']."
";
print "Device -> ".$p["device"]."
";
}
*/
}elseif("w" == $p['carrier'] && $p['xhtml']){
}
$template->show();
}
index($p);
?>