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,9 +57,16 @@ class ModelSearchMessage extends Model {
pclose($handle);
/* TODO: decode only if it's a base64 encoded attachment */
/* check if it's a base64 encoded stuff */
return base64_decode(preg_replace("/\s/", "", $data));
$s = substr($data, 0, 4096);
$s = preg_replace("/(\r|\n)/", "", $s);
if(!preg_replace("/\s/", $s)) {
return base64_decode(preg_replace("/\s/", "", $data));
}
return $data;
}

View File

@ -759,6 +759,9 @@ class ModelSearchSearch extends Model {
public function add_search_term($term = '') {
if($term == '') { return 0; }
parse_str($term, $s);
if(!isset($s['search']) || $s['search'] == '') { return 0; }
if($this->update_search_term($term) == 0) {
AUDIT(ACTION_SAVE_SEARCH, '', '', '', $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) {
parse_str($term['term'], $s);
if(isset($s['search'])) {
if(isset($s['search']) && $s['search']) {
?>
<div class="resultrow">
<a href="#" onclick="Piler.load_search_results_for_saved_query('<?php print urldecode($term['term']); ?>');"><?php print $s['search']; ?></a></br />