require_once('../prepare.php');
require_once('lib/diary_function.php');
$free_flg = false;
//- メンバーチェック
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){
header("Location: ".MEMBER_REGIST_URL."?contents=".substr(strrchr(dirname( __FILE__ ) , '/'), 1));
exit;
}
u4user_close($db);
function diary_comment_detail( $p )
{
$this->db = cs4_open();
//- コメント取得
$comment_detail = get_UserCommentDetail($p['id']);
$comment_count = count($comment_detail);
//- 日記詳細
$diary_detail = get_DiaryDetail_id($comment_detail[0]['diary_id']);
//- レシピ写真サイズ判定
// $photo_size = (empty($p['p_size'])) ? '0' : '1' ;
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);
// テンプレート読み込み
$template =& loadTemplate( $p );
$template->setVariable('recipe_name',$comment_detail[0]['rcp_nm']);
$img_filename = array(sprintf("%s_n.jpg",$comment_detail[0]['uniq_id']),sprintf("%s_n-s.jpg",$comment_detail[0]['uniq_id']));
switch($photo_size){
case "0":
$img_path = sprintf("%s/%s",constant('IMG_DIR_COMMENT'),$img_filename[0]);
$another_url = sprintf("%s/%s",constant('IMG_DIR_COMMENT'),$img_filename[1]);
if(file_exists($img_path)){
$template->setCurrentBlock('__ShowImage__');
$template->setVariable('photo_link',sprintf("
",str_replace(KTY_SERVER_ROOT,"",$img_path)));
$template->parseCurrentBlock();
}
clearstatcache();
break;
case "1":
$img_path = sprintf("%s/%s",constant('IMG_DIR_COMMENT'),$img_filename[1]);
$another_url = sprintf("%s/%s",constant('IMG_DIR_COMMENT'),$img_filename[0]);
if(file_exists($img_path)){
$template->setCurrentBlock('__ShowImage__');
$template->setVariable('photo_link',sprintf("
",str_replace(KTY_SERVER_ROOT,"",$img_path)));
$template->parseCurrentBlock();
}
clearstatcache();
break;
default:
break;
}
//- 画像セット
/*
switch($photo_size){
case "0":
if(!empty($comment_detail[0]['test_kty_image'])){
$template->setCurrentBlock('__ShowImage__');
$template->setVariable('image_id',$comment_detail[0]['test_kty_image']);
$template->parseCurrentBlock();
}else{
$template->hideBlock('__ShowImage__');
}
break;
case "1":
if(!empty($comment_detail[0]['test_kty_image_mini'])){
$template->setCurrentBlock('__ShowImage__');
$template->setVariable('image_id',$comment_detail[0]['test_kty_image_mini']);
$template->parseCurrentBlock();
}else{
$template->hideBlock('__ShowImage__');
}
break;
}
*/
//- 公開日セット
$tmp = explode(" ",$comment_detail[0]['post_date']);
$date_arr = explode("-",$tmp[0]);
$day = get_Day(date("w",mktime(0,0,0,$date_arr[1],$date_arr[2],$date_arr[0])));
$date_str = sprintf("%d年%d月%d日",$date_arr[0],$date_arr[1],$date_arr[2]);
$template->setVariable('post_date',$date_str);
//- タイトルセット
$template->setVariable('title',$diary_detail[0]['title']);
//- 投稿者名セット
$template->setVariable('user_name',$comment_detail[0]['contributor']);
//- 本文セット
$template->setVariable('body',$comment_detail[0]['body']);
$template->hideBlock('__Toll__');
//- コンテンツトップ戻りリンク
if(strstr(date("Y-m-d"),$comment_detail[0]['post_date'])){
$template->hideBlock('__ReturnContentsTop__');
}else{
$template->setCurrentBlock('__ReturnContentsTop__');
$template->setVariable('contents_top_url','comment_detail.php');
$template->setVariable('contents_top',DIARY_NAME);
$template->parseCurrentBlock();
}
$template->show();
cs4_close($this->db);
}
diary_comment_detail( $p );
?>