soft_id / 500); if(!is_dir($_current_cache_dir."/view/".$_cache_dir)) { mkdir($_current_cache_dir."/view/".$_cache_dir); chmod($_current_cache_dir."/view/".$_cache_dir, 0777); } $_cache_file_name = $_current_cache_dir."/view/".$_cache_dir."/".$SoftInfo->soft_id.".html"; $time = @filemtime($_cache_file_name); if($cache == "yes" || time() - $time < 3600*24*7) { $sql = "update software set view_num=view_num+1 where soft_id='$SoftInfo->soft_id'"; mysql_query($sql); header("Last-Modified: ".gmdate("D, d M Y H:i:s", $time)." GMT"); header("Expires: " .gmdate("D, d M Y H:i:s", $time + 360000)." GMT"); readfile($_cache_file_name); exit; } //--------------------------------------- $xtpl = new xtpl(); $xtpl->set_file("tpl/soft_view.html"); //---- 软件所在小类 ---- $sql = "select name, main_id, directory from sub_category where sub_id='$SoftInfo->sub_id'"; $result = mysql_query($sql); $SmallCategory = mysql_fetch_object($result); //---- 软件所在大类 ---- $sql = "select name, directory from main_category where main_id='$SmallCategory->main_id'"; $result = mysql_query($sql); $BigCategory = mysql_fetch_object($result); //---- 该大类的小分类情况 ---- $sub_category_list = ""; $tmp = "sub_category_list_".$SmallCategory->main_id; $main[$tmp] = $sub_category_list; $tmp = "current_category_".$SmallCategory->main_id; $main[$tmp] = " class=current"; /* //---- keyword 情况 ---- $sql = "select directory, j_name from software_keyword where id>167301 order by rand() limit 0, 36"; $res = mysql_query($sql); while($dbRow = mysql_fetch_object($res)) { $KeywordInfo[$dbRow->directory] = $dbRow->j_name; } $no = 0; foreach($KeywordInfo as $kid => $data) { $no++; if($no<15) { $main[more_keyword] .= "
  • ".$data."
  • "; continue; } if($no % 2) { $main[list_keyword] .= "
  • ".$data."
  • "; } else { $main[list_search] .= "
  • ".$data."
  • "; } } $main[list_keyword] = substr($main[list_keyword], 0, -3); $main[list_search] = substr($main[list_search], 0, -3); */ //---- 推荐关键词 ---- $sql = "SELECT j_name,directory FROM `software_keyword` WHERE id in ('180462','373589','168874','2432','248845','168894','178620','30316','330772','301854','160964','2908','344072','301091','165305','2455','178580','7571') ORDER BY `hits` DESC"; $result = mysql_query($sql); while($dbRow = mysql_fetch_object($result)) { $main[more_keyword] .= "
  • ".$dbRow->j_name."
  • \n"; } $main[main_category_url] = "http://jp.brothersoft.com/".$BigCategory->directory; $main[main_category_name] = $BigCategory->name; $main[sub_category_url] = "http://jp.brothersoft.com/".$BigCategory->directory."/".$SmallCategory->directory; $main[sub_category_name] = $SmallCategory->name; //---- 软件基本信息 ---- $main[soft_id] = $SoftInfo->soft_id; $main[name] = $SoftInfo->name; $main[brief] = $SoftInfo->brief; $main[version] = ($SoftInfo->version=='-') ? "" : $SoftInfo->version; $main[down_num] = $SoftInfo->download_num; $main[os] = $SoftInfo->os; $main[license] = $SoftInfo->license; $main[price] = $SoftInfo->price; $main[icon] = ($SoftInfo->icon == "") ? "/images/default-icon.jpg" : $SoftInfo->icon; $main[limitations] = ($SoftInfo->limitations == "") ? "N/A" : $SoftInfo->limitations; $main[requirements] = ($SoftInfo->requirements == "") ? "No special requirements" : $SoftInfo->requirements; $main[size] = $SoftInfo->size; if(!empty($SoftInfo->domain)) { $main[download_url] = "http://".$SoftInfo->domain.".jp.brothersoft.com/download/"; } else { $main[download_url] = "http://jp.brothersoft.com/software-d".$SoftInfo->soft_id."-".software_directory($SoftInfo->name)."a.html"; } $color_style[] = "tag1"; $color_style[] = "tag2"; $color_style[] = "tag3"; $color_style[] = "tag4"; $color_style[] = "tag5"; $color_style[] = "tag6"; unset($tag_list); $all_tag_list = array(); //---- 该软件的关键词列表 ---- if(!empty($SoftInfo->keywords)) { $tag_list = explode(",", $SoftInfo->keywords); $addon = ""; foreach($tag_list as $k) { $k = trim($k); $k = mysql_escape_string($k); if(strlen($k)>3) { $addon = $addon." or name='$k'"; } } if($addon != "") { $addon = substr($addon, 4); $sql = "select directory, j_name from software_keyword where $addon"; $result = mysql_query($sql); while($dbRow=mysql_fetch_object($result)) { $k = "http://jp.brothersoft.com/".urlencode($dbRow->directory).".html"; $all_tag_list[$k] = $dbRow->j_name; } } } //---- 用软件名查询英文关键词结果 ---- $tag_name = mysql_escape_string($SoftInfo->name); $sql = "select directory, j_name from software_keyword where match(name) against('$tag_name') limit 0, 10"; $res = mysql_query($sql); while($dbRow = mysql_fetch_object($res)) { $k = "http://jp.brothersoft.com/".urlencode($dbRow->directory).".html"; $all_tag_list[$k] = $dbRow->j_name; } //---- 用软件名查询日文关键词结果 ---- $tag_name = mysql_escape_string($SoftInfo->name); $sql = "select directory, j_name from software_keyword where match(j_name) against('$tag_name') limit 0, 10"; $res = mysql_query($sql); while($dbRow = mysql_fetch_object($res)) { $k = "http://jp.brothersoft.com/".urlencode($dbRow->directory).".html"; $all_tag_list[$k] = $dbRow->j_name; } $all_tag_list = array_unique($all_tag_list); foreach($all_tag_list as $directory => $local_name) { $cc_index = rand(0, 5); $this_color = $color_style[$cc_index]; $main[all_tag_list] .= "".$local_name." |\n"; } $main[all_tag_list] = substr($main[all_tag_list], 0, -10); //----------------------------- if(!empty($SoftInfo->screenshots)) { if(substr($SoftInfo->screenshots, 0, 12) == "/screenshots") { $screenshots = str_replace("/screenshots/160x120/", "/screenshots/src/", $SoftInfo->screenshots); $main[screenshot] = "\"".htmlspecialchars($SoftInfo-name)." \"/>"; } else { $main[screenshot] = "$SoftInfo->name  "; } } else { $main[screenshot] = "\"".htmlspecialchars($SoftInfo-name)." \"/>"; } $updatetime = strtotime($SoftInfo->updatetime); $main[updatetime] = date("Y-m-d", $updatetime); $SoftInfo->description = str_replace($SoftInfo->name, "".$SoftInfo->name."", $SoftInfo->description); $main[description] = nl2br($SoftInfo->description); if(!empty($SoftInfo->publisher_url)) { $main[publisher] = "".$SoftInfo->publisher_url."";; } if(!empty($SoftInfo->publisher_name)) { $main[publisher] = $SoftInfo->publisher_name; if(!empty($SoftInfo->publisher_url)) { $main[publisher] = "".$SoftInfo->publisher_name.""; } } //---- Related Software ---- $search = mysql_escape_string($SoftInfo->name); $sql = "select soft_id, name, version, brief, domain, icon, size, license from software where match(name) against('$search') and soft_id<>'$soft_id' limit 0, 5"; $result = mysql_query($sql); while($dbRow = mysql_fetch_object($result)) { unset($list_related); $list_related[name] = $dbRow->name; $list_related[version] = ($dbRow->version == '-') ? "" : $dbRow->version; $list_related[brief] = $dbRow->brief; $list_related[license] = $dbRow->license; $list_related[size] = $dbRow->size; if(!empty($dbRow->domain)) { $list_related[url] = "http://".$dbRow->domain.".jp.brothersoft.com/"; } else { $list_related[url] = "http://jp.brothersoft.com/software-".$dbRow->soft_id."-".software_directory($dbRow->name)."a.html"; } $list_related[icon] = ($dbRow->icon == "") ? "/images/default-icon.jpg" : $dbRow->icon; $xtpl->assign("list_related", $list_related); $xtpl->parse("main.list_related"); } if($SmallCategory->main_id == 2) { $main[keyword_addon] = "DVD 動画"; } $sub_id=$SoftInfo->sub_id; $main_id=$SmallCategory->main_id; if($sub_id) { $sql = "select * from sub_category where main_id='$SmallCategory->main_id'"; $result = mysql_query($sql); $sub_ids=''; while($row = mysql_fetch_object($result)) { $sub_ids.=','.$row->sub_id; } $sub_ids = trim($sub_ids,','); $main_count=0; if($sub_ids) { $result=mysql_query("select count(*) c from software where is_check='1' and sub_id in(".$sub_ids.")"); $row=mysql_fetch_object($result); $main_count = $row->c; } $result=mysql_query("select count(*) c from software where is_check='1' and sub_id =".$sub_id); $row=mysql_fetch_object($result); $sub_count = $row->c; } //---- popular search $no = 1; $sql = "select keyword_id, name from popular_search where main_id={$main_id} order by rand() limit 20"; $result = mysql_query($sql); while($dbRow = mysql_fetch_object($result)) { $popular[id] = $no; $popular[keyword_id] = $dbRow->keyword_id; $popular[name] = $dbRow->name; $popular[url] = "http://jp.brothersoft.com/downloads/".$dbRow->keyword_id.".html"; $xtpl->assign("popular", $popular); $xtpl->parse("main.popular"); $no++; } /* 获取 mobile数据 */ include_once(dirname(__FILE__)."/lib/nusoap2/nusoap.php"); $client = new soapclient('http://mobile.brothersoft.com/services.php'); $header = array("sn"=>"www-f0440",'type'=>2,'limit'=>'15','is_game'=>2); $client->setHeaders($header); $featured_soft = $client->call('featured_soft',array()); foreach($featured_soft as $k=>$v){ $tmp = "featured_name_".$k; $main[$tmp] = $v['soft_name']; $tmp = "featured_url_".$k; $main[$tmp] = $v['soft_url']; } //---- 底部链接数据 ---- //全站top20 $soft_ids = ''; $no = 1; $sql = "select soft_id, name, domain, version from software where is_check=1 order by download_num desc limit 20"; $result = mysql_query($sql); while($dbRow = mysql_fetch_object($result)) { $tmp = "baselink1_soft_url_".$no; if(!empty($dbRow->domain)) { $main[$tmp] = "http://".$dbRow->domain.".jp.brothersoft.com/"; } else { $main[$tmp] = "http://jp.brothersoft.com/software-".$dbRow->soft_id."-".software_directory($dbRow->name)."a.html"; } $tmp = "baselink1_soft_name_".$no; $main[$tmp] = !preg_match('/[\x{0800}-\x{4e00}]+/u',$dbRow->name) ? $dbRow->name." 日本語" : $dbRow->name."無料";//日语软件加"無料",英语软件加"日本語" $no++; $soft_ids .= ",".$dbRow->soft_id; } $soft_ids = substr($soft_ids, 1); //本分类的top20 $no = 1; $sql = "select soft_id, name, domain, version from software where is_check=1 and sub_id in ({$sub_ids}) and soft_id not in ({$soft_ids}) order by download_num desc limit 20"; $result = mysql_query($sql); while($dbRow = mysql_fetch_object($result)) { $tmp = "baselink2_soft_url_".$no; if(!empty($dbRow->domain)) { $main[$tmp] = "http://".$dbRow->domain.".jp.brothersoft.com/"; } else { $main[$tmp] = "http://jp.brothersoft.com/software-".$dbRow->soft_id."-".software_directory($dbRow->name)."a.html"; } $tmp = "baselink2_soft_name_".$no; $main[$tmp] = !preg_match('/[\x{0800}-\x{4e00}]+/u',$dbRow->name) ? $dbRow->name." 日本語" : $dbRow->name."無料";//日语软件加"無料",英语软件加"日本語" $no++; $soft_ids .= ",".$dbRow->soft_id; } //---- related search $sql = "select keyword_id, name from keywords where MATCH (name) AGAINST ('".mysql_escape_string($SoftInfo->name)."') order by google_pv desc limit 10"; $result = mysql_query($sql); $rows = mysql_num_rows($result); while($dbRow = mysql_fetch_object($result)) { $related_keyword[keyword_id] = $dbRow->keyword_id; $related_keyword[name] = $dbRow->name; $related_keyword[url] = "http://jp.brothersoft.com/downloads/".$dbRow->keyword_id.".html"; $xtpl->assign("related_keyword", $related_keyword); $xtpl->parse("main.related_keyword"); } if(!empty($rows)) $xtpl->assign("related_keyword_text", "関するキーワード: "); else $xtpl->assign("related_keyword_text", ""); $xtpl->assign("main", $main); $xtpl->parse("main"); $html_body = $xtpl->text("main"); echo $html_body; if($fp = @fopen($_cache_file_name, "w")) { fputs($fp, $html_body); fclose($fp); chmod($_cache_file_name, 0777); } $sql = "update software set view_num=view_num+1 where soft_id='$SoftInfo->soft_id'"; mysql_query($sql);