diff --git a/webui/config.php b/webui/config.php index 9b031c43..9c863955 100644 --- a/webui/config.php +++ b/webui/config.php @@ -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, diff --git a/webui/controller/message/notspam.php b/webui/controller/message/notspam.php new file mode 100644 index 00000000..33fe581c --- /dev/null +++ b/webui/controller/message/notspam.php @@ -0,0 +1,43 @@ +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']); + + } + + +} + +?> diff --git a/webui/model/search/message.php b/webui/model/search/message.php index 8d229462..747ff493 100644 --- a/webui/model/search/message.php +++ b/webui/model/search/message.php @@ -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 ''; } diff --git a/webui/view/javascript/piler-in.js b/webui/view/javascript/piler-in.js index 4b8d57f7..ac545c15 100644 --- a/webui/view/javascript/piler-in.js +++ b/webui/view/javascript/piler-in.js @@ -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]"); diff --git a/webui/view/theme/default/templates/message/view.tpl b/webui/view/theme/default/templates/message/view.tpl index 67e57dfa..8dc771a1 100644 --- a/webui/view/theme/default/templates/message/view.tpl +++ b/webui/view/theme/default/templates/message/view.tpl @@ -22,6 +22,9 @@   |   + + + |   |   diff --git a/webui/view/theme/mobile/templates/message/view.tpl b/webui/view/theme/mobile/templates/message/view.tpl index 180eeae7..f7db4e7a 100644 --- a/webui/view/theme/mobile/templates/message/view.tpl +++ b/webui/view/theme/mobile/templates/message/view.tpl @@ -23,6 +23,10 @@ |   + + |   + + |