public function build()
 {
     \yii\base\Event::on(\denoll\filekit\Storage::className(), \denoll\filekit\Storage::EVENT_BEFORE_SAVE, function ($event) {
         /** @var \denoll\filekit\Storage $storage */
         $storage = $event->sender;
         if (!$storage->getFilesystem()->has('.dirindex')) {
             $storage->getFilesystem()->write('.dirindex', 1);
             $dirindex = 1;
         } else {
             $dirindex = $storage->getFilesystem()->read('.dirindex');
         }
         if ($storage->maxDirFiles !== -1) {
             if ($storage->getFilesystem()->has($dirindex)) {
                 $filesCount = count($storage->getFilesystem()->listContents($dirindex));
                 if ($filesCount > $storage->maxDirFiles) {
                     $dirindex++;
                     $storage->getFilesystem()->createDir($dirindex);
                 }
             } else {
                 $storage->getFilesystem()->createDir($dirindex);
             }
         }
     });
     $client = new \Sabre\DAV\Client(['baseUri' => 'https://webdav.yandex.ru']);
     $client->addCurlSetting(CURLOPT_SSL_VERIFYPEER, false);
     $client->addCurlSetting(CURLOPT_HTTPHEADER, ['Authorization: OAuth TOKENTOKENTOKEN', 'Accept: */*', 'Host: webdav.yandex.ru']);
     $adapter = new WebDAVAdapter($client, '/');
     $flysystem = new Filesystem($adapter);
     if (!$flysystem->has($this->pathPrefix)) {
         $flysystem->createDir($this->pathPrefix);
     }
     $adapter->setPathPrefix($this->pathPrefix);
     return $flysystem;
 }
Ejemplo n.º 2
0
 /**
  *  Default constructor for CalDAV client.
  *
  * @param string Caldav URI to appropriate calendar.
  * @param string Username for HTTP basic auth.
  * @param string Password for HTTP basic auth.
  * @param boolean Verify SSL cert. // Mod by Rosali (https://gitlab.awesome-it.de/kolab/roundcube-plugins/issues/1)
  */
 public function __construct($uri, $user = null, $pass = null, $authtype = 'detect', $verifySSL = array(true, true))
 {
     $this->user_agent = 'MyRoundcube-SabreDAV/' . Sabre\DAV\Version::VERSION;
     // Include libvcalendar on demand ...
     if (!class_exists("libvcalendar")) {
         require_once INSTALL_PATH . 'plugins/libgpl/libcalendaring/libvcalendar.php';
     }
     $this->libvcal = new libvcalendar();
     $this->rc = rcube::get_instance();
     $tokens = parse_url($uri);
     $this->base_uri = $tokens['scheme'] . "://" . $tokens['host'] . ($tokens['port'] ? ":" . $tokens['port'] : null);
     $this->path = $tokens['path'] . ($tokens['query'] ? "?" . $tokens['query'] : null);
     switch ($authtype) {
         case 'digest':
             $auth = Sabre\DAV\Client::AUTH_DIGEST;
             break;
         case 'basic':
             $auth = Sabre\DAV\Client::AUTH_BASIC;
             break;
         default:
             $auth = Sabre\DAV\Client::AUTH_BASIC | Sabre\DAV\Client::AUTH_DIGEST;
     }
     $settings = array('baseUri' => $this->base_uri, 'authType' => $auth);
     if ($user) {
         $settings['userName'] = $user;
     }
     if ($pass) {
         $settings['password'] = $pass;
     }
     parent::__construct($settings);
     $this->verifyPeer = $verifySSL[0];
     $this->verifyHost = $verifySSL[1];
 }
Ejemplo n.º 3
0
function WebDAVFetch($URL, $enable_cache, $cache_time, $verify_peer)
{
    $parts = parse_url($URL);
    $location = $parts['scheme'] . '://' . $parts['host'] . $parts['path'];
    if (!array_key_exists('host', $parts)) {
        $parts['host'] = $parts['path'];
        $parts['path'] = '/';
    }
    if (!array_key_exists('scheme', $parts)) {
        $parts['scheme'] = 'http';
    }
    if (!array_key_exists('path', $parts)) {
        $parts['path'] = '/';
    }
    $location = $parts['scheme'] . '://' . $parts['host'] . $parts['path'];
    $settings = array('baseUri' => $location);
    if (array_key_exists('user', $parts)) {
        $settings['userName'] = $parts['user'];
    }
    if (array_key_exists('pass', $parts)) {
        $settings['password'] = $parts['pass'];
    }
    $client = new Sabre\DAV\Client($settings);
    if (!$verify_peer) {
        $client->addCurlSetting(CURLOPT_SSL_VERIFYPEER, FALSE);
    }
    $client->addCurlSetting(CURLOPT_USERAGENT, 'Extcal');
    $entries = $client->propfind('', array('{DAV:}getetag', '{DAV:}getcontenttype', '{DAV:}getlastmodified'), 1);
    $RET = "";
    foreach ($entries as $ICS => $properties) {
        $cachefile = preg_replace('/\\.ics\\.ics/', '.ics', dirname(__FILE__) . "/cache/" . preg_replace('/\\//', '_', $ICS) . ".ics");
        if (array_key_exists('{DAV:}getcontenttype', $properties) && preg_match('/calendar/i', $properties['{DAV:}getcontenttype']) > 0) {
            if ($enable_cache && $cache_time > 0 && file_exists($cachefile) && strtotime($properties['{DAV:}getlastmodified']) < filemtime($cachefile) && time() - filemtime($cachefile) < $cache_time) {
                $entry = file_get_contents($cachefile);
            } else {
                $entry = $client->request('GET', $ICS)['body'];
                if ($enable_cache) {
                    file_put_contents($cachefile, $entry);
                }
            }
            $RET .= $entry . "\n\n";
        }
    }
    // workaround for start dates before 1970
    // $RET = preg_replace("/DTSTART;VALUE=DATE:19[0-6]/","DTSTART;VALUE=DATE:197",$RET);
    return $RET;
}
Ejemplo n.º 4
0
 /**
  * Constructor
  *
  * Settings are provided through the 'settings' argument. The following
  * settings are supported:
  *
  *   * client
  *   * baseUri
  *   * userName (optional)
  *   * password (optional)
  *   * proxy (optional)
  *
  * @param array $settings
  */
 public function __construct(array $settings)
 {
     if (!isset($settings['client'])) {
         throw new InvalidArgumentException('A client must be provided');
     }
     $this->_http = $settings['client'];
     $this->propertyMap['{DAV:}current-user-privilege-set'] = 'Sabre\\DAVACL\\Property\\CurrentUserPrivilegeSet';
     parent::__construct($settings);
 }
Ejemplo n.º 5
0
 public function actionInstall($argv)
 {
     count($argv) > 0 || APP_ID != 'gini' or die("Usage: gini index install <module> <version>\n\n");
     if (!class_exists('\\Sabre\\DAV\\Client')) {
         self::_loadGiniComposer();
     }
     list($options, $headers) = self::_davOptionsAndHeaders();
     $client = new \Sabre\DAV\Client($options);
     $installedModules = [];
     $installModule = function ($module, $versionRange, $targetDir, $isApp = false) use(&$installModule, &$installedModules, &$client, &$options, &$headers) {
         if (isset($installedModules[$module])) {
             $info = $installedModules[$module];
             $v = new \Gini\Version($info->version);
             // if installed version is incorrect, abort the operation.
             if (!$v->satisfies($versionRange)) {
                 die("Conflict detected on {$module}! Installed: {$v->fullVersion} Expecting: {$versionRange}\n");
             }
         } else {
             // try to see if we've already got it somewhere
             if (isset(\Gini\Core::$MODULE_INFO[$module])) {
                 $info = \Gini\Core::$MODULE_INFO[$module];
                 $v = new \Gini\Version($info->version);
                 if ($v->satisfies($versionRange)) {
                     $matched = $v;
                 }
             }
             // fetch index.json
             echo "Fetching catalog of {$module}...\n";
             while (true) {
                 $response = $client->request('GET', $module . '/index.json', null, $headers);
                 if ($response['statusCode'] == 401 && isset($response['headers']['www-authenticate'])) {
                     // Authentication required
                     // prompt user/password and try again
                     if (!isset($options['userName'])) {
                         list($options, $headers) = self::_davOptionsAndHeaders(true);
                         $client = new \Sabre\DAV\Client($options);
                         continue;
                     }
                     $matched or die("Access denied for fetch catalog of {$module} .\n");
                     $response = null;
                 } elseif ($response['statusCode'] < 200 || $response['statusCode'] > 206) {
                     $matched or die('Error: ' . $response['statusCode'] . "\n");
                     $response = null;
                 }
                 break;
             }
             if ($response) {
                 $indexInfo = (array) json_decode($response['body'], true);
                 // find latest match version
                 foreach ($indexInfo as $version => $foo) {
                     $v = new \Gini\Version($version);
                     if ($v->satisfies($versionRange)) {
                         if ($matched) {
                             if ($matched->compare($v) > 0) {
                                 continue;
                             }
                         }
                         $matched = $v;
                     }
                 }
             }
             if (!$matched) {
                 die("Failed to locate required version!\n");
             }
             if (!$info || $matched->fullVersion != $info->version) {
                 $version = $matched->fullVersion;
                 $info = (object) $indexInfo[$version];
                 $tarPath = "{$module}/{$version}.tgz";
                 echo "Downloading {$module} from {$tarPath}...\n";
                 while (true) {
                     $response = $client->request('GET', $tarPath, null, $headers);
                     if ($response['statusCode'] == 401 && isset($response['headers']['www-authenticate'])) {
                         // Authentication required
                         // prompt user/password and try again
                         if (!isset($options['userName'])) {
                             list($options, $headers) = self::_davOptionsAndHeaders(true);
                             $client = new \Sabre\DAV\Client($options);
                             continue;
                         }
                         die("Access denied for fetch catalog of {$module}.\n");
                     }
                     if ($response['statusCode'] < 200 || $response['statusCode'] > 206) {
                         die('Error: ' . $response['statusCode'] . "\n");
                     }
                     break;
                 }
                 if ($isApp) {
                     $modulePath = $targetDir;
                 } else {
                     $modulePath = "{$targetDir}/modules/{$module}";
                 }
                 if (is_dir($modulePath) && file_exists($modulePath)) {
                     \Gini\File::removeDir($modulePath);
                 }
                 \Gini\File::ensureDir($modulePath);
                 echo "Extracting {$module}...\n";
                 $ph = popen('tar -zx -C ' . escapeshellcmd($modulePath), 'w');
                 if (is_resource($ph)) {
                     fwrite($ph, $response['body']);
                     pclose($ph);
                 }
             } else {
                 $version = $info->version;
                 echo "Found local copy of {$module}/{$version}.\n";
             }
             $installedModules[$module] = $info;
             echo "\n";
         }
         if ($info) {
             foreach ((array) $info->dependencies as $m => $r) {
                 if ($m == 'gini') {
                     continue;
                 }
                 $installModule($m, $r, $targetDir, false);
             }
         }
     };
     if (count($argv) > 0) {
         // e.g. gini install xxx
         $module = $argv[0];
         if (count($argv) > 1) {
             $versionRange = $argv[1];
         } else {
             $versionRange = readline('Please provide a version constraint for the ' . $module . ' requirement:');
         }
         $installModule($module, $versionRange, $_SERVER['PWD'] . "/{$module}", true);
     } else {
         // run: gini install, then you should be in module directory
         if (APP_ID != 'gini') {
             // try to install its dependencies
             $app = \Gini\Core::moduleInfo(APP_ID);
             $installedModules[APP_ID] = $app;
             $installModule(APP_ID, $app->version, APP_PATH, true);
         }
     }
 }
Ejemplo n.º 6
0
 /**
  * @param string $sEmail
  * @param string $sUrl
  * @param string $sUser
  * @param string $sPassword
  * @param string $sProxy = ''
  *
  * @return bool
  */
 public function Sync($sEmail, $sUrl, $sUser, $sPassword, $sProxy = '')
 {
     $this->SyncDatabase();
     $iUserID = $this->getUserId($sEmail);
     if (0 >= $iUserID) {
         return false;
     }
     $aUrl = \parse_url($sUrl);
     if (!\is_array($aUrl)) {
         $aUrl = array();
     }
     $aUrl['scheme'] = isset($aUrl['scheme']) ? $aUrl['scheme'] : 'http';
     $aUrl['host'] = isset($aUrl['host']) ? $aUrl['host'] : 'localhost';
     $aUrl['port'] = isset($aUrl['port']) ? $aUrl['port'] : 80;
     $aUrl['path'] = isset($aUrl['path']) ? \rtrim($aUrl['path'], '\\/') . '/' : '/';
     $aSettings = array('baseUri' => $aUrl['scheme'] . '://' . $aUrl['host'] . ('80' === (string) $aUrl['port'] ? '' : ':' . $aUrl['port']), 'userName' => $sUser, 'password' => $sPassword);
     $this->oLogger->AddSecret($sPassword);
     if (!empty($sProxy)) {
         $aSettings['proxy'] = $sProxy;
     }
     $sPath = $aUrl['path'];
     if (!\class_exists('Sabre\\DAV\\Client')) {
         return false;
     }
     $oClient = new \Sabre\DAV\Client($aSettings);
     $oClient->setVerifyPeer(false);
     $this->oLogger->Write('User: '******'userName'] . ', Url: ' . $sUrl, \MailSo\Log\Enumerations\Type::INFO, 'DAV');
     $aRemoteSyncData = $this->prepearRemoteSyncData($oClient, $sPath);
     if (false === $aRemoteSyncData) {
         return false;
     }
     $aDatabaseSyncData = $this->prepearDatabaseSyncData($iUserID);
     //		$this->oLogger->WriteDump($aDatabaseSyncData);
     //		$this->oLogger->WriteDump($aRemoteSyncData);
     //+++del (from carddav)
     foreach ($aDatabaseSyncData as $sKey => $aData) {
         if ($aData['deleted'] && isset($aRemoteSyncData[$sKey], $aRemoteSyncData[$sKey]['vcf'])) {
             $this->davClientRequest($oClient, 'DELETE', $sPath . $aRemoteSyncData[$sKey]['vcf']);
         }
     }
     //---del
     //+++del (from db)
     $aIdsForDeletedion = array();
     foreach ($aDatabaseSyncData as $sKey => $aData) {
         if (!$aData['deleted'] && !empty($aData['etag']) && !isset($aRemoteSyncData[$sKey])) {
             $aIdsForDeletedion[] = $aData['id_contact'];
         }
     }
     if (0 < \count($aIdsForDeletedion)) {
         $this->DeleteContacts($sEmail, $aIdsForDeletedion, false);
     }
     //---del
     $this->flushDeletedContacts($iUserID);
     //+++new or newer (from db)
     foreach ($aDatabaseSyncData as $sKey => $aData) {
         if (!$aData['deleted'] && (empty($aData['etag']) && !isset($aRemoteSyncData[$sKey])) || !empty($aData['etag']) && isset($aRemoteSyncData[$sKey]) && $aRemoteSyncData[$sKey]['etag'] !== $aData['etag'] && $aRemoteSyncData[$sKey]['changed'] < $aData['changed']) {
             $mID = $aData['id_contact'];
             $oContact = $this->GetContactByID($sEmail, $mID, false);
             if ($oContact) {
                 $sExsistensBody = '';
                 $mExsistenRemoteID = isset($aRemoteSyncData[$sKey]['vcf']) && !empty($aData['etag']) ? $aRemoteSyncData[$sKey]['vcf'] : '';
                 if (0 < \strlen($mExsistenRemoteID)) {
                     $oResponse = $this->davClientRequest($oClient, 'GET', $sPath . $mExsistenRemoteID);
                     if ($oResponse && isset($oResponse['headers'], $oResponse['body'])) {
                         $sExsistensBody = \trim($oResponse['body']);
                     }
                 }
                 $oResponse = $this->davClientRequest($oClient, 'PUT', $sPath . $oContact->CardDavNameUri(), $oContact->ToVCard($sExsistensBody));
                 if ($oResponse && isset($oResponse['headers'], $oResponse['headers']['etag'])) {
                     $sEtag = \trim(\trim($oResponse['headers']['etag']), '"\'');
                     $sDate = !empty($oResponse['headers']['date']) ? \trim($oResponse['headers']['date']) : '';
                     if (!empty($sEtag)) {
                         $iChanged = empty($sDate) ? \time() : \MailSo\Base\DateTimeHelper::ParseRFC2822DateString($sDate);
                         $this->updateContactEtagAndTime($iUserID, $mID, $sEtag, $iChanged);
                     }
                 }
             }
             unset($oContact);
         }
     }
     //---new
     //+++new or newer (from carddav)
     foreach ($aRemoteSyncData as $sKey => $aData) {
         if (!isset($aDatabaseSyncData[$sKey]) || $aDatabaseSyncData[$sKey]['etag'] !== $aData['etag'] && $aDatabaseSyncData[$sKey]['changed'] < $aData['changed']) {
             $mExsistenContactID = isset($aDatabaseSyncData[$sKey]['id_contact']) ? $aDatabaseSyncData[$sKey]['id_contact'] : '';
             $oResponse = $this->davClientRequest($oClient, 'GET', $sPath . $aData['vcf']);
             if ($oResponse && isset($oResponse['headers'], $oResponse['body'])) {
                 $sBody = \trim($oResponse['body']);
                 if (!empty($sBody)) {
                     $oContact = null;
                     if ($mExsistenContactID) {
                         $oContact = $this->GetContactByID($sEmail, $mExsistenContactID);
                     }
                     if (!$oContact) {
                         $oContact = new \RainLoop\Providers\AddressBook\Classes\Contact();
                     }
                     $oContact->PopulateByVCard($sBody, !empty($oResponse['headers']['etag']) ? \trim(\trim($oResponse['headers']['etag']), '"\'') : '');
                     $this->ContactSave($sEmail, $oContact);
                     unset($oContact);
                 }
             }
         }
     }
     return true;
 }
Ejemplo n.º 7
0
 public function initWithResource($resource)
 {
     $config = $resource->config;
     $this->importFly();
     $adapterClass = '\\League\\Flysystem\\Adapter\\' . $resource->adapter;
     if (property_exists($config, 'pathPrefix')) {
         $this->pathPrefix = $config->pathPrefix;
     }
     if ($resource->adapter == 'Ftp' || $resource->adapter == 'Sftp') {
         $adapterInstance = new $adapterClass((array) $config);
     } else {
         if ($resource->adapter == 'WebDav') {
             //require_once realpath(dirname(__FILE__)) .'/vendor/sabre/dav/lib/Sabre/autoload.php';
             require_once realpath(dirname(__FILE__)) . '/vendor/autoload.php';
             $client = new Sabre\DAV\Client((array) $config);
             $client->setVerifyPeer(false);
             //$client->
             /*CURLOPT_SSL_VERIFYPEER => 0,
             CURLOPT_SSL_VERIFYHOST => 0,*/
             //xapp_dump($client);
             $adapterInstance = new $adapterClass($client);
         } else {
             if ($resource->adapter == 'Dropbox') {
                 require_once realpath(dirname(__FILE__)) . '/vendor/dropbox/dropbox-sdk/lib/Dropbox/autoload.php';
                 $client = new \Dropbox\Client($config->token, $config->appname);
                 $adapterInstance = new $adapterClass($client);
             } else {
                 if ($resource->adapter == 'GoogleDrive') {
                     //$client_id = '914720938366-1b9t1n0d87g7r429j37kh29474n301la.apps.googleusercontent.com';
                     //$client_secret = '-FqmFBTynCy6VBIYwDLeIvPm';
                     $client_id = '34179804656-v7ckk0id5h1dcrpoj07c2343vbf2qto2.apps.googleusercontent.com';
                     $client_secret = 'ZnWLJFaJh_c1AO8wk_d4Y7fk';
                     //$auth_token = '{"access_token":"ya29.IQD9DFJHv7U1kBgAAAAJSdBBwvJq8lmEj8f9RBsXbK5uX82vXlvlQAbn_pL2Rg","token_type":"Bearer","expires_in":3600,"refresh_token":"1\/_RAFGmxs0bQBSCCI3hJYnntuGiyXq28UGCdsW8E1cb4","created":1401030654}';
                     $auth_token = null;
                     // This URL should be the landing page after authorising the site access to your Google Drive.
                     // It should store your $auth_token or display it for manual entry.
                     //$auth_token = '{"access_token":"4/rBfx8PY5GOGkLPdeHnJLieoQBur_.gq0ftA4x5ZATOl05ti8ZT3YPlhuxjAI","token_type":"Bearer","expires_in":3600,"refresh_token":"1\/_RAFGmxs0bQBSCCI3hJYnntuGiyXq28UGCdsW8E1cb4","created":1401030654}';
                     $auth_token = '{"access_token":"ya29.KAACmqCTqVx9lBoAAABKWlyiPU-ZJiN-MOWl57hPFu1-uNjvC2vC5cQgO1IzJA","token_type":"Bearer","expires_in":3600,"created":1401645493}';
                     //$redirect_url = 'http://localhost/flysystem/GoogleDriveSetup.php';
                     $redirect_url = 'http://mc007ibi.dyndns.org:81/x4mm/Code/trunk/xide-php/xapp/xcf/index.php?debug=true';
                     //$redirect_url = 'http://www.mc007ibi.dyndns.org:81/xapp-commander-standalone/docroot/index.php?option=com_xappcommander&service=XCOM_Directory_Service.get&path=./Determining Food Preferences of Hagfish.docx&callback=asdf&mount=google&raw=html&attachment=true&user=e741198e1842408aa660459240d430a6&sig=025d0a5326e1bb4608b7624c99c3cff49db7664f';
                     //http://www.mc007ibi.dyndns.org:81/xapp-commander-standalone/docroot/index.php?option=com_xappcommander&service=XCOM_Directory_Service.get&path=./Determining Food Preferences of Hagfish.docx&callback=asdf&mount=google&raw=html&attachment=true&user=e741198e1842408aa660459240d430a6&sig=025d0a5326e1bb4608b7624c99c3cff49db7664f
                     //http://mc007ibi.dyndns.org:81/x4mm/Code/trunk/xide-php/xapp/xcf/index.php?debug=true&code=4/rBfx8PY5GOGkLPdeHnJLieoQBur_.gq0ftA4x5ZATOl05ti8ZT3YPlhuxjAI
                     //http://192.168.1.37:81/xapp-commander-standalone/docroot/index.php?option=com_xappcommander&service=XCOM_Directory_Service.get&path=./Cleanup.doc&callback=asdf&mount=/google&raw=html&attachment=true&user=e741198e1842408aa660459240d430a6&sig=5faf21f72a91fa70890c75b7f7f579b3fd5e03a8
                     //error_log('########0');
                     $client = new Google_Client();
                     if ($auth_token) {
                         $client->setAccessToken($auth_token);
                     }
                     $client->setClientId($client_id);
                     $client->setClientSecret($client_secret);
                     $client->setRedirectUri($redirect_url);
                     $token = $client->getAccessToken();
                     $code = null;
                     //$code = '4/lnZn4gks2d2pO1ddiO488ZxPKX_o.8uYEey1YDAkROl05ti8ZT3bHlSmxjAI';
                     //{"access_token":"ya29.KAACmqCTqVx9lBoAAABKWlyiPU-ZJiN-MOWl57hPFu1-uNjvC2vC5cQgO1IzJA","token_type":"Bearer","expires_in":3600,"created":1401645493}
                     //error_log('######## : ' . $token);//
                     //www.mc007ibi.dyndns.org:81/xapp-commander-standalone/docroot/index.php?option=com_xappcommander&service=XCOM_Directory_Service.get&path=./Determining Food Preferences of Hagfish.docx&callback=asdf&mount=google&raw=html&attachment=true&user=e741198e1842408aa660459240d430a6&sig=025d0a5326e1bb4608b7624c99c3cff49db7664f
                     if ($auth_token) {
                         error_log('have auth');
                         $refreshToken = json_decode($token);
                         /*xapp_dump($refreshToken);*/
                         /*
                         $refreshToken = $refreshToken->refresh_token;
                         if($client->getAuth()->isAccessTokenExpired()) {
                         			        $client->getAuth()->refreshToken($refreshToken);
                         }
                         */
                     } else {
                         if ($code) {
                             error_log('########1 : have code ');
                             $client->authenticate($code);
                             echo "Your access token for Google Drive is:<br /><br />\n\n";
                             echo $client->getAccessToken();
                             echo "\n\n<br /><br />This is your \$auth_token value. Set it in the configuration file.";
                             exit;
                         } else {
                             error_log('######## getting auth url : begin');
                             $client->setScopes(array('https://www.googleapis.com/auth/drive'));
                             $authUrl = $client->createAuthUrl();
                             error_log('######## getting auth url : ' . $authUrl);
                             /*echo($authUrl);*/
                             die("You must first authorise the plugin. Make sure your client ID and secret are set then <a href='{$authUrl}'>click here</a> to do so.");
                         }
                     }
                     $adapterInstance = new $adapterClass($client);
                 }
             }
         }
     }
     $fs = "League\\Flysystem\\Filesystem";
     // Add them in the constructor
     $manager = new League\Flysystem\MountManager(array($resource->name => new $fs($adapterInstance)));
     $this->mountManager = $manager;
     $this->adapter = $adapterInstance;
     //xapp_dump($resource);
     //$fs = $this->getFilesystem($resource->{'name'});
     // Or mount them later
     //$manager->mountFilesystem('local', $local);
     //xapp_dump($manager);
     //$filesystem = new Filesystem($adapterInstance);
     //$ls = $fs->listWith(array('mimetype', 'size', 'timestamp'),'httpdocs');
     //$ls = $fs->listWith(null,'httpdocs');
     //xapp_dump($fs->listContents('/httpdocs'));
 }