summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-04-02 15:56:25 -0700
committerBrion Vibber <brion@pobox.com>2010-04-02 15:56:25 -0700
commit2f4438fe24a99e5493469f734bf41547c8ad2ce5 (patch)
tree71bd93323bb6d39696ea6d13d961d4395be59ee4 /actions
parent01a03e34c8d286011c0f4301e60c103d992a449a (diff)
parente4d934827bd7b2162e870611662549a5df759b57 (diff)
Merge branch '0.9.x' into 1.0.x
Conflicts: actions/imsettings.php lib/jabber.php Made a quick attempt to merge the new JID validation into the XmppPlugin, have not had a chance to test that version live yet. Should also move over the test cases.
Diffstat (limited to 'actions')
-rw-r--r--actions/apigrouplist.php15
-rw-r--r--actions/apigrouplistall.php11
-rw-r--r--actions/foaf.php2
-rw-r--r--actions/newnotice.php55
-rw-r--r--actions/tag.php2
5 files changed, 49 insertions, 36 deletions
diff --git a/actions/apigrouplist.php b/actions/apigrouplist.php
index 98fdb0497..dd2a68c66 100644
--- a/actions/apigrouplist.php
+++ b/actions/apigrouplist.php
@@ -66,7 +66,13 @@ class ApiGroupListAction extends ApiBareAuthAction
{
parent::prepare($args);
- $this->user = $this->getTargetUser($id);
+ $this->user = $this->getTargetUser(null);
+
+ if (empty($this->user)) {
+ $this->clientError(_('No such user.'), 404, $this->format);
+ return false;
+ }
+
$this->groups = $this->getGroups();
return true;
@@ -86,11 +92,6 @@ class ApiGroupListAction extends ApiBareAuthAction
{
parent::handle($args);
- if (empty($this->user)) {
- $this->clientError(_('No such user.'), 404, $this->format);
- return;
- }
-
$sitename = common_config('site', 'name');
$title = sprintf(_("%s's groups"), $this->user->nickname);
$taguribase = TagURI::base();
@@ -100,7 +101,7 @@ class ApiGroupListAction extends ApiBareAuthAction
array('nickname' => $this->user->nickname)
);
$subtitle = sprintf(
- _("Groups %1$s is a member of on %2$s."),
+ _("Groups %1\$s is a member of on %2\$s."),
$this->user->nickname,
$sitename
);
diff --git a/actions/apigrouplistall.php b/actions/apigrouplistall.php
index e1b54a832..f7677970f 100644
--- a/actions/apigrouplistall.php
+++ b/actions/apigrouplistall.php
@@ -66,7 +66,7 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction
{
parent::prepare($args);
- $this->user = $this->getTargetUser($id);
+ $this->user = $this->getTargetUser(null);
$this->groups = $this->getGroups();
return true;
@@ -137,11 +137,18 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction
$qry = 'SELECT user_group.* '.
'from user_group join local_group on user_group.id = local_group.group_id '.
'order by created desc ';
-
+ $offset = intval($this->page - 1) * intval($this->count);
+ $limit = intval($this->count);
+ if (common_config('db', 'type') == 'pgsql') {
+ $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
+ } else {
+ $qry .= ' LIMIT ' . $offset . ', ' . $limit;
+ }
$group = new User_group();
$group->query($qry);
+ $groups = array();
while ($group->fetch()) {
$groups[] = clone($group);
}
diff --git a/actions/foaf.php b/actions/foaf.php
index fc56e19b4..9cb65a885 100644
--- a/actions/foaf.php
+++ b/actions/foaf.php
@@ -126,7 +126,7 @@ class FoafAction extends Action
$this->element('geo:lat', null, $location->lat);
}
if ($location->lon) {
- $this->element('geo:long', null, $location->lat);
+ $this->element('geo:long', null, $location->lon);
}
if ($location->getURL()) {
$this->element('page', array('rdf:resource'=>$location->getURL()));
diff --git a/actions/newnotice.php b/actions/newnotice.php
index 2aa354870..748d104ff 100644
--- a/actions/newnotice.php
+++ b/actions/newnotice.php
@@ -164,43 +164,48 @@ class NewnoticeAction extends Action
$replyto = 'false';
}
- $uploads = array();
- foreach($_FILES as $name => $value) {
- if(substr($name, 0, 6) == "attach") {
- $upload = MediaFile::fromUpload($name);
- if (isset($upload)) {
- $content_shortened .= ' ' . $upload->shortUrl();
- }
- }
- }
- if (Notice::contentTooLong($content_shortened)) {
- foreach($uploads as $upload) {
+ $upload = null;
+ $upload = MediaFile::fromUpload('attach');
+
+ if (isset($upload)) {
+
+ $content_shortened .= ' ' . $upload->shortUrl();
+
+ if (Notice::contentTooLong($content_shortened)) {
$upload->delete();
+ $this->clientError(
+ sprintf(
+ _('Max notice size is %d chars, including attachment URL.'),
+ Notice::maxContent()
+ )
+ );
}
- $this->clientError(
- sprintf(
- _('Max notice size is %d chars, including attachment URL.'),
- Notice::maxContent()
- )
- );
}
$options = array('reply_to' => ($replyto == 'false') ? null : $replyto);
- if ($user->shareLocation() && $this->arg('notice_data-geo')) {
-
- $locOptions = Notice::locationOptions($this->trimmed('lat'),
- $this->trimmed('lon'),
- $this->trimmed('location_id'),
- $this->trimmed('location_ns'),
- $user->getProfile());
+ if ($user->shareLocation()) {
+ // use browser data if checked; otherwise profile data
+ if ($this->arg('notice_data-geo')) {
+ $locOptions = Notice::locationOptions($this->trimmed('lat'),
+ $this->trimmed('lon'),
+ $this->trimmed('location_id'),
+ $this->trimmed('location_ns'),
+ $user->getProfile());
+ } else {
+ $locOptions = Notice::locationOptions(null,
+ null,
+ null,
+ null,
+ $user->getProfile());
+ }
$options = array_merge($options, $locOptions);
}
$notice = Notice::saveNew($user->id, $content_shortened, 'web', $options);
- foreach($uploads as $upload) {
+ if (isset($upload)) {
$upload->attachToNotice($notice);
}
diff --git a/actions/tag.php b/actions/tag.php
index 72668a0c9..512dac63a 100644
--- a/actions/tag.php
+++ b/actions/tag.php
@@ -111,7 +111,7 @@ class TagAction extends Action
$this->pagination($this->page > 1, $cnt > NOTICES_PER_PAGE,
$this->page, 'tag', array('tag' => $this->tag));
- Event::handle('EndTagShowContent', array($this))
+ Event::handle('EndTagShowContent', array($this));
}
}