include("inc_global.php"); include("inc_function.php"); include("inc_presswork.php"); chk_subscription(); if ($md == "guest_db") { check_ip_block(); $host1 = parse_url($HTTP_REFERER); $host2 = parse_url($s_root_path); if ($host1[host] != $host2[host]) error_process("01B1"); if ($guest_input_homepage == "http://") $guest_input_homepage = ""; if ($act != "edit") { setcookie ("c_guest_name", $guest_input_name, time()+60*60*24*30); setcookie ("c_guest_homepage", $guest_input_homepage, time()+60*60*24*30); setcookie ("c_guest_icon", $guest_select_icon, time()+60*60*24*30); } $guest_select_icon = get_private_icon($guest_select_icon, $guest_input_name, $guest_input_password, $guest_input_homepage); list($width, $height) = get_icon_size($guest_select_icon); if (!$guest_input_password) $guest_input_password = get_timestamp3(); if (!return_authority()) { $guest_input_name = str_tag_off($guest_input_name); $guest_input_homepage = str_tag_off($guest_input_homepage); $guest_select_icon = str_tag_off($guest_select_icon); $guest_textarea_body = str_tag_off($guest_textarea_body); } if (!$sort) $sort = 1; switch ($act) { case "insert" : if (!return_authority() && ($p_gue_perm == 0 || $p_gue_perm == 2)) error_process("01B4"); put_query (" insert into t3_".$dbid."_guest ( sortno , name, homepage, icon, icon_width, icon_height, body, password , regdate, ip ) values ( '".(get_maxval("t3_".$dbid."_guest", "sortno", null)+1)."' , '$guest_input_name', '$guest_input_homepage', '$guest_select_icon', '$width', '$height', '$guest_textarea_body', password('$guest_input_password') , '".time()."', '$REMOTE_ADDR' ) "); header("Location: $r_root_path"."index.php?md=guest"); break; case "reply" : if (!return_authority() && ($p_gue_perm == 0 || $p_gue_perm == 1)) error_process("01B5"); put_query(" insert into t3_".$dbid."_guest_reply ( pno , name, homepage, icon, icon_width, icon_height, body, password , regdate, ip ) values ( '$num' , '$guest_input_name', '$guest_input_homepage', '$guest_select_icon', '$width', '$height', '$guest_textarea_body', password('$guest_input_password') , '".time()."', '$REMOTE_ADDR' ) "); put_query(" update t3_".$dbid."_guest set sortno = '".(get_maxval("t3_".$dbid."_guest", "sortno", null)+1)."' where no = '$num' "); ?> break; case "edit" : $tab = "t3_".$dbid."_guest"; $set = "gue$num"; if ($pnum) { $tab .= "_reply"; $set = "gue$pnum"."_"."$num"; } $sql = "select password('$guest_input_password')"; list ($del_pass) = mysql_fetch_array(mysql_query($sql)); $sql = "select password from $tab where no = '$num'"; list ($db_pass) = mysql_fetch_array(mysql_query($sql)); if ($del_pass == $db_pass || return_authority()) { put_query (" update $tab set name = '$guest_input_name' , homepage = '$guest_input_homepage' , icon = '$guest_select_icon' , icon_width = '$width' , icon_height = '$height' , body = '$guest_textarea_body' where no = '$num' "); } else error_process("02B1"); ?> break; } exit; } unset($add_query, $add_val); if (!$page) $page = 1; if ($md == "guest") $pagelog = $p_gue_page_cnt; else $pagelog = $p_page_cnt; $start = ($page - 1) * $pagelog; $end = $pagelog; if (return_authority()) $is_public = "1"; else $is_public = "is_public = '1'"; if ($ct1) { if ($ct1 != -1) $add_query .= " and category1 = '$ct1' "; $add_val .= "&ct1=$ct1"; } if ($ct2) { $add_query .= " and category2 = '$ct2' "; $add_val .= "&ct2=$ct2"; } if ($setdate) { $add_query .= " and from_unixtime(regdate, '%Y%m') = '$setdate' "; $add_val .= "&setdate=".$setdate;} if ($setday) { $add_query .= " and from_unixtime(regdate, '%e') = '$setday' "; $add_val .= "&setday=".$setday; } if ($stext) { $stext = str_replace("%", "", $stext); $add_query .= " and (title like ('%$stext%') or body like ('%$stext%')) "; $add_val .= "&stext=".urlencode($stext); } if ($md == "pl") { $sql = "select no from t3_".$dbid." where $is_public $add_query order by regdate desc limit ".($page-1).", 1"; // print $sql; list ($pl) = mysql_fetch_array(mysql_query($sql)); header("Location: index.php?pl=$pl".str_replace("&", "&", $add_val)); exit; } $time_skin = chk_time($time_skin); $skin = new set_skin(); $time_skin = chk_time($time_skin); if (!$HTTP_COOKIE_VARS["c_count"]) set_count(); setcookie ("c_count", "1", time()+60*60); ob_start(); ?>
$post_d1 = ob_get_contents(); ob_end_clean(); $d0 = $skin->s_s; $d1 = str_replace("[##_s_t3_##]", $pre_d1.$skin->s_t3."[##_shortcut_script_##]".$post_d1, $d0); $image = $s_attach_path."image/".$p_imagefile; if (!$p_imagefile) $image = "images/spacer.gif"; $d1 = str_replace("[##_url_##]", "", $d1); $d1 = str_replace("[##_title_##]", "$p_title", $d1); $d1 = str_replace("[##_image_##]", $image, $d1); $d1 = str_replace("[##_onclick_image_##]", "window.open('image_pop.php?imagefile=$s_attach_path"."image/"."$p_imagefile&width=$p_width&height=$p_height','s_im','width=$p_width,height=$p_height,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0')", $d1); $d1 = str_replace("[##_desc_##]", $p_description, $d1); $d1 = str_replace("[##_search_text_##]", $stext, $d1); $d1 = str_replace("[##_search_name_##]", "search", $d1); $d1 = str_replace("[##_search_onclick_submit_##]", "window.location.href='index.php?stext='+document.weblog.search.value; return false;", $d1); if (strpos($d1, "[##_count_total_##]")) { $sql = "select sum(count) from t3_".$dbid."_count"; list ($sum) = mysql_fetch_array(mysql_query($sql)); $d1 = str_replace("[##_count_total_##]", $sum+$p_icount, $d1); } if (strpos($d1, "[##_count_today_##]") || strpos($d1, "[##_count_yesterday_##]")) { $day_count1 = 0; $day_count2 = 0; $sql = "select set_date, count from t3_".$dbid."_count where set_date between '".date("Ymd", mktime(0, 0, 0, date(m), date(d)-1, date(Y)))."' and '".date("Ymd")."' order by set_date asc"; $result = @mysql_query($sql); while(list($date, $count) = @mysql_fetch_array($result)) { if (date("Ymd") == $date) $day_count1 = $count; else $day_count2 = $count; } $d1 = str_replace("[##_count_today_##]", $day_count1, $d1); $d1 = str_replace("[##_count_yesterday_##]", $day_count2, $d1); } if ($pl) { $sql = "select regdate from t3_".$dbid." where no = '$pl'"; list ($rd) = mysql_fetch_array(mysql_query($sql)); $sql = "select count(*) from t3_".$dbid." where $is_public $add_query and regdate > '$rd'"; list ($r_cnt) = mysql_fetch_array(mysql_query($sql)); $start = $r_cnt; $end = 1; $page = $start+1; $pagelog = 1; $md = "pl"; } unset($p, $p2, $add_str); while(1) { if ($md == "rss" || $md == "guest" || ($ct1 && ($p_select_cat_view == 2)) || (($setdate || $setday) && ($p_select_arc_view == 2)) || ($stext && $pl) || $page != 1 || $pl || !($setdate || $setday || $stext || $ct1 || $ct2)) break; $p = $skin->s_list; $sql = "select no, category1, category2, title, user_id, image_file_path1, image_file_path2, regdate, rp_cnt from t3_".$dbid." where $is_public $add_query order by regdate desc"; // print $sql; $result = @mysql_query($sql); $list_count = mysql_num_rows($result); while(list($no, $category1, $category2, $title, $user_id, $image_file_path1, $image_file_path2, $regdate, $rp_cnt) = @mysql_fetch_array($result)) { if ($rp_cnt) $rp_cnt = "($rp_cnt)"; else $rp_cnt = ""; $p2_rp = $skin->s_list_rep; $p2_rp = str_replace("[##_list_rep_title_##]", $title, $p2_rp); $p2_rp = str_replace("[##_list_rep_link_##]", "index.php?pl=$no".$add_val, $p2_rp); $p2_rp = str_replace("[##_list_rep_regdate_##]", get_timevalue1($regdate), $p2_rp); $p2_rp = str_replace("[##_list_rep_rp_cnt_##]", $rp_cnt, $p2_rp); $p2 .= $p2_rp; } if ($ct2) $add_str = " - '".get_category2_label($ct2)."'"; if ($ct1) $p = str_replace("[##_list_conform_##]", "分類 '".get_category1_label($ct1)."' $add_str", $p); unset($add_str); if ($setday) $add_str = " ".$setday."日 "; if ($setdate) $p = str_replace("[##_list_conform_##]", substr($setdate,0,4)."年 ".intval(substr($setdate,4))."月".$add_str, $p); if ($stext) $p = str_replace("[##_list_conform_##]", "搜索 '$stext'", $p); $p = str_replace("[##_list_count_##]", $list_count, $p); $p = str_replace("[##_s_list_rep_##]", $p2, $p); break; } if (strpos($d1, "[##_s_list_##]")) $d1 = str_replace("[##_s_list_##]", $p, $d1); unset($p, $p2); if (!$pl && $stext) { $p = $skin->s_rplist; $sql = "select no, pno, name, body, regdate from t3_".$dbid."_reply where ".(return_authority()?(""):("is_secret = '0' and"))." (name like ('%$stext%') or body like ('%$stext%')) order by no desc"; // print $sql; $result = @mysql_query($sql); $rp_cnt = mysql_num_rows($result); while(list($no, $pno, $name, $body, $regdate) = @mysql_fetch_array($result)) { $p2_rp = $skin->s_rplist_rep; $p2_rp = str_replace("[##_rplist_rep_link_##]", $PHP_SELF."?pl=$pno#r$no", $p2_rp); $p2_rp = str_replace("[##_rplist_rep_regdate_##]", get_timevalue1($regdate), $p2_rp); $p2_rp = str_replace("[##_rplist_rep_name_##]", $name, $p2_rp); $p2_rp = str_replace("[##_rplist_rep_body_##]", str_cut($body, 50, 0), $p2_rp); $p2 .= $p2_rp; } if ($stext) $p = str_replace("[##_rplist_conform_##]", "搜索 '$stext'", $p); $p = str_replace("[##_rplist_count_##]", $rp_cnt, $p); } $p = str_replace("[##_s_rplist_rep_##]", $p2, $p); $d1 = str_replace("[##_s_rplist_##]", $p, $d1); while(1) { if ($md == "rss" || $md == "guest" || ($ct1 && $p_select_cat_view == 1 && !$pl) || (($setdate || $setday) && $p_select_arc_view == 1 && !$pl) || ($stext && !$pl)) break; $sql = "select count(*) from t3_".$dbid." where $is_public $add_query"; list ($t_cnt) = mysql_fetch_array(mysql_query($sql)); $sql = " select no, category1, category2, title, body , user_id, image_file_path1, image_file_path2, regdate , rp_cnt, tb_cnt, is_sync, is_public , perm_rp, perm_tb from t3_".$dbid." where $is_public $add_query order by regdate desc limit $start, $end "; // print $sql; $result = @mysql_query($sql); while(list( $no, $category1, $category2, $title, $body , $user_id, $image_file_path1, $image_file_path2, $regdate , $rp_cnt, $tb_cnt, $is_sync, $is_public_set , $perm_rp, $perm_tb ) = @mysql_fetch_array($result)) { unset($plbuffer); $set_tb = 0; $set_rp = 0; if (return_authority()) { $perm_tb = 1; $perm_rp = 1; } if ($pl || $p_show_preview) { if ($perm_tb && ($pl || $p_show_preview != 1)) { $plbuffer = get_tb_content($skin, $no); $set_tb = 1; } if ($perm_rp && ($pl || $p_show_preview != 2)) { $plbuffer .= get_rp_content($skin, $no); $set_rp = 1; } } unset ($perm_rp_link, $perm_tb_link); $category = get_category1_label($category1); if ($category2) $category .= " - ".get_category2_label($category2); if ($rp_cnt) $rp_cnt = "($rp_cnt)"; else $rp_cnt = ""; if ($tb_cnt) $tb_cnt = "($tb_cnt)"; else $tb_cnt = ""; $d2_rp = $skin->s_article_rep; $d2_rp = str_replace("[##_s_tb_##]", "", $d2_rp); $d2_rp = str_replace("[##_s_rp_##]", "", $d2_rp); $d2_rp = str_replace("[##_article_rep_title_##]", $title, $d2_rp); $d2_rp = str_replace("[##_article_rep_desc_##]", set_moreless( nl2brc( set_keyword( attach_image( 1, $body, $s_root_path, $r_root_path, $attach_path.$image_file_path1.$image_file_path2 ), $is_sync ) ), $no ), $d2_rp ); if ($perm_rp) $perm_rp_link = "onclick_addexe('$no', 'post_$no', weblog.post_$no"."_div_rp, weblog.post_$no"."_div_tb, 'rp'); return false;"; else $perm_rp_link = "alert('對不起,此文章日誌不允許訪客回覆.\\t'); return false;"; if ($perm_tb) $perm_tb_link = "onclick_addexe('$no', 'post_$no', weblog.post_$no"."_div_tb, weblog.post_$no"."_div_rp, 'tb'); return false;"; else $perm_tb_link = "alert('對不起,此文章日誌不接受文章引用傳送.\\t'); return false;"; $d2_rp = str_replace("[##_article_rep_name_##]", $user_id, $d2_rp); $d2_rp = str_replace("[##_article_rep_date_##]", get_timevalue1($regdate)." ".get_timevalue3($regdate), $d2_rp); $d2_rp = str_replace("[##_article_rep_link_##]", $PHP_SELF."?pl=$no".$add_val, $d2_rp); $d2_rp = str_replace("[##_article_rep_category_##]", $category, $d2_rp); $d2_rp = str_replace("[##_article_rep_category_link_##]", "index.php?ct1=$category1&ct2=$category2", $d2_rp); $d2_rp = str_replace("[##_article_div_area_##]", "