function saveTags()
{
/* extract all #hastags */
- $count = preg_match_all('/(?:^|\s)#([\pL\pN_\-\.]{1,64})/', strtolower($this->content), $match);
+ $count = preg_match_all('/(?:^|\s)#([\pL\pN_\-\.]{1,64})/u', strtolower($this->content), $match);
if (!$count) {
return true;
}
$reply->notice_id = $this->id;
$reply->profile_id = $profile->id;
+ $reply->modified = $this->created;
common_log(LOG_INFO, __METHOD__ . ": saving reply: notice $this->id to profile $profile->id");
$reply->notice_id = $this->id;
$reply->profile_id = $mentioned->id;
+ $reply->modified = $this->created;
$id = $reply->insert();
* @return Activity activity object representing this Notice.
*/
- function asActivity()
+ function asActivity($cur)
{
$act = self::cacheGet(Cache::codeKey('notice:as-activity:'.$this->id));
if (!empty($act)) {
return $act;
}
-
$act = new Activity();
if (Event::handle('StartNoticeAsActivity', array($this, &$act))) {
$profile = $this->getProfile();
- $act->actor = ActivityObject::fromProfile($profile);
- $act->verb = ActivityVerb::POST;
- $act->objects[] = ActivityObject::fromNotice($this);
+ $act->actor = ActivityObject::fromProfile($profile);
+ $act->actor->extra[] = $profile->profileInfo($cur);
+ $act->verb = ActivityVerb::POST;
+ $act->objects[] = ActivityObject::fromNotice($this);
// XXX: should this be handled by default processing for object entry?
$author=true,
$cur=null)
{
- $act = $this->asActivity();
+ $act = $this->asActivity($cur);
$act->extra[] = $this->noticeInfo($cur);
return $act->asString($namespace, $author, $source);
}
if ($user) {
if (Event::handle('StartSetUser', array(&$user))) {
- if($user){
+ if (!empty($user)) {
+ if (!$user->hasRight(Right::WEBLOGIN)) {
+ throw new AuthorizationException(_('Not allowed to log in.'));
+ }
common_ensure_session();
$_SESSION['userid'] = $user->id;
$_cur = $user;
$r = preg_replace('/[\x{0}-\x{8}\x{b}-\x{c}\x{e}-\x{19}]/', '', $r);
$r = common_replace_urls_callback($r, 'common_linkify');
- $r = preg_replace('/(^|\"\;|\'|\(|\[|\{|\s+)#([\pL\pN_\-\.]{1,64})/e', "'\\1#'.common_tag_link('\\2')", $r);
+ $r = preg_replace('/(^|\"\;|\'|\(|\[|\{|\s+)#([\pL\pN_\-\.]{1,64})/ue', "'\\1#'.common_tag_link('\\2')", $r);
// XXX: machine tags
return $r;
}
// functions
$url = htmlspecialchars_decode($url);
- if(strpos($url, '@') !== false && strpos($url, ':') === false) {
- //url is an email address without the mailto: protocol
- $canon = "mailto:$url";
- $longurl = "mailto:$url";
- }else{
+ if (strpos($url, '@') !== false && strpos($url, ':') === false && Validate::email($url)) {
+ //url is an email address without the mailto: protocol
+ $canon = "mailto:$url";
+ $longurl = "mailto:$url";
+ } else {
$canon = File_redirection::_canonUrl($url);