Post by wormopolis on Jul 7, 2010 23:11:44 GMT -6
Browser Tested: IE and FF
Location: main footer
puts a link at the bottom of PMs to allow user to forward a protected copy of a "naughty" PM to the admin (or whoever you list as a recipient). variables also allow recipients to be edited or not.
Preview:
PMs will have a "report to admin" link at the bottom (green circle). Click that link to notify admin (or whoever you set up to be recipient).
A response form will be generated. if you choose to protect recipients, the box will be greyed out (green circle). The quoted message will be in its own protected box that cannot be edited (red circle). at the bottom of the report, the preview button will be gone and there will be a "Report User" button.
This is what the report looks like to the recipients.
Location: main footer
puts a link at the bottom of PMs to allow user to forward a protected copy of a "naughty" PM to the admin (or whoever you list as a recipient). variables also allow recipients to be edited or not.
<script type="text/javascript">
<!--
/*
Report PM To Admin v1.35
By Wormopolis
Do Not Repost
*/
var rptLinkText = "Report to Admin";
var rptSubject = "Reporting User: ";
var rptBody = "I am reporting this user for what he sent me in the following PM:";
var rptTo = "admin, sobhraj"; // EDIT THIS LIST FOR ALL THE RECIPIENTS. IMPORTANT IT IS ACCURATE!
var allowRecipientEdit = false; //EDIT true or false if you want user to be able to change recipients
var allowSubjectEdit = false; //EDIT true or false if you want user to be able to change subject
// shouldnt need to edit below
function stripTags(nStr) {
if(nStr.match(/<FONT/i)) {
start=nStr.indexOf(">")+1;
end=nStr.indexOf("</",start);
nStr=nStr.substring(start,end);
}
return nStr;
}
function URLencode(sStr) {
return escape(sStr).replace(/\+/g, '%2B').replace(/\"/g,'%22').replace(/\'/g, '%27');
}
var tds = document.getElementsByTagName("td");
var i; var recentName; var recentDate; var pmRptLink;
if (location.href.match("REP0RTING=1")) {
if (document.postForm) {
var temp=unescape(location.href.split("subject=")[1].split("&quo")[0]);
document.postForm.subject.value=temp.split("::")[0];
Qdate=temp.split("::")[1];
please=document.createElement("textarea");
please.rows=document.postForm.message.rows;
please.cols=document.postForm.message.cols;
postForm.message.rows=3;
please.style.background="#CCCCCC";
if (!allowRecipientEdit) document.postForm.to.disabled=true;
if (!allowSubjectEdit) document.postForm.subject.disabled=true;
please.value=document.postForm.message.value;
document.postForm.message.value=rptBody;
regMessage=document.postForm.message.parentNode.firstChild;
regMessage.parentNode.appendChild(please)
if (document.addEventListener) {
please.addEventListener('focus',function() {document.postForm.message.focus();},false);
please.disabled="disabled";
} else {
please.attachEvent('onfocus',function() {document.postForm.message.focus();});
}
function addBackQuote(){
if (document.postForm.to.disabled) document.postForm.to.disabled=false;
if (document.postForm.subject.disabled) document.postForm.subject.disabled=false;
postForm.message.value+=please.value+Qdate;
}
if(document.addEventListener){
postForm.addEventListener('submit',addBackQuote,false);
} else {
postForm.attachEvent('onsubmit',addBackQuote);
}
btns=document.getElementsByTagName('input');
for (b=0; b<btns.length; b++) {
if (btns[b].type=="submit" && btns[b].value=="Send Personal Message") btns[b].value="Report User";
if (btns[b].type=="submit" && btns[b].value=="Preview") btns[b].style.display="none";
}
}
}
if(location.href.match(/action=pmview/i) ){
for(i=0; i<tds.length; i++){
if(tds.item(i).align == "right" && tds.item(i).firstChild.nodeName.match(/font/i)){
if(tds.item(i).lastChild.firstChild.nodeName.match(/img/i) && tds.item(i).lastChild.firstChild.alt.match(/IP:/i)){
msgLink=location.href.split("id=")[1];
tds.item(i).firstChild.replaceChild(document.createTextNode(" - "), tds.item(i).firstChild.lastChild);
pmRptLink = document.createElement("a");
pmRptLink.href = "/index.cgi?action=pmsend&to="+rptTo+"&subject=";
pmRptLink.href+=URLencode(rptSubject+recentName+"::"+recentDate)+"&quo"+"te="+msgLink;
pmRptLink.href+="&view=1&REP0RTING=1";
pmRptLink.innerHTML=rptLinkText;
tds.item(i).firstChild.appendChild(pmRptLink);
tds.item(i).firstChild.appendChild(document.createTextNode(" "));
}
} else {
if(tds.item(i).width == "20%") {
if (tds.item(i).firstChild.nodeName.match(/b/i)){
if (tds.item(i).firstChild.firstChild.nodeName=='A') {
recentName = tds.item(i).firstChild.firstChild.innerHTML;
recentName=stripTags(recentName);
recentDate= tds.item(i).nextSibling.getElementsByTagName('td')[1].getElementsByTagName('font')[1].innerHTML;
var dt= new Date();
var ydt= new Date();
ydt.setDate(ydt.getDate()-1);
recentDate=recentDate.replace(/yesterday/i,ydt.toDateString()).replace(/<b>today<\/b>/i,dt.toDateString());
}
}
}
}
}
}
// -->
</script>
Preview:
PMs will have a "report to admin" link at the bottom (green circle). Click that link to notify admin (or whoever you set up to be recipient).
A response form will be generated. if you choose to protect recipients, the box will be greyed out (green circle). The quoted message will be in its own protected box that cannot be edited (red circle). at the bottom of the report, the preview button will be gone and there will be a "Report User" button.
This is what the report looks like to the recipients.