📄 main.php
字号:
var msg_forbid = 12;
var msg_unlock = 13;
var msg_clear = 14;
var msg_warning_out = 15;
var msg_grade = 16;
var msg_ungrade = 17;
var enable_receive_call = true;
function writeMessage(content,from,to,time,title,saycolor,namecolor,private,type,event,face)
{
content = autoRemove(content);//自动清除不能显示的图片
var filter = parseInt(inputmessage.document.MessageForm.filter.value);
var type_user = 0;
var type_system = 1;
var message = "";
switch(parseInt(type))
{
case type_user:
var defaultColor = "#0000FF";
saycolor = parseInt(saycolor);
namecolor = parseInt(namecolor);
if(!isNaN(saycolor)&&!isNaN(namecolor))
{
var sayColor = array_colors[0][parseInt(saycolor)];
var nameColor = array_colors[0][parseInt(namecolor)];
}
else
{
var sayColor = defaultColor;
var nameColor = defaultColor;
}
if(parseInt(title))
{
//执行标题操作
message = content + "<font color='blue' style='font-size:12px'> (<a href=javascript:parent.PointTo('"+from+"')>"+from+"</a>, "+time+")";
showtitle.ShowTitles.innerHTML = message;
return;
}
else
{
//检测是否被屏蔽
if(isPBed(from))
return;
if(content.indexOf("{%%}")>=0||content.indexOf("{##}")>=0)
{
//是动作
message += replaceConfig(from,to,content) + "<br>";
}
else
{
//不是动作
face = parseInt(face);
if(isNaN(face))
{
face = 0;
}
if(face)
{
var userface = array_face[face];
userface = userface+"的";
}
else
{
var userface ="";
}
if(to==username)
{
//如果对自己说
var tostr = "<font color='red'>【"+to+"】</font>"
}
else
{
//否则
var tostr = "<a href=javascript:parent.PointTo('"+to+"')><font color='"+defaultColor+"'>"+to+"</font></a>";
}
if(parseInt(private))
{
//私聊信息
message += "【私聊】";
}
else
{
//公聊信息
}
message += "<a href=javascript:parent.PointTo('"+from+"')><font color='"+nameColor+"'>"+from+"</font></a>"+userface+"对"+tostr+"说:"+"<font color='"+sayColor+"'>"+content+"</font>"+" <span class=tm>("+time+")</span><br>";
if(inputmessage.document.MessageForm.leave.checked&&to==username)
{
tmpnum ++;
var fm = inputmessage.document.MessageForm;
var query = urlpath+"addmessage.php?from_user="+username+"&to_user="+from+"&content=系统自动回复->"+encode(fm.temp.value)+"&saycolor="+fm.saycolor.value+"&namecolor="+fm.namecolor.value+"&private="+fm.private.value+"&title=0&face="+fm.face.value+"&filter="+fm.filter.value+"&roomid="+roomid+"&sessionid="+fm.sessionid.value+"&tmp="+tmpnum;
xmlhttp.open("get",query,false);
xmlhttp.send();
// writeMessage(fm.temp.value,username,from,time,fm.title.checked,fm.saycolor.value,fm.namecolor.value,fm.private.checked,0,0,fm.face.value);
}
}
}
if((filter==1||filter==3)&&username!=from&&username!=to)
message = "";
break;
case type_system:
//如果为系统信息,那么saycolor就是消息类别
if(filter<=1)
message = "【系统】";
switch(parseInt(event))
{
case msg_warn:
if(to==username)
{
if(!filter)
message = "【系统】"+replaceConfig(to,from,message_warn)+" 原因:【"+content + "】 <span class=tm>("+time+")</span><br>";
xmlhttp.open("get",urlpath+"manage.php?mode=warning",false);
xmlhttp.send();
eval(bytes2BSTR(xmlhttp.responseBody));
}
else
{
if(!filter)
message += replaceConfig(to,from,message_warn)+" 原因:【"+content + "】 <span class=tm>("+time+")</span><br>";
}
break;
case msg_kick:
if(to==username)
{
top.location.href = "notice.php?id="+msg_kick+"&manager="+from+"&why="+content;
}
else
{
onlines.delName(to);
onlines.write();
if(!filter)
message += replaceConfig(to,from,message_kick)+" 原因:【"+content + "】 <span class=tm>("+time+")</span><br>";
}
break;
case msg_bomb:
if(to==username)
{
top.location.href = "notice.php?id="+msg_bomb+"&manager="+from+"&why="+content;
}
else
{
onlines.delName(to);
onlines.write();
if(!filter)
message += replaceConfig(to,from,message_bomb)+" 原因:【"+content+"】 <span class=tm>("+time+")</span><br>";
}
break;
case msg_lock:
if(to==username)
{
top.location.href = "notice.php?id="+msg_lock+"&manager="+from+"&why="+content;
}
else
{
onlines.delName(to);
onlines.write();
if(!filter)
message += replaceConfig(to,from,message_lock)+" 原因:【"+content+"】 <span class=tm>("+time+")</span><br>";
}
break;
case msg_login:
if(!filter)
message += replaceConfig(from,"",message_login)+"<span class=tm>("+time+")</span><br>";
onlines.addName(from,saycolor);
onlines.write();
break;
case msg_logout:
if(!filter)
message += replaceConfig(from,"",message_logout) +"<span class=tm>("+time+")</span><br>";;
onlines.delName(from);
onlines.write();
break;
case msg_leave:
if(!filter)
message += replaceConfig(from,"",message_leave) +"<span class=tm>("+time+")</span><br>";
onlines.delName(from);
onlines.write();
break;
case msg_call:
if(to==username&&enable_receive_call)
{
var callWindow = window.open("","","width=300,height=130");
var callStr = "<html><head><title>接收 "+from+" 的呼叫</title><style>td,body{font-size:12px}</style></head><body bgcolor='"+page_bgcolor+"'>";
callStr += "<table width=250 align='center' bgcolor='black' cellspacing=1 cellpadding=2>";
callStr += "<tr><td bgcolor='#6699ff' align='center' colspan=2><b>接收呼叫信息</b></td></tr>";
callStr += "<tr><td bgcolor='buttonface' width=80 align='right'>呼叫者</td><td bgcolor='white' width=220>"+from+"</td></tr>";
callStr += "<tr><td bgcolor='buttonface' width=80 align='right'>内容</td><td bgcolor='white' width=220>"+content+"</td></tr>";
callStr += "<tr><td colspan=2 align='center' bgcolor='white'><a href='javascript:window.close()'>关闭窗口</a> <a href='dialog.php?mode=8&why=&username="+from+"'>回复信息</a> <a href='#' onclick='opener.enable_receive_call=false;alert(\"不接受呼叫成功,若要允许弹出呼叫窗口,请刷新聊天窗口\")'>不接受呼叫</a></td></tr>";
callStr += "</table></body></html>";
callWindow.document.write(callStr);
callWindow.focus();
return;
}
else
{
return;
}
break;//呼叫
case msg_unlock:
if(!filter)
message += replaceConfig(from,to,message_unlock) + " 原因:【"+content+"】 <span class=tm>("+time+")</span><br>";
break;
case msg_changeroom:
if(!filter)
message += replaceConfig(from,content,message_changeroom) + "<span class=tm>("+time+")</span></br>";
onlines.delName(from);
onlines.write();
break;
case msg_clear:
if(!filter)
message += replaceConfig(from,content,message_clear) + "<span class=tm>("+time+")</span></br>";
onlines.delName(from);
onlines.write();
break;
case msg_warning_out:
if(from==username)
{
top.location.href = "notice.php?id="+msg_warning_out;
}
else
{
if(filter<=1)
message += replaceConfig(from,content,message_warning_out) + "<span class=tm>("+time+")</span></br>";
onlines.delName(from);
onlines.write();
}
break;
}
}
if(from==username||to==username)
{
showselfmessage.document.write(message);
}
else
{
showmessage.document.write(message);
}
showallmessage.document.write(message);
}
function preWriteTitle()
{
var str = "<html><head><style>a{color:blue;text-decoration:none;}a:hover{text-decoraton:underline}body{background-color:"+style_titleframe_background_color+";background-image:url('"+style_titleframe_background_image+"');font-size:13px}</style></head><body scroll=no leftmargin=0 topmargin=5><base target='readmessage'>";
str += "<center>" + chatroom_affiche +"<br>";
str += "<span id='ShowTitles'>";
str += title_content + "<font color='blue' style='font-size:12px'> (<a href=javascript:parent.PointTo('"+title_from+"')>"+title_from+"</a>, "+title_time+")";
str += "</span>";
str += "</center></body></html>";
showtitle.document.write(str);
}
var noticeNum = 0;
function showNotice(msg)
{
noticeNum++;
if(!notice_show_time)
{
closeStr="";
}
var str = "<span id='notice"+noticeNum+"'>【提示】" ;
str += msg+"<br></span>";
if(inputmessage.document.MessageForm.split.checked)
{
showselfmessage.document.write(str);
showallmessage.document.write(str);
if(!notice_show_time)
{
return;
}
setTimeout('showselfmessage.document.all("notice'+noticeNum+'").innerHTML=""',notice_show_time*1000);
}
else
{
showmessage.document.write(str);
showallmessage.document.write(str);
if(!notice_show_time)
{
return;
}
setTimeout('showmessage.document.all("notice'+noticeNum+'").innerHTML=""',notice_show_time*1000);
}
}
var lastTo = "大家";
var lastSayContent = "";
function preSubmit(fm)
{
if(fm.temp.value=="")
{
showNotice("发言不能为空。");
return false;
}
Sayed.addSays(fm.temp.value);
if(say_enable_filter)
{
if(isDirty(fm.temp.value))
{
showNotice("请文明用语!");
fm.temp.value = "";
fm.temp.focus();
return false;
}
}
var nowTime = Date.parse(new Date())/1000;
if((nowTime-lastSayTime)<say_interval)
{
showNotice("两次发言时间不要超过 <font color='blue'>"+say_interval+"</font> 秒!");
fm.temp.focus();
return false;
}
if(fm.temp.value.length>=say_maxlength)
{
showNotice("请不要超过 <font color='blue'>"+say_maxlength+"</font> 个字符,您目前的发言字符数量为:<font color='blue'> "+fm.temp.value.length+"</font>");
fm.temp.focus();
return false;
}
if(lastSayContent==fm.temp.value&&lastTo==fm.to_user.value)
{
showNotice("发言请不要重复!");
fm.temp.focus();
return false;
}
var content = fm.temp.value;
var result = new Array();
if(content.indexOf("/")==0)
{
//发言为特殊管理信息
if(!content.indexOf("/cd"))
{
saveCents();
fm.temp.value = "";
fm.temp.focus();
return false;
}
if(!content.indexOf("/warn"))
{
if(fm.to_user.value=="大家")
{
showNotice("您不能警告〖<font color='blue'>大家</font>〗");
return false;
}
var why = content.substring(5,content.length);
window.open("dialog.php?why="+why+"&mode="+msg_warn+"&username="+fm.to_user.value,result,"height=130px,width=300px,statusbar:no");
return false;
}
if(!content.indexOf("/kick"))
{
if(fm.to_user.value=="大家")
{
showNotice("您不能踢出〖<font color='blue'>大家</font>〗");
fm.temp.value = "";
fm.temp.focus();
return false;
}
var why = content.substring(5,content.length);
window.open("dialog.php?why="+encode(why)+"&mode="+msg_kick+"&username="+fm.to_user.value,result,"height=130px,width=300px,status=no");
fm.temp.value = "";
return false;
}
if(!content.indexOf("/bomb"))
{
if(fm.to_user.value=="大家")
{
showNotice("您不能轰炸〖<font color='blue'>大家</font>〗");
fm.temp.value = "";
fm.temp.focus();
return false;
}
var why = content.substring(5,content.length);
window.open("dialog.php?why="+why+"&mode="+msg_bomb+"&username="+fm.to_user.value,result,"height=130px,width=300px,status=no");
fm.temp.value = "";
return false;
}
if(!content.indexOf("/lock"))
{
if(fm.to_user.value=="大家")
{
showNotice("您不能封锁〖<font color='blue'>大家</font>〗");
fm.temp.value = "";
fm.temp.focus();
return false;
}
var why = content.substring(5,content.length);
window.open("dialog.php?why="+why+"&mode="+msg_lock+"&username="+fm.to_user.value,result,"height=130px,width=300px,status=no");
fm.temp.value = "";
return false;
}
if(!content.indexOf("/cx"))
{
if(fm.to_user.value=="大家")
{
showNotice("您不能查询〖<font color='blue'>大家</font>〗");
fm.temp.value = "";
fm.temp.focus();
return false;
}
window.open("member.php?mode=info&username="+fm.to_user.value,"","height=510,width=400,statusbar=no,top=0");
return false;
}
if(!content.indexOf("/rank"))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -