get_token_id(); $token_value = $csrf->get_token($token_id); // Generate Random Form Names $form_names = $csrf->form_names(array('contact_name', 'contact_email','contact_tel','contact_gender','contact_content'), false); include "../mysql_db_connection.php"; include "chat_online_update_parameter.php"; include "site_url.php"; $link = new mysqli($MYSQL_SERVER_SITE,$MYSQL_DB_USER,$MYSQL_DB_PASS,$MYSQL_DB_NAME); $link->set_charset('utf8mb4'); $link->query('SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci'); function path_info($path,$r) { $dirname = ''; $basename = ''; $extension = ''; $filename = ''; $pos = strrpos($path, '/'); if($pos !== false) { $dirname = substr($path, 0, $pos); $basename = substr($path, $pos + 1); } else { $basename = $path; } $ext = strrchr($basename, '.'); if($ext !== false) { $extension = substr($ext, 1); } $filename = $basename; $pos = strrpos($basename, '.'); if($pos !== false) { $filename = substr($basename, 0, $pos); } switch($r){ case PATHINFO_DIRNAME: return $dirname; break; case PATHINFO_BASENAME: return $basename; break; case PATHINFO_EXTENSION: return $extension; break; case PATHINFO_FILENAME: return $filename; break; default: return ""; } } $str = "select introduction from yangfamily_yang where pattern='slideshow'"; $list = $link->query($str); list($introduction) = $list->fetch_row(); $list->close(); $name0 = array(); $name = array(); $str = "select id,title from yangfamily_yang where pattern='members_yang' order by id asc"; $list = $link->query($str); while(list($id,$title) = $list->fetch_row()){ $name0[$id] = $title; $name[$id] = htmlspecialchars($title); } $list->close(); $str = "select title from yangfamily_yang where pattern='grayscale'"; $list = $link->query($str); list($grayscale) = $list->fetch_row(); $list->close(); $read_num = 20; $d_s = array( "public", "dad", "mom", "tetsuhiko", "candy", "maggie"); $d_array = array( "undefined" => "檔案下載", "public" => "共用檔案庫", "dad" => $name0[0]."的檔案庫", "mom" => $name0[1]."的檔案庫", "tetsuhiko" => $name0[2]."的檔案庫", "candy" => $name0[3]."的檔案庫", "maggie" => $name0[4]."的檔案庫"); $id_array = array( "undefined" => "5", "public" => "51", "dad" => "52", "mom" => "53", "tetsuhiko" => "54", "candy" => "55", "maggie" => "56"); $new_to_old = array( "undefined" => "undefined", "public" => "public", "dad" => "dad", "mom" => "mom", "tetsuhiko" => "redwhale", "candy" => "s1", "maggie" => "s2"); $old_to_new = array( "undefined" => "undefined", "public" => "public", "dad" => "dad", "mom" => "mom", "redwhale" => "tetsuhiko", "s1" => "candy", "s2" => "maggie"); if(isset($_GET['d']) && !empty($_GET['d']) && in_array($_GET['d'],array_keys($d_array))){ $d = $_GET['d']; }else{ $d = "undefined"; } $main_q = ""; $main_q_len = 0; $keyword_value = ""; $q = ""; $t = ""; function pregQuote($string){ //類似PHP函數的preg_quote,只是它不跳脫「減號 (-)」這個字元 $pattern = '/([.\\\\+*?\\[\\^\\]$(){}=!<>|:\\/])/'; $replacement = '\\\\$1'; return preg_replace($pattern, $replacement, $string); } function insert_keyword_into_db($t){ global $link; $q = trim($t); // Get IP Address if (!empty($_SERVER['HTTP_CLIENT_IP'])){ $ip=$_SERVER['HTTP_CLIENT_IP']; }else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){ $ip=$_SERVER['HTTP_X_FORWARDED_FOR']; }else{ $ip=$_SERVER['REMOTE_ADDR']; } include "../array-lang_full_name.php"; $ip_to_long = ip2long($ip); $str = "select country from ip_to_country2 where start<='$ip_to_long' and end>='$ip_to_long'"; $list = $link->query($str); list($country) = $list->fetch_row(); $list->close(); if(empty($country)) $country = "Unknown"; if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) $lang = strtolower(strtok(strip_tags($_SERVER['HTTP_ACCEPT_LANGUAGE']), ',')); else $lang = "Unknown"; if(isset($lang_full_name[$lang])) $lang_name = $lang_full_name[$lang]; else $lang_name = "Unknown"; if(isset($_SERVER['HTTP_USER_AGENT'])) $browser = $_SERVER['HTTP_USER_AGENT']; else $browser = "Unknown"; $time = time(); $hidden = (preg_match("/([\s,+ ]+)/u",$q) || strlen($q) <= 0 || substr($q,0,1) === "-")?'T':'F'; $ip = $link->real_escape_string($ip); $country = $link->real_escape_string($country); $browser = $link->real_escape_string($browser); $lang_name = $link->real_escape_string($lang_name); $str = "insert into yangfamily_keyword (hidden,time,content,ip,country,browser,pc_language) values ('$hidden','$time','$q','$ip','$country','$browser','$lang_name')"; $link->query($str); if($hidden == "T" && strlen($q) > 0){ $result = array(); $keywords = preg_split("/([\s,+ ]+)/u",$q); $keywords_tmp = count($keywords); for($i = 0; $i < $keywords_tmp; $i++){ $keyword = trim($keywords[$i]); if(substr($keyword,0,1) === "-" && strlen($keyword) > 1){ array_push($result,substr($keyword,1)); }else if(strlen($keyword) > 0){ array_push($result,$keyword); } } $str = "insert into yangfamily_keyword (hidden,time,content,ip,country,browser,pc_language) values "; $result_tmp = count($result); for($i = 0; $i < $result_tmp; $i++){ if($i > 0) $str.=","; $str.="('F','$time','".$result[$i]."','$ip','$country','$browser','$lang_name')"; } $link->query($str); } } function string_to_utf8($charset, $text, $htmlspecialchars){ //$charset設成'UTF-8' $encoding_list = array('BIG-5', 'UCS-4', 'UCS-4BE', 'UCS-4LE', 'UCS-2', 'UCS-2BE', 'UCS-2LE', 'UTF-32', 'UTF-32BE', 'UTF-32LE', 'UTF-16', 'UTF-16BE', 'UTF-16LE', 'UTF-7', 'UTF7-IMAP', 'UTF-8', 'ASCII', 'EUC-JP', 'SJIS', 'eucJP-win', 'SJIS-win', 'ISO-2022-JP', 'ISO-2022-JP-MS', 'CP932', 'CP51932', 'MacJapanese', 'SJIS-DOCOMO', 'SJIS-KDDI', 'SJIS-SOFTBANK', 'UTF-8-DOCOMO', 'UTF-8-Mobile#KDDI-A', 'UTF-8-KDDI', 'UTF-8-SOFTBANK', 'ISO-2022-JP-KDDI', 'JIS', 'JIS-ms', 'CP50220', 'CP50220raw', 'CP50221', 'CP50222', 'ISO-8859-1', 'ISO-8859-2', 'ISO-8859-3', 'ISO-8859-4', 'ISO-8859-5', 'ISO-8859-6', 'ISO-8859-7', 'ISO-8859-8', 'ISO-8859-9', 'ISO-8859-10', 'ISO-8859-13', 'ISO-8859-14', 'ISO-8859-15', 'byte2be', 'byte2le', 'byte4be', 'byte4le', 'BASE64', 'HTML-ENTITIES', '7bit', '8bit', 'EUC-CN', 'CP936', 'GB18030', 'HZ', 'EUC-TW', 'CP950', 'EUC-KR', 'CP949', 'ISO-2022-KR', 'CP1251', 'CP1252', 'IBM866', 'KOI8-R'); if(mb_check_encoding ($text, $charset)) $string = ($htmlspecialchars)?htmlspecialchars(iconv($charset, "utf-8", $text)):iconv($charset, "utf-8", $text); else $string = ($htmlspecialchars)?htmlspecialchars(mb_convert_encoding($text, "utf-8", $encoding_list)):mb_convert_encoding($text, "utf-8", $encoding_list); return $string; } if(isset($_GET['q']) && strlen(trim($_GET['q'])) > 0 && !isset($_GET['feed'])){ $main_q = string_to_utf8('UTF-8', trim(str_replace(array('"',"'","_","%","\\"),"",$_GET['q'])), 0); $keyword_value = htmlspecialchars($main_q); $q = $link->real_escape_string(pregQuote($main_q, '/')); $t = $link->real_escape_string($main_q); insert_keyword_into_db($t); $main_q_len = strlen($main_q) > 0; } $keyword = array(); $nKeyword = array(); $keywords = preg_split("/([\s, ]+)/u",$q); $keywords_tmp = count($keywords); function Vbv($col,$n,$g){ global $nKeyword,$keyword; $result_array = array(); if(!$n){ for($i = 0; $i < $g; $i++){ if(substr($nKeyword[$i],0,2) == "[^") array_push($result_array,$col." NOT REGEXP '".$nKeyword[$i]."'"); else array_push($result_array,$col." NOT LIKE '%".$nKeyword[$i]."%'"); } return implode(" and ",$result_array); }else{ for($i = 0; $i < $g; $i++){ if(substr($keyword[$i],0,2) == "[^") array_push($result_array,$col." REGEXP '".$keyword[$i]."'"); else array_push($result_array,$col." LIKE '%".$keyword[$i]."%'"); } return implode(" and ",$result_array); } } $slk1 = ""; for($h = 0; $h < 2; $h++){ for($i = 0; $i < $keywords_tmp; $i++){ $ttr = explode("+",$keywords[$i]); $ttr_tmp = count($ttr); for($j = 0; $j < $ttr_tmp; $j++){ $tr = trim($ttr[$j]); if(substr($tr,0,1) === "-" && strlen($tr) > 1){ $kw = substr($tr,1); if($h == 0){ if(!ctype_alnum($kw)) array_push($nKeyword,$kw); }else if(ctype_alpha($kw)) array_push($nKeyword,"[^a-zA-Z]".$kw."[^a-zA-Z]|^".$kw."$|^".$kw."[^a-zA-Z]|[^a-zA-Z]".$kw."$"); else if(ctype_digit($kw)) array_push($nKeyword,"[^0-9]".$kw."[^0-9]|^".$kw."$|^".$kw."[^0-9]|[^0-9]".$kw."$"); else if(ctype_alnum($kw)) array_push($nKeyword,"[^a-zA-Z0-9]".$kw."[^a-zA-Z0-9]|^".$kw."$|^".$kw."[^a-zA-Z0-9]|[^a-zA-Z0-9]".$kw."$"); }else if(strlen($tr) > 0){ if($h == 0) array_push($keyword,$tr); else if(ctype_alpha($tr)) array_push($keyword,"[^a-zA-Z]".$tr."[^a-zA-Z]|^".$tr."$|^".$tr."[^a-zA-Z]|[^a-zA-Z]".$tr."$"); else if(ctype_digit($tr)) array_push($keyword,"[^0-9]".$tr."[^0-9]|^".$tr."$|^".$tr."[^0-9]|[^0-9]".$tr."$"); else if(ctype_alnum($tr)) array_push($keyword,"[^a-zA-Z0-9]".$tr."[^a-zA-Z0-9]|^".$tr."$|^".$tr."[^a-zA-Z0-9]|[^a-zA-Z0-9]".$tr."$"); } } } $nKeyword_count = count($nKeyword); $keyword_count = count($keyword); if($nKeyword_count > 0 || $keyword_count > 0) $slk1 .= " and "; $slk1 .= Vbv("search",0,$nKeyword_count); if($nKeyword_count > 0 && $keyword_count > 0) $slk1 .= " and "; $slk1 .= Vbv("search",1,$keyword_count); $keyword = array(); $nKeyword = array(); } $page_data = ""; $page = 1; if($main_q_len){ $page_data = "q=".rawurlencode($main_q); } if(isset($_POST['page']) && ctype_digit($_POST['page']) && $_POST['page'] > 0){ $page_data = (($page_data == "")?"":$page_data."&")."page=".intval($_POST['page']); $page = intval($_POST['page']); }elseif(isset($_GET['page']) && ctype_digit($_GET['page']) && $_GET['page'] > 0){ $page_data = (($page_data == "")?"":$page_data."&")."page=".intval($_GET['page']); $page = intval($_GET['page']); } if(isset($_POST['id']) && ctype_digit($_POST['id']) && $_POST['id'] > 0){ $page_data = (($page_data == "")?"":$page_data."&")."folder=".intval($_POST['id']); $folder = intval($_POST['id']); }elseif(isset($_GET['id']) && ctype_digit($_GET['id']) && $_GET['id'] > 0){ $page_data = (($page_data == "")?"":$page_data."&")."folder=".intval($_GET['id']); $folder = intval($_GET['id']); }else{ $folder = 0; } $o0 = ""; if($d == "undefined") $category_query = ""; elseif($d == "public") $category_query = " and introduction='public'"; else $category_query = " and category='".$new_to_old[$d]."'"; if($folder > 0){ $str = "select keywords from yangfamily_articles where id='$folder' and hidden='F' and head='F'".$category_query." and pattern='file_folder'"; $list = $link->query($str); $c = $list->num_rows; if($c <= 0){ header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found", true, 404); include "404.php"; } list($keywords2) = $list->fetch_row(); $list->close(); if(!$main_q_len && !isset($_GET['feed'])){ // Get IP Address if (!empty($_SERVER['HTTP_CLIENT_IP'])){ $ip=$_SERVER['HTTP_CLIENT_IP']; }else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){ $ip=$_SERVER['HTTP_X_FORWARDED_FOR']; }else{ $ip=$_SERVER['REMOTE_ADDR']; } include "../array-lang_full_name.php"; /*$str = "select count(*) from yangfamily_click where pattern='file_click'"; $list = $link->query($str); list($c) = $list->fetch_row(); $c++;*/ $ip_to_long = ip2long($ip); $str = "select country from ip_to_country2 where start<='$ip_to_long' and end>='$ip_to_long'"; $list = $link->query($str); list($country) = $list->fetch_row(); $list->close(); if(empty($country)) $country = "Unknown"; if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) $lang = strtolower(strtok(strip_tags($_SERVER['HTTP_ACCEPT_LANGUAGE']), ',')); else $lang = "Unknown"; if(isset($lang_full_name[$lang])) $lang_name = $lang_full_name[$lang]; else $lang_name = "Unknown"; if(isset($_SERVER['HTTP_USER_AGENT'])) $browser = $_SERVER['HTTP_USER_AGENT']; else $browser = "Unknown"; $time = time(); //$str = "insert into yangfamily_click (id,to_time,category,time,title,pattern,ip,country,browser,pc_language,author) values ('$c','$folder','','$time','','file_click','$ip','$country','$browser','$lang_name','111')"; $ip = $link->real_escape_string($ip); $country = $link->real_escape_string($country); $browser = $link->real_escape_string($browser); $lang_name = $link->real_escape_string($lang_name); $str = "insert into yangfamily_click (to_time,category,time,title,pattern,ip,country,browser,pc_language,author) values ('$folder','','$time','','file_click','$ip','$country','$browser','$lang_name','111')"; $link->query($str); $str = "update yangfamily_count set count=count+1 where to_time='$folder' and category='file'"; $link->query($str); $str = "insert into yangfamily_count (to_time,category,count) select '$folder','file','1' where not exists (select * from yangfamily_count where to_time='$folder' and category='file')"; $link->query($str); } } //$kkj = "CONCAT(title,' ',content,' ',thumbnail,' ',explode_and_replace(keywords,'|',' '))"; $start_num = $read_num*($page-1); function to_folder_query(){ global $category_query,$folder,$link; $layer = 0; $has_folder_array = array(); $has_folder_array[$layer] = array($folder); do { $has_folder_array[$layer+1] = array(); $has_folder_array_tmp = count($has_folder_array[$layer]); for($j = 0; $j < $has_folder_array_tmp; $j++){ $str = "select id from yangfamily_articles where to_time='".$has_folder_array[$layer][$j]."' and hidden='F' and head='F'".$category_query." and (pattern='file_folder')"; $list = $link->query($str); while(list($folder_id) = $list->fetch_row()){ array_push($has_folder_array[$layer+1],$folder_id); } $list->close(); } $layer++; }while(count($has_folder_array[$layer]) > 0); $result_array = array(); $has_folder_array_tmp = count($has_folder_array); for($i = 0; $i < $has_folder_array_tmp; $i++){ $has_folder_array_i_tmp = count($has_folder_array[$i]); for($j = 0; $j < $has_folder_array_i_tmp; $j++){ array_push($result_array,"to_time='".$has_folder_array[$i][$j]."'"); } } return "(".implode(" or ",$result_array).")"; } $str = "select id,category,time,title,introduction,pattern,location,thumbnail,author from yangfamily_articles where ".(($main_q_len)?to_folder_query():"to_time='$folder'")." and hidden='F' and head='F'".$category_query." and (pattern='add_file' or pattern='file_folder')".$slk1." order by case when pattern = 'file_folder' then 1 else 2 end, time desc, serial desc"; $list = $link->query($str); $numResults = $list->num_rows; $counter = 0; $i = 0; $g = 0; $data = array(); while(list($id,$category,$time,$title,$isPublic,$pattern,$filesize,$filename,$author) = $list->fetch_row()){ if(isset($_GET['feed']) || $g >= $start_num && $i < $read_num){ $o0 .= $yangfamily_site.'/img/icon/'.(($pattern == "file_folder")?"folder":strtolower(path_info($filename, PATHINFO_EXTENSION))).'.png|'; $data[$i] = array(); $data[$i]["id"] = $id; $data[$i]["category"] = (array_key_exists($category,$old_to_new))?$old_to_new[$category]:$category; $data[$i]["time"] = $time; $data[$i]["title"] = $title; $data[$i]["isPublic"] = $isPublic; $data[$i]["pattern"] = $pattern; $data[$i]["filesize"] = $filesize; $data[$i]["filename"] = $filename; $data[$i]["author"] = $author; $i++; }else if($i >= $read_num){ break; } $g++; } $list->close(); $numResults2 = $i; $page_title = ""; if($folder > 0){ $to_folder_array = array(); $to_folder = $folder; $to_folder_title_array = array(); do { array_push($to_folder_array,$to_folder); $str = "select to_time,title from yangfamily_articles where id='$to_folder' and hidden='F' and head='F' and (pattern='file_folder')"; $list = $link->query($str); list($to_folder,$to_folder_title)=$list->fetch_row(); $list->close(); array_push($to_folder_title_array,$to_folder_title); }while($to_folder > 0); $page_title .= htmlspecialchars($to_folder_title_array[0]); }else{ $keywords2 = "楊家人,家庭,網站,部落格,家庭成員,檔案,下載,資料夾,家人"; $page_title .= htmlspecialchars($d_array[$d]); } $page_title .= " - 楊家人"; $link_url = '/download'.(($d == "undefined")?"":"/".$d).(($folder > 0)?"/".$folder:""); $this_page_location_href = '["'.$link_url.'","'.$link_url.'/search"]'; $link_url = $yangfamily_site.$link_url; $feed_link_url = $link_url."/feed"; if(isset($_GET['feed'])){ header("Content-Type: text/xml; charset=utf-8"); $rssfeed = ''; $rssfeed .= ''; $rssfeed .= ''; $rssfeed .= ''.htmlspecialchars($page_title).''; $rssfeed .= ''; $rssfeed .= '這是我們家成員公開的家庭成員檔案庫,將公開的檔案公佈於此並開放各位下載,其中分為共用檔案庫和各成員的檔案庫,共用檔案庫是無論家庭成員屬性的共用且公開的檔案庫。'; $rssfeed .= ''; $rssfeed .= ''; $rssfeed .= ''.htmlspecialchars($page_title).''; $rssfeed .= ''; $rssfeed .= ''; $rssfeed .= 'zh-tw'; $rssfeed .= 'All rights reserved. (C) '.$copyrightYear.' Red Whale'; $rssfeed .= '600'; $data_tmp = count($data); for($i = 0; $i < $data_tmp; $i++){ $rssfeed .= ''; $rssfeed .= ''.htmlspecialchars(htmlspecialchars($data[$i]["title"])).''; if($data[$i]["filesize"] < 1000) $filesize = $data[$i]["filesize"]." bytes"; elseif($data[$i]["filesize"] >= 1000 && $data[$i]["filesize"] < 1000000){ if($data[$i]["filesize"] < 10240) $precision = 2; elseif($data[$i]["filesize"] < 102400) $precision = 1; else $precision = 0; $filesize = round($data[$i]["filesize"]/1024,$precision)." KB"; }elseif($data[$i]["filesize"] >= 1000000 && $data[$i]["filesize"] < 1000000000){ if($data[$i]["filesize"] < 10485760) $precision = 2; elseif($data[$i]["filesize"] < 104857600) $precision = 1; else $precision = 0; $filesize = round($data[$i]["filesize"]/1048576,$precision)." MB"; }else{ if($data[$i]["filesize"] < 10737418240) $precision = 2; elseif($data[$i]["filesize"] < 107374182400) $precision = 1; else $precision = 0; $filesize = round($data[$i]["filesize"]/1073741824,$precision)." GB"; } $category_str = ""; if($data[$i]["isPublic"] == "public") $category_str = "共用檔案庫"; if(array_key_exists($data[$i]["category"],$d_array)){ if(strlen($category_str) > 0) $category_str.="、"; $category_str.=htmlspecialchars($d_array[$data[$i]["category"]]); } $rssfeed .= ''.htmlspecialchars((($data[$i]["pattern"] == "add_file")?'檔案名稱:'.htmlspecialchars($data[$i]["filename"]).'
':'').'發佈時間:'.date("Y-m-d H:i:s",$data[$i]["time"]).'
發佈人:'.$name[$data[$i]["author"]].'
'.(($data[$i]["pattern"] == "add_file")?'檔案大小:'.$filesize.'
':'').(($category_str)?'分類:'.$category_str:'')).'
'; $rssfeed .= ''; $rssfeed .= ''.date("D, d M Y H:i:s O", $data[$i]["time"]).''; $rssfeed .= 'ID'; if($data[$i]["pattern"] == "file_folder") $rssfeed .= '3'; else $rssfeed .= '4'; $rssfeed .= '-'.$data[$i]["id"].'-'.date("YmdHis",$data[$i]["time"]).'
'; } $rssfeed .= '
'; $rssfeed .= '
'; echo $rssfeed; exit; } $count2 = array(); $str = "select to_time,count from yangfamily_count where category='file'"; $list = $link->query($str); while(list($count_id,$count) = $list->fetch_row()){ $count2[$count_id] = $count; } $list->close(); $img_all = ""; $header_bg_css = "download"; $chat_getIn = 0; $nav_show = ""; $js_page = $id_array[$d]; $js_page_data = $page_data; $session_id = ""; $tmp_noti_dont_show = (isset($_GET['do']))?"1":"0"; $left = $chatroom_msg_left_right_reverse?'left':'right'; $right = $chatroom_msg_left_right_reverse?'right':'left'; function aes_encrypt($plaintext, $key) { // 必須是 16/24/32 bytes,決定是 AES-128/192/256 $key = hash('sha256', $key, true); // 產生 32 bytes,用於 AES-256 $iv = openssl_random_pseudo_bytes(16); // CBC 模式固定為 16 bytes $ciphertext = openssl_encrypt( $plaintext, 'aes-256-cbc', $key, OPENSSL_RAW_DATA, $iv ); // 通常會把 IV + cipher 合併後再 base64 傳輸 return base64_encode($iv . $ciphertext); } function randStr(){ $result = ""; for($i = 0; $i < 16; $i++){ $result .= chr(rand(33,126)); } return $result; } $randString = randStr(); ?><? echo $page_title; ?>'; ?>">" />
載入中
載入中
載入錯誤
還在載入中,請稍候...

    0 && $main_q_len){ $split_keyword = preg_split("/([\s,+ ]+)/mu",$main_q,-1,PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); $keyword_result = ""; $split_keyword_tmp = count($split_keyword); for($i = 0; $i < $split_keyword_tmp; $i++){ $first_word = substr($split_keyword[$i],0,1); if($first_word == "-"){ $keyword_result .= ''.htmlspecialchars($split_keyword[$i]).''; }else if(preg_match("/[\s,+]/",$first_word)){ $keyword_result .= ''.htmlspecialchars($split_keyword[$i]).''; }else{ $keyword_result .= htmlspecialchars($split_keyword[$i]); } } echo '
    以下是「'.$keyword_result.'」的搜尋結果:
    '; }else if(!$main_q_len){ echo 'RSS訂閱'; } ?>
    >
    0) echo '
    '; $data_tmp = count($data); for($i = 0; $i < $data_tmp; $i++){ $count = (isset($count2[$data[$i]["id"]]))?$count2[$data[$i]["id"]]:0; $filename = htmlspecialchars($data[$i]["filename"]); $author = $name[$data[$i]["author"]]; $dt = date("Y-m-d H:i:s",$data[$i]["time"]); if(++$counter == $numResults2) { echo '
    '; }else{ echo '
    '; } echo '
    '; if($data[$i]["pattern"] == "file_folder") echo ''; else echo ''; echo ''.htmlspecialchars($data[$i]['; echo '
    '; $title=mb_strimwidth($data[$i]["title"], 0, 60, "...","utf-8"); $title = htmlspecialchars($title); if($data[$i]["pattern"] == "file_folder"){ $total_artical_count = 0; $layer = 0; $has_folder_array = array(); $has_folder_array[$layer] = array($data[$i]["id"]); do { $has_folder_array[$layer+1] = array(); $has_folder_array_tmp = count($has_folder_array[$layer]); for($j = 0; $j < $has_folder_array_tmp; $j++){ $str = "select id from yangfamily_articles where to_time='".$has_folder_array[$layer][$j]."' and hidden='F' and head='F' and pattern='file_folder'"; $list0 = $link->query($str); while(list($folder_id) = $list0->fetch_row()){ array_push($has_folder_array[$layer+1],$folder_id); } $list0->close(); } $layer++; }while(count($has_folder_array[$layer]) > 0); $has_folder_array_tmp = count($has_folder_array); for($k = 0; $k < $has_folder_array_tmp; $k++){ $has_folder_array_k_tmp = count($has_folder_array[$k]); for($j = 0; $j < $has_folder_array_k_tmp; $j++){ $str = "select count(*) from yangfamily_articles where to_time='".$has_folder_array[$k][$j]."' and hidden='F' and head='F' and pattern='add_file'"; $list0 = $link->query($str); list($artical_count) = $list0->fetch_row(); $list0->close(); $total_artical_count += $artical_count; } } }else{ if($data[$i]["filesize"] < 1000) $filesize = $data[$i]["filesize"]." bytes"; elseif($data[$i]["filesize"] >= 1000 && $data[$i]["filesize"] < 1000000){ if($data[$i]["filesize"] < 10240) $precision = 2; elseif($data[$i]["filesize"] < 102400) $precision = 1; else $precision = 0; $filesize = round($data[$i]["filesize"]/1024,$precision)." KB"; }elseif($data[$i]["filesize"] >= 1000000 && $data[$i]["filesize"] < 1000000000){ if($data[$i]["filesize"] < 10485760) $precision = 2; elseif($data[$i]["filesize"] < 104857600) $precision = 1; else $precision = 0; $filesize = round($data[$i]["filesize"]/1048576,$precision)." MB"; }else{ if($data[$i]["filesize"] < 10737418240) $precision = 2; elseif($data[$i]["filesize"] < 107374182400) $precision = 1; else $precision = 0; $filesize = round($data[$i]["filesize"]/1073741824,$precision)." GB"; } } if($data[$i]["pattern"] == "file_folder") echo '

    '.$title.'
    '.$total_artical_count.'個檔案

    '; else echo '

    '.$title.'

    '; echo '
      '; if($data[$i]["pattern"] == "add_file") echo '
    • '.$filename.'
    • '; echo '
    • '.$dt.'
    • '; echo '
    • '.$count.'
    • '; echo '
    • '.$author.'
    • '; if($data[$i]["pattern"] == "add_file") echo '
    • '.$filesize.'
    • '; $category_str = ""; if($data[$i]["isPublic"] == "public") $category_str = "共用檔案庫"; if(array_key_exists($data[$i]["category"],$d_array)){ if(strlen($category_str) > 0) $category_str.="、"; $category_str.=htmlspecialchars($d_array[$data[$i]["category"]]); } if($category_str) echo '
    • '.$category_str.'
    • '; echo '
    '; echo '
    '; echo '
    '; } if($numResults2 <= 0) echo '
    '.(($main_q_len)?'查無資料':'目前尚無檔案'); ?>
    close(); $all_page = ceil($count/$read_num); if($all_page > 1 && $page <= $all_page){ echo '
    '; echo '
      '; $searData = ($main_q_len)?'q='.rawurlencode($main_q).'&':''; $sear = ($main_q_len)?'/search?'.$searData:'?'; if($page > 1){ if($folder > 0) echo '
    • «
    • '; else echo '
    • «
    • '; }else echo '
    • «
    • '; $h_page = $page-4; if($page > $all_page-4) $h_page = $all_page-8; if($h_page <= 0) $h_page = 1; $f_page = $h_page+8; if($f_page > $all_page) $f_page = $all_page; for($i=$h_page;$i<=$f_page;$i++){ if($page == $i) echo '
    • '.$i.'
    • '; else{ if($folder > 0) echo '
    • '.$i.'
    • '; else echo '
    • '.$i.'
    • '; } } if($page < $all_page){ if($folder > 0) echo '
    • »
    • '; else echo '
    • »
    • '; }else echo '
    • »
    • '; echo '
    '; echo '
      '; if($page > 1){ if($folder > 0) echo '
    • «
    • '; else echo '
    • «
    • '; }else echo '
    • «
    • '; if($folder > 0) echo '
    • '.$i.''; } echo '
    • '; if($page < $all_page){ if($folder > 0) echo '
    • »
    • '; else echo '
    • »
    • '; }else echo '
    • »
    • '; echo '
    '; echo '
    '; } ?>
    Top