diff --git a/webui/.htaccess b/webui/.htaccess index ee91d6b3..c7fd6e03 100644 --- a/webui/.htaccess +++ b/webui/.htaccess @@ -6,6 +6,7 @@ RewriteRule ^expert.php /index.php?route=search/search&type=expert [L] RewriteRule ^search-helper.php /index.php?route=search/helper [L] RewriteRule ^audit-helper.php /index.php?route=audit/helper [L] RewriteRule ^message.php /index.php?route=message/view [L] +RewriteRule ^bulkrestore.php /index.php?route=message/bulkrestore [L] RewriteRule ^settings.php /index.php?route=user/settings [L] RewriteRule ^login.php /index.php?route=login/login [L] RewriteRule ^logout.php /index.php?route=login/logout [L] diff --git a/webui/config.php b/webui/config.php index 904667e8..3f020105 100644 --- a/webui/config.php +++ b/webui/config.php @@ -126,6 +126,7 @@ define('FROM_LENGTH_TO_SHOW', 28); define('SEARCH_HELPER_URL', SITE_URL . 'search-helper.php'); define('AUDIT_HELPER_URL', SITE_URL . 'audit-helper.php'); +define('BULK_RESTORE_URL', SITE_URL . 'bulkrestore.php'); define('SAVE_SEARCH_URL', SITE_URL . 'index.php?route=search/save'); define('SEARCH_TAG_URL', SITE_URL . 'index.php?route=search/tag'); diff --git a/webui/controller/message/bulkrestore.php b/webui/controller/message/bulkrestore.php new file mode 100644 index 00000000..21d726ef --- /dev/null +++ b/webui/controller/message/bulkrestore.php @@ -0,0 +1,54 @@ +id = "content"; + $this->template = "message/bulkrestore.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->load->model('mail/mail'); + + $this->document->title = $this->data['text_message']; + + if(!isset($this->request->post['idlist']) || $this->request->post['idlist'] == '') { die("no idlist parameter given"); } + + list($a, $idlist) = $this->model_search_search->check_your_permission_by_id_list(explode(",", $this->request->post['idlist'])); + + + $this->data['username'] = Registry::get('username'); + + $rcpt = array(); + + + array_push($rcpt, $_SESSION['email']); + + + $this->data['restored'] = 0; + + foreach($idlist as $id) { + + AUDIT(ACTION_RESTORE_MESSAGE, '', '', $id, ''); + + /*$x = $this->model_mail_mail->send_smtp_email(SMARTHOST, SMARTHOST_PORT, SMTP_DOMAIN, SMTP_FROMADDR, $rcpt, + "Received: by piler" . EOL . PILER_HEADER_FIELD . $id . EOL . $this->model_search_message->get_raw_message($id) ); + + if($x == 1) { $this->data['restored']++; }*/ + } + + $this->render(); + } + + +} + +?> diff --git a/webui/controller/search/tag.php b/webui/controller/search/tag.php index 3d162b31..0d40fc32 100644 --- a/webui/controller/search/tag.php +++ b/webui/controller/search/tag.php @@ -23,7 +23,7 @@ class ControllerSearchTag extends Controller { $q = ''; - $ids = $this->model_search_search->check_your_permission_by_id_list($idlist); + list($ids, $a) = $this->model_search_search->check_your_permission_by_id_list($idlist); for($i=0; $idb->query("SELECT distinct id FROM " . VIEW_MESSAGES . " WHERE `id` IN ($q2) AND ( `from` IN ($q) OR `to` IN ($q) )", $arr); + $query = $this->db->query("SELECT distinct id, piler_id FROM " . VIEW_MESSAGES . " WHERE `id` IN ($q2) AND ( `from` IN ($q) OR `to` IN ($q) )", $arr); if($query->num_rows > 0) { foreach ($query->rows as $q) { array_push($result, $q['id']); + array_push($result2, $q['piler_id']); } } - return $result; + return array($result, $result2); } diff --git a/webui/view/javascript/piler.js b/webui/view/javascript/piler.js index ac56e9e4..c22731a0 100644 --- a/webui/view/javascript/piler.js +++ b/webui/view/javascript/piler.js @@ -385,6 +385,62 @@ function tag_search_results(url){ } +function restore_selected_emails(url) { + var a = document.getElementById('results'); + var idlist = ""; + + len = a.childNodes.length; + + for(i=0; i