X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=classes%2FMessage.php;h=4806057b4ca1183fa6c752fde2e0ce03c4f20ee0;hb=628a9371082531908a023618ad4216a2f254f481;hp=12ec10846bf7bb37a108aff600524fc58882c1b1;hpb=e2e6bbb298e8b41573e78c6acfd764cc95f6954a;p=quix0rs-gnu-social.git diff --git a/classes/Message.php b/classes/Message.php index 12ec10846b..4806057b4c 100644 --- a/classes/Message.php +++ b/classes/Message.php @@ -2,7 +2,7 @@ /** * Table Definition for message */ -require_once 'classes/Memcached_DataObject.php'; +require_once INSTALLDIR.'/classes/Memcached_DataObject.php'; class Message extends Memcached_DataObject { @@ -22,47 +22,50 @@ class Message extends Memcached_DataObject public $source; // varchar(32) /* Static get */ - function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Message',$k,$v); } + function staticGet($k,$v=null) + { return Memcached_DataObject::staticGet('Message',$k,$v); } /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE - - function getFrom() { - return Profile::staticGet('id', $this->from_profile); - } - - function getTo() { - return Profile::staticGet('id', $this->to_profile); - } - - static function saveNew($from, $to, $content, $source) { - - $msg = new Message(); - - $msg->from_profile = $from; - $msg->to_profile = $to; - $msg->content = $content; - $msg->rendered = common_render_text($content); - $msg->created = common_sql_now(); - $msg->source = $source; - - $result = $msg->insert(); - - if (!$result) { - common_log_db_error($msg, 'INSERT', __FILE__); - return _('Could not insert message.'); - } - - $orig = clone($msg); - $msg->uri = common_local_url('showmessage', array('message' => $msg->id)); - - $result = $msg->update($orig); - - if (!$result) { - common_log_db_error($msg, 'UPDATE', __FILE__); - return _('Could not update message with new URI.'); - } - - return $msg; - } + + function getFrom() + { + return Profile::staticGet('id', $this->from_profile); + } + + function getTo() + { + return Profile::staticGet('id', $this->to_profile); + } + + static function saveNew($from, $to, $content, $source) { + + $msg = new Message(); + + $msg->from_profile = $from; + $msg->to_profile = $to; + $msg->content = common_shorten_links($content); + $msg->rendered = common_render_text($content); + $msg->created = common_sql_now(); + $msg->source = $source; + + $result = $msg->insert(); + + if (!$result) { + common_log_db_error($msg, 'INSERT', __FILE__); + return _('Could not insert message.'); + } + + $orig = clone($msg); + $msg->uri = common_local_url('showmessage', array('message' => $msg->id)); + + $result = $msg->update($orig); + + if (!$result) { + common_log_db_error($msg, 'UPDATE', __FILE__); + return _('Could not update message with new URI.'); + } + + return $msg; + } }