]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch 'master' into 0.9.x
authorBrion Vibber <brion@pobox.com>
Thu, 20 Jan 2011 23:08:31 +0000 (15:08 -0800)
committerBrion Vibber <brion@pobox.com>
Thu, 20 Jan 2011 23:08:31 +0000 (15:08 -0800)
lib/common.php
plugins/Facebook/FBConnectAuth.php
plugins/OpenID/finishopenidlogin.php
plugins/RegisterThrottle/RegisterThrottlePlugin.php
plugins/TwitterBridge/twitterauthorization.php

index 6138200e49880f2da1688049613ac9d366025df5..94540e3a8520d8c8c7eb6db42928aaa0ba3eefa3 100644 (file)
@@ -63,8 +63,13 @@ if (!function_exists('dl')) {
     // Fortunately trying to call the disabled one will only trigger
     // a warning, not a fatal, so it's safe to leave it for our case.
     // Callers will be suppressing warnings anyway.
-    $disabled = array_filter(array_map('trim', explode(',', ini_get('disable_functions'))));
-    if (!in_array('dl', $disabled)) {
+    try {
+        // Reading the ini setting is hard as we don't know PHP's parsing,
+        // but we can check if it is disabled through reflection.
+        $dl = new ReflectionFunction('dl');
+        // $disabled = $dl->isDisabled(); // don't need to check this now
+    } catch (ReflectionException $e) {
+        // Ok, it *really* doesn't exist!
         function dl($library) {
             return false;
         }
index 84d51578f12198dd32c72f343c543e627227755f..937db56e56f9e35d355175421cdc7bd74080930f 100644 (file)
@@ -232,6 +232,10 @@ class FBConnectauthAction extends Action
 
     function createNewUser()
     {
+        if (!Event::handle('StartRegistrationTry', array($this))) {
+            return;
+        }
+
         if (common_config('site', 'closed')) {
             // TRANS: Client error trying to register with registrations not allowed.
             $this->clientError(_m('Registration not allowed.'));
@@ -297,6 +301,8 @@ class FBConnectauthAction extends Action
         common_debug('Facebook Connect Plugin - ' .
                      "Registered new user $user->id from Facebook user $this->fbuid");
 
+        Event::handle('EndRegistrationTry', array($this));
+
         common_redirect(common_local_url('showstream', array('nickname' => $user->nickname)),
                         303);
     }
index 0053a7f1d29e0b7f40d888992d1bd113158bcb33..8d498d05490b65dec6b746cbaf9a5b941b62557c 100644 (file)
@@ -262,6 +262,10 @@ class FinishopenidloginAction extends Action
     {
         # FIXME: save invite code before redirect, and check here
 
+        if (!Event::handle('StartRegistrationTry', array($this))) {
+            return;
+        }
+
         if (common_config('site', 'closed')) {
             // TRANS: OpenID plugin message. No new user registration is allowed on the site.
             $this->clientError(_m('Registration not allowed.'));
@@ -374,6 +378,9 @@ class FinishopenidloginAction extends Action
             common_rememberme($user);
         }
         unset($_SESSION['openid_rememberme']);
+
+        Event::handle('EndRegistrationTry', array($this));
+
         common_redirect(common_local_url('showstream', array('nickname' => $user->nickname)),
                         303);
     }
index 0078d3c6004ad7130d7ccf509dded28d7e62b7e0..e3982427da5053b5400aa7bce0e38a8095339a78 100644 (file)
@@ -167,28 +167,24 @@ class RegisterThrottlePlugin extends Plugin
     }
 
     /**
-     * Called after someone registers.
+     * Called after someone registers, by any means.
      *
      * We record the successful registration and IP address.
      *
-     * @param Action $action Action that is being executed
+     * @param Profile $profile new user's profile
+     * @param User $user new user
      *
      * @return boolean hook value
      *
      */
 
-    function onEndRegistrationTry($action)
+    function onEndUserRegister($profile, $user)
     {
         $ipaddress = $this->_getIpAddress();
 
         if (empty($ipaddress)) {
-            throw new ServerException(_m('Cannot find IP address.'));
-        }
-
-        $user = common_current_user();
-
-        if (empty($user)) {
-            throw new ServerException(_m('Cannot find user after successful registration.'));
+            // User registration can happen from command-line scripts etc.
+            return true;
         }
 
         $reg = new Registration_ip();
index bbe41bd438f181303c033bc59181958300d5f182..28b40cc4f47b3ab56f1921f6f8605de20d1df38f 100644 (file)
@@ -419,6 +419,10 @@ class TwitterauthorizationAction extends Action
 
     function createNewUser()
     {
+        if (!Event::handle('StartRegistrationTry', array($this))) {
+            return;
+        }
+
         if (common_config('site', 'closed')) {
             $this->clientError(_m('Registration not allowed.'));
             return;
@@ -490,6 +494,8 @@ class TwitterauthorizationAction extends Action
         common_debug('TwitterBridge Plugin - ' .
                      "Registered new user $user->id from Twitter user $this->twuid");
 
+        Event::handle('EndRegistrationTry', array($this));
+
         common_redirect(common_local_url('showstream', array('nickname' => $user->nickname)),
                         303);
     }