Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/concrete5/concrete5
Browse files Browse the repository at this point in the history
  • Loading branch information
aembler committed Nov 23, 2011
2 parents c29b839 + 25c3b2d commit 67d5a26
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions web/concrete/models/user_private_message.php
@@ -1,19 +1,12 @@
<?

defined('C5_EXECUTE') or die("Access Denied.");
/**
* @package Users
* @author Andrew Embler <andrew@concrete5.org>
* @copyright Copyright (c) 2003-2009 Concrete5. (http://www.concrete5.org)
* @license http://www.concrete5.org/license/ MIT License
*
*/

/**
* An object representing a private message sent to a user
*
* @package Users
* @category Concrete
* @author Andrew Embler <andrew@concrete5.org>
* @copyright Copyright (c) 2003-2009 Concrete5. (http://www.concrete5.org)
* @license http://www.concrete5.org/license/ MIT License
*
Expand Down Expand Up @@ -80,6 +73,7 @@ public function markAsRead() {

$db = Loader::db();
if ($this->uID != $this->uAuthorID) {
Events::fire('on_private_message_marked_as_read', $this);
$db->Execute('update UserPrivateMessagesTo set msgIsUnread = 0 where msgID = ?', array($this->msgID, $this->msgMailboxID, $this->uID));
}
}
Expand Down Expand Up @@ -125,6 +119,10 @@ public function delete() {
if (!$this->uID) {
return false;
}
$ret = Events::fire('on_private_message_delete', $this);
if($ret < 0) {
return;
}
$db->Execute('delete from UserPrivateMessagesTo where uID = ? and msgID = ?', array($this->uID, $this->msgID));
}

Expand Down Expand Up @@ -192,6 +190,7 @@ public static function get($user, $msgMailboxID) {
public function removeNewStatus() {
$db = Loader::db();
$user = UserInfo::getByID($this->uID);
Events::fire('on_private_message_marked_not_new', $this);
$db->Execute('update UserPrivateMessagesTo set msgIsNew = 0 where msgMailboxID = ? and uID = ?', array($this->msgMailboxID, $user->getUserID()));
}

Expand Down Expand Up @@ -270,6 +269,7 @@ public function getErrorObject() {

protected function notifyAdmin($offenderID) {
$offender = UserInfo::getByID($offenderID);
Events::fire('on_private_message_over_limit', $offender);
$admin = UserInfo::getByID(USER_SUPER_ID);

Log::addEntry(t("User: %s has tried to send more than %s private messages within %s minutes", $offender->getUserName(), USER_PRIVATE_MESSAGE_MAX, USER_PRIVATE_MESSAGE_MAX_TIME_SPAN),t('warning'));
Expand Down

0 comments on commit 67d5a26

Please sign in to comment.