mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-25 19:10:11 +01:00
added conversation available feature
This commit is contained in:
parent
cd68dd1f1a
commit
ea9da966ff
@ -266,11 +266,11 @@ CLOSE:
|
|||||||
|
|
||||||
int store_meta_data(struct session_data *sdata, struct _state *state, struct __config *cfg){
|
int store_meta_data(struct session_data *sdata, struct _state *state, struct __config *cfg){
|
||||||
int rc, ret=ERR;
|
int rc, ret=ERR;
|
||||||
char *subj, *p, s[MAXBUFSIZE], s2[SMALLBUFSIZE], vcode[2*DIGEST_LENGTH+1];
|
char *subj, *p, s[MAXBUFSIZE], s2[SMALLBUFSIZE], vcode[2*DIGEST_LENGTH+1], ref[2*DIGEST_LENGTH+1];
|
||||||
|
|
||||||
MYSQL_STMT *stmt;
|
MYSQL_STMT *stmt;
|
||||||
MYSQL_BIND bind[5];
|
MYSQL_BIND bind[4];
|
||||||
unsigned long len[5];
|
unsigned long len[4];
|
||||||
|
|
||||||
my_ulonglong id=0;
|
my_ulonglong id=0;
|
||||||
|
|
||||||
@ -279,10 +279,14 @@ int store_meta_data(struct session_data *sdata, struct _state *state, struct __c
|
|||||||
if(*subj == ' ') subj++;
|
if(*subj == ' ') subj++;
|
||||||
|
|
||||||
snprintf(s, sizeof(s)-1, "%llu+%s%s%s%ld%ld%d%d%d%d%s%s%s", id, subj, state->b_from, state->message_id, sdata->now, sdata->sent, sdata->tot_len, sdata->hdr_len, sdata->direction, state->n_attachments, sdata->ttmpfile, sdata->digest, sdata->bodydigest);
|
snprintf(s, sizeof(s)-1, "%llu+%s%s%s%ld%ld%d%d%d%d%s%s%s", id, subj, state->b_from, state->message_id, sdata->now, sdata->sent, sdata->tot_len, sdata->hdr_len, sdata->direction, state->n_attachments, sdata->ttmpfile, sdata->digest, sdata->bodydigest);
|
||||||
|
|
||||||
digest_string(s, &vcode[0]);
|
digest_string(s, &vcode[0]);
|
||||||
|
|
||||||
|
memset(ref, 0, sizeof(ref));
|
||||||
|
if(strlen(state->reference) > 10) digest_string(state->reference, &ref[0]);
|
||||||
|
|
||||||
snprintf(s, MAXBUFSIZE-1, "INSERT INTO %s (`from`,`fromdomain`,`subject`,`spam`,`arrived`,`sent`,`size`,`hlen`,`direction`,`attachments`,`piler_id`,`message_id`,`reference`,`digest`,`bodydigest`,`vcode`) VALUES(?,?,?,%d,%ld,%ld,%d,%d,%d,%d,'%s',?,?,'%s','%s','%s')", SQL_METADATA_TABLE, sdata->spam_message, sdata->now, sdata->sent, sdata->tot_len, sdata->hdr_len, sdata->direction, state->n_attachments, sdata->ttmpfile, sdata->digest, sdata->bodydigest, vcode);
|
|
||||||
|
snprintf(s, MAXBUFSIZE-1, "INSERT INTO %s (`from`,`fromdomain`,`subject`,`spam`,`arrived`,`sent`,`size`,`hlen`,`direction`,`attachments`,`piler_id`,`message_id`,`reference`,`digest`,`bodydigest`,`vcode`) VALUES(?,?,?,%d,%ld,%ld,%d,%d,%d,%d,'%s',?,'%s','%s','%s','%s')", SQL_METADATA_TABLE, sdata->spam_message, sdata->now, sdata->sent, sdata->tot_len, sdata->hdr_len, sdata->direction, state->n_attachments, sdata->ttmpfile, ref, sdata->digest, sdata->bodydigest, vcode);
|
||||||
|
|
||||||
if(cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "%s: meta sql: *%s*", sdata->ttmpfile, s);
|
if(cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "%s: meta sql: *%s*", sdata->ttmpfile, s);
|
||||||
|
|
||||||
@ -331,11 +335,6 @@ int store_meta_data(struct session_data *sdata, struct _state *state, struct __c
|
|||||||
bind[3].is_null = 0;
|
bind[3].is_null = 0;
|
||||||
len[3] = strlen(state->message_id); bind[3].length = &len[3];
|
len[3] = strlen(state->message_id); bind[3].length = &len[3];
|
||||||
|
|
||||||
bind[4].buffer_type = MYSQL_TYPE_STRING;
|
|
||||||
bind[4].buffer = state->reference;
|
|
||||||
bind[4].is_null = 0;
|
|
||||||
len[4] = strlen(state->reference); bind[4].length = &len[4];
|
|
||||||
|
|
||||||
if(mysql_stmt_bind_param(stmt, bind)){
|
if(mysql_stmt_bind_param(stmt, bind)){
|
||||||
syslog(LOG_PRIORITY, "%s: %s.mysql_stmt_bind_param() error: %s", sdata->ttmpfile, SQL_METADATA_TABLE, mysql_stmt_error(stmt));
|
syslog(LOG_PRIORITY, "%s: %s.mysql_stmt_bind_param() error: %s", sdata->ttmpfile, SQL_METADATA_TABLE, mysql_stmt_error(stmt));
|
||||||
goto CLOSE;
|
goto CLOSE;
|
||||||
|
@ -17,8 +17,6 @@ define('ENABLE_LDAP_IMPORT_FEATURE', 0);
|
|||||||
|
|
||||||
define('HOLD_EMAIL', 0);
|
define('HOLD_EMAIL', 0);
|
||||||
|
|
||||||
define('DEMO', 0);
|
|
||||||
|
|
||||||
define('REMOTE_IMAGE_REPLACEMENT', '/view/theme/default/images/remote.gif');
|
define('REMOTE_IMAGE_REPLACEMENT', '/view/theme/default/images/remote.gif');
|
||||||
define('ICON_ARROW_UP', '/view/theme/default/images/arrowup.gif');
|
define('ICON_ARROW_UP', '/view/theme/default/images/arrowup.gif');
|
||||||
define('ICON_ARROW_DOWN', '/view/theme/default/images/arrowdown.gif');
|
define('ICON_ARROW_DOWN', '/view/theme/default/images/arrowdown.gif');
|
||||||
|
@ -19,7 +19,8 @@ class ControllerSearchHelper extends Controller {
|
|||||||
'direction' => '',
|
'direction' => '',
|
||||||
'size' => '',
|
'size' => '',
|
||||||
'attachment_type' => '',
|
'attachment_type' => '',
|
||||||
'tag' => ''
|
'tag' => '',
|
||||||
|
'ref' => ''
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -89,6 +90,8 @@ class ControllerSearchHelper extends Controller {
|
|||||||
if($this->a[$k]) { $this->a[$k] = substr($this->a[$k], 1, strlen($this->a[$k])); }
|
if($this->a[$k]) { $this->a[$k] = substr($this->a[$k], 1, strlen($this->a[$k])); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->a['ref'] = $this->request->post['ref'];
|
||||||
|
|
||||||
$this->a['sort'] = $this->request->post['sort'];
|
$this->a['sort'] = $this->request->post['sort'];
|
||||||
$this->a['order'] = $this->request->post['order'];
|
$this->a['order'] = $this->request->post['order'];
|
||||||
}
|
}
|
||||||
@ -116,24 +119,29 @@ class ControllerSearchHelper extends Controller {
|
|||||||
else if($v == 'attachment:' || $v == 'a:') { $token = 'attachment_type'; continue; }
|
else if($v == 'attachment:' || $v == 'a:') { $token = 'attachment_type'; continue; }
|
||||||
else if($v == 'size') { $token = 'size'; continue; }
|
else if($v == 'size') { $token = 'size'; continue; }
|
||||||
else if($v == 'tag:') { $token = 'tag'; continue; }
|
else if($v == 'tag:') { $token = 'tag'; continue; }
|
||||||
|
else if($v == 'ref:') { $token = 'ref'; continue; }
|
||||||
|
|
||||||
if($token == 'from') {
|
if($token == 'from') {
|
||||||
$v = fix_email_address($v);
|
$v = fix_email_address($v);
|
||||||
|
|
||||||
if(!strstr($v, '@')) { $this->a['from_domain'] .= "|$v"; }
|
if(substr($v, 0, 1) == '@') { $this->a['from_domain'] .= "|$v"; }
|
||||||
else {
|
else if(strstr($v, '@')) {
|
||||||
$this->a['from'] .= "|$v";
|
|
||||||
if(in_array($v, $_SESSION['emails'])) { $this->a['o_from'] .= "|$v"; } else { $this->a['f_from'] .= "|$v"; }
|
if(in_array($v, $_SESSION['emails'])) { $this->a['o_from'] .= "|$v"; } else { $this->a['f_from'] .= "|$v"; }
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
$this->a['from'] .= " $v";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if($token == 'to') {
|
else if($token == 'to') {
|
||||||
$v = fix_email_address($v);
|
$v = fix_email_address($v);
|
||||||
|
|
||||||
if(!strstr($v, '@')) { $this->a['to_domain'] .= "|$v"; }
|
if(substr($v, 0, 1) == '@') { $this->a['to_domain'] .= "|$v"; }
|
||||||
else {
|
else if(strstr($v, '@')) {
|
||||||
$this->a['to'] .= "|$v";
|
|
||||||
if(in_array($v, $_SESSION['emails'])) { $this->a['o_to'] .= "|$v"; } else { $this->a['f_to'] .= "|$v"; }
|
if(in_array($v, $_SESSION['emails'])) { $this->a['o_to'] .= "|$v"; } else { $this->a['f_to'] .= "|$v"; }
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
$this->a['to'] .= " $v";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if($token == 'subject') { $this->a['subject'] .= ' ' . $v; }
|
else if($token == 'subject') { $this->a['subject'] .= ' ' . $v; }
|
||||||
else if($token == 'body') { $this->a['body'] .= ' ' . $v; }
|
else if($token == 'body') { $this->a['body'] .= ' ' . $v; }
|
||||||
@ -143,6 +151,7 @@ class ControllerSearchHelper extends Controller {
|
|||||||
else if($token == 'size') { $this->a['size'] .= ' ' . $v; }
|
else if($token == 'size') { $this->a['size'] .= ' ' . $v; }
|
||||||
else if($token == 'attachment_type') { $this->a['attachment_type'] .= ' ' . $v; }
|
else if($token == 'attachment_type') { $this->a['attachment_type'] .= ' ' . $v; }
|
||||||
else if($token == 'tag') { $this->a['tag'] .= ' ' . $v; }
|
else if($token == 'tag') { $this->a['tag'] .= ' ' . $v; }
|
||||||
|
else if($token == 'ref') { $this->a['ref'] = $v; }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -159,20 +168,24 @@ class ControllerSearchHelper extends Controller {
|
|||||||
if($f == 'from') {
|
if($f == 'from') {
|
||||||
$v = fix_email_address($v);
|
$v = fix_email_address($v);
|
||||||
|
|
||||||
if(!strstr($v, '@')) { $this->a['from_domain'] .= "|$v"; }
|
if(substr($v, 0, 1) == '@') { $this->a['from_domain'] .= "|$v"; }
|
||||||
|
else if(strstr($v, '@')) {
|
||||||
|
if(in_array($v, $_SESSION['emails'])) { $this->a['o_from'] .= "|$v"; } else { $this->a['f_from'] .= "|$v"; }
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
$this->a['from'] .= "|$v";
|
$this->a['from'] .= "|$v";
|
||||||
if(in_array($v, $_SESSION['emails'])) { $this->a['o_from'] .= "|$v"; } else { $this->a['f_from'] .= "|$v"; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($f == 'to') {
|
if($f == 'to') {
|
||||||
$v = fix_email_address($v);
|
$v = fix_email_address($v);
|
||||||
|
|
||||||
if(!strstr($v, '@')) { $this->a['to_domain'] .= "|$v"; }
|
if(substr($v, 0, 1) == '@') { $this->a['to_domain'] .= "|$v"; }
|
||||||
|
else if(strstr($v, '@')) {
|
||||||
|
if(in_array($v, $_SESSION['emails'])) { $this->a['o_to'] .= "|$v"; } else { $this->a['f_to'] .= "|$v"; }
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
$this->a['to'] .= "|$v";
|
$this->a['to'] .= "|$v";
|
||||||
if(in_array($v, $_SESSION['emails'])) { $this->a['o_to'] .= "|$v"; } else { $this->a['f_to'] .= "|$v"; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ $_['text_close'] = "Close";
|
|||||||
$_['text_compressed'] = "compressed";
|
$_['text_compressed'] = "compressed";
|
||||||
$_['text_confirm_to_reset_counters'] = "Confirm to reset counters";
|
$_['text_confirm_to_reset_counters'] = "Confirm to reset counters";
|
||||||
$_['text_content_filter'] = "Content filter";
|
$_['text_content_filter'] = "Content filter";
|
||||||
|
$_['text_conversation_available'] = "Conversation available";
|
||||||
$_['text_counters'] = "Counters";
|
$_['text_counters'] = "Counters";
|
||||||
$_['text_cpu_load'] = "CPU load";
|
$_['text_cpu_load'] = "CPU load";
|
||||||
$_['text_cpu_usage'] = "CPU usage";
|
$_['text_cpu_usage'] = "CPU usage";
|
||||||
|
@ -34,6 +34,7 @@ $_['text_close'] = "Bez
|
|||||||
$_['text_compressed'] = "tömörített";
|
$_['text_compressed'] = "tömörített";
|
||||||
$_['text_confirm_to_reset_counters'] = "Számlálók nullázásának megerõsítése";
|
$_['text_confirm_to_reset_counters'] = "Számlálók nullázásának megerõsítése";
|
||||||
$_['text_content_filter'] = "Tartalomszûrõ";
|
$_['text_content_filter'] = "Tartalomszûrõ";
|
||||||
|
$_['text_conversation_available'] = "Levélváltás elérhetõ";
|
||||||
$_['text_counters'] = "Számlálók";
|
$_['text_counters'] = "Számlálók";
|
||||||
$_['text_cpu_load'] = "CPU terhelés";
|
$_['text_cpu_load'] = "CPU terhelés";
|
||||||
$_['text_cpu_usage'] = "CPU használat";
|
$_['text_cpu_usage'] = "CPU használat";
|
||||||
|
@ -34,6 +34,7 @@ $_['text_close'] = "Bezár";
|
|||||||
$_['text_compressed'] = "tömörített";
|
$_['text_compressed'] = "tömörített";
|
||||||
$_['text_confirm_to_reset_counters'] = "Számlálók nullázásának megerősítése";
|
$_['text_confirm_to_reset_counters'] = "Számlálók nullázásának megerősítése";
|
||||||
$_['text_content_filter'] = "Tartalomszűrő";
|
$_['text_content_filter'] = "Tartalomszűrő";
|
||||||
|
$_['text_conversation_available'] = "Levélváltás elérhető";
|
||||||
$_['text_counters'] = "Számlálók";
|
$_['text_counters'] = "Számlálók";
|
||||||
$_['text_cpu_load'] = "CPU terhelés";
|
$_['text_cpu_load'] = "CPU terhelés";
|
||||||
$_['text_cpu_usage'] = "CPU használat";
|
$_['text_cpu_usage'] = "CPU használat";
|
||||||
|
@ -43,6 +43,10 @@ class ModelSearchSearch extends Model {
|
|||||||
$all_ids = $m['ids'];
|
$all_ids = $m['ids'];
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
if($data['ref']){
|
||||||
|
$all_ids = $this->query_all_possible_IDs_by_reference($data['ref'], $cache_key);
|
||||||
|
}
|
||||||
|
else {
|
||||||
if($search_type == SIMPLE_SEARCH) {
|
if($search_type == SIMPLE_SEARCH) {
|
||||||
$conditions = $this->assemble_simple_query_conditions($data);
|
$conditions = $this->assemble_simple_query_conditions($data);
|
||||||
}
|
}
|
||||||
@ -52,6 +56,7 @@ class ModelSearchSearch extends Model {
|
|||||||
|
|
||||||
$all_ids = $this->query_all_possible_IDs($data, $conditions, $sort, $order, $sortorder, $cache_key);
|
$all_ids = $this->query_all_possible_IDs($data, $conditions, $sort, $order, $sortorder, $cache_key);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -85,7 +90,6 @@ class ModelSearchSearch extends Model {
|
|||||||
$email = $match = '';
|
$email = $match = '';
|
||||||
$n_fc = $n_tc = 0;
|
$n_fc = $n_tc = 0;
|
||||||
|
|
||||||
|
|
||||||
$data['f_from'] = $this->fix_email_address_for_sphinx($data['f_from']);
|
$data['f_from'] = $this->fix_email_address_for_sphinx($data['f_from']);
|
||||||
$data['o_from'] = $this->fix_email_address_for_sphinx($data['o_from']);
|
$data['o_from'] = $this->fix_email_address_for_sphinx($data['o_from']);
|
||||||
$data['f_to'] = $this->fix_email_address_for_sphinx($data['f_to']);
|
$data['f_to'] = $this->fix_email_address_for_sphinx($data['f_to']);
|
||||||
@ -100,11 +104,13 @@ class ModelSearchSearch extends Model {
|
|||||||
if(Registry::get('admin_user') == 1 || Registry::get('auditor_user') == 1) {
|
if(Registry::get('admin_user') == 1 || Registry::get('auditor_user') == 1) {
|
||||||
if($data['f_from']) { $f1 .= "|" . $data['f_from']; $n_fc++; }
|
if($data['f_from']) { $f1 .= "|" . $data['f_from']; $n_fc++; }
|
||||||
if($data['o_from']) { $f1 .= "|" . $data['o_from']; $n_fc++; }
|
if($data['o_from']) { $f1 .= "|" . $data['o_from']; $n_fc++; }
|
||||||
if($data['from_domain']) { $fd .= "(@fromdomain " . $data['from_domain'] . ")"; $n_fc++; }
|
if($data['from_domain']) { $fd .= "(@fromdomain " . substr($data['from_domain'], 1, strlen($data['from_domain'])) . ")"; $n_fc++; }
|
||||||
|
if($data['from']) { $f1 .= "|" . $this->fixup_sphinx_operators($data['from']); $n_fc++; }
|
||||||
|
|
||||||
if($data['f_to']) { $t1 .= "|" . $data['f_to']; $n_tc++; }
|
if($data['f_to']) { $t1 .= "|" . $data['f_to']; $n_tc++; }
|
||||||
if($data['o_to']) { $t1 .= "|" . $data['o_to']; $n_tc++; }
|
if($data['o_to']) { $t1 .= "|" . $data['o_to']; $n_tc++; }
|
||||||
if($data['to_domain']) { $td .= "(@todomain " . $data['to_domain'] . ")"; $n_tc++; }
|
if($data['to_domain']) { $td .= "(@todomain " . substr($data['to_domain'], 1, strlen($data['to_domain'])) . ")"; $n_tc++; }
|
||||||
|
if($data['to']) { $f2 .= "|" . $this->fixup_sphinx_operators($data['to']); $n_tc++; }
|
||||||
|
|
||||||
if($f1) { $f1 = "(@from " . substr($f1, 1, strlen($f1)) . ")"; }
|
if($f1) { $f1 = "(@from " . substr($f1, 1, strlen($f1)) . ")"; }
|
||||||
if($t1) { $t1 = "(@to " . substr($t1, 1, strlen($t1)) . ")"; }
|
if($t1) { $t1 = "(@to " . substr($t1, 1, strlen($t1)) . ")"; }
|
||||||
@ -115,11 +121,13 @@ class ModelSearchSearch extends Model {
|
|||||||
|
|
||||||
if($data['f_from']) { $f1 = "(@from " . $data['f_from'] . " @to $all_your_addresses)"; $n_fc++; }
|
if($data['f_from']) { $f1 = "(@from " . $data['f_from'] . " @to $all_your_addresses)"; $n_fc++; }
|
||||||
if($data['o_from']) { $f2 = "(@from " . $data['o_from'] . ")"; $n_fc++; }
|
if($data['o_from']) { $f2 = "(@from " . $data['o_from'] . ")"; $n_fc++; }
|
||||||
if($data['from_domain']) { $fd = "(@fromdomain " . $data['from_domain'] . " @to $all_your_addresses)"; $n_fc++; }
|
if($data['from_domain']) { $fd = "(@fromdomain " . substr($data['from_domain'], 1, strlen($data['from_domain'])) . " @to $all_your_addresses)"; $n_fc++; }
|
||||||
|
if($data['from']) { $fd = "(@from " . $this->fixup_sphinx_operators($data['from']) . " @to $all_your_addresses)"; $n_fc++; }
|
||||||
|
|
||||||
if($data['f_to']) { $t1 = "(@to " . $data['f_to'] . " @from $all_your_addresses)"; $n_tc++; }
|
if($data['f_to']) { $t1 = "(@to " . $data['f_to'] . " @from $all_your_addresses)"; $n_tc++; }
|
||||||
if($data['o_to']) { $t2 = "(@to " . $data['o_to'] . ")"; $n_tc++; }
|
if($data['o_to']) { $t2 = "(@to " . $data['o_to'] . ")"; $n_tc++; }
|
||||||
if($data['to_domain']) { $td = "(@todomain " . $data['to_domain'] . " @from $all_your_addresses)"; $n_tc++; }
|
if($data['to_domain']) { $td = "(@todomain " . substr($data['to_domain'], 1, strlen($data['to_domain'])) . " @from $all_your_addresses)"; $n_tc++; }
|
||||||
|
if($data['to']) { $fd = "(@to " . $this->fixup_sphinx_operators($data['to']) . " @from $all_your_addresses)"; $n_tc++; }
|
||||||
|
|
||||||
if($n_fc == 0 && $n_tc == 0 && $data['from_domain'] == '' && $data['to_domain'] == '') {
|
if($n_fc == 0 && $n_tc == 0 && $data['from_domain'] == '' && $data['to_domain'] == '') {
|
||||||
if($data['direction'] == 2) {
|
if($data['direction'] == 2) {
|
||||||
@ -170,21 +178,27 @@ class ModelSearchSearch extends Model {
|
|||||||
if(isset($data['from'])) { $data['from'] = fix_email_address($data['from']); }
|
if(isset($data['from'])) { $data['from'] = fix_email_address($data['from']); }
|
||||||
if(isset($data['to'])) { $data['to'] = fix_email_address($data['to']); }
|
if(isset($data['to'])) { $data['to'] = fix_email_address($data['to']); }
|
||||||
|
|
||||||
// missing from address
|
// missing From: address
|
||||||
|
|
||||||
if(!isset($data['from'])) {
|
if(!isset($data['from'])) {
|
||||||
|
|
||||||
if(isset($data['to']) && !strstr($data['to'], '@')) { $email = "@from $all_your_addresses @todomain " . $this->fix_email_address_for_sphinx($data['to']); }
|
if(isset($data['to']) && substr($data['to'], 0, 1) == '@') {
|
||||||
|
$email = "@from $all_your_addresses @todomain " . $this->fix_email_address_for_sphinx(substr($data['to'], 1, strlen($data['to'])));
|
||||||
|
}
|
||||||
|
else if(isset($data['to']) && !strstr($data['to'], '@')) { $email = "@from $all_your_addresses @to " . $this->fixup_sphinx_operators($this->fix_email_address_for_sphinx($data['to'])); }
|
||||||
else if(!isset($data['to'])) { $email = "@to $all_your_addresses"; }
|
else if(!isset($data['to'])) { $email = "@to $all_your_addresses"; }
|
||||||
else if(!in_array($data['to'], $_SESSION['emails'])) { $email = "@from $all_your_addresses @to " . $this->fix_email_address_for_sphinx($data['to']); }
|
else if(!in_array($data['to'], $_SESSION['emails'])) { $email = "@from $all_your_addresses @to " . $this->fix_email_address_for_sphinx($data['to']); }
|
||||||
else { $email = "@to " . $this->fix_email_address_for_sphinx($data['to']); }
|
else { $email = "@to " . $this->fix_email_address_for_sphinx($data['to']); }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// missing to address
|
// missing To: address
|
||||||
|
|
||||||
else if(!isset($data['to'])) {
|
else if(!isset($data['to'])) {
|
||||||
if(isset($data['from']) && !strstr($data['from'], '@')) { $email = "@to $all_your_addresses @fromdomain " . $this->fix_email_address_for_sphinx($data['from']); }
|
if(isset($data['from']) && substr($data['from'], 0, 1) == '@') {
|
||||||
|
$email = "@to $all_your_addresses @fromdomain " . $this->fix_email_address_for_sphinx(substr($data['from'], 1, strlen($data['from'])));
|
||||||
|
}
|
||||||
|
else if(isset($data['from']) && !strstr($data['from'], '@')) { $email = "@to $all_your_addresses @from " . $this->fixup_sphinx_operators($this->fix_email_address_for_sphinx($data['from'])); }
|
||||||
else if(!in_array($data['from'], $_SESSION['emails'])) { $email = "@to $all_your_addresses @from " . $this->fix_email_address_for_sphinx($data['from']); }
|
else if(!in_array($data['from'], $_SESSION['emails'])) { $email = "@to $all_your_addresses @from " . $this->fix_email_address_for_sphinx($data['from']); }
|
||||||
else { $email = "@from " . $this->fix_email_address_for_sphinx($data['from']); }
|
else { $email = "@from " . $this->fix_email_address_for_sphinx($data['from']); }
|
||||||
}
|
}
|
||||||
@ -206,13 +220,13 @@ class ModelSearchSearch extends Model {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(isset($data['from'])) {
|
if(isset($data['from'])) {
|
||||||
if(strstr($data['from'], '@')) { $match .= " @from " . $this->fix_email_address_for_sphinx($data['from']); }
|
if(substr($data['from'], 0, 1) == '@') { $match .= " @fromdomain " . $this->fix_email_address_for_sphinx(substr($data['from'], 1, strlen($data['from']))); }
|
||||||
else { $match .= " @fromdomain " . $this->fix_email_address_for_sphinx($data['from']); }
|
else { $match .= " @from " . $this->fixup_sphinx_operators($this->fix_email_address_for_sphinx($data['from'])); }
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($data['to'])) {
|
if(isset($data['to'])) {
|
||||||
if(strstr($data['to'], '@')) { $match .= " @to " . $this->fix_email_address_for_sphinx($data['to']); }
|
if(substr($data['to'], 0, 1) == '@') { $match .= " @todomain " . $this->fix_email_address_for_sphinx(substr($data['to'], 1, strlen($data['to']))); }
|
||||||
else { $match .= " @todomain " . $this->fix_email_address_for_sphinx($data['to']); }
|
else { $match .= " @to " . $this->fixup_sphinx_operators($this->fix_email_address_for_sphinx($data['to'])); }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -252,8 +266,6 @@ class ModelSearchSearch extends Model {
|
|||||||
|
|
||||||
|
|
||||||
if($data['tag']) {
|
if($data['tag']) {
|
||||||
$tag_id_list = " AND id IN (0";
|
|
||||||
|
|
||||||
$data['tag'] = $this->fixup_sphinx_operators($data['tag']);
|
$data['tag'] = $this->fixup_sphinx_operators($data['tag']);
|
||||||
|
|
||||||
$aa = $this->sphx->query("SELECT id FROM " . SPHINX_TAG_INDEX . " WHERE uid=" . $_SESSION['uid'] . " AND MATCH('@tag " . $data['tag'] . " ') ");
|
$aa = $this->sphx->query("SELECT id FROM " . SPHINX_TAG_INDEX . " WHERE uid=" . $_SESSION['uid'] . " AND MATCH('@tag " . $data['tag'] . " ') ");
|
||||||
@ -262,12 +274,11 @@ class ModelSearchSearch extends Model {
|
|||||||
$tag_id_list .= "," . $a['id'];
|
$tag_id_list .= "," . $a['id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$tag_id_list .= ") ";
|
$query = $this->sphx->query("SELECT id FROM " . SPHINX_MAIN_INDEX . " WHERE id IN (" . substr($tag_id_list, 1, strlen($tag_id_list)) . ") $sortorder LIMIT 0," . MAX_SEARCH_HITS);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$query = $this->sphx->query("SELECT id FROM " . SPHINX_MAIN_INDEX . " WHERE $date $direction $size MATCH('$conditions') $sortorder LIMIT 0," . MAX_SEARCH_HITS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$query = $this->sphx->query("SELECT id FROM " . SPHINX_MAIN_INDEX . " WHERE $date $direction $size MATCH('$conditions') $tag_id_list $sortorder LIMIT 0," . MAX_SEARCH_HITS);
|
|
||||||
|
|
||||||
//print $query->query; print "<p>" . $query->exec_time . "</p>\n";
|
//print $query->query; print "<p>" . $query->exec_time . "</p>\n";
|
||||||
|
|
||||||
@ -294,7 +305,6 @@ class ModelSearchSearch extends Model {
|
|||||||
if($data['sort'] == 'from' || $data['sort'] == 'subj') {
|
if($data['sort'] == 'from' || $data['sort'] == 'subj') {
|
||||||
|
|
||||||
$query = $this->db->query("SELECT id FROM " . TABLE_META . " WHERE id IN ($q) ORDER BY `$sort` $order", $ids);
|
$query = $this->db->query("SELECT id FROM " . TABLE_META . " WHERE id IN ($q) ORDER BY `$sort` $order", $ids);
|
||||||
//print $query->query . ", exec: " . $query->exec_time . "<p/>\n";
|
|
||||||
|
|
||||||
$ids = array();
|
$ids = array();
|
||||||
|
|
||||||
@ -315,6 +325,26 @@ class ModelSearchSearch extends Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function query_all_possible_IDs_by_reference($reference = '', $cache_key = '') {
|
||||||
|
$ids = array();
|
||||||
|
|
||||||
|
if($reference == '') { return $ids; }
|
||||||
|
|
||||||
|
$query = $this->db->query("SELECT id FROM " . TABLE_META . " WHERE message_id=? OR reference=? ORDER BY id DESC", array($reference, $reference));
|
||||||
|
|
||||||
|
foreach($query->rows as $q) {
|
||||||
|
array_push($ids, $q['id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(MEMCACHED_ENABLED && $cache_key) {
|
||||||
|
$memcache = Registry::get('memcache');
|
||||||
|
$memcache->add($cache_key, array('ts' => time(), 'total_hits' => count($ids), 'ids' => $ids), 0, MEMCACHED_TTL);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ids;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private function get_meta_data($ids = array(), $q = '', $sortorder = '') {
|
private function get_meta_data($ids = array(), $q = '', $sortorder = '') {
|
||||||
$messages = array();
|
$messages = array();
|
||||||
$tag = array();
|
$tag = array();
|
||||||
@ -346,7 +376,6 @@ class ModelSearchSearch extends Model {
|
|||||||
$m['date'] = date(SEARCH_HIT_DATE_FORMAT, $m['sent']);
|
$m['date'] = date(SEARCH_HIT_DATE_FORMAT, $m['sent']);
|
||||||
$m['size'] = nice_size($m['size']);
|
$m['size'] = nice_size($m['size']);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* verifying 20 messages takes some time, still it's useful
|
* verifying 20 messages takes some time, still it's useful
|
||||||
*/
|
*/
|
||||||
@ -473,6 +502,7 @@ class ModelSearchSearch extends Model {
|
|||||||
if($s == '') { return $s; }
|
if($s == '') { return $s; }
|
||||||
|
|
||||||
$s = preg_replace("/ OR /", "|", $s);
|
$s = preg_replace("/ OR /", "|", $s);
|
||||||
|
$s = preg_replace("/(\-)/", " ", $s);
|
||||||
$a = explode(" ", $s);
|
$a = explode(" ", $s);
|
||||||
$s = '';
|
$s = '';
|
||||||
|
|
||||||
|
@ -127,6 +127,12 @@ function send_ajax_post_request(url, params, id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function add_message_reference_to_form(s) {
|
||||||
|
e = document.getElementById('ref');
|
||||||
|
if(e) e.value = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function assemble_search_term(n) {
|
function assemble_search_term(n) {
|
||||||
var data = '';
|
var data = '';
|
||||||
var attachment_type = '';
|
var attachment_type = '';
|
||||||
@ -147,7 +153,6 @@ function assemble_search_term(n) {
|
|||||||
e = document.getElementById('subject');
|
e = document.getElementById('subject');
|
||||||
if(e && e.value) { data = data + "&subject=" + e.value; }
|
if(e && e.value) { data = data + "&subject=" + e.value; }
|
||||||
|
|
||||||
|
|
||||||
for(i=0; i<=n; i++) {
|
for(i=0; i<=n; i++) {
|
||||||
var a = 'key' + i;
|
var a = 'key' + i;
|
||||||
var b = 'val' + i;
|
var b = 'val' + i;
|
||||||
@ -181,6 +186,9 @@ function assemble_search_term(n) {
|
|||||||
|
|
||||||
if(attachment_type) { data = data + "&attachment_type=" + attachment_type.substring(1,attachment_type.length); }
|
if(attachment_type) { data = data + "&attachment_type=" + attachment_type.substring(1,attachment_type.length); }
|
||||||
|
|
||||||
|
e = document.getElementById('ref');
|
||||||
|
if(e && e.value) { data = data + "&ref=" + e.value; }
|
||||||
|
|
||||||
e = document.getElementById('sort');
|
e = document.getElementById('sort');
|
||||||
if(e && e.value) { data = data + "&sort=" + e.value; }
|
if(e && e.value) { data = data + "&sort=" + e.value; }
|
||||||
|
|
||||||
@ -228,6 +236,9 @@ function reset_simple_form() {
|
|||||||
a = document.getElementById('from'); a.value = '';
|
a = document.getElementById('from'); a.value = '';
|
||||||
a = document.getElementById('to'); a.value = '';
|
a = document.getElementById('to'); a.value = '';
|
||||||
a = document.getElementById('subject'); a.value = '';
|
a = document.getElementById('subject'); a.value = '';
|
||||||
|
|
||||||
|
a = document.getElementById('ref');
|
||||||
|
if(a) { a.value = ''; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -253,6 +264,9 @@ function reset_adv_form(n) {
|
|||||||
a = document.getElementById('val0');
|
a = document.getElementById('val0');
|
||||||
if(a) { a.value = ''; }
|
if(a) { a.value = ''; }
|
||||||
|
|
||||||
|
a = document.getElementById('ref');
|
||||||
|
if(a) { a.value = ''; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<link rel="stylesheet" type="text/css" href="/view/theme/default/stylesheet/style.css" />
|
<link rel="stylesheet" type="text/css" href="/view/theme/default/stylesheet/style-<?php print THEME; ?>.css" />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body style="background: white;">
|
<body style="background: white;">
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<link rel="stylesheet" type="text/css" href="/view/theme/default/stylesheet/style.css" />
|
<link rel="stylesheet" type="text/css" href="/view/theme/default/stylesheet/style-<?php print THEME; ?>.css" />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body style="background: white;">
|
<body style="background: white;">
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<link rel="stylesheet" type="text/css" href="/view/theme/default/stylesheet/style.css" />
|
<link rel="stylesheet" type="text/css" href="/view/theme/default/stylesheet/style-<?php print THEME; ?>.css" />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body style="background: white;">
|
<body style="background: white;">
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<link rel="stylesheet" type="text/css" href="/view/theme/default/stylesheet/style.css" />
|
<link rel="stylesheet" type="text/css" href="/view/theme/default/stylesheet/style-<?php print THEME; ?>.css" />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body style="background: white;">
|
<body style="background: white;">
|
||||||
|
@ -8,6 +8,9 @@
|
|||||||
|
|
||||||
<input type="hidden" name="sort" id="sort" value="date" />
|
<input type="hidden" name="sort" id="sort" value="date" />
|
||||||
<input type="hidden" name="order" id="order" value="0" />
|
<input type="hidden" name="order" id="order" value="0" />
|
||||||
|
<input type="hidden" name="ref" id="ref" value="" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div id="myid">
|
<div id="myid">
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
<input type="hidden" name="sort" id="sort" value="date" />
|
<input type="hidden" name="sort" id="sort" value="date" />
|
||||||
<input type="hidden" name="order" id="order" value="0" />
|
<input type="hidden" name="order" id="order" value="0" />
|
||||||
|
<input type="hidden" name="ref" id="ref" value="" />
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -29,7 +30,7 @@
|
|||||||
<div class="cell1s"> </div>
|
<div class="cell1s"> </div>
|
||||||
<div class="cell2">
|
<div class="cell2">
|
||||||
<button id="button_search" class="active" onclick="script:load_search_results('<?php print SEARCH_HELPER_URL; ?>', assemble_search_term(count), 0);"><?php print $text_search; ?></button>
|
<button id="button_search" class="active" onclick="script:load_search_results('<?php print SEARCH_HELPER_URL; ?>', assemble_search_term(count), 0);"><?php print $text_search; ?></button>
|
||||||
<input type="button" class="advsecondary" onclick="javascript:var a=document.getElementById('_search'); a.value=''; return false;" value="<?php print $text_cancel; ?>" />
|
<input type="button" class="advsecondary" onclick="javascript:var a=document.getElementById('_search'); a.value=''; a = document.getElementById('ref'); a.value=''; return false;" value="<?php print $text_cancel; ?>" />
|
||||||
<input type="button" class="advsecondary" value="<?php print $text_save; ?>" onclick="javascript:send_ajax_post_request('<?php print SAVE_SEARCH_URL; ?>', assemble_search_term(0) + '&save=1', 'A1');" />
|
<input type="button" class="advsecondary" value="<?php print $text_save; ?>" onclick="javascript:send_ajax_post_request('<?php print SAVE_SEARCH_URL; ?>', assemble_search_term(0) + '&save=1', 'A1');" />
|
||||||
<input type="button" class="load" name="load" onclick="javascript:load_ajax_url('<?php print SAVE_SEARCH_URL; ?>&<?php if(isset($search_args)) { print $search_args; } ?>');" value="<?php print $text_load; ?>..." />
|
<input type="button" class="load" name="load" onclick="javascript:load_ajax_url('<?php print SAVE_SEARCH_URL; ?>&<?php if(isset($search_args)) { print $search_args; } ?>');" value="<?php print $text_load; ?>..." />
|
||||||
</div>
|
</div>
|
||||||
|
@ -69,7 +69,7 @@
|
|||||||
<div class="cell5 id"><?php print ($page*$page_len) + $i; ?>.</div>
|
<div class="cell5 id"><?php print ($page*$page_len) + $i; ?>.</div>
|
||||||
<div class="cell5 date"><?php print $message['date']; ?></div>
|
<div class="cell5 date"><?php print $message['date']; ?></div>
|
||||||
<div class="cell5 from"><?php if($message['from'] != $message['shortfrom']) { ?><span onmouseover="Tip('<?php print preg_replace("/&/", "&", $message['from']); ?>', BALLOON, true, ABOVE, true)" onmouseout="UnTip()"><?php print $message['shortfrom']; ?></span><?php } else { print $message['from']; } ?></div>
|
<div class="cell5 from"><?php if($message['from'] != $message['shortfrom']) { ?><span onmouseover="Tip('<?php print preg_replace("/&/", "&", $message['from']); ?>', BALLOON, true, ABOVE, true)" onmouseout="UnTip()"><?php print $message['shortfrom']; ?></span><?php } else { print $message['from']; } ?></div>
|
||||||
<div class="cell5 subject"><a class="messagelink<?php if($message['spam'] == 1) { ?> spam<?php } ?>" href="<?php print SITE_URL; ?>message.php/<?php print $message['piler_id']; ?>"><?php if($message['subject'] != $message['shortsubject']) { ?><span onmouseover="Tip('<?php print preg_replace("/&/", "&", $message['subject']); ?>', BALLOON, true, ABOVE, true)" onmouseout="UnTip()"><?php print $message['shortsubject']; ?></span><?php } else { print $message['subject']; } ?></a><?php if($message['reference']) { ?> <span onmouseover="Tip('<?php print $message['reference']; ?>', BALLOON, true, ABOVE, true)" onmouseout="UnTip()">[+]</span><?php } ?></div>
|
<div class="cell5 subject"><a class="messagelink<?php if($message['spam'] == 1) { ?> spam<?php } ?>" href="<?php print SITE_URL; ?>message.php/<?php print $message['piler_id']; ?>"><?php if($message['subject'] != $message['shortsubject']) { ?><span onmouseover="Tip('<?php print preg_replace("/&/", "&", $message['subject']); ?>', BALLOON, true, ABOVE, true)" onmouseout="UnTip()"><?php print $message['shortsubject']; ?></span><?php } else { print $message['subject']; } ?></a><?php if($message['reference']) { ?> <a href="#" onclick="script:add_message_reference_to_form('<?php print $message['reference']; ?>'); load_search_results('<?php print SEARCH_HELPER_URL; ?>', assemble_search_term(count), 0); a = document.getElementById('ref'); a.value=''; return false;"><span onmouseover="Tip('<?php print $text_conversation_available; ?>', BALLOON, true, ABOVE, true)" onmouseout="UnTip()">[+]</span></a><?php } ?></div>
|
||||||
<div class="cell5 size"><?php print $message['size']; ?></div>
|
<div class="cell5 size"><?php print $message['size']; ?></div>
|
||||||
<div class="cell5"><?php if($message['attachments'] > 0) { ?><img src="<?php print ICON_ATTACHMENT; ?>" alt="" width="16" height="18" /><?php } else { ?> <?php } ?></div>
|
<div class="cell5"><?php if($message['attachments'] > 0) { ?><img src="<?php print ICON_ATTACHMENT; ?>" alt="" width="16" height="18" /><?php } else { ?> <?php } ?></div>
|
||||||
<div class="cell5"><?php if($message['tag']) { ?><span onmouseover="Tip('<?php print $message['tag']; ?>', BALLOON, true, ABOVE, true)" onmouseout="UnTip()"><img src="<?php print ICON_TAG; ?>" alt="" /></span><?php } else { ?> <?php } ?></div>
|
<div class="cell5"><?php if($message['tag']) { ?><span onmouseover="Tip('<?php print $message['tag']; ?>', BALLOON, true, ABOVE, true)" onmouseout="UnTip()"><img src="<?php print ICON_TAG; ?>" alt="" /></span><?php } else { ?> <?php } ?></div>
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
<input type="hidden" name="sort" id="sort" value="date" />
|
<input type="hidden" name="sort" id="sort" value="date" />
|
||||||
<input type="hidden" name="order" id="order" value="0" />
|
<input type="hidden" name="order" id="order" value="0" />
|
||||||
|
<input type="hidden" name="ref" id="ref" value="" />
|
||||||
|
|
||||||
<div id="ss1">
|
<div id="ss1">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
Loading…
Reference in New Issue
Block a user