Browse Source

Merge branch '1.11.x' of https://github.com/chamilo/chamilo-lms into 1.11.x

Alex Aragon 8 years ago
parent
commit
935f9ad4c3
66 changed files with 738 additions and 5061 deletions
  1. 1 1
      app/config/mail.conf.dist.php
  2. 2 1
      composer.json
  3. 0 5
      index.php
  4. 65 0
      main/admin/email_tester.php
  5. 35 24
      main/admin/index.php
  6. 23 0
      main/admin/skill_list.php
  7. 0 70
      main/auth/external_login/facebook-php-sdk/autoload.php
  8. 0 381
      main/auth/external_login/facebook-php-sdk/src/Facebook/Entities/AccessToken.php
  9. 0 386
      main/auth/external_login/facebook-php-sdk/src/Facebook/Entities/SignedRequest.php
  10. 0 33
      main/auth/external_login/facebook-php-sdk/src/Facebook/FacebookAuthorizationException.php
  11. 0 60
      main/auth/external_login/facebook-php-sdk/src/Facebook/FacebookCanvasLoginHelper.php
  12. 0 33
      main/auth/external_login/facebook-php-sdk/src/Facebook/FacebookClientException.php
  13. 0 45
      main/auth/external_login/facebook-php-sdk/src/Facebook/FacebookJavaScriptLoginHelper.php
  14. 0 33
      main/auth/external_login/facebook-php-sdk/src/Facebook/FacebookOtherException.php
  15. 0 102
      main/auth/external_login/facebook-php-sdk/src/Facebook/FacebookPageTabHelper.php
  16. 0 33
      main/auth/external_login/facebook-php-sdk/src/Facebook/FacebookPermissionException.php
  17. 0 324
      main/auth/external_login/facebook-php-sdk/src/Facebook/FacebookRedirectLoginHelper.php
  18. 0 313
      main/auth/external_login/facebook-php-sdk/src/Facebook/FacebookRequest.php
  19. 0 222
      main/auth/external_login/facebook-php-sdk/src/Facebook/FacebookRequestException.php
  20. 0 206
      main/auth/external_login/facebook-php-sdk/src/Facebook/FacebookResponse.php
  21. 0 33
      main/auth/external_login/facebook-php-sdk/src/Facebook/FacebookSDKException.php
  22. 0 33
      main/auth/external_login/facebook-php-sdk/src/Facebook/FacebookServerException.php
  23. 0 367
      main/auth/external_login/facebook-php-sdk/src/Facebook/FacebookSession.php
  24. 0 166
      main/auth/external_login/facebook-php-sdk/src/Facebook/FacebookSignedRequestFromInputHelper.php
  25. 0 33
      main/auth/external_login/facebook-php-sdk/src/Facebook/FacebookThrottleException.php
  26. 0 173
      main/auth/external_login/facebook-php-sdk/src/Facebook/GraphAlbum.php
  27. 0 105
      main/auth/external_login/facebook-php-sdk/src/Facebook/GraphLocation.php
  28. 0 171
      main/auth/external_login/facebook-php-sdk/src/Facebook/GraphObject.php
  29. 0 64
      main/auth/external_login/facebook-php-sdk/src/Facebook/GraphPage.php
  30. 0 115
      main/auth/external_login/facebook-php-sdk/src/Facebook/GraphSessionInfo.php
  31. 0 135
      main/auth/external_login/facebook-php-sdk/src/Facebook/GraphUser.php
  32. 0 84
      main/auth/external_login/facebook-php-sdk/src/Facebook/GraphUserPage.php
  33. 0 129
      main/auth/external_login/facebook-php-sdk/src/Facebook/HttpClients/FacebookCurl.php
  34. 0 329
      main/auth/external_login/facebook-php-sdk/src/Facebook/HttpClients/FacebookCurlHttpClient.php
  35. 0 133
      main/auth/external_login/facebook-php-sdk/src/Facebook/HttpClients/FacebookGuzzleHttpClient.php
  36. 0 68
      main/auth/external_login/facebook-php-sdk/src/Facebook/HttpClients/FacebookHttpable.php
  37. 0 79
      main/auth/external_login/facebook-php-sdk/src/Facebook/HttpClients/FacebookStream.php
  38. 0 190
      main/auth/external_login/facebook-php-sdk/src/Facebook/HttpClients/FacebookStreamHttpClient.php
  39. 0 23
      main/auth/external_login/facebook-php-sdk/src/Facebook/HttpClients/certs/DigiCertHighAssuranceEVRootCA.pem
  40. 142 77
      main/auth/external_login/facebook.inc.php
  41. 8 12
      main/badge/assign.php
  42. 0 1
      main/badge/issued.php
  43. 6 6
      main/badge/issued_all.php
  44. 7 4
      main/exercise/export/scorm/scorm_classes.php
  45. 2 2
      main/exercise/tests_category.php
  46. 1 1
      main/inc/lib/diagnoser.lib.php
  47. 31 0
      main/inc/lib/extra_field.lib.php
  48. 231 165
      main/inc/lib/message.lib.php
  49. 1 1
      main/inc/lib/sessionmanager.lib.php
  50. 1 1
      main/inc/lib/usermanager.lib.php
  51. 2 2
      main/inc/lib/userportal.lib.php
  52. 1 1
      main/install/configuration.dist.php
  53. 4 0
      main/mySpace/session.php
  54. 1 7
      main/mySpace/works_in_session_report.php
  55. 7 8
      main/session/add_many_session_to_category.php
  56. 0 1
      main/session/add_students_to_session.php
  57. 5 2
      main/session/add_users_to_session.php
  58. 16 15
      main/session/session_add.php
  59. 1 2
      main/session/session_export.php
  60. 19 0
      main/template/default/admin/email_tester.tpl
  61. 15 0
      main/template/default/layout/page_footer.tpl
  62. 24 1
      main/template/default/skill/list.tpl
  63. 58 28
      plugin/bbb/lib/bbb.lib.php
  64. 15 3
      plugin/bbb/listing.php
  65. 14 11
      plugin/share_buttons/index.php
  66. 0 8
      user_portal.php

+ 1 - 1
app/config/mail.conf.dist.php

@@ -10,7 +10,7 @@ $platform_email['SMTP_FROM_EMAIL'] = (isset($administrator['email']) ? $administ
 $platform_email['SMTP_FROM_NAME'] = (isset($administrator['name']) ? $administrator['name'] : 'Admin');
 $platform_email['SMTP_HOST'] = 'localhost';
 $platform_email['SMTP_PORT'] = 25;
-$platform_email['SMTP_MAILER'] = IS_WINDOWS_OS ? 'smtp' : 'mail'; // mail, sendmail or smtp
+$platform_email['SMTP_MAILER'] = 'sendmail'; // mail, sendmail or smtp
 $platform_email['SMTP_AUTH'] = 0;
 $platform_email['SMTP_USER'] = '';
 $platform_email['SMTP_PASS'] = '';

+ 2 - 1
composer.json

@@ -146,7 +146,8 @@
         "lunetics/locale-bundle": "^2.4",
         "theodo-evolution/session-bundle": "1.0.*",
         "jimmiw/php-time-ago": "^0.4.11",
-        "phpoffice/phpword": "^0.12.1"
+        "phpoffice/phpword": "^0.12.1",
+        "facebook/php-sdk-v4" : "~5.0"
     },
     "require-dev": {
         "behat/behat": "@stable",

+ 0 - 5
index.php

@@ -24,11 +24,6 @@ if (!api_is_anonymous()) {
     $header_title = " ";
 }
 
-// Facebook connexion, if activated
-/*if (api_is_facebook_auth_activated() && !api_get_user_id()) {
-    facebookConnect();
-}
-*/
 $controller = new IndexManager($header_title);
 
 //Actions

+ 65 - 0
main/admin/email_tester.php

@@ -0,0 +1,65 @@
+<?php
+/* For licensing terms, see /license.txt */
+/**
+ * Index page of the admin tools
+ * @package chamilo.admin
+ */
+// Resetting the course id.
+$cidReset = true;
+
+// Including some necessary chamilo files.
+require_once '../inc/global.inc.php';
+
+api_protect_admin_script();
+
+// Setting the section (for the tabs).
+$this_section = SECTION_PLATFORM_ADMIN;
+$toolName = get_lang('EMailTester');
+
+$form = new FormValidator('email_tester');
+$form->addText('smtp_host', get_lang('Host'), false, ['cols-size' => [3, 8, 1]]);
+$form->addText('smtp_port', get_lang('Port'), false, ['cols-size' => [3, 8, 1]]);
+$form->addText('destination', get_lang('Destination'), true, ['cols-size' => [3, 8, 1]]);
+$form->addText('subject', get_lang('Subject'), true, ['cols-size' => [3, 8, 1]]);
+$form->addHtmlEditor('content', get_lang('Message'), true, false, ['ToolbarSet' => 'Minimal', 'cols-size' => [3, 8, 1]]);
+$form->addButtonSend(get_lang('SendMessage'), 'submit', false, ['cols-size' => [3, 8, 1]]);
+$form->setDefaults([
+    'smtp_host' => $platform_email['SMTP_HOST'],
+    'smtp_port' => $platform_email['SMTP_PORT']
+]);
+$form->freeze(['smtp_host', 'smtp_port']);
+
+$errorsInfo = MessageManager::failedSentMailErrors();
+
+if ($form->validate()) {
+    $values = $form->exportValues();
+
+    $user = api_get_user_entity(api_get_user_id());
+
+    $mailIsSent = api_mail_html(
+        get_lang('UserTestingEMailConf'),
+        $values['destination'],
+        $values['subject'],
+        $values['content'],
+        $user->getCompleteName(),
+        $user->getEmail()
+    );
+
+    Display::addFlash(
+        Display::return_message(get_lang('MailingTestSent'), 'warning')
+    );
+
+    header('Location: ' . api_get_self());
+    exit;
+}
+
+$view = new Template($toolName);
+$view->assign('form', $form->returnForm());
+$view->assign('errors', $errorsInfo);
+
+$template = $view->get_template('admin/email_tester.tpl');
+$content = $view->fetch($template);
+
+$view->assign('header', $toolName);
+$view->assign('content', $content);
+$view->display_one_col_template();

+ 35 - 24
main/admin/index.php

@@ -350,11 +350,9 @@ if (api_is_platform_admin()) {
 
     $items[] = array('url' => 'archive_cleanup.php', 'label' => get_lang('ArchiveDirCleanup'));
     $items[] = array('url' => 'resource_sequence.php', 'label' => get_lang('ResourcesSequencing'));
+    $items[] = ['url' => 'email_tester.php', 'label' => get_lang('EMailTester')];
 
-    if (isset($_configuration['db_manager_enabled']) &&
-        $_configuration['db_manager_enabled'] == true &&
-        api_is_global_platform_admin()
-    ) {
+    if (api_get_configuration_value('db_manager_enabled') == true && api_is_global_platform_admin()) {
         $host = $_configuration['db_host'];
         $username = $_configuration['db_user'];
         $databaseName = $_configuration['main_database'];
@@ -405,29 +403,42 @@ if (api_is_platform_admin()) {
     /* Plugins */
     global $_plugins;
     if (isset($_plugins['menu_administrator']) && count($_plugins['menu_administrator']) > 0) {
-        $blocks['plugins']['icon'] = Display::return_icon(
-            'plugins.png',
-             get_lang('Plugins'),
-             array(),
-             ICON_SIZE_MEDIUM,
-             false
-        );
-        $blocks['plugins']['label'] = api_ucfirst(get_lang('Plugins'));
-        $blocks['plugins']['class'] = 'block-admin-platform';
-        $blocks['plugins']['editable'] = true;
+        $menuAdministratorItems = [];
 
-        $plugin_obj = new AppPlugin();
-        $items = array();
-        foreach ($_plugins['menu_administrator'] as $plugin_name) {
-            $plugin_info = $plugin_obj->getPluginInfo($plugin_name);
-            $items[] = array(
-                'url' => api_get_path(WEB_CODE_PATH) . '../plugin/'.$plugin_name.'/start.php',
-                'label' => $plugin_info['title']
-            );
+        foreach ($_plugins['menu_administrator'] as $pluginName) {
+            if (!file_exists(api_get_path(SYS_PLUGIN_PATH) . $pluginName . '/start.php')) {
+                continue;
+            }
+
+            $menuAdministratorItems[] = $pluginName;
         }
 
-        $blocks['plugins']['items'] = $items;
-        $blocks['plugins']['extra'] = null;
+        if ($menuAdministratorItems) {
+            $blocks['plugins']['icon'] = Display::return_icon(
+                'plugins.png',
+                get_lang('Plugins'),
+                array(),
+                ICON_SIZE_MEDIUM,
+                false
+            );
+            $blocks['plugins']['label'] = api_ucfirst(get_lang('Plugins'));
+            $blocks['plugins']['class'] = 'block-admin-platform';
+            $blocks['plugins']['editable'] = true;
+
+            $plugin_obj = new AppPlugin();
+            $items = array();
+
+            foreach ($menuAdministratorItems as $plugin_name) {
+                $plugin_info = $plugin_obj->getPluginInfo($plugin_name);
+                $items[] = array(
+                    'url' => api_get_path(WEB_PLUGIN_PATH) . $plugin_name . '/start.php',
+                    'label' => $plugin_info['title']
+                );
+            }
+
+            $blocks['plugins']['items'] = $items;
+            $blocks['plugins']['extra'] = null;
+        }
     }
 
     /* Chamilo.org */

+ 23 - 0
main/admin/skill_list.php

@@ -140,13 +140,36 @@ switch ($action) {
             ['title' => get_lang('BadgesManagement')]
         );
 
+        $extraField = new ExtraField('skill');
+        $arrayVals = $extraField->get_handler_field_info_by_tags('tags');
+        $tags = [];
+        foreach ($arrayVals['options'] as $value) {
+            $tags[] = $value;
+        }
+
         /* View */
         $skill = new Skill();
         $skillList = $skill->get_all();
 
+        $extraFieldSearchTagId = isset($_REQUEST['tag_id']) ? $_REQUEST['tag_id'] : 0;
+
+        if ($extraFieldSearchTagId) {
+            $skills = [];
+
+            $skillsFiltered = $extraField->getAllSkillPerTag($arrayVals['id'], $extraFieldSearchTagId);
+            foreach ($skillList as $index => $value) {
+                if (array_search($index, $skillsFiltered)) {
+                    $skills[$index] = $value;
+                }
+            }
+            $skillList = $skills;
+        }
+
         $tpl = new Template(get_lang('ManageSkills'));
         $tpl->assign('message', $message);
         $tpl->assign('skills', $skillList);
+        $tpl->assign('current_tag_id', $extraFieldSearchTagId);
+        $tpl->assign('tags', $tags);
 
         $content = $tpl->fetch('default/skill/list.tpl');
 

+ 0 - 70
main/auth/external_login/facebook-php-sdk/autoload.php

@@ -1,70 +0,0 @@
-<?php
-/**
- * Copyright 2014 Facebook, Inc.
- *
- * You are hereby granted a non-exclusive, worldwide, royalty-free license to
- * use, copy, modify, and distribute this software in source code or binary
- * form for use in connection with the web services and APIs provided by
- * Facebook.
- *
- * As with any software that integrates with the Facebook platform, your use
- * of this software is subject to the Facebook Developer Principles and
- * Policies [http://developers.facebook.com/policy/]. This copyright notice
- * shall be included in all copies or substantial portions of the software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-
-/**
- * You only need this file if you are not using composer.
- * Why are you not using composer?
- * https://getcomposer.org/
- */
-
-if (version_compare(PHP_VERSION, '5.4.0', '<')) {
-  throw new Exception('The Facebook SDK v4 requires PHP version 5.4 or higher.');
-}
-
-/**
- * Register the autoloader for the Facebook SDK classes.
- * Based off the official PSR-4 autoloader example found here:
- * https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader-examples.md
- *
- * @param string $class The fully-qualified class name.
- * @return void
- */
-spl_autoload_register(function ($class)
-{
-  // project-specific namespace prefix
-  $prefix = 'Facebook\\';
-
-  // base directory for the namespace prefix
-  $base_dir = defined('FACEBOOK_SDK_V4_SRC_DIR') ? FACEBOOK_SDK_V4_SRC_DIR : __DIR__ . '/src/Facebook/';
-
-  // does the class use the namespace prefix?
-  $len = strlen($prefix);
-  if (strncmp($prefix, $class, $len) !== 0) {
-    // no, move to the next registered autoloader
-    return;
-  }
-
-  // get the relative class name
-  $relative_class = substr($class, $len);
-
-  // replace the namespace prefix with the base directory, replace namespace
-  // separators with directory separators in the relative class name, append
-  // with .php
-  $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php';
-
-  // if the file exists, require it
-  if (file_exists($file)) {
-    require $file;
-  }
-});

+ 0 - 381
main/auth/external_login/facebook-php-sdk/src/Facebook/Entities/AccessToken.php

@@ -1,381 +0,0 @@
-<?php
-/**
- * Copyright 2014 Facebook, Inc.
- *
- * You are hereby granted a non-exclusive, worldwide, royalty-free license to
- * use, copy, modify, and distribute this software in source code or binary
- * form for use in connection with the web services and APIs provided by
- * Facebook.
- *
- * As with any software that integrates with the Facebook platform, your use
- * of this software is subject to the Facebook Developer Principles and
- * Policies [http://developers.facebook.com/policy/]. This copyright notice
- * shall be included in all copies or substantial portions of the software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-namespace Facebook\Entities;
-
-use Facebook\FacebookRequest;
-use Facebook\FacebookRequestException;
-use Facebook\FacebookSession;
-use Facebook\GraphSessionInfo;
-
-/**
- * Class AccessToken
- * @package Facebook
- */
-class AccessToken
-{
-
-  /**
-   * The access token.
-   *
-   * @var string
-   */
-  protected $accessToken;
-
-  /**
-   * A unique ID to identify a client.
-   *
-   * @var string
-   */
-  protected $machineId;
-
-  /**
-   * Date when token expires.
-   *
-   * @var \DateTime|null
-   */
-  protected $expiresAt;
-
-  /**
-   * Create a new access token entity.
-   *
-   * @param string $accessToken
-   * @param int $expiresAt
-   * @param string|null machineId
-   * @param string $machineId
-   */
-  public function __construct($accessToken, $expiresAt = 0, $machineId = null)
-  {
-    $this->accessToken = $accessToken;
-    if ($expiresAt) {
-      $this->setExpiresAtFromTimeStamp($expiresAt);
-    }
-    $this->machineId = $machineId;
-  }
-
-  /**
-   * Setter for expires_at.
-   *
-   * @param int $timeStamp
-   */
-  protected function setExpiresAtFromTimeStamp($timeStamp)
-  {
-    $dt = new \DateTime();
-    $dt->setTimestamp($timeStamp);
-    $this->expiresAt = $dt;
-  }
-
-  /**
-   * Getter for expiresAt.
-   *
-   * @return \DateTime|null
-   */
-  public function getExpiresAt()
-  {
-    return $this->expiresAt;
-  }
-
-  /**
-   * Getter for machineId.
-   *
-   * @return string
-   */
-  public function getMachineId()
-  {
-    return $this->machineId;
-  }
-
-  /**
-   * Determines whether or not this is a long-lived token.
-   *
-   * @return bool
-   */
-  public function isLongLived()
-  {
-    if ($this->expiresAt) {
-      return $this->expiresAt->getTimestamp() > time() + (60 * 60 * 2);
-    }
-    return false;
-  }
-
-  /**
-   * Checks the validity of the access token.
-   *
-   * @param string|null $appId Application ID to use
-   * @param string|null $appSecret App secret value to use
-   * @param string|null $machineId
-   *
-   * @return boolean
-   */
-  public function isValid($appId = null, $appSecret = null, $machineId = null)
-  {
-    $accessTokenInfo = $this->getInfo($appId, $appSecret);
-    $machineId = $machineId ?: $this->machineId;
-    return static::validateAccessToken($accessTokenInfo, $appId, $machineId);
-  }
-
-  /**
-   * Ensures the provided GraphSessionInfo object is valid,
-   *   throwing an exception if not.  Ensures the appId matches,
-   *   that the machineId matches if it's being used,
-   *   that the token is valid and has not expired.
-   *
-   * @param GraphSessionInfo $tokenInfo
-   * @param string|null $appId Application ID to use
-   * @param string|null $machineId
-   *
-   * @return boolean
-   */
-  public static function validateAccessToken(GraphSessionInfo $tokenInfo,
-                                             $appId = null, $machineId = null)
-  {
-    $targetAppId = FacebookSession::_getTargetAppId($appId);
-
-    $appIdIsValid = $tokenInfo->getAppId() == $targetAppId;
-    $machineIdIsValid = $tokenInfo->getProperty('machine_id') == $machineId;
-    $accessTokenIsValid = $tokenInfo->isValid();
-
-    // Not all access tokens return an expiration. E.g. an app access token.
-    if ($tokenInfo->getExpiresAt() instanceof \DateTime) {
-      $accessTokenIsStillAlive = $tokenInfo->getExpiresAt()->getTimestamp() >= time();
-    } else {
-      $accessTokenIsStillAlive = true;
-    }
-
-    return $appIdIsValid && $machineIdIsValid && $accessTokenIsValid && $accessTokenIsStillAlive;
-  }
-
-  /**
-   * Get a valid access token from a code.
-   *
-   * @param string $code
-   * @param string|null $appId
-   * @param string|null $appSecret
-   * @param string|null $machineId
-   *
-   * @return AccessToken
-   */
-  public static function getAccessTokenFromCode($code, $appId = null, $appSecret = null, $machineId = null)
-  {
-    $params = array(
-      'code' => $code,
-      'redirect_uri' => '',
-    );
-
-    if ($machineId) {
-      $params['machine_id'] = $machineId;
-    }
-
-    return static::requestAccessToken($params, $appId, $appSecret);
-  }
-
-  /**
-   * Get a valid code from an access token.
-   *
-   * @param AccessToken $accessToken
-   * @param string|null $appId
-   * @param string|null $appSecret
-   *
-   * @return string
-   */
-  public static function getCodeFromAccessToken($accessToken, $appId = null, $appSecret = null)
-  {
-    $accessToken = (string) $accessToken;
-
-    $params = array(
-      'access_token' => $accessToken,
-      'redirect_uri' => '',
-    );
-
-    return static::requestCode($params, $appId, $appSecret);
-  }
-
-  /**
-   * Exchanges a short lived access token with a long lived access token.
-   *
-   * @param string|null $appId
-   * @param string|null $appSecret
-   *
-   * @return AccessToken
-   */
-  public function extend($appId = null, $appSecret = null)
-  {
-    $params = array(
-      'grant_type' => 'fb_exchange_token',
-      'fb_exchange_token' => $this->accessToken,
-    );
-
-    return static::requestAccessToken($params, $appId, $appSecret);
-  }
-
-  /**
-   * Request an access token based on a set of params.
-   *
-   * @param array $params
-   * @param string|null $appId
-   * @param string|null $appSecret
-   *
-   * @return AccessToken
-   *
-   * @throws FacebookRequestException
-   */
-  public static function requestAccessToken(array $params, $appId = null, $appSecret = null)
-  {
-    $response = static::request('/oauth/access_token', $params, $appId, $appSecret);
-    $data = $response->getResponse();
-
-    /**
-     * @TODO fix this malarkey - getResponse() should always return an object
-     * @see https://github.com/facebook/facebook-php-sdk-v4/issues/36
-     */
-    if (is_array($data)) {
-      if (isset($data['access_token'])) {
-        $expiresAt = isset($data['expires']) ? time() + $data['expires'] : 0;
-        return new static($data['access_token'], $expiresAt);
-      }
-    } elseif($data instanceof \stdClass) {
-      if (isset($data->access_token)) {
-        $expiresAt = isset($data->expires_in) ? time() + $data->expires_in : 0;
-        $machineId = isset($data->machine_id) ? (string) $data->machine_id : null;
-        return new static((string) $data->access_token, $expiresAt, $machineId);
-      }
-    }
-
-    throw FacebookRequestException::create(
-      $response->getRawResponse(),
-      $data,
-      401
-    );
-  }
-
-  /**
-   * Request a code from a long lived access token.
-   *
-   * @param array $params
-   * @param string|null $appId
-   * @param string|null $appSecret
-   *
-   * @return string
-   *
-   * @throws FacebookRequestException
-   */
-  public static function requestCode(array $params, $appId = null, $appSecret = null)
-  {
-    $response = static::request('/oauth/client_code', $params, $appId, $appSecret);
-    $data = $response->getResponse();
-
-    if (isset($data->code)) {
-      return (string) $data->code;
-    }
-
-    throw FacebookRequestException::create(
-      $response->getRawResponse(),
-      $data,
-      401
-    );
-  }
-
-  /**
-   * Send a request to Graph with an app access token.
-   *
-   * @param string $endpoint
-   * @param array $params
-   * @param string|null $appId
-   * @param string|null $appSecret
-   *
-   * @return \Facebook\FacebookResponse
-   *
-   * @throws FacebookRequestException
-   */
-  protected static function request($endpoint, array $params, $appId = null, $appSecret = null)
-  {
-    $targetAppId = FacebookSession::_getTargetAppId($appId);
-    $targetAppSecret = FacebookSession::_getTargetAppSecret($appSecret);
-
-    if (!isset($params['client_id'])) {
-      $params['client_id'] = $targetAppId;
-    }
-    if (!isset($params['client_secret'])) {
-      $params['client_secret'] = $targetAppSecret;
-    }
-
-    // The response for this endpoint is not JSON, so it must be handled
-    //   differently, not as a GraphObject.
-    $request = new FacebookRequest(
-      FacebookSession::newAppSession($targetAppId, $targetAppSecret),
-      'GET',
-      $endpoint,
-      $params
-    );
-    return $request->execute();
-  }
-
-  /**
-   * Get more info about an access token.
-   *
-   * @param string|null $appId
-   * @param string|null $appSecret
-   *
-   * @return GraphSessionInfo
-   */
-  public function getInfo($appId = null, $appSecret = null)
-  {
-    $params = array('input_token' => $this->accessToken);
-
-    $request = new FacebookRequest(
-      FacebookSession::newAppSession($appId, $appSecret),
-      'GET',
-      '/debug_token',
-      $params
-    );
-    $response = $request->execute()->getGraphObject(GraphSessionInfo::className());
-
-    // Update the data on this token
-    if ($response->getExpiresAt()) {
-      $this->expiresAt = $response->getExpiresAt();
-    }
-
-    return $response;
-  }
-
-  /**
-   * Returns the access token as a string.
-   *
-   * @return string
-   */
-  public function __toString()
-  {
-    return $this->accessToken;
-  }
-
-  /**
-   * Returns true if the access token is an app session token.
-   *
-   * @return bool
-   */
-  public function isAppSession()
-  {
-    return strpos($this->accessToken, "|") !== false;
-  }
-
-}

+ 0 - 386
main/auth/external_login/facebook-php-sdk/src/Facebook/Entities/SignedRequest.php

@@ -1,386 +0,0 @@
-<?php
-/**
- * Copyright 2014 Facebook, Inc.
- *
- * You are hereby granted a non-exclusive, worldwide, royalty-free license to
- * use, copy, modify, and distribute this software in source code or binary
- * form for use in connection with the web services and APIs provided by
- * Facebook.
- *
- * As with any software that integrates with the Facebook platform, your use
- * of this software is subject to the Facebook Developer Principles and
- * Policies [http://developers.facebook.com/policy/]. This copyright notice
- * shall be included in all copies or substantial portions of the software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-namespace Facebook\Entities;
-
-use Facebook\FacebookSDKException;
-use Facebook\FacebookSession;
-
-/**
- * Class SignedRequest
- * @package Facebook
- */
-class SignedRequest
-{
-
-  /**
-   * @var string
-   */
-  public $rawSignedRequest;
-
-  /**
-   * @var array
-   */
-  public $payload;
-
-  /**
-   * Instantiate a new SignedRequest entity.
-   *
-   * @param string|null $rawSignedRequest The raw signed request.
-   * @param string|null $state random string to prevent CSRF.
-   * @param string|null $appSecret
-   */
-  public function __construct($rawSignedRequest = null, $state = null, $appSecret = null)
-  {
-    if (!$rawSignedRequest) {
-      return;
-    }
-
-    $this->rawSignedRequest = $rawSignedRequest;
-    $this->payload = static::parse($rawSignedRequest, $state, $appSecret);
-  }
-
-  /**
-   * Returns the raw signed request data.
-   *
-   * @return string
-   */
-  public function getRawSignedRequest()
-  {
-    return $this->rawSignedRequest;
-  }
-
-  /**
-   * Returns the parsed signed request data.
-   *
-   * @return array|null
-   */
-  public function getPayload()
-  {
-    return $this->payload;
-  }
-
-  /**
-   * Returns a property from the signed request data if available.
-   *
-   * @param string $key
-   * @param integer $default
-   *
-   * @return mixed|null
-   */
-  public function get($key, $default = null)
-  {
-    if (isset($this->payload[$key])) {
-      return $this->payload[$key];
-    }
-    return $default;
-  }
-
-  /**
-   * Returns user_id from signed request data if available.
-   *
-   * @return string|null
-   */
-  public function getUserId()
-  {
-    return $this->get('user_id');
-  }
-
-  /**
-   * Checks for OAuth data in the payload.
-   *
-   * @return boolean
-   */
-  public function hasOAuthData()
-  {
-    return isset($this->payload['oauth_token']) || isset($this->payload['code']);
-  }
-
-  /**
-   * Creates a signed request from an array of data.
-   *
-   * @param array $payload
-   * @param string|null $appSecret
-   *
-   * @return string
-   */
-  public static function make(array $payload, $appSecret = null)
-  {
-    $payload['algorithm'] = 'HMAC-SHA256';
-    $payload['issued_at'] = time();
-    $encodedPayload = static::base64UrlEncode(json_encode($payload));
-
-    $hashedSig = static::hashSignature($encodedPayload, $appSecret);
-    $encodedSig = static::base64UrlEncode($hashedSig);
-
-    return $encodedSig.'.'.$encodedPayload;
-  }
-
-  /**
-   * Validates and decodes a signed request and returns
-   * the payload as an array.
-   *
-   * @param string $signedRequest
-   * @param string|null $state
-   * @param string|null $appSecret
-   *
-   * @return array
-   */
-  public static function parse($signedRequest, $state = null, $appSecret = null)
-  {
-    list($encodedSig, $encodedPayload) = static::split($signedRequest);
-
-    // Signature validation
-    $sig = static::decodeSignature($encodedSig);
-    $hashedSig = static::hashSignature($encodedPayload, $appSecret);
-    static::validateSignature($hashedSig, $sig);
-
-    // Payload validation
-    $data = static::decodePayload($encodedPayload);
-    static::validateAlgorithm($data);
-    if ($state) {
-      static::validateCsrf($data, $state);
-    }
-
-    return $data;
-  }
-
-  /**
-   * Validates the format of a signed request.
-   *
-   * @param string $signedRequest
-   *
-   * @throws FacebookSDKException
-   */
-  public static function validateFormat($signedRequest)
-  {
-    if (strpos($signedRequest, '.') !== false) {
-      return;
-    }
-
-    throw new FacebookSDKException(
-      'Malformed signed request.', 606
-    );
-  }
-
-  /**
-   * Decodes a raw valid signed request.
-   *
-   * @param string $signedRequest
-   *
-   * @returns array
-   */
-  public static function split($signedRequest)
-  {
-    static::validateFormat($signedRequest);
-
-    return explode('.', $signedRequest, 2);
-  }
-
-  /**
-   * Decodes the raw signature from a signed request.
-   *
-   * @param string $encodedSig
-   *
-   * @returns string
-   *
-   * @throws FacebookSDKException
-   */
-  public static function decodeSignature($encodedSig)
-  {
-    $sig = static::base64UrlDecode($encodedSig);
-
-    if ($sig) {
-      return $sig;
-    }
-
-    throw new FacebookSDKException(
-      'Signed request has malformed encoded signature data.', 607
-    );
-  }
-
-  /**
-   * Decodes the raw payload from a signed request.
-   *
-   * @param string $encodedPayload
-   *
-   * @returns array
-   *
-   * @throws FacebookSDKException
-   */
-  public static function decodePayload($encodedPayload)
-  {
-    $payload = static::base64UrlDecode($encodedPayload);
-
-    if ($payload) {
-      $payload = json_decode($payload, true);
-    }
-
-    if (is_array($payload)) {
-      return $payload;
-    }
-
-    throw new FacebookSDKException(
-      'Signed request has malformed encoded payload data.', 607
-    );
-  }
-
-  /**
-   * Validates the algorithm used in a signed request.
-   *
-   * @param array $data
-   *
-   * @throws FacebookSDKException
-   */
-  public static function validateAlgorithm(array $data)
-  {
-    if (isset($data['algorithm']) && $data['algorithm'] === 'HMAC-SHA256') {
-      return;
-    }
-
-    throw new FacebookSDKException(
-      'Signed request is using the wrong algorithm.', 605
-    );
-  }
-
-  /**
-   * Hashes the signature used in a signed request.
-   *
-   * @param string $encodedData
-   * @param string|null $appSecret
-   *
-   * @return string
-   *
-   * @throws FacebookSDKException
-   */
-  public static function hashSignature($encodedData, $appSecret = null)
-  {
-    $hashedSig = hash_hmac(
-      'sha256', $encodedData, FacebookSession::_getTargetAppSecret($appSecret), $raw_output = true
-    );
-
-    if ($hashedSig) {
-      return $hashedSig;
-    }
-
-    throw new FacebookSDKException(
-      'Unable to hash signature from encoded payload data.', 602
-    );
-  }
-
-  /**
-   * Validates the signature used in a signed request.
-   *
-   * @param string $hashedSig
-   * @param string $sig
-   *
-   * @throws FacebookSDKException
-   */
-  public static function validateSignature($hashedSig, $sig)
-  {
-    if (mb_strlen($hashedSig) === mb_strlen($sig)) {
-      $validate = 0;
-      for ($i = 0; $i < mb_strlen($sig); $i++) {
-        $validate |= ord($hashedSig[$i]) ^ ord($sig[$i]);
-      }
-      if ($validate === 0) {
-        return;
-      }
-    }
-
-    throw new FacebookSDKException(
-      'Signed request has an invalid signature.', 602
-    );
-  }
-
-  /**
-   * Validates a signed request against CSRF.
-   *
-   * @param array $data
-   * @param string $state
-   *
-   * @throws FacebookSDKException
-   */
-  public static function validateCsrf(array $data, $state)
-  {
-    if (isset($data['state']) && $data['state'] === $state) {
-      return;
-    }
-
-    throw new FacebookSDKException(
-      'Signed request did not pass CSRF validation.', 604
-    );
-  }
-
-  /**
-   * Base64 decoding which replaces characters:
-   *   + instead of -
-   *   / instead of _
-   * @link http://en.wikipedia.org/wiki/Base64#URL_applications
-   *
-   * @param string $input base64 url encoded input
-   *
-   * @return string decoded string
-   */
-  public static function base64UrlDecode($input)
-  {
-    $urlDecodedBase64 = strtr($input, '-_', '+/');
-    static::validateBase64($urlDecodedBase64);
-    return base64_decode($urlDecodedBase64);
-  }
-
-  /**
-   * Base64 encoding which replaces characters:
-   *   + instead of -
-   *   / instead of _
-   * @link http://en.wikipedia.org/wiki/Base64#URL_applications
-   *
-   * @param string $input string to encode
-   *
-   * @return string base64 url encoded input
-   */
-  public static function base64UrlEncode($input)
-  {
-    return strtr(base64_encode($input), '+/', '-_');
-  }
-
-  /**
-   * Validates a base64 string.
-   *
-   * @param string $input base64 value to validate
-   *
-   * @throws FacebookSDKException
-   */
-  public static function validateBase64($input)
-  {
-    $pattern = '/^[a-zA-Z0-9\/\r\n+]*={0,2}$/';
-    if (preg_match($pattern, $input)) {
-      return;
-    }
-
-    throw new FacebookSDKException(
-      'Signed request contains malformed base64 encoding.', 608
-    );
-  }
-
-}

+ 0 - 33
main/auth/external_login/facebook-php-sdk/src/Facebook/FacebookAuthorizationException.php

@@ -1,33 +0,0 @@
-<?php
-/**
- * Copyright 2014 Facebook, Inc.
- *
- * You are hereby granted a non-exclusive, worldwide, royalty-free license to
- * use, copy, modify, and distribute this software in source code or binary
- * form for use in connection with the web services and APIs provided by
- * Facebook.
- *
- * As with any software that integrates with the Facebook platform, your use
- * of this software is subject to the Facebook Developer Principles and
- * Policies [http://developers.facebook.com/policy/]. This copyright notice
- * shall be included in all copies or substantial portions of the software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-namespace Facebook;
-
-/**
- * Class FacebookAuthorizationException
- * @package Facebook
- */
-class FacebookAuthorizationException extends FacebookRequestException
-{
-
-}

+ 0 - 60
main/auth/external_login/facebook-php-sdk/src/Facebook/FacebookCanvasLoginHelper.php

@@ -1,60 +0,0 @@
-<?php
-/**
- * Copyright 2014 Facebook, Inc.
- *
- * You are hereby granted a non-exclusive, worldwide, royalty-free license to
- * use, copy, modify, and distribute this software in source code or binary
- * form for use in connection with the web services and APIs provided by
- * Facebook.
- *
- * As with any software that integrates with the Facebook platform, your use
- * of this software is subject to the Facebook Developer Principles and
- * Policies [http://developers.facebook.com/policy/]. This copyright notice
- * shall be included in all copies or substantial portions of the software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-namespace Facebook;
-
-/**
- * Class FacebookCanvasLoginHelper
- * @package Facebook
- * @author Fosco Marotto <fjm@fb.com>
- * @author David Poll <depoll@fb.com>
- */
-class FacebookCanvasLoginHelper extends FacebookSignedRequestFromInputHelper
-{
-
-  /**
-   * Returns the app data value.
-   *
-   * @return mixed|null
-   */
-  public function getAppData()
-  {
-    return $this->signedRequest ? $this->signedRequest->get('app_data') : null;
-  }
-
-  /**
-   * Get raw signed request from POST.
-   *
-   * @return string|null
-   */
-  public function getRawSignedRequest()
-  {
-    $rawSignedRequest = $this->getRawSignedRequestFromPost();
-    if ($rawSignedRequest) {
-      return $rawSignedRequest;
-    }
-
-    return null;
-  }
-
-}

+ 0 - 33
main/auth/external_login/facebook-php-sdk/src/Facebook/FacebookClientException.php

@@ -1,33 +0,0 @@
-<?php
-/**
- * Copyright 2014 Facebook, Inc.
- *
- * You are hereby granted a non-exclusive, worldwide, royalty-free license to
- * use, copy, modify, and distribute this software in source code or binary
- * form for use in connection with the web services and APIs provided by
- * Facebook.
- *
- * As with any software that integrates with the Facebook platform, your use
- * of this software is subject to the Facebook Developer Principles and
- * Policies [http://developers.facebook.com/policy/]. This copyright notice
- * shall be included in all copies or substantial portions of the software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-namespace Facebook;
-
-/**
- * Class FacebookClientException
- * @package Facebook
- */
-class FacebookClientException extends FacebookRequestException
-{
-
-}

+ 0 - 45
main/auth/external_login/facebook-php-sdk/src/Facebook/FacebookJavaScriptLoginHelper.php

@@ -1,45 +0,0 @@
-<?php
-/**
- * Copyright 2014 Facebook, Inc.
- *
- * You are hereby granted a non-exclusive, worldwide, royalty-free license to
- * use, copy, modify, and distribute this software in source code or binary
- * form for use in connection with the web services and APIs provided by
- * Facebook.
- *
- * As with any software that integrates with the Facebook platform, your use
- * of this software is subject to the Facebook Developer Principles and
- * Policies [http://developers.facebook.com/policy/]. This copyright notice
- * shall be included in all copies or substantial portions of the software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-namespace Facebook;
-
-/**
- * Class FacebookJavaScriptLoginHelper
- * @package Facebook
- * @author Fosco Marotto <fjm@fb.com>
- * @author David Poll <depoll@fb.com>
- */
-class FacebookJavaScriptLoginHelper extends FacebookSignedRequestFromInputHelper
-{
-
-  /**
-   * Get raw signed request from the cookie.
-   *
-   * @return string|null
-   */
-  public function getRawSignedRequest()
-  {
-    return $this->getRawSignedRequestFromCookie();
-  }
-
-}

+ 0 - 33
main/auth/external_login/facebook-php-sdk/src/Facebook/FacebookOtherException.php

@@ -1,33 +0,0 @@
-<?php
-/**
- * Copyright 2014 Facebook, Inc.
- *
- * You are hereby granted a non-exclusive, worldwide, royalty-free license to
- * use, copy, modify, and distribute this software in source code or binary
- * form for use in connection with the web services and APIs provided by
- * Facebook.
- *
- * As with any software that integrates with the Facebook platform, your use
- * of this software is subject to the Facebook Developer Principles and
- * Policies [http://developers.facebook.com/policy/]. This copyright notice
- * shall be included in all copies or substantial portions of the software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-namespace Facebook;
-
-/**
- * Class FacebookOtherException
- * @package Facebook
- */
-class FacebookOtherException extends FacebookRequestException
-{
-
-}

+ 0 - 102
main/auth/external_login/facebook-php-sdk/src/Facebook/FacebookPageTabHelper.php

@@ -1,102 +0,0 @@
-<?php
-/**
- * Copyright 2014 Facebook, Inc.
- *
- * You are hereby granted a non-exclusive, worldwide, royalty-free license to
- * use, copy, modify, and distribute this software in source code or binary
- * form for use in connection with the web services and APIs provided by
- * Facebook.
- *
- * As with any software that integrates with the Facebook platform, your use
- * of this software is subject to the Facebook Developer Principles and
- * Policies [http://developers.facebook.com/policy/]. This copyright notice
- * shall be included in all copies or substantial portions of the software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-namespace Facebook;
-
-/**
- * Class FacebookPageTabHelper
- * @package Facebook
- * @author Fosco Marotto <fjm@fb.com>
- */
-class FacebookPageTabHelper extends FacebookCanvasLoginHelper
-{
-
-  /**
-   * @var array|null
-   */
-  protected $pageData;
-
-  /**
-   * Initialize the helper and process available signed request data.
-   *
-   * @param string|null $appId
-   * @param string|null $appSecret
-   */
-  public function __construct($appId = null, $appSecret = null)
-  {
-    parent::__construct($appId, $appSecret);
-
-    if (!$this->signedRequest) {
-      return;
-    }
-
-    $this->pageData = $this->signedRequest->get('page');
-  }
-
-  /**
-   * Returns a value from the page data.
-   *
-   * @param string $key
-   * @param mixed|null $default
-   *
-   * @return mixed|null
-   */
-  public function getPageData($key, $default = null)
-  {
-    if (isset($this->pageData[$key])) {
-      return $this->pageData[$key];
-    }
-    return $default;
-  }
-
-  /**
-   * Returns true if the page is liked by the user.
-   *
-   * @return boolean
-   */
-  public function isLiked()
-  {
-    return $this->getPageData('liked') === true;
-  }
-
-  /**
-   * Returns true if the user is an admin.
-   *
-   * @return boolean
-   */
-  public function isAdmin()
-  {
-    return $this->getPageData('admin') === true;
-  }
-
-  /**
-   * Returns the page id if available.
-   *
-   * @return string|null
-   */
-  public function getPageId()
-  {
-    return $this->getPageData('id');
-  }
-
-}

+ 0 - 33
main/auth/external_login/facebook-php-sdk/src/Facebook/FacebookPermissionException.php

@@ -1,33 +0,0 @@
-<?php
-/**
- * Copyright 2014 Facebook, Inc.
- *
- * You are hereby granted a non-exclusive, worldwide, royalty-free license to
- * use, copy, modify, and distribute this software in source code or binary
- * form for use in connection with the web services and APIs provided by
- * Facebook.
- *
- * As with any software that integrates with the Facebook platform, your use
- * of this software is subject to the Facebook Developer Principles and
- * Policies [http://developers.facebook.com/policy/]. This copyright notice
- * shall be included in all copies or substantial portions of the software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-namespace Facebook;
-
-/**
- * Class FacebookPermissionException
- * @package Facebook
- */
-class FacebookPermissionException extends FacebookRequestException
-{
-
-}

+ 0 - 324
main/auth/external_login/facebook-php-sdk/src/Facebook/FacebookRedirectLoginHelper.php

@@ -1,324 +0,0 @@
-<?php
-/**
- * Copyright 2014 Facebook, Inc.
- *
- * You are hereby granted a non-exclusive, worldwide, royalty-free license to
- * use, copy, modify, and distribute this software in source code or binary
- * form for use in connection with the web services and APIs provided by
- * Facebook.
- *
- * As with any software that integrates with the Facebook platform, your use
- * of this software is subject to the Facebook Developer Principles and
- * Policies [http://developers.facebook.com/policy/]. This copyright notice
- * shall be included in all copies or substantial portions of the software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-namespace Facebook;
-
-/**
- * Class FacebookRedirectLoginHelper
- * @package Facebook
- * @author Fosco Marotto <fjm@fb.com>
- * @author David Poll <depoll@fb.com>
- */
-class FacebookRedirectLoginHelper
-{
-
-  /**
-   * @var string The application id
-   */
-  private $appId;
-
-  /**
-   * @var string The application secret
-   */
-  private $appSecret;
-
-  /**
-   * @var string The redirect URL for the application
-   */
-  private $redirectUrl;
-
-  /**
-   * @var string Prefix to use for session variables
-   */
-  private $sessionPrefix = 'FBRLH_';
-
-  /**
-   * @var string State token for CSRF validation
-   */
-  protected $state;
-
-  /**
-   * @var boolean Toggle for PHP session status check
-   */
-  protected $checkForSessionStatus = true;
-
-  /**
-   * Constructs a RedirectLoginHelper for a given appId and redirectUrl.
-   *
-   * @param string $redirectUrl The URL Facebook should redirect users to
-   *                            after login
-   * @param string $appId The application id
-   * @param string $appSecret The application secret
-   */
-  public function __construct($redirectUrl, $appId = null, $appSecret = null)
-  {
-    $this->appId = FacebookSession::_getTargetAppId($appId);
-    $this->appSecret = FacebookSession::_getTargetAppSecret($appSecret);
-    $this->redirectUrl = $redirectUrl;
-  }
-
-  /**
-   * Stores CSRF state and returns a URL to which the user should be sent to
-   *   in order to continue the login process with Facebook.  The
-   *   provided redirectUrl should invoke the handleRedirect method.
-   *
-   * @param array $scope List of permissions to request during login
-   * @param string $version Optional Graph API version if not default (v2.0)
-   * @param boolean $displayAsPopup Indicate if the page will be displayed as a popup
-   *
-   * @return string
-   */
-  public function getLoginUrl($scope = array(), $version = null, $displayAsPopup = false)
-  {
-
-    $version = ($version ?: FacebookRequest::GRAPH_API_VERSION);
-    $this->state = $this->random(16);
-    $this->storeState($this->state);
-
-    $params = array(
-      'client_id' => $this->appId,
-      'redirect_uri' => $this->redirectUrl,
-      'state' => $this->state,
-      'sdk' => 'php-sdk-' . FacebookRequest::VERSION,
-      'scope' => implode(',', $scope)
-    );
-    
-    if ($displayAsPopup)
-    {
-      $params['display'] = 'popup';
-    }
-    
-    return 'https://www.facebook.com/' . $version . '/dialog/oauth?' .
-      http_build_query($params, null, '&');
-  }
-
-  /**
-   * Returns a URL to which the user should be sent to re-request permissions.
-   *
-   * @param array $scope List of permissions to re-request
-   * @param string $version Optional Graph API version if not default (v2.0)
-   *
-   * @return string
-   */
-  public function getReRequestUrl($scope = array(), $version = null)
-  {
-    $version = ($version ?: FacebookRequest::GRAPH_API_VERSION);
-    $this->state = $this->random(16);
-    $this->storeState($this->state);
-    $params = array(
-      'client_id' => $this->appId,
-      'redirect_uri' => $this->redirectUrl,
-      'state' => $this->state,
-      'sdk' => 'php-sdk-' . FacebookRequest::VERSION,
-      'auth_type' => 'rerequest',
-      'scope' => implode(',', $scope)
-    );
-    return 'https://www.facebook.com/' . $version . '/dialog/oauth?' .
-      http_build_query($params, null, '&');
-  }
-
-  /**
-   * Returns the URL to send the user in order to log out of Facebook.
-   *
-   * @param FacebookSession $session The session that will be logged out
-   * @param string $next The url Facebook should redirect the user to after
-   *   a successful logout
-   *
-   * @return string
-   *
-   * @throws FacebookSDKException
-   */
-  public function getLogoutUrl(FacebookSession $session, $next)
-  {
-    if ($session->getAccessToken()->isAppSession()) {
-      throw new FacebookSDKException(
-        'Cannot generate a Logout URL with an App Session.', 722
-      );
-    }
-    $params = array(
-      'next' => $next,
-      'access_token' => $session->getToken()
-    );
-    return 'https://www.facebook.com/logout.php?' . http_build_query($params, null, '&');
-  }
-
-  /**
-   * Handles a response from Facebook, including a CSRF check, and returns a
-   *   FacebookSession.
-   *
-   * @return FacebookSession|null
-   */
-  public function getSessionFromRedirect()
-  {
-    $this->loadState();
-    if ($this->isValidRedirect()) {
-	
-      $params = array(
-        'client_id' => FacebookSession::_getTargetAppId($this->appId),
-        'redirect_uri' => $this->redirectUrl,
-        'client_secret' =>
-          FacebookSession::_getTargetAppSecret($this->appSecret),
-        'code' => $this->getCode()
-      );
-
-      $response = (new FacebookRequest(
-        FacebookSession::newAppSession($this->appId, $this->appSecret),
-        'GET',
-        '/oauth/access_token',
-        $params
-      ))->execute()->getResponse();
-		
-      if (isset($response['access_token'])) {
-        return new FacebookSession($response['access_token']);
-      }
-    }
-    return null;
-  }
-
-  /**
-   * Check if a redirect has a valid state.
-   *
-   * @return bool
-   */
-  protected function isValidRedirect()
-  {
-    return $this->getCode() && isset($_GET['state'])
-        && $_GET['state'] == $this->state;
-  }
-
-  /**
-   * Return the code.
-   *
-   * @return string|null
-   */
-  protected function getCode()
-  {
-
-    return isset($_GET['code']) ? $_GET['code'] : null;
-  }
-
-  /**
-   * Stores a state string in session storage for CSRF protection.
-   * Developers should subclass and override this method if they want to store
-   *   this state in a different location.
-   *
-   * @param string $state
-   *
-   * @throws FacebookSDKException
-   */
-  protected function storeState($state)
-  {
-    if ($this->checkForSessionStatus === true
-      && session_status() !== PHP_SESSION_ACTIVE) {
-      throw new FacebookSDKException(
-        'Session not active, could not store state.', 720
-      );
-    }
-    $_SESSION[$this->sessionPrefix . 'state'] = $state;
-  }
-
-  /**
-   * Loads a state string from session storage for CSRF validation.  May return
-   *   null if no object exists.  Developers should subclass and override this
-   *   method if they want to load the state from a different location.
-   *
-   * @return string|null
-   *
-   * @throws FacebookSDKException
-   */
-  protected function loadState()
-  {
-	
-    if ($this->checkForSessionStatus === true
-      && session_status() !== PHP_SESSION_ACTIVE) {
-      throw new FacebookSDKException(
-        'Session not active, could not load state.', 721
-      );
-    }
-    if (isset($_SESSION[$this->sessionPrefix . 'state'])) {
-      $this->state = $_SESSION[$this->sessionPrefix . 'state'];
-      return $this->state;
-    }
-    return null;
-  }
-  
-  /**
-   * Generate a cryptographically secure pseudrandom number
-   * 
-   * @param integer $bytes - number of bytes to return
-   * 
-   * @return string
-   * 
-   * @throws FacebookSDKException
-   * 
-   * @todo Support Windows platforms
-   */
-  public function random($bytes)
-  {
-    if (!is_numeric($bytes)) {
-      throw new FacebookSDKException(
-        "random() expects an integer"
-      );
-    }
-    if ($bytes < 1) {
-      throw new FacebookSDKException(
-        "random() expects an integer greater than zero"
-      );
-    }
-    $buf = '';
-    // http://sockpuppet.org/blog/2014/02/25/safely-generate-random-numbers/
-    if (!ini_get('open_basedir')
-      && is_readable('/dev/urandom')) {
-      $fp = fopen('/dev/urandom', 'rb');
-      if ($fp !== FALSE) {
-        $buf = fread($fp, $bytes);
-        fclose($fp);
-        if($buf !== FALSE) {
-          return bin2hex($buf);
-        }
-      }
-    }
-
-    if (function_exists('mcrypt_create_iv')) {
-        $buf = mcrypt_create_iv($bytes, MCRYPT_DEV_URANDOM);
-        if ($buf !== FALSE) {
-          return bin2hex($buf);
-        }
-    }
-    
-    while (strlen($buf) < $bytes) {
-      $buf .= md5(uniqid(mt_rand(), true), true); 
-      // We are appending raw binary
-    }
-    return bin2hex(substr($buf, 0, $bytes));
-  }
-
-  /**
-   * Disables the session_status() check when using $_SESSION
-   */
-  public function disableSessionStatusCheck()
-  {
-    $this->checkForSessionStatus = false;
-  }
-
-}

+ 0 - 313
main/auth/external_login/facebook-php-sdk/src/Facebook/FacebookRequest.php

@@ -1,313 +0,0 @@
-<?php
-/**
- * Copyright 2014 Facebook, Inc.
- *
- * You are hereby granted a non-exclusive, worldwide, royalty-free license to
- * use, copy, modify, and distribute this software in source code or binary
- * form for use in connection with the web services and APIs provided by
- * Facebook.
- *
- * As with any software that integrates with the Facebook platform, your use
- * of this software is subject to the Facebook Developer Principles and
- * Policies [http://developers.facebook.com/policy/]. This copyright notice
- * shall be included in all copies or substantial portions of the software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-namespace Facebook;
-
-use Facebook\HttpClients\FacebookHttpable;
-use Facebook\HttpClients\FacebookCurlHttpClient;
-use Facebook\HttpClients\FacebookStreamHttpClient;
-
-/**
- * Class FacebookRequest
- * @package Facebook
- * @author Fosco Marotto <fjm@fb.com>
- * @author David Poll <depoll@fb.com>
- */
-class FacebookRequest
-{
-
-  /**
-   * @const string Version number of the Facebook PHP SDK.
-   */
-  const VERSION = '4.0.15';
-
-  /**
-   * @const string Default Graph API version for requests
-   */
-  const GRAPH_API_VERSION = 'v2.2';
-
-  /**
-   * @const string Graph API URL
-   */
-  const BASE_GRAPH_URL = 'https://graph.facebook.com';
-
-  /**
-   * @var FacebookSession The session used for this request
-   */
-  private $session;
-
-  /**
-   * @var string The HTTP method for the request
-   */
-  private $method;
-
-  /**
-   * @var string The path for the request
-   */
-  private $path;
-
-  /**
-   * @var array The parameters for the request
-   */
-  private $params;
-
-  /**
-   * @var string The Graph API version for the request
-   */
-  private $version;
-
-  /**
-   * @var string ETag sent with the request
-   */
-  private $etag;
-
-  /**
-   * @var FacebookHttpable HTTP client handler
-   */
-  private static $httpClientHandler;
-
-  /**
-   * @var int The number of calls that have been made to Graph.
-   */
-  public static $requestCount = 0;
-
-  /**
-   * getSession - Returns the associated FacebookSession.
-   *
-   * @return FacebookSession
-   */
-  public function getSession()
-  {
-    return $this->session;
-  }
-
-  /**
-   * getPath - Returns the associated path.
-   *
-   * @return string
-   */
-  public function getPath()
-  {
-    return $this->path;
-  }
-
-  /**
-   * getParameters - Returns the associated parameters.
-   *
-   * @return array
-   */
-  public function getParameters()
-  {
-    return $this->params;
-  }
-
-  /**
-   * getMethod - Returns the associated method.
-   *
-   * @return string
-   */
-  public function getMethod()
-  {
-    return $this->method;
-  }
-
-  /**
-   * getETag - Returns the ETag sent with the request.
-   *
-   * @return string
-   */
-  public function getETag()
-  {
-    return $this->etag;
-  }
-
-  /**
-   * setHttpClientHandler - Returns an instance of the HTTP client
-   * handler
-   *
-   * @param \Facebook\HttpClients\FacebookHttpable
-   */
-  public static function setHttpClientHandler(FacebookHttpable $handler)
-  {
-    static::$httpClientHandler = $handler;
-  }
-
-  /**
-   * getHttpClientHandler - Returns an instance of the HTTP client
-   * data handler
-   *
-   * @return FacebookHttpable
-   */
-  public static function getHttpClientHandler()
-  {
-    if (static::$httpClientHandler) {
-      return static::$httpClientHandler;
-    }
-    return function_exists('curl_init') ? new FacebookCurlHttpClient() : new FacebookStreamHttpClient();
-  }
-
-  /**
-   * FacebookRequest - Returns a new request using the given session.  optional
-   *   parameters hash will be sent with the request.  This object is
-   *   immutable.
-   *
-   * @param FacebookSession $session
-   * @param string $method
-   * @param string $path
-   * @param array|null $parameters
-   * @param string|null $version
-   * @param string|null $etag
-   */
-  public function __construct(
-    FacebookSession $session, $method, $path, $parameters = null, $version = null, $etag = null
-  )
-  {
-    $this->session = $session;
-    $this->method = $method;
-    $this->path = $path;
-    if ($version) {
-      $this->version = $version;
-    } else {
-      $this->version = static::GRAPH_API_VERSION;
-    }
-    $this->etag = $etag;
-
-    $params = ($parameters ?: array());
-    if ($session
-      && !isset($params["access_token"])) {
-      $params["access_token"] = $session->getToken();
-    }
-    if (FacebookSession::useAppSecretProof()
-      && !isset($params["appsecret_proof"])) {
-      $params["appsecret_proof"] = $this->getAppSecretProof(
-        $params["access_token"]
-      );
-    }
-    $this->params = $params;
-  }
-
-  /**
-   * Returns the base Graph URL.
-   *
-   * @return string
-   */
-  protected function getRequestURL()
-  {
-    return static::BASE_GRAPH_URL . '/' . $this->version . $this->path;
-  }
-
-  /**
-   * execute - Makes the request to Facebook and returns the result.
-   *
-   * @return FacebookResponse
-   *
-   * @throws FacebookSDKException
-   * @throws FacebookRequestException
-   */
-  public function execute()
-  {
-    $url = $this->getRequestURL();
-    $params = $this->getParameters();
-
-    if ($this->method === "GET") {
-      $url = self::appendParamsToUrl($url, $params);
-      $params = array();
-    }
-
-    $connection = self::getHttpClientHandler();
-    $connection->addRequestHeader('User-Agent', 'fb-php-' . self::VERSION);
-    $connection->addRequestHeader('Accept-Encoding', '*'); // Support all available encodings.
-
-    // ETag
-    if (isset($this->etag)) {
-      $connection->addRequestHeader('If-None-Match', $this->etag);
-    }
-
-    // Should throw `FacebookSDKException` exception on HTTP client error.
-    // Don't catch to allow it to bubble up.
-    $result = $connection->send($url, $this->method, $params);
-
-    static::$requestCount++;
-
-    $etagHit = 304 == $connection->getResponseHttpStatusCode();
-
-    $headers = $connection->getResponseHeaders();
-    $etagReceived = isset($headers['ETag']) ? $headers['ETag'] : null;
-
-    $decodedResult = json_decode($result);
-    if ($decodedResult === null) {
-      $out = array();
-      parse_str($result, $out);
-      return new FacebookResponse($this, $out, $result, $etagHit, $etagReceived);
-    }
-    if (isset($decodedResult->error)) {
-      throw FacebookRequestException::create(
-        $result,
-        $decodedResult->error,
-        $connection->getResponseHttpStatusCode()
-      );
-    }
-
-    return new FacebookResponse($this, $decodedResult, $result, $etagHit, $etagReceived);
-  }
-
-  /**
-   * Generate and return the appsecret_proof value for an access_token
-   *
-   * @param string $token
-   *
-   * @return string
-   */
-  public function getAppSecretProof($token)
-  {
-    return hash_hmac('sha256', $token, FacebookSession::_getTargetAppSecret());
-  }
-
-  /**
-   * appendParamsToUrl - Gracefully appends params to the URL.
-   *
-   * @param string $url
-   * @param array $params
-   *
-   * @return string
-   */
-  public static function appendParamsToUrl($url, $params = array())
-  {
-    if (!$params) {
-      return $url;
-    }
-
-    if (strpos($url, '?') === false) {
-      return $url . '?' . http_build_query($params, null, '&');
-    }
-
-    list($path, $query_string) = explode('?', $url, 2);
-    parse_str($query_string, $query_array);
-
-    // Favor params from the original URL over $params
-    $params = array_merge($params, $query_array);
-
-    return $path . '?' . http_build_query($params, null, '&');
-  }
-
-}

+ 0 - 222
main/auth/external_login/facebook-php-sdk/src/Facebook/FacebookRequestException.php

@@ -1,222 +0,0 @@
-<?php
-/**
- * Copyright 2014 Facebook, Inc.
- *
- * You are hereby granted a non-exclusive, worldwide, royalty-free license to
- * use, copy, modify, and distribute this software in source code or binary
- * form for use in connection with the web services and APIs provided by
- * Facebook.
- *
- * As with any software that integrates with the Facebook platform, your use
- * of this software is subject to the Facebook Developer Principles and
- * Policies [http://developers.facebook.com/policy/]. This copyright notice
- * shall be included in all copies or substantial portions of the software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-namespace Facebook;
-
-/**
- * Class FacebookRequestException
- * @package Facebook
- * @author Fosco Marotto <fjm@fb.com>
- * @author David Poll <depoll@fb.com>
- */
-class FacebookRequestException extends FacebookSDKException
-{
-
-  /**
-   * @var int Status code for the response causing the exception
-   */
-  private $statusCode;
-
-  /**
-   * @var string Raw response
-   */
-  private $rawResponse;
-
-  /**
-   * @var array Decoded response
-   */
-  private $responseData;
-
-  /**
-   * Creates a FacebookRequestException.
-   *
-   * @param string $rawResponse The raw response from the Graph API
-   * @param array $responseData The decoded response from the Graph API
-   * @param int $statusCode
-   */
-  public function __construct($rawResponse, $responseData, $statusCode)
-  {
-    $this->rawResponse = $rawResponse;
-    $this->statusCode = $statusCode;
-    $this->responseData = self::convertToArray($responseData);
-    parent::__construct(
-      $this->get('message', 'Unknown Exception'), $this->get('code', -1), null
-    );
-  }
-
-  /**
-   * Process an error payload from the Graph API and return the appropriate
-   *   exception subclass.
-   *
-   * @param string $raw the raw response from the Graph API
-   * @param array $data the decoded response from the Graph API
-   * @param int $statusCode the HTTP response code
-   *
-   * @return FacebookRequestException
-   */
-  public static function create($raw, $data, $statusCode)
-  {
-    $data = self::convertToArray($data);
-    if (!isset($data['error']['code']) && isset($data['code'])) {
-      $data = array('error' => $data);
-    }
-    $code = (isset($data['error']['code']) ? $data['error']['code'] : null);
-
-    if (isset($data['error']['error_subcode'])) {
-      switch ($data['error']['error_subcode']) {
-        // Other authentication issues
-        case 458:
-        case 459:
-        case 460:
-        case 463:
-        case 464:
-        case 467:
-          return new FacebookAuthorizationException($raw, $data, $statusCode);
-          break;
-      }
-    }
-
-    switch ($code) {
-      // Login status or token expired, revoked, or invalid
-      case 100:
-      case 102:
-      case 190:
-        return new FacebookAuthorizationException($raw, $data, $statusCode);
-        break;
-
-      // Server issue, possible downtime
-      case 1:
-      case 2:
-        return new FacebookServerException($raw, $data, $statusCode);
-        break;
-
-      // API Throttling
-      case 4:
-      case 17:
-      case 341:
-        return new FacebookThrottleException($raw, $data, $statusCode);
-        break;
-
-      // Duplicate Post
-      case 506:
-        return new FacebookClientException($raw, $data, $statusCode);
-        break;
-    }
-
-    // Missing Permissions
-    if ($code == 10 || ($code >= 200 && $code <= 299)) {
-      return new FacebookPermissionException($raw, $data, $statusCode);
-    }
-
-    // OAuth authentication error
-    if (isset($data['error']['type'])
-      and $data['error']['type'] === 'OAuthException') {
-      return new FacebookAuthorizationException($raw, $data, $statusCode);
-    }
-
-    // All others
-    return new FacebookOtherException($raw, $data, $statusCode);
-  }
-
-  /**
-   * Checks isset and returns that or a default value.
-   *
-   * @param string $key
-   * @param mixed $default
-   *
-   * @return mixed
-   */
-  private function get($key, $default = null)
-  {
-    if (isset($this->responseData['error'][$key])) {
-      return $this->responseData['error'][$key];
-    }
-    return $default;
-  }
-
-  /**
-   * Returns the HTTP status code
-   *
-   * @return int
-   */
-  public function getHttpStatusCode()
-  {
-    return $this->statusCode;
-  }
-
-  /**
-   * Returns the sub-error code
-   *
-   * @return int
-   */
-  public function getSubErrorCode()
-  {
-    return $this->get('error_subcode', -1);
-  }
-
-  /**
-   * Returns the error type
-   *
-   * @return string
-   */
-  public function getErrorType()
-  {
-    return $this->get('type', '');
-  }
-
-  /**
-   * Returns the raw response used to create the exception.
-   *
-   * @return string
-   */
-  public function getRawResponse()
-  {
-    return $this->rawResponse;
-  }
-
-  /**
-   * Returns the decoded response used to create the exception.
-   *
-   * @return array
-   */
-  public function getResponse()
-  {
-    return $this->responseData;
-  }
-
-  /**
-   * Converts a stdClass object to an array
-   *
-   * @param mixed $object
-   *
-   * @return array
-   */
-  private static function convertToArray($object)
-  {
-    if ($object instanceof \stdClass) {
-      return get_object_vars($object);
-    }
-    return $object;
-  }
-
-}

+ 0 - 206
main/auth/external_login/facebook-php-sdk/src/Facebook/FacebookResponse.php

@@ -1,206 +0,0 @@
-<?php
-/**
- * Copyright 2014 Facebook, Inc.
- *
- * You are hereby granted a non-exclusive, worldwide, royalty-free license to
- * use, copy, modify, and distribute this software in source code or binary
- * form for use in connection with the web services and APIs provided by
- * Facebook.
- *
- * As with any software that integrates with the Facebook platform, your use
- * of this software is subject to the Facebook Developer Principles and
- * Policies [http://developers.facebook.com/policy/]. This copyright notice
- * shall be included in all copies or substantial portions of the software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-namespace Facebook;
-
-/**
- * Class FacebookResponse
- * @package Facebook
- * @author Fosco Marotto <fjm@fb.com>
- * @author David Poll <depoll@fb.com>
- */
-class FacebookResponse
-{
-
-  /**
-   * @var FacebookRequest The request which produced this response
-   */
-  private $request;
-
-  /**
-   * @var array The decoded response from the Graph API
-   */
-  private $responseData;
-
-  /**
-   * @var string The raw response from the Graph API
-   */
-  private $rawResponse;
-
-  /**
-   * @var bool Indicates whether sent ETag matched the one on the FB side
-   */
-  private $etagHit;
-
-  /**
-   * @var string ETag received with the response. `null` in case of ETag hit.
-   */
-  private $etag;
-
-  /**
-   * Creates a FacebookResponse object for a given request and response.
-   *
-   * @param FacebookRequest $request
-   * @param array $responseData JSON Decoded response data
-   * @param string $rawResponse Raw string response
-   * @param bool $etagHit Indicates whether sent ETag matched the one on the FB side
-   * @param string|null $etag ETag received with the response. `null` in case of ETag hit.
-   */
-  public function __construct($request, $responseData, $rawResponse, $etagHit = false, $etag = null)
-  {
-    $this->request = $request;
-    $this->responseData = $responseData;
-    $this->rawResponse = $rawResponse;
-    $this->etagHit = $etagHit;
-    $this->etag = $etag;
-  }
-
-  /**
-   * Returns the request which produced this response.
-   *
-   * @return FacebookRequest
-   */
-  public function getRequest()
-  {
-    return $this->request;
-  }
-
-  /**
-   * Returns the decoded response data.
-   *
-   * @return array
-   */
-  public function getResponse()
-  {
-    return $this->responseData;
-  }
-
-  /**
-   * Returns the raw response
-   *
-   * @return string
-   */
-  public function getRawResponse()
-  {
-    return $this->rawResponse;
-  }
-
-  /**
-   * Returns true if ETag matched the one sent with a request
-   *
-   * @return bool
-   */
-  public function isETagHit()
-  {
-    return $this->etagHit;
-  }
-
-  /**
-   * Returns the ETag
-   *
-   * @return string
-   */
-  public function getETag()
-  {
-    return $this->etag;
-  }
-
-  /**
-   * Gets the result as a GraphObject.  If a type is specified, returns the
-   *   strongly-typed subclass of GraphObject for the data.
-   *
-   * @param string $type
-   *
-   * @return mixed
-   */
-  public function getGraphObject($type = 'Facebook\GraphObject') {
-    return (new GraphObject($this->responseData))->cast($type);
-  }
-
-  /**
-   * Returns an array of GraphObject returned by the request.  If a type is
-   * specified, returns the strongly-typed subclass of GraphObject for the data.
-   *
-   * @param string $type
-   *
-   * @return mixed
-   */
-  public function getGraphObjectList($type = 'Facebook\GraphObject') {
-    $out = array();
-    $data = $this->responseData->data;
-    $dataLength = count($data);
-    for ($i = 0; $i < $dataLength; $i++) {
-      $out[] = (new GraphObject($data[$i]))->cast($type);
-    }
-    return $out;
-  }
-
-  /**
-   * If this response has paginated data, returns the FacebookRequest for the
-   *   next page, or null.
-   *
-   * @return FacebookRequest|null
-   */
-  public function getRequestForNextPage()
-  {
-    return $this->handlePagination('next');
-  }
-
-  /**
-   * If this response has paginated data, returns the FacebookRequest for the
-   *   previous page, or null.
-   *
-   * @return FacebookRequest|null
-   */
-  public function getRequestForPreviousPage()
-  {
-    return $this->handlePagination('previous');
-  }
-
-  /**
-   * Returns the FacebookRequest for the previous or next page, or null.
-   *
-   * @param string $direction
-   *
-   * @return FacebookRequest|null
-   */
-  private function handlePagination($direction) {
-    if (isset($this->responseData->paging->$direction)) {
-      $url = parse_url($this->responseData->paging->$direction);
-      parse_str($url['query'], $params);
-
-      if (isset($params['type']) && strpos($this->request->getPath(), $params['type']) !== false){
-        unset($params['type']);
-      }
-      return new FacebookRequest(
-        $this->request->getSession(),
-        $this->request->getMethod(),
-        $this->request->getPath(),
-        $params
-      );
-    } else {
-      return null;
-    }
-  }
-
-}

+ 0 - 33
main/auth/external_login/facebook-php-sdk/src/Facebook/FacebookSDKException.php

@@ -1,33 +0,0 @@
-<?php
-/**
- * Copyright 2014 Facebook, Inc.
- *
- * You are hereby granted a non-exclusive, worldwide, royalty-free license to
- * use, copy, modify, and distribute this software in source code or binary
- * form for use in connection with the web services and APIs provided by
- * Facebook.
- *
- * As with any software that integrates with the Facebook platform, your use
- * of this software is subject to the Facebook Developer Principles and
- * Policies [http://developers.facebook.com/policy/]. This copyright notice
- * shall be included in all copies or substantial portions of the software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-namespace Facebook;
-
-/**
- * Class FacebookSDKException
- * @package Facebook
- */
-class FacebookSDKException extends \Exception
-{
-
-}

+ 0 - 33
main/auth/external_login/facebook-php-sdk/src/Facebook/FacebookServerException.php

@@ -1,33 +0,0 @@
-<?php
-/**
- * Copyright 2014 Facebook, Inc.
- *
- * You are hereby granted a non-exclusive, worldwide, royalty-free license to
- * use, copy, modify, and distribute this software in source code or binary
- * form for use in connection with the web services and APIs provided by
- * Facebook.
- *
- * As with any software that integrates with the Facebook platform, your use
- * of this software is subject to the Facebook Developer Principles and
- * Policies [http://developers.facebook.com/policy/]. This copyright notice
- * shall be included in all copies or substantial portions of the software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-namespace Facebook;
-
-/**
- * Class FacebookServerException
- * @package Facebook
- */
-class FacebookServerException extends FacebookRequestException
-{
-
-}

+ 0 - 367
main/auth/external_login/facebook-php-sdk/src/Facebook/FacebookSession.php

@@ -1,367 +0,0 @@
-<?php
-/**
- * Copyright 2014 Facebook, Inc.
- *
- * You are hereby granted a non-exclusive, worldwide, royalty-free license to
- * use, copy, modify, and distribute this software in source code or binary
- * form for use in connection with the web services and APIs provided by
- * Facebook.
- *
- * As with any software that integrates with the Facebook platform, your use
- * of this software is subject to the Facebook Developer Principles and
- * Policies [http://developers.facebook.com/policy/]. This copyright notice
- * shall be included in all copies or substantial portions of the software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-namespace Facebook;
-
-use Facebook\Entities\AccessToken;
-use Facebook\Entities\SignedRequest;
-
-/**
- * Class FacebookSession
- * @package Facebook
- * @author Fosco Marotto <fjm@fb.com>
- * @author David Poll <depoll@fb.com>
- */
-class FacebookSession
-{
-
-  /**
-   * @var string
-   */
-  private static $defaultAppId;
-
-  /**
-   * @var string
-   */
-  private static $defaultAppSecret;
-
-  /**
-   * @var AccessToken The AccessToken entity for this connection.
-   */
-  private $accessToken;
-
-  /**
-   * @var SignedRequest
-   */
-  private $signedRequest;
-
-  /**
-   * @var bool
-   */
-  protected static $useAppSecretProof = true;
-
-  /**
-   * When creating a Session from an access_token, use:
-   *   var $session = new FacebookSession($accessToken);
-   * This will validate the token and provide a Session object ready for use.
-   * It will throw a SessionException in case of error.
-   *
-   * @param AccessToken|string $accessToken
-   * @param SignedRequest $signedRequest The SignedRequest entity
-   */
-  public function __construct($accessToken, SignedRequest $signedRequest = null)
-  {
-    $this->accessToken = $accessToken instanceof AccessToken ? $accessToken : new AccessToken($accessToken);
-    $this->signedRequest = $signedRequest;
-  }
-
-  /**
-   * Returns the access token.
-   *
-   * @return string
-   */
-  public function getToken()
-  {
-    return (string) $this->accessToken;
-  }
-
-  /**
-   * Returns the access token entity.
-   *
-   * @return AccessToken
-   */
-  public function getAccessToken()
-  {
-    return $this->accessToken;
-  }
-
-  /**
-   * Returns the SignedRequest entity.
-   *
-   * @return SignedRequest
-   */
-  public function getSignedRequest()
-  {
-    return $this->signedRequest;
-  }
-
-  /**
-   * Returns the signed request payload.
-   *
-   * @return null|array
-   */
-  public function getSignedRequestData()
-  {
-    return $this->signedRequest ? $this->signedRequest->getPayload() : null;
-  }
-
-  /**
-   * Returns a property from the signed request data if available.
-   *
-   * @param string $key
-   *
-   * @return null|mixed
-   */
-  public function getSignedRequestProperty($key)
-  {
-    return $this->signedRequest ? $this->signedRequest->get($key) : null;
-  }
-
-  /**
-   * Returns user_id from signed request data if available.
-   *
-   * @return null|string
-   */
-  public function getUserId()
-  {
-    return $this->signedRequest ? $this->signedRequest->getUserId() : null;
-  }
-
-  // @TODO Remove getSessionInfo() in 4.1: can be accessed from AccessToken directly
-  /**
-   * getSessionInfo - Makes a request to /debug_token with the appropriate
-   *   arguments to get debug information about the sessions token.
-   *
-   * @param string|null $appId
-   * @param string|null $appSecret
-   *
-   * @return GraphSessionInfo
-   */
-  public function getSessionInfo($appId = null, $appSecret = null)
-  {
-    return $this->accessToken->getInfo($appId, $appSecret);
-  }
-
-  // @TODO Remove getLongLivedSession() in 4.1: can be accessed from AccessToken directly
-  /**
-   * getLongLivedSession - Returns a new Facebook session resulting from
-   *   extending a short-lived access token.  If this session is not
-   *   short-lived, returns $this.
-   *
-   * @param string|null $appId
-   * @param string|null $appSecret
-   *
-   * @return FacebookSession
-   */
-  public function getLongLivedSession($appId = null, $appSecret = null)
-  {
-    $longLivedAccessToken = $this->accessToken->extend($appId, $appSecret);
-    return new static($longLivedAccessToken, $this->signedRequest);
-  }
-
-  // @TODO Remove getExchangeToken() in 4.1: can be accessed from AccessToken directly
-  /**
-   * getExchangeToken - Returns an exchange token string which can be sent
-   *   back to clients and exchanged for a device-linked access token.
-   *
-   * @param string|null $appId
-   * @param string|null $appSecret
-   *
-   * @return string
-   */
-  public function getExchangeToken($appId = null, $appSecret = null)
-  {
-    return AccessToken::getCodeFromAccessToken($this->accessToken, $appId, $appSecret);
-  }
-
-  // @TODO Remove validate() in 4.1: can be accessed from AccessToken directly
-  /**
-   * validate - Ensures the current session is valid, throwing an exception if
-   *   not.  Fetches token info from Facebook.
-   *
-   * @param string|null $appId Application ID to use
-   * @param string|null $appSecret App secret value to use
-   * @param string|null $machineId
-   *
-   * @return boolean
-   *
-   * @throws FacebookSDKException
-   */
-  public function validate($appId = null, $appSecret = null, $machineId = null)
-  {
-    if ($this->accessToken->isValid($appId, $appSecret, $machineId)) {
-      return true;
-    }
-
-    // @TODO For v4.1 this should not throw an exception, but just return false.
-    throw new FacebookSDKException(
-      'Session has expired, or is not valid for this app.', 601
-    );
-  }
-
-  // @TODO Remove validateSessionInfo() in 4.1: can be accessed from AccessToken directly
-  /**
-   * validateTokenInfo - Ensures the provided GraphSessionInfo object is valid,
-   *   throwing an exception if not.  Ensures the appId matches,
-   *   that the token is valid and has not expired.
-   *
-   * @param GraphSessionInfo $tokenInfo
-   * @param string|null $appId Application ID to use
-   * @param string|null $machineId
-   *
-   * @return boolean
-   *
-   * @throws FacebookSDKException
-   */
-  public static function validateSessionInfo(GraphSessionInfo $tokenInfo,
-                                           $appId = null,
-                                           $machineId = null)
-  {
-    if (AccessToken::validateAccessToken($tokenInfo, $appId, $machineId)) {
-      return true;
-    }
-
-    // @TODO For v4.1 this should not throw an exception, but just return false.
-    throw new FacebookSDKException(
-      'Session has expired, or is not valid for this app.', 601
-    );
-  }
-
-  /**
-   * newSessionFromSignedRequest - Returns a FacebookSession for a
-   *   given signed request.
-   *
-   * @param SignedRequest $signedRequest
-   *
-   * @return FacebookSession
-   */
-  public static function newSessionFromSignedRequest(SignedRequest $signedRequest)
-  {
-    if ($signedRequest->get('code')
-      && !$signedRequest->get('oauth_token')) {
-      return self::newSessionAfterValidation($signedRequest);
-    }
-    $accessToken = $signedRequest->get('oauth_token');
-    $expiresAt = $signedRequest->get('expires', 0);
-    $accessToken = new AccessToken($accessToken, $expiresAt);
-    return new static($accessToken, $signedRequest);
-  }
-
-  /**
-   * newSessionAfterValidation - Returns a FacebookSession for a
-   *   validated & parsed signed request.
-   *
-   * @param SignedRequest $signedRequest
-   *
-   * @return FacebookSession
-   */
-  protected static function newSessionAfterValidation(SignedRequest $signedRequest)
-  {
-    $code = $signedRequest->get('code');
-    $accessToken = AccessToken::getAccessTokenFromCode($code);
-    return new static($accessToken, $signedRequest);
-  }
-
-  /**
-   * newAppSession - Returns a FacebookSession configured with a token for the
-   *   application which can be used for publishing and requesting app-level
-   *   information.
-   *
-   * @param string|null $appId Application ID to use
-   * @param string|null $appSecret App secret value to use
-   *
-   * @return FacebookSession
-   */
-  public static function newAppSession($appId = null, $appSecret = null)
-  {
-    $targetAppId = static::_getTargetAppId($appId);
-    $targetAppSecret = static::_getTargetAppSecret($appSecret);
-    return new FacebookSession(
-      $targetAppId . '|' . $targetAppSecret
-    );
-  }
-
-  /**
-   * setDefaultApplication - Will set the static default appId and appSecret
-   *   to be used for API requests.
-   *
-   * @param string $appId Application ID to use by default
-   * @param string $appSecret App secret value to use by default
-   */
-  public static function setDefaultApplication($appId, $appSecret)
-  {
-    self::$defaultAppId = $appId;
-    self::$defaultAppSecret = $appSecret;
-  }
-
-  /**
-   * _getTargetAppId - Will return either the provided app Id or the default,
-   *   throwing if neither are populated.
-   *
-   * @param string $appId
-   *
-   * @return string
-   *
-   * @throws FacebookSDKException
-   */
-  public static function _getTargetAppId($appId = null) {
-    $target = ($appId ?: self::$defaultAppId);
-    if (!$target) {
-      throw new FacebookSDKException(
-        'You must provide or set a default application id.', 700
-      );
-    }
-    return $target;
-  }
-
-  /**
-   * _getTargetAppSecret - Will return either the provided app secret or the
-   *   default, throwing if neither are populated.
-   *
-   * @param string $appSecret
-   *
-   * @return string
-   *
-   * @throws FacebookSDKException
-   */
-  public static function _getTargetAppSecret($appSecret = null) {
-    $target = ($appSecret ?: self::$defaultAppSecret);
-    if (!$target) {
-      throw new FacebookSDKException(
-        'You must provide or set a default application secret.', 701
-      );
-    }
-    return $target;
-  }
-
-  /**
-   * Enable or disable sending the appsecret_proof with requests.
-   *
-   * @param bool $on
-   */
-  public static function enableAppSecretProof($on = true)
-  {
-    static::$useAppSecretProof = ($on ? true : false);
-  }
-
-  /**
-   * Get whether or not appsecret_proof should be sent with requests.
-   *
-   * @return bool
-   */
-  public static function useAppSecretProof()
-  {
-    return static::$useAppSecretProof;
-  }
-
-}

+ 0 - 166
main/auth/external_login/facebook-php-sdk/src/Facebook/FacebookSignedRequestFromInputHelper.php

@@ -1,166 +0,0 @@
-<?php
-/**
- * Copyright 2014 Facebook, Inc.
- *
- * You are hereby granted a non-exclusive, worldwide, royalty-free license to
- * use, copy, modify, and distribute this software in source code or binary
- * form for use in connection with the web services and APIs provided by
- * Facebook.
- *
- * As with any software that integrates with the Facebook platform, your use
- * of this software is subject to the Facebook Developer Principles and
- * Policies [http://developers.facebook.com/policy/]. This copyright notice
- * shall be included in all copies or substantial portions of the software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-namespace Facebook;
-
-use Facebook\Entities\SignedRequest;
-
-/**
- * Class FacebookSignedRequestFromInputHelper
- * @package Facebook
- */
-abstract class FacebookSignedRequestFromInputHelper
-{
-
-  /**
-   * @var \Facebook\Entities\SignedRequest|null
-   */
-  protected $signedRequest;
-
-  /**
-   * @var string the app id
-   */
-  protected $appId;
-
-  /**
-   * @var string the app secret
-   */
-  protected $appSecret;
-
-  /**
-   * @var string|null Random string to prevent CSRF.
-   */
-  public $state = null;
-
-  /**
-   * Initialize the helper and process available signed request data.
-   *
-   * @param string|null $appId
-   * @param string|null $appSecret
-   */
-  public function __construct($appId = null, $appSecret = null)
-  {
-    $this->appId = FacebookSession::_getTargetAppId($appId);
-    $this->appSecret = FacebookSession::_getTargetAppSecret($appSecret);
-
-    $this->instantiateSignedRequest();
-  }
-
-  /**
-   * Instantiates a new SignedRequest entity.
-   *
-   * @param string|null
-   */
-  public function instantiateSignedRequest($rawSignedRequest = null)
-  {
-    $rawSignedRequest = $rawSignedRequest ?: $this->getRawSignedRequest();
-
-    if (!$rawSignedRequest) {
-      return;
-    }
-
-    $this->signedRequest = new SignedRequest($rawSignedRequest, $this->state, $this->appSecret);
-  }
-
-  /**
-   * Instantiates a FacebookSession from the signed request from input.
-   *
-   * @return FacebookSession|null
-   */
-  public function getSession()
-  {
-    if ($this->signedRequest && $this->signedRequest->hasOAuthData()) {
-      return FacebookSession::newSessionFromSignedRequest($this->signedRequest);
-    }
-    return null;
-  }
-
-  /**
-   * Returns the SignedRequest entity.
-   *
-   * @return \Facebook\Entities\SignedRequest|null
-   */
-  public function getSignedRequest()
-  {
-    return $this->signedRequest;
-  }
-
-  /**
-   * Returns the user_id if available.
-   *
-   * @return string|null
-   */
-  public function getUserId()
-  {
-    return $this->signedRequest ? $this->signedRequest->getUserId() : null;
-  }
-
-  /**
-   * Get raw signed request from input.
-   *
-   * @return string|null
-   */
-  abstract public function getRawSignedRequest();
-
-  /**
-   * Get raw signed request from GET input.
-   *
-   * @return string|null
-   */
-  public function getRawSignedRequestFromGet()
-  {
-    if (isset($_GET['signed_request'])) {
-      return $_GET['signed_request'];
-    }
-
-    return null;
-  }
-
-  /**
-   * Get raw signed request from POST input.
-   *
-   * @return string|null
-   */
-  public function getRawSignedRequestFromPost()
-  {
-    if (isset($_POST['signed_request'])) {
-      return $_POST['signed_request'];
-    }
-
-    return null;
-  }
-
-  /**
-   * Get raw signed request from cookie set from the Javascript SDK.
-   *
-   * @return string|null
-   */
-  public function getRawSignedRequestFromCookie()
-  {
-    if (isset($_COOKIE['fbsr_' . $this->appId])) {
-      return $_COOKIE['fbsr_' . $this->appId];
-    }
-    return null;
-  }
-
-}

+ 0 - 33
main/auth/external_login/facebook-php-sdk/src/Facebook/FacebookThrottleException.php

@@ -1,33 +0,0 @@
-<?php
-/**
- * Copyright 2014 Facebook, Inc.
- *
- * You are hereby granted a non-exclusive, worldwide, royalty-free license to
- * use, copy, modify, and distribute this software in source code or binary
- * form for use in connection with the web services and APIs provided by
- * Facebook.
- *
- * As with any software that integrates with the Facebook platform, your use
- * of this software is subject to the Facebook Developer Principles and
- * Policies [http://developers.facebook.com/policy/]. This copyright notice
- * shall be included in all copies or substantial portions of the software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-namespace Facebook;
-
-/**
- * Class FacebookThrottleException
- * @package Facebook
- */
-class FacebookThrottleException extends FacebookRequestException
-{
-
-}

+ 0 - 173
main/auth/external_login/facebook-php-sdk/src/Facebook/GraphAlbum.php

@@ -1,173 +0,0 @@
-<?php
-/**
- * Copyright 2014 Facebook, Inc.
- *
- * You are hereby granted a non-exclusive, worldwide, royalty-free license to
- * use, copy, modify, and distribute this software in source code or binary
- * form for use in connection with the web services and APIs provided by
- * Facebook.
- *
- * As with any software that integrates with the Facebook platform, your use
- * of this software is subject to the Facebook Developer Principles and
- * Policies [http://developers.facebook.com/policy/]. This copyright notice
- * shall be included in all copies or substantial portions of the software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-namespace Facebook;
-
-/**
- * Class GraphAlbum
- * @package Facebook
- * @author Daniele Grosso <daniele.grosso@gmail.com>
- */
-
-class GraphAlbum extends GraphObject
-{
-    /**
-     * Returns the ID for the album.
-     *
-     * @return string|null
-     */
-    public function getId()
-    {
-        return $this->getProperty('id');
-    }
-
-    /**
-     * Returns whether the viewer can upload photos to this album.
-     *
-     * @return boolean|null
-     */
-    public function canUpload()
-    {
-        return $this->getProperty('can_upload');
-    }
-
-    /**
-     * Returns the number of photos in this album.
-     *
-     * @return int|null
-     */
-    public function getCount()
-    {
-        return $this->getProperty('count');
-    }
-
-    /**
-     * Returns the ID of the album's cover photo.
-     *
-     * @return string|null
-     */
-    public function getCoverPhoto()
-    {
-        return $this->getProperty('cover_photo');
-    }
-
-    /**
-     * Returns the time the album was initially created.
-     *
-     * @return \DateTime|null
-     */
-    public function getCreatedTime()
-    {
-        $value = $this->getProperty('created_time');
-        if ($value) {
-            return new \DateTime($value);
-        }
-        return null;
-    }
-
-    /**
-     * Returns the time the album was updated.
-     *
-     * @return \DateTime|null
-     */
-    public function getUpdatedTime()
-    {
-        $value = $this->getProperty('updated_time');
-        if ($value) {
-            return new \DateTime($value);
-        }
-        return null;
-    }
-
-    /**
-     * Returns the description of the album.
-     *
-     * @return string|null
-     */
-    public function getDescription()
-    {
-        return $this->getProperty('description');
-    }
-
-    /**
-     * Returns profile that created the album.
-     *
-     * @return GraphUser|null
-     */
-    public function getFrom()
-    {
-      return  $this->getProperty('from', GraphUser::className());
-    }
-
-    /**
-     * Returns a link to this album on Facebook.
-     *
-     * @return string|null
-     */
-    public function getLink()
-    {
-        return $this->getProperty('link');
-    }
-
-    /**
-     * Returns the textual location of the album.
-     *
-     * @return string|null
-     */
-    public function getLocation()
-    {
-        return $this->getProperty('location');
-    }
-
-    /**
-     * Returns the title of the album.
-     *
-     * @return string|null
-     */
-    public function getName()
-    {
-        return $this->getProperty('name');
-    }
-
-    /**
-     * Returns the privacy settings for the album.
-     *
-     * @return string|null
-     */
-    public function getPrivacy()
-    {
-        return $this->getProperty('privacy');
-    }
-
-    /**
-     * Returns the type of the album. enum{profile, mobile, wall, normal, album}
-     *
-     * @return string|null
-     */
-    public function getType()
-    {
-        return $this->getProperty('type');
-    }
-
-    //TODO: public function getPlace() that should return GraphPage
-}

+ 0 - 105
main/auth/external_login/facebook-php-sdk/src/Facebook/GraphLocation.php

@@ -1,105 +0,0 @@
-<?php
-/**
- * Copyright 2014 Facebook, Inc.
- *
- * You are hereby granted a non-exclusive, worldwide, royalty-free license to
- * use, copy, modify, and distribute this software in source code or binary
- * form for use in connection with the web services and APIs provided by
- * Facebook.
- *
- * As with any software that integrates with the Facebook platform, your use
- * of this software is subject to the Facebook Developer Principles and
- * Policies [http://developers.facebook.com/policy/]. This copyright notice
- * shall be included in all copies or substantial portions of the software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-namespace Facebook;
-
-/**
- * Class GraphLocation
- * @package Facebook
- * @author Fosco Marotto <fjm@fb.com>
- * @author David Poll <depoll@fb.com>
- */
-class GraphLocation extends GraphObject
-{
-
-  /**
-   * Returns the street component of the location
-   *
-   * @return string|null
-   */
-  public function getStreet()
-  {
-    return $this->getProperty('street');
-  }
-
-  /**
-   * Returns the city component of the location
-   *
-   * @return string|null
-   */
-  public function getCity()
-  {
-    return $this->getProperty('city');
-  }
-
-  /**
-   * Returns the state component of the location
-   *
-   * @return string|null
-   */
-  public function getState()
-  {
-    return $this->getProperty('state');
-  }
-
-  /**
-   * Returns the country component of the location
-   *
-   * @return string|null
-   */
-  public function getCountry()
-  {
-    return $this->getProperty('country');
-  }
-
-  /**
-   * Returns the zipcode component of the location
-   *
-   * @return string|null
-   */
-  public function getZip()
-  {
-    return $this->getProperty('zip');
-  }
-
-  /**
-   * Returns the latitude component of the location
-   *
-   * @return float|null
-   */
-  public function getLatitude()
-  {
-    return $this->getProperty('latitude');
-  }
-
-  /**
-   * Returns the street component of the location
-   *
-   * @return float|null
-   */
-  public function getLongitude()
-  {
-    return $this->getProperty('longitude');
-  }
-
-}

+ 0 - 171
main/auth/external_login/facebook-php-sdk/src/Facebook/GraphObject.php

@@ -1,171 +0,0 @@
-<?php
-/**
- * Copyright 2014 Facebook, Inc.
- *
- * You are hereby granted a non-exclusive, worldwide, royalty-free license to
- * use, copy, modify, and distribute this software in source code or binary
- * form for use in connection with the web services and APIs provided by
- * Facebook.
- *
- * As with any software that integrates with the Facebook platform, your use
- * of this software is subject to the Facebook Developer Principles and
- * Policies [http://developers.facebook.com/policy/]. This copyright notice
- * shall be included in all copies or substantial portions of the software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-namespace Facebook;
-
-/**
- * Class GraphObject
- * @package Facebook
- * @author Fosco Marotto <fjm@fb.com>
- * @author David Poll <depoll@fb.com>
- */
-class GraphObject
-{
-
-  /**
-   * @var array - Holds the raw associative data for this object
-   */
-  protected $backingData;
-
-  /**
-   * Creates a GraphObject using the data provided.
-   *
-   * @param array $raw
-   */
-  public function __construct($raw)
-  {
-    if ($raw instanceof \stdClass) {
-      $raw = get_object_vars($raw);
-    }
-    $this->backingData = $raw;
-
-    if (isset($this->backingData['data']) && count($this->backingData) === 1) {
-      if ($this->backingData['data'] instanceof \stdClass) {
-        $this->backingData = get_object_vars($this->backingData['data']);
-      } else {
-        $this->backingData = $this->backingData['data'];
-      }
-    }
-  }
-
-  /**
-   * cast - Return a new instance of a FacebookGraphObject subclass for this
-   *   objects underlying data.
-   *
-   * @param string $type The GraphObject subclass to cast to
-   *
-   * @return GraphObject
-   *
-   * @throws FacebookSDKException
-   */
-  public function cast($type)
-  {
-    if ($this instanceof $type) {
-      return $this;
-    }
-    if (is_subclass_of($type, GraphObject::className())) {
-      return new $type($this->backingData);
-    } else {
-      throw new FacebookSDKException(
-        'Cannot cast to an object that is not a GraphObject subclass', 620
-      );
-    }
-  }
-
-  /**
-   * asArray - Return a key-value associative array for the given graph object.
-   *
-   * @return array
-   */
-  public function asArray()
-  {
-    return $this->backingData;
-  }
-
-  /**
-   * getProperty - Gets the value of the named property for this graph object,
-   *   cast to the appropriate subclass type if provided.
-   *
-   * @param string $name The property to retrieve
-   * @param string $type The subclass of GraphObject, optionally
-   *
-   * @return mixed
-   */
-  public function getProperty($name, $type = 'Facebook\GraphObject')
-  {
-    if (isset($this->backingData[$name])) {
-      $value = $this->backingData[$name];
-      if (is_scalar($value)) {
-        return $value;
-      } else {
-        return (new GraphObject($value))->cast($type);
-      }
-    } else {
-      return null;
-    }
-  }
-
-  /**
-   * getPropertyAsArray - Get the list value of a named property for this graph
-   *   object, where each item has been cast to the appropriate subclass type
-   *   if provided.
-   *
-   * Calling this for a property that is not an array, the behavior
-   *   is undefined, so don’t do this.
-   *
-   * @param string $name The property to retrieve
-   * @param string $type The subclass of GraphObject, optionally
-   *
-   * @return array
-   */
-  public function getPropertyAsArray($name, $type = 'Facebook\GraphObject')
-  {
-    $target = array();
-    if (isset($this->backingData[$name]['data'])) {
-      $target = $this->backingData[$name]['data'];
-    } else if (isset($this->backingData[$name])
-      && !is_scalar($this->backingData[$name])) {
-      $target = $this->backingData[$name];
-    }
-    $out = array();
-    foreach ($target as $key => $value) {
-      if (is_scalar($value)) {
-        $out[$key] = $value;
-      } else {
-        $out[$key] = (new GraphObject($value))->cast($type);
-      }
-    }
-    return $out;
-  }
-
-  /**
-   * getPropertyNames - Returns a list of all properties set on the object.
-   *
-   * @return array
-   */
-  public function getPropertyNames()
-  {
-    return array_keys($this->backingData);
-  }
-
-  /**
-   * Returns the string class name of the GraphObject or subclass.
-   *
-   * @return string
-   */
-  public static function className()
-  {
-    return get_called_class();
-  }
-
-}

+ 0 - 64
main/auth/external_login/facebook-php-sdk/src/Facebook/GraphPage.php

@@ -1,64 +0,0 @@
-<?php
-/**
- * Copyright 2014 Facebook, Inc.
- *
- * You are hereby granted a non-exclusive, worldwide, royalty-free license to
- * use, copy, modify, and distribute this software in source code or binary
- * form for use in connection with the web services and APIs provided by
- * Facebook.
- *
- * As with any software that integrates with the Facebook platform, your use
- * of this software is subject to the Facebook Developer Principles and
- * Policies [http://developers.facebook.com/policy/]. This copyright notice
- * shall be included in all copies or substantial portions of the software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-namespace Facebook;
-
-/**
- * Class GraphPage
- * @package Facebook
- * @author Artur Luiz <artur@arturluiz.com.br>
- */
-class GraphPage extends GraphObject
-{
-
-  /**
-   * Returns the ID for the user's page as a string if present.
-   *
-   * @return string|null
-   */
-  public function getId()
-  {
-    return $this->getProperty('id');
-  }
-
-  /**
-   * Returns the Category for the user's page as a string if present.
-   *
-   * @return string|null
-   */
-  public function getCategory()
-  {
-    return $this->getProperty('category');
-  }
-
-  /**
-   * Returns the Name of the user's page as a string if present.
-   *
-   * @return string|null
-   */
-  public function getName()
-  {
-    return $this->getProperty('name');
-  }
-
-}

+ 0 - 115
main/auth/external_login/facebook-php-sdk/src/Facebook/GraphSessionInfo.php

@@ -1,115 +0,0 @@
-<?php
-/**
- * Copyright 2014 Facebook, Inc.
- *
- * You are hereby granted a non-exclusive, worldwide, royalty-free license to
- * use, copy, modify, and distribute this software in source code or binary
- * form for use in connection with the web services and APIs provided by
- * Facebook.
- *
- * As with any software that integrates with the Facebook platform, your use
- * of this software is subject to the Facebook Developer Principles and
- * Policies [http://developers.facebook.com/policy/]. This copyright notice
- * shall be included in all copies or substantial portions of the software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-namespace Facebook;
-
-/**
- * Class GraphSessionInfo
- * @package Facebook
- * @author Fosco Marotto <fjm@fb.com>
- * @author David Poll <depoll@fb.com>
- */
-class GraphSessionInfo extends GraphObject
-{
-
-  /**
-   * Returns the application id the token was issued for.
-   *
-   * @return string|null
-   */
-  public function getAppId()
-  {
-    return $this->getProperty('app_id');
-  }
-
-  /**
-   * Returns the application name the token was issued for.
-   *
-   * @return string|null
-   */
-  public function getApplication()
-  {
-    return $this->getProperty('application');
-  }
-
-  /**
-   * Returns the date & time that the token expires.
-   *
-   * @return \DateTime|null
-   */
-  public function getExpiresAt()
-  {
-    $stamp = $this->getProperty('expires_at');
-    if ($stamp) {
-      return (new \DateTime())->setTimestamp($stamp);
-    } else {
-      return null;
-    }
-  }
-
-  /**
-   * Returns whether the token is valid.
-   *
-   * @return boolean
-   */
-  public function isValid()
-  {
-    return $this->getProperty('is_valid');
-  }
-
-  /**
-   * Returns the date & time the token was issued at.
-   *
-   * @return \DateTime|null
-   */
-  public function getIssuedAt()
-  {
-    $stamp = $this->getProperty('issued_at');
-    if ($stamp) {
-      return (new \DateTime())->setTimestamp($stamp);
-    } else {
-      return null;
-    }
-  }
-
-  /**
-   * Returns the scope permissions associated with the token.
-   *
-   * @return array
-   */
-  public function getScopes()
-  {
-    return $this->getPropertyAsArray('scopes');
-  }
-
-  /**
-   * Returns the login id of the user associated with the token.
-   *
-   * @return string|null
-   */
-  public function getId()
-  {
-    return $this->getProperty('user_id');
-  }
-
-}

+ 0 - 135
main/auth/external_login/facebook-php-sdk/src/Facebook/GraphUser.php

@@ -1,135 +0,0 @@
-<?php
-/**
- * Copyright 2014 Facebook, Inc.
- *
- * You are hereby granted a non-exclusive, worldwide, royalty-free license to
- * use, copy, modify, and distribute this software in source code or binary
- * form for use in connection with the web services and APIs provided by
- * Facebook.
- *
- * As with any software that integrates with the Facebook platform, your use
- * of this software is subject to the Facebook Developer Principles and
- * Policies [http://developers.facebook.com/policy/]. This copyright notice
- * shall be included in all copies or substantial portions of the software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-namespace Facebook;
-
-/**
- * Class GraphUser
- * @package Facebook
- * @author Fosco Marotto <fjm@fb.com>
- * @author David Poll <depoll@fb.com>
- */
-class GraphUser extends GraphObject
-{
-
-  /**
-   * Returns the ID for the user as a string if present.
-   *
-   * @return string|null
-   */
-  public function getId()
-  {
-    return $this->getProperty('id');
-  }
-
-  /**
-   * Returns the name for the user as a string if present.
-   *
-   * @return string|null
-   */
-  public function getName()
-  {
-    return $this->getProperty('name');
-  }
-  
-  public function getEmail()
-  {
-    return $this->getProperty('email');
-  }
-
-  /**
-   * Returns the first name for the user as a string if present.
-   *
-   * @return string|null
-   */
-  public function getFirstName()
-  {
-    return $this->getProperty('first_name');
-  }
-
-  /**
-   * Returns the middle name for the user as a string if present.
-   *
-   * @return string|null
-   */
-  public function getMiddleName()
-  {
-    return $this->getProperty('middle_name');
-  }
-
-  /**
-   * Returns the last name for the user as a string if present.
-   *
-   * @return string|null
-   */
-  public function getLastName()
-  {
-    return $this->getProperty('last_name');
-  }
-  
-  /**
-   * Returns the gender for the user as a string if present.
-   *
-   * @return string|null
-   */
-  public function getGender()
-  {
-    return $this->getProperty('gender');
-  }
-
-  /**
-   * Returns the Facebook URL for the user as a string if available.
-   *
-   * @return string|null
-   */
-  public function getLink()
-  {
-    return $this->getProperty('link');
-  }
-
-  /**
-   * Returns the users birthday, if available.
-   *
-   * @return \DateTime|null
-   */
-  public function getBirthday()
-  {
-    $value = $this->getProperty('birthday');
-    if ($value) {
-      return new \DateTime($value);
-    }
-    return null;
-  }
-
-  /**
-   * Returns the current location of the user as a FacebookGraphLocation
-   *   if available.
-   *
-   * @return GraphLocation|null
-   */
-  public function getLocation()
-  {
-    return $this->getProperty('location', GraphLocation::className());
-  }
-
-}

+ 0 - 84
main/auth/external_login/facebook-php-sdk/src/Facebook/GraphUserPage.php

@@ -1,84 +0,0 @@
-<?php
-/**
- * Copyright 2014 Facebook, Inc.
- *
- * You are hereby granted a non-exclusive, worldwide, royalty-free license to
- * use, copy, modify, and distribute this software in source code or binary
- * form for use in connection with the web services and APIs provided by
- * Facebook.
- *
- * As with any software that integrates with the Facebook platform, your use
- * of this software is subject to the Facebook Developer Principles and
- * Policies [http://developers.facebook.com/policy/]. This copyright notice
- * shall be included in all copies or substantial portions of the software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-namespace Facebook;
-
-/**
- * Class GraphUserPage
- * @package Facebook
- * @author Artur Luiz <artur@arturluiz.com.br>
- */
-class GraphUserPage extends GraphObject
-{
-
-  /**
-   * Returns the ID for the user's page as a string if present.
-   *
-   * @return string|null
-   */
-  public function getId()
-  {
-    return $this->getProperty('id');
-  }
-
-  /**
-   * Returns the Category for the user's page as a string if present.
-   *
-   * @return string|null
-   */
-  public function getCategory()
-  {
-    return $this->getProperty('category');
-  }
-
-  /**
-   * Returns the Name of the user's page as a string if present.
-   *
-   * @return string|null
-   */
-  public function getName()
-  {
-    return $this->getProperty('name');
-  }
-
-  /**
-   * Returns the Access Token used to access the user's page as a string if present.
-   *
-   * @return string|null
-   */
-  public function getAccessToken()
-  {
-    return $this->getProperty('access_token');
-  }
-  
-  /**
-   * Returns the Permissions for the user's page as an array if present.
-   *
-   * @return array|null
-   */
-  public function getPermissions()
-  {
-    return $this->getProperty('perms');
-  }
-
-}

+ 0 - 129
main/auth/external_login/facebook-php-sdk/src/Facebook/HttpClients/FacebookCurl.php

@@ -1,129 +0,0 @@
-<?php
-/**
- * Copyright 2014 Facebook, Inc.
- *
- * You are hereby granted a non-exclusive, worldwide, royalty-free license to
- * use, copy, modify, and distribute this software in source code or binary
- * form for use in connection with the web services and APIs provided by
- * Facebook.
- *
- * As with any software that integrates with the Facebook platform, your use
- * of this software is subject to the Facebook Developer Principles and
- * Policies [http://developers.facebook.com/policy/]. This copyright notice
- * shall be included in all copies or substantial portions of the software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-namespace Facebook\HttpClients;
-
-/**
- * Class FacebookCurl
- * Abstraction for the procedural curl elements so that curl can be mocked
- * and the implementation can be tested.
- * @package Facebook
- */
-class FacebookCurl
-{
-
-  /**
-   * @var resource Curl resource instance
-   */
-  protected $curl;
-
-  /**
-   * Make a new curl reference instance
-   */
-  public function init()
-  {
-    $this->curl = curl_init();
-  }
-
-  /**
-   * Set a curl option
-   *
-   * @param $key
-   * @param $value
-   */
-  public function setopt($key, $value)
-  {
-    curl_setopt($this->curl, $key, $value);
-  }
-
-  /**
-   * Set an array of options to a curl resource
-   *
-   * @param array $options
-   */
-  public function setopt_array(array $options)
-  {
-    curl_setopt_array($this->curl, $options);
-  }
-
-  /**
-   * Send a curl request
-   *
-   * @return mixed
-   */
-  public function exec()
-  {
-    return curl_exec($this->curl);
-  }
-
-  /**
-   * Return the curl error number
-   *
-   * @return int
-   */
-  public function errno()
-  {
-    return curl_errno($this->curl);
-  }
-
-  /**
-   * Return the curl error message
-   *
-   * @return string
-   */
-  public function error()
-  {
-    return curl_error($this->curl);
-  }
-
-  /**
-   * Get info from a curl reference
-   *
-   * @param $type
-   *
-   * @return mixed
-   */
-  public function getinfo($type)
-  {
-    return curl_getinfo($this->curl, $type);
-  }
-
-  /**
-   * Get the currently installed curl version
-   *
-   * @return array
-   */
-  public function version()
-  {
-    return curl_version();
-  }
-
-  /**
-   * Close the resource connection to curl
-   */
-  public function close()
-  {
-    curl_close($this->curl);
-  }
-
-}

+ 0 - 329
main/auth/external_login/facebook-php-sdk/src/Facebook/HttpClients/FacebookCurlHttpClient.php

@@ -1,329 +0,0 @@
-<?php
-/**
- * Copyright 2014 Facebook, Inc.
- *
- * You are hereby granted a non-exclusive, worldwide, royalty-free license to
- * use, copy, modify, and distribute this software in source code or binary
- * form for use in connection with the web services and APIs provided by
- * Facebook.
- *
- * As with any software that integrates with the Facebook platform, your use
- * of this software is subject to the Facebook Developer Principles and
- * Policies [http://developers.facebook.com/policy/]. This copyright notice
- * shall be included in all copies or substantial portions of the software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-namespace Facebook\HttpClients;
-
-use Facebook\FacebookSDKException;
-
-/**
- * Class FacebookCurlHttpClient
- * @package Facebook
- */
-class FacebookCurlHttpClient implements FacebookHttpable
-{
-
-  /**
-   * @var array The headers to be sent with the request
-   */
-  protected $requestHeaders = array();
-
-  /**
-   * @var array The headers received from the response
-   */
-  protected $responseHeaders = array();
-
-  /**
-   * @var int The HTTP status code returned from the server
-   */
-  protected $responseHttpStatusCode = 0;
-
-  /**
-   * @var string The client error message
-   */
-  protected $curlErrorMessage = '';
-
-  /**
-   * @var int The curl client error code
-   */
-  protected $curlErrorCode = 0;
-
-  /**
-   * @var string|boolean The raw response from the server
-   */
-  protected $rawResponse;
-
-  /**
-   * @var FacebookCurl Procedural curl as object
-   */
-  protected static $facebookCurl;
-
-  /**
-   * @var boolean If IPv6 should be disabled
-   */
-  protected static $disableIPv6;
-
-  /**
-   * @const Curl Version which is unaffected by the proxy header length error.
-   */
-  const CURL_PROXY_QUIRK_VER = 0x071E00;
-
-  /**
-   * @const "Connection Established" header text
-   */
-  const CONNECTION_ESTABLISHED = "HTTP/1.0 200 Connection established\r\n\r\n";
-
-  /**
-   * @param FacebookCurl|null Procedural curl as object
-   */
-  public function __construct(FacebookCurl $facebookCurl = null)
-  {
-    self::$facebookCurl = $facebookCurl ?: new FacebookCurl();
-    self::$disableIPv6 = self::$disableIPv6 ?: false;
-  }
-
-  /**
-   * Disable IPv6 resolution
-   */
-  public function disableIPv6()
-  {
-    self::$disableIPv6 = true;
-  }
-
-  /**
-   * The headers we want to send with the request
-   *
-   * @param string $key
-   * @param string $value
-   */
-  public function addRequestHeader($key, $value)
-  {
-    $this->requestHeaders[$key] = $value;
-  }
-
-  /**
-   * The headers returned in the response
-   *
-   * @return array
-   */
-  public function getResponseHeaders()
-  {
-    return $this->responseHeaders;
-  }
-
-  /**
-   * The HTTP status response code
-   *
-   * @return int
-   */
-  public function getResponseHttpStatusCode()
-  {
-    return $this->responseHttpStatusCode;
-  }
-
-  /**
-   * Sends a request to the server
-   *
-   * @param string $url The endpoint to send the request to
-   * @param string $method The request method
-   * @param array  $parameters The key value pairs to be sent in the body
-   *
-   * @return string Raw response from the server
-   *
-   * @throws \Facebook\FacebookSDKException
-   */
-  public function send($url, $method = 'GET', $parameters = array())
-  {
-    $this->openConnection($url, $method, $parameters);
-    $this->tryToSendRequest();
-
-    if ($this->curlErrorCode) {
-      throw new FacebookSDKException($this->curlErrorMessage, $this->curlErrorCode);
-    }
-
-    // Separate the raw headers from the raw body
-    list($rawHeaders, $rawBody) = $this->extractResponseHeadersAndBody();
-
-    $this->responseHeaders = self::headersToArray($rawHeaders);
-
-    $this->closeConnection();
-
-    return $rawBody;
-  }
-
-  /**
-   * Opens a new curl connection
-   *
-   * @param string $url The endpoint to send the request to
-   * @param string $method The request method
-   * @param array  $parameters The key value pairs to be sent in the body
-   */
-  public function openConnection($url, $method = 'GET', $parameters = array())
-  {
-    $options = array(
-      CURLOPT_URL            => $url,
-      CURLOPT_CONNECTTIMEOUT => 10,
-      CURLOPT_TIMEOUT        => 60,
-      CURLOPT_RETURNTRANSFER => true, // Follow 301 redirects
-      CURLOPT_HEADER         => true, // Enable header processing
-      CURLOPT_SSL_VERIFYHOST => 2,
-      CURLOPT_SSL_VERIFYPEER => true,
-      CURLOPT_CAINFO         => __DIR__ . '/certs/DigiCertHighAssuranceEVRootCA.pem',
-    );
-
-    if ($method !== "GET") {
-      $options[CURLOPT_POSTFIELDS] = $parameters;
-    }
-    if ($method === 'DELETE' || $method === 'PUT') {
-      $options[CURLOPT_CUSTOMREQUEST] = $method;
-    }
-
-    if (!empty($this->requestHeaders)) {
-      $options[CURLOPT_HTTPHEADER] = $this->compileRequestHeaders();
-    }
-
-    if (self::$disableIPv6) {
-      $options[CURLOPT_IPRESOLVE] = CURL_IPRESOLVE_V4;
-    }
-
-    self::$facebookCurl->init();
-    self::$facebookCurl->setopt_array($options);
-  }
-
-  /**
-   * Closes an existing curl connection
-   */
-  public function closeConnection()
-  {
-    self::$facebookCurl->close();
-  }
-
-  /**
-   * Try to send the request
-   */
-  public function tryToSendRequest()
-  {
-    $this->sendRequest();
-    $this->curlErrorMessage = self::$facebookCurl->error();
-    $this->curlErrorCode = self::$facebookCurl->errno();
-    $this->responseHttpStatusCode = self::$facebookCurl->getinfo(CURLINFO_HTTP_CODE);
-  }
-
-  /**
-   * Send the request and get the raw response from curl
-   */
-  public function sendRequest()
-  {
-    $this->rawResponse = self::$facebookCurl->exec();
-  }
-
-  /**
-   * Compiles the request headers into a curl-friendly format
-   *
-   * @return array
-   */
-  public function compileRequestHeaders()
-  {
-    $return = array();
-
-    foreach ($this->requestHeaders as $key => $value) {
-      $return[] = $key . ': ' . $value;
-    }
-
-    return $return;
-  }
-
-  /**
-   * Extracts the headers and the body into a two-part array
-   *
-   * @return array
-   */
-  public function extractResponseHeadersAndBody()
-  {
-    $headerSize = self::getHeaderSize();
-
-    $rawHeaders = mb_substr($this->rawResponse, 0, $headerSize);
-    $rawBody = mb_substr($this->rawResponse, $headerSize);
-
-    return array(trim($rawHeaders), trim($rawBody));
-  }
-
-  /**
-   * Converts raw header responses into an array
-   *
-   * @param string $rawHeaders
-   *
-   * @return array
-   */
-  public static function headersToArray($rawHeaders)
-  {
-    $headers = array();
-
-    // Normalize line breaks
-    $rawHeaders = str_replace("\r\n", "\n", $rawHeaders);
-
-    // There will be multiple headers if a 301 was followed
-    // or a proxy was followed, etc
-    $headerCollection = explode("\n\n", trim($rawHeaders));
-    // We just want the last response (at the end)
-    $rawHeader = array_pop($headerCollection);
-
-    $headerComponents = explode("\n", $rawHeader);
-    foreach ($headerComponents as $line) {
-      if (strpos($line, ': ') === false) {
-        $headers['http_code'] = $line;
-      } else {
-        list ($key, $value) = explode(': ', $line);
-        $headers[$key] = $value;
-      }
-    }
-
-    return $headers;
-  }
-
-  /**
-   * Return proper header size
-   *
-   * @return integer
-   */
-  private function getHeaderSize()
-  {
-    $headerSize = self::$facebookCurl->getinfo(CURLINFO_HEADER_SIZE);
-    // This corrects a Curl bug where header size does not account
-    // for additional Proxy headers.
-    if ( self::needsCurlProxyFix() ) {
-      // Additional way to calculate the request body size.
-      if (preg_match('/Content-Length: (\d+)/', $this->rawResponse, $m)) {
-          $headerSize = mb_strlen($this->rawResponse) - $m[1];
-      } elseif (stripos($this->rawResponse, self::CONNECTION_ESTABLISHED) !== false) {
-          $headerSize += mb_strlen(self::CONNECTION_ESTABLISHED);
-      }
-    }
-
-    return $headerSize;
-  }
-
-  /**
-   * Detect versions of Curl which report incorrect header lengths when
-   * using Proxies.
-   *
-   * @return boolean
-   */
-  private static function needsCurlProxyFix()
-  {
-    $ver = self::$facebookCurl->version();
-    $version = $ver['version_number'];
-
-    return $version < self::CURL_PROXY_QUIRK_VER;
-  }
-
-}

+ 0 - 133
main/auth/external_login/facebook-php-sdk/src/Facebook/HttpClients/FacebookGuzzleHttpClient.php

@@ -1,133 +0,0 @@
-<?php
-/**
- * Copyright 2014 Facebook, Inc.
- *
- * You are hereby granted a non-exclusive, worldwide, royalty-free license to
- * use, copy, modify, and distribute this software in source code or binary
- * form for use in connection with the web services and APIs provided by
- * Facebook.
- *
- * As with any software that integrates with the Facebook platform, your use
- * of this software is subject to the Facebook Developer Principles and
- * Policies [http://developers.facebook.com/policy/]. This copyright notice
- * shall be included in all copies or substantial portions of the software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-namespace Facebook\HttpClients;
-
-use Facebook\FacebookSDKException;
-use GuzzleHttp\Client;
-use GuzzleHttp\Exception\AdapterException;
-use GuzzleHttp\Exception\RequestException;
-
-class FacebookGuzzleHttpClient implements FacebookHttpable {
-
-  /**
-   * @var array The headers to be sent with the request
-   */
-  protected $requestHeaders = array();
-
-  /**
-   * @var array The headers received from the response
-   */
-  protected $responseHeaders = array();
-
-  /**
-   * @var int The HTTP status code returned from the server
-   */
-  protected $responseHttpStatusCode = 0;
-
-  /**
-   * @var \GuzzleHttp\Client The Guzzle client
-   */
-  protected static $guzzleClient;
-
-  /**
-   * @param \GuzzleHttp\Client|null The Guzzle client
-   */
-  public function __construct(Client $guzzleClient = null)
-  {
-    self::$guzzleClient = $guzzleClient ?: new Client();
-  }
-
-  /**
-   * The headers we want to send with the request
-   *
-   * @param string $key
-   * @param string $value
-   */
-  public function addRequestHeader($key, $value)
-  {
-    $this->requestHeaders[$key] = $value;
-  }
-
-  /**
-   * The headers returned in the response
-   *
-   * @return array
-   */
-  public function getResponseHeaders()
-  {
-    return $this->responseHeaders;
-  }
-
-  /**
-   * The HTTP status response code
-   *
-   * @return int
-   */
-  public function getResponseHttpStatusCode()
-  {
-    return $this->responseHttpStatusCode;
-  }
-
-  /**
-   * Sends a request to the server
-   *
-   * @param string $url The endpoint to send the request to
-   * @param string $method The request method
-   * @param array  $parameters The key value pairs to be sent in the body
-   *
-   * @return string Raw response from the server
-   *
-   * @throws \Facebook\FacebookSDKException
-   */
-  public function send($url, $method = 'GET', $parameters = array())
-  {
-    $options = array();
-    if ($parameters) {
-      $options = array('body' => $parameters);
-    }
-
-    $options['verify'] = __DIR__ . '/certs/DigiCertHighAssuranceEVRootCA.pem';
-
-    $request = self::$guzzleClient->createRequest($method, $url, $options);
-
-    foreach($this->requestHeaders as $k => $v) {
-      $request->setHeader($k, $v);
-    }
-
-    try {
-      $rawResponse = self::$guzzleClient->send($request);
-    } catch (RequestException $e) {
-      if ($e->getPrevious() instanceof AdapterException) {
-        throw new FacebookSDKException($e->getMessage(), $e->getCode());
-      }
-      $rawResponse = $e->getResponse();
-    }
-
-    $this->responseHttpStatusCode = $rawResponse->getStatusCode();
-    $this->responseHeaders = $rawResponse->getHeaders();
-
-    return $rawResponse->getBody();
-  }
-
-}

+ 0 - 68
main/auth/external_login/facebook-php-sdk/src/Facebook/HttpClients/FacebookHttpable.php

@@ -1,68 +0,0 @@
-<?php
-/**
- * Copyright 2014 Facebook, Inc.
- *
- * You are hereby granted a non-exclusive, worldwide, royalty-free license to
- * use, copy, modify, and distribute this software in source code or binary
- * form for use in connection with the web services and APIs provided by
- * Facebook.
- *
- * As with any software that integrates with the Facebook platform, your use
- * of this software is subject to the Facebook Developer Principles and
- * Policies [http://developers.facebook.com/policy/]. This copyright notice
- * shall be included in all copies or substantial portions of the software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-namespace Facebook\HttpClients;
-
-/**
- * Interface FacebookHttpable
- * @package Facebook
- */
-interface FacebookHttpable
-{
-
-  /**
-   * The headers we want to send with the request
-   *
-   * @param string $key
-   * @param string $value
-   */
-  public function addRequestHeader($key, $value);
-
-  /**
-   * The headers returned in the response
-   *
-   * @return array
-   */
-  public function getResponseHeaders();
-
-  /**
-   * The HTTP status response code
-   *
-   * @return int
-   */
-  public function getResponseHttpStatusCode();
-
-  /**
-   * Sends a request to the server
-   *
-   * @param string $url The endpoint to send the request to
-   * @param string $method The request method
-   * @param array  $parameters The key value pairs to be sent in the body
-   *
-   * @return string Raw response from the server
-   *
-   * @throws \Facebook\FacebookSDKException
-   */
-  public function send($url, $method = 'GET', $parameters = array());
-
-}

+ 0 - 79
main/auth/external_login/facebook-php-sdk/src/Facebook/HttpClients/FacebookStream.php

@@ -1,79 +0,0 @@
-<?php
-/**
- * Copyright 2014 Facebook, Inc.
- *
- * You are hereby granted a non-exclusive, worldwide, royalty-free license to
- * use, copy, modify, and distribute this software in source code or binary
- * form for use in connection with the web services and APIs provided by
- * Facebook.
- *
- * As with any software that integrates with the Facebook platform, your use
- * of this software is subject to the Facebook Developer Principles and
- * Policies [http://developers.facebook.com/policy/]. This copyright notice
- * shall be included in all copies or substantial portions of the software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-namespace Facebook\HttpClients;
-
-/**
- * Class FacebookStream
- * Abstraction for the procedural stream elements so that the functions can be
- * mocked and the implementation can be tested.
- * @package Facebook
- */
-class FacebookStream
-{
-
-  /**
-   * @var resource Context stream resource instance
-   */
-  protected $stream;
-
-  /**
-   * @var array Response headers from the stream wrapper
-   */
-  protected $responseHeaders;
-
-  /**
-   * Make a new context stream reference instance
-   *
-   * @param array $options
-   */
-  public function streamContextCreate(array $options)
-  {
-    $this->stream = stream_context_create($options);
-  }
-
-  /**
-   * The response headers from the stream wrapper
-   *
-   * @return array|null
-   */
-  public function getResponseHeaders()
-  {
-    return $this->responseHeaders;
-  }
-
-  /**
-   * Send a stream wrapped request
-   *
-   * @param string $url
-   *
-   * @return mixed
-   */
-  public function fileGetContents($url)
-  {
-    $rawResponse = file_get_contents($url, false, $this->stream);
-    $this->responseHeaders = $http_response_header;
-    return $rawResponse;
-  }
-
-}

+ 0 - 190
main/auth/external_login/facebook-php-sdk/src/Facebook/HttpClients/FacebookStreamHttpClient.php

@@ -1,190 +0,0 @@
-<?php
-/**
- * Copyright 2014 Facebook, Inc.
- *
- * You are hereby granted a non-exclusive, worldwide, royalty-free license to
- * use, copy, modify, and distribute this software in source code or binary
- * form for use in connection with the web services and APIs provided by
- * Facebook.
- *
- * As with any software that integrates with the Facebook platform, your use
- * of this software is subject to the Facebook Developer Principles and
- * Policies [http://developers.facebook.com/policy/]. This copyright notice
- * shall be included in all copies or substantial portions of the software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-namespace Facebook\HttpClients;
-
-use Facebook\FacebookSDKException;
-
-class FacebookStreamHttpClient implements FacebookHttpable {
-
-  /**
-   * @var array The headers to be sent with the request
-   */
-  protected $requestHeaders = array();
-
-  /**
-   * @var array The headers received from the response
-   */
-  protected $responseHeaders = array();
-
-  /**
-   * @var int The HTTP status code returned from the server
-   */
-  protected $responseHttpStatusCode = 0;
-
-  /**
-   * @var FacebookStream Procedural stream wrapper as object
-   */
-  protected static $facebookStream;
-
-  /**
-   * @param FacebookStream|null Procedural stream wrapper as object
-   */
-  public function __construct(FacebookStream $facebookStream = null)
-  {
-    self::$facebookStream = $facebookStream ?: new FacebookStream();
-  }
-
-  /**
-   * The headers we want to send with the request
-   *
-   * @param string $key
-   * @param string $value
-   */
-  public function addRequestHeader($key, $value)
-  {
-    $this->requestHeaders[$key] = $value;
-  }
-
-  /**
-   * The headers returned in the response
-   *
-   * @return array
-   */
-  public function getResponseHeaders()
-  {
-    return $this->responseHeaders;
-  }
-
-  /**
-   * The HTTP status response code
-   *
-   * @return int
-   */
-  public function getResponseHttpStatusCode()
-  {
-    return $this->responseHttpStatusCode;
-  }
-
-  /**
-   * Sends a request to the server
-   *
-   * @param string $url The endpoint to send the request to
-   * @param string $method The request method
-   * @param array  $parameters The key value pairs to be sent in the body
-   *
-   * @return string Raw response from the server
-   *
-   * @throws \Facebook\FacebookSDKException
-   */
-  public function send($url, $method = 'GET', $parameters = array())
-  {
-    $options = array(
-      'http' => array(
-        'method' => $method,
-        'timeout' => 60,
-        'ignore_errors' => true
-      ),
-      'ssl' => array(
-        'verify_peer' => true,
-        'verify_peer_name' => true,
-        'allow_self_signed' => true, // All root certificates are self-signed
-        'cafile' => __DIR__ . '/certs/DigiCertHighAssuranceEVRootCA.pem',
-      ),
-    );
-
-    if ($parameters) {
-      $options['http']['content'] = http_build_query($parameters, null, '&');
-
-      $this->addRequestHeader('Content-type', 'application/x-www-form-urlencoded');
-    }
-
-    $options['http']['header'] = $this->compileHeader();
-
-    self::$facebookStream->streamContextCreate($options);
-    $rawResponse = self::$facebookStream->fileGetContents($url);
-    $rawHeaders = self::$facebookStream->getResponseHeaders();
-
-    if ($rawResponse === false || !$rawHeaders) {
-      throw new FacebookSDKException('Stream returned an empty response', 660);
-    }
-
-    $this->responseHeaders = self::formatHeadersToArray($rawHeaders);
-    $this->responseHttpStatusCode = self::getStatusCodeFromHeader($this->responseHeaders['http_code']);
-
-    return $rawResponse;
-  }
-
-  /**
-   * Formats the headers for use in the stream wrapper
-   *
-   * @return string
-   */
-  public function compileHeader()
-  {
-    $header = [];
-    foreach($this->requestHeaders as $k => $v) {
-      $header[] = $k . ': ' . $v;
-    }
-
-    return implode("\r\n", $header);
-  }
-
-  /**
-   * Converts array of headers returned from the wrapper into
-   * something standard
-   *
-   * @param array $rawHeaders
-   *
-   * @return array
-   */
-  public static function formatHeadersToArray(array $rawHeaders)
-  {
-    $headers = array();
-
-    foreach ($rawHeaders as $line) {
-      if (strpos($line, ':') === false) {
-        $headers['http_code'] = $line;
-      } else {
-        list ($key, $value) = explode(': ', $line);
-        $headers[$key] = $value;
-      }
-    }
-
-    return $headers;
-  }
-
-  /**
-   * Pulls out the HTTP status code from a response header
-   *
-   * @param string $header
-   *
-   * @return int
-   */
-  public static function getStatusCodeFromHeader($header)
-  {
-    preg_match('|HTTP/\d\.\d\s+(\d+)\s+.*|', $header, $match);
-    return (int) $match[1];
-  }
-
-}

+ 0 - 23
main/auth/external_login/facebook-php-sdk/src/Facebook/HttpClients/certs/DigiCertHighAssuranceEVRootCA.pem

@@ -1,23 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBs
-MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
-d3cuZGlnaWNlcnQuY29tMSswKQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5j
-ZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAwMFoXDTMxMTExMDAwMDAwMFowbDEL
-MAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZMBcGA1UECxMQd3d3
-LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFuY2Ug
-RVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm
-+9S75S0tMqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTW
-PNt0OKRKzE0lgvdKpVMSOO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEM
-xChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFB
-Ik5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQNAQTXKFx01p8VdteZOE3
-hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUeh10aUAsg
-EsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQF
-MAMBAf8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaA
-FLE+w2kD+L9HAdSYJhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3Nec
-nzyIZgYIVyHbIUf4KmeqvxgydkAQV8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6z
-eM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFpmyPInngiK3BD41VHMWEZ71jF
-hS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkKmNEVX58Svnw2
-Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
-vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep
-+OkuE6N36B9K
------END CERTIFICATE-----

+ 142 - 77
main/auth/external_login/facebook.inc.php

@@ -13,19 +13,9 @@
 
 require_once dirname(__FILE__) . '/../../inc/global.inc.php';
 require_once dirname(__FILE__) . '/facebook.init.php';
-require_once dirname(__FILE__) . '/facebook-php-sdk/autoload.php';
-
-use Facebook\FacebookSession;
-use Facebook\FacebookRedirectLoginHelper;
-use Facebook\FacebookRequest;
-use Facebook\FacebookSDKException;
-use Facebook\FacebookRequestException;
 
 require_once dirname(__FILE__) . '/functions.inc.php';
 
-// dont rename $facebook_config to $facebookConfig otherwise get a "Facebook\\FacebookSDKException"
-FacebookSession::setDefaultApplication($facebook_config['appId'], $facebook_config['secret']);
-
 /**
  * This function connect to facebook and retrieves the user info
  * If user does not exist in chamilo, it creates it and logs in
@@ -33,74 +23,144 @@ FacebookSession::setDefaultApplication($facebook_config['appId'], $facebook_conf
  */
 function facebookConnect()
 {
-    global $facebook_config;
-    global $helper;
+    $fb = new \Facebook\Facebook([
+        'app_id' => $GLOBALS['facebook_config']['appId'],
+        'app_secret' => $GLOBALS['facebook_config']['secret'],
+        'default_graph_version' => 'v2.2'
+    ]);
+
+    $helper = $fb->getRedirectLoginHelper();
+
+    try {
+        $accessToken = $helper->getAccessToken();
+    } catch(Facebook\Exceptions\FacebookResponseException $e) {
+        Display::addFlash(
+            Display::return_message('Facebook Graph returned an error: ' . $e->getMessage(), 'error')
+        );
+
+        header('Location: ' . api_get_path(WEB_PATH));
+        exit;
+    } catch(Facebook\Exceptions\FacebookSDKException $e) {
+        Display::addFlash(
+            Display::return_message('Facebook SDK returned an error: ' . $e->getMessage(), 'error')
+        );
+
+        header('Location: ' . api_get_path(WEB_PATH));
+        exit;
+    }
+
+    if (!isset($accessToken)) {
+        if (!$helper->getError()) {
+            return;
+        }
+
+        if (isset($_GET['loginFailed'])) {
+            return;
+        }
+
+        $error = implode('<br>', [
+            'Error: ' . $helper->getError(),
+            'Error Code: ' . $helper->getErrorCode(),
+            'Error Reason: ' . $helper->getErrorReason(),
+            'Error Description: ' . $helper->getErrorDescription()
+        ]);
+
+        Display::addFlash(
+            Display::return_message($error, 'error', false)
+        );
+
+        header('Location: ' . api_get_path(WEB_PATH));
+        exit;
+    }
+
+    $oAuth2Client = $fb->getOAuth2Client();
+    $tokenMetadata = $oAuth2Client->debugToken($accessToken);
+    $tokenMetadata->validateAppId($GLOBALS['facebook_config']['appId']);
+    $tokenMetadata->validateExpiration();
+
+    if (!$accessToken->isLongLived()) {
+        try {
+            $accessToken = $oAuth2Client->getLongLivedAccessToken($accessToken);
+        } catch (Facebook\Exceptions\FacebookSDKException $e) {
+            Display::addFlash(
+                Display::return_message('Error getting long-lived access token: ' . $e->getMessage(), 'error')
+            );
+
+            header('Location: ' . api_get_path(WEB_PATH));
+            exit;
+        }
+    }
 
     try {
-        $helper = new FacebookRedirectLoginHelper($facebook_config['return_url']);
-        $session = $helper->getSessionFromRedirect();
-        // see if we have a session
-        if (isset($session)) {
-            // graph api request for user data
-            $request = new FacebookRequest($session, 'GET', '/me?fields=id,first_name,last_name,email,locale');
-            $response = $request->execute();
-            // get response
-            $graphObject = $response->getGraphObject(Facebook\GraphUser::className());
-            $username = changeToValidChamiloLogin($graphObject->getProperty('email'));
-            $email = $graphObject->getProperty('email');
-            $locale = $graphObject->getProperty('locale');
-            $language = facebookPluginGetLanguage($locale);
-            if (!$language) {
-                $language='en_US';
-            }
-
-            //Checks if user already exists in chamilo
-            $u = array(
-                'firstname' => $graphObject->getProperty('first_name'),
-                'lastname' => $graphObject->getProperty('last_name'),
-                'status' => STUDENT,
-                'email' => $graphObject->getProperty('email'),
-                'username' => $username,
-                'language' => $language,
-                'password' => 'facebook',
-                'auth_source' => 'facebook',
-                // 'courses' => $user_info['courses'],
-                // 'profile_link' => $user_info['profile_link'],
-                // 'worldwide_bu' => $user_info['worlwide_bu'],
-                // 'manager' => $user_info['manager'],
-                'extra' => array()
+        $response = $fb->get('/me?fields=id,first_name,last_name,locale,email', $accessToken->getValue());
+    } catch(Facebook\Exceptions\FacebookResponseException $e) {
+        Display::addFlash(
+            Display::return_message('Graph returned an error: ' . $e->getMessage(), 'error')
+        );
+
+        header('Location: ' . api_get_path(WEB_PATH));
+        exit;
+    } catch(Facebook\Exceptions\FacebookSDKException $e) {
+        Display::addFlash(
+            Display::return_message('Facebook SDK returned an error: ' . $e->getMessage(), 'error')
+        );
+
+        header('Location: ' . api_get_path(WEB_PATH));
+        exit;
+    }
+
+    $user = $response->getGraphUser();
+    $language = facebookPluginGetLanguage($user['locale']);
+
+    if (!$language) {
+        $language = 'en_US';
+    }
+
+    $u = [
+        'firstname' => $user->getFirstName(),
+        'lastname' => $user->getLastName(),
+        'status' => STUDENT,
+        'email' => $user->getEmail(),
+        'username' => changeToValidChamiloLogin($user->getEmail()),
+        'language' => $language,
+        'password' => 'facebook',
+        'auth_source' => 'facebook',
+        'extra' => array()
+    ];
+    $chamiloUinfo = api_get_user_info_from_email($user->getEmail());
+
+    $_user['uidReset'] = true;
+    $_user['language'] = $language;
+
+    if ($chamiloUinfo === false) {
+        // We have to create the user
+        $chamilo_uid = external_add_user($u);
+
+        if ($chamilo_uid === false) {
+            Display::addFlash(
+                Display::return_message(get_lang('UserNotRegistered'), 'error')
             );
 
-            $chamiloUinfo = api_get_user_info_from_email($email);
-            if ($chamiloUinfo === false) {
-                // we have to create the user
-                $chamilo_uid = external_add_user($u);
-                if ($chamilo_uid !== false) {
-                    $_user['user_id'] = $chamilo_uid;
-                    $_user['uidReset'] = true;
-                    $_SESSION['_user'] = $_user;
-                    header('Location:' . api_get_path(WEB_PATH));
-                    exit();
-                } else {
-                    return false;
-                }
-            } else {
-                // User already exists, update info and login
-                $chamilo_uid = $chamiloUinfo['user_id'];
-                $u['user_id'] = $chamilo_uid;
-                external_update_user($u);
-                $_user['user_id'] = $chamilo_uid;
-                $_user['uidReset'] = true;
-                $_SESSION['_user'] = $_user;
-                header('Location:' . api_get_path(WEB_PATH));
-                exit();
-            }
+            header('Location: ' . api_get_path(WEB_PATH));
+            exit;
         }
-    } catch (FacebookRequestException $ex) {
-        echo $ex;
-    } catch (Exception $ex) {
-        // When validation fails or other local issues
+
+        $_user['user_id'] = $chamilo_uid;
+        $_SESSION['_user'] = $_user;
+
+        header('Location: ' . api_get_path(WEB_PATH));
+        exit();
     }
+
+    // User already exists, update info and login
+    $chamilo_uid = $chamiloUinfo['user_id'];
+    $u['user_id'] = $chamilo_uid;
+    external_update_user($u);
+    $_user['user_id'] = $chamilo_uid;
+    $_SESSION['_user'] = $_user;
+
+    header('Location: ' . api_get_path(WEB_PATH));
+    exit();
 }
 
 /**
@@ -109,11 +169,16 @@ function facebookConnect()
  */
 function facebookGetLoginUrl()
 {
-    global $facebook_config;
-    $helper = new FacebookRedirectLoginHelper($facebook_config['return_url']);
-    $loginUrl =   $helper->getLoginUrl(
-        array('scope' => 'email')
-    );
+    $fb = new \Facebook\Facebook([
+        'app_id' => $GLOBALS['facebook_config']['appId'],
+        'app_secret' => $GLOBALS['facebook_config']['secret'],
+        'default_graph_version' => 'v2.2'
+    ]);
+
+    $helper = $fb->getRedirectLoginHelper();
+    $loginUrl = $helper->getLoginUrl(api_get_path(WEB_PATH) . '?action=fbconnect', [
+        'email'
+    ]);
 
     return $loginUrl;
 }

+ 8 - 12
main/badge/assign.php

@@ -43,14 +43,13 @@ $skills = $skillRepo->findBy([
 
 $url = api_get_path(WEB_CODE_PATH)."badge/assign.php?user=".$_REQUEST['user']."&id=";
 
-$htmlHeadXtra[] = ''
-    . '<script>'
-        . '$( document ).ready(function() {'
-            . '$("#skill").on("change", function() {'
-                . '$(location).attr("href", "'. $url .'"+$(this).val());'
-            . '});'
-        . '});'
-    . '</script>';
+$htmlHeadXtra[] = '<script>
+$( document ).ready(function() {
+    $("#skill").on("change", function() {
+        $(location).attr("href", "'. $url .'"+$(this).val());
+    });
+});
+</script>';
 
 $skillsOptions = [];
 $acquiredLevel = [];
@@ -87,9 +86,7 @@ if (!$profile) {
 }
 
 if ($profile) {
-
     $profileId = $profile->getId();
-
     $levels = $skillLevelRepo->findBy([
         'profile' => $profileId
     ]);
@@ -175,8 +172,7 @@ if ($form->validate()) {
 $form->setDefaults(['user_name' => $user->getCompleteName()]);
 $form->freeze(['user_name']);
 
-//View
 $template = new Template('');
 $template->assign('header', get_lang('AssignSkill'));
 $template->assign('content', $form->returnForm());
-$template->display_one_col_template();
+$template->display_one_col_template();

+ 0 - 1
main/badge/issued.php

@@ -7,7 +7,6 @@
  * @package chamilo.badge
  */
 require_once '../inc/global.inc.php';
-require_once '../inc/lib/baker.lib.php';
 
 $issue = isset($_REQUEST['issue']) ? intval($_REQUEST['issue']) : 0;
 

+ 6 - 6
main/badge/issued_all.php

@@ -7,7 +7,6 @@
  * @package chamilo.badge
  */
 require_once '../inc/global.inc.php';
-require_once '../inc/lib/baker.lib.php';
 
 $userId = isset($_GET['user']) ? intval($_GET['user']) : 0;
 $skillId = isset($_GET['skill']) ? intval($_GET['skill']) : 0;
@@ -132,9 +131,7 @@ foreach ($userSkills as $index => $skillIssue) {
     }
 
     if ($profile) {
-
         $profileId = $profile->getId();
-
         $levels = $skillLevelRepo->findBy([
             'profile' => $profileId
         ]);
@@ -149,10 +146,13 @@ foreach ($userSkills as $index => $skillIssue) {
             $profileId = key($profileLevel);
             $acquiredLevel[$profileId] = $profileLevel[$profileId];
         }
-
     }
 
-    $formAcquiredLevel = new FormValidator('acquired_level'.$skillIssue->getId(), 'post', $skillIssue->getIssueUrlAll());
+    $formAcquiredLevel = new FormValidator(
+        'acquired_level'.$skillIssue->getId(), 
+        'post', 
+        $skillIssue->getIssueUrlAll()
+    );
     $formAcquiredLevel->addSelect('acquired_level', get_lang('AcquiredLevel'), $acquiredLevel);
     $formAcquiredLevel->addHidden('user', $skillIssue->getUser()->getId());
     $formAcquiredLevel->addHidden('issue', $skillIssue->getId());
@@ -161,7 +161,7 @@ foreach ($userSkills as $index => $skillIssue) {
     if ($formAcquiredLevel->validate() && $allowComment) {
         $values = $formAcquiredLevel->exportValues();
 
-        $level = $skillLevelRepo->find(intval($values['acquired_level']));
+        $level = $skillLevelRepo->find($values['acquired_level']);
         $skillIssue->setAcquiredLevel($level);
 
         $entityManager->persist($skillIssue);

+ 7 - 4
main/exercise/export/scorm/scorm_classes.php

@@ -173,10 +173,10 @@ class ScormQuestion extends Question
 
         switch ($this->type) {
             case ORAL_EXPRESSION:
-                $script = file_get_contents(api_get_path(LIBRARY_PATH) . 'javascript/rtc/RecordRTC.js');
+                /*$script = file_get_contents(api_get_path(LIBRARY_PATH) . 'javascript/rtc/RecordRTC.js');
                 $script .= file_get_contents(api_get_path(LIBRARY_PATH) . 'wami-recorder/recorder.js');
                 $script .= file_get_contents(api_get_path(LIBRARY_PATH) . 'wami-recorder/gui.js');
-                $js .= $script;
+                $js .= $script;*/
                 break;
            case HOT_SPOT:
                 //put the max score to 0 to avoid discounting the points of
@@ -544,20 +544,23 @@ class ScormAnswerFree extends Answer
 	function export()
 	{
 		$js = '';
-
         $identifier = 'question_'.$this->questionJSId.'_free';
 		// currently the free answers cannot be displayed, so ignore the textarea
 		$html = '<tr><td colspan="2">';
         $type = $this->getQuestionType();
 
         if ($type == ORAL_EXPRESSION) {
+            /*
             $template = new Template('');
             $template->assign('directory', '/tmp/');
             $template->assign('user_id', api_get_user_id());
 
             $layout = $template->get_template('document/record_audio.tpl');
-            $html .= $template->fetch($layout);
+            $html .= $template->fetch($layout);*/
+
+			$html = '<tr><td colspan="2">'.get_lang('ThisItemIsNotExportable').'</td></tr>';
 
+            return array($js, $html);
         }
 
         $html .= '<textarea minlength="20" name="'.$identifier.'" id="'.$identifier.'" ></textarea>';

+ 2 - 2
main/exercise/tests_category.php

@@ -250,12 +250,12 @@ function displayActionBar()
         Display::return_icon('question_category.gif', get_lang('AddACategory')) . '</a>';
 
     echo Display::url(
-        Display::return_icon('export_csv.png', get_lang('ExportAsCSV')),
+        Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), [], ICON_SIZE_MEDIUM),
         api_get_self() . '?action=export_category&'.api_get_cidreq()
     );
 
     echo Display::url(
-        Display::return_icon('import_csv.png', get_lang('ImportAsCSV')),
+        Display::return_icon('import_csv.png', get_lang('ImportAsCSV'), [], ICON_SIZE_MEDIUM),
         api_get_self() . '?action=import_category&'.api_get_cidreq()
     );
 

+ 1 - 1
main/inc/lib/diagnoser.lib.php

@@ -28,7 +28,7 @@ class Diagnoser
     public function show_html()
     {
         $sections = array('chamilo', 'php', 'database', 'webserver');
-
+        $currentSection = isset($_GET['section']) ? $_GET['section'] : '';
         if (!in_array(trim($currentSection), $sections)) {
             $currentSection = 'chamilo';
         }

+ 31 - 0
main/inc/lib/extra_field.lib.php

@@ -2603,4 +2603,35 @@ JAVASCRIPT;
 
         return Database::store_result($result, 'ASSOC');
     }
+
+    /**
+     * @param int $fieldId
+     * @param int $tagId
+     *
+     * @return array
+     */
+    public function getAllSkillPerTag($fieldId, $tagId)
+    {
+        $skillTable = Database::get_main_table(TABLE_MAIN_SKILL);
+        $tagRelXtraTable = Database::get_main_table(TABLE_MAIN_EXTRA_FIELD_REL_TAG);
+        $fieldId = intval($fieldId);
+        $tagId = intval($tagId);
+
+        $sql = "SELECT s.id
+                FROM $skillTable s INNER JOIN $tagRelXtraTable t
+                ON t.item_id = s.id
+                WHERE tag_id = $tagId AND t.field_id = $fieldId;
+        ";
+
+        $result = Database::query($sql);
+        $result = Database::store_result($result, 'ASSOC');
+
+        $skillList = [];
+
+        foreach ($result as $index => $value) {
+            $skillList[$value['id']] = $value['id'];
+        }
+
+        return $skillList;
+    }
 }

+ 231 - 165
main/inc/lib/message.lib.php

@@ -24,7 +24,7 @@ class MessageManager
         $userlist = who_is_online(0, $count, null, null, 30, true);
         $online_user_list = array();
         foreach ($userlist as $user_id) {
-            $online_user_list[$user_id] = GetFullUserName($user_id).($current_user_id == $user_id ? ("&nbsp;(".get_lang('Myself').")") : (""));
+            $online_user_list[$user_id] = GetFullUserName($user_id) . ($current_user_id == $user_id ? ("&nbsp;(" . get_lang('Myself') . ")") : (""));
         }
 
         return $online_user_list;
@@ -40,20 +40,20 @@ class MessageManager
             $_SESSION['social_exist'] === true
         ) {
             if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_message_tool') == 'true') {
-                $success = get_lang('MessageSentTo').
-                    "&nbsp;<b>".
-                    GetFullUserName($uid).
+                $success = get_lang('MessageSentTo') .
+                    "&nbsp;<b>" .
+                    GetFullUserName($uid) .
                     "</b>";
             } else {
-                $success = get_lang('MessageSentTo').
-                    "&nbsp;<b>".
-                    GetFullUserName($uid).
+                $success = get_lang('MessageSentTo') .
+                    "&nbsp;<b>" .
+                    GetFullUserName($uid) .
                     "</b>";
             }
         } else {
-            $success = get_lang('MessageSentTo').
-                "&nbsp;<b>".
-                GetFullUserName($uid).
+            $success = get_lang('MessageSentTo') .
+                "&nbsp;<b>" .
+                GetFullUserName($uid) .
                 "</b>";
         }
 
@@ -72,8 +72,8 @@ class MessageManager
         }
         $sql = "SELECT * FROM $table
                 WHERE
-                    user_receiver_id=".api_get_user_id()." AND
-                    msg_status=".MESSAGE_STATUS_UNREAD;
+                    user_receiver_id=" . api_get_user_id() . " AND
+                    msg_status=" . MESSAGE_STATUS_UNREAD;
         $result = Database::query($sql);
         $i = Database::num_rows($result);
 
@@ -102,9 +102,9 @@ class MessageManager
     {
         $table_message = Database::get_main_table(TABLE_MESSAGE);
         if ($unread) {
-            $condition_msg_status = ' msg_status = '.MESSAGE_STATUS_UNREAD.' ';
+            $condition_msg_status = ' msg_status = ' . MESSAGE_STATUS_UNREAD . ' ';
         } else {
-            $condition_msg_status = ' msg_status IN('.MESSAGE_STATUS_NEW.','.MESSAGE_STATUS_UNREAD.') ';
+            $condition_msg_status = ' msg_status IN(' . MESSAGE_STATUS_NEW . ',' . MESSAGE_STATUS_UNREAD . ') ';
         }
 
         $keyword = Session::read('message_search_keyword');
@@ -117,7 +117,7 @@ class MessageManager
         $sql = "SELECT COUNT(*) as number_messages
                 FROM $table_message
                 WHERE $condition_msg_status AND
-                    user_receiver_id=".api_get_user_id()."
+                    user_receiver_id=" . api_get_user_id() . "
                     $keywordCondition
                 ";
         $result = Database::query($sql);
@@ -159,7 +159,7 @@ class MessageManager
         $sql = "SELECT id as col0, user_sender_id as col1, title as col2, send_date as col3, msg_status as col4
                 FROM $table_message
                 WHERE
-                  user_receiver_id=".api_get_user_id()." AND
+                  user_receiver_id=" . api_get_user_id() . " AND
                   msg_status IN (0,1)
                   $keywordCondition
                 ORDER BY col$column $direction
@@ -183,9 +183,9 @@ class MessageManager
             if (isset($_GET['f']) && $_GET['f'] == 'social') {
                 $link = '&f=social';
             }
-            $message[1] = '<a '.$class.' href="view_message.php?id='.$result[0].$link.'">'.$result[2].'</a><br />'.GetFullUserName(($result[1]));
-            $message[3] = '<a href="new_message.php?re_id='.$result[0].$link.'">'.Display::return_icon('message_reply.png', get_lang('ReplyToMessage')).'</a>'.
-                '&nbsp;&nbsp;<a onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmDeleteMessage')))."'".')) return false;" href="inbox.php?action=deleteone&id='.$result[0].$link.'">'.Display::return_icon('delete.png', get_lang('DeleteMessage')).'</a>';
+            $message[1] = '<a ' . $class . ' href="view_message.php?id=' . $result[0] . $link . '">' . $result[2] . '</a><br />' . GetFullUserName(($result[1]));
+            $message[3] = '<a href="new_message.php?re_id=' . $result[0] . $link . '">' . Display::return_icon('message_reply.png', get_lang('ReplyToMessage')) . '</a>' .
+                '&nbsp;&nbsp;<a onclick="javascript:if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang('ConfirmDeleteMessage'))) . "'" . ')) return false;" href="inbox.php?action=deleteone&id=' . $result[0] . $link . '">' . Display::return_icon('delete.png', get_lang('DeleteMessage')) . '</a>';
 
             $message[2] = api_convert_and_format_date($result[3], DATE_TIME_FORMAT_LONG); //date stays the same
             foreach ($message as $key => $value) {
@@ -201,16 +201,16 @@ class MessageManager
     /**
      * Sends a message to a user/group
      *
-     * @param int 	  $receiver_user_id
-     * @param string  $subject
-     * @param string  $content
-     * @param array   $file_attachments files array($_FILES) (optional)
-     * @param array   $file_comments about attachment files (optional)
-     * @param int     $group_id (optional)
-     * @param int     $parent_id (optional)
-     * @param int 	  $edit_message_id id for updating the message (optional)
-     * @param int     $topic_id (optional) the default value is the current user_id
-     * @param int     $sender_id
+     * @param int $receiver_user_id
+     * @param string $subject
+     * @param string $content
+     * @param array $file_attachments files array($_FILES) (optional)
+     * @param array $file_comments about attachment files (optional)
+     * @param int $group_id (optional)
+     * @param int $parent_id (optional)
+     * @param int $edit_message_id id for updating the message (optional)
+     * @param int $topic_id (optional) the default value is the current user_id
+     * @param int $sender_id
      * @param bool $directMessage
      *
      * @return bool
@@ -227,7 +227,8 @@ class MessageManager
         $topic_id = 0,
         $sender_id = null,
         $directMessage = false
-    ) {
+    )
+    {
         $table_message = Database::get_main_table(TABLE_MESSAGE);
         $group_id = intval($group_id);
         $receiver_user_id = intval($receiver_user_id);
@@ -287,7 +288,7 @@ class MessageManager
             //@todo it's possible to edit a message? yes, only for groups
             if ($edit_message_id) {
                 $query = " UPDATE $table_message SET
-                                update_date = '".$now."',
+                                update_date = '" . $now . "',
                                 content = '$clean_content'
                            WHERE id = '$edit_message_id' ";
                 Database::query($query);
@@ -434,7 +435,8 @@ class MessageManager
         $sender_id = null,
         $sendCopyToDrhUsers = false,
         $directMessage = false
-    ) {
+    )
+    {
         $result = MessageManager::send_message(
             $receiver_user_id,
             $subject,
@@ -458,7 +460,7 @@ class MessageManager
                     $message = sprintf(
                             get_lang('CopyOfMessageSentToXUser'),
                             $userInfo['complete_name']
-                        ).' <br />'.$message;
+                        ) . ' <br />' . $message;
 
                     MessageManager::send_message_simple(
                         $drhInfo['user_id'],
@@ -478,9 +480,9 @@ class MessageManager
     /**
      * Update parent ids for other receiver user from current message in groups
      * @author Christian Fasanando Flores
-     * @param  int	$parent_id
-     * @param  int	$receiver_user_id
-     * @param  int	$message_id
+     * @param  int $parent_id
+     * @param  int $receiver_user_id
+     * @param  int $message_id
      * @return void
      */
     public static function update_parent_ids_from_reply($parent_id, $receiver_user_id, $message_id)
@@ -506,7 +508,7 @@ class MessageManager
         $row = Database::fetch_array($rs_msg_id);
 
         // update parent_id for other user receiver
-        $sql = "UPDATE $table_message SET parent_id = ".$row['id']."
+        $sql = "UPDATE $table_message SET parent_id = " . $row['id'] . "
                 WHERE id = $message_id";
         Database::query($sql);
     }
@@ -524,7 +526,7 @@ class MessageManager
         $user_receiver_id = intval($user_receiver_id);
         $id = intval($id);
         $sql = "SELECT * FROM $table_message
-                WHERE id=".$id." AND msg_status<>4";
+                WHERE id=" . $id . " AND msg_status<>4";
         $rs = Database::query($sql);
 
         if (Database::num_rows($rs) > 0) {
@@ -532,7 +534,7 @@ class MessageManager
             self::delete_message_attachment_file($id, $user_receiver_id);
             // delete message
             $query = "UPDATE $table_message SET msg_status=3
-                      WHERE user_receiver_id=".$user_receiver_id." AND id=".$id;
+                      WHERE user_receiver_id=" . $user_receiver_id . " AND id=" . $id;
             $result = Database::query($query);
             return $result;
         } else {
@@ -577,12 +579,12 @@ class MessageManager
 
     /**
      * Saves a message attachment files
-     * @param  array 	$file_attach $_FILES['name']
-     * @param  string  	a comment about the uploaded file
-     * @param  int		message id
-     * @param  int		receiver user id (optional)
-     * @param  int		sender user id (optional)
-     * @param  int		group id (optional)
+     * @param  array $file_attach $_FILES['name']
+     * @param  string    a comment about the uploaded file
+     * @param  int        message id
+     * @param  int        receiver user id (optional)
+     * @param  int        sender user id (optional)
+     * @param  int        group id (optional)
      * @return void
      */
     public static function save_message_attachment_file(
@@ -592,7 +594,8 @@ class MessageManager
         $receiver_user_id = 0,
         $sender_user_id = 0,
         $group_id = 0
-    ) {
+    )
+    {
         $tbl_message_attach = Database::get_main_table(TABLE_MESSAGE_ATTACHMENT);
 
         // Try to add an extension to the file if it hasn't one
@@ -601,7 +604,7 @@ class MessageManager
         // user's file name
         $file_name = $file_attach['name'];
         if (!filter_extension($new_file_name)) {
-            Display :: display_error_message(get_lang('UplUnableToSaveFileFilteredExtension'));
+            Display:: display_error_message(get_lang('UplUnableToSaveFileFilteredExtension'));
         } else {
             $new_file_name = uniqid('');
             if (!empty($receiver_user_id)) {
@@ -619,13 +622,13 @@ class MessageManager
                 $path_user_info['dir'] = UserManager::getUserPathById($message_user_id, 'system');
             }
 
-            $path_message_attach = $path_user_info['dir'].'message_attachments/';
+            $path_message_attach = $path_user_info['dir'] . 'message_attachments/';
 
             // If this directory does not exist - we create it.
             if (!file_exists($path_message_attach)) {
                 @mkdir($path_message_attach, api_get_permissions_for_new_directories(), true);
             }
-            $new_path = $path_message_attach.$new_file_name;
+            $new_path = $path_message_attach . $new_file_name;
             if (is_uploaded_file($file_attach['tmp_name'])) {
                 @copy($file_attach['tmp_name'], $new_path);
             }
@@ -644,9 +647,9 @@ class MessageManager
 
     /**
      * Delete message attachment files (logically updating the row with a suffix _DELETE_id)
-     * @param  int	message id
-     * @param  int	message user id (receiver user id or sender user id)
-     * @param  int	group id (optional)
+     * @param  int    message id
+     * @param  int    message user id (receiver user id or sender user id)
+     * @param  int    group id (optional)
      * @return void
      */
     public static function delete_message_attachment_file($message_id, $message_uid, $group_id = 0)
@@ -660,7 +663,7 @@ class MessageManager
         while ($row = Database::fetch_array($rs)) {
             $path = $row['path'];
             $attach_id = $row['id'];
-            $new_path = $path.'_DELETED_'.$attach_id;
+            $new_path = $path . '_DELETED_' . $attach_id;
 
             if (!empty($group_id)) {
                 $userGroup = new UserGroup();
@@ -676,9 +679,9 @@ class MessageManager
                 );
             }
 
-            $path_message_attach = $path_user_info['dir'].'message_attachments/';
-            if (is_file($path_message_attach.$path)) {
-                if (rename($path_message_attach.$path, $path_message_attach.$new_path)) {
+            $path_message_attach = $path_user_info['dir'] . 'message_attachments/';
+            if (is_file($path_message_attach . $path)) {
+                if (rename($path_message_attach . $path, $path_message_attach . $new_path)) {
                     $sql = "UPDATE $table_message_attach set path='$new_path'
                             WHERE id ='$attach_id'";
                     Database::query($sql);
@@ -689,8 +692,8 @@ class MessageManager
 
     /**
      * update messages by user id and message id
-     * @param  int		$user_id
-     * @param  int		$message_id
+     * @param  int $user_id
+     * @param  int $message_id
      * @return resource
      */
     public static function update_message($user_id, $message_id)
@@ -702,8 +705,8 @@ class MessageManager
         $sql = "UPDATE $table_message SET msg_status = '0'
                 WHERE
                     msg_status<>4 AND
-                    user_receiver_id=".intval($user_id)." AND
-                    id='".intval($message_id)."'";
+                    user_receiver_id=" . intval($user_id) . " AND
+                    id='" . intval($message_id) . "'";
         Database::query($sql);
     }
 
@@ -713,7 +716,7 @@ class MessageManager
      * @param string $type
      * @return bool
      */
-    public static function update_message_status($user_id, $message_id,$type)
+    public static function update_message_status($user_id, $message_id, $type)
     {
         $type = intval($type);
         if ($message_id != strval(intval($message_id)) || $user_id != strval(intval($user_id))) {
@@ -723,15 +726,15 @@ class MessageManager
         $sql = "UPDATE $table_message SET
                     msg_status = '$type'
                 WHERE
-                    user_receiver_id=".intval($user_id)." AND
-                    id='".intval($message_id)."'";
+                    user_receiver_id=" . intval($user_id) . " AND
+                    id='" . intval($message_id) . "'";
         Database::query($sql);
     }
 
     /**
      * get messages by user id and message id
-     * @param  int		$user_id
-     * @param  int		$message_id
+     * @param  int $user_id
+     * @param  int $message_id
      * @return array
      */
     public static function get_message_by_user($user_id, $message_id)
@@ -740,14 +743,14 @@ class MessageManager
             return false;
         $table_message = Database::get_main_table(TABLE_MESSAGE);
         $query = "SELECT * FROM $table_message
-                  WHERE user_receiver_id=".intval($user_id)." AND id='".intval($message_id)."'";
+                  WHERE user_receiver_id=" . intval($user_id) . " AND id='" . intval($message_id) . "'";
         $result = Database::query($query);
         return $row = Database::fetch_array($result);
     }
 
     /**
      * get messages by group id
-     * @param  int		group id
+     * @param  int        group id
      * @return array
      */
     public static function get_messages_by_group($group_id)
@@ -760,7 +763,7 @@ class MessageManager
         $sql = "SELECT * FROM $table_message
                 WHERE
                     group_id= $group_id AND
-                    msg_status NOT IN ('".MESSAGE_STATUS_OUTBOX."', '".MESSAGE_STATUS_DELETED."')
+                    msg_status NOT IN ('" . MESSAGE_STATUS_OUTBOX . "', '" . MESSAGE_STATUS_DELETED . "')
                 ORDER BY id";
         $rs = Database::query($sql);
         $data = array();
@@ -787,7 +790,7 @@ class MessageManager
         $sql = "SELECT * FROM $table_message
                 WHERE
                     group_id = $group_id AND
-                    msg_status NOT IN ('".MESSAGE_STATUS_OUTBOX."', '".MESSAGE_STATUS_DELETED."')
+                    msg_status NOT IN ('" . MESSAGE_STATUS_OUTBOX . "', '" . MESSAGE_STATUS_DELETED . "')
                 ORDER BY id ";
 
         $rs = Database::query($sql);
@@ -807,10 +810,10 @@ class MessageManager
 
     /**
      * get messages by parent id optionally with limit
-     * @param  int		parent id
-     * @param  int		group id (optional)
-     * @param  int		offset (optional)
-     * @param  int		limit (optional)
+     * @param  int        parent id
+     * @param  int        group id (optional)
+     * @param  int        offset (optional)
+     * @param  int        limit (optional)
      * @return array
      */
     public static function get_messages_by_parent($parent_id, $group_id = '', $offset = 0, $limit = 0)
@@ -836,7 +839,7 @@ class MessageManager
         $sql = "SELECT * FROM $table_message
                 WHERE
                     parent_id='$parent_id' AND
-                    msg_status <> ".MESSAGE_STATUS_OUTBOX."
+                    msg_status <> " . MESSAGE_STATUS_OUTBOX . "
                     $condition_group_id
                 ORDER BY send_date DESC $condition_limit ";
         $rs = Database::query($sql);
@@ -864,8 +867,8 @@ class MessageManager
         $table_message = Database::get_main_table(TABLE_MESSAGE);
         $query = "SELECT id FROM $table_message
                   WHERE
-                    user_receiver_id = ".intval($user_id)." AND
-                    id = '".intval($id)."'";
+                    user_receiver_id = " . intval($user_id) . " AND
+                    id = '" . intval($id) . "'";
         $result = Database::query($query);
         $num = Database::num_rows($result);
         if ($num > 0) {
@@ -908,8 +911,8 @@ class MessageManager
                     id as col0, user_sender_id as col1, title as col2, send_date as col3, user_receiver_id as col4, msg_status as col5
                 FROM $table_message
                 WHERE
-                    user_sender_id=".api_get_user_id()." AND
-                    msg_status=".MESSAGE_STATUS_OUTBOX."
+                    user_sender_id=" . api_get_user_id() . " AND
+                    msg_status=" . MESSAGE_STATUS_OUTBOX . "
                     $keywordCondition
                 ORDER BY col$column $direction
                 LIMIT $from, $number_of_items";
@@ -918,7 +921,7 @@ class MessageManager
         $message_list = array();
         while ($result = Database::fetch_row($sql_result)) {
             if ($request === true) {
-                $message[0] = '<input type="checkbox" value='.$result[0].' name="out[]">';
+                $message[0] = '<input type="checkbox" value=' . $result[0] . ' name="out[]">';
             } else {
                 $message[0] = ($result[0]);
             }
@@ -926,20 +929,20 @@ class MessageManager
             $result[2] = Security::remove_XSS($result[2]);
 
             if ($request === true) {
-                $message[1] = '<a onclick="show_sent_message('.$result[0].')" href="javascript:void(0)">'.GetFullUserName($result[4]).'</a>';
-                $message[2] = '<a onclick="show_sent_message('.$result[0].')" href="javascript:void(0)">'.str_replace("\\", "", $result[2]).'</a>';
+                $message[1] = '<a onclick="show_sent_message(' . $result[0] . ')" href="javascript:void(0)">' . GetFullUserName($result[4]) . '</a>';
+                $message[2] = '<a onclick="show_sent_message(' . $result[0] . ')" href="javascript:void(0)">' . str_replace("\\", "", $result[2]) . '</a>';
                 $message[3] = api_convert_and_format_date($result[3], DATE_TIME_FORMAT_LONG); //date stays the same
 
-                $message[4] = '&nbsp;&nbsp;<a onclick="delete_one_message_outbox('.$result[0].')" href="javascript:void(0)"  >'.Display::return_icon('delete.png', get_lang('DeleteMessage')).'</a>';
+                $message[4] = '&nbsp;&nbsp;<a onclick="delete_one_message_outbox(' . $result[0] . ')" href="javascript:void(0)"  >' . Display::return_icon('delete.png', get_lang('DeleteMessage')) . '</a>';
             } else {
                 $link = '';
                 if (isset($_GET['f']) && $_GET['f'] == 'social') {
                     $link = '&f=social';
                 }
-                $message[1] = '<a '.$class.' onclick="show_sent_message ('.$result[0].')" href="../messages/view_message.php?id_send='.$result[0].$link.'">'.$result[2].'</a><br />'.GetFullUserName($result[4]);
+                $message[1] = '<a ' . $class . ' onclick="show_sent_message (' . $result[0] . ')" href="../messages/view_message.php?id_send=' . $result[0] . $link . '">' . $result[2] . '</a><br />' . GetFullUserName($result[4]);
                 //$message[2] = '<a '.$class.' onclick="show_sent_message ('.$result[0].')" href="../messages/view_message.php?id_send='.$result[0].$link.'">'.$result[2].'</a>';
                 $message[2] = api_convert_and_format_date($result[3], DATE_TIME_FORMAT_LONG); //date stays the same
-                $message[3] = '<a href="outbox.php?action=deleteone&id='.$result[0].'&'.$link.'"  onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmDeleteMessage')))."'".')) return false;" >'.Display::return_icon('delete.png', get_lang('DeleteMessage')).'</a>';
+                $message[3] = '<a href="outbox.php?action=deleteone&id=' . $result[0] . '&' . $link . '"  onclick="javascript:if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang('ConfirmDeleteMessage'))) . "'" . ')) return false;" >' . Display::return_icon('delete.png', get_lang('DeleteMessage')) . '</a>';
             }
 
             foreach ($message as $key => $value) {
@@ -971,8 +974,8 @@ class MessageManager
 
         $sql = "SELECT COUNT(*) as number_messages FROM $table_message
                 WHERE
-                  msg_status=".MESSAGE_STATUS_OUTBOX." AND
-                  user_sender_id=".api_get_user_id()."
+                  msg_status=" . MESSAGE_STATUS_OUTBOX . " AND
+                  user_sender_id=" . api_get_user_id() . "
                   $keywordCondition
                 ";
         $result = Database::query($sql);
@@ -997,25 +1000,25 @@ class MessageManager
             if (isset($message_id) && is_numeric($message_id)) {
                 $query = "SELECT * FROM $table_message
                           WHERE
-                            user_sender_id = ".api_get_user_id()." AND
-                            id = ".$message_id." AND
+                            user_sender_id = " . api_get_user_id() . " AND
+                            id = " . $message_id . " AND
                             msg_status = 4;";
                 $result = Database::query($query);
             }
         } else {
             if (is_numeric($message_id) && !empty($message_id)) {
                 $query = "UPDATE $table_message SET
-                          msg_status = '".MESSAGE_STATUS_NEW."'
+                          msg_status = '" . MESSAGE_STATUS_NEW . "'
                           WHERE
-                            user_receiver_id=".api_get_user_id()." AND
-                            id='".$message_id."'";
+                            user_receiver_id=" . api_get_user_id() . " AND
+                            id='" . $message_id . "'";
                 Database::query($query);
 
                 $query = "SELECT * FROM $table_message
                           WHERE
                             msg_status<>4 AND
-                            user_receiver_id=".api_get_user_id()." AND
-                            id='".$message_id."'";
+                            user_receiver_id=" . api_get_user_id() . " AND
+                            id='" . $message_id . "'";
                 $result = Database::query($query);
             }
         }
@@ -1042,7 +1045,7 @@ class MessageManager
 
         $receiverUserInfo = api_get_user_info($row['user_receiver_id']);
 
-        $message_content .='<tr>';
+        $message_content .= '<tr>';
         if (api_get_setting('allow_social_tool') == 'true') {
             $message_content .= '<div class="row">';
 
@@ -1052,8 +1055,8 @@ class MessageManager
                 $message_content .= '</div>';
 
                 $message_content .= '<div class="col-md-4">';
-                $message_content .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$user_sender_id.'">'.$name.'</a> ';
-                $message_content .= api_strtolower(get_lang('To')).'&nbsp;<b>'.$receiverUserInfo['complete_name'];
+                $message_content .= '<a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php?u=' . $user_sender_id . '">' . $name . '</a> ';
+                $message_content .= api_strtolower(get_lang('To')) . '&nbsp;<b>' . $receiverUserInfo['complete_name'];
                 $message_content .= '</div>';
 
                 $message_content .= '<div class="col-md-2 col-md-offset-5">';
@@ -1066,7 +1069,7 @@ class MessageManager
                 $message_content .= '</div>';
 
                 $message_content .= '<div class="col-md-4">';
-                $message_content .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$user_sender_id.'">'.$name.'</a> ';
+                $message_content .= '<a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php?u=' . $user_sender_id . '">' . $name . '</a> ';
                 $message_content .= '</div>';
 
                 $message_content .= '<div class="col-md-2 col-md-offset-5">';
@@ -1076,38 +1079,38 @@ class MessageManager
             $message_content .= '</div>';
         } else {
             if ($source == 'outbox') {
-                $message_content .= get_lang('From').':&nbsp;'.$name.'</b> '.api_strtolower(get_lang('To')).' <b>'.$receiverUserInfo['complete_name'].'</b>';
+                $message_content .= get_lang('From') . ':&nbsp;' . $name . '</b> ' . api_strtolower(get_lang('To')) . ' <b>' . $receiverUserInfo['complete_name'] . '</b>';
             } else {
-                $message_content .= get_lang('From').':&nbsp;'.$name.'</b> '.api_strtolower(get_lang('To')).' <b>'.get_lang('Me').'</b>';
+                $message_content .= get_lang('From') . ':&nbsp;' . $name . '</b> ' . api_strtolower(get_lang('To')) . ' <b>' . get_lang('Me') . '</b>';
             }
         }
-        $message_content .='
+        $message_content .= '
 		        <br />
 		        <hr style="color:#ddd" />
 		        <table height="209px" width="100%">
 		            <tr>
-		              <td valign=top class="view-message-content">'.str_replace("\\", "", $content).'</td>
+		              <td valign=top class="view-message-content">' . str_replace("\\", "", $content) . '</td>
 		            </tr>
 		        </table>
-		        <div id="message-attach">'.(!empty($files_attachments) ? implode('<br />', $files_attachments) : '').'</div>
+		        <div id="message-attach">' . (!empty($files_attachments) ? implode('<br />', $files_attachments) : '') . '</div>
 		        <div style="padding: 15px 0px 5px 0px">';
         $social_link = '';
         if (isset($_GET['f']) && $_GET['f'] == 'social') {
             $social_link = 'f=social';
         }
         if ($source == 'outbox') {
-            $message_content .= '<a href="outbox.php?'.$social_link.'">'.
-                Display::return_icon('back.png', get_lang('ReturnToOutbox')).'</a> &nbsp';
+            $message_content .= '<a href="outbox.php?' . $social_link . '">' .
+                Display::return_icon('back.png', get_lang('ReturnToOutbox')) . '</a> &nbsp';
         } else {
-            $message_content .= '<a href="inbox.php?'.$social_link.'">'.
-                Display::return_icon('back.png', get_lang('ReturnToInbox')).'</a> &nbsp';
-            $message_content .= '<a href="new_message.php?re_id='.$message_id.'&'.$social_link.'">'.
-                Display::return_icon('message_reply.png', get_lang('ReplyToMessage')).'</a> &nbsp';
+            $message_content .= '<a href="inbox.php?' . $social_link . '">' .
+                Display::return_icon('back.png', get_lang('ReturnToInbox')) . '</a> &nbsp';
+            $message_content .= '<a href="new_message.php?re_id=' . $message_id . '&' . $social_link . '">' .
+                Display::return_icon('message_reply.png', get_lang('ReplyToMessage')) . '</a> &nbsp';
         }
-        $message_content .= '<a href="inbox.php?action=deleteone&id='.$message_id.'&'.$social_link.'" >'.
-            Display::return_icon('delete.png', get_lang('DeleteMessage')).'</a>&nbsp';
+        $message_content .= '<a href="inbox.php?action=deleteone&id=' . $message_id . '&' . $social_link . '" >' .
+            Display::return_icon('delete.png', get_lang('DeleteMessage')) . '</a>&nbsp';
 
-        $message_content .='</div></td>
+        $message_content .= '</div></td>
 		      <td width=10></td>
 		    </tr>
 		</table>';
@@ -1123,8 +1126,8 @@ class MessageManager
     public static function get_user_id_by_email($user_email)
     {
         $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
-        $sql = 'SELECT user_id FROM '.$tbl_user.'
-                WHERE email="'.Database::escape_string($user_email).'";';
+        $sql = 'SELECT user_id FROM ' . $tbl_user . '
+                WHERE email="' . Database::escape_string($user_email) . '";';
         $rs = Database::query($sql);
         $row = Database::fetch_array($rs, 'ASSOC');
         if (isset($row['user_id'])) {
@@ -1185,7 +1188,7 @@ class MessageManager
 
                 $items = $topic['count'];
                 $reply_label = ($items == 1) ? get_lang('GroupReply') : get_lang('GroupReplies');
-                $label =  '<i class="fa fa-envelope"></i> ' . $items . ' ' . $reply_label;
+                $label = '<i class="fa fa-envelope"></i> ' . $items . ' ' . $reply_label;
                 $topic['title'] = trim($topic['title']);
 
                 if (empty($topic['title'])) {
@@ -1197,31 +1200,31 @@ class MessageManager
                     'h4',
                     Display::url(
                         Security::remove_XSS($topic['title'], STUDENT, true),
-                        api_get_path(WEB_CODE_PATH).'social/group_topics.php?id='.$group_id.'&topic_id='.$topic['id']
-                    ), array('class'=>'title')
+                        api_get_path(WEB_CODE_PATH) . 'social/group_topics.php?id=' . $group_id . '&topic_id=' . $topic['id']
+                    ), array('class' => 'title')
                 );
                 $actions = '';
                 if ($my_group_role == GROUP_USER_PERMISSION_ADMIN ||
                     $my_group_role == GROUP_USER_PERMISSION_MODERATOR
                 ) {
-                    $actions = '<br />'.Display::url(get_lang('Delete'), api_get_path(WEB_CODE_PATH).'social/group_topics.php?action=delete&id='.$group_id.'&topic_id='.$topic['id'], array('class' => 'btn btn-default'));
+                    $actions = '<br />' . Display::url(get_lang('Delete'), api_get_path(WEB_CODE_PATH) . 'social/group_topics.php?action=delete&id=' . $group_id . '&topic_id=' . $topic['id'], array('class' => 'btn btn-default'));
                 }
 
                 $date = '';
                 if ($topic['send_date'] != $topic['update_date']) {
                     if (!empty($topic['update_date'])) {
-                        $date .= '<i class="fa fa-calendar"></i> '.get_lang('LastUpdate').' '.date_to_str_ago($topic['update_date']);
+                        $date .= '<i class="fa fa-calendar"></i> ' . get_lang('LastUpdate') . ' ' . date_to_str_ago($topic['update_date']);
                     }
                 } else {
-                    $date .= '<i class="fa fa-calendar"></i> '.get_lang('Created').' '.date_to_str_ago($topic['send_date']);
+                    $date .= '<i class="fa fa-calendar"></i> ' . get_lang('Created') . ' ' . date_to_str_ago($topic['send_date']);
                 }
-                $html .= '<div class="date">'. $label.' - '.$date.$actions . '</div>';
+                $html .= '<div class="date">' . $label . ' - ' . $date . $actions . '</div>';
                 $html .= '</div>';
 
                 $image = $user_sender_info['avatar'];
 
-                $user_info = '<div class="author"><img class="img-responsive img-circle" src="'.$image.'" alt="'.$name.'"  width="64" height="64" title="'.$name.'" /></div>';
-                $user_info .= '<div class="name"><a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$topic['user_sender_id'].'">'.$name.'&nbsp;</a></div>';
+                $user_info = '<div class="author"><img class="img-responsive img-circle" src="' . $image . '" alt="' . $name . '"  width="64" height="64" title="' . $name . '" /></div>';
+                $user_info .= '<div class="name"><a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php?u=' . $topic['user_sender_id'] . '">' . $name . '&nbsp;</a></div>';
 
                 $html .= '<div class="col-xs-4 col-md-2">';
                 $html .= $user_info;
@@ -1285,11 +1288,11 @@ class MessageManager
 
         $topic_page_nr = isset($_GET['topics_page_nr']) ? intval($_GET['topics_page_nr']) : null;
 
-        $links.= '<div class="pull-right">';
-        $links.= '<div class="btn-group">';
+        $links .= '<div class="pull-right">';
+        $links .= '<div class="btn-group">';
 
         if (($my_group_role == GROUP_USER_PERMISSION_ADMIN ||
-            $my_group_role == GROUP_USER_PERMISSION_MODERATOR) ||
+                $my_group_role == GROUP_USER_PERMISSION_MODERATOR) ||
             $main_message['user_sender_id'] == $current_user_id
         ) {
             $urlEdit = api_get_path(WEB_CODE_PATH);
@@ -1307,7 +1310,7 @@ class MessageManager
             if (api_is_platform_admin()) {
                 $links .= Display::url(
                     Display::returnFontAwesomeIcon('trash'),
-                    'group_topics.php?action=delete&id='.$group_id.'&topic_id='.$topic_id,
+                    'group_topics.php?action=delete&id=' . $group_id . '&topic_id=' . $topic_id,
                     [
                         'class' => 'btn btn-default'
                     ]
@@ -1347,27 +1350,27 @@ class MessageManager
                 'data-size' => 'lg'
             ]
         );
-        $links.= '</div>';
-        $links.= '</div>';
+        $links .= '</div>';
+        $links .= '</div>';
 
-        $title = '<h4>'.Security::remove_XSS($main_message['title'], STUDENT, true).$links.'</h4>';
+        $title = '<h4>' . Security::remove_XSS($main_message['title'], STUDENT, true) . $links . '</h4>';
 
         $userPicture = $user_sender_info['avatar'];
         $main_content .= '<div class="avatar-author">';
-        $main_content .= '<img src="'.$userPicture.'" alt="'.$name.'" class="img-responsive img-circle" width="64" height="64" title="'.$name.'" />';
-        $main_content .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$main_message['user_sender_id'].'">'.$name.'</a>';
+        $main_content .= '<img src="' . $userPicture . '" alt="' . $name . '" class="img-responsive img-circle" width="64" height="64" title="' . $name . '" />';
+        $main_content .= '<a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php?u=' . $main_message['user_sender_id'] . '">' . $name . '</a>';
         $main_content .= '</div>';
 
         $date = '';
         if ($main_message['send_date'] != $main_message['update_date']) {
             if (!empty($main_message['update_date'])) {
-                $date = '<div class="message-date"> '.get_lang('LastUpdate').' '.date_to_str_ago($main_message['update_date']).'</div>';
+                $date = '<div class="message-date"> ' . get_lang('LastUpdate') . ' ' . date_to_str_ago($main_message['update_date']) . '</div>';
             }
         } else {
-            $date = '<div class="message-date"> '.get_lang('Created').' '.date_to_str_ago($main_message['send_date']).'</div>';
+            $date = '<div class="message-date"> ' . get_lang('Created') . ' ' . date_to_str_ago($main_message['send_date']) . '</div>';
         }
-        $attachment = '<div class="message-attach">'.(!empty($files_attachments) ? implode('<br />', $files_attachments) : '').'</div>';
-        $main_content.= '<div class="message-content"> '.$date.$main_message['content'].$attachment.'</div>';
+        $attachment = '<div class="message-attach">' . (!empty($files_attachments) ? implode('<br />', $files_attachments) : '') . '</div>';
+        $main_content .= '<div class="message-content"> ' . $date . $main_message['content'] . $attachment . '</div>';
         //$main_content = Security::remove_XSS($main_content, STUDENT, true);
 
         $html .= Display::div(Display::div($title . $main_content, array('class' => 'message-topic')), array('class' => 'sm-groups-message'));
@@ -1381,39 +1384,39 @@ class MessageManager
                 if (empty($topic['id'])) {
                     continue;
                 }
-                $items_page_nr = isset($_GET['items_'.$topic['id'].'_page_nr']) ? intval($_GET['items_'.$topic['id'].'_page_nr']) : null;
+                $items_page_nr = isset($_GET['items_' . $topic['id'] . '_page_nr']) ? intval($_GET['items_' . $topic['id'] . '_page_nr']) : null;
                 $links = '';
-                $links.= '<div class="pull-right">';
+                $links .= '<div class="pull-right">';
                 $html_items = '';
                 $user_sender_info = api_get_user_info($topic['user_sender_id']);
                 $files_attachments = self::get_links_message_attachment_files($topic['id']);
                 $name = $user_sender_info['complete_name'];
 
-                $links.= '<div class="btn-group">';
+                $links .= '<div class="btn-group">';
                 if (($my_group_role == GROUP_USER_PERMISSION_ADMIN || $my_group_role == GROUP_USER_PERMISSION_MODERATOR) || $topic['user_sender_id'] == $current_user_id) {
-                    $links.= '<a href="'.api_get_path(WEB_CODE_PATH).'social/message_for_group_form.inc.php?height=400&width=800&&user_friend='.$current_user_id.'&group_id='.$group_id.'&message_id='.$topic['id'].'&action=edit_message_group&anchor_topic=topic_'.$topic_id.'&topics_page_nr='.$topic_page_nr.'&items_page_nr='.$items_page_nr.'&topic_id='.$topic_id.'" class="ajax btn btn-default" data-size="lg" data-title="'.get_lang('Edit').'" title="'.get_lang('Edit').'">'.
-                    Display::returnFontAwesomeIcon('pencil') . '</a>';
+                    $links .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'social/message_for_group_form.inc.php?height=400&width=800&&user_friend=' . $current_user_id . '&group_id=' . $group_id . '&message_id=' . $topic['id'] . '&action=edit_message_group&anchor_topic=topic_' . $topic_id . '&topics_page_nr=' . $topic_page_nr . '&items_page_nr=' . $items_page_nr . '&topic_id=' . $topic_id . '" class="ajax btn btn-default" data-size="lg" data-title="' . get_lang('Edit') . '" title="' . get_lang('Edit') . '">' .
+                        Display::returnFontAwesomeIcon('pencil') . '</a>';
                 }
-                $links.= '<a href="'.api_get_path(WEB_CODE_PATH).'social/message_for_group_form.inc.php?height=400&width=800&&user_friend='.api_get_user_id().'&group_id='.$group_id.'&message_id='.$topic['id'].'&action=reply_message_group&anchor_topic=topic_'.$topic_id.'&topics_page_nr='.$topic_page_nr.'&items_page_nr='.$items_page_nr.'&topic_id='.$topic_id.'" class="ajax btn btn-default" data-size="lg" data-title="'.get_lang('Reply').'" title="'.get_lang('Reply').'">';
-                $links.= Display::returnFontAwesomeIcon('commenting') . '</a>';
-                $links.= '</div>';
-                $links.= '</div>';
+                $links .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'social/message_for_group_form.inc.php?height=400&width=800&&user_friend=' . api_get_user_id() . '&group_id=' . $group_id . '&message_id=' . $topic['id'] . '&action=reply_message_group&anchor_topic=topic_' . $topic_id . '&topics_page_nr=' . $topic_page_nr . '&items_page_nr=' . $items_page_nr . '&topic_id=' . $topic_id . '" class="ajax btn btn-default" data-size="lg" data-title="' . get_lang('Reply') . '" title="' . get_lang('Reply') . '">';
+                $links .= Display::returnFontAwesomeIcon('commenting') . '</a>';
+                $links .= '</div>';
+                $links .= '</div>';
 
                 $userPicture = $user_sender_info['avatar'];
-                $user_link = '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$topic['user_sender_id'].'">'.$name.'&nbsp</a>';
-                $html_items.= '<div class="avatar-author"><img src="'.$userPicture.'" alt="'.$name.'" class="img-responsive img-circle"  width="64" height="64" title="'.$name.'" />'.$user_link.'</div>';
+                $user_link = '<a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php?u=' . $topic['user_sender_id'] . '">' . $name . '&nbsp</a>';
+                $html_items .= '<div class="avatar-author"><img src="' . $userPicture . '" alt="' . $name . '" class="img-responsive img-circle"  width="64" height="64" title="' . $name . '" />' . $user_link . '</div>';
 
 
                 $date = '';
                 if ($topic['send_date'] != $topic['update_date']) {
                     if (!empty($topic['update_date'])) {
-                        $date = '<div class="message-date"> '.get_lang('LastUpdate').' '.date_to_str_ago($topic['update_date']).'</div>';
+                        $date = '<div class="message-date"> ' . get_lang('LastUpdate') . ' ' . date_to_str_ago($topic['update_date']) . '</div>';
                     }
                 } else {
-                    $date = '<div class="message-date"> '.get_lang('Created').' '.date_to_str_ago($topic['send_date']).'</div>';
+                    $date = '<div class="message-date"> ' . get_lang('Created') . ' ' . date_to_str_ago($topic['send_date']) . '</div>';
                 }
-                $attachment = '<div class="message-attach">'.(!empty($files_attachments) ? implode('<br />', $files_attachments) : '').'</div>';
-                $html_items.= '<div class="message-content">'.$links.' '.$date.Security::remove_XSS($topic['content'], STUDENT, true).$attachment.'</div>';
+                $attachment = '<div class="message-attach">' . (!empty($files_attachments) ? implode('<br />', $files_attachments) : '') . '</div>';
+                $html_items .= '<div class="message-content">' . $links . ' ' . $date . Security::remove_XSS($topic['content'], STUDENT, true) . $attachment . '</div>';
 
                 $base_padding = 20;
 
@@ -1423,8 +1426,8 @@ class MessageManager
                     $indent = intval($topic['indent_cnt']) * $base_padding + $base_padding;
                 }
 
-                $html_items = Display::div($html_items, array('class' => 'message-post', 'id' => 'msg_'.$topic['id']));
-                $html_items = Display::div($html_items, array('class' => '', 'style' => 'margin-left:'.$indent.'px'));
+                $html_items = Display::div($html_items, array('class' => 'message-post', 'id' => 'msg_' . $topic['id']));
+                $html_items = Display::div($html_items, array('class' => '', 'style' => 'margin-left:' . $indent . 'px'));
                 $array_html_items[] = array($html_items);
             }
             // grids for items with paginations
@@ -1437,7 +1440,7 @@ class MessageManager
             );
             if (!empty($array_html_items)) {
                 $html .= Display::return_sortable_grid(
-                    'items_'.$topic['id'],
+                    'items_' . $topic['id'],
                     array(),
                     $array_html_items,
                     $options,
@@ -1454,7 +1457,7 @@ class MessageManager
 
     /**
      * Add children to messages by id is used for nested view messages
-     * @param array  $rows rows of messages
+     * @param array $rows rows of messages
      * @return array $first_seed new list adding the item children
      */
     public static function calculate_children($rows, $first_seed)
@@ -1497,8 +1500,8 @@ class MessageManager
 
     /**
      * Sort date by desc from a multi-dimensional array
-     * @param array $array1  first array to compare
-     * @param array $array2  second array to compare
+     * @param array $array1 first array to compare
+     * @param array $array2 second array to compare
      * @return bool
      */
     public function order_desc_date($array1, $array2)
@@ -1508,8 +1511,8 @@ class MessageManager
 
     /**
      * Get array of links (download) for message attachment files
-     * @param int  		$message_id
-     * @param string	$type message list (inbox/outbox)
+     * @param int $message_id
+     * @param string $type message list (inbox/outbox)
      * @return array
      */
     public static function get_links_message_attachment_files($message_id, $type = '')
@@ -1527,14 +1530,14 @@ class MessageManager
             $rs_file = Database::query($sql);
             if (Database::num_rows($rs_file) > 0) {
                 $attach_icon = Display::return_icon('attachment.gif', '');
-                $archiveURL = api_get_path(WEB_CODE_PATH).'messages/download.php?type='.$type.'&file=';
+                $archiveURL = api_get_path(WEB_CODE_PATH) . 'messages/download.php?type=' . $type . '&file=';
                 while ($row_file = Database::fetch_array($rs_file)) {
                     $archiveFile = $row_file['path'];
                     $filename = $row_file['filename'];
                     $filesize = format_file_size($row_file['size']);
                     $filecomment = Security::remove_XSS($row_file['comment']);
                     $filename = Security::remove_XSS($filename);
-                    $links_attach_file[] = $attach_icon.'&nbsp;<a href="'.$archiveURL.$archiveFile.'">'.$filename.'</a>&nbsp;('.$filesize.')'.(!empty($filecomment) ? '&nbsp;-&nbsp;<i>'.$filecomment.'</i>' : '');
+                    $links_attach_file[] = $attach_icon . '&nbsp;<a href="' . $archiveURL . $archiveFile . '">' . $filename . '</a>&nbsp;(' . $filesize . ')' . (!empty($filecomment) ? '&nbsp;-&nbsp;<i>' . $filecomment . '</i>' : '');
                 }
             }
         }
@@ -1543,7 +1546,7 @@ class MessageManager
 
     /**
      * Get message list by id
-     * @param int  $message_id
+     * @param int $message_id
      * @return array
      */
     public static function get_message_by_id($message_id)
@@ -1551,7 +1554,7 @@ class MessageManager
         $tbl_message = Database::get_main_table(TABLE_MESSAGE);
         $message_id = intval($message_id);
         $sql = "SELECT * FROM $tbl_message
-                WHERE id = '$message_id' AND msg_status <> '".MESSAGE_STATUS_DELETED."' ";
+                WHERE id = '$message_id' AND msg_status <> '" . MESSAGE_STATUS_DELETED . "' ";
         $res = Database::query($sql);
         $item = array();
         if (Database::num_rows($res) > 0) {
@@ -1600,7 +1603,7 @@ class MessageManager
 
         if (isset($_REQUEST['action'])) {
             switch ($_REQUEST['action']) {
-                 case 'mark_as_unread' :
+                case 'mark_as_unread' :
                     $number_of_selected_messages = count($_POST['id']);
                     if (is_array($_POST['id'])) {
                         foreach ($_POST['id'] as $index => $message_id) {
@@ -1677,7 +1680,7 @@ class MessageManager
 
         Session::write('message_sent_search_keyword', $keyword);
 
-        $success = get_lang('SelectedMessagesDeleted').'&nbsp</b><br /><a href="outbox.php?'.$social_link.'">'.get_lang('BackToOutbox').'</a>';
+        $success = get_lang('SelectedMessagesDeleted') . '&nbsp</b><br /><a href="outbox.php?' . $social_link . '">' . get_lang('BackToOutbox') . '</a>';
 
         $html = null;
         if (isset($_REQUEST['action'])) {
@@ -1693,7 +1696,7 @@ class MessageManager
                     break;
                 case 'deleteone' :
                     MessageManager::delete_message_by_user_receiver(api_get_user_id(), $_GET['id']);
-                    $html .=Display::return_message(api_xml_http_response_encode($success), 'normal', false);
+                    $html .= Display::return_message(api_xml_http_response_encode($success), 'normal', false);
                     $html .= '<br/>';
                     break;
             }
@@ -1882,4 +1885,67 @@ class MessageManager
             );
         }
     }
+
+    /**
+     * Get the error log from failed mailing
+     * @return array|bool
+     */
+    public static function failedSentMailErrors()
+    {
+        $base = api_get_path(SYS_ARCHIVE_PATH) . 'mail/';
+        $mailq = $base . 'mailq';
+
+        if (!file_exists($mailq) || !is_readable($mailq)) {
+            return false;
+        }
+
+        $file = fopen($mailq, 'r');
+        $i = 1;
+        while (!feof($file)) {
+            $line = fgets($file);
+            //$line = trim($line);
+
+            if (trim($line) == '') {
+                continue;
+            }
+
+            //Get the mail code, something like 1WBumL-0002xg-FF
+            if (preg_match('/(.*)\s((.*)-(.*)-(.*))\s<(.*)$/', $line, $codeMatches)) {
+                $mail_queue[$i]['code'] = $codeMatches[2];
+            }
+
+            $fullMail = $base . $mail_queue[$i]['code'];
+            $mailFile = fopen($fullMail, 'r');
+
+            //Get the reason of mail fail
+            $iX = 1;
+
+            while (!feof($mailFile)) {
+                $mailLine = fgets($mailFile);
+                #if ($iX == 4 && preg_match('/(.*):\s(.*)$/', $mailLine, $matches)) {
+                if (
+                    $iX == 2 &&
+                    preg_match('/(.*)(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})\s(.*)/', $mailLine, $detailsMatches)
+                ) {
+                    $mail_queue[$i]['reason'] = $detailsMatches[3];
+                }
+
+                $iX++;
+            }
+
+            fclose($mailFile);
+
+            //Get the time of mail fail
+            if (preg_match('/^\s?(\d+)(\D+)\s+(.*)$/', $line, $timeMatches)) {
+                $mail_queue[$i]['time'] = $timeMatches[1] . $timeMatches[2];
+            } elseif (preg_match('/^(\s+)((.*)@(.*))\s+(.*)$/', $line, $emailMatches)) {
+                $mail_queue[$i]['mail'] = $emailMatches[2];
+                $i++;
+            }
+        }
+
+        fclose($file);
+
+        return array_reverse($mail_queue);
+    }
 }

+ 1 - 1
main/inc/lib/sessionmanager.lib.php

@@ -2628,7 +2628,7 @@ class SessionManager
         $return_array = array();
 
         $sql_query = " SELECT
-                    s.id,
+                    DISTINCT(s.id),
                     s.name,
                     s.nbr_courses,
                     s.access_start_date,

+ 1 - 1
main/inc/lib/usermanager.lib.php

@@ -860,7 +860,7 @@ class UserManager
         $encrypt_method = '',
         $send_email = false,
         $reset_password = 0,
-        $address
+        $address = null
     ) {
         $hook = HookUpdateUser::create();
         if (!empty($hook)) {

+ 2 - 2
main/inc/lib/userportal.lib.php

@@ -422,7 +422,7 @@ class IndexManager
         // Initialization.
         $user_identified = (api_get_user_id() > 0 && !api_is_anonymous());
         $web_course_path = api_get_path(WEB_COURSE_PATH);
-        $category = Database::escape_string($_GET['category']);
+        $category = isset($_GET['category']) ? Database::escape_string($_GET['category']) : '';
         $setting_show_also_closed_courses = api_get_setting('show_closed_courses') == 'true';
 
         // Database table definitions.
@@ -431,7 +431,7 @@ class IndexManager
 
         // Get list of courses in category $category.
         $sql_get_course_list = "SELECT * FROM $main_course_table cours
-                                    WHERE category_code = '".Database::escape_string($_GET['category'])."'
+                                    WHERE category_code = '" . $category . "'
                                     ORDER BY title, UPPER(visual_code)";
 
         // Showing only the courses of the current access_url_id.

+ 1 - 1
main/install/configuration.dist.php

@@ -67,7 +67,7 @@ $_configuration['url_append'] = '{URL_APPEND_PATH}';
 // $extAuthSource["extldap"]["newUser"] = $_configuration['root_sys']."main/auth/external_login/newUser.ldap.php";
 //
 // FACEBOOK IMPLEMENTATION BASED ON external_login info
-// -> Uncomment the line bellow to activate Facebook Auth AND edit main/auth/external_login/ldap.conf.php for configuration
+// -> Uncomment the line bellow to activate Facebook Auth AND edit app/config/auth.conf.php for configuration
 // $_configuration['facebook_auth'] = 1;
 //
 // OTHER EXTERNAL LOGIN INFORMATION

+ 4 - 0
main/mySpace/session.php

@@ -64,6 +64,10 @@ if (api_is_drh() || api_is_session_admin() || api_is_platform_admin()) {
         Display::return_icon('works.png', get_lang('WorksReport'), [], ICON_SIZE_MEDIUM),
         api_get_path(WEB_CODE_PATH) . 'mySpace/works_in_session_report.php'
     );
+    $menu_items[] = Display::url(
+        Display::return_icon('clock.png', get_lang('TeacherTimeReportBySession'), [], ICON_SIZE_MEDIUM),
+        api_get_path(WEB_CODE_PATH) . 'admin/teachers_time_by_session_report.php'
+    );
 
     $actionsLeft = '';
     $nb_menu_items = count($menu_items);

+ 1 - 7
main/mySpace/works_in_session_report.php

@@ -8,7 +8,6 @@
 require_once '../inc/global.inc.php';
 
 use \Chamilo\CoreBundle\Entity\Session;
-use \Doctrine\Common\Collections\Criteria;
 
 api_block_anonymous_users(true);
 
@@ -46,12 +45,7 @@ if ($session) {
     foreach ($sessionCourses as $sessionCourse) {
         $course = $sessionCourse->getCourse();
         $coursesInfo[$course->getId()] =  $course->getCode();
-        $criteria = Criteria::create()->where(
-            Criteria::expr()->eq("status", Session::STUDENT)
-        );
-        $userCourseSubscriptions = $session
-            ->getUserCourseSubscriptions()
-            ->matching($criteria);
+        $userCourseSubscriptions = $session->getUserCourseSubscriptionsByStatus($course, Session::STUDENT);
 
         foreach ($userCourseSubscriptions as $userCourseSubscription) {
             $user = $userCourseSubscription->getUser();

+ 7 - 8
main/session/add_many_session_to_category.php

@@ -16,16 +16,15 @@ $xajax->registerFunction('search_courses');
 $this_section = SECTION_PLATFORM_ADMIN;
 
 // setting breadcrumbs
-//$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
 $interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList'));
 
 // Database Table Definitions
-$tbl_session_rel_course_rel_user	= Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
-$tbl_session						= Database::get_main_table(TABLE_MAIN_SESSION);
-$tbl_session_category				= Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY);
-$tbl_session_rel_user				= Database::get_main_table(TABLE_MAIN_SESSION_USER);
-$tbl_session_rel_course				= Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
-$tbl_course							= Database::get_main_table(TABLE_MAIN_COURSE);
+$tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
+$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
+$tbl_session_category = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY);
+$tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
+$tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
+$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
 
 // setting the name of the tool
 $tool_name = get_lang('SubscribeSessionsToCategory');
@@ -49,7 +48,7 @@ if (!api_is_platform_admin() && !api_is_session_admin()) {
 $xajax -> processRequests();
 $htmlHeadXtra[] = $xajax->getJavascript('../inc/lib/xajax/');
 $htmlHeadXtra[] = '
-<script type="text/javascript">
+<script>
 function add_course_to_session (code, content) {
     document.getElementById("course_to_add").value = "";
     document.getElementById("ajax_list_courses_single").innerHTML = "";

+ 0 - 1
main/session/add_students_to_session.php

@@ -13,7 +13,6 @@ require_once '../inc/global.inc.php';
 $this_section = SECTION_PLATFORM_ADMIN;
 
 // setting breadcrumbs
-//$interbreadcrumb[] = array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
 $interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList'));
 
 // Setting the name of the tool

+ 5 - 2
main/session/add_users_to_session.php

@@ -21,8 +21,11 @@ $addProcess = isset($_GET['add']) ? Security::remove_XSS($_GET['add']) : null;
 SessionManager::protectSession($id_session);
 
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList'));
-$interbreadcrumb[] = array('url' => "resume_session.php?id_session=".$id_session,"name" => get_lang('SessionOverview'));
+$interbreadcrumb[] = array('url' => 'session_list.php', 'name' => get_lang('SessionList'));
+$interbreadcrumb[] = array(
+    'url' => "resume_session.php?id_session=".$id_session,
+    "name" => get_lang('SessionOverview'),
+);
 
 // Database Table Definitions
 $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);

+ 16 - 15
main/session/session_add.php

@@ -78,7 +78,6 @@ $interbreadcrumb[] = array(
     'name' => get_lang('SessionList'),
 );
 
-
 function search_coachs($needle)
 {
     $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
@@ -191,20 +190,22 @@ $(function() {
     '.$result['js'].'
 });
 </script>';
-
-$form->addHtml(''
-    . '<div class="form-group">'
-    . '<label for="cropImage" id="labelCropImage" class="col-sm-2 control-label"></label>'
-    . '<div class="col-sm-8">'
-    . '<div id="cropImage" class="cropCanvas">'
-    . '<img id="previewImage" >'
-    . '</div>'
-    . '<div>'
-    . '<button class="btn btn-primary hidden" name="cropButton" id="cropButton"><em class="fa fa-crop"></em> '.get_lang('CropYourPicture').'</button>'
-    . '</div>'
-    . '</div>'
-    . '</div>'
-    . '');
+// @todo add an html element
+$form->addHtml('
+    <div class="form-group">
+    <label for="cropImage" id="labelCropImage" class="col-sm-2 control-label"></label>
+    <div class="col-sm-8">
+    <div id="cropImage" class="cropCanvas">
+    <img id="previewImage">
+    </div>
+    <div>
+    <button class="btn btn-primary hidden" name="cropButton" id="cropButton">
+        <em class="fa fa-crop"></em> '.get_lang('CropYourPicture').'
+    </button>
+    </div>
+    </div>
+    </div>
+');
 $form->addHidden('cropResult', '');
 
 $form->addButtonNext(get_lang('NextStep'));

+ 1 - 2
main/session/session_export.php

@@ -234,8 +234,7 @@ if (isset($_POST['formSent'])) {
 			if (!empty($courses) && $cvs) {
 				$courses = api_substr($courses, 0, api_strlen($courses) - 1);
 			}
-			$add .= $courses;
-
+			$add = $courses;
 
 			if (in_array($file_type, ['csv', 'xls'])) {
 				$sessionListToExport[] = [

+ 19 - 0
main/template/default/admin/email_tester.tpl

@@ -0,0 +1,19 @@
+<div class="row">
+    <div class="col-sm-5">
+        {{ form }}
+    </div>
+    {% if not errors is empty %}
+        <div class="col-sm-7">
+            <h4 class="page-header">{{ 'Errors'|get_lang }}</h4>
+            <ul>
+                {% for error in errors %}
+                    <li>
+                        {{ 'Email: %s. %s ago'|format(error.mail, error.time) }}
+                        <pre>{{ error.reason|replace({'\n': '<br>'}) }}</pre>
+                    </li>
+                {% endfor %}
+            </ul>
+        </div>
+    {% endif %}
+</div>
+

+ 15 - 0
main/template/default/layout/page_footer.tpl

@@ -70,6 +70,21 @@
         </div>
     </div>
 </div>
+{# Global modal, load content by AJAX call to href attribute on anchor tag with 'ajax' class #}
+<div class="modal fade" id="global-modal" tabindex="-1" role="dialog" aria-labelledby="global-modal-title" aria-hidden="true">
+    <div class="modal-dialog modal-lg">
+        <div class="modal-content">
+            <div class="modal-header">
+                <button type="button" class="close" data-dismiss="modal" aria-label="{{ "Close" | get_lang }}">
+                    <span aria-hidden="true">&times;</span>
+                </button>
+                <h4 class="modal-title" id="global-modal-title">&nbsp;</h4>
+            </div>
+            <div class="modal-body">
+            </div>
+        </div>
+    </div>
+</div>
                 
 {% include template ~ '/layout/footer.js.tpl' %}
 

+ 24 - 1
main/template/default/skill/list.tpl

@@ -1,7 +1,20 @@
 <legend>
     <h1>{{ "ManageSkills" | get_lang }}</h1>
 </legend>
-
+<div class="row">
+    <div class="col-md-3" >
+        <select id="tag-filter" class="form-control">
+            <option value="0">{{ 'PleaseSelectAChoice' | get_lang }}</option>
+            {% for tag in tags %}
+                <option value="{{ tag.id }}">{{ tag.tag }}</option>
+            {% endfor %}
+        </select>
+    </div>
+    <div class="col-md-3">
+        <a id="filter-button" class="btn btn-default">{{ 'FilterByTags' | get_lang }}</a>
+    </div>
+</div>
+<br />
 <div class="table table-responsive">
     <table class="table table-hover table-striped">
         <thead>
@@ -62,3 +75,13 @@
         </tbody>
     </table>
 </div>
+
+<script>
+    $(document).ready(function() {
+        $("#tag-filter").val("{{ current_tag_id }}");
+        $("#filter-button").click(function() {
+            var tagId = $( "#tag-filter option:selected" ).val();
+            $(location).attr('href', '{{ _p.web_main }}admin/skill_list.php?tag_id='+tagId);
+        });
+    });
+</script>

+ 58 - 28
plugin/bbb/lib/bbb.lib.php

@@ -28,6 +28,7 @@ class bbb
     public $enableGlobalConference = false;
     public $isGlobalConference = false;
     public $groupSupport = false;
+    public $table;
 
     /**
      * Constructor (generates a connection to the API and the Chamilo settings
@@ -48,15 +49,18 @@ class bbb
 
         $this->logoutUrl = $this->getListingUrl();
         $this->table = Database::get_main_table('plugin_bbb_meeting');
+
         $this->enableGlobalConference = $plugin->get('enable_global_conference');
         $this->isGlobalConference = (bool) $isGlobalConference;
 
         $columns = Database::listTableColumns($this->table);
+
         $this->groupSupport = isset($columns['group_id']) ? true : false;
 
         if ($this->groupSupport) {
             // Plugin check
             $this->groupSupport = (bool) $plugin->get('enable_conference_in_course_groups');
+
             if ($this->groupSupport) {
 
                 // Platform check
@@ -66,9 +70,8 @@ class bbb
                 if ($bbbSetting) {
                     // Course check
                     $courseInfo = api_get_course_info();
-
                     if ($courseInfo) {
-                        $this->groupSupport = api_get_course_setting('bbb_enable_conference_in_groups') === '1';
+                        $this->groupSupport = api_get_course_setting('bbb_enable_conference_in_groups', $courseInfo['code']) === '1';
                     }
                 }
             }
@@ -136,32 +139,32 @@ class bbb
      * See this file in you BBB to set up default values
      * @param   array $params Array of parameters that will be completed if not containing all expected variables
 
-       /var/lib/tomcat6/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties
+    /var/lib/tomcat6/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties
      *
-       More record information:
-       http://code.google.com/p/bigbluebutton/wiki/RecordPlaybackSpecification
-
-       # Default maximum number of users a meeting can have.
-        # Doesn't get enforced yet but is the default value when the create
-        # API doesn't pass a value.
-        defaultMaxUsers=20
-
-        # Default duration of the meeting in minutes.
-        # Current default is 0 (meeting doesn't end).
-        defaultMeetingDuration=0
-
-        # Remove the meeting from memory when the end API is called.
-        # This allows 3rd-party apps to recycle the meeting right-away
-        # instead of waiting for the meeting to expire (see below).
-        removeMeetingWhenEnded=false
-
-        # The number of minutes before the system removes the meeting from memory.
-        defaultMeetingExpireDuration=1
-
-        # The number of minutes the system waits when a meeting is created and when
-        # a user joins. If after this period, a user hasn't joined, the meeting is
-        # removed from memory.
-        defaultMeetingCreateJoinDuration=5
+    More record information:
+    http://code.google.com/p/bigbluebutton/wiki/RecordPlaybackSpecification
+
+    # Default maximum number of users a meeting can have.
+    # Doesn't get enforced yet but is the default value when the create
+    # API doesn't pass a value.
+    defaultMaxUsers=20
+
+    # Default duration of the meeting in minutes.
+    # Current default is 0 (meeting doesn't end).
+    defaultMeetingDuration=0
+
+    # Remove the meeting from memory when the end API is called.
+    # This allows 3rd-party apps to recycle the meeting right-away
+    # instead of waiting for the meeting to expire (see below).
+    removeMeetingWhenEnded=false
+
+    # The number of minutes before the system removes the meeting from memory.
+    defaultMeetingExpireDuration=1
+
+    # The number of minutes the system waits when a meeting is created and when
+    # a user joins. If after this period, a user hasn't joined, the meeting is
+    # removed from memory.
+    defaultMeetingCreateJoinDuration=5
      *
      * @return mixed
      */
@@ -442,6 +445,34 @@ class bbb
         return false;
     }
 
+    /**
+     * @param int $courseId
+     * @param int $sessionId
+     * @param int $status
+     *
+     * @return array
+     */
+    public function getAllMeetingsInCourse($courseId, $sessionId, $status)
+    {
+        $conditions =  array(
+            'where' => array(
+                'status = ? AND c_id = ? AND session_id = ? ' => array(
+                    $status,
+                    $courseId,
+                    $sessionId,
+                ),
+            ),
+        );
+
+        $meetingList = Database::select(
+            '*',
+            $this->table,
+            $conditions
+        );
+
+        return $meetingList;
+    }
+
     /**
      * Gets all the course meetings saved in the plugin_bbb_meeting table
      * @return array Array of current open meeting rooms
@@ -667,7 +698,6 @@ class bbb
                     $actionLinksArray[] = $actionLinks;
                     $item['action_links'] = implode('<br />', $actionLinksArray);
                 }
-                //var_dump($recordArray);
                 $item['show_links']  = implode('<br />', $recordArray);
                 $item['action_links'] = implode('<br />', $actionLinksArray);
             }

+ 15 - 3
plugin/bbb/listing.php

@@ -13,6 +13,7 @@ $tool_name = $plugin->get_lang('Videoconference');
 $isGlobal = isset($_GET['global']) ? true : false;
 
 $bbb = new bbb('', '', $isGlobal);
+
 $action = isset($_GET['action']) ? $_GET['action'] : null;
 
 $conferenceManager = $bbb->isConferenceManager();
@@ -104,7 +105,6 @@ if ($conferenceManager) {
             break;
     }
 }
-
 $meetings = $bbb->getMeetings();
 if (!empty($meetings)) {
     $meetings = array_reverse($meetings);
@@ -137,12 +137,23 @@ if ($bbb->isGlobalConference() === false &&
         });
 </script>';
 
-    $form = new FormValidator(api_get_self());
+    $form = new FormValidator(api_get_self().'?'.api_get_cidreq());
     $groupId = api_get_group_id();
     $groups = GroupManager::get_groups();
     if ($groups) {
+        $meetingsInGroup = $bbb->getAllMeetingsInCourse(api_get_course_int_id(), api_get_session_id(), 1);
+        $meetingsGroup = array_column($meetingsInGroup, 'status', 'group_id');
+
+        foreach ($groups as &$groupData) {
+            $itemGroupId = $groupData['id'];
+            if (isset($meetingsGroup[$itemGroupId]) && $meetingsGroup[$itemGroupId] == 1) {
+                $groupData['name'] .= ' ('.get_lang('Active').')';
+            }
+        }
+
         $groupList[0] = get_lang('Select');
         $groupList = array_merge($groupList, array_column($groups, 'name', 'iid'));
+
         $form->addSelect('group_id', get_lang('Groups'), $groupList, ['id' => 'group_select']);
         $form->setDefaults(['group_id' => $groupId]);
         $formToString = $form->returnForm();
@@ -161,4 +172,5 @@ $tpl->assign('form', $formToString);
 
 $listing_tpl = 'bbb/listing.tpl';
 $content = $tpl->fetch($listing_tpl);
-$tpl->assign('content', $content);$tpl->display_one_col_template();
+$tpl->assign('content', $content);
+$tpl->display_one_col_template();

+ 14 - 11
plugin/share_buttons/index.php

@@ -3,15 +3,18 @@
  * Controller for example date plugin
  * @package chamilo.plugin.share_buttons
  */
-echo '<div class="well">
-<!-- AddThis Button BEGIN -->
-<div class="addthis_toolbox addthis_default_style '.$plugin_info['icon_class'].' ">
-<a class="addthis_button_preferred_2"></a>
-<a class="addthis_button_preferred_3"></a>
-<a class="addthis_button_preferred_4"></a>
-<a class="addthis_button_compact"></a>
-<a class="addthis_counter addthis_bubble_style"></a>
-</div>
-<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=xa-4f69d6f847541385"></script>
+echo '
+<div class="well well-sm">
+    <!-- AddThis Button BEGIN -->
+    <div class="addthis_toolbox addthis_default_style ' . $plugin_info['icon_class'] . '">
+        <a class="addthis_button_preferred_1"></a>
+        <a class="addthis_button_preferred_2"></a>
+        <a class="addthis_button_preferred_3"></a>
+        <a class="addthis_button_preferred_4"></a>
+        <a class="addthis_button_compact"></a>
+        <a class="addthis_counter addthis_bubble_style"></a>
+    </div>
 <!-- AddThis Button END -->
-</div>';
+</div>
+<script type="text/javascript" src="//s7.addthis.com/js/250/addthis_widget.js"></script>
+';

+ 0 - 8
user_portal.php

@@ -191,14 +191,6 @@ if (empty($courseAndSessions['html']) && !isset($_GET['history'])) {
 
 $controller->tpl->assign('content', $courseAndSessions['html']);
 
-if (api_get_setting('allow_browser_sniffer') == 'true') {
-    if (isset($_SESSION['sniff_navigator']) && $_SESSION['sniff_navigator'] != "checked") {
-        $controller->tpl->assign('show_sniff', 1);
-    } else {
-        $controller->tpl->assign('show_sniff', 0);
-    }
-}
-
 // Display the Site Use Cookie Warning Validation
 $useCookieValidation = api_get_setting('cookie_warning');
 if ($useCookieValidation === 'true') {