]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Fixes for posting shortened URLs or uploads
authorBrion Vibber <brion@pobox.com>
Mon, 21 Sep 2009 05:30:10 +0000 (22:30 -0700)
committerBrenda Wallace <shiny@cpan.org>
Mon, 21 Sep 2009 09:34:59 +0000 (21:34 +1200)
* If no shortener plugin is enabled, fall back to using the long URL instead of trying to load nonexistent ur1.ca plugin and throwing 'Class  does not exist'
* Fix bad call to call_user_func_array() in callback_helper() which broke all shortening

lib/util.php

index b74dc619c12d13aafc8b84b948b0b5e90b040948..d9ff8b863b4a1a13782559ab741d3d859203429d 100644 (file)
@@ -493,7 +493,7 @@ function callback_helper($matches, $callback, $notice_id) {
     }while($original_url!=$url);
 
     if(empty($notice_id)){
-        $result = call_user_func_array($callback,$url);
+        $result = call_user_func_array($callback, array($url));
     }else{
         $result = call_user_func_array($callback, array(array($url,$notice_id)) );
     }
@@ -1374,10 +1374,14 @@ function common_shorten_url($long_url)
         $svc = $user->urlshorteningservice;
     }
     global $_shorteners;
-    if(! $_shorteners[$svc]){
+    if (!isset($_shorteners[$svc])) {
         //the user selected service doesn't exist, so default to ur1.ca
         $svc = 'ur1.ca';
     }
+    if (!isset($_shorteners[$svc])) {
+       // no shortener plugins installed.
+       return $long_url;
+    }
 
     $reflectionObj = new ReflectionClass($_shorteners[$svc]['callInfo'][0]);
     $short_url_service = $reflectionObj->newInstanceArgs($_shorteners[$svc]['callInfo'][1]);