[Mapbender-commits] r5555 - trunk/mapbender/http/plugins

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Sat Feb 20 08:18:16 EST 2010


Author: christoph
Date: 2010-02-20 08:18:16 -0500 (Sat, 20 Feb 2010)
New Revision: 5555

Modified:
   trunk/mapbender/http/plugins/mb_twitter.php
Log:


Modified: trunk/mapbender/http/plugins/mb_twitter.php
===================================================================
--- trunk/mapbender/http/plugins/mb_twitter.php	2010-02-20 13:17:51 UTC (rev 5554)
+++ trunk/mapbender/http/plugins/mb_twitter.php	2010-02-20 13:18:16 UTC (rev 5555)
@@ -17,9 +17,16 @@
 
 $ajaxResponse = new AjaxResponse($_POST);
 
+if (!isset($consumerKey) || !isset($consumerSecret)) {
+	$ajaxResponse->setSuccess(false);
+	$ajaxResponse->setMessage(_mb("Element vars consumerKey and consumerSecret are not set. If you don't have them, get them from Twitter."));
+	$ajaxResponse->send();
+}
+
+$Twitter = new EpiTwitter($consumerKey, $consumerSecret);
+		
 switch ($ajaxResponse->getMethod()) {
 	case "isSignedIn" :
-//		echo Mapbender::session()->get("oauth_token");die;
 		$token = $ajaxResponse->getParameter("token");
 		if (!is_null($token)) {
 			$ajaxResponse->setSuccess(true);
@@ -34,14 +41,20 @@
 		break;
 
 	case "signin" :
-	
-		if (!isset($consumerKey) || !isset($consumerSecret)) {
+		try {
+			$url = $Twitter->getAuthenticateUrl();
+		}
+		catch (Exception $e) {
 			$ajaxResponse->setSuccess(false);
-			$ajaxResponse->setMessage(_mb("Element vars consumerKey and consumerSecret are not set. If you don't have them, get them from Twitter."));
+			$ajaxResponse->setMessage(_mb("Could not connect to Twitter."));
 			$ajaxResponse->send();
 		}
 
-		$Twitter = new EpiTwitter($consumerKey, $consumerSecret);
+		$ajaxResponse->setResult(array("url" => $url)); 
+		$ajaxResponse->setSuccess(true);
+		break;
+
+	case "signout" :
 		try {
 			$url = $Twitter->getAuthenticateUrl();
 		}



More information about the Mapbender_commits mailing list