added a not spam link to preview pane

This commit is contained in:
SJ 2014-01-16 12:57:29 +01:00
parent c859b93096
commit 4b08cc3f96
6 changed files with 88 additions and 0 deletions

View File

@ -399,6 +399,7 @@ define('ACTION_UNAUTHORIZED_REMOVE_MESSAGE', 14);
define('ACTION_DOWNLOAD_ATTACHMENT', 15);
define('ACTION_UNAUTHORIZED_DOWNLOAD_ATTACHMENT', 16);
define('ACTION_VIEW_JOURNAL', 17);
define('ACTION_NOT_SPAM', 18);
$actions = array(
'unknown' => 1,

View File

@ -0,0 +1,43 @@
<?php
class ControllerMessageNotSpam extends Controller {
public function index(){
$this->id = "content";
$this->template = "message/headers.tpl";
$this->layout = "common/layout-empty";
$request = Registry::get('request');
$db = Registry::get('db');
$this->load->model('search/search');
$this->load->model('search/message');
$this->load->model('user/user');
$this->document->title = $this->data['text_message'];
$this->data['id'] = $this->request->post['id'];
if(!verify_piler_id($this->data['id'])) {
AUDIT(ACTION_UNKNOWN, '', '', $this->data['id'], 'unknown id: ' . $this->data['id']);
die("invalid id: " . $this->data['id']);
}
if(!$this->model_search_search->check_your_permission_by_id($this->data['id'])) {
AUDIT(ACTION_UNAUTHORIZED_VIEW_MESSAGE, '', '', $this->data['id'], '');
die("no permission for " . $this->data['id']);
}
AUDIT(ACTION_NOT_SPAM, '', '', $this->data['id'], '');
$this->model_search_message->not_spam($this->data['id']);
}
}
?>

View File

@ -710,6 +710,28 @@ class ModelSearchMessage extends Model {
}
public function is_message_spam($id = 0) {
$spam = 0;
if($id > 0) {
$query = $this->db->query("SELECT spam FROM " . TABLE_META . " WHERE id=?", array($id));
if(isset($query->row['spam'])) { $spam = $query->row['spam']; }
}
return $spam;
}
public function not_spam($id = 0) {
if($id > 0) {
$query = $this->db->query("UPDATE " . TABLE_META . " SET spam=0, retained=? WHERE id=?", array(NOW + (DEFAULT_RETENTION*86400), $id));
}
}
public function get_message_tag($id = '', $uid = 0) {
if($id == '' || $uid <= 0) { return ''; }

View File

@ -303,6 +303,21 @@ var Piler =
},
not_spam:function(id)
{
Piler.log("[not_spam]", id);
jQuery.ajax('index.php?route=message/notspam', {
data: { id: id },
type: "POST"
})
.done( function( a ) {})
.fail(function(a, b) { alert("Problem retrieving XML data:" + b) });
Piler.show_message('messagebox1', "OK", 0.8);
},
restore_message:function(id)
{
Piler.log("[restore_message]");

View File

@ -22,6 +22,9 @@
<a class="messagelink" href="#" onclick="Piler.view_headers(<?php print $id; ?>);"><i class="icon-envelope-alt"></i>&nbsp;<?php print $text_view_headers; ?></a>
<?php if($message['has_journal'] == 1 && Registry::get('auditor_user') == 1 && SHOW_ENVELOPE_JOURNAL == 1) { ?>
| <a class="messagelink" href="#" onclick="Piler.view_journal(<?php print $id; ?>);"><i class="icon-envelope-alt"></i>&nbsp;<?php print $text_view_journal_envelope; ?></a>
<?php } ?>
<?php if($spam == 1) { ?>
| <a class="messagelink" href="#" onclick="Piler.not_spam(<?php print $id; ?>);"><i class="icon-exclamation-sign"></i>&nbsp;<?php print $text_not_spam; ?></a>
<?php } ?>
| <a href="#" onclick="Piler.print_div('messageblock');"><i class="icon-print"></i>&nbsp;<?php print $text_print_message; ?></a>

View File

@ -23,6 +23,10 @@
<?php if($message['has_journal'] == 1 && Registry::get('auditor_user') == 1 && SHOW_ENVELOPE_JOURNAL == 1) { ?>
| <a class="messagelink" href="#" onclick="Piler.view_journal(<?php print $id; ?>);"><i class="icon-envelope"></i>&nbsp;<?php print $text_view_journal_envelope; ?></a>
<?php } ?>
<?php if($spam == 1) { ?>
| <a class="messagelink" href="#" onclick="Piler.not_spam(<?php print $id; ?>);"><i class="icon-exclamation-sign"></i>&nbsp;<?php print $text_not_spam; ?></a>
<?php } ?>
| <a class="messagelink" href="#" onclick="Piler.print_div('messageblock');"><i class="icon-print"></i>&nbsp;<?php print $text_print_message; ?></a>
<?php if(ENABLE_ON_THE_FLY_VERIFICATION == 0) {