<?php
/*
 * 注意：此文件由tpl_engine编译型模板引擎编译生成。
 * 如果您的模板要进行修改，请修改 templates/default/main.html
 * 如果您的模型要进行修改，请修改 models/main.php
 *
 * 修改完成之后需要您进入后台重新编译，才会重新生成。
 * 如果您开启了debug模式运行，那么您可以省去上面这一步，但是debug模式每次都会判断程序是否更新，debug模式只适合开发调试。
 * 如果您正式运行此程序时，请切换到service模式运行！
 * 
 * 如有您有问题请到官方论坛（http://tech.jooyea.com/bbs/）提问，谢谢您的支持。
 */
?><?php
header("content-type:text/html;charset=utf-8");
require("foundation/asession.php");
require("configuration.php");
require("includes.php");
require("foundation/module_users.php");
require("foundation/fplugin.php");

//必须登录才能浏览该页面
require("foundation/auser_mustlogin.php");

//语言包引入
$u_langpackage=new userslp;
$mn_langpackage=new menulp;
$pu_langpackage=new publiclp;
$mp_langpackage=new mypalslp;
$s_langpackage=new sharelp;
$hi_langpackage=new hilp;
$l_langpackage=new loginlp;
$rp_langpackage=new reportlp;

$user_id=get_sess_userid();

$t_plugins=$tablePreStr."plugins";

$dbo = new dbex;
//读写分离定义函数
dbtarget('r',$dbServs);

if(is_null(get_sess_plugins()))$plugins="''";
	else $plugins=get_sess_plugins();
	$sql="select * from $t_plugins where plugin_id in('0','4','5','6','7') and valid=1 and name not in (".$plugins.")";
	$rows=$dbo->getRs($sql);
	$plugin_apps=array();
	$plugin_left=array();
	$plugin_search=array();
	$plugin_guest=array();
	$plugin_friends=array();
	foreach($rows as $row)
	{
		if($row['plugin_id']==0) $plugin_apps[]=$row;
		else if($row['plugin_id']==4) $plugin_left[]=$row;
		else if($row['plugin_id']==5) $plugin_search[]=$row;
		else if($row['plugin_id']==6) $plugin_guest[]=$row;
		else if($row['plugin_id']==7) $plugin_friends[]=$row;
	}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />	
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><?php echo $siteName;?></title>
<link rel="stylesheet" type="text/css" href="skin/<?php echo $skinUrl;?>/css/main.css">
<script language=JavaScript src="skin/default/js/jooyea.js"></script>
<SCRIPT language=JavaScript src="skin/default/js/iframeautoh.js"></SCRIPT>
<SCRIPT language=JavaScript src="servtools/ajax_client/ajax.js"></SCRIPT>
<script src="skin/default/js/area_config_act.js" type="text/javascript"></script>
<SCRIPT language=JavaScript src="skin/default/js/Dialog.js"></SCRIPT>
<SCRIPT language=JavaScript src="servtools/Common.js"></SCRIPT>
<script type='text/javascript'>
	function get_mod_com(mod_id,type_id,start_num,end_num){
		if(frame_content.$("max_"+type_id+"_"+mod_id)){
			var max_num=parseInt(frame_content.$("max_"+type_id+"_"+mod_id).innerHTML);
			start_num=max_num;
		}
		var xmlhttp=InitAjax();
		xmlhttp.open("GET","modules.php?app=restore&mod_id="+mod_id+"&type_id="+type_id+"&start_num="+start_num+"&end_num="+end_num);
		xmlhttp.onreadystatechange=function(){
			if(xmlhttp.readyState==4&&xmlhttp.status==200){
	  	  var return_str=xmlhttp.responseText;
		    var	return_text=trim(return_str);
		    if(return_text){
		    	frame_content.$("show_"+type_id+"_"+mod_id).style.display='block';
		    	var history_com=frame_content.$("show_"+type_id+"_"+mod_id).innerHTML;
		    	frame_content.$("show_"+type_id+"_"+mod_id).innerHTML=history_com+return_text;
		    }else{
		    	frame_content.$("show_"+type_id+"_"+mod_id).style.display='none';
		    }
			}
		}
		xmlhttp.send(null);
	}
	
	function restore(user_name,type_id,mod_id,user_id){
		if(frame_content.$("replycontent_"+type_id+"_"+mod_id)){
			frame_content.toggle2("reply_"+type_id+"_"+mod_id);
		}
		$('restore').value=user_id;
		frame_content.$('reply_'+type_id+'_'+mod_id+'_input').value='回复'+user_name+":";
	}

	function restore_com(holder_id,type_id,mod_id){
		var r_content=frame_content.$('reply_'+type_id+'_'+mod_id+'_input').value;
		var user_id='';
		if($('restore').value!=''){
			var user_id=$('restore').value;
		}
		//var is_hidden=frame_content.document.getElementById('hidden_'+type_id+'_'+mod_id).value;
		$('restore').value;
		var is_hidden=0;
		if(trim(r_content)==''){
			Dialog.alert('<?php echo $pu_langpackage->pu_data_empty;?>');
		}else{
			var xmlhttp=InitAjax();
			xmlhttp.open("POST","do.php?act=restore_add&holder_id="+holder_id+"&type_id="+type_id+"&mod_id="+mod_id+"&is_hidden="+is_hidden+"&to_userid="+user_id);
			xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
			xmlhttp.onreadystatechange=function(){
				if(xmlhttp.readyState==4&&xmlhttp.status==200){
					if(frame_content.$('max_'+type_id+'_'+mod_id)){
						var max_num=frame_content.$('max_'+type_id+'_'+mod_id).innerHTML;
						var total_num=frame_content.$('total_'+type_id+'_'+mod_id).innerHTML;
						frame_content.$('max_'+type_id+'_'+mod_id).innerHTML=parseInt(max_num)+1;
						frame_content.$('total_'+type_id+'_'+mod_id).innerHTML=parseInt(total_num)+1;
					}
		  	  var return_str=xmlhttp.responseText;
			    var	return_text=trim(return_str);
			    frame_content.$('reply_'+type_id+'_'+mod_id+'_input').value='';
			    frame_content.$('reply_'+type_id+'_'+mod_id+'_input').onblur;
			    var history_com=frame_content.$("show_"+type_id+"_"+mod_id).innerHTML;
			    frame_content.$("show_"+type_id+"_"+mod_id).innerHTML=return_text+history_com;
			    $('restore').value='';
				}
			}
			xmlhttp.send("CONTENT="+r_content);
		}
	}
	
	function del_com(holder_id,type_id,parent_id,com_id,sendor_id){
		var xmlhttp=InitAjax();
		xmlhttp.open("GET","do.php?act=restore_del&holder_id="+holder_id+"&type_id="+type_id+"&com_id="+com_id+"&sendor_id="+sendor_id+"&parent_id="+parent_id);
		xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
		xmlhttp.onreadystatechange=function(){
			if(xmlhttp.readyState==4&&xmlhttp.status==200){
				if(frame_content.$('max_'+type_id+'_'+parent_id)){
						var max_num=frame_content.$('max_'+type_id+'_'+parent_id).innerHTML;
						var total_num=frame_content.$('total_'+type_id+'_'+parent_id).innerHTML;					
					if(max_num==1){
						frame_content.$("show_"+type_id+"_"+parent_id).style.display='none';
					}else{
						frame_content.$('max_'+type_id+'_'+parent_id).innerHTML=parseInt(max_num)-1;
						frame_content.$('total_'+type_id+'_'+parent_id).innerHTML=parseInt(total_num)-1;
					}
				}
				var return_str=xmlhttp.responseText;
				var	return_text=return_str.replace(/[\s\n\r]/g,"");
				if(return_text=="success"){
					frame_content.$("record_"+type_id+"_"+com_id).style.display='none';
				}else{
					Dialog.alert(return_text);
				}
			}
		}
		xmlhttp.send(null);
	}

	function report(type_id,user_id,mod_id){
		var point=Get_mouse_position();
		$("report").style.display='';
		$("report").style.top=point[1]-30+"px";
		$("report").style.left=point[0]-30+"px";
		$("report").innerHTML=
		"<table style='background-color:white'>"+
		"<tr><caption><b><?php echo $pu_langpackage->pu_report;?></b></caption></tr>"+
		"<tr><td><?php echo $pu_langpackage->pu_report_info;?></td></tr>"+
		"<tr><td><?php echo $pu_langpackage->pu_report_re;?></td></tr>"+
		"<tr><td><textarea id='reason' style='width:260px;height:100px'></textarea></td></tr>"+
		"<tr><td><input type='button' class='top_button' value='<?php echo $u_langpackage->u_b_con;?>' onclick='act_report(\""+type_id+"\","+user_id+","+mod_id+");' /><input type='button' onclick='cancel_report();' class='top_button' value='<?php echo $u_langpackage->u_b_can;?>' /></td></tr>"+
		"</table>";
	}
	
	function cancel_report(){
		$("report").innerHTML="";
		$("report").style.display="none";
	}	
	
	function act_report(type_id,user_id,mod_id){
		var reason_str=$("reason").value;
		if(trim(reason_str)){
			var xmlhttp=InitAjax();
			xmlhttp.open("POST","do.php?act=report_add&type="+type_id+"&uid="+user_id+"&mod_id="+mod_id);
			xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
			xmlhttp.onreadystatechange=function(){
				if(xmlhttp.readyState==4&&xmlhttp.status==200){
					$("report").innerHTML="";
					$("report").style.display="none";
		  	  var return_str=xmlhttp.responseText;
			    var	return_text=return_str.replace(/[\s\n\r]/g,"");			
			    if(return_text=="true"){
			    	Dialog.alert_ok('<?php echo $rp_langpackage->rp_suc;?>');
			    }else{
			    	Dialog.alert(return_text);
			    }
				}
			}
			xmlhttp.send("reason="+reason_str);
		}else{
			Dialog.alert('<?php echo $pu_langpackage->pu_report_none;?>');
		}
	}

	function guide(modules)
	{
		window.frames["bread_guide"].location.replace("modules.php?app=bread&act_name="+modules);
	}
		
	function goLogin(){
		Dialog.confirm("<?php echo $pu_langpackage->pu_login;?>",function(){top.location="/index.php";});
	}	
	
	function hi_action(uid){
		var point=Get_mouse_position();
		$("button_action").onclick=function(){send_hi(uid);};
		$("hi_window").style.display="";
		$("hi_window").style.top=point[1]-30+"px";
		$("hi_window").style.left=point[0]-30+"px";
	}
	
	function cancel_hi(){
		$("hi_window").style.display="none";
	}
	
	function send_hi(uid){
		var hi_type=document.getElementsByName("hi_type");
		
		for(def=0;def<hi_type.length;def++){
			if(hi_type[def].checked==true){
				var hi_t=hi_type[def].value;
			}
		}
		var xmlhttp=InitAjax();
		xmlhttp.open("GET","do.php?act=user_add_hi&to_userid="+uid+"&hi_t="+hi_t);
		xmlhttp.onreadystatechange=function(){
			if(xmlhttp.readyState==4&&xmlhttp.status==200){
				$("hi_window").style.display="none";
	  	  var return_str=xmlhttp.responseText;
		    var	return_text=return_str.replace(/[\s\n\r]/g,"");
		    if(return_text=="success"){
		    	Dialog.alert_ok("<?php echo $hi_langpackage->hi_success;?>");
		    }else{
		    	Dialog.alert(return_text);
		    }
			}
		}
		xmlhttp.send(null);
	}

	function show_share(share_type,share_content_id,s_title,s_link,point){
		if(!point){
			var point=Get_mouse_position();
		}
		$("share_window").style.display="";
		$("share_window").style.top=point[1]-30+"px";
		$("share_window").style.left=point[0]-30+"px";
		var is_disabled='';
		if(share_type<5||share_type==8){
			var is_disabled="disabled";
		}
			$("share_window").innerHTML=
			"<table style='width:280px;background-color:white'><caption><b><?php echo $s_langpackage->s_share;?></b></caption>"+
			"<tr><td style='width:90px;text-align:right;vertical-align:top;_vertical-align:middle;'><?php echo $s_langpackage->s_add_com;?></td><td><textarea id='share_com' style='width:200px'></textarea></td></tr>"+
			"<tr><td style='width:80px;text-align:right;'><?php echo $s_langpackage->s_title;?></td><td><input maxlength='50' type='text' style='width:200px' "+is_disabled+" id='out_title' value='"+s_title+"' /></td></tr>"+
			"<tr><td colspan=2 align=center><input type='button' class='top_button' value='<?php echo $u_langpackage->u_b_con;?>' onclick='act_share("+share_type+","+share_content_id+",\""+s_title+"\",\""+s_link+"\")' />"+
			"<input type='button' class='top_button' value='<?php echo $u_langpackage->u_b_can;?>' onclick='cancel_share()' /></td></tr>"+
			"</table>";
	}
	
	function cancel_share(){
		$("share_window").style.display="none";
		$("share_window").innerHTML='';
	}
	
	function act_share(share_type,share_content_id,title_data,re_link){
		if(share_type==5||share_type==6||share_type==7){
			var out_title=$("out_title").value;
			var title_data=trim(out_title);
		}
		var com_str=$("share_com").value;
		var xmlhttp=InitAjax();
		xmlhttp.open("POST","do.php?act=share_action&s_type="+share_type+"&share_content_id="+share_content_id);
		xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
		xmlhttp.onreadystatechange=function(){
			if(xmlhttp.readyState==4&&xmlhttp.status==200){
				$("share_window").style.display="none";
				$("share_window").innerHTML='';
			  var return_str=xmlhttp.responseText;
		    var	return_text=return_str.replace(/[\s\n\r]/g,"");
		    if(return_text=="success"){
		    	if(share_type==5||share_type==6||share_type==7){
		    		window.frames['frame_content'].location.reload();
		    	}
		    	Dialog.alert_ok("<?php echo $s_langpackage->s_success;?>");
		    }else{
		    	Dialog.alert(return_text);
		    }
	  	}
		}
		xmlhttp.send("comment="+com_str+"&title_data="+title_data+"&re_link="+re_link);
	}
	
	function pic_error(pic){
		pic.src='skin/<?php echo $skinUrl;?>/images/pic_none.gif';
	}
	
	function GET_TOP_URL(){
		return "http://"+location.host+location.pathname+location.search;
	}
	
</script>
</head>
<body>
<input type="hidden" value="" id="restore" />
<div class="wrapper">	
<div id='report' style='display:none;' class='ajax_window'>
</div>	
<div id='share_window' style='display:none;' class='ajax_window'>
</div>
<div id='hi_window' style='display:none;' class='ajax_window'>
  <table width="350px" style='background-color:white'>
		<?php echo hi_window();?>
  </table>
</div>	
<?php require("uiparts/mainheader.php");?>
<!-- End banner-->
<div class="main top10">
<?php require("uiparts/mainleft.php");?>
    <div class="main_r left10">
      <div id="maincontent">
        <div class="c_t">
          <div class="c_t_l left"></div>
          <div class="c_t_r right"></div>
        </div>
        <div class="c_m">
        <div id="bigpart" class="maincontent left">
          <div class="brnav">
          <img id="img" src="skin/<?php echo $skinUrl;?>/images/open.gif" style="margin-top: 8px; float:right; cursor:pointer;" onclick="showDiv();" width="10" height="9" alt="隐藏侧边栏" />
          <iframe height="30px"  id="bread_guide" name="bread_guide"  src="modules.php?app=bread" scrolling="no" frameborder="0" width="90%" allowTransparency="true"></iframe>
          </div>
<div class="clear"></div>
             <iframe onload="this.height=120" id="frame_content" name="frame_content"  src="modules.php<?php echo getUrlPara();?>" scrolling="no" frameborder="0" width="100%" style="background: transparent;" allowTransparency="true"></iframe>
          </div><!--maincontent end -->
		  <div id="bar" style="float:right;width: 28px; height:100%; overflow: hidden; cursor: pointer; text-align:center; display:none;"><img src="skin/<?php echo $skinUrl;?>/images/close.gif" style="margin-top:8px;" onclick="hiddenDiv();" width="10" height="9" alt="展开侧边栏" /></div>
  <div id="sidebar" class="rightcontent left">
    <iframe style="width:199px; padding:0px; margin:0px;" id="remind" name="remind" onload="this.height=0"  src="modules.php?app=remind" scrolling="no" frameborder="0" allowTransparency="true"></iframe>
    <div class="r_con" id="friend"><h4><?php echo $mn_langpackage->mn_find_pals;?></h4>
     <form action='modules.php?' target='frame_content'>
     	<input type='hidden' name='app' value='mypals_search_list' />
     	<input type='hidden' name='type' value='quick_search' />
            <div class="seach_part top10">
             <div class="item">
                  <div class="name"><?php echo $l_langpackage->l_location;?>：</div>
                  <div class="sel w1" onmouseover="addClass(this,'sel_hover')" onmouseout="removeClass(this,'sel_hover')" onclick="showBox(0);"><span id="area"><?php echo $l_langpackage->l_chose;?></span></div>
				  <div id="showssBox_0" class="showbox s1" style="display: none">
				  	<div class="subitem"><select id="q_province" name='q_province' onchange = "hw_select('q_province','q_city');"></select></div>
					<div class="subitem"><select name='q_city' id="q_city" onchange = "hw_select('q_province','q_city');"></select></div><div class="subitem"><input type="button" value="<?php echo $l_langpackage->l_confirm;?>" onclick="setArea();" /></div>
					<script type="text/javascript">
						hw_init('q_province','q_city');
					</script>
				  </div>
               	</div>
			    <div class="item">
                  <div class="name"><label class="mr12"><?php echo $l_langpackage->l_age;?>：</div>
                  <div class="sel w2" onmouseover="addClass(this,'sel_hover')" onmouseout="removeClass(this,'sel_hover')" onclick="showBox(1);createAge();"><span id="age"><?php echo $l_langpackage->l_chose;?></span></div>
				  <div id="showssBox_1" class="showbox s2" style="display:none">
				  	<div class="subitem"><select id="select_age_b" name="select_age_b" onchange="$('age_begin').value = $('select_age_b').value;createAge2();$('age_end').value = $('select_age_e').value;"></select><input id="age_begin" type="hidden"  value="" name="min_age"/>-<select id="select_age_e" name="select_age_e" onchange="$('age_end').value = this.value"></select><input id="age_end" type="hidden" value="" name="max_age"/></div>
					<div class="subitem"><input style="margin-right:0;" type="button" value="<?php echo $l_langpackage->l_confirm;?>" onclick="setAge();" /><label style="text-decoration:underline;text-align:left;margin-left:5px;" onclick="$('age_end').value = '不限';$('age_begin').value = '不限';$('age').innerHTML = '不限';$('showssBox_1').style.display = 'none';">年龄不限</label></div>
				  </div> 
               	</div>
			    <div class="item">
                  <div class="name"><label class="mr12"><?php echo $l_langpackage->l_sex;?>：</div>
                  <div class="sel w3" onmouseover="addClass(this,'sel_hover')" onmouseout="removeClass(this,'sel_hover')" onclick="showBox(2);"><span id="gender"><?php echo $l_langpackage->l_no_restraint;?></span><input id="sex" type="hidden" name="sex" value="" /></div>
				  
				  <div id="showssBox_2" class="showbox s3" style="display: none">
				  <div class="subitem" onmouseover='this.style.background="#0296c3";this.style.color="#ffffff"' onmouseout='this.style.background="#ffffff";this.style.color="#666"' onclick="setGender(this);$('sex').value = '';"><?php echo $l_langpackage->l_no_restraint;?></div>
				  <div class="subitem" onmouseover='this.style.background="#0296c3";this.style.color="#ffffff"' onmouseout='this.style.background="#ffffff";this.style.color="#666"' onclick="setGender(this);$('sex').value = 0;"><?php echo $l_langpackage->l_lady;?></div>
					<div class="subitem" onmouseover='this.style.background="#0296c3";this.style.color="#ffffff"' onmouseout='this.style.background="#ffffff";this.style.color="#666"' onclick="setGender(this);$('sex').value = 1;"><?php echo $l_langpackage->l_men;?></div>
				  </div></div>
               	<div class="item"><div class="submit"><input type="checkbox" name="online" value="1" /><?php echo $pu_langpackage->pu_online;?><input name="submit" type="submit" class="btn" value="<?php echo $l_langpackage->l_search;?>" /></div></div>
                </div>
				</form>
    </div>
    <div class="line clear"></div>
    <!-- plugins !-->  
    <div id="plugin_search">
    	<?php echo show_plugins($plugin_search);?>
    </div>
    <!-- plugins !-->
    <div class="clear"></div>
    <div class="r_con"><span><a href="modules.php?app=guest_more&user_id=<?php echo $user_id;?>" target='frame_content'><?php echo $mp_langpackage->mp_more;?></a></span><h4><?php echo $mn_langpackage->mn_visi;?></h4>
      <ul id='current_guest'> 
      </ul>
    </div>
    <div class="line clear"></div>
    <!-- plugins !-->  
    <div id="plugin_guest">
    	<?php echo show_plugins($plugin_guest);?>
    </div>
    <!-- plugins !-->        
    <div class="clear"></div>
    <div class="r_con"><span><a href="modules.php?app=friend_all&user_id=<?php echo $user_id;?>" target='frame_content'><?php echo $mp_langpackage->mp_more;?></a></span><h4><?php echo $mn_langpackage->mn_pal;?></h4>
      <ul id='friend_list'> 
      </ul>
    </div>
    <div class="line clear"></div>
    <!-- plugins !-->  
    <div id="plugin_friends">
    	<?php echo show_plugins($plugin_friends);?>
    </div>
    <!-- plugins !-->    
    <div class="clear"></div>
  
  </div>      
        <div class="clear"></div></div>
        <div class="c_bt">
          <div class="c_bt_l left"></div>
          <div class="c_bt_r right"></div>
        </div>
    </div>
    </div>
        <!-- main end -->
      </div>
  <div class="clear"></div>
<?php require("uiparts/footor.php");?>
</div>
<script type='text/javascript'>  	
function set_cur_guest() 
{
	var url="modules.php?app=guest&user_id=<?php echo $user_id;?>";
	ajax=InitAjax();
	ajax.open("GET", url, true);
  ajax.onreadystatechange = function() { 
     if (ajax.readyState==4&&ajax.status==200) { 
        document.getElementById("current_guest").innerHTML=trim(ajax.responseText);
        set_friend_list();
     }
  }
  ajax.send(null);
} 

function set_friend_list() 
{								
	var url="modules.php?app=friend&user_id=<?php echo $user_id;?>"; //															
	ajax=InitAjax();
	ajax.open("GET", url, true);						
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); 
  ajax.onreadystatechange = function() { 
     if (ajax.readyState==4&&ajax.status==200) {
        document.getElementById("friend_list").innerHTML=trim(ajax.responseText);
     }
  }
  ajax.send(null);
}
set_cur_guest();
</script>
<script language="JavaScript" src="im/im_js.php"></script>
</body>
</html>