minor gui fixes

This commit is contained in:
SJ 2013-03-24 10:02:34 +01:00
parent 97800b32fa
commit 4fefb6c33f
3 changed files with 13 additions and 3 deletions

View File

@ -57,11 +57,18 @@ class ModelSearchMessage extends Model {
pclose($handle); pclose($handle);
/* TODO: decode only if it's a base64 encoded attachment */ /* check if it's a base64 encoded stuff */
$s = substr($data, 0, 4096);
$s = preg_replace("/(\r|\n)/", "", $s);
if(!preg_replace("/\s/", $s)) {
return base64_decode(preg_replace("/\s/", "", $data)); return base64_decode(preg_replace("/\s/", "", $data));
} }
return $data;
}
public function get_message_headers($id = '') { public function get_message_headers($id = '') {
$data = ''; $data = '';

View File

@ -759,6 +759,9 @@ class ModelSearchSearch extends Model {
public function add_search_term($term = '') { public function add_search_term($term = '') {
if($term == '') { return 0; } if($term == '') { return 0; }
parse_str($term, $s);
if(!isset($s['search']) || $s['search'] == '') { return 0; }
if($this->update_search_term($term) == 0) { if($this->update_search_term($term) == 0) {
AUDIT(ACTION_SAVE_SEARCH, '', '', '', $term); AUDIT(ACTION_SAVE_SEARCH, '', '', '', $term);
$query = $this->db->query("INSERT INTO " . TABLE_SEARCH . " (email, ts, term) VALUES(?,?,?)", array($_SESSION['email'], time(), $term)); $query = $this->db->query("INSERT INTO " . TABLE_SEARCH . " (email, ts, term) VALUES(?,?,?)", array($_SESSION['email'], time(), $term));

View File

@ -13,7 +13,7 @@
<?php foreach($terms as $term) { <?php foreach($terms as $term) {
parse_str($term['term'], $s); parse_str($term['term'], $s);
if(isset($s['search'])) { if(isset($s['search']) && $s['search']) {
?> ?>
<div class="resultrow"> <div class="resultrow">
<a href="#" onclick="Piler.load_search_results_for_saved_query('<?php print urldecode($term['term']); ?>');"><?php print $s['search']; ?></a></br /> <a href="#" onclick="Piler.load_search_results_for_saved_query('<?php print urldecode($term['term']); ?>');"><?php print $s['search']; ?></a></br />