Skip to content
Snippets Groups Projects
Commit 3020c04b authored by deuce's avatar deuce
Browse files

Check for delete permissions before deleting messages.

parent c48918f0
No related branches found
No related tags found
No related merge requests found
...@@ -13,12 +13,26 @@ if(http_request.query.Action=="Delete Message(s)") { ...@@ -13,12 +13,26 @@ if(http_request.query.Action=="Delete Message(s)") {
var deleted=0; var deleted=0;
var errors=0; var errors=0;
errorlist=new Array; errorlist=new Array;
for(num in http_request.query.number) {
if(msgbase.remove_msg(false,parseInt(http_request.query.number[num]))) if(sub!='mail' && !msg_area.grp_list[g].sub_list[s].is_operator) {
deleted++; errorlist.push("Only operators can delete messages!");
else { errors++;
errors++; }
errorlist.push(msgbase.last_error); else {
for(num in http_request.query.number) {
var mnum=parseInt(http_request.query.number[num]);
if(sub==mail && ((idx=get_msg_index(false,mnum))==null || idx.to!=user.number) {
errors++;
errorlist.push("Cannot delete message "+mnum);
}
else {
if(msgbase.remove_msg(false,mnum))
deleted++;
else {
errors++;
errorlist.push(msgbase.last_error);
}
}
} }
} }
template.title=deleted+" Messages Deleted"; template.title=deleted+" Messages Deleted";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment