Просмотр исходного кода

Merge branch 'master' of https://github.com/unaio/una

RomanL 5 лет назад
Родитель
Сommit
22755b37d3

+ 14 - 8
modules/boonex/facebook_connect/classes/BxFaceBookConnectModule.php

@@ -36,14 +36,20 @@ class BxFaceBookConnectModule extends BxBaseModConnectModule
         // Create our Application instance.
         $this -> oFacebook = null;
 
-        if ($this -> _oConfig -> mApiID) {
+        if ($this -> _oConfig -> mApiID && $this -> _oConfig -> mApiSecret) {
             if (!isset($_SESSION))
                 session_start();
-            $this -> oFacebook = new Facebook\Facebook(array(
-                'app_id'  => $this -> _oConfig -> mApiID,
-                'app_secret' => $this -> _oConfig -> mApiSecret,
-                'default_graph_version' => 'v2.4',  
-            ));
+
+            try {
+                $this -> oFacebook = new Facebook\Facebook(array(
+                    'app_id'  => $this -> _oConfig -> mApiID,
+                    'app_secret' => $this -> _oConfig -> mApiSecret,
+                    'default_graph_version' => 'v2.4',  
+                ));
+            }
+            catch (Exception $e) {
+                $this->_setLastError($e->getMessage());
+            }
         }
     }
 
@@ -153,9 +159,9 @@ class BxFaceBookConnectModule extends BxBaseModConnectModule
         $this -> _oTemplate -> dislayPageError();
     }
 
-    function serviceLastError()
+    function serviceLastError($bShowEmpty = true)
     {
-        return MsgBox($this->sLastError ? $this->sLastError : _t('_Empty'));
+        return $this->sLastError ? MsgBox($this->sLastError) : ($bShowEmpty ? MsgBox(_t('_Empty')): '');
     }
 
     /**

+ 7 - 0
modules/boonex/facebook_connect/classes/BxFaceBookConnectStudioPage.php

@@ -21,6 +21,13 @@ class BxFaceBookConnectStudioPage extends BxTemplStudioModule
         );
     }
     
+    function getSettings ()
+    {
+        $s = parent::getSettings ();
+        $oModule = BxDolModule::getInstance('bx_facebook');         
+        return $oModule->serviceLastError(false) . $s;
+    }
+
     function getHelp ()
     {
         $oModule = BxDolModule::getInstance('bx_facebook');