summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
authorCraig Andrews <candrews@integralblue.com>2009-11-18 17:04:42 -0500
committerCraig Andrews <candrews@integralblue.com>2009-11-18 17:04:42 -0500
commitcac5a417f2a81b974781d4dbc40fd9d718a7a7f2 (patch)
treeac4798b1acd4abbe1674af08af99460374bda537 /actions
parenta00141a180d54cbcc244e0157c72f53ac53779b3 (diff)
parent199ccdb53fbd732eeced3edf734e39687729da9b (diff)
Merge branch '0.9.x' of gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'actions')
-rw-r--r--actions/apigroupcreate.php62
-rw-r--r--actions/apistatusesupdate.php2
-rw-r--r--actions/newgroup.php46
3 files changed, 15 insertions, 95 deletions
diff --git a/actions/apigroupcreate.php b/actions/apigroupcreate.php
index 895dfb7ab..8827d1c5c 100644
--- a/actions/apigroupcreate.php
+++ b/actions/apigroupcreate.php
@@ -117,61 +117,13 @@ class ApiGroupCreateAction extends ApiAuthAction
return;
}
- $group = new User_group();
-
- $group->query('BEGIN');
-
- $group->nickname = $this->nickname;
- $group->fullname = $this->fullname;
- $group->homepage = $this->homepage;
- $group->description = $this->description;
- $group->location = $this->location;
- $group->created = common_sql_now();
-
- $result = $group->insert();
-
- if (!$result) {
- common_log_db_error($group, 'INSERT', __FILE__);
- $this->serverError(
- _('Could not create group.'),
- 500,
- $this->format
- );
- return;
- }
-
- $result = $group->setAliases($this->aliases);
-
- if (!$result) {
- $this->serverError(
- _('Could not create aliases.'),
- 500,
- $this->format
- );
- return;
- }
-
- $member = new Group_member();
-
- $member->group_id = $group->id;
- $member->profile_id = $this->user->id;
- $member->is_admin = 1;
- $member->created = $group->created;
-
- $result = $member->insert();
-
- if (!$result) {
- common_log_db_error($member, 'INSERT', __FILE__);
- $this->serverError(
- _('Could not set group membership.'),
- 500,
- $this->format
- );
- return;
- }
-
- $group->query('COMMIT');
-
+ $group = User_group::register(array('nickname' => $this->nickname,
+ 'fullname' => $this->fullname,
+ 'homepage' => $this->homepage,
+ 'description' => $this->description,
+ 'location' => $this->location,
+ 'aliases' => $this->aliases,
+ 'userid' => $this->user->id));
switch($this->format) {
case 'xml':
$this->showSingleXmlGroup($group);
diff --git a/actions/apistatusesupdate.php b/actions/apistatusesupdate.php
index 7ddf7703b..85a7c8c08 100644
--- a/actions/apistatusesupdate.php
+++ b/actions/apistatusesupdate.php
@@ -85,7 +85,7 @@ class ApiStatusesUpdateAction extends ApiAuthAction
$this->lat = $this->trimmed('lat');
$this->lon = $this->trimmed('long');
- if (empty($this->source) || in_array($source, self::$reserved_sources)) {
+ if (empty($this->source) || in_array($this->source, self::$reserved_sources)) {
$this->source = 'api';
}
diff --git a/actions/newgroup.php b/actions/newgroup.php
index 80da9861a..25da7f8fc 100644
--- a/actions/newgroup.php
+++ b/actions/newgroup.php
@@ -186,45 +186,13 @@ class NewgroupAction extends Action
assert(!is_null($cur));
- $group = new User_group();
-
- $group->query('BEGIN');
-
- $group->nickname = $nickname;
- $group->fullname = $fullname;
- $group->homepage = $homepage;
- $group->description = $description;
- $group->location = $location;
- $group->created = common_sql_now();
-
- $result = $group->insert();
-
- if (!$result) {
- common_log_db_error($group, 'INSERT', __FILE__);
- $this->serverError(_('Could not create group.'));
- }
-
- $result = $group->setAliases($aliases);
-
- if (!$result) {
- $this->serverError(_('Could not create aliases.'));
- }
-
- $member = new Group_member();
-
- $member->group_id = $group->id;
- $member->profile_id = $cur->id;
- $member->is_admin = 1;
- $member->created = $group->created;
-
- $result = $member->insert();
-
- if (!$result) {
- common_log_db_error($member, 'INSERT', __FILE__);
- $this->serverError(_('Could not set group membership.'));
- }
-
- $group->query('COMMIT');
+ $group = User_group::register(array('nickname' => $nickname,
+ 'fullname' => $fullname,
+ 'homepage' => $homepage,
+ 'description' => $description,
+ 'location' => $location,
+ 'aliases' => $aliases,
+ 'userid' => $cur->id));
common_redirect($group->homeUrl(), 303);
}