added the private feature

This commit is contained in:
SJ 2016-02-10 14:57:30 +01:00
parent 93e1d0e7fe
commit 2fbb41264c
20 changed files with 117 additions and 2 deletions

View File

@ -314,6 +314,12 @@ create table if not exists `note` (
) ENGINE=InnoDB;
create table if not exists `private` (
`id` bigint unsigned not null unique,
key (`id`)
) ENGINE=InnoDB;
create table if not exists `remote` (
`remotedomain` char(64) not null primary key,
`remotehost` char(64) not null,

View File

@ -377,6 +377,7 @@ define('TABLE_GOOGLE_IMAP', 'google_imap');
define('TABLE_AUTOSEARCH', 'autosearch');
define('TABLE_LEGAL_HOLD', 'legal_hold');
define('TABLE_TIMESTAMP', 'timestamp');
define('TABLE_PRIVATE', 'private');
define('VIEW_MESSAGES', 'v_messages');
define('EOL', "\n");
@ -448,6 +449,7 @@ define('ACTION_DOWNLOAD_ATTACHMENT', 15);
define('ACTION_UNAUTHORIZED_DOWNLOAD_ATTACHMENT', 16);
define('ACTION_VIEW_JOURNAL', 17);
define('ACTION_NOT_SPAM', 18);
define('ACTION_MARK_AS_PRIVATE', 19);
$actions = array(
'unknown' => 1,
@ -461,7 +463,8 @@ $actions = array(
'search' => 10,
'save_search' => 11,
'download_attachment' => 15,
'journal' => 17
'journal' => 17,
'private' => 19
);

View File

@ -0,0 +1,50 @@
<?php
class ControllerMessagePrivate 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_MARK_AS_PRIVATE, '', '', $this->data['id'], '');
$this->data['username'] = Registry::get('username');
if(Registry::get('auditor_user') == 1) {
syslog(LOG_INFO, "hokamoka:" . $this->data['id']);
$this->model_search_message->mark_as_private($this->data['id']);
}
}
}
?>

View File

@ -480,5 +480,6 @@ $_['text_customer_delete_confirm_message'] = 'Opravdu chcete smazat zákazníka'
$_['text_with_selected'] = 'S označenými';
$_['text_compliance_warning'] = 'The delete feature is enabled, therefore the archive is NOT compliant!';
$_['text_private'] = "Private";
?>

View File

@ -486,5 +486,6 @@ $_['text_legal_hold'] = "Legal hold";
$_['text_compliance_warning'] = 'The delete feature is enabled, therefore the archive is NOT compliant!';
$_['text_folder_rules'] = "Folder rules";
$_['text_private'] = "Private";
?>

View File

@ -265,6 +265,7 @@ $_['text_policy_group'] = "Policy group";
$_['text_policy_name'] = "Policy name";
$_['text_previous'] = "Previous";
$_['text_print_message'] = "Print";
$_['text_private'] = "Private";
$_['text_processed_emails'] = "Processed emails";
$_['text_progress'] = "Progress";
$_['text_purge_all_messages_from_quarantine'] = "Purge all your own messages from quarantine";

View File

@ -485,5 +485,6 @@ $_['text_legal_hold'] = "Legal hold";
$_['text_compliance_warning'] = 'The delete feature is enabled, therefore the archive is NOT compliant!';
$_['text_folder_rules'] = "Folder rules";
$_['text_private'] = "Private";
?>

View File

@ -482,5 +482,6 @@ $_['text_legal_hold'] = "Legal hold";
$_['text_compliance_warning'] = 'The delete feature is enabled, therefore the archive is NOT compliant!';
$_['text_folder_rules'] = "Folder rules";
$_['text_private'] = "Private";
?>

View File

@ -266,6 +266,7 @@ $_['text_policy_group'] = "H
$_['text_policy_name'] = "Házirend neve";
$_['text_previous'] = "Előző";
$_['text_print_message'] = "Nyomtatás";
$_['text_private'] = "Privát";
$_['text_processed_emails'] = "Feldolgozott levelek";
$_['text_progress'] = "Státusz";
$_['text_purge_all_messages_from_quarantine'] = "Összes saját üzenet törlése a karanténból";

View File

@ -266,6 +266,7 @@ $_['text_policy_group'] = "Házirend azonosító";
$_['text_policy_name'] = "Házirend neve";
$_['text_previous'] = "Előző";
$_['text_print_message'] = "Nyomtatás";
$_['text_private'] = "Privát";
$_['text_processed_emails'] = "Feldolgozott levelek";
$_['text_progress'] = "Státusz";
$_['text_purge_all_messages_from_quarantine'] = "Összes saját üzenet törlése a karanténból";

View File

@ -482,5 +482,6 @@ $_['text_with_selected'] = 'wraz z zaznaczonymi';
$_['text_compliance_warning'] = 'The delete feature is enabled, therefore the archive is NOT compliant!';
$_['text_folder_rules'] = "Folder rules";
$_['text_private'] = "Private";
?>

View File

@ -475,5 +475,6 @@ $_['text_legal_hold'] = "Legal hold";
$_['text_compliance_warning'] = 'The delete feature is enabled, therefore the archive is NOT compliant!';
$_['text_folder_rules'] = "Folder rules";
$_['text_private'] = "Private";
?>

View File

@ -483,5 +483,6 @@ $_['text_legal_hold'] = "Legal hold";
$_['text_compliance_warning'] = 'The delete feature is enabled, therefore the archive is NOT compliant!';
$_['text_folder_rules'] = "Folder rules";
$_['text_private'] = "Private";
?>

View File

@ -483,5 +483,6 @@ $_['text_legal_hold'] = "Legal hold";
$_['text_compliance_warning'] = 'The delete feature is enabled, therefore the archive is NOT compliant!';
$_['text_folder_rules'] = "Folder rules";
$_['text_private'] = "Private";
?>

View File

@ -870,6 +870,15 @@ class ModelSearchMessage extends Model {
}
public function mark_as_private($id = 0) {
if($id > 0) {
$query = $this->db->query("INSERT INTO " . TABLE_PRIVATE . " (id) VALUES(?)", array($id));
}
return 1;
}
public function get_message_tag($id = '', $uid = 0) {
if($id == '' || $uid <= 0) { return ''; }

View File

@ -484,6 +484,7 @@ class ModelSearchSearch extends Model {
$rcpt = $srcpt = array();
$tag = array();
$note = array();
$private = array();
$q = '';
global $SUPPRESS_RECIPIENTS;
@ -515,6 +516,12 @@ class ModelSearchSearch extends Model {
if(isset($query->rows)) {
$privates = $this->db->query("SELECT `id` FROM `" . TABLE_PRIVATE . "` WHERE id IN ($q)", $ids);
foreach ($privates->rows as $p) {
$private[$p['id']] = 1;
}
array_unshift($ids, (int)$session->get("uid"));
$tags = $this->db->query("SELECT `id`, `tag` FROM `" . TABLE_TAG . "` WHERE `uid`=? AND `id` IN ($q)", $ids);
@ -571,6 +578,8 @@ class ModelSearchSearch extends Model {
$m['note'] = preg_replace("/\"/", "*", strip_tags($m['note']));
$m['tag'] = preg_replace("/\"/", "*", strip_tags($m['tag']));
if(isset($private[$m['id']])) { $m['private'] = 1; } else { $m['private'] = 0; }
array_push($messages, $m);
}
@ -693,6 +702,12 @@ class ModelSearchSearch extends Model {
}
}
else {
$query = $this->db->query("SELECT id FROM " . TABLE_PRIVATE . " WHERE id=?", array($id));
if(isset($query->row['id'])) {
return 0;
}
$emails = $session->get("emails");
while(list($k, $v) = each($emails)) {

View File

@ -328,6 +328,23 @@ var Piler =
},
mark_as_private:function(id)
{
Piler.log("[mark_as_private]", id);
Piler.poor_mans_keepalive_for_dummy_browsers();
jQuery.ajax('index.php?route=message/private', {
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

@ -1690,6 +1690,7 @@ html,body{height:auto !important;height:100%;min-height:100%;}
.resultrow{font-style:italic;cursor:pointer;}
.resultrow.new{font-style:normal;}
.xxx{color:#aaa;}
.private{color:red;}
.table-striped tbody>tr.resultrow.selected:nth-child(odd)>td{background-color:#ffffdd;}
.table-striped tbody>tr.resultrow.selected:nth-child(even)>td{background-color:#ffffdd;}
table#resultstable{margin-bottom:0;}

View File

@ -25,6 +25,9 @@
<?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(Registry::get('auditor_user') == 1) { ?>
| <a class="messagelink" href="#" onclick="Piler.mark_as_private(<?php print $id; ?>);"><i class="icon-bookmark-empty"></i>&nbsp;<?php print $text_private; ?></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 } ?>

View File

@ -51,7 +51,7 @@
<td id="c4_r<?php print $i; ?>" class="resultcell from"><?php if($message['from'] != $message['shortfrom']) { ?><span title="<?php print $message['from']; ?>"><?php print $message['shortfrom']; ?></span><?php } else { print $message['from']; } ?></td>
<td id="c5_r<?php print $i; ?>" class="resultcell to"><?php if($message['to'] != $message['shortto']) { ?><span title="<?php print $message['to']; ?>"><?php print $message['shortto']; ?>&nbsp;<i class=" muted icon-group"></i></span><?php } else { print $message['to']; } ?></td>
<td id="c6_r<?php print $i; ?>" class="resultcell subject"><a href="#" <?php if($message['deleted'] == 1) { ?>class="xxx"<?php } ?>><?php print $message['subject']; ?></a><?php if(ENABLE_REFERENCES == 1 && $message['reference']) { ?> <a href="#" <?php if($message['deleted'] == 1) { ?>class="xxx"<?php } ?> title="<?php print $text_conversation_available; ?>" onclick="$('#ref').val('<?php print $message['reference']; ?>'); Piler.expert(this);">[+]</span></a><?php } ?></td>
<td id="c6_r<?php print $i; ?>" class="resultcell subject"><a href="#" <?php if($message['deleted'] == 1) { ?>class="xxx"<?php } ?>><?php print $message['subject']; ?></a><?php if(ENABLE_REFERENCES == 1 && $message['reference']) { ?> <a href="#" <?php if($message['deleted'] == 1) { ?>class="xxx"<?php } ?> title="<?php print $text_conversation_available; ?>" onclick="$('#ref').val('<?php print $message['reference']; ?>'); Piler.expert(this);">[+]</span></a><?php } ?><?php if($message['private'] == 1) { ?> <span class="private">P</span><?php } ?></td>
<td id="c7_r<?php print $i; ?>" class="resultcell size"><?php print $message['size']; ?></td>
<td id="c8_r<?php print $i; ?>" class="resultcell end"><?php if($message['spam'] == 1) { ?><i class="spam icon-warning-sign icon-large" title="<?php print $text_spam_flag; ?>"></i><?php } else { ?>&nbsp;<?php } ?></td>