本文整理汇总了PHP中dropbox::getAccountInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP dropbox::getAccountInfo方法的具体用法?PHP dropbox::getAccountInfo怎么用?PHP dropbox::getAccountInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dropbox
的用法示例。
在下文中一共展示了dropbox::getAccountInfo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* Prepare FTP connection
* Connect to remote server and check if credentials are correct, if so, store the connection id in $ftp_conn
*
* @return bool
* @author Dmitry (dio) Levashov
* @author Cem (DiscoFever)
**/
protected function init()
{
if (!class_exists('PDO', false)) {
return $this->setError('PHP PDO class is require.');
}
if (!$this->options['consumerKey'] || !$this->options['consumerSecret'] || !$this->options['accessToken'] || !$this->options['accessTokenSecret']) {
return $this->setError('Required options undefined.');
}
if (empty($this->options['metaCachePath']) && defined('ELFINDER_DROPBOX_META_CACHE_PATH')) {
$this->options['metaCachePath'] = ELFINDER_DROPBOX_META_CACHE_PATH;
}
// make net mount key
$this->netMountKey = md5(join('-', array('dropbox', $this->options['path'])));
if (!$this->oauth) {
if (defined('ELFINDER_DROPBOX_USE_CURL_PUT')) {
$this->oauth = new Dropbox_OAuth_Curl($this->options['consumerKey'], $this->options['consumerSecret']);
} else {
if (class_exists('OAuth', false)) {
$this->oauth = new Dropbox_OAuth_PHP($this->options['consumerKey'], $this->options['consumerSecret']);
} else {
if (!class_exists('HTTP_OAuth_Consumer')) {
// We're going to try to load in manually
include 'HTTP/OAuth/Consumer.php';
}
if (class_exists('HTTP_OAuth_Consumer', false)) {
$this->oauth = new Dropbox_OAuth_PEAR($this->options['consumerKey'], $this->options['consumerSecret']);
}
}
}
}
if (!$this->oauth) {
return $this->setError('OAuth extension not loaded.');
}
// normalize root path
$this->root = $this->options['path'] = $this->_normpath($this->options['path']);
if (empty($this->options['alias'])) {
$this->options['alias'] = $this->options['path'] === '/' ? 'Dropbox.com' : 'Dropbox' . $this->options['path'];
}
$this->rootName = $this->options['alias'];
try {
$this->oauth->setToken($this->options['accessToken'], $this->options['accessTokenSecret']);
$this->dropbox = new Dropbox_API($this->oauth, $this->options['root']);
} catch (Dropbox_Exception $e) {
$this->session->remove('DropboxTokens');
return $this->setError('Dropbox error: ' . $e->getMessage());
}
// user
if (empty($this->options['dropboxUid'])) {
try {
$res = $this->dropbox->getAccountInfo();
$this->options['dropboxUid'] = $res['uid'];
} catch (Dropbox_Exception $e) {
$this->session->remove('DropboxTokens');
return $this->setError('Dropbox error: ' . $e->getMessage());
}
}
$this->dropboxUid = $this->options['dropboxUid'];
$this->tmbPrefix = 'dropbox' . base_convert($this->dropboxUid, 10, 32);
if (!empty($this->options['tmpPath'])) {
if ((is_dir($this->options['tmpPath']) || mkdir($this->options['tmpPath'])) && is_writable($this->options['tmpPath'])) {
$this->tmp = $this->options['tmpPath'];
}
}
if (!$this->tmp && is_writable($this->options['tmbPath'])) {
$this->tmp = $this->options['tmbPath'];
}
if (!$this->tmp && ($tmp = elFinder::getStaticVar('commonTempPath'))) {
$this->tmp = $tmp;
}
if (!empty($this->options['metaCachePath'])) {
if ((is_dir($this->options['metaCachePath']) || mkdir($this->options['metaCachePath'])) && is_writable($this->options['metaCachePath'])) {
$this->metaCache = $this->options['metaCachePath'];
}
}
if (!$this->metaCache && $this->tmp) {
$this->metaCache = $this->tmp;
}
if (!$this->metaCache) {
return $this->setError('Cache dirctory (metaCachePath or tmp) is require.');
}
// setup PDO
if (!$this->options['PDO_DSN']) {
$this->options['PDO_DSN'] = 'sqlite:' . $this->metaCache . DIRECTORY_SEPARATOR . '.elFinder_dropbox_db_' . md5($this->dropboxUid . $this->options['consumerSecret']);
}
// DataBase table name
$this->DB_TableName = $this->options['PDO_DBName'];
// DataBase check or make table
try {
$this->DB = new PDO($this->options['PDO_DSN'], $this->options['PDO_User'], $this->options['PDO_Pass'], $this->options['PDO_Options']);
if (!$this->checkDB()) {
return $this->setError('Can not make DB table');
}
//.........这里部分代码省略.........
示例2: init
/**
* Prepare FTP connection
* Connect to remote server and check if credentials are correct, if so, store the connection id in $ftp_conn
*
* @return bool
* @author Dmitry (dio) Levashov
* @author Cem (DiscoFever)
**/
protected function init()
{
$this->netmountPrepare($this->options);
if (!$this->options['consumerKey'] || !$this->options['consumerSecret'] || !$this->options['accessToken'] || !$this->options['accessTokenSecret']) {
return $this->setError('Required options undefined.');
}
// make net mount key
$this->netMountKey = md5(join('-', array('dropbox', $this->options['path'])));
if (!$this->oauth) {
if (class_exists('OAuth')) {
$this->oauth = new Dropbox_OAuth_PHP($this->options['consumerKey'], $this->options['consumerSecret']);
} else {
if (!class_exists('HTTP_OAuth_Consumer')) {
// We're going to try to load in manually
include 'HTTP/OAuth/Consumer.php';
}
if (class_exists('HTTP_OAuth_Consumer')) {
$this->oauth = new Dropbox_OAuth_PEAR($this->options['consumerKey'], $this->options['consumerSecret']);
}
}
}
if (!$this->oauth) {
return $this->setError('OAuth extension not loaded.');
}
// normalize root path
$this->root = $this->options['path'] = $this->_normpath($this->options['path']);
if (empty($this->options['alias'])) {
$this->options['alias'] = $this->options['path'] === '/' ? 'Dropbox.com' : 'Dropbox' . $this->options['path'];
}
$this->rootName = $this->options['alias'];
$this->options['separator'] = '/';
try {
$this->oauth->setToken($this->options['accessToken'], $this->options['accessTokenSecret']);
$this->dropbox = new Dropbox_API($this->oauth, $this->options['root']);
} catch (Dropbox_Exception $e) {
unset($_SESSION['elFinderDropboxTokens']);
return $this->setError('Dropbox error: ' . $e->getMessage());
}
// user
if (empty($this->options['dropboxUid'])) {
try {
$res = $this->dropbox->getAccountInfo();
$this->options['dropboxUid'] = $res['uid'];
} catch (Dropbox_Exception $e) {
unset($_SESSION['elFinderDropboxTokens']);
return $this->setError('Dropbox error: ' . $e->getMessage());
}
}
$this->dropboxUid = $this->options['dropboxUid'];
if (!empty($this->options['tmpPath'])) {
if ((is_dir($this->options['tmpPath']) || @mkdir($this->options['tmpPath'])) && is_writable($this->options['tmpPath'])) {
$this->tmp = $this->options['tmpPath'];
}
}
if (!$this->tmp && is_writable($this->options['tmbPath'])) {
$this->tmp = $this->options['tmbPath'];
}
if (!empty($this->options['metaCachePath'])) {
if ((is_dir($this->options['metaCachePath']) || @mkdir($this->options['metaCachePath'])) && is_writable($this->options['metaCachePath'])) {
$this->metaCache = $this->options['metaCachePath'];
}
}
if (!$this->metaCache && $this->tmp) {
$this->metaCache = $this->tmp;
}
if (!$this->tmp) {
$this->disabled[] = 'archive';
$this->disabled[] = 'extract';
}
if (!$this->metaCache) {
return $this->setError('Cache dirctory (metaCachePath or tmp) is require.');
}
$this->metaCacheFile = $this->metaCache . DIRECTORY_SEPARATOR . '.elFinder_dropbox_metaCache_' . md5($this->dropboxUid . $this->options['consumerSecret']);
$this->metaCacheGet(!empty($_REQUEST['init']));
return true;
}
示例3: init
/**
* Prepare FTP connection
* Connect to remote server and check if credentials are correct, if so, store the connection id in $ftp_conn
*
* @return bool
* @author Dmitry (dio) Levashov
* @author Cem (DiscoFever)
**/
protected function init()
{
if (!$this->options['consumerKey'] || !$this->options['consumerSecret'] || !$this->options['accessToken'] || !$this->options['accessTokenSecret']) {
return $this->setError('Required options undefined.');
}
if (empty($this->options['metaCachePath']) && defined('ELFINDER_DROPBOX_META_CACHE_PATH')) {
$this->options['metaCachePath'] = ELFINDER_DROPBOX_META_CACHE_PATH;
}
// make net mount key
$this->netMountKey = md5(join('-', array('dropbox', $this->options['path'])));
if (!$this->oauth) {
if (class_exists('OAuth')) {
$this->oauth = new Dropbox_OAuth_PHP($this->options['consumerKey'], $this->options['consumerSecret']);
} else {
if (!class_exists('HTTP_OAuth_Consumer')) {
// We're going to try to load in manually
include 'HTTP/OAuth/Consumer.php';
}
if (class_exists('HTTP_OAuth_Consumer')) {
$this->oauth = new Dropbox_OAuth_PEAR($this->options['consumerKey'], $this->options['consumerSecret']);
}
}
}
if (!$this->oauth) {
return $this->setError('OAuth extension not loaded.');
}
// normalize root path
$this->root = $this->options['path'] = $this->_normpath($this->options['path']);
if (empty($this->options['alias'])) {
$this->options['alias'] = $this->options['path'] === '/' ? 'Dropbox.com' : 'Dropbox' . $this->options['path'];
}
$this->rootName = $this->options['alias'];
$this->options['separator'] = '/';
try {
$this->oauth->setToken($this->options['accessToken'], $this->options['accessTokenSecret']);
$this->dropbox = new Dropbox_API($this->oauth, $this->options['root']);
} catch (Dropbox_Exception $e) {
unset($_SESSION['elFinderDropboxTokens']);
return $this->setError('Dropbox error: ' . $e->getMessage());
}
// user
if (empty($this->options['dropboxUid'])) {
try {
$res = $this->dropbox->getAccountInfo();
$this->options['dropboxUid'] = $res['uid'];
} catch (Dropbox_Exception $e) {
unset($_SESSION['elFinderDropboxTokens']);
return $this->setError('Dropbox error: ' . $e->getMessage());
}
}
$this->dropboxUid = $this->options['dropboxUid'];
$this->tmbPrefix = 'dropbox' . base_convert($this->dropboxUid, 10, 32);
if (!empty($this->options['tmpPath'])) {
if ((is_dir($this->options['tmpPath']) || @mkdir($this->options['tmpPath'])) && is_writable($this->options['tmpPath'])) {
$this->tmp = $this->options['tmpPath'];
}
}
if (!$this->tmp && is_writable($this->options['tmbPath'])) {
$this->tmp = $this->options['tmbPath'];
}
if (!empty($this->options['metaCachePath'])) {
if ((is_dir($this->options['metaCachePath']) || @mkdir($this->options['metaCachePath'])) && is_writable($this->options['metaCachePath'])) {
$this->metaCache = $this->options['metaCachePath'];
}
}
if (!$this->metaCache && $this->tmp) {
$this->metaCache = $this->tmp;
}
if (!$this->tmp) {
$this->disabled[] = 'archive';
$this->disabled[] = 'extract';
}
if (!$this->metaCache) {
return $this->setError('Cache dirctory (metaCachePath or tmp) is require.');
}
// setup PDO
if (!$this->options['PDO_DSN']) {
$this->options['PDO_DSN'] = 'sqlite:' . $this->metaCache . DIRECTORY_SEPARATOR . '.elFinder_dropbox_db_' . md5($this->dropboxUid . $this->options['consumerSecret']);
}
// DataBase table name
$this->DB_TableName = $this->options['PDO_DBName'];
// DataBase check or make table
if ($this->DB = new PDO($this->options['PDO_DSN'], $this->options['PDO_User'], $this->options['PDO_Pass'], $this->options['PDO_Options'])) {
if (!$this->checkDB()) {
return $this->setError('Can not make DB table');
}
} else {
return $this->setError('Could not use PDO');
}
$res = $this->deltaCheck(!empty($_REQUEST['init']));
if ($res !== true) {
if (is_string($res)) {
//.........这里部分代码省略.........