require_once('../prepare.php');
require_once('lib/search_function.php');
require_once('../ktkm/index.php');
function search_detail( $p ){
$this->db = cs4_open();
//- VsΪΧξρζΎ
$detail = get_rcpDetail($this->db,$p['id']);
//- 2007.07.06 J.Nikaido Add LΏVsΜκΙΝ³ΏουΝ}Cj
[o^y[WΦJΪ
if($detail[0][toll_flg] >= 1){
//- o[`FbN
if("e" == $p['carrier']){
chdir(dirname(__FILE__) . "/authcheck");
require_once("../authcheck/authcheck.php");
chdir(dirname(__FILE__));
}
$db = u4user_open();
if(!get_UserDetail_uid($db, $p['uid'], '0', '1') && MEMBER_CHECK && "w" != $p['carrier'] && !$p['free']){
/*$p['template'] = preg_replace('/.php$/','_free.html', basename( $_SERVER['SCRIPT_NAME'] ) );
$p['template_x'] = preg_replace('/.php$/','_free.xhtml', basename( $_SERVER['SCRIPT_NAME'] ) );
$free_flg = true;*/
header("Location: " . NEW_MEMBER_REGIST_URL . "?p[contents]=" . substr(strrchr(dirname( __FILE__ ) , '/'), 1)."_".$p['id']);
exit;
}
u4user_close($db);
}
//- VsΚ^TCY»θ
if("1" == $p['version']){
$photo_size = 1;
}else{
$photo_size = 0;
}
//- au Ver.2 Ξ
if("e" == $p['carrier'] && $p['version'] == "2"){
$photo_size = 1;
}
$dir_name = substr(strrchr(dirname( __FILE__ ) , '/'), 1);
// ev[gΗέέ
$template =& loadTemplate( $p );
/*if($free_flg){
if($p['carrier'] == 'i'){
$template->setVariable('regist_url', MEMBER_REGIST_URL . "?uid=NULLGWDOCOMO&p[contents]=" . $dir_name."_".$p['id']);
}else{
$template->setVariable('regist_url', MEMBER_REGIST_URL . "?p[contents]=" . $dir_name."_".$p['id']);
}
}*/
$template->setVariable('recipe_name',$detail[0]['rcp_nm']);
$img_filename = array(sprintf("%s_n.jpg",$detail[0]['uniq_id']),sprintf("%s_n-s.jpg",$detail[0]['uniq_id']));
switch($photo_size){
case "0":
$img_path = sprintf("%s/%s",constant('IMG_DIR_RECIPE'),$img_filename[0]);
$another_url = sprintf("%s/%s",constant('IMG_DIR_RECIPE'),$img_filename[1]);
if(file_exists($img_path)){
$template->setVariable('recipe_image',sprintf("",str_replace(KTY_SERVER_ROOT,"",$img_path)));
}
clearstatcache();
break;
case "1":
$img_path = sprintf("%s/%s",constant('IMG_DIR_RECIPE'),$img_filename[1]);
$another_url = sprintf("%s/%s",constant('IMG_DIR_RECIPE'),$img_filename[0]);
if(file_exists($img_path)){
$template->setVariable('recipe_image',sprintf("",str_replace(KTY_SERVER_ROOT,"",$img_path)));
}
clearstatcache();
break;
default:
break;
}
//- ͺΚ\¦ΗΑ
if(!empty($detail[0]['rcp_salt']) && "1" == $detail[0]['rcp_salt_flg']){
$template->setCurrentBlock('__Salt__');
$template->setVariable('salt',sprintf("%sg
",$detail[0]['rcp_salt']));
$template->parseCurrentBlock();
}
if(!empty($detail[0]['rcp_menu'])){
$template->setCurrentBlock('__Genre__');
$template->setVariable('genre',sprintf("%s
",$detail[0]['rcp_menu']));
$template->parseCurrentBlock();
}
if(!empty($detail[0]['rcp_time'])){
$template->setCurrentBlock('__Time__');
$template->setVariable('time',sprintf("%s
",$detail[0]['rcp_time']."ͺ"));
$template->parseCurrentBlock();
}
if(!empty($detail[0]['rcp_crl'])){
$template->setCurrentBlock('__Calorie__');
$template->setVariable('calorie',sprintf("%skcal
",$detail[0]['rcp_crl']));
$template->parseCurrentBlock();
}
if(!empty($detail[0]['rcp_style'])){
$template->setCurrentBlock('__Style__');
$template->setVariable('style',sprintf("%s
",$detail[0]['rcp_style']));
$template->parseCurrentBlock();
}
if(!empty($detail[0]['rcp_num'])){
$template->setVariable('number_of_persons',sprintf("(%slͺ)",$detail[0]['rcp_num']));
}
else
{
$template->touchBlock("__Easy__");
}
//- ήΏZbg
$ing = array();
$detail[0]['rcp_cook_mtr'] = str_replace("A",",",$detail[0]['rcp_cook_mtr']);
$ing = explode(",",$detail[0]['rcp_cook_mtr']);
for($i=0;$isetCurrentBlock('__Ingedients__');
$ing_name = get_filter($ing_name);
$template->setVariable('Ingredients',$ing_name);
$template->setVariable('amount',sprintf(":%s",$ing_amount));
$template->parseCurrentBlock();
}
//if(!$free_flg){
//- μθϋZbg
$howto = array();
$howto = explode(",",$detail[0]['mtr_cook_exp']);
$exist_show = get_bsc_img_show($p['uid']);
if(!$p['flg']){
if($exist_show){
$p['flg'] = $exist_show;
} else {
$p['flg'] = 2;
}
}
$exist_flg = 0;
for($i=0;$itouchBlock('__HowtoCook__');
$image_id = "process_".($i+1)."_image";
if($detail[0][$image_id] && $p['flg'] == 1){
$template->setVariable('image_id',$detail[0][$image_id]);
}
if($detail[0][$image_id]) {
$exist_flg++;
}
$template->setVariable('process',sprintf("%s.%s",$i + 1,$howto[$i]));
$template->setVariable('_process_num_',$i+1);
$template->setVariable('_process_howto_',get_filter($howto[$i]));
$template->parse('__HowtoCook__');
}
if($exist_flg == 0){
$template->hideBlock("__show__");
}else{
if(!$p['flg']) {
$template->touchBlock("__a1__");
$template->touchBlock("__t2__");
$template->setVariable("a1_rcp_no", $detail[0]['uniq_id']);
$template->hideBlock("__t1__");
$template->hideBlock("__a2__");
} else {
$image_show = get_ImageShow($p['uid'], $p['flg']);
if($p['flg'] == 1) {
$template->touchBlock("__t1__");
$template->touchBlock("__a2__");
$template->setVariable("a2_rcp_no", $detail[0]['uniq_id']);
$template->hideBlock("__a1__");
$template->hideBlock("__t2__");
}else{
$template->touchBlock("__t2__");
$template->touchBlock("__a1__");
$template->setVariable("a1_rcp_no", $detail[0]['uniq_id']);
$template->hideBlock("__a2__");
$template->hideBlock("__t1__");
}
}
}
//- MemoZbg
$template->setCurrentBlock('__Memo__');
$detail[0]['rcp_comment'] = str_replace("", '', $detail[0]['rcp_comment']);
$detail[0]['rcp_comment'] = str_replace('', '', $detail[0]['rcp_comment']);
$detail[0]['rcp_comment'] = str_replace('', '', $detail[0]['rcp_comment']);
$detail[0]['rcp_comment'] = get_filter($detail[0]['rcp_comment']);
$template->setVariable('memo',"".$detail[0]['rcp_comment']."");
$template->parseCurrentBlock();
$template->setVariable('rcp_no',$detail[0]['uniq_id']);
//- ¨CΙόθ Zbg
if( is_favorite($this->db,$detail[0]['uniq_id'],$p['uid']) ){
$template->setCurrentBlock('__FavoriteOff__');
$template->setVariable('rcp_no',$detail[0]['uniq_id']);
$template->setVariable('contents',$dir_name);
$template->parseCurrentBlock();
$template->hideBlock('__FavoriteOn__');
}else{
$template->setCurrentBlock('__FavoriteOn__');
$template->setVariable('rcp_no',$detail[0]['uniq_id']);
$template->setVariable('contents',$dir_name);
$template->parseCurrentBlock();
$template->hideBlock('__FavoriteOff__');
}
//- υπ
$p['pre_terms'] = serialize($p);
//}
//- access_log L^
//$ret = bsc_insert_acslog($this->db,$detail[0],"r",$p['uid']);
//- ίθURLZbg
$add_param = "";
if(!empty($p['vegetable'])){
$add_param .= sprintf("&p[vegetable]=%s",$p['vegetable']);
}
if(!empty($p['meat'])){
$add_param .= sprintf("&p[meat]=%s",$p['meat']);
}
if(!empty($p['fish'])){
$add_param .= sprintf("&p[fish]=%s",$p['fish']);
}
if(!empty($p['other'])){
$add_param .= sprintf("&p[other]=%s",$p['other']);
}
if(!empty($p['genre'])){
$add_param .= sprintf("&p[genre]=%s",$p['genre']);
}
if(!empty($p['ing_genre'])){
$add_param .= sprintf("&p[ing_genre]=%s",$p['ing_genre']);
}
if(!empty($p['cook'])){
$add_param .= sprintf("&p[cook]=%s",$p['cook']);
}
if(!empty($p['kind'])){
$add_param .= sprintf("&p[kind]=%s",$p['kind']);
}
if(!empty($p['theme'])){
$add_param .= sprintf("&p[theme]=%s",$p['theme']);
}
if(!empty($p['keywords'])){
$add_param .= sprintf("&p[keywords]=%s",$p['keywords']);
}
if(!empty($p['mode'])){
$add_param .= sprintf("&p[mode]=%s",$p['mode']);
}
$add_param = sprintf("?p[page]=%d%s",$p['page'],$add_param);
$template->setVariable('add_param',$add_param);
$ktkm = get_ktkm($p['id']);
$review = get_review($p['id']);
if($review)
{
$template->setVariable('review_count', $review['review_count']);
if($review['rating']){
$template->setVariable('prating', get_star($review['rating']));
}
if($review['value']){
$template->setVariable('value', $review['value'], 'hq');
}
$template->setVariable('r_user_name', $review['handle']);
$template->setVariable('ruurl', $review['user_url']);
$template->setVariable('r_create_datetime', $review['create_datetime']);
$template->setVariable('view_url', $review['review_url']);
$template->setVariable('vote_url', $review['vote_url']);
}
if($ktkm)
{
$template->setVariable('star', $ktkm['star']);
$template->setVariable('rstar', $ktkm['star']);
if($ktkm['ranking']){
foreach($ktkm['ranking'] as $k=> $v){
$template->touchBlock('__Rdata__');
$template->setVariable('url', $v['url']);
$v['theme_name'] = mb_ereg_replace( "\{_#i\w{4}_\}", "", $v['theme_name'] );
$template->setVariable('theme_name', $v['theme_name']);
$template->setVariable('rating_name', $v['rating_name']);
$template->setVariable('rating', get_star( $v['rating'] ));
$template->setVariable('rank', $v['rank']);
$template->parse('__Rdata__');
}
}
if($ktkm['photo']){
foreach($ktkm['photo'] as $k=> $v){
$template->touchBlock('__Pdata__');
$template->setVariable('photo', $v['picture_url']);
$template->setVariable('ptitle', $v['photo_title']);
$template->setVariable('user_name', $v['user_name']);
$template->setVariable('create_datetime', $v['create_datetime']);
$template->setVariable('uurl', $v['url']);
$template->setVariable('purl', $v['purl']);
$template->setVariable('ph_vote_url', $v['vote_url']);
$template->parse('__Pdata__');
}
if($ktkm['photo'][0]['view_url']){
$template->setVariable('p_view_url', $ktkm['photo'][0]['view_url']);
}
if($ktkm['photo'][0]['ph_rcnt']){
$template->setVariable('ph_rcnt', $ktkm['photo'][0]['ph_rcnt']);
}
}else{
$template->setVariable('ph_vote_url', $v['view_url']);
}
}
if($p['carrier'] == 'i'){
header( "Content-Type: application/xhtml+xml;charset=EUC-JP" );
}
if($p['carrier'] == 'i'){
header( "Content-Type: application/xhtml+xml;charset=EUC-JP" );
}
$template->show();
cs4_close($this->db);
}
function get_filter($data){
$data = str_replace('/search/','/search_new/',$data);
$data = str_replace('/jouzu/','/jouzu_new/',$data);
$data = str_replace('/kotu/','/kotu_new/',$data);
return $data;
}
function get_star($rating){
$rating = number_format($rating, 1);
if($rating < 1){
return "";
} else if($rating >= 1 && $rating < 2){
return "".$rating;
} else if($rating >= 2 && $rating < 3){
return "".$rating;
} else if($rating >= 3 && $rating < 4){
return "".$rating;
} else if($rating >= 4 && $rating < 5){
return "".$rating;
} else if($rating >=5){
return "".$rating;
}
}
search_detail( $p );
?>