<%
'================================================
'作  用：查看用户信息
'参  数：
'	uuser : 用户名称
'	ut    : 是否弹出窗口显示
'   un    : 是否对用户名称进行截取
'================================================
function format_user_view(uuser,ut,un)
  if var_null(uuser)="" then
    format_user_view="<font class=gray>-----</font>"
    exit function
  end if
  dim uname
  uname=uuser
  if un=1 then uname=joekoe_cms.cuted(uuser,5)
  format_user_view="<a href='"&joekoe_cms.web_path&"user/view.asp?username="&server.urlencode(uuser)&"' alt='查看 "&uuser&" 的详细资料'"
  if ut=1 then format_user_view=format_user_view&" target=_blank"
  format_user_view=format_user_view&">"&uname&"</a>"
end function

'================================================
'作  用：查看用户信息
'参  数：
'	varss : 用户名称
'	ctt   : 是否对用户名称进行截取
'   ct    : 名称显示颜色标记
'================================================
function format_user_name(varss,ctt,ct)
  dim cnum,vars,classt
  cnum=5
  if int(ctt)=0 then cnum=0
  vars=varss
  if var_null(vars)="" then
    format_user_name="<font class=gray>-----</font>"
    exit function
  end if
  if var_null(ct)<>"" and ct<>"" then classt=" class="&ct
  format_user_name="<a href='"&joekoe_cms.web_path&"user/view.asp?username="&server.urlencode(vars)&"' alt='查看 "&vars&" 的详细资料' class='h_user' target=_blank"&classt&">"&joekoe_cms.code_html(vars,1,cnum)&"</a>"
end function

'================================================
'作  用：定义用户图像
'参  数：
'	f_vars: 图像地址
'	f_w   : 图像宽度
'   f_h   : 图像高度
'================================================
function format_user_face(f_vars,f_w,f_h)
  if var_null(f_vars)="" or f_vars="" then
    format_user_face="../images/face/0.gif"
    exit function
  end if
  format_user_face="<img src='"&f_vars&"' border=0 width="&f_w&" height="&f_h&">"
end function

'================================================
'作  用：推荐信息给好友
'参  数：
'	t1: 信息分类
'	t2: 信息主题
'   t3: 信息链接地址
'================================================
function commend_friend(t1,t2,t3)
  commend_friend="【<a href='javascript:;' onclick=""javascript:open_win('../common/commend.asp?nsort="&server.urlencode(t1)&"&topic="&server.urlencode(t2)&"&url="&server.urlencode(t3)&"','commend',500,380,'no');"">告诉好友</a>】"
end function

'================================================
'作  用：举报错误信息与链接
'参  数：
'	t1: 信息分类
'	t2: 信息主题
'   t3: 报错信息编号
'	t4: 报错信息分类
'   t5: 信息链接地址
'================================================
function commend_err(t1,t2,t3,t4,t5)
  commend_err="【<a href='javascript:;' onclick=""javascript:open_win('"&joekoe_cms.web_dir&"common/Err.asp?nsort="&server.urlencode(t1)&"&topic="&server.urlencode(t2)&"&eid="&server.urlencode(t3)&"&n_sort="&server.urlencode(t4)&"&url="&server.urlencode(t5)&"','commend',500,325,'no');"">错误报告</a>】"
end function

'================================================
'作  用：定义网站图片
'参  数：
'	snum: 图片名称前缀
'================================================
function img_small(snum)
  img_small="<img border=0 src='"&joekoe_cms.web_path&"images/small/"&snum&".gif' align=absmiddle>&nbsp;"
end function

function img_skin(snum)
  img_skin="<img border=0 src='"&joekoe_cms.web_dir_skin&"small/"&snum&".gif' align=absmiddle>&nbsp;"
end function

'================================================
'作  用：定义网站em贴图
'参  数：
'	em_frm : 写入方式
'	em_word: 写入位置
'================================================
function jk_em(em_frm,em_word)
  dim temp1,j
  temp1="<table width='100%' border=0 cellpadding=0 cellspacing=0 class=tbl><tr valign=top ><td id=em_body class=s align=left>"&vbcrlf
  for j=0 to 15
    temp1=temp1&"<img src='"&joekoe_cms.web_path&"images/icon/em/"&(j+1)&".gif' border=0 align=absMiddle onclick=""javascript:jk_insert_em('[em"&(j+1)&"]','"&em_frm&"','"&em_word&"');"" style=""cursor: hand"">&nbsp;"
  next
  temp1=temp1&vbcrlf&"&nbsp;<font class=gray >[&nbsp;<a href=javascript:; onclick=""javascript:em_more('"&em_frm&"','"&em_word&"');"">更多EM贴图…</a>&nbsp;]</font></td></tr>"
  temp1=temp1&vbcrlf&"<tr><td id=em_menu class=s></td></tr></table>"
  jk_em=temp1
end function

'================================================
'作  用：定义网站巧嘴娃娃
'参  数：
' inum : 首选表情图片名称前缀
'================================================
function jk_wawa(em_frm,em_word)
  dim temp1,j
  temp1=temp1&"<table border=0 cellspacing=0 cellpadding=0><tr>"
  for j=0 to 9
    temp1=temp1&"<td nowrap><Div style='padding:0;position:relative;width:48;height:48;left:0;top:0;'><Div style='padding:0;position:absolute;width:48;height:48;left:0;top:0;z-index:1;'><OBJECT codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0 classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 width=48 height=48><PARAM NAME=movie VALUE='images/icon/audio/"&(j+1)&".swf'><param name=menu value=false><PARAM NAME=quality VALUE=high><PARAM NAME=play VALUE=false><param name='wmode' value='transparent'><embed src='images/icon/audio/"&(j+1)&".swf' quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width=48 height=48></embed></OBJECT></Div><img src='images/icon/audio/blank.gif' style='padding:0;position:absolute;width:48;height:48;left:0;top:0;z-index:2;cursor:hand;' oncontextmenu=""this.parentElement.children[0].children[0].Play()"" onmouseover=""this.title = Audibles_Text["&(j+1)&"]"" onclick=""javascript:jk_insert_em('[wawa"&(j+1)&"]','"&em_frm&"','"&em_word&"');""></Div></td>"
  next
  temp1=temp1&"<td>&nbsp;&nbsp;<font class=gray>[&nbsp;<a href='javascript:' onclick=""javascript:open_win('magic_wawa.asp?"&em_frm&","&em_word&",em','em',100,100,'yes');"">更多巧嘴娃娃…</a>&nbsp;]</font>&nbsp;&nbsp;</td></tr></table>"
  jk_wawa=temp1
end function

'================================================
'作  用：定义网站随机表情
'参  数：
'	inum : 首选表情图片名称前缀
'================================================
function jk_icon(inum)
  dim temp1,j
  for j=0 to 9
    temp1=temp1&"<img border=0 src='"&joekoe_cms.web_path&"images/icon/"&j&".gif'><input type=radio value='"&j&"' name=icon"
    if int(inum)=int(j) then temp1=temp1&" checked"
    temp1=temp1&">&nbsp;"
  next
  jk_icon=temp1
end function

'================================================
'作  用：定义商城购物虚拟币支付
'参  数：
'	p_emoney: 商品虚拟币支付价格
'	p_nsort : 商品分类
'   p_id    : 商品编号
'	put     : 是否可以使用虚拟币支付
'================================================
function note_emoney_pay(p_emoney,p_nsort,p_id,put)
  dim tmp1
  if int(p_emoney)>0 then
    tmp1="<a href='emoney_pay.asp?nsort="&p_nsort&"&id="&p_id&"' ><img src='"&joekoe_cms.web_dir_skin&"small/emoney.gif' border=0 width=14 alt='"&joekoe_cms.web_unit&"支付' align=absmiddle>&nbsp;<font class=red2>"&p_emoney&"</font> "&joekoe_cms.web_unit&"</a>"
  else
    tmp1="<img src='"&joekoe_cms.web_dir_skin&"small/emoney.gif' border=0 alt='"&joekoe_cms.web_unit&"支付' align=absmiddle>&nbsp;<font class=gray>不可用</font>"
  end if
  if put=1 then tmp1=tmp1
  note_emoney_pay=tmp1
end function

'================================================
'作  用：虚拟币支付
'参  数：
'	p_is_emoney : 是否可以使用虚拟币支付
'	p_emoney    : 商品虚拟币支付价格
'   p_id        : 商品编号
'================================================
function shop_emoney_pay(p_is_emoney,p_emoney,p_id)
  dim nemoney
  nemoney=0
  if p_is_emoney then nemoney=p_emoney
  shop_emoney_pay=note_emoney_pay(nemoney,n_sort,p_id)
end function


'================================================
'作  用：权限及金钱判断相关
'参  数：
'       略
'================================================
function powercheck(power)
  if  instr("."&power&".","."&login_modep&".")>0 then   '权限判断成功
     powercheck=true
	 else
	 powercheck=false
	 end if
end function

'[H][S][C][M][S][1][.][2]

function emoneycheck(emoney,n_sort,iid)
 dim nrs
  emoneycheck=true
  if int(emoney)<=0 then exit function  '不要钱
  if int(login_is_abate)>0 then exit function   '包月的
  if login_mode="" then
    emoneycheck=false
    exit function
  end if
  sql="select count(id) from notes where username='"&login_username&"' and nsort='"&n_sort&"' and iid="&iid
  set nrs=joekoe_cms.exec(sql,1)
  if int(nrs(0))>0 then
    nrs.close
    set nrs=nothing
    exit function
  end if
  nrs.close
  set nrs=nothing
  emoneycheck=false
end function

'================================================
'作  用：用户系统勋章
'================================================
function web_xz(xzq)
 dim xzrs,xzid,xzname,xzsm,xzpicurl,xzdata,i,xzq2,xztt
if xzq<>"" and xzq<>"0|||0|||0|||0|||0" then
          temp1="勋章："
             xzdata=split(xzq,"|||")
 	       for i=0 to ubound(xzdata)
		xzq2=xzdata(i)
                if xzq2<>"0" then
               set xzrs=conn.execute("select * from xzdata where xzid="&xzq2)
              If Not xzrs.eof Then
                    xzid=xzrs("xzid")
                    xzname=xzrs("xzname")
                    xzsm=xzrs("xzsm")
                    xzpicurl=xzrs("xzpicurl")
	  	   temp1=temp1&"<img src=../images/xz/"&xzrs("xzpicurl")&" alt='"&xzname&"<br>"&xzsm&"' align=absmiddle>"
		end if
              end if
	       next
           else
           temp1=""
	end if
web_xz=temp1
end function

'================================================
'作  用：用户系统Rank等级
'================================================
function rank_img(t_ltimes,ltimes,ttype)
 dim times,h_ltime,m_ltime,n_ltime,nh_ltime,nm_ltime,rank_temp,rank,i,temp,nrank_time
 rank_temp=0
 h_ltime=ltimes \ 60
 m_ltime=ltimes mod 60
 Do While h_ltime >= cint(rank_temp^1.5+rank_temp)
  rank_temp=rank_temp+1
 loop
 rank=rank_temp-1
 n_ltime=(cint(rank_temp^1.5+rank_temp))*60-ltimes
 nh_ltime=n_ltime \ 60
 nm_ltime=n_ltime mod 60
 times=rank
 Do While times > 0
  if times \ 16 >0 then
   for i=1 to times \ 16
    temp=temp&"<img border=0 src="&joekoe_cms.web_path&"images/rank/sun.gif>"
   next
   times=times mod 16
  end if
  if times \ 4 >0 then
   for i=1 to times \ 4
    temp=temp&"<img border=0 src="&joekoe_cms.web_path&"images/rank/moon.gif>"
   next
   times=times mod 4
  end if
  if times \ 1 >0 then
   for i=1 to times \ 1
    temp=temp&"<img border=0 src="&joekoe_cms.web_path&"images/rank/star.gif>"
   next
   times=times mod 1
  end if
 loop
 if rank=0 then temp=""
 select case cint(ttype)
 case 1
   rank_img="<td colspan=2 class=gray>  <span title='Rank: "&rank&"'>"&temp&"</span>  今日在线 <font class=red>"&t_ltimes&" </font>分钟， 总在线 <font class=red>"&ltimes&"</font> 分钟， Rank:<font class=red>"&rank&"</font>"
   rank_img=rank_img&"   <br>离下次升级还有 <font class=red>"&n_ltime&"</font> 分钟，合计 <font class=red>"&Formatnumber(nh_ltime,0)&"</font> 小时 <font class=red>"&nm_ltime&"</font> 分钟</font></td></tr>"
 case else
   rank_img= "<span title='Rank: "&rank&"'>"&temp&"</span>"
 end select
end function


'---------------------------------网站用户图例--------------------------------
function img_user()
  dim a,udim,ui,udim2
  a="用户图例："
  udim=dim_user
  for ui=0 to ubound(udim)
    udim2=split(udim(ui),":")
    a=a&vbcrlf&"&nbsp;<img border=0 src='"&joekoe_cms.web_dir_skin&"small/icon_"&udim2(0)&".gif' align=absmiddle>&nbsp;"&udim2(1)
  next
  a=a&vbcrlf&"&nbsp;<img border=0 src='"&joekoe_cms.web_dir_skin&"small/icon_other.gif' align=absmiddle>&nbsp;游客"
  if isarray(udim) then erase udim
  if isarray(udim2) then erase udim2
  img_user=a
end function

function get_abc(var_s)
  '65-90 A-Z
  '97-122 a-z
  '48-58 0-9
  '45 -
  dim tmp,vars:vars=trim(var_s)
  if vars="" or isnull(vars) then get_abc="-":exit function
  vars=left(vars,1)
  tmp=int(asc(vars))
  if tmp>=48 and tmp<=57 then get_abc=vars:exit function
  if (tmp>=65 and tmp<=90) or (tmp>=97 and tmp<=122) then get_abc=ucase(vars):exit function
  tmp=tmp+65536
  if(tmp>=45217 and tmp<=45252) then get_abc="A":exit function
  if(tmp>=45253 and tmp<=45760) then get_abc="B":exit function
  if(tmp>=45761 and tmp<=46317) then get_abc="C":exit function
  if(tmp>=46318 and tmp<=46825) then get_abc="D":exit function
  if(tmp>=46826 and tmp<=47009) then get_abc="E":exit function
  if(tmp>=47010 and tmp<=47296) then get_abc="F":exit function
  if(tmp>=47297 and tmp<=47613) then get_abc="G":exit function
  if(tmp>=47614 and tmp<=48118) then get_abc="H":exit function
  if(tmp>=48119 and tmp<=49061) then get_abc="J":exit function
  if(tmp>=49062 and tmp<=49323) then get_abc="K":exit function
  if(tmp>=49324 and tmp<=49895) then get_abc="L":exit function
  if(tmp>=49896 and tmp<=50370) then get_abc="M":exit function
  if(tmp>=50371 and tmp<=50613) then get_abc="N":exit function
  if(tmp>=50614 and tmp<=50621) then get_abc="O":exit function
  if(tmp>=50622 and tmp<=50905) then get_abc="P":exit function
  if(tmp>=50906 and tmp<=51386) then get_abc="Q":exit function
  if(tmp>=51387 and tmp<=51445) then get_abc="R":exit function
  if(tmp>=51446 and tmp<=52217) then get_abc="S":exit function
  if(tmp>=52218 and tmp<=52697) then get_abc="T":exit function
  if(tmp>=52698 and tmp<=52979) then get_abc="W":exit function
  if(tmp>=52980 and tmp<=53640) then get_abc="X":exit function
  if(tmp>=53641 and tmp<=54480) then get_abc="Y":exit function
  if(tmp>=54481 and tmp<=62289) then get_abc="Z":exit function
  get_abc="-"
end function

'----------------------------站内搜索----------------------------
sub web_search()
  response.write vbcrlf&"  <table border=0>" & _
                 vbcrlf&"  <form action='"&joekoe_cms.web_path&"common/search.asp' method=get onsubmit=""javascript:frm_submitonce(this);"">" & _
                 vbcrlf&"  <tr>" & _
                 vbcrlf&"  <td>"&img_small("search")&"</td>" & _
                 vbcrlf&"  <td>&nbsp;<input type=text name=keyword size=20 maxlength=20 title='多个关键字请用 空格 格开' class=bg_search></td>" & _
                 vbcrlf&"  <td>&nbsp;<select name=sea_type>" & _
                 vbcrlf&"<option value='forum'>论坛</option>" & _
                 vbcrlf&"<option value='news'>新闻</option>" & _
                 vbcrlf&"<option value='article'>文栏</option>" & _
                 vbcrlf&"<option value='down'>下载</option>" & _
                 vbcrlf&"<option value='video'>电影</option>" & _
		 vbcrlf&"<option value='music_song'>音乐</option>" & _
                 vbcrlf&"<option value='paste'>图片</option>" & _
                 vbcrlf&"<option value='flash'>Flash</option>" & _
                 vbcrlf&"<option value='website'>网站</option>" & _
                 vbcrlf&"<option value='shop_product'>商城</option>" & _
                 vbcrlf&"<option value='flea'>市场</option>" & _
                 vbcrlf&"</select></td>" & _
                 vbcrlf&"  <td>&nbsp;<input type=checkbox name=celerity value='yes'></td>" & _
                 vbcrlf&"  <td>快速搜索&nbsp;</td>" & _
                 vbcrlf&"  <td valign=top><input type=image src='"&joekoe_cms.web_path&"images/small/web_sea.gif' border=0></td>" & _
                 vbcrlf&"  <td>&nbsp;<a href='"&joekoe_cms.web_path&"common/search.asp?action=help' title='多功能搜索'>帮助？</a></td>" & _
                 vbcrlf&"  </tr>" & _
                 vbcrlf&"  </form>" & _
                 vbcrlf&"  </table>"
end sub

'-----------------------------版权信息----------------------------
sub web_copy()
dim tmp
  tmp=CMS_Skin.GetDB("copyright")
  tmp=Replace(tmp,"{$web_url}",joekoe_cms.web_url) 
  tmp=Replace(tmp,"{$web_name}",joekoe_cms.web_name)
  tmp=Replace(tmp,"{$pro_editon}",joekoe_cms.pro_edition)
  Response.Write(vbcrlf&tmp)
end sub

'================================================
'作  用：用户系统信息
'参  数：
'	svar : 用户系统信息
'================================================
function user_sys_type(svar)
  if svar="" or var_null(svar)="" then
    user_sys_type="未知的系统信息"
    exit function
  end if
  dim sys_dim,temp1,sys2,s1,tmp
  sys_dim=split(svar,";")
  if int(ubound(sys_dim))<2 then
    user_sys_type="未知的系统信息"
    exit function
  end if
  sys2=sys_dim(2)
  s1=len(sys2)
  tmp=mid(sys2,s1,1)
  if tmp=")" then sys2=mid(sys2,1,s1-1)
  temp1="操作系统："&sys2
  temp1=temp1&"，浏览器："&sys_dim(1)
  temp1=replace(temp1,"MSIE","Internet Explorer")
  temp1=replace(temp1,"NT 5.0","2000")
  temp1=replace(temp1,"NT 5.1","XP")
  temp1=replace(temp1,"NT 5.2","2003")
  if isarray(sys_dim) then erase sys_dim
  user_sys_type=temp1
end function

'----------------------------------论坛图片--------------------------
function forum_img_topic()
  dim tmp
  tmp=CMS_Skin.GetDB("forum_end")
  tmp=Replace(tmp,"{$web_skin}",joekoe_cms.web_dir_skin)
  forum_img_topic=tmp&CMS_Skin.skukong
end function

function base_forum_is(b_re_counter,b_islock,b_isvote,b_vote_num)
  dim temp_b
  temp_b="isok"
  if b_isvote=1 then
    if b_islock=1 then
      temp_b="isvotelock"
    else
      temp_b="isvote"
    end if
  else
      if b_re_counter>=10 then 
		 temp_b="ishot"
		       else
            if b_islock=1 then
            temp_b="islock"
		end if
      end if
  end if
  base_forum_is="<img src='"&joekoe_cms.web_dir_skin&"forum/"&temp_b&".gif' border=0>"
end function

function pic_index(pvar,pt,purl)
  dim burl,picurl
  burl="images/fk/"
  picurl=pic_url(pvar,pt)
  if purl<>"" and var_null(purl)<>"" then picurl="<a href='"&purl&"' target=_blank>"&picurl&"</a>"
  pic_index=Replace(CMS_Skin.GetDB("format_fk"),"{$pics}",picurl)
end function

function pic_url(pvar,pt)
  dim temp1,pic_var,pic_w,pic_h
  pic_w=dim_num(15)
  pic_h=dim_num(16)
  pic_var=pvar
  if pic_var="" then
    pic_var="no_pic.gif"
  else
    if instr(pic_var,"://")<1 then
      pic_var=joekoe_cms.web_upload&pic_var
    end if
  end if
  select case int(pt)
  case 1
    temp1="<img border=0 width="&pic_w&" height="&pic_h&" src='" & pic_var & "'>"
  case 2
    temp1="<img border=0 width="&(pic_w*1.5)&" height="&(pic_h*1.5)&" src='" & pic_var & "'>"
  case 3
    temp1="<img border=0 src='" & pic_var & "'>"
  case 4
     temp1="<img border=0 width="&(pic_w*0.7)&" height="&(pic_h*0.7)&" src='" & pic_var & "'>"
  case 5
     temp1="<img border=0 width="&(pic_w*0.5)&" height="&(pic_h*0.5)&" src='" & pic_var & "'>"
  case 6
     temp1="<img border=0 width="&(pic_w*0.65)&" height="&(pic_h*1.1)&" src='" & pic_var & "'>"
  case 7
     temp1="<img border=0 width="&(pic_w*0.42)&" height="&(pic_h*0.73)&" src='" & pic_var & "'>"
  case 8
    temp1="<img border=0 width="&(pic_w*1.2)&" height="&(pic_h*1.2)&" src='" & pic_var & "'>"
  case 9
    temp1="<img border=0 width="&(pic_w*1.7)&" height="&(pic_h*3)&" src='" & pic_var & "'>"
  case 10
    temp1="<img border=0 width="&(pic_w*0.91)&" height="&(pic_h*1.58)&" src='" & pic_var & "'>"
  case 11
    temp1="<img border=0 width="&(pic_w*1.2)&" height="&(pic_h*2.16)&" src='" & pic_var & "'>"
  case else
    temp1=pic_var
  end select
  pic_url=temp1
end function

function constellation(byval birthday,byval ishowbir)
 dim bir,birmon,birday,mon,da
 mon=month(birthday)
 if len(mon)=1 then mon="0"&mon
 da=day(birthday)
 if len(da)=1 then da="0"&da
 bir=mon&da
 if bir>="0120" and bir<="0218" then
  constellation="<img src=../images/star/z11.gif alt=水瓶座"
 elseif bir>="0219" and bir<="0320" then
  constellation="<img src=../images/star/z12.gif alt=双鱼座"
 elseif bir>="0321" and bir<="0419" then
  constellation="<img src=../images/star/z1.gif alt=白羊座"
 elseif bir>="0420" and bir<="0520" then
  constellation="<img src=../images/star/z2.gif alt=金牛座"
 elseif bir>="0521" and bir<="0621" then
  constellation="<img src=../images/star/z3.gif alt=双子座"
 elseif bir>="0622" and bir<="0722" then
  constellation="<img src=../images/star/z4.gif alt=巨蟹座"
 elseif bir>="0723" and bir<="0822" then
  constellation="<img src=../images/star/z5.gif alt=狮子座"
 elseif bir>="0823" and bir<="0922" then
  constellation="<img src=../images/star/z6.gif alt=处女座"
 elseif bir>="0923" and bir<="1023" then
  constellation="<img src=../images/star/z7.gif alt=天秤座"
 elseif bir>="1024" and bir<="1121" then
  constellation="<img src=../images/star/z8.gif alt=天蝎座"
 elseif bir>="1122" and bir<="1221" then
  constellation="<img src=../images/star/z9.gif alt=射手座"
 elseif bir>="1222" or bir<="0119" then
  constellation="<img src=../images/star/z10.gif alt=摩羯座"
 end if
 if ishowbir then constellation=constellation&" "&birthday
 constellation=constellation&">"
end function

Function IdToName(rsid)
    Dim Tmprs
	sql="select  username from user_data where id="&rsid
	set tmprs=joekoe_cms.exec(sql,1)
	If not tmprs.eof then 
	IdToName=tmprs(0)
	else
	IdToName="流浪者家园"
	End IF
	tmprs.close()
	set tmprs=nothing
End Function
%>
