'id' => $this->target->id),
array('max_id' => $this->next_id))
: null;
- $lastNotice = $this->notices[0];
- $lastId = $lastNotice->id;
+
+ $prevExtra = array();
+ if (!empty($this->notices)) {
+ assert($this->notices[0] instanceof Notice);
+ $prevExtra['since_id'] = $this->notices[0]->id;
+ }
+
$prevUrl = common_local_url('ApiTimelineUser',
array('format' => $this->format,
'id' => $this->target->id),
- array('since_id' => $lastId));
+ $prevExtra);
$firstUrl = common_local_url('ApiTimelineUser',
array('format' => $this->format,
'id' => $this->target->id));
}
}
- if (empty($notices)) {
- // TRANS: When no posts were found with specific or default parameters
- $this->clientError(_('Did not find any posts within search parameters'), 404);
- }
-
return $notices;
}
function showContent() {
$this->areYouSureForm();
+ $block = new GroupProfileBlock($this, $this->group);
+ $block->show();
}
/**
if (empty($notice->conversation) and !empty($options['conversation'])) {
$conv = Conversation::getKV('uri', $options['conversation']);
if ($conv instanceof Conversation) {
- common_debug('Conversation stitched together from (probably) reply to unknown remote user. Activity creation time ('.$activity->time.') should maybe be compared to conversation creation time ('.$conv->created.').');
+ common_debug('Conversation stitched together from (probably) reply to unknown remote user. Activity creation time ('.$notice->created.') should maybe be compared to conversation creation time ('.$conv->created.').');
$notice->conversation = $conv->id;
} else {
// Conversation URI was not found, so we must create it. But we can't create it
}
// If this isn't a reply to anything, then it's its own
- // root.
+ // root if it's the earliest notice in the conversation:
if (empty($this->reply_to)) {
- return $this;
+ $root = new Notice;
+ $root->conversation = $this->conversation;
+ $root->orderBy('notice.created ASC');
+ $root->find();
+ $root->fetch();
+ $root->free();
+ return $root;
}
if (is_null($profile)) {
$this->type = self::PERSON; // XXX: is this fair?
}
- // start with <atom:title>
- $title = ActivityUtils::childHtmlContent($element, self::TITLE);
+ // Start with <poco::displayName>
- if (!empty($title)) {
- $this->title = common_strip_html($title);
+ $this->title = ActivityUtils::childContent($element, PoCo::DISPLAYNAME, PoCo::NS);
+
+ // try falling back to <atom:title>
+
+ if (empty($this->title)) {
+ $title = ActivityUtils::childHtmlContent($element, self::TITLE);
+
+ if (!empty($title)) {
+ $this->title = common_strip_html($title);
+ }
}
- // fall back to <atom:name>
+ // fall back to <atom:name> as a last resort
if (empty($this->title)) {
$this->title = $this->_childContent($element, self::NAME);
// If it is a string, we really store a JSON object in there
// except if it begins with '<', because then it is XML.
- if (is_string($object) && substr($object, 0, 1) != '<') {
+ if (is_string($object) &&
+ substr($object, 0, 1) != '<' &&
+ !is_numeric($object))
+ {
$json = json_decode($object);
if ($json === null) {
throw new Exception('Bad frame in queue item');
// TRANS: Standard search suggestions shown when a search does not give any results.
$message .= sprintf(_("You can also try your search on other engines:
-* [Twingly](http://www.twingly.com/search?q=%s&content=microblog&site=%%%%site.server%%%%)
-* [Tweet scan](http://www.tweetscan.com/indexi.php?s=%s)
-* [Google](http://www.google.com/search?q=site%%3A%%%%site.server%%%%+%s)
-* [Yahoo](http://search.yahoo.com/search?p=site%%3A%%%%site.server%%%%+%s)
-* [Collecta](http://collecta.com/#q=%s)"), $qe, $qe, $qe, $qe, $qe);
+* [DuckDuckGo](https://duckduckgo.com/?q=site%%3A%%%%site.server%%%%+%s)
+* [Ixquick](https://ixquick.com/do/search?query=site%%3A%%%%site.server%%%%+%s)
+* [Google](https://www.google.com/search?q=site%%3A%%%%site.server%%%%+%s)
+* [Yahoo!](https://search.yahoo.com/search?p=site%%3A%%%%site.server%%%%+%s)
+"), $qe, $qe, $qe, $qe);
$message .= "\n";
}
$this->elementStart('div', 'help instructions');
$pathpart = (common_config('site', 'path')) ? common_config('site', 'path')."/" : '';
if (($ssl && (common_config('site', 'ssl') === 'sometimes'))
+ || StatusNet::isHTTPS()
|| common_config('site', 'ssl') === 'always') {
$proto = 'https';
if (is_string(common_config('site', 'sslserver')) &&
$this->endProfile();
}
+ function endActions()
+ {
+ // delete button
+ $cur = common_current_user();
+ list($action, $r2args) = $this->out->returnToArgs();
+ $r2args['action'] = $action;
+ if ($cur instanceof User && $cur->hasRight(Right::DELETEGROUP)) {
+ $this->out->elementStart('li', 'entity_delete');
+ $df = new DeleteGroupForm($this->out, $this->profile, $r2args);
+ $df->show();
+ $this->out->elementEnd('li');
+ }
+
+ $this->out->elementEnd('ul');
+ $this->out->elementEnd('td');
+ }
+
function showActions()
{
$this->startActions();
}
// An InboxNoticeStream for a certain user, scoped to its own view
- $stream = new InboxNoticeStream($profile, $profile);
+ $stream = new InboxNoticeStream($profile);
$notice = $stream->getNotices(0, self::MAX_NOTICES, $since_id);
$new_top = null;
- if ($notice instanceof ArrayWrapper) {
- $new_top = $notice->_items[0]->id;
+ if ($notice->fetch()) {
+ $new_top = $notice->id;
}
// TRANS: Subject for e-mail.
$out->elementStart('table', array('width' => '550px',
'style' => 'border: none; border-collapse: collapse;', 'cellpadding' => '6'));
- while ($notice->fetch()) {
+ do {
$profile = Profile::getKV('id', $notice->profile_id);
if (empty($profile)) {
$out->text(' ');
$out->raw($notice->rendered);
$out->elementStart('div', array('style' => 'font-size: 0.8em; padding-top: 4px;'));
- $noticeurl = $notice->getUrl();
+ $noticeurl = $notice->getLocalUrl();
// above should always return an URL
assert(!empty($noticeurl));
$out->elementStart('a', array('rel' => 'bookmark',
$out->elementEnd('div');
$out->elementEnd('td');
$out->elementEnd('tr');
- }
+ } while ($notice->fetch());
$out->elementEnd('table');
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/../..'));
+define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
$shortoptions = 'i:n:au';
$longoptions = array('id=', 'nickname=', 'all', 'universe');
.notice .addressees:before {
content: '\003E';
}
-
-.user_in .notice div.e-content {
- max-width: 150px;
-}
* @throws Exception on various error conditions
* @throws OStatusShadowException if this reference would obscure a local user/group
*/
- public static function ensureProfileURL($profile_url, $hints=array())
+ public static function ensureProfileURL($profile_url, array $hints=array())
{
$oprofile = self::getFromProfileURL($profile_url);
* @return Ostatus_profile
* @throws Exception
*/
- public static function ensureFeedURL($feed_url, $hints=array())
+ public static function ensureFeedURL($feed_url, array $hints=array())
{
$discover = new FeedDiscovery();
* @return Ostatus_profile
* @throws Exception
*/
- public static function ensureAtomFeed($feedEl, $hints)
+ public static function ensureAtomFeed(DOMElement $feedEl, array $hints)
{
$author = ActivityUtils::getFeedAuthor($feedEl);
* @return Ostatus_profile
* @throws Exception
*/
- public static function ensureRssChannel($feedEl, $hints)
+ public static function ensureRssChannel(DOMElement $feedEl, array $hints)
{
// Special-case for Posterous. They have some nice metadata in their
// posterous:author elements. We should use them instead of the channel.
* @param array $hints
* @return mixed URL string or false
*/
- public static function getActivityObjectAvatar($object, $hints=array())
+ public static function getActivityObjectAvatar(ActivityObject $object, array $hints=array())
{
if ($object->avatarLinks) {
$best = false;
* @param DOMElement $feed
* @return string
*/
- protected static function getAvatar($actor, $feed)
+ protected static function getAvatar(ActivityObject $actor, DOMElement $feed)
{
$url = '';
$icon = '';
* @return Ostatus_profile
* @throws Exception
*/
- public static function ensureActorProfile($activity, $hints=array())
+ public static function ensureActorProfile(Activity $activity, array $hints=array())
{
return self::ensureActivityObjectProfile($activity->actor, $hints);
}
* @return Ostatus_profile
* @throws Exception
*/
- public static function ensureActivityObjectProfile($object, $hints=array())
+ public static function ensureActivityObjectProfile(ActivityObject $object, array $hints=array())
{
$profile = self::getActivityObjectProfile($object);
if ($profile instanceof Ostatus_profile) {
* @return mixed matching Ostatus_profile or false if none known
* @throws ServerException if feed info invalid
*/
- public static function getActorProfile($activity)
+ public static function getActorProfile(Activity $activity)
{
return self::getActivityObjectProfile($activity->actor);
}
* @return mixed matching Ostatus_profile or false if none known
* @throws ServerException if feed info invalid
*/
- protected static function getActivityObjectProfile($object)
+ protected static function getActivityObjectProfile(ActivityObject $object)
{
$uri = self::getActivityObjectProfileURI($object);
return Ostatus_profile::getKV('uri', $uri);
* @return string
* @throws ServerException if feed info invalid
*/
- protected static function getActivityObjectProfileURI($object)
+ protected static function getActivityObjectProfileURI(ActivityObject $object)
{
if ($object->id) {
if (ActivityUtils::validateUri($object->id)) {
*
* @return Ostatus_profile
*/
- protected static function createActivityObjectProfile($object, $hints=array())
+ protected static function createActivityObjectProfile(ActivityObject $object, array $hints=array())
{
$homeuri = $object->id;
$discover = false;
* @param ActivityObject $object
* @param array $hints
*/
- public function updateFromActivityObject($object, $hints=array())
+ public function updateFromActivityObject(ActivityObject $object, array $hints=array())
{
if ($this->isGroup()) {
$group = $this->localGroup();
}
}
- public static function updateProfile($profile, $object, $hints=array())
+ public static function updateProfile(Profile $profile, ActivityObject $object, array $hints=array())
{
$orig = clone($profile);
}
}
- protected static function updateGroup(User_group $group, $object, $hints=array())
+ protected static function updateGroup(User_group $group, ActivityObject $object, array $hints=array())
{
$orig = clone($group);
}
}
- protected static function updatePeopletag($tag, $object, $hints=array()) {
+ protected static function updatePeopletag($tag, ActivityObject $object, array $hints=array()) {
$orig = clone($tag);
$tag->tag = $object->title;
}
}
- protected static function getActivityObjectHomepage($object, $hints=array())
+ protected static function getActivityObjectHomepage(ActivityObject $object, array $hints=array())
{
$homepage = null;
$poco = $object->poco;
return $homepage;
}
- protected static function getActivityObjectLocation($object, $hints=array())
+ protected static function getActivityObjectLocation(ActivityObject $object, array $hints=array())
{
$location = null;
return $location;
}
- protected static function getActivityObjectBio($object, $hints=array())
+ protected static function getActivityObjectBio(ActivityObject $object, array $hints=array())
{
$bio = null;
return $bio;
}
- public static function getActivityObjectNickname($object, $hints=array())
+ public static function getActivityObjectNickname(ActivityObject $object, array $hints=array())
{
if ($object->poco) {
if (!empty($object->poco->preferredUsername)) {
update-profile-data.php [options] [http://example.com/profile/url]
Rerun profile discovery for the given OStatus remote profile, and save the
-updated profile data (nickname, avatar, bio, etc). Doesn't touch feed state.
+updated profile data (nickname, fullname, avatar, bio, etc).
+Doesn't touch feed state.
Can be used to clean up after breakages.
Options:
} else {
$profile = $oprofile->localProfile();
try {
- foreach (array('nickname', 'bio', 'homepage', 'location') as $field) {
+ foreach (array('nickname', 'fullname', 'bio', 'homepage', 'location') as $field) {
print " $field: {$profile->$field}\n";
}
} catch (NoProfileException $e) {
}
-.form_settings .form_data input {
-width:39%;
-}
.form_settings .form_data input.submit,
.form_settings .form_data input.checkbox,
.form_settings .form_data input.radio {