require_once('../prepare.php');
require_once('lib/myrecipe_function.php');
//- 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){
header("Location: " . MEMBER_REGIST_URL . "?p[contents]=" . substr(strrchr(dirname( __FILE__ ) , '/'), 1));
exit;
}
u4user_close($db);
//- [Uf[^o^Οέ`FbN
$user_data = is_MyRecipeUser($p);
function myrecipe_top( $p , $user_data)
{
$terms_arr = get_Terms();
$this->db = cs4_open();
//- }CBAD+A581EDΕmκ[δΔ¦εΨ[main]Ψ[sub])
$myrecipe_list = get_MyRecipe($p['uid'],$user_data[0]);
//- \¦·EδYΗξY’ιΎΰcqd
if(!empty($myrecipe_list['main'])){
$nowdate_count = (mktime(0,0,0,date("m"),date("d"),date("Y")) - mktime(0,0,0,1,1,2005)) / (24*60*60);
$main_index = $nowdate_count % count($myrecipe_list['main']);
if(DEBUG_MODE){
print "
εΨ -> ";
print ($main_index + 1)."/".count($myrecipe_list['main'])." ( view / total )";
//var_dump($myrecipe_list['main']);
print "
RecipeID => ";
foreach($myrecipe_list['main'] as $key => $val){
print ($i + 1)."/".$val['rcp_no'].",";
$i++;
}
print "
";
}
}
if(!empty($myrecipe_list['sub'])){
$nowdate_count = (mktime(0,0,0,date("m"),date("d"),date("Y")) - mktime(0,0,0,1,1,2005)) / (24*60*60);
$sub_index = $nowdate_count % count($myrecipe_list['sub']);
if(DEBUG_MODE){
print "
Ψ -> ";
print ($sub_index + 1)."/".count($myrecipe_list['sub'])." ( view / total )";
//var_dump($myrecipe_list['sub']);
print "
RecipeID => ";
foreach($myrecipe_list['sub'] as $key => $val){
print ($ix + 1)."/".$val['rcp_no'].",";
$ix++;
}
print "
";
}
//- εHΖ―ΆΙΘΑ½Μ -- BTS No.44 Ξ by Aida 06/02/02
if(!empty($myrecipe_list['main'])){
if($myrecipe_list['main'][$main_index]['rcp_no'] == $myrecipe_list['sub'][$sub_index]['rcp_no']){
//- ΨͺE’’C’εgκh[
if(1 >= count($myrecipe_list['sub'])){
$myrecipe_list['sub'] = "";
}else{
$sub_index++;
}
}
}
}
cs4_close($this->db);
// evBAD+A581E£ΔCΰXο’BAD+DF8D
$template =& loadTemplate( $p );
//- myrecipe
if(!empty($myrecipe_list['main'])){
if(('i' == $p['carrier'] && '2' == $p['version']) || ('v' == $p['carrier'] && '3' == $p['version']) || ('e' == $p['carrier'] && '3' == $p['version']) || ('w' == $p['carrier']) || ('g' == $p['carrier'])){
$thumbnail_path = sprintf("%s/%s_n-thm.jpg",IMG_DIR_RECIPE,$myrecipe_list['main'][$main_index]['rcp_no']);
if(file_exists($thumbnail_path)){
$template->setCurrentBlock('__ImageLinkMain__');
$template->setVariable('image_id',$myrecipe_list['main'][$main_index]['rcp_no']);
$template->parseCurrentBlock();
}
}
$template->setCurrentBlock('__Main__');
$template->setVariable('phrase',$myrecipe_list['main'][$main_index]['rcp_exp']);
$template->setVariable('rcp_no',$myrecipe_list['main'][$main_index]['rcp_no']);
$template->setVariable('title',$myrecipe_list['main'][$main_index]['rcp_nm']);
$template->parseCurrentBlock();
}else{
$template->hideBlock('__Main__');
$template->TouchBlock('__NoMain__');
}
if(!empty($myrecipe_list['sub'])){
if(('i' == $p['carrier'] && '2' == $p['version']) || ('v' == $p['carrier'] && '3' == $p['version']) || ('e' == $p['carrier'] && '3' == $p['version']) || ('w' == $p['carrier']) || ('g' == $p['carrier'])){
$thumbnail_path = sprintf("%s/%s_n-thm.jpg",IMG_DIR_RECIPE,$myrecipe_list['sub'][$sub_index]['rcp_no']);
if(file_exists($thumbnail_path)){
$template->setCurrentBlock('__ImageLinkSub__');
$template->setVariable('image_id',$myrecipe_list['sub'][$sub_index]['rcp_no']);
$template->parseCurrentBlock();
}
}
$template->setCurrentBlock('__Sub__');
$template->setVariable('phrase',$myrecipe_list['sub'][$sub_index]['rcp_exp']);
$template->setVariable('rcp_no',$myrecipe_list['sub'][$sub_index]['rcp_no']);
$template->setVariable('title',$myrecipe_list['sub'][$sub_index]['rcp_nm']);
$template->parseCurrentBlock();
}else{
$template->hideBlock('__Sub__');
$template->TouchBlock('__NoSub__');
}
//- f[^ΟXphiddenp[^Zbg
foreach($terms_arr as $tmp_key => $tmp_val){
foreach($terms_arr[$tmp_key] as $key => $val){
if(1 == $user_data[0][$key]){
$template->setCurrentBlock('__HiddenParam__');
$template->setVariable('name',$key);
$template->parseCurrentBlock();
}
}
}
$template->show();
}
myrecipe_top( $p , $user_data);
?>