]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/apignusocialoauthdatastore.php
No more needed (for this fix) but maybe later. So I always only comment them out.
[quix0rs-gnu-social.git] / lib / apignusocialoauthdatastore.php
index 5a0c2a8243ddefa15bc65031d17c4ce829b3070a..da412df8d298bfe9a55a946a37b4df71c7a79ecc 100644 (file)
@@ -24,13 +24,13 @@ require_once 'OAuth.php';
 /**
  * @fixme class doc
  */
-class ApiGNUSocialOAuthDataStore extends OAuthDataStore
+class ApiGNUsocialOAuthDataStore extends OAuthDataStore
 {
     function lookup_consumer($consumerKey)
     {
         $con = Consumer::getKV('consumer_key', $consumerKey);
 
-        if (!$con) {
+        if (!$con instanceof Consumer) {
 
             // Create an anon consumer and anon application if one
             // doesn't exist already
@@ -264,8 +264,8 @@ class ApiGNUSocialOAuthDataStore extends OAuthDataStore
         $at = new Token();
 
         $at->consumer_key      = $consumer->key;
-        $at->tok               = common_good_rand(16);
-        $at->secret            = common_good_rand(16);
+        $at->tok               = common_random_hexstr(16);
+        $at->secret            = common_random_hexstr(16);
         $at->type              = 1; // access
         $at->verifier          = $verifier;
         $at->verified_callback = $rt->verified_callback; // 1.0a
@@ -392,8 +392,8 @@ class ApiGNUSocialOAuthDataStore extends OAuthDataStore
     {
         $t = new Token();
         $t->consumer_key = $consumer->key;
-        $t->tok = common_good_rand(16);
-        $t->secret = common_good_rand(16);
+        $t->tok = common_random_hexstr(16);
+        $t->secret = common_random_hexstr(16);
         $t->type = 0; // request
         $t->state = 0; // unauthorized
         $t->verified_callback = $callback;
@@ -402,7 +402,7 @@ class ApiGNUSocialOAuthDataStore extends OAuthDataStore
             // six digit pin
             $t->verifier = mt_rand(0, 9999999);
         } else {
-            $t->verifier = common_good_rand(8);
+            $t->verifier = common_random_hexstr(8);
         }
 
         $t->created = common_sql_now();
@@ -460,7 +460,7 @@ class ApiGNUSocialOAuthDataStore extends OAuthDataStore
         if ($n->find(true)) {
             return true;
         } else {
-            $n->created = DB_DataObject_Cast::dateTime();
+            $n->created = common_sql_now();
             $n->insert();
             return false;
         }