Example #1
0
 /**
  *
  * @return Bridge_Api_Auth_OAuth2
  */
 public function reconnect()
 {
     $post_params = ['client_id' => $this->client_id, 'client_secret' => $this->client_secret, 'refresh_token' => $this->settings->get('refresh_token'), 'grant_type' => 'refresh_token'];
     $response = http_query::getUrl($this->token_endpoint, $post_params);
     $response = json_decode($response, JSON_HEX_TAG | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_HEX_APOS);
     if (!is_array($response) || !isset($response['access_token'])) {
         throw new Bridge_Exception_ApiConnectorAccessTokenFailed();
     }
     $this->settings->set('auth_token', $response['access_token']);
     return $this;
 }
 public function connect(Application $app)
 {
     $app['controller.utils.pathfile-test'] = $this;
     $controllers = $app['controllers_factory'];
     /**
      * @todo : check this as it would lead to a security issue
      */
     $controllers->get('/path/', function (Application $app, Request $request) {
         return $app->json(['exists' => file_exists($request->query->get('path')), 'file' => is_file($request->query->get('path')), 'dir' => is_dir($request->query->get('path')), 'readable' => is_readable($request->query->get('path')), 'writeable' => is_writable($request->query->get('path')), 'executable' => is_executable($request->query->get('path'))]);
     });
     $controllers->get('/url/', function (Application $app, Request $request) {
         return $app->json(['code' => \http_query::getHttpCodeFromUrl($request->query->get('url'))]);
     });
     return $controllers;
 }
Example #3
0
 public function checkUrl()
 {
     return ['code' => \http_query::getHttpCodeFromUrl($this->request->query->get('url'))];
 }