[Mapbender-commits] r8705 - trunk/mapbender/http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Sep 25 04:13:12 PDT 2013


Author: armin11
Date: 2013-09-25 04:13:10 -0700 (Wed, 25 Sep 2013)
New Revision: 8705

Modified:
   trunk/mapbender/http/classes/class_twitter.php
Log:
Bugfix for using twitter api without proxy.

Modified: trunk/mapbender/http/classes/class_twitter.php
===================================================================
--- trunk/mapbender/http/classes/class_twitter.php	2013-09-23 15:52:01 UTC (rev 8704)
+++ trunk/mapbender/http/classes/class_twitter.php	2013-09-25 11:13:10 UTC (rev 8705)
@@ -17,18 +17,27 @@
      */
 	function postTweet($tweetText) {
 			if (TWITTER_CONSUMER_KEY != '' && TWITTER_CONSUMER_SECRET != '' && TWITTER_ACCESS_TOKEN != '' && TWITTER_ACCESS_TOKEN_SECRET != '') {
-			  $connection = new tmhOAuth(array(
-    				'consumer_key' => TWITTER_CONSUMER_KEY,
-    				'consumer_secret' => TWITTER_CONSUMER_SECRET,
-    				'user_token' => TWITTER_ACCESS_TOKEN,
-    				'user_secret' => TWITTER_ACCESS_TOKEN_SECRET,
-        			'curl_proxy'  => CONNECTION_PROXY.":".CONNECTION_PORT
-  				)); 
+			  if (defined('CONNECTION_PROXY') && CONNECTION_PROXY != '') {
+			  	$connection = new tmhOAuth(array(
+    					'consumer_key' => TWITTER_CONSUMER_KEY,
+    					'consumer_secret' => TWITTER_CONSUMER_SECRET,
+    					'user_token' => TWITTER_ACCESS_TOKEN,
+    					'user_secret' => TWITTER_ACCESS_TOKEN_SECRET,
+        				'curl_proxy'  => CONNECTION_PROXY.":".CONNECTION_PORT
+  					)); 
+			} else {
+				$connection = new tmhOAuth(array(
+    					'consumer_key' => TWITTER_CONSUMER_KEY,
+    					'consumer_secret' => TWITTER_CONSUMER_SECRET,
+    					'user_token' => TWITTER_ACCESS_TOKEN,
+    					'user_secret' => TWITTER_ACCESS_TOKEN_SECRET
+  					)); 
+			}
 				$connection->request('POST', 
     					$connection->url('1.1/statuses/update'), 
     					array('status' => $tweetText)
 				);
-				$e = new mb_notice("class_twitter.php: ".$connection->response['error']);
+				$e = new mb_exception("class_twitter.php: ".$connection->response['error']);
   				return $connection->response['code'];
 			} else {
 				return false;



More information about the Mapbender_commits mailing list