/**
  * Constructor
  *
  * @param User    $user    the user for the feed
  * @param User    $cur     the current authenticated user, if any
  * @param boolean $indent  flag to turn indenting on or off
  *
  * @return void
  */
 function __construct($user, $cur = null, $indent = true)
 {
     parent::__construct($cur, $indent);
     $this->user = $user;
     if (!empty($user)) {
         $profile = $user->getProfile();
         $this->addAuthor($profile->nickname, $user->uri);
         $this->setActivitySubject($profile->asActivityNoun('subject'));
     }
     // TRANS: Title in atom user notice feed. %s is a user name.
     $title = sprintf(_("%s timeline"), $user->nickname);
     $this->setTitle($title);
     $sitename = common_config('site', 'name');
     $subtitle = sprintf(_('Updates from %1$s on %2$s!'), $user->nickname, $sitename);
     $this->setSubtitle($subtitle);
     $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
     $logo = $avatar ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE);
     $this->setLogo($logo);
     $this->setUpdated('now');
     $this->addLink(common_local_url('showstream', array('nickname' => $user->nickname)));
     $self = common_local_url('ApiTimelineUser', array('id' => $user->id, 'format' => 'atom'));
     $this->setId($self);
     $this->setSelfLink($self);
     $this->addLink(common_local_url('sup', null, null, $user->id), array('rel' => 'http://api.friendfeed.com/2008/03#sup', 'type' => 'application/json'));
 }
Esempio n. 2
0
 function showNotice($notice)
 {
     $profile = $notice->getProfile();
     if (empty($profile)) {
         common_log(LOG_WARNING, sprintf("Notice %d has no profile", $notice->id));
         return;
     }
     $this->out->elementStart('li', 'hentry notice');
     $this->out->elementStart('div', 'entry-title');
     $avatar = $profile->getAvatar(AVATAR_MINI_SIZE);
     $this->out->elementStart('span', 'vcard author');
     $this->out->elementStart('a', array('title' => $profile->fullname ? $profile->fullname : $profile->nickname, 'href' => $profile->profileurl, 'class' => 'url'));
     $this->out->element('img', array('src' => $avatar ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_MINI_SIZE), 'width' => AVATAR_MINI_SIZE, 'height' => AVATAR_MINI_SIZE, 'class' => 'avatar photo', 'alt' => $profile->fullname ? $profile->fullname : $profile->nickname));
     $this->out->text(' ');
     $this->out->element('span', 'fn nickname', $profile->nickname);
     $this->out->elementEnd('a');
     $this->out->elementEnd('span');
     $this->out->elementStart('p', 'entry-content');
     $this->out->raw($notice->rendered);
     $this->out->elementEnd('p');
     $this->out->elementStart('div', 'entry_content');
     class_exists('NoticeList');
     $nli = new NoticeListItem($notice, $this->out);
     $nli->showNoticeLink();
     $this->out->elementEnd('div');
     if (!empty($notice->value)) {
         $this->out->elementStart('p');
         $this->out->text($notice->value);
         $this->out->elementEnd('p');
     }
     $this->out->elementEnd('div');
     $this->out->elementEnd('li');
 }
 /**
  * Class handler.
  *
  * @param array $args query arguments
  *
  * @return boolean false if nickname or user isn't found
  */
 protected function handle()
 {
     parent::handle();
     $nickname = $this->trimmed('nickname');
     if (!$nickname) {
         // TRANS: Client error displayed trying to get an avatar without providing a nickname.
         $this->clientError(_('No nickname.'));
     }
     $size = $this->trimmed('size') ?: 'original';
     $user = User::getKV('nickname', $nickname);
     if (!$user) {
         // TRANS: Client error displayed trying to get an avatar for a non-existing user.
         $this->clientError(_('No such user.'));
     }
     $profile = $user->getProfile();
     if (!$profile) {
         // TRANS: Error message displayed when referring to a user without a profile.
         $this->clientError(_('User has no profile.'));
     }
     if ($size === 'original') {
         try {
             $avatar = Avatar::getUploaded($profile);
             $url = $avatar->displayUrl();
         } catch (NoAvatarException $e) {
             $url = Avatar::defaultImage(AVATAR_PROFILE_SIZE);
         }
     } else {
         $url = $profile->avatarUrl($size);
     }
     common_redirect($url, 302);
 }
Esempio n. 4
0
 /**
  * Show the item
  *
  * @return void
  */
 function show()
 {
     $group = $this->gm->getGroup();
     $sender = $this->gm->getSender();
     $this->out->elementStart('li', array('class' => 'hentry notice message group-message', 'id' => 'message-' . $this->gm->id));
     $this->out->elementStart('div', 'entry-title');
     $this->out->elementStart('span', 'vcard author');
     $this->out->elementStart('a', array('href' => $sender->profileurl, 'class' => 'url'));
     $avatar = $sender->getAvatar(AVATAR_STREAM_SIZE);
     $this->out->element('img', array('src' => $avatar ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_STREAM_SIZE), 'width' => AVATAR_STREAM_SIZE, 'height' => AVATAR_STREAM_SIZE, 'class' => 'photo avatar', 'alt' => $sender->getBestName()));
     $this->out->element('span', array('class' => 'nickname fn'), $sender->nickname);
     $this->out->elementEnd('a');
     $this->out->elementEnd('span');
     $this->out->elementStart('p', array('class' => 'entry-content message-content'));
     $this->out->raw($this->gm->rendered);
     $this->out->elementEnd('p');
     $this->out->elementEnd('div');
     $this->out->elementStart('div', 'entry-content');
     $this->out->elementStart('a', array('rel' => 'bookmark', 'class' => 'timestamp', 'href' => $this->gm->url));
     $dt = common_date_iso8601($this->gm->created);
     $this->out->element('abbr', array('class' => 'published', 'title' => $dt), common_date_string($this->gm->created));
     $this->out->elementEnd('a');
     $this->out->elementEnd('div');
     $this->out->elementEnd('li');
 }
 /**
  * Constructor
  *
  * @param User    $user    the user for the feed
  * @param User    $cur     the current authenticated user, if any
  * @param boolean $indent  flag to turn indenting on or off
  *
  * @return void
  */
 function __construct($user, $cur = null, $indent = true)
 {
     parent::__construct($cur, $indent);
     $this->user = $user;
     if (!empty($user)) {
         $profile = $user->getProfile();
         $ao = ActivityObject::fromProfile($profile);
         array_push($ao->extra, $profile->profileInfo($cur));
         // XXX: For users, we generate an author _AND_ an <activity:subject>
         // This is for backward compatibility with clients (especially
         // StatusNet's clients) that assume the Atom will conform to an
         // older version of the Activity Streams API. Subject should be
         // removed in future versions of StatusNet.
         $this->addAuthorRaw($ao->asString('author'));
         $depMsg = 'Deprecation warning: activity:subject is present ' . 'only for backward compatibility. It will be ' . 'removed in the next version of StatusNet.';
         $this->addAuthorRaw("<!--{$depMsg}-->\n" . $ao->asString('activity:subject'));
     }
     // TRANS: Title in atom user notice feed. %s is a user name.
     $title = sprintf(_("%s timeline"), $user->nickname);
     $this->setTitle($title);
     $sitename = common_config('site', 'name');
     $subtitle = sprintf(_('Updates from %1$s on %2$s!'), $user->nickname, $sitename);
     $this->setSubtitle($subtitle);
     $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
     $logo = $avatar ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE);
     $this->setLogo($logo);
     $this->setUpdated('now');
     $this->addLink(common_local_url('showstream', array('nickname' => $user->nickname)));
     $self = common_local_url('ApiTimelineUser', array('id' => $user->id, 'format' => 'atom'));
     $this->setId($self);
     $this->setSelfLink($self);
     $this->addLink(common_local_url('sup', null, null, $user->id), array('rel' => 'http://api.friendfeed.com/2008/03#sup', 'type' => 'application/json'));
 }
 function avatar()
 {
     $avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE);
     if (empty($avatar)) {
         $avatar = $this->profile->getAvatar(73);
     }
     return !empty($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE);
 }
Esempio n. 7
0
 function showNotice($notice)
 {
     $profile = $notice->getProfile();
     if (empty($profile)) {
         common_log(LOG_WARNING, sprintf("Notice %d has no profile", $notice->id));
         return;
     }
     $this->out->elementStart('li', 'hentry notice');
     $this->out->elementStart('div', 'entry-title');
     $avatar = $profile->getAvatar(AVATAR_MINI_SIZE);
     $this->out->elementStart('span', 'vcard author');
     $this->out->elementStart('a', array('title' => $profile->fullname ? $profile->fullname : $profile->nickname, 'href' => $profile->profileurl, 'class' => 'url'));
     $this->out->element('img', array('src' => $avatar ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_MINI_SIZE), 'width' => AVATAR_MINI_SIZE, 'height' => AVATAR_MINI_SIZE, 'class' => 'avatar photo', 'alt' => $profile->fullname ? $profile->fullname : $profile->nickname));
     $this->out->text(' ');
     $this->out->element('span', 'fn nickname', $profile->nickname);
     $this->out->elementEnd('a');
     $this->out->elementEnd('span');
     $this->out->elementStart('p', 'entry-content');
     $this->out->raw($notice->rendered);
     $notice_link_cfg = common_config('site', 'notice_link');
     if ('direct' === $notice_link_cfg) {
         $this->out->text(' (');
         $this->out->element('a', array('href' => $notice->uri), 'see');
         $this->out->text(')');
     } elseif ('attachment' === $notice_link_cfg) {
         if ($count = $notice->hasAttachments()) {
             // link to attachment(s) pages
             if (1 === $count) {
                 $f2p = File_to_post::staticGet('post_id', $notice->id);
                 $href = common_local_url('attachment', array('attachment' => $f2p->file_id));
                 $att_class = 'attachment';
             } else {
                 $href = common_local_url('attachments', array('notice' => $notice->id));
                 $att_class = 'attachments';
             }
             $clip = Theme::path('images/icons/clip.png', 'base');
             $this->out->elementStart('a', array('class' => $att_class, 'style' => "font-style: italic;", 'href' => $href, 'title' => "# of attachments: {$count}"));
             $this->out->raw(" ({$count}&nbsp");
             $this->out->element('img', array('style' => 'display: inline', 'align' => 'top', 'width' => 20, 'height' => 20, 'src' => $clip, 'alt' => 'alt'));
             $this->out->text(')');
             $this->out->elementEnd('a');
         } else {
             $this->out->text(' (');
             $this->out->element('a', array('href' => $notice->uri), 'see');
             $this->out->text(')');
         }
     }
     $this->out->elementEnd('p');
     if (!empty($notice->value)) {
         $this->out->elementStart('p');
         $this->out->text($notice->value);
         $this->out->elementEnd('p');
     }
     $this->out->elementEnd('div');
     $this->out->elementEnd('li');
 }
Esempio n. 8
0
 function showProfile()
 {
     $this->out->elementStart('li', 'vcard');
     $this->out->elementStart('a', array('title' => $this->profile->getBestName(), 'href' => $this->profile->profileurl, 'rel' => 'contact member', 'class' => 'url'));
     $avatar = $this->profile->getAvatar(AVATAR_MINI_SIZE);
     $this->out->element('img', array('src' => $avatar ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_MINI_SIZE), 'width' => AVATAR_MINI_SIZE, 'height' => AVATAR_MINI_SIZE, 'class' => 'avatar photo', 'alt' => $this->profile->fullname ? $this->profile->fullname : $this->profile->nickname));
     $this->out->element('span', 'fn nickname', $this->profile->nickname);
     $this->out->elementEnd('a');
     $this->out->elementEnd('li');
 }
Esempio n. 9
0
 function showAvatar()
 {
     if (Event::handle('StartProfilePageAvatar', array($this->out, $this->profile))) {
         $avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE);
         $this->out->element('img', array('src' => $avatar ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE), 'id' => 'profile_avatar', 'width' => AVATAR_PROFILE_SIZE, 'height' => AVATAR_PROFILE_SIZE, 'alt' => $this->profile->nickname));
         $this->showNickname();
         $this->showFullName();
         $user = User::staticGet('id', $this->profile->id);
         $cur = common_current_user();
         if ($cur && $cur->id == $user->id) {
             $this->out->element('a', array('href' => common_local_url('avatarsettings'), 'id' => 'edit_avatar'), _('编辑头像'));
         }
         Event::handle('EndProfilePageAvatar', array($this->out, $this->profile));
     }
 }
Esempio n. 10
0
 function show()
 {
     $this->out->elementStart('li', 'vcard');
     if (Event::handle('StartProfileListItemProfileElements', array($this))) {
         if (Event::handle('StartProfileListItemAvatar', array($this))) {
             $aAttrs = $this->linkAttributes();
             $this->out->elementStart('a', $aAttrs);
             $avatar = $this->profile->getAvatar(AVATAR_MINI_SIZE);
             $this->out->element('img', array('src' => $avatar ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_MINI_SIZE), 'width' => AVATAR_MINI_SIZE, 'height' => AVATAR_MINI_SIZE, 'class' => 'avatar photo', 'alt' => $this->profile->fullname ? $this->profile->fullname : $this->profile->nickname));
             $this->out->element('span', 'fn nickname', $this->profile->nickname);
             $this->out->elementEnd('a');
             Event::handle('EndProfileListItemAvatar', array($this));
         }
         $this->out->elementEnd('li');
     }
 }
Esempio n. 11
0
 /**
  * Show the widget
  *
  * @return void
  */
 function show()
 {
     $this->out->elementStart('li', array('class' => 'hentry notice', 'id' => 'message-' . $this->message->id));
     $profile = $this->getMessageProfile();
     $this->out->elementStart('div', 'entry-title');
     $this->out->elementStart('span', 'vcard author');
     $this->out->elementStart('a', array('href' => $profile->profileurl, 'class' => 'url'));
     $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
     $this->out->element('img', array('src' => $avatar ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_STREAM_SIZE), 'class' => 'photo avatar', 'width' => AVATAR_STREAM_SIZE, 'height' => AVATAR_STREAM_SIZE, 'alt' => $profile->fullname ? $profile->fullname : $profile->nickname));
     $this->out->element('span', array('class' => 'nickname fn'), $profile->nickname);
     $this->out->elementEnd('a');
     $this->out->elementEnd('span');
     // FIXME: URL, image, video, audio
     $this->out->elementStart('p', array('class' => 'entry-content'));
     $this->out->raw($this->message->rendered);
     $this->out->elementEnd('p');
     $this->out->elementEnd('div');
     $messageurl = common_local_url('showmessage', array('message' => $this->message->id));
     // XXX: we need to figure this out better. Is this right?
     if (strcmp($this->message->uri, $messageurl) != 0 && preg_match('/^http/', $this->message->uri)) {
         $messageurl = $this->message->uri;
     }
     $this->out->elementStart('div', 'entry-content');
     $this->out->elementStart('a', array('rel' => 'bookmark', 'class' => 'timestamp', 'href' => $messageurl));
     $dt = common_date_iso8601($this->message->created);
     $this->out->element('abbr', array('class' => 'published', 'title' => $dt), common_date_string($this->message->created));
     $this->out->elementEnd('a');
     if ($this->message->source) {
         $this->out->elementStart('span', 'source');
         // FIXME: bad i18n. Device should be a parameter (from %s).
         // TRANS: Followed by notice source (usually the client used to send the notice).
         $this->out->text(_('from'));
         $this->showSource($this->message->source);
         $this->out->elementEnd('span');
     }
     $this->out->elementEnd('div');
     $this->out->elementEnd('li');
 }
Esempio n. 12
0
 function libravatar_url($email, $size)
 {
     global $config;
     $defaultavatar = Avatar::defaultImage($size);
     if (isset($config['Libravatar']) && isset($config['Libravatar']['nocheck']) && $config['Libravatar']['nocheck'] === true) {
         include_once 'Services/Libravatar.php';
     } else {
         try {
             if (function_exists('stream_resolve_include_path') && stream_resolve_include_path('Services/Libravatar.php')) {
                 include_once 'Services/Libravatar.php';
             }
         } catch (exception $e) {
             return $defaultavatar;
         }
     }
     if (!class_exists('Services_Libravatar')) {
         return $defaultavatar;
     }
     $libravatar = new Services_Libravatar();
     $libravatar->setSize($size)->setDefault(Avatar::defaultImage($size))->setHttps(true);
     $url = $libravatar->getUrl($email);
     return $url;
 }
Esempio n. 13
0
 function twitter_user_array($profile, $get_notice = false)
 {
     $twitter_user = array();
     $twitter_user['name'] = $profile->getBestName();
     $twitter_user['followers_count'] = $this->count_subscriptions($profile);
     $twitter_user['screen_name'] = $profile->nickname;
     $twitter_user['description'] = $profile->bio ? $profile->bio : null;
     $twitter_user['location'] = $profile->location ? $profile->location : null;
     $twitter_user['id'] = intval($profile->id);
     $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
     $twitter_user['profile_image_url'] = $avatar ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_STREAM_SIZE);
     $twitter_user['protected'] = 'false';
     # not supported by Laconica yet
     $twitter_user['url'] = $profile->homepage ? $profile->homepage : null;
     if ($get_notice) {
         $notice = $profile->getCurrentNotice();
         if ($notice) {
             # don't get user!
             $twitter_user['status'] = $this->twitter_status_array($notice, false);
         }
     }
     return $twitter_user;
 }
Esempio n. 14
0
 function gravatar_url($email, $size)
 {
     $url = "http://www.gravatar.com/avatar.php?gravatar_id=" . md5(strtolower($email)) . "&default=" . urlencode(Avatar::defaultImage($size)) . "&size=" . $size;
     return $url;
 }
Esempio n. 15
0
    function showQvitter()
    {
        $logged_in_user_nickname = '';
        $logged_in_user_obj = false;
        $logged_in_user = common_current_user();
        if ($logged_in_user) {
            $logged_in_user_nickname = $logged_in_user->nickname;
            $logged_in_user_obj = ApiAction::twitterUserArray($logged_in_user->getProfile());
        }
        $registrationsclosed = false;
        if (common_config('site', 'closed') == 1 || common_config('site', 'inviteonly') == 1) {
            $registrationsclosed = true;
        }
        // check if the client's ip address is blocked for registration
        if (is_array(QvitterPlugin::settings("blocked_ips"))) {
            $client_ip_is_blocked = in_array($_SERVER['REMOTE_ADDR'], QvitterPlugin::settings("blocked_ips"));
        }
        $sitetitle = common_config('site', 'name');
        $siterootdomain = common_config('site', 'server');
        $qvitterpath = Plugin::staticPath('Qvitter', '');
        $apiroot = common_path('api/', StatusNet::isHTTPS());
        $attachmentroot = common_path('attachment/', StatusNet::isHTTPS());
        $instanceurl = common_path('', StatusNet::isHTTPS());
        // user's browser's language setting
        $user_browser_language = 'en';
        // use english if we can't find the browser language
        if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
            $user_browser_language = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
        }
        common_set_returnto('');
        // forget this
        // if this is a profile we add a link header for LRDD Discovery (see WebfingerPlugin.php)
        if (substr_count($_SERVER['REQUEST_URI'], '/') == 1) {
            $nickname = substr($_SERVER['REQUEST_URI'], 1);
            if (preg_match("/^[a-zA-Z0-9]+\$/", $nickname) == 1) {
                $acct = 'acct:' . $nickname . '@' . common_config('site', 'server');
                $url = common_local_url('webfinger') . '?resource=' . $acct;
                foreach (array(Discovery::JRD_MIMETYPE, Discovery::XRD_MIMETYPE) as $type) {
                    header('Link: <' . $url . '>; rel="' . Discovery::LRDD_REL . '"; type="' . $type . '"');
                }
            }
        }
        ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
		"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
		<html xmlns="http://www.w3.org/1999/xhtml">
			<head>
				<title><?php 
        print $sitetitle;
        ?>
</title>
				<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
				<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
				<link rel="stylesheet" type="text/css" href="<?php 
        print $qvitterpath;
        ?>
css/qvitter.css?changed=<?php 
        print date('YmdHis', filemtime(QVITTERDIR . '/css/qvitter.css'));
        ?>
" />
				<link rel="stylesheet" type="text/css" href="<?php 
        print $qvitterpath;
        ?>
css/jquery.minicolors.css" />
				<link rel="shortcut icon" type="image/x-icon" href="<?php 
        print $qvitterpath;
        print QvitterPlugin::settings("favicon");
        ?>
">
				<?php 
        // if qvitter is a webapp and this is a users url we add feeds
        if (substr_count($_SERVER['REQUEST_URI'], '/') == 1) {
            $nickname = substr($_SERVER['REQUEST_URI'], 1);
            if (preg_match("/^[a-zA-Z0-9]+\$/", $nickname) == 1) {
                $user = User::getKV('nickname', $nickname);
                if (!isset($user->id)) {
                    //error_log("QVITTER: Could not get user id for user with nickname: $nickname – REQUEST_URI: ".$_SERVER['REQUEST_URI']);
                } else {
                    print '<link title="Notice feed for ' . $nickname . ' (Activity Streams JSON)" type="application/stream+json" href="' . $instanceurl . 'api/statuses/user_timeline/' . $user->id . '.as" rel="alternate">' . "\n";
                    print '				<link title="Notice feed for ' . $nickname . ' (RSS 1.0)" type="application/rdf+xml" href="' . $instanceurl . $nickname . '/rss" rel="alternate">' . "\n";
                    print '				<link title="Notice feed for ' . $nickname . ' (RSS 2.0)" type="application/rss+xml" href="' . $instanceurl . 'api/statuses/user_timeline/' . $user->id . '.rss" rel="alternate">' . "\n";
                    print '				<link title="Notice feed for ' . $nickname . ' (Atom)" type="application/atom+xml" href="' . $instanceurl . 'api/statuses/user_timeline/' . $user->id . '.atom" rel="alternate">' . "\n";
                    print '				<link title="FOAF for ' . $nickname . '" type="application/rdf+xml" href="' . $instanceurl . $nickname . '/foaf" rel="meta">' . "\n";
                    print '				<link href="' . $instanceurl . $nickname . '/microsummary" rel="microsummary">' . "\n";
                    // maybe openid
                    if (array_key_exists('OpenID', StatusNet::getActivePlugins())) {
                        print '				<link rel="openid2.provider" href="' . common_local_url('openidserver') . '"/>' . "\n";
                        print '				<link rel="openid2.local_id" href="' . $user->getProfile()->profileurl . '"/>' . "\n";
                        print '				<link rel="openid2.server" href="' . common_local_url('openidserver') . '"/>' . "\n";
                        print '				<link rel="openid2.delegate" href="' . $user->getProfile()->profileurl . '"/>' . "\n";
                    }
                }
            }
        } elseif (substr($_SERVER['REQUEST_URI'], 0, 7) == '/group/') {
            $group_id_or_name = substr($_SERVER['REQUEST_URI'], 7);
            if (stristr($group_id_or_name, '/id')) {
                $group_id_or_name = substr($group_id_or_name, 0, strpos($group_id_or_name, '/id'));
                $group = User_group::getKV('id', $group_id_or_name);
                if ($group instanceof User_group) {
                    $group_name = $group->nickname;
                    $group_id = $group_id_or_name;
                }
            } else {
                $group = Local_group::getKV('nickname', $group_id_or_name);
                if ($group instanceof Local_group) {
                    $group_id = $group->group_id;
                    $group_name = $group_id_or_name;
                }
            }
            if (preg_match("/^[a-zA-Z0-9]+\$/", $group_id_or_name) == 1 && isset($group_name) && isset($group_id)) {
                ?>

				<link rel="alternate" href="<?php 
                echo htmlspecialchars(common_local_url('ApiTimelineGroup', array('id' => $group_id, 'format' => 'as')));
                ?>
" type="application/stream+json" title="Notice feed for '<?php 
                echo htmlspecialchars($group_name);
                ?>
' group (Activity Streams JSON)" />
				<link rel="alternate" href="<?php 
                echo htmlspecialchars(common_local_url('grouprss', array('nickname' => $group_name)));
                ?>
" type="application/rdf+xml" title="Notice feed for '<?php 
                echo htmlspecialchars($group_name);
                ?>
' group (RSS 1.0)" />
				<link rel="alternate" href="<?php 
                echo htmlspecialchars(common_local_url('ApiTimelineGroup', array('id' => $group_id, 'format' => 'rss')));
                ?>
" type="application/rss+xml" title="Notice feed for '<?php 
                echo htmlspecialchars($group_name);
                ?>
' group (RSS 2.0)" />
				<link rel="alternate" href="<?php 
                echo htmlspecialchars(common_local_url('ApiTimelineGroup', array('id' => $group_id, 'format' => 'atom')));
                ?>
" type="application/atom+xml" title="Notice feed for '<?php 
                echo htmlspecialchars($group_name);
                ?>
' group (Atom)" />
				<link rel="meta" href="<?php 
                echo htmlspecialchars(common_local_url('foafgroup', array('nickname' => $group_name)));
                ?>
" type="application/rdf+xml" title="FOAF for '<?php 
                echo htmlspecialchars($group_name);
                ?>
' group" />
                <?php 
            }
        }
        // oembed discovery for local notices
        if (substr($_SERVER['REQUEST_URI'], 0, 8) == '/notice/' && $this->arg('notice') && array_key_exists('Oembed', StatusNet::getActivePlugins())) {
            $notice = Notice::getKV('id', $this->arg('notice'));
            if ($notice instanceof Notice) {
                if ($notice->isLocal()) {
                    try {
                        $notice_url = $notice->getUrl();
                        print '<link title="oEmbed" href="' . common_local_url('apiqvitteroembednotice', array('id' => $notice->id, 'format' => 'json')) . '?url=' . urlencode($notice_url) . '" type="application/json+oembed" rel="alternate">';
                        print '<link title="oEmbed" href="' . common_local_url('apiqvitteroembednotice', array('id' => $notice->id, 'format' => 'xml')) . '?url=' . urlencode($notice_url) . '" type="application/xml+oembed" rel="alternate">';
                    } catch (Exception $e) {
                        //
                    }
                }
            }
        }
        ?>
				<script>

					/*
					@licstart  The following is the entire license notice for the
					JavaScript code in this page.

					Copyright (C) 2015  Hannes Mannerheim and other contributors

					This program is free software: you can redistribute it and/or modify
					it under the terms of the GNU Affero General Public License as
					published by the Free Software Foundation, either version 3 of the
					License, or (at your option) any later version.

					This program is distributed in the hope that it will be useful,
					but WITHOUT ANY WARRANTY; without even the implied warranty of
					MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
					GNU Affero General Public License for more details.

					You should have received a copy of the GNU Affero General Public License
					along with this program.  If not, see <http://www.gnu.org/licenses/>.

					@licend  The above is the entire license notice
					for the JavaScript code in this page.
					*/

                    window.usersLanguageCode = <?php 
        print json_encode($user_browser_language);
        ?>
;
                    window.usersLanguageNameInEnglish = <?php 
        print json_encode(Locale::getDisplayLanguage($user_browser_language, 'en'));
        ?>
;
                    window.englishLanguageData = <?php 
        print file_get_contents(QVITTERDIR . '/locale/en.json');
        ?>
;
                    window.defaultAvatarStreamSize = <?php 
        print json_encode(Avatar::defaultImage(AVATAR_STREAM_SIZE));
        ?>
;
                    window.defaultAvatarProfileSize = <?php 
        print json_encode(Avatar::defaultImage(AVATAR_PROFILE_SIZE));
        ?>
;
					window.textLimit = <?php 
        print json_encode((int) common_config('site', 'textlimit'));
        ?>
;
					window.registrationsClosed = <?php 
        print json_encode($registrationsclosed);
        ?>
;
					window.thisSiteThinksItIsHttpButIsActuallyHttps = <?php 
        // this is due to a crazy setup at quitter.se, sorry about that
        $siteSSL = common_config('site', 'ssl');
        if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' && $siteSSL == 'never') {
            $this_site_thinks_it_is_http_but_is_actually_https = true;
            print 'true';
        } else {
            $this_site_thinks_it_is_http_but_is_actually_https = false;
            print 'false';
        }
        ?>
;
					window.siteTitle = <?php 
        print json_encode($sitetitle);
        ?>
;
					window.loggedIn = <?php 
        $logged_in_user_json = json_encode($logged_in_user_obj);
        $logged_in_user_json = str_replace('http:\\/\\/quitter.se\\/', 'https:\\/\\/quitter.se\\/', $logged_in_user_json);
        print $logged_in_user_json;
        ?>
;
					window.timeBetweenPolling = <?php 
        print QvitterPlugin::settings("timebetweenpolling");
        ?>
;
					window.apiRoot = <?php 
        $api_root = common_path("api/", StatusNet::isHTTPS());
        if ($this_site_thinks_it_is_http_but_is_actually_https) {
            $api_root = str_replace('http://', 'https://', $api_root);
        }
        print '\'' . $api_root . '\'';
        ?>
;
					window.fullUrlToThisQvitterApp = '<?php 
        print $qvitterpath;
        ?>
';
					window.siteRootDomain = '<?php 
        print $siterootdomain;
        ?>
';
					window.siteInstanceURL = '<?php 
        print $instanceurl;
        ?>
';
					window.defaultLinkColor = '<?php 
        print QvitterPlugin::settings("defaultlinkcolor");
        ?>
';
					window.defaultBackgroundColor = '<?php 
        print QvitterPlugin::settings("defaultbackgroundcolor");
        ?>
';
					window.siteBackground = '<?php 
        print QvitterPlugin::settings("sitebackground");
        ?>
';
					window.enableWelcomeText = <?php 
        print json_encode(QvitterPlugin::settings("enablewelcometext"));
        ?>
;
					window.customWelcomeText = <?php 
        print json_encode(QvitterPlugin::settings("customwelcometext"));
        ?>
;
					window.urlShortenerAPIURL = '<?php 
        print QvitterPlugin::settings("urlshortenerapiurl");
        ?>
';
					window.urlShortenerSignature = '<?php 
        print QvitterPlugin::settings("urlshortenersignature");
        ?>
';
					window.commonSessionToken = '<?php 
        print common_session_token();
        ?>
';
					window.siteMaxThumbnailSize = <?php 
        print common_config('thumbnail', 'maxsize');
        ?>
;
					window.siteAttachmentURLBase = '<?php 
        print $attachmentroot;
        ?>
';
					window.siteEmail = '<?php 
        print common_config('site', 'email');
        ?>
';
					window.siteLicenseTitle = '<?php 
        print common_config('license', 'title');
        ?>
';
					window.siteLicenseURL = '<?php 
        print common_config('license', 'url');
        ?>
';
					window.customTermsOfUse = <?php 
        print json_encode(QvitterPlugin::settings("customtermsofuse"));
        ?>
;
                    window.siteLocalOnlyDefaultPath = <?php 
        print common_config('public', 'localonly') ? 'true' : 'false';
        ?>
;
                    <?php 
        // Get all topics in Qvitter's namespace in Profile_prefs
        if ($logged_in_user) {
            try {
                $qvitter_profile_prefs = Profile_prefs::getNamespace(Profile::current(), 'qvitter');
            } catch (Exception $e) {
                $qvitter_profile_prefs = array();
            }
            if (count($qvitter_profile_prefs) > 0) {
                $topic_data = new stdClass();
                foreach ($qvitter_profile_prefs as $pref) {
                    $topic_data->{$pref->topic} = $pref->data;
                }
                print 'window.qvitterProfilePrefs = ' . json_encode($topic_data) . ';';
            } else {
                print 'window.qvitterProfilePrefs = false;';
            }
        }
        ?>

					// available language files and their last update time
					window.availableLanguages = {<?php 
        // scan all files in the locale directory and create a json object with their change date added
        $available_languages = array_diff(scandir(QVITTERDIR . '/locale'), array('..', '.'));
        foreach ($available_languages as $lankey => $lan) {
            $lancode = substr($lan, 0, strpos($lan, '.'));
            // for the paranthesis containing language region to work with rtl in ltr enviroment and vice versa, we add a
            // special rtl or ltr html char after the paranthesis
            // this list is incomplete, but if any rtl language gets a regional translation, it will probably be arabic
            $rtl_or_ltr_special_char = '&lrm;';
            $base_lancode = substr($lancode, 0, strpos($lancode, '_'));
            if ($base_lancode == 'ar' || $base_lancode == 'fa' || $base_lancode == 'he') {
                $rtl_or_ltr_special_char = '&rlm;';
            }
            // also make an array with all language names, to use for generating menu
            $languagecodesandnames[$lancode]['english_name'] = Locale::getDisplayLanguage($lancode, 'en');
            $languagecodesandnames[$lancode]['name'] = Locale::getDisplayLanguage($lancode, $lancode);
            if (Locale::getDisplayRegion($lancode, $lancode)) {
                $languagecodesandnames[$lancode]['name'] .= ' (' . Locale::getDisplayRegion($lancode, $lancode) . ')' . $rtl_or_ltr_special_char;
            }
            // ahorita meme only on quitter.es
            if ($lancode == 'es_ahorita') {
                if ($siterootdomain == 'quitter.es') {
                    $languagecodesandnames[$lancode]['name'] = 'español (ahorita)';
                } else {
                    unset($available_languages[$lankey]);
                    unset($languagecodesandnames[$lancode]);
                    continue;
                }
            }
            print "\n" . '						"' . $lancode . '": "' . $lan . '?changed=' . date('YmdHis', filemtime(QVITTERDIR . '/locale/' . $lan)) . '",';
        }
        ?>

						};

				</script>
				<?php 
        // event for other plugins to use to add head elements to qvitter
        Event::handle('QvitterEndShowHeadElements', array($this));
        ?>
			</head>
			<body style="background-color:<?php 
        print QvitterPlugin::settings("defaultbackgroundcolor");
        ?>
">
                <?php 
        // add an accessibility toggle link to switch to standard UI, if we're logged in
        if ($logged_in_user) {
            print '<a id="accessibility-toggle-link" href="#"></a>';
        }
        ?>
				<input id="upload-image-input" class="upload-image-input" type="file" name="upload-image-input">
				<div class="topbar">
					<a href="<?php 
        // if we're logged in, the logo links to the home stream
        // if logged out it links to the site's public stream
        if ($logged_in_user) {
            print $instanceurl . $logged_in_user_nickname . '/all';
        } else {
            print $instanceurl . 'main/public';
        }
        ?>
"><div id="logo"></div></a><?php 
        // menu for logged in users
        if ($logged_in_user) {
            ?>
    					<a id="settingslink">
    						<div class="dropdown-toggle">
    							<div class="nav-session" style="background-image:url('<?php 
            print htmlspecialchars($logged_in_user_obj['profile_image_url_profile_size']);
            ?>
')"></div>
    						</div>
    					</a><?php 
        }
        ?>
<div id="top-compose" class="hidden"></div>
					<ul class="quitter-settings dropdown-menu">
						<li class="dropdown-caret right">
							<span class="caret-outer"></span>
							<span class="caret-inner"></span>
						</li>
						<li class="fullwidth"><a id="logout"></a></li>
						<li class="fullwidth dropdown-divider"></li>
						<li class="fullwidth"><a id="edit-profile-header-link"></a></li>
						<li class="fullwidth"><a id="settings" href="<?php 
        print $instanceurl;
        ?>
settings/profile" donthijack></a></li>
						<li class="fullwidth"><a id="faq-link"></a></li>
                        <li class="fullwidth"><a id="shortcuts-link"></a></li>
						<?php 
        if (common_config('invite', 'enabled') && !common_config('site', 'closed')) {
            ?>
							<li class="fullwidth"><a id="invite-link" href="<?php 
            print $instanceurl;
            ?>
main/invite"></a></li>
						<?php 
        }
        ?>
						<li class="fullwidth"><a id="classic-link"></a></li>
						<li class="fullwidth language dropdown-divider"></li>
						<?php 
        // languages
        foreach ($languagecodesandnames as $lancode => $lan) {
            print '<li class="language"><a class="language-link" title="' . $lan['english_name'] . '" data-lang-code="' . $lancode . '">' . $lan['name'] . '</a></li>';
        }
        ?>
                        <li class="fullwidth language dropdown-divider"></li>
                        <li class="fullwidth"><a href="https://git.gnu.io/h2p/Qvitter/tree/master/locale" target="_blank" id="add-edit-language-link"></a></li>
					</ul>
					<div class="global-nav">
						<div class="global-nav-inner">
							<div class="container">
								<div id="search">
									<input type="text" spellcheck="false" autocomplete="off" name="q" placeholder="Sök" id="search-query" class="search-input">
									<span class="search-icon">
										<button class="icon nav-search" type="submit" tabindex="-1">
											<span> Sök </span>
										</button>
									</span>
								</div>
								<ul class="language-dropdown">
									<li class="dropdown">
										<a class="dropdown-toggle">
											<small></small>
											<span class="current-language"></span>
											<b class="caret"></b>
										</a>
										<ul class="dropdown-menu">
											<li class="dropdown-caret right">
												<span class="caret-outer"></span>
												<span class="caret-inner"></span>
											</li>
											<?php 
        // languages
        foreach ($languagecodesandnames as $lancode => $lan) {
            print '<li><a class="language-link" title="' . $lan['english_name'] . '" data-lang-code="' . $lancode . '">' . $lan['name'] . '</a></li>';
        }
        ?>
										</ul>
									</li>
								</ul>
							</div>
						</div>
					</div>
				</div>
                <div id="no-js-error">Please enable javascript to use this site.<script>var element = document.getElementById('no-js-error'); element.parentNode.removeChild(element);</script></div>
				<div id="page-container">
					<?php 
        $site_notice = common_config('site', 'notice');
        if (!empty($site_notice)) {
            print '<div id="site-notice">' . common_config('site', 'notice') . '</div>';
        }
        // welcome text, login and register container if logged out
        if ($logged_in_user === null) {
            ?>
                        <div class="front-welcome-text <?php 
            if ($registrationsclosed) {
                print 'registrations-closed';
            }
            ?>
"></div>
                        <div id="login-register-container">
    						<div id="login-content">
    							<form id="form_login" class="form_settings" action="<?php 
            print common_local_url('qvitterlogin');
            ?>
" method="post">
    								<div id="username-container">
    									<input id="nickname" name="nickname" type="text" value="<?php 
            print $logged_in_user_nickname;
            ?>
" tabindex="1" />
    								</div>
    								<table class="password-signin"><tbody><tr>
    									<td class="flex-table-primary">
    										<div class="placeholding-input">
    											<input id="password" name="password" type="password" tabindex="2" value="" />
    										</div>
    									</td>
    									<td class="flex-table-secondary">
    										<button class="submit" type="submit" id="submit-login" tabindex="4"></button>
    									</td>
    								</tr></tbody></table>
    								<div id="remember-forgot">
    									<input type="checkbox" id="rememberme" name="rememberme" value="yes" tabindex="3" checked="checked"> <span id="rememberme_label"></span> · <a id="forgot-password" href="<?php 
            print $instanceurl;
            ?>
main/recoverpassword" ></a>
    									<input type="hidden" id="token" name="token" value="<?php 
            print common_session_token();
            ?>
">
    									<?php 
            if (array_key_exists('OpenID', StatusNet::getActivePlugins())) {
                print '<a href="' . $instanceurl . 'main/openid" id="openid-login" title="OpenID" donthijack>OpenID</a>';
            }
            ?>
    								</div>
    							</form>
    						</div>
    						<?php 
            if ($registrationsclosed === false && $client_ip_is_blocked === false) {
                ?>
<div class="front-signup">
    							<h2></h2>
    							<div class="signup-input-container"><input placeholder="" type="text" name="user[name]" autocomplete="off" class="text-input" id="signup-user-name"></div>
    							<div class="signup-input-container"><input placeholder="" type="text" name="user[email]" autocomplete="off" id="signup-user-email"></div>
    							<div class="signup-input-container"><input placeholder="" type="password" name="user[user_password]" class="text-input" id="signup-user-password"></div>
    							<button id="signup-btn-step1" class="signup-btn" type="submit"></button>
    						</div>
                            <div id="other-servers-link"></div><?php 
            }
            ?>
<div id="qvitter-notice-logged-out"><?php 
            print common_config('site', 'qvitternoticeloggedout');
            ?>
</div>
                        </div><?php 
        }
        // box containing the logged in users queet count and compose form
        if ($logged_in_user) {
            ?>
                        <div id="user-container" style="display:none;">
    						<div id="user-header" style="background-image:url('<?php 
            print htmlspecialchars($logged_in_user_obj['cover_photo']);
            ?>
')">
    							<div id="mini-edit-profile-button"></div>
    							<div class="profile-header-inner-overlay"></div>
    							<div id="user-avatar-container"><img id="user-avatar" src="<?php 
            print htmlspecialchars($logged_in_user_obj['profile_image_url_profile_size']);
            ?>
" /></div>
    							<div id="user-name"><?php 
            print htmlspecialchars($logged_in_user_obj['name']);
            ?>
</div>
    							<div id="user-screen-name"><?php 
            print htmlspecialchars($logged_in_user_obj['screen_name']);
            ?>
</div>
    						</div>
    						<ul id="user-body">
    							<li><a href="<?php 
            print $instanceurl . $logged_in_user->nickname;
            ?>
" id="user-queets"><span class="label"></span><strong><?php 
            print $logged_in_user_obj['statuses_count'];
            ?>
</strong></a></li>
    							<li><a href="<?php 
            print $instanceurl . $logged_in_user->nickname;
            ?>
/subscriptions" id="user-following"><span class="label"></span><strong><?php 
            print $logged_in_user_obj['friends_count'];
            ?>
</strong></a></li>
    							<li><a href="<?php 
            print $instanceurl . $logged_in_user->nickname;
            ?>
/groups" id="user-groups"><span class="label"></span><strong><?php 
            print $logged_in_user_obj['groups_count'];
            ?>
</strong></a></li>
    						</ul>
    						<div id="user-footer">
    							<div id="user-footer-inner">
    								<div id="queet-box" class="queet-box queet-box-syntax" data-start-text=""></div>
    								<div class="syntax-middle"></div>
    								<div class="syntax-two" contenteditable="true"></div>
    								<div class="mentions-suggestions"></div>
    								<div class="queet-toolbar">
    									<div class="queet-box-extras">
    										<button class="upload-image"></button>
    										<button class="shorten disabled">URL</button>
    									</div>
    									<div class="queet-button">
    										<span class="queet-counter"></span>
    										<button></button>
    									</div>
    								</div>
    							</div>
    						</div>
                            <div id="main-menu" class="menu-container"><?php 
            if ($logged_in_user) {
                ?>
<a href="<?php 
                print $instanceurl . $logged_in_user->nickname;
                ?>
/all" class="stream-selection friends-timeline"><i class="chev-right"></i></a>
            							<a href="<?php 
                print $instanceurl . $logged_in_user->nickname;
                ?>
/notifications" class="stream-selection notifications"><span id="unseen-notifications"></span><i class="chev-right"></i></a>
            							<a href="<?php 
                print $instanceurl . $logged_in_user->nickname;
                ?>
/replies" class="stream-selection mentions"><i class="chev-right"></i></a>
            							<a href="<?php 
                print $instanceurl . $logged_in_user->nickname;
                ?>
" class="stream-selection my-timeline"><i class="chev-right"></i></a>
            							<a href="<?php 
                print $instanceurl . $logged_in_user->nickname;
                ?>
/favorites" class="stream-selection favorites"><i class="chev-right"></i></a>
            							<a href="<?php 
                print $instanceurl;
                ?>
main/public" class="stream-selection public-timeline"><i class="chev-right"></i></a>
            							<a href="<?php 
                print $instanceurl;
                ?>
main/all" class="stream-selection public-and-external-timeline"><i class="chev-right"></i></a>
                                        <?php 
            }
            ?>
        						</div>
        						<div class="menu-container" id="bookmark-container"></div>
                                <div class="menu-container" id="history-container"></div>
                                <div id="clear-history"></div>
        						<div id="qvitter-notice"><?php 
            print common_config('site', 'qvitternotice');
            ?>
</div>
        					</div><?php 
        }
        ?>

                    <div id="feed">
						<div id="feed-header">
							<div id="feed-header-inner">
								<h2></h2>
								<div class="reload-stream"></div>
							</div>
						</div>
						<div id="new-queets-bar-container" class="hidden"><div id="new-queets-bar"></div></div>
						<div id="feed-body"></div>
					</div>
                    <div id="hidden-html"><?php 
        // adds temporary support for microformats and linkbacks on the notice page
        if (substr($_SERVER['REQUEST_URI'], 0, 8) == '/notice/' && $this->arg('notice')) {
            echo '<ol class="notices xoxo">';
            if ($notice instanceof Notice) {
                $widget = new NoticeListItem($notice, $this);
                $widget->show();
                $this->flush();
            }
            echo '</ol>';
        }
        Event::handle('QvitterHiddenHtml', array($this));
        ?>
</div>
					<div id="footer"><div id="footer-spinner-container"></div></div>
				</div>
				<script type="text/javascript" src="<?php 
        print $qvitterpath;
        ?>
js/lib/jquery-2.1.4.min.js?changed=<?php 
        print date('YmdHis', filemtime(QVITTERDIR . '/js/lib/jquery-2.1.4.min.js'));
        ?>
"></script>
				<script type="text/javascript" src="<?php 
        print $qvitterpath;
        ?>
js/lib/jquery-ui.min.js?changed=<?php 
        print date('YmdHis', filemtime(QVITTERDIR . '/js/lib/jquery-ui.min.js'));
        ?>
"></script>
				<script type="text/javascript" src="<?php 
        print $qvitterpath;
        ?>
js/lib/jquery.minicolors.min.js?changed=<?php 
        print date('YmdHis', filemtime(QVITTERDIR . '/js/lib/jquery.minicolors.min.js'));
        ?>
"></script>
				<script type="text/javascript" src="<?php 
        print $qvitterpath;
        ?>
js/lib/jquery.jWindowCrop.js?changed=<?php 
        print date('YmdHis', filemtime(QVITTERDIR . '/js/lib/jquery.jWindowCrop.js'));
        ?>
"></script>
				<script type="text/javascript" src="<?php 
        print $qvitterpath;
        ?>
js/lib/load-image.min.js?changed=<?php 
        print date('YmdHis', filemtime(QVITTERDIR . '/js/lib/load-image.min.js'));
        ?>
"></script>
				<script type="text/javascript" src="<?php 
        print $qvitterpath;
        ?>
js/lib/xregexp-all-3.0.0-pre.js?changed=<?php 
        print date('YmdHis', filemtime(QVITTERDIR . '/js/lib/xregexp-all-3.0.0-pre.js'));
        ?>
"></script>
                <script type="text/javascript" src="<?php 
        print $qvitterpath;
        ?>
js/lib/lz-string.js?changed=<?php 
        print date('YmdHis', filemtime(QVITTERDIR . '/js/lib/lz-string.js'));
        ?>
"></script>
                <script type="text/javascript" src="<?php 
        print $qvitterpath;
        ?>
js/lib/bowser.min.js?changed=<?php 
        print date('YmdHis', filemtime(QVITTERDIR . '/js/lib/bowser.min.js'));
        ?>
"></script>
				<script charset="utf-8" type="text/javascript" src="<?php 
        print $qvitterpath;
        ?>
js/dom-functions.js?changed=<?php 
        print date('YmdHis', filemtime(QVITTERDIR . '/js/dom-functions.js'));
        ?>
"></script>
				<script charset="utf-8" type="text/javascript" src="<?php 
        print $qvitterpath;
        ?>
js/misc-functions.js?changed=<?php 
        print date('YmdHis', filemtime(QVITTERDIR . '/js/misc-functions.js'));
        ?>
"></script>
				<script charset="utf-8" type="text/javascript" src="<?php 
        print $qvitterpath;
        ?>
js/ajax-functions.js?changed=<?php 
        print date('YmdHis', filemtime(QVITTERDIR . '/js/ajax-functions.js'));
        ?>
"></script>
                <script charset="utf-8" type="text/javascript" src="<?php 
        print $qvitterpath;
        ?>
js/stream-router.js?changed=<?php 
        print date('YmdHis', filemtime(QVITTERDIR . '/js/stream-router.js'));
        ?>
"></script>
				<script charset="utf-8" type="text/javascript" src="<?php 
        print $qvitterpath;
        ?>
js/qvitter.js?changed=<?php 
        print date('YmdHis', filemtime(QVITTERDIR . '/js/qvitter.js'));
        ?>
"></script>
				<?php 
        // event for other plugins to add scripts to qvitter
        Event::handle('QvitterEndShowScripts', array($this));
        // we might have custom javascript in the config file that we want to add
        if (QvitterPlugin::settings('js')) {
            print '<script type="text/javascript">' . QvitterPlugin::settings('js') . '</script>';
        }
        ?>
			<div id="dynamic-styles">
				<style>
					a, a:visited, a:active,
					ul.stats li:hover a,
					ul.stats li:hover a strong,
					#user-body a:hover div strong,
					#user-body a:hover div div,
					.permalink-link:hover,
					.stream-item.expanded > .queet .stream-item-expand,
					.stream-item-footer .with-icn .requeet-text a b:hover,
					.queet-text span.attachment.more,
					.stream-item-header .created-at a:hover,
					.stream-item-header a.account-group:hover .name,
					.queet:hover .stream-item-expand,
					.show-full-conversation:hover,
					#new-queets-bar,
					.menu-container div,
					.cm-mention, .cm-tag, .cm-group, .cm-url, .cm-email,
					div.syntax-middle span,
					#user-body strong,
					ul.stats,
					.stream-item:not(.temp-post) ul.queet-actions li .icon:not(.is-mine):hover:before,
					.show-full-conversation,
					#user-body #user-queets:hover .label,
					#user-body #user-groups:hover .label,
					#user-body #user-following:hover .label,
					ul.stats a strong,
					.queet-box-extras button,
					#openid-login:hover:after,
                    .post-to-group {
						color:/*COLORSTART*/<?php 
        print QvitterPlugin::settings("defaultlinkcolor");
        ?>
/*COLOREND*/;
						}
					#unseen-notifications,
					.stream-item.notification.not-seen > .queet::before,
					#top-compose,
					#logo,
					.queet-toolbar button,
					#user-header,
					.profile-header-inner,
					.topbar,
					.menu-container,
					.member-button.member,
					.external-follow-button.following,
					.qvitter-follow-button.following,
					.save-profile-button,
					.crop-and-save-button,
					.topbar .global-nav.show-logo:before,
					.topbar .global-nav.pulse-logo:before,
                    .dropdown-menu li:not(.dropdown-caret) a:hover {
						background-color:/*BACKGROUNDCOLORSTART*/<?php 
        print QvitterPlugin::settings("defaultlinkcolor");
        ?>
/*BACKGROUNDCOLOREND*/;
						}
					.queet-box-syntax[contenteditable="true"]:focus,
                    .stream-item.selected-by-keyboard::before {
						border-color:/*BORDERCOLORSTART*/#999999/*BORDERCOLOREND*/;
						}
					#user-footer-inner,
					.inline-reply-queetbox,
					#popup-faq #faq-container p.indent {
						background-color:/*LIGHTERBACKGROUNDCOLORSTART*/rgb(205,230,239)/*LIGHTERBACKGROUNDCOLOREND*/;
						}
					#user-footer-inner,
					.queet-box,
					.queet-box-syntax[contenteditable="true"],
					.inline-reply-queetbox,
					span.inline-reply-caret,
				    .stream-item.expanded .stream-item.first-visible-after-parent,
					#popup-faq #faq-container p.indent,
                    .post-to-group,
                    .quoted-notice:hover,
                    .oembed-item:hover,
                    .stream-item:hover:not(.expanded) .quoted-notice:hover,
                    .stream-item:hover:not(.expanded) .oembed-item:hover {
						border-color:/*LIGHTERBORDERCOLORSTART*/rgb(155,206,224)/*LIGHTERBORDERCOLOREND*/;
						}
					span.inline-reply-caret .caret-inner {
						border-bottom-color:/*LIGHTERBORDERBOTTOMCOLORSTART*/rgb(205,230,239)/*LIGHTERBORDERBOTTOMCOLOREND*/;
						}

					.modal-close .icon,
					.chev-right,
					.close-right,
					button.icon.nav-search,
					.member-button .join-text i,
					.external-member-button .join-text i,
					.external-follow-button .follow-text i,
					.qvitter-follow-button .follow-text i,
					#logo,
					.upload-cover-photo,
					.upload-avatar,
					.upload-background-image,
					button.shorten i,
					.reload-stream,
					.topbar .global-nav:before,
					.stream-item.notification.repeat .dogear,
					.stream-item.notification.like .dogear,
					.ostatus-link,
					.close-edit-profile-window {
						background-image: url("<?php 
        print QvitterPlugin::settings("sprite");
        ?>
");
						background-size: 500px 1329px;
						}
					@media (max-width: 910px) {
						#search-query,
						.menu-container a,
						.menu-container a.current,
						.stream-selection.friends-timeline:after,
						.stream-selection.notifications:after,
						.stream-selection.my-timeline:after,
						.stream-selection.public-timeline:after {
							background-image: url("<?php 
        print QvitterPlugin::settings("sprite");
        ?>
");
							background-size: 500px 1329px;
							}
						}

				</style>
			</div>
			</body>
		</html>


			<?php 
    }
Esempio n. 16
0
 /**
  * show the avatar of the peopletag's creator
  *
  * This will use the default avatar if no avatar is assigned for the author.
  * It makes a link to the author's profile.
  *
  * @return void
  */
 function showAvatar($size = AVATAR_STREAM_SIZE)
 {
     $avatar = $this->profile->getAvatar($size);
     $this->out->element('img', array('src' => $avatar ? $avatar->displayUrl() : Avatar::defaultImage($size), 'class' => 'avatar photo', 'width' => $size, 'height' => $size, 'alt' => $this->profile->fullname ? $this->profile->fullname : $this->profile->nickname));
 }
 /**
  * Show the timeline of notices
  *
  * @return void
  */
 function showTimeline()
 {
     $profile = $this->user->getProfile();
     $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
     $sitename = common_config('site', 'name');
     $title = sprintf(_('%1$s / Updates mentioning %2$s'), $sitename, $this->user->nickname);
     $taguribase = TagURI::base();
     $id = "tag:{$taguribase}:Mentions:" . $this->user->id;
     $link = common_local_url('replies', array('nickname' => $this->user->nickname));
     $self = $this->getSelfUri();
     $subtitle = sprintf(_('%1$s updates that reply to updates from %2$s / %3$s.'), $sitename, $this->user->nickname, $profile->getBestName());
     $logo = $avatar ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE);
     switch ($this->format) {
         case 'xml':
             $this->showXmlTimeline($this->notices);
             break;
         case 'rss':
             $this->showRssTimeline($this->notices, $title, $link, $subtitle, null, $logo, $self);
             break;
         case 'atom':
             header('Content-Type: application/atom+xml; charset=utf-8');
             $atom = new AtomNoticeFeed();
             $atom->setId($id);
             $atom->setTitle($title);
             $atom->setSubtitle($subtitle);
             $atom->setLogo($logo);
             $atom->setUpdated('now');
             $atom->addLink($link);
             $atom->setSelfLink($self);
             $atom->addEntryFromNotices($this->notices);
             $this->raw($atom->getString());
             break;
         case 'json':
             $this->showJsonTimeline($this->notices);
             break;
         default:
             $this->clientError(_('API method not found.'), $code = 404);
             break;
     }
 }
Esempio n. 18
0
 /**
  * Class handler.
  *
  * @param array $args query arguments
  * 
  * @return boolean false if nickname or user isn't found
  */
 function handle($args)
 {
     parent::handle($args);
     $nickname = $this->trimmed('nickname');
     if (!$nickname) {
         $this->clientError(_('No nickname.'));
         return;
     }
     $size = $this->trimmed('size');
     if (!$size) {
         $this->clientError(_('No size.'));
         return;
     }
     $size = strtolower($size);
     if (!in_array($size, array('original', '96', '48', '24'))) {
         $this->clientError(_('Invalid size.'));
         return;
     }
     $user = User::staticGet('nickname', $nickname);
     if (!$user) {
         $this->clientError(_('No such user.'));
         return;
     }
     $profile = $user->getProfile();
     if (!$profile) {
         $this->clientError(_('User has no profile.'));
         return;
     }
     if ($size == 'original') {
         $avatar = $profile->getOriginal();
     } else {
         $avatar = $profile->getAvatar($size + 0);
     }
     if ($avatar) {
         $url = $avatar->url;
     } else {
         if ($size == 'original') {
             $url = Avatar::defaultImage(AVATAR_PROFILE_SIZE);
         } else {
             $url = Avatar::defaultImage($size + 0);
         }
     }
     common_redirect($url, 302);
 }
Esempio n. 19
0
 /**
  * Show the timeline of notices
  *
  * @return void
  */
 function showTimeline()
 {
     $profile = $this->user->getProfile();
     $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
     $sitename = common_config('site', 'name');
     $title = sprintf(_('%1$s / Bookmarks from %2$s'), $sitename, $this->user->nickname);
     $taguribase = TagURI::base();
     $id = "tag:{$taguribase}:Bookmarks:" . $this->user->id;
     $subtitle = sprintf(_('%1$s updates bookmarked by %2$s / %3$s.'), $sitename, $profile->getBestName(), $this->user->nickname);
     $logo = !empty($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE);
     $link = common_local_url('bookmarks', array('nickname' => $this->user->nickname));
     $self = $this->getSelfUri();
     switch ($this->format) {
         case 'xml':
             $this->showXmlTimeline($this->notices);
             break;
         case 'rss':
             $this->showRssTimeline($this->notices, $title, $link, $subtitle, null, $logo, $self);
             break;
         case 'atom':
             header('Content-Type: application/atom+xml; charset=utf-8');
             $atom = new AtomNoticeFeed($this->auth_user);
             $atom->setId($id);
             $atom->setTitle($title);
             $atom->setSubtitle($subtitle);
             $atom->setLogo($logo);
             $atom->setUpdated('now');
             $atom->addLink($link);
             $atom->setSelfLink($self);
             $atom->addEntryFromNotices($this->notices);
             $this->raw($atom->getString());
             break;
         case 'json':
             $this->showJsonTimeline($this->notices);
             break;
         case 'as':
             header('Content-Type: ' . ActivityStreamJSONDocument::CONTENT_TYPE);
             $doc = new ActivityStreamJSONDocument($this->auth_user);
             $doc->setTitle($title);
             $doc->addLink($link, 'alternate', 'text/html');
             $doc->addItemsFromNotices($this->notices);
             $this->raw($doc->asString());
             break;
         default:
             // TRANS: Client error displayed when coming across a non-supported API method.
             $this->clientError(_('API method not found.'), $code = 404);
             break;
     }
 }
Esempio n. 20
0
 function showAvatar()
 {
     $avatar = $this->profile->getAvatar(AVATAR_STREAM_SIZE);
     $aAttrs = $this->linkAttributes();
     $this->out->elementStart('a', $aAttrs);
     $this->out->element('img', array('src' => !empty($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_STREAM_SIZE), 'class' => 'photo avatar', 'width' => AVATAR_STREAM_SIZE, 'height' => AVATAR_STREAM_SIZE, 'alt' => $this->profile->fullname ? $this->profile->fullname : $this->profile->nickname));
     $this->out->text(' ');
     $hasFN = !empty($this->profile->fullname) ? 'nickname' : 'fn nickname';
     $this->out->elementStart('span', $hasFN);
     $this->out->raw($this->highlight($this->profile->nickname));
     $this->out->elementEnd('span');
     $this->out->elementEnd('a');
 }
Esempio n. 21
0
 private function getAvatar($profile)
 {
     $avatar = $this->profile->getAvatar(48);
     if ($avatar) {
         return $avatar->displayUrl();
     } else {
         return Avatar::defaultImage(48);
     }
 }
Esempio n. 22
0
 function showContent()
 {
     $this->elementStart('div', 'entity_profile vcard author');
     $this->element('h2', null, _('User profile'));
     $avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE);
     $this->elementStart('dl', 'entity_depiction');
     $this->element('dt', null, _('Photo'));
     $this->elementStart('dd');
     $this->element('img', array('src' => $avatar ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE), 'class' => 'photo avatar', 'width' => AVATAR_PROFILE_SIZE, 'height' => AVATAR_PROFILE_SIZE, 'alt' => $this->profile->fullname ? $this->profile->fullname : $this->profile->nickname));
     $this->elementEnd('dd');
     $this->elementEnd('dl');
     $this->elementStart('dl', 'entity_nickname');
     $this->element('dt', null, _('Nickname'));
     $this->elementStart('dd');
     $this->element('a', array('href' => $this->profile->profileurl, 'class' => 'nickname'), $this->profile->nickname);
     $this->elementEnd('dd');
     $this->elementEnd('dl');
     if ($this->profile->fullname) {
         $this->elementStart('dl', 'entity_fn');
         $this->element('dt', null, _('Full name'));
         $this->elementStart('dd');
         $this->element('span', 'fn', $this->profile->fullname);
         $this->elementEnd('dd');
         $this->elementEnd('dl');
     }
     if ($this->profile->location) {
         $this->elementStart('dl', 'entity_location');
         $this->element('dt', null, _('Location'));
         $this->element('dd', 'label', $this->profile->location);
         $this->elementEnd('dl');
     }
     if ($this->profile->homepage) {
         $this->elementStart('dl', 'entity_url');
         $this->element('dt', null, _('URL'));
         $this->elementStart('dd');
         $this->element('a', array('href' => $this->profile->homepage, 'rel' => 'me', 'class' => 'url'), $this->profile->homepage);
         $this->elementEnd('dd');
         $this->elementEnd('dl');
     }
     if ($this->profile->bio) {
         $this->elementStart('dl', 'entity_note');
         $this->element('dt', null, _('Note'));
         $this->element('dd', 'note', $this->profile->bio);
         $this->elementEnd('dl');
     }
     $this->elementEnd('div');
     $this->elementStart('form', array('method' => 'post', 'id' => 'form_tag_user', 'class' => 'form_settings', 'name' => 'tagother', 'action' => common_local_url('tagother', array('id' => $this->profile->id))));
     $this->elementStart('fieldset');
     $this->element('legend', null, _('Tag user'));
     $this->hidden('token', common_session_token());
     $this->hidden('id', $this->profile->id);
     $user = common_current_user();
     $this->elementStart('ul', 'form_data');
     $this->elementStart('li');
     $this->input('tags', _('Tags'), $this->arg('tags') ? $this->arg('tags') : implode(' ', Profile_tag::getTags($user->id, $this->profile->id)), _('Tags for this user (letters, numbers, -, ., and _), comma- or space- separated'));
     $this->elementEnd('li');
     $this->elementEnd('ul');
     $this->submit('save', _('Save'));
     $this->elementEnd('fieldset');
     $this->elementEnd('form');
 }
Esempio n. 23
0
 function showAvatar()
 {
     if (Event::handle('StartProfilePageAvatar', array($this->out, $this->profile))) {
         $avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE);
         $this->out->elementStart('dl', 'entity_depiction');
         $this->out->element('dt', null, _('Photo'));
         $this->out->elementStart('dd');
         $this->out->element('img', array('src' => $avatar ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE), 'class' => 'photo avatar', 'width' => AVATAR_PROFILE_SIZE, 'height' => AVATAR_PROFILE_SIZE, 'alt' => $this->profile->nickname));
         $this->out->elementEnd('dd');
         $user = User::staticGet('id', $this->profile->id);
         $cur = common_current_user();
         if ($cur && $cur->id == $user->id) {
             $this->out->elementStart('dd');
             $this->out->element('a', array('href' => common_local_url('avatarsettings')), _('Edit Avatar'));
             $this->out->elementEnd('dd');
         }
         $this->out->elementEnd('dl');
         Event::handle('EndProfilePageAvatar', array($this->out, $this->profile));
     }
 }
Esempio n. 24
0
 /**
  * Class handler.
  *
  * @param array $args query arguments
  *
  * @return boolean false if nickname or user isn't found
  */
 function handle($args)
 {
     parent::handle($args);
     $nickname = $this->trimmed('nickname');
     if (!$nickname) {
         // TRANS: Client error displayed trying to get an avatar without providing a nickname.
         $this->clientError(_('No nickname.'));
         return;
     }
     $size = $this->trimmed('size');
     if (!$size) {
         // TRANS: Client error displayed trying to get an avatar without providing an avatar size.
         $this->clientError(_('No size.'));
         return;
     }
     $size = strtolower($size);
     if (!in_array($size, array('original', '96', '48', '24'))) {
         // TRANS: Client error displayed trying to get an avatar providing an invalid avatar size.
         $this->clientError(_('Invalid size.'));
         return;
     }
     $user = User::staticGet('nickname', $nickname);
     if (!$user) {
         // TRANS: Client error displayed trying to get an avatar for a non-existing user.
         $this->clientError(_('No such user.'));
         return;
     }
     $profile = $user->getProfile();
     if (!$profile) {
         // TRANS: Error message displayed when referring to a user without a profile.
         $this->clientError(_('User has no profile.'));
         return;
     }
     if ($size == 'original') {
         $avatar = $profile->getOriginal();
     } else {
         $avatar = $profile->getAvatar($size + 0);
     }
     if ($avatar) {
         $url = $avatar->url;
     } else {
         if ($size == 'original') {
             $url = Avatar::defaultImage(AVATAR_PROFILE_SIZE);
         } else {
             $url = Avatar::defaultImage($size + 0);
         }
     }
     common_redirect($url, 302);
 }
Esempio n. 25
0
 function rssDirectMessageArray($message)
 {
     $entry = array();
     $from = $message->getFrom();
     $entry['title'] = sprintf('Message from %1$s to %2$s', $from->nickname, $message->getTo()->nickname);
     $entry['content'] = common_xml_safe_str($message->rendered);
     $entry['link'] = common_local_url('showmessage', array('message' => $message->id));
     $entry['published'] = common_date_iso8601($message->created);
     $taguribase = TagURI::base();
     $entry['id'] = "tag:{$taguribase}:{$entry['link']}";
     $entry['updated'] = $entry['published'];
     $entry['author-name'] = $from->getBestName();
     $entry['author-uri'] = $from->homepage;
     $avatar = $from->getAvatar(AVATAR_STREAM_SIZE);
     $entry['avatar'] = !empty($avatar) ? $avatar->url : Avatar::defaultImage(AVATAR_STREAM_SIZE);
     $entry['avatar-type'] = !empty($avatar) ? $avatar->mediatype : 'image/png';
     // RSS item specific
     $entry['description'] = $entry['content'];
     $entry['pubDate'] = common_date_rfc2822($message->created);
     $entry['guid'] = $entry['link'];
     return $entry;
 }
Esempio n. 26
0
 /**
  * show the avatar of the notice's author
  *
  * This will use the default avatar if no avatar is assigned for the author.
  * It makes a link to the author's profile.
  *
  * @return void
  */
 function showAvatar()
 {
     if ('shownotice' === $this->out->trimmed('action')) {
         $avatar_size = AVATAR_PROFILE_SIZE;
     } else {
         $avatar_size = AVATAR_STREAM_SIZE;
     }
     $avatar = $this->profile->getAvatar($avatar_size);
     $this->out->element('img', array('src' => $avatar ? $avatar->displayUrl() : Avatar::defaultImage($avatar_size), 'class' => 'avatar photo', 'width' => $avatar_size, 'height' => $avatar_size, 'alt' => $this->profile->fullname ? $this->profile->fullname : $this->profile->nickname));
 }
Esempio n. 27
0
 function showProfile()
 {
     $this->elementStart('div', 'entity_profile vcard author');
     $this->element('h2', null, _('User profile'));
     $avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE);
     $this->elementStart('dl', 'entity_depiction');
     $this->element('dt', null, _('Photo'));
     $this->elementStart('dd');
     $this->element('img', array('src' => $avatar ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE), 'class' => 'photo avatar', 'width' => AVATAR_PROFILE_SIZE, 'height' => AVATAR_PROFILE_SIZE, 'alt' => $this->profile->nickname));
     $this->elementEnd('dd');
     $user = User::staticGet('id', $this->profile->id);
     $cur = common_current_user();
     if ($cur && $cur->id == $user->id) {
         $this->elementStart('dd');
         $this->element('a', array('href' => common_local_url('avatarsettings')), _('Edit Avatar'));
         $this->elementEnd('dd');
     }
     $this->elementEnd('dl');
     $this->elementStart('dl', 'entity_nickname');
     $this->element('dt', null, _('Nickname'));
     $this->elementStart('dd');
     $hasFN = $this->profile->fullname ? 'nickname url uid' : 'fn nickname url uid';
     $this->element('a', array('href' => $this->profile->profileurl, 'rel' => 'me', 'class' => $hasFN), $this->profile->nickname);
     $this->elementEnd('dd');
     $this->elementEnd('dl');
     if ($this->profile->fullname) {
         $this->elementStart('dl', 'entity_fn');
         $this->element('dt', null, _('Full name'));
         $this->elementStart('dd');
         $this->element('span', 'fn', $this->profile->fullname);
         $this->elementEnd('dd');
         $this->elementEnd('dl');
     }
     if ($this->profile->location) {
         $this->elementStart('dl', 'entity_location');
         $this->element('dt', null, _('Location'));
         $this->element('dd', 'label', $this->profile->location);
         $this->elementEnd('dl');
     }
     if ($this->profile->homepage) {
         $this->elementStart('dl', 'entity_url');
         $this->element('dt', null, _('URL'));
         $this->elementStart('dd');
         $this->element('a', array('href' => $this->profile->homepage, 'rel' => 'me', 'class' => 'url'), $this->profile->homepage);
         $this->elementEnd('dd');
         $this->elementEnd('dl');
     }
     if ($this->profile->bio) {
         $this->elementStart('dl', 'entity_note');
         $this->element('dt', null, _('Note'));
         $this->element('dd', 'note', $this->profile->bio);
         $this->elementEnd('dl');
     }
     $tags = Profile_tag::getTags($this->profile->id, $this->profile->id);
     if (count($tags) > 0) {
         $this->elementStart('dl', 'entity_tags');
         $this->element('dt', null, _('Tags'));
         $this->elementStart('dd');
         $this->elementStart('ul', 'tags xoxo');
         foreach ($tags as $tag) {
             $this->elementStart('li');
             // Avoid space by using raw output.
             $pt = '<span class="mark_hash">#</span><a rel="tag" href="' . common_local_url('peopletag', array('tag' => $tag)) . '">' . $tag . '</a>';
             $this->raw($pt);
             $this->elementEnd('li');
         }
         $this->elementEnd('ul');
         $this->elementEnd('dd');
         $this->elementEnd('dl');
     }
     $this->elementEnd('div');
     $this->elementStart('div', 'entity_actions');
     $this->element('h2', null, _('User actions'));
     $this->elementStart('ul');
     $cur = common_current_user();
     if ($cur && $cur->id == $this->profile->id) {
         $this->elementStart('li', 'entity_edit');
         $this->element('a', array('href' => common_local_url('profilesettings'), 'title' => _('Edit profile settings')), _('Edit'));
         $this->elementEnd('li');
     }
     if ($cur) {
         if ($cur->id != $this->profile->id) {
             $this->elementStart('li', 'entity_subscribe');
             if ($cur->isSubscribed($this->profile)) {
                 $usf = new UnsubscribeForm($this, $this->profile);
                 $usf->show();
             } else {
                 $sf = new SubscribeForm($this, $this->profile);
                 $sf->show();
             }
             $this->elementEnd('li');
         }
     } else {
         $this->elementStart('li', 'entity_subscribe');
         $this->showRemoteSubscribeLink();
         $this->elementEnd('li');
     }
     if ($cur && $cur->id != $user->id && $cur->mutuallySubscribed($user)) {
         $this->elementStart('li', 'entity_send-a-message');
         $this->element('a', array('href' => common_local_url('newmessage', array('to' => $user->id)), 'title' => _('Send a direct message to this user')), _('Message'));
         $this->elementEnd('li');
         if ($user->email && $user->emailnotifynudge) {
             $this->elementStart('li', 'entity_nudge');
             $nf = new NudgeForm($this, $user);
             $nf->show();
             $this->elementEnd('li');
         }
     }
     if ($cur && $cur->id != $this->profile->id) {
         $blocked = $cur->hasBlocked($this->profile);
         $this->elementStart('li', 'entity_block');
         if ($blocked) {
             $ubf = new UnblockForm($this, $this->profile);
             $ubf->show();
         } else {
             $bf = new BlockForm($this, $this->profile);
             $bf->show();
         }
         $this->elementEnd('li');
     }
     $this->elementEnd('ul');
     $this->elementEnd('div');
 }
Esempio n. 28
0
 function showEntity($entity, $profile, $avatar, $note)
 {
     $nickname = $entity->nickname;
     $fullname = $entity->fullname;
     $homepage = $entity->homepage;
     $location = $entity->location;
     if (!$avatar) {
         $avatar = Avatar::defaultImage(AVATAR_PROFILE_SIZE);
     }
     $this->elementStart('div', 'entity_profile vcard');
     $this->elementStart('dl', 'entity_depiction');
     $this->element('dt', null, _('Photo'));
     $this->elementStart('dd');
     $this->element('img', array('src' => $avatar, 'class' => 'photo avatar', 'width' => AVATAR_PROFILE_SIZE, 'height' => AVATAR_PROFILE_SIZE, 'alt' => $nickname));
     $this->elementEnd('dd');
     $this->elementEnd('dl');
     $this->elementStart('dl', 'entity_nickname');
     $this->element('dt', null, _('Nickname'));
     $this->elementStart('dd');
     $hasFN = $fullname !== '' ? 'nickname' : 'fn nickname';
     $this->elementStart('a', array('href' => $profile, 'class' => 'url ' . $hasFN));
     $this->raw($nickname);
     $this->elementEnd('a');
     $this->elementEnd('dd');
     $this->elementEnd('dl');
     if (!is_null($fullname)) {
         $this->elementStart('dl', 'entity_fn');
         $this->elementStart('dd');
         $this->elementStart('span', 'fn');
         $this->raw($fullname);
         $this->elementEnd('span');
         $this->elementEnd('dd');
         $this->elementEnd('dl');
     }
     if (!is_null($location)) {
         $this->elementStart('dl', 'entity_location');
         $this->element('dt', null, _('Location'));
         $this->elementStart('dd', 'label');
         $this->raw($location);
         $this->elementEnd('dd');
         $this->elementEnd('dl');
     }
     if (!is_null($homepage)) {
         $this->elementStart('dl', 'entity_url');
         $this->element('dt', null, _('URL'));
         $this->elementStart('dd');
         $this->elementStart('a', array('href' => $homepage, 'class' => 'url'));
         $this->raw($homepage);
         $this->elementEnd('a');
         $this->elementEnd('dd');
         $this->elementEnd('dl');
     }
     if (!is_null($note)) {
         $this->elementStart('dl', 'entity_note');
         $this->element('dt', null, _('Note'));
         $this->elementStart('dd', 'note');
         $this->raw($note);
         $this->elementEnd('dd');
         $this->elementEnd('dl');
     }
     $this->elementEnd('div');
 }
Esempio n. 29
0
 /**
  * Extra <head> content
  *
  * We show the microid(s) for the author, if any.
  *
  * @return void
  */
 function extraHead()
 {
     $user = User::staticGet($this->profile->id);
     if (!$user) {
         return;
     }
     if ($user->emailmicroid && $user->email && $this->notice->uri) {
         $id = new Microid('mailto:' . $user->email, $this->notice->uri);
         $this->element('meta', array('name' => 'microid', 'content' => $id->toString()));
     }
     if ($user->jabbermicroid && $user->jabber && $this->notice->uri) {
         $id = new Microid('xmpp:', $user->jabber, $this->notice->uri);
         $this->element('meta', array('name' => 'microid', 'content' => $id->toString()));
     }
     $this->element('link', array('rel' => 'alternate', 'type' => 'application/json+oembed', 'href' => common_local_url('oembed', array(), array('format' => 'json', 'url' => $this->notice->uri)), 'title' => 'oEmbed'), null);
     $this->element('link', array('rel' => 'alternate', 'type' => 'text/xml+oembed', 'href' => common_local_url('oembed', array(), array('format' => 'xml', 'url' => $this->notice->uri)), 'title' => 'oEmbed'), null);
     // Extras to aid in sharing notices to Facebook
     $avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE);
     $avatarUrl = $avatar ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE);
     $this->element('meta', array('property' => 'og:image', 'content' => $avatarUrl));
     $this->element('meta', array('property' => 'og:description', 'content' => $this->notice->content));
 }
Esempio n. 30
0
 /**
  * Build a search result object
  *
  * This populates the the result in preparation for JSON encoding.
  *
  * @return void
  */
 function buildResult()
 {
     $this->text = $this->notice->content;
     $replier_profile = null;
     if ($this->notice->reply_to) {
         $reply = Notice::staticGet(intval($this->notice->reply_to));
         if ($reply) {
             $replier_profile = $reply->getProfile();
         }
     }
     $this->to_user_id = $replier_profile ? intval($replier_profile->id) : null;
     $this->to_user = $replier_profile ? $replier_profile->nickname : null;
     $this->from_user = $this->profile->nickname;
     $this->id = $this->notice->id;
     $this->from_user_id = $this->profile->id;
     $user = User::staticGet('id', $this->profile->id);
     $this->iso_language_code = $user->language;
     $this->source = $this->getSourceLink($this->notice->source);
     $avatar = $this->profile->getAvatar(AVATAR_STREAM_SIZE);
     $this->profile_image_url = $avatar ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_STREAM_SIZE);
     $this->created_at = common_date_rfc2822($this->notice->created);
 }