mirror of
https://github.com/Studio-42/elFinder
synced 2026-06-08 12:37:09 +00:00
[php:core] add public static function getConnectorUrl()
This commit is contained in:
@@ -3168,4 +3168,22 @@ class elFinder {
|
||||
return (int)$val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get script url.
|
||||
*
|
||||
* @return string full URL
|
||||
*
|
||||
* @author Naoki Sawada
|
||||
*/
|
||||
public static function getConnectorUrl() {
|
||||
$https = (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off');
|
||||
$url = ($https ? 'https://' : 'http://')
|
||||
.$_SERVER['SERVER_NAME'] // host
|
||||
.(((! $https && $_SERVER['SERVER_PORT'] == 80) || ($https && $_SERVER['SERVER_PORT'] == 443)) ? '' : (':' . $_SERVER['SERVER_PORT'])) // port
|
||||
.$_SERVER['REQUEST_URI']; // path & query
|
||||
list($url) = explode('?', $url);
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
} // END class
|
||||
|
||||
@@ -123,7 +123,7 @@ class elFinderVolumeFlysystemGoogleDriveNetmount extends \Hypweb\elFinderFlysyst
|
||||
|
||||
if ($options['user'] === 'init') {
|
||||
if (empty($options['url'])) {
|
||||
$options['url'] = $this->getConnectorUrl();
|
||||
$options['url'] = elFinder::getConnectorUrl();
|
||||
}
|
||||
|
||||
$callback = $options['url']
|
||||
@@ -320,22 +320,6 @@ class elFinderVolumeFlysystemGoogleDriveNetmount extends \Hypweb\elFinderFlysyst
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get script url
|
||||
*
|
||||
* @return string full URL
|
||||
* @author Naoki Sawada
|
||||
*/
|
||||
private function getConnectorUrl()
|
||||
{
|
||||
$url = ((isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off')? 'https://' : 'http://')
|
||||
. $_SERVER['SERVER_NAME'] // host
|
||||
. ($_SERVER['SERVER_PORT'] == 80 ? '' : ':' . $_SERVER['SERVER_PORT']) // port
|
||||
. $_SERVER['REQUEST_URI']; // path & query
|
||||
list($url) = explode('?', $url);
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
|
||||
@@ -189,7 +189,7 @@ class elFinderVolumeDropbox extends elFinderVolumeDriver {
|
||||
}
|
||||
}
|
||||
if (strpos($options['url'], 'http') !== 0 ) {
|
||||
$options['url'] = $this->getConnectorUrl();
|
||||
$options['url'] = elFinder::getConnectorUrl();
|
||||
}
|
||||
$callback = $options['url']
|
||||
. '?cmd=netmount&protocol=dropbox&host=dropbox.com&user=init&pass=return&node='.$options['id'].$cdata;
|
||||
@@ -259,21 +259,6 @@ class elFinderVolumeDropbox extends elFinderVolumeDriver {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get script url
|
||||
*
|
||||
* @return string full URL
|
||||
* @author Naoki Sawada
|
||||
*/
|
||||
private function getConnectorUrl() {
|
||||
$url = ((isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off')? 'https://' : 'http://')
|
||||
. $_SERVER['SERVER_NAME'] // host
|
||||
. ($_SERVER['SERVER_PORT'] == 80 ? '' : ':' . $_SERVER['SERVER_PORT']) // port
|
||||
. $_SERVER['REQUEST_URI']; // path & query
|
||||
list($url) = explode('?', $url);
|
||||
return $url;
|
||||
}
|
||||
|
||||
/*********************************************************************/
|
||||
/* INIT AND CONFIGURE */
|
||||
/*********************************************************************/
|
||||
|
||||
@@ -726,7 +726,7 @@ class elFinderVolumeGoogleDrive extends elFinderVolumeDriver
|
||||
|
||||
if ($options['user'] === 'init') {
|
||||
if (empty($options['url'])) {
|
||||
$options['url'] = $this->getConnectorUrl();
|
||||
$options['url'] = elFinder::getConnectorUrl();
|
||||
}
|
||||
|
||||
$callback = $options['url']
|
||||
@@ -853,24 +853,6 @@ class elFinderVolumeGoogleDrive extends elFinderVolumeDriver
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get script url.
|
||||
*
|
||||
* @return string full URL
|
||||
*
|
||||
* @author Naoki Sawada
|
||||
*/
|
||||
private function getConnectorUrl()
|
||||
{
|
||||
$url = ((isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') ? 'https://' : 'http://')
|
||||
.$_SERVER['SERVER_NAME'] // host
|
||||
.($_SERVER['SERVER_PORT'] == 80 ? '' : ':'.$_SERVER['SERVER_PORT']) // port
|
||||
.$_SERVER['REQUEST_URI']; // path & query
|
||||
list($url) = explode('?', $url);
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
/*********************************************************************/
|
||||
/* INIT AND CONFIGURE */
|
||||
/*********************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user