]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch '0.9.x' of gitorious.org:statusnet/mainline into 0.9.x
authorZach Copley <zach@status.net>
Thu, 21 Oct 2010 00:28:28 +0000 (17:28 -0700)
committerZach Copley <zach@status.net>
Thu, 21 Oct 2010 00:28:28 +0000 (17:28 -0700)
Conflicts:
actions/apioauthauthorize.php
lib/apioauthstore.php

1  2 
actions/apioauthaccesstoken.php
actions/apioauthauthorize.php
lib/apioauthstore.php

Simple merge
Simple merge
index 9a260826334ab3b839b164430441163921c1ece0,76df6c1ed2393133895f3b7b22488cfca44509de..6b9b977560b3fa0d1890d79f687e077604746549
@@@ -37,36 -35,23 +37,38 @@@ class ApiStatusNetOAuthDataStore extend
                  $con = new Consumer();
                  $con->consumer_key    = $consumerKey;
                  $con->consumer_secret = $consumerKey;
 +                $con->created         = common_sql_now();
 +
                  $result = $con->insert();
                  if (!$result) {
-                     $this->serverError(_("Could not create anonymous consumer."));
+                     // TRANS: Server error displayed when trying to create an anynymous OAuth consumer.
+                     $this->serverError(_('Could not create anonymous consumer.'));
                  }
 -                $app               = new OAuth_application();
 -                $app->consumer_key = $con->consumer_key;
 -                $app->name         = 'anonymous';
 -
 -                // XXX: allow the user to set the access type when
 -                // authorizing? Currently we default to r+w for anonymous
 -                // OAuth client applications
 -                $app->access_type  = 3; // read + write
 -                $id = $app->insert();
 -                if (!$id) {
 -                    // TRANS: Server error displayed when trying to create an anynymous OAuth application.
 -                    $this->serverError(_('Could not create anonymous OAuth application.'));
 +
 +                $app = Oauth_application::getByConsumerKey('anonymous');
 +
 +                if (!$app) {
 +
 +                    common_debug("API OAuth - creating anonymous application");
 +                    $app               = new OAuth_application();
 +                    $app->owner        = 1; // XXX: What to do here?
 +                    $app->consumer_key = $con->consumer_key;
 +                    $app->name         = 'anonymous';
 +                    $app->icon         = 'default-avatar-stream.png'; // XXX: Fix this!
 +                    $app->description  = "An anonymous application";
 +                    // XXX: allow the user to set the access type when
 +                    // authorizing? Currently we default to r+w for anonymous
 +                    // OAuth client applications
 +                    $app->access_type  = 3; // read + write
 +                    $app->type         = 2; // desktop
 +                    $app->created      = common_sql_now();
 +
 +                    $id = $app->insert();
 +
 +                    if (!$id) {
++                                              // TRANS: Server error displayed when trying to create an anynymous OAuth application.
 +                        $this->serverError(_("Could not create anonymous OAuth application."));
 +                    }
                  }
              } else {
                  return null;