mirror of
https://bitbucket.org/jsuto/piler.git
synced 2025-06-12 23:37:02 +02:00
added the private feature
This commit is contained in:
@ -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 ''; }
|
||||
|
||||
|
@ -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)) {
|
||||
|
Reference in New Issue
Block a user