www.gusucode.com > Tatter Tools 0.961 SE GB2312 简体中文版 > upload/inc_presswork.php
<? function get_category() { global $db, $dbid, $p_tree, $p_tree_limit, $s_tree_path; $g_array = array(); $m_array = array(); $total_cnt = 0; $sql = "select no, sortno, label, cnt from t3_".$dbid."_ct1 order by sortno asc"; $result = @mysql_query($sql); while(list($pno, $psortno, $plabel, $pcnt) = @mysql_fetch_array($result)) { $sql = "select no, sortno, label, cnt from t3_".$dbid."_ct2 where pno = $pno order by sortno asc"; $result2 = @mysql_query($sql); while(list($no, $sortno, $label, $cnt) = @mysql_fetch_array($result2)) { array_push($m_array, array("num"=>$no, "label"=>$label, "link"=>"window.location.href='index.php?ct1=$pno&ct2=$no';", "cnt"=>$cnt)); } array_push($g_array , array("num"=>$pno, "label"=>$plabel, "link"=>"window.location.href='index.php?ct1=$pno';", "cnt"=>$pcnt, "items"=>$m_array)); $m_array = array(); $total_cnt += $pcnt; } $rtval = array("label"=>"所有网志分类文章", "link"=>"window.location.href='index.php?ct1=-1';", "cnt" => $total_cnt); if (count($g_array)) { ob_start(); print_tree($rtval, $g_array, $p_tree_limit, $s_tree_path.$p_tree."/",0); $tree_str = ob_get_contents(); ob_end_clean(); } return $tree_str; } function get_calendar() { global $db, $dbid, $setdate, $is_public; if (!$setdate) $setdate2 = date("Ym"); else $setdate2 = $setdate; list($cal, $lastyear, $lastmonth, $nextyear, $nextmonth) = get_cal_array($setdate2); $thisyear = substr($setdate2,0,4); $thismonth = substr($setdate2,4); $wset = array(); $sql = "select distinct FROM_UNIXTIME(regdate, '%e') from t3_".$dbid." where $is_public and FROM_UNIXTIME(regdate, '%Y,%m') = '$thisyear,$thismonth'"; $result = @mysql_query($sql); while(list($regdate) = @mysql_fetch_array($result)) array_push($wset, $regdate); $wset = array_flip($wset); ob_start(); ?> <table cellpadding="0" cellspacing="0" width="100%"><tr> <td class="cal_month"> <a href="<?=$PHP_SELF?>?setdate=<?=$lastyear.$lastmonth?>"><<</a> <a href="<?=$PHP_SELF?>?setdate=<?=$thisyear.$thismonth?>"><?=$thisyear." ".date("M", mktime(0,0,0,$thismonth,1,2004))?></a> <a href="<?=$PHP_SELF?>?setdate=<?=$nextyear.$nextmonth?>">>></a> </td> </tr></table> <table cellpadding="0" cellspacing="1" width="100%"><tr> <td class="cal_week2">日</td> <td width="14.2%" class="cal_week1">一</td> <td width="14.2%" class="cal_week1">二</td> <td width="14.2%" class="cal_week1">三</td> <td width="14.2%" class="cal_week1">四</td> <td width="14.2%" class="cal_week1">五</td> <td width="14.2%" class="cal_week1">六</td> </tr> <? foreach ($cal as $k => $row) { unset($c_class); if ($row[month] == $lastmonth) $c_class = "cal_day1"; else if ($row[month] == $nextmonth) $c_class = "cal_day2"; else if ($row[day] == date("d") && $row[month] == date("m") && $row[year] == date("Y")) $c_class = "cal_day4"; else $c_class = "cal_day3"; if (isset($wset[$row[day]]) && $row[month] == $thismonth) $row[day] = "<a class=\"cal_click\" href=\"$PHP_SELF?setdate=".$thisyear.$thismonth."&setday=".$row[day]."\">".$row[day]."</a>"; if ($row[week] == 0) { ?><tr><? } ?><td class="<?=$c_class?>"><?=$row[day]?></td><? if ($row[week] == 6) { ?></tr><? } } ?> </table> <? $cal_str = ob_get_contents(); ob_end_clean(); return $cal_str; } function get_rcttb_rep() { global $db, $dbid, $p_rct_tb_cnt, $p_rct_tb_trunc; unset($p); $sql = "select no, pno, site, url, title, body, regdate, ip from t3_".$dbid."_trackback order by no desc limit 0, $p_rct_tb_cnt"; // print $sql; $result = @mysql_query($sql); while(list($no, $pno, $site, $url, $title, $body, $regdate, $ip) = @mysql_fetch_array($result)) { $p_rep = $GLOBALS["skin"]->s_rcttb_rep; $p_rep = str_replace("[##_rcttb_rep_link_##]", "index.php?pl=$pno#t$no", $p_rep); $p_rep = str_replace("[##_rcttb_rep_desc_##]", str_cut($title,$p_rct_tb_trunc,0), $p_rep); $p_rep = str_replace("[##_rcttb_rep_name_##]", $site, $p_rep); $p_rep = str_replace("[##_rcttb_rep_time_##]", get_timevalue0($regdate, 2), $p_rep); $p .= $p_rep; } return $p; } function get_rctrp_rep() { global $db, $dbid, $p_rct_rp_cnt, $p_rct_rp_trunc, $emoticon; unset($p); $sql = "select no, pno, name, body, regdate, is_secret from t3_".$dbid."_reply order by no desc limit 0, $p_rct_rp_cnt"; // print $sql; $result = @mysql_query($sql); while(list($no, $pno, $name, $body, $regdate, $is_secret) = @mysql_fetch_array($result)) { if (return_authority()) $is_admin = 1; else $is_admin = 0; if ($is_secret && !$is_admin) $name = "秘密回复"; if ($is_secret && !$is_admin) $body = "只有管理员才有权限查看."; $p_rep = $GLOBALS["skin"]->s_rctrp_rep; $p_rep = str_replace("[##_rctrp_rep_link_##]", "index.php?pl=$pno#r$no", $p_rep); $p_rep = str_replace("[##_rctrp_rep_desc_##]", str_cut($body, $p_rct_rp_trunc, 0), $p_rep); $p_rep = str_replace("[##_rctrp_rep_name_##]", $name, $p_rep); $p_rep = str_replace("[##_rctrp_rep_time_##]", get_timevalue0($regdate, 2), $p_rep); $p .= $p_rep; } return $p; } function get_rctps_rep() { global $db, $dbid, $is_public, $p_rct_ps_cnt, $p_rct_ps_trunc; unset($p); $sql = "select no, title, rp_cnt from t3_".$dbid." where $is_public order by regdate desc limit 0, $p_rct_ps_cnt"; // print $sql; $result = @mysql_query($sql); while(list($no, $title, $rp_cnt) = @mysql_fetch_array($result)) { if ($rp_cnt) $rp_cnt = "($rp_cnt)"; else $rp_cnt = ""; $p_rep = $GLOBALS["skin"]->s_rctps_rep; $p_rep = str_replace("[##_rctps_rep_link_##]", "index.php?pl=$no", $p_rep); $p_rep = str_replace("[##_rctps_rep_title_##]", str_cut($title, $p_rct_ps_trunc, 1), $p_rep); $p_rep = str_replace("[##_rctps_rep_rp_cnt_##]", $rp_cnt, $p_rep); $p .= $p_rep; } return $p; } function get_archive() { global $db, $dbid, $is_public, $setdate; unset($p); if (!$setdate) { $setdate = date("Ym"); $q_limit = "limit 0, 5"; } list($cal, $lastyear, $lastmonth, $nextyear, $nextmonth) = get_cal_array($setdate); $thisyear = substr($setdate,0,4); $thismonth = substr($setdate,4); $sql = "select distinct FROM_UNIXTIME(regdate, '%Y,%m') from t3_".$dbid." where $is_public order by regdate desc $q_limit"; $result = @mysql_query($sql); while(list($regdate) = @mysql_fetch_array($result)) { list ($p_year, $p_month) = split(",", $regdate); $p_rep = $GLOBALS["skin"]->s_archive_rep; $p_rep = str_replace("[##_archive_rep_link_##]", "index.php?setdate=$p_year".$p_month, $p_rep); $p_rep = str_replace("[##_archive_rep_date_##]", $p_year."年 ".$p_month."月", $p_rep); $p .= $p_rep; } return $p; } function get_link_rep() { global $db, $dbid, $p_link_trunc; unset($p); $sql = "select no, type, xml_url, title, link, regdate from t3_".$dbid."_link order by title asc"; $result = @mysql_query($sql); while(list($no, $type, $xml_url, $title, $link, $regdate) = @mysql_fetch_array($result)) { $p_rep = $GLOBALS["skin"]->s_link_rep; $p_rep = str_replace("[##_link_url_##]", $link, $p_rep); $p_rep = str_replace("[##_link_site_##]", str_cut($title, $p_link_trunc, 1), $p_rep); $p .= $p_rep; } return $p; } function get_rss(){ global $db, $dbid, $md, $p_rssp_limit; unset($p, $p2, $p3, $ext); $nd_set = array(); $p = $GLOBALS["skin"]->s_rss; if ($md != "rss") return null; if (return_authority()) $is_public = 1; $sql = "select no from t3_".$dbid."_rss where is_public = '1'"; $result = @mysql_query($sql); while(list($no) = @mysql_fetch_array($result)) $nd_set[] = $no; $limit = mktime(0, 0, 0, date("m"), date("d")-$p_rssp_limit, date("Y")); if (strpos($p, "[##_s_rss_date_##]")) { $sql = "select no, rno, title, link, creator, regdate from t3_".$dbid."_rss_item where regdate between $limit and ".(time()+300)." order by regdate desc"; // print $sql; $result = @mysql_query($sql); while(list($no, $rno, $title, $link, $creator, $regdate) = @mysql_fetch_array($result)) { if (!($is_public || in_array($rno, $nd_set))) continue; $regdate2 = date("ymd", $regdate); if ($predate != $regdate2) { $p2 = str_replace("[##_s_rss_rep_##]", $p3, $p2); unset($p3); $predate = $regdate2; $p2_rep = $GLOBALS["skin"]->s_rss_date; $p2_rep = str_replace("[##_rss_year_##]", date("Y", $regdate), $p2_rep); $p2_rep = str_replace("[##_rss_month_##]", date("n", $regdate), $p2_rep); $p2_rep = str_replace("[##_rss_day_##]", date("j", $regdate), $p2_rep); $p2 .= $p2_rep; } $p3_rep = $GLOBALS["skin"]->s_rss_rep; $p3_rep = str_replace("[##_rss_url_##]", $link, $p3_rep); $p3_rep = str_replace("[##_rss_title_##]", $title, $p3_rep); $p3_rep = str_replace("[##_rss_creator_##]", str_tag_truncate($creator), $p3_rep); $p3 .= $p3_rep; } $p2 = str_replace("[##_s_rss_rep_##]", $p3, $p2); } $p = str_replace("[##_s_rss_date_##]", $p2, $p); return $p; } function get_keyword(){ global $db, $dbid, $md, $sort, $r_root_path; if ($md != "keyword") return null; if (!$sort) $sort = 2; if ($sort == 1) $order = "order by regdate desc"; else if ($sort == 2) $order = "order by keyword asc"; $p = $GLOBALS["skin"]->s_keyword; $p = str_replace("[##_keyword_sort1_##]", "index.php?md=keyword&sort=1", $p); $p = str_replace("[##_keyword_sort2_##]", "index.php?md=keyword&sort=2", $p); if (strpos($p, "[##_s_keyword_rep_##]")) { $sql = "select no, sortno, keyword, body, image_file_path1, image_file_path2, regdate, is_public, is_sync from t3_".$dbid."_keyword where is_public = '1' $order"; // print $sql; $result = @mysql_query($sql); while(list($no, $sortno, $keyword, $body, $image_file_path1, $image_file_path2, $regdate, $is_public, $is_sync) = @mysql_fetch_array($result)) { $p3_rep = $GLOBALS["skin"]->s_keyword_rep; $regdate2 = date("ymd", $regdate); unset($p2_rep); if ($predate != $regdate2 && $sort == 1) { $p2_rep = $GLOBALS["skin"]->s_keyword_date_rep; $p2_rep = str_replace("[##_keyword_year_##]", date("Y", $regdate), $p2_rep); $p2_rep = str_replace("[##_keyword_month_##]", date("n", $regdate), $p2_rep); $p2_rep = str_replace("[##_keyword_day_##]", date("j", $regdate), $p2_rep); } $predate = $regdate2; $p3_rep = str_replace("[##_onclick_keyword_##]", "keyword_open('".$r_root_path."kview.php?kd=".urlencode($keyword)."'); return false;", $p3_rep); $p3_rep = str_replace("[##_keyword_label_##]", $keyword, $p3_rep); $p3 .= $p2_rep.$p3_rep; } } $p = str_replace("[##_s_keyword_rep_##]", $p3, $p); $p = str_replace("[##_s_keyword_date_rep_##]", "", $p); return $p; } function get_local() { global $db, $dbid, $md; if ($md != "local") return null; $p = $GLOBALS["skin"]->s_local; if (strpos($p, "[##_s_local_spot_rep_##]")) { $sql = "select no, title, local_info, regdate from t3_".$dbid." where local_info != '' and is_public = '1' order by local_info asc, regdate desc"; // print $sql; $result = @mysql_query($sql); while(list($no, $title, $local_info, $regdate) = @mysql_fetch_array($result)) { $lset = explode(" > ", $local_info); $plset = explode(" > ", $p_local_info); $depth = "0"; for($i=0; $i<count($lset); $i++) { $p3_rep = $GLOBALS["skin"]->s_local_spot_rep; $p3_rep = str_replace("[##_local_spot_depth_##]", $depth, $p3_rep); $p3_rep = str_replace("[##_local_spot_##]", trim($lset[$i]), $p3_rep); if ($lset[$i] != $plset[$i]) $p3 .= $p3_rep; $depth += 20; } $p2_rep = $GLOBALS["skin"]->s_local_info_rep; $p2_rep = str_replace("[##_local_info_depth_##]", $depth, $p2_rep); $p2_rep = str_replace("[##_local_info_link_##]", "index.php?pl=".$no, $p2_rep); $p2_rep = str_replace("[##_local_info_title_##]", $title, $p2_rep); $p3 .= $p2_rep; $p_local_info = $local_info; } } $p = str_replace("[##_s_local_spot_rep_##]", $p3, $p); $p = str_replace("[##_s_local_info_rep_##]", "", $p); return $p; } function get_guest() { global $db, $dbid, $HTTP_COOKIE_VARS, $md, $act, $s_icon_path, $page, $pagelog, $sort, $num, $pnum, $o_num, $emoticon; unset($p, $p2, $p3, $add_cond, $set_form, $where_query, $icons); if ($md != "guest") return null; $p = $GLOBALS["skin"]->s_guest; $p = str_replace("[##_s_guest_form_##]", "", $p); $p = str_replace("[##_guest_sort1_##]", "index.php?md=guest&sort=1", $p); $p = str_replace("[##_guest_sort2_##]", "index.php?md=guest&sort=2", $p); $c_guest_name = stripslashes(stripslashes($HTTP_COOKIE_VARS["c_guest_name"])); $c_guest_homepage = stripslashes($HTTP_COOKIE_VARS["c_guest_homepage"]); $c_guest_icon = stripslashes($HTTP_COOKIE_VARS["c_guest_icon"]); $c_guest_body = ""; if (!$c_guest_homepage) $c_guest_homepage = "http://"; if (return_authority()) $add_cond = ", '3'"; if (!$act) $act = "list"; $p2 = $GLOBALS["skin"]->s_guest_form; switch ($act) { case "list": $p = str_replace("[##_guest_form_area2_##]", "", $p); $p2 = str_replace("[##_guest_onclick_submit_##]", "onclick_insert_guest(document.weblog, 'insert', null, '$page', '$sort'); return false;", $p2); $set_form = "[##_guest_form_area1_##]"; break; case "edit": $p = str_replace("[##_guest_form_area1_##]", "", $p); $p = str_replace("[##_s_guest_rep_##]", "", $p); $p = str_replace("[##_s_guest_link_rep_##]", "", $p); $p2 = str_replace("[##_guest_onclick_submit_##]", "onclick_edit_guest(document.weblog, '$pnum', '$num', '$page', '$sort'); return false;", $p2); $set_form = "[##_guest_form_area2_##]"; list($name, $homepage, $icon, $body) = get_guest_edit_info($pnum, $num); $where_query = "where no = '$num'"; $c_guest_name = $name; $c_guest_homepage = $homepage; $c_guest_body = $body; $c_guest_icon = $icon; break; case "reply": $p = str_replace("[##_guest_form_area1_##]", "", $p); $p = str_replace("[##_s_guest_link_rep_##]", "", $p); $p2 = str_replace("[##_guest_onclick_submit_##]", "onclick_insert_guest(document.weblog, 'reply', '$num', '$page', '$sort'); return false;", $p2); $set_form = "[##_guest_form_area2_##]"; $where_query = "where no = '$num'"; break; } $src = "images/spacer.gif"; $sql = "select no, name, file, label from t3_".$dbid."_guest_icon where type in ('1' $add_cond ) order by type asc, sortno asc"; // print $sql; $result = @mysql_query($sql); $first = true; while(list($no, $name, $file, $label) = @mysql_fetch_array($result)) { if ($first) { $src = $s_icon_path.$file; $first = false; } if ($c_guest_icon == $file) { $src = $s_icon_path.$file; $sflag = "selected"; } else $sflag = ""; $icons .= "<option value=\"$file\" $sflag>$name</option>\n"; } // 作 者:Sea Otter // 代码说明:表情相关 // 变动类型:添加 // 修改时间:2005.05.07 // 变更开始------------------- $temp_html = str_replace("[##_ins_emoticon_target_##]", "weblog.guest_textarea_body", $emoticon->e_str_html); $p2 = str_replace("[##_guest_emoticon_panel_##]", $temp_html, $p2); // 变更结束--------- Sea Otter $p2 = str_replace("[##_guest_name_##]", $c_guest_name, $p2); $p2 = str_replace("[##_guest_homepage_##]", $c_guest_homepage, $p2); $p2 = str_replace("[##_guest_textarea_body_value_##]", $c_guest_body, $p2); $p2 = str_replace("[##_guest_input_name_##]", "guest_input_name", $p2); $p2 = str_replace("[##_guest_input_homepage_##]", "guest_input_homepage", $p2); $p2 = str_replace("[##_guest_select_icon_##]", "guest_select_icon", $p2); $p2 = str_replace("[##_select_icons_##]", $icons, $p2); $p2 = str_replace("[##_guest_select_icon_onchange_##]", "document.getElementById('select_icon_imgid').src = '$s_icon_path'+this.value;", $p2); $p2 = str_replace("[##_guest_select_icon_imgid_##]", "select_icon_imgid", $p2); $p2 = str_replace("[##_guest_select_icon_src_##]", $src, $p2); $p2 = str_replace("[##_guest_textarea_body_##]", "guest_textarea_body", $p2); $p2 = str_replace("[##_guest_input_password_##]", "guest_input_password", $p2); $p2 = str_replace("[##_guest_password_##]", "", $p2); $p = str_replace($set_form, $p2, $p); unset($p2); if (!$where_query) { $sql = "select count(*) from t3_".$dbid."_guest"; list ($t_cnt) = mysql_fetch_array(mysql_query($sql)); $start = ($page - 1) * $pagelog; $end = $pagelog; $final = sprintf("%d", ($t_cnt+$pagelog-1) / $pagelog); $limit_query = "limit $start, $end"; } if ($sort == "2") $order_query = "order by sortno desc"; else $order_query = "order by no desc"; if ($o_num) $o_no = $o_num; else $o_no = $t_cnt - $start; $sql = " select no, sortno, name, homepage, icon, icon_width, icon_height, body, regdate, ip from t3_".$dbid."_guest $where_query $order_query $limit_query "; $result = @mysql_query($sql); while(list($no, $sortno, $name, $homepage, $icon, $icon_width, $icon_height, $body, $regdate, $ip) = @mysql_fetch_array($result)) { if ($homepage) $homepage = " href=\"$homepage\" "; if (return_authority() && $ip) $body .= "<br><font size=\"1\" face=\"tahoma\"> // $ip</font>"; // 作 者:Sea Otter // 代码说明:表情相关 // 变动类型:添加 // 修改时间:2005.05.07 // 原 代 码:无 // 变更开始------------------- $body = $emoticon->e_explain($body); // 变更结束--------- Sea Otter $p2_rep = $GLOBALS["skin"]->s_guest_rep; $p2_rep = str_replace("[##_mark_##]", "gue$no", $p2_rep); $p2_rep = str_replace("[##_guest_rep_num_##]", $o_no, $p2_rep); $p2_rep = str_replace("[##_guest_rep_name_##]", $name, $p2_rep); $p2_rep = str_replace("[##_guest_rep_homepage_##]", $homepage, $p2_rep); $p2_rep = str_replace("[##_guest_rep_icon_##]", $s_icon_path.$icon, $p2_rep); $p2_rep = str_replace("[##_guest_rep_icon_width_##]", $icon_width, $p2_rep); $p2_rep = str_replace("[##_guest_rep_icon_height_##]", $icon_height, $p2_rep); $p2_rep = str_replace("[##_guest_rep_body_##]", nl2br(autolink(" ".$body)), $p2_rep); $p2_rep = str_replace("[##_guest_rep_regdate_##]", get_timevalue1($regdate)." ".get_timevalue3($regdate), $p2_rep); $p2_rep = str_replace("[##_guest_rep_reply_##]", "index.php?md=guest&act=reply&page=$page&sort=$sort&num=$no&o_num=$o_no#gue$no", $p2_rep); $p2_rep = str_replace("[##_guest_rep_edit_##]", "index.php?md=guest&act=edit&page=$page&sort=$sort&num=$no", $p2_rep); $p2_rep = str_replace("[##_guest_rep_delete_##]", "onclick_delete('gue', '', '$no'); return false;", $p2_rep); $o_no--; unset($p3); $sql = " select no, pno, name, homepage, icon, icon_width, icon_height, body, regdate, ip from t3_".$dbid."_guest_reply where pno = '$no' order by no asc "; // print $sql; $result2 = @mysql_query($sql); while(list($no2, $pno, $name, $homepage, $icon, $icon_width, $icon_height, $body, $regdate, $ip) = @mysql_fetch_array($result2)) { if ($homepage) $homepage = " href=\"$homepage\" "; if (return_authority() && $ip) $body .= "<br><font size=\"1\" face=\"tahoma\"> // $ip</font>"; // 作 者:Sea Otter // 代码说明:表情相关 // 变动类型:添加 // 修改时间:2005.05.07 // 原 代 码:无 // 变更开始------------------- $body = $emoticon->e_explain($body); // 变更结束--------- Sea Otter $p3_rep = $GLOBALS["skin"]->s_guest_reply_rep; $p3_rep = str_replace("[##_mark_##]", "gue$no"."_$no2", $p3_rep); $p3_rep = str_replace("[##_guest_rep_num_##]", $no, $p3_rep); $p3_rep = str_replace("[##_guest_rep_name_##]", $name, $p3_rep); $p3_rep = str_replace("[##_guest_rep_homepage_##]", $homepage, $p3_rep); $p3_rep = str_replace("[##_guest_rep_icon_##]", $s_icon_path.$icon, $p3_rep); $p3_rep = str_replace("[##_guest_rep_icon_width_##]", $icon_width, $p3_rep); $p3_rep = str_replace("[##_guest_rep_icon_height_##]", $icon_height, $p3_rep); $p3_rep = str_replace("[##_guest_rep_body_##]", nl2br(autolink(" ".$body)), $p3_rep); $p3_rep = str_replace("[##_guest_rep_regdate_##]", get_timevalue1($regdate)." ".get_timevalue3($regdate), $p3_rep); $p3_rep = str_replace("[##_guest_rep_edit_##]", "index.php?md=guest&act=edit&page=$page&sort=$sort&pnum=$no&num=$no2", $p3_rep); $p3_rep = str_replace("[##_guest_rep_delete_##]", "onclick_delete('gue', '$no', '$no2'); return false;", $p3_rep); $p3 .= $p3_rep; } $p2_rep = str_replace("[##_s_guest_reply_rep_##]", $p3, $p2_rep); $p2 .= $p2_rep; } $p = str_replace("[##_s_guest_rep_##]", $p2, $p); $GLOBALS["t_cnt"] = $t_cnt; return $p; } ?>