2015-07-07 14:12:35 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
class ControllerMessageBulkremove extends Controller {
|
|
|
|
|
|
|
|
public function index(){
|
|
|
|
|
|
|
|
$this->id = "content";
|
|
|
|
$this->template = "message/bulkremove.tpl";
|
|
|
|
$this->layout = "common/layout-empty";
|
|
|
|
|
|
|
|
$session = Registry::get('session');
|
|
|
|
$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'];
|
|
|
|
|
|
|
|
if(!isset($this->request->post['idlist']) || $this->request->post['idlist'] == '') { die("no idlist parameter given"); }
|
2019-07-14 19:20:49 +02:00
|
|
|
if(!isset($this->request->post['reason']) || $this->request->post['reason'] == '') { die("no reason parameter given"); }
|
2015-07-07 14:12:35 +02:00
|
|
|
|
|
|
|
$idlist = $this->model_search_search->check_your_permission_by_id_list(explode(",", $this->request->post['idlist']));
|
|
|
|
|
2016-02-06 21:14:00 +01:00
|
|
|
$this->data['removed'] = 0;
|
2015-07-07 14:12:35 +02:00
|
|
|
|
|
|
|
$this->data['username'] = Registry::get('username');
|
|
|
|
|
2015-07-08 15:22:35 +02:00
|
|
|
if(Registry::get('auditor_user') == 0) {
|
|
|
|
die("go away");
|
|
|
|
}
|
2015-07-07 14:12:35 +02:00
|
|
|
|
2019-07-14 21:58:18 +02:00
|
|
|
if(NEED_TO_APPROVE_DELETE) {
|
2019-08-04 08:09:21 +02:00
|
|
|
$deleted = -1;
|
2019-08-20 15:41:18 +02:00
|
|
|
} else {
|
|
|
|
$deleted = 1;
|
2019-07-14 21:58:18 +02:00
|
|
|
}
|
|
|
|
|
2015-07-07 14:12:35 +02:00
|
|
|
foreach($idlist as $id) {
|
2019-07-28 11:02:44 +02:00
|
|
|
$db->query("INSERT INTO " . TABLE_DELETED . " (id, requestor, reason1, date1, deleted) VALUES(?,?,?,?,?)", [$id, $this->data['username'], $this->request->post['reason'], NOW, $deleted]);
|
2015-07-07 14:12:35 +02:00
|
|
|
|
2019-07-14 21:58:18 +02:00
|
|
|
if(NEED_TO_APPROVE_DELETE) {
|
2019-07-14 19:20:49 +02:00
|
|
|
AUDIT(ACTION_MARK_MESSAGE_FOR_REMOVAL, '', '', $id, '');
|
|
|
|
syslog(LOG_INFO, $this->data['username'] . " marked message for removal: $id");
|
|
|
|
} else {
|
|
|
|
AUDIT(ACTION_REMOVE_MESSAGE, '', '', $id, '');
|
|
|
|
$db->query("UPDATE " . TABLE_META . " SET retained=? WHERE id=?", [NOW, $id]);
|
2022-12-31 08:09:30 +01:00
|
|
|
if(RT) {
|
2024-01-02 08:09:53 +01:00
|
|
|
$sphxrw = Registry::get('sphxrw');
|
|
|
|
$sphxrw->query("DELETE FROM " . SPHINX_MAIN_INDEX . " WHERE id=" . (int)$this->data['id']);
|
2022-12-31 08:09:30 +01:00
|
|
|
}
|
|
|
|
|
2019-07-14 19:20:49 +02:00
|
|
|
syslog(LOG_INFO, $this->data['username'] . " removed message: $id");
|
|
|
|
}
|
2015-07-07 14:12:35 +02:00
|
|
|
|
2015-07-08 15:22:35 +02:00
|
|
|
$this->data['removed']++;
|
2015-07-07 14:12:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$this->render();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|