Version 4.3.0
This commit is contained in:
1 parent
96997ddd8e
commit
fe1acf984a
1349 files changed
+116159
-67711
No files matched your search
+36
-7
@@ -104,7 +104,7 @@ class _Url
|
||||
{
|
||||
return \IPS\Http\Url\Internal::createInternalFromComponents(
|
||||
'admin',
|
||||
\IPS\Settings::i()->logins_over_https ? static::PROTOCOL_HTTPS : $protocol,
|
||||
$protocol,
|
||||
\IPS\CP_DIRECTORY . '/'
|
||||
);
|
||||
}
|
||||
@@ -114,7 +114,7 @@ class _Url
|
||||
{
|
||||
return \IPS\Http\Url\Internal::createInternalFromComponents(
|
||||
'admin',
|
||||
\IPS\Settings::i()->logins_over_https ? static::PROTOCOL_HTTPS : $protocol,
|
||||
$protocol,
|
||||
\IPS\CP_DIRECTORY . '/',
|
||||
array( 'adsess' => session_id() ) + static::convertQueryAsStringToArray( $queryString )
|
||||
);
|
||||
@@ -209,6 +209,7 @@ class _Url
|
||||
|
||||
/* Is it internal? */
|
||||
$baseUrlComponents = static::componentsFromUrlString( static::baseUrl() );
|
||||
|
||||
if ( $components[ static::COMPONENT_HOST ] === $baseUrlComponents[ static::COMPONENT_HOST ] and
|
||||
$components[ static::COMPONENT_USERNAME ] === $baseUrlComponents[ static::COMPONENT_USERNAME ] and
|
||||
$components[ static::COMPONENT_PASSWORD ] === $baseUrlComponents[ static::COMPONENT_PASSWORD ] and
|
||||
@@ -528,7 +529,24 @@ class _Url
|
||||
*/
|
||||
public function isLocalhost()
|
||||
{
|
||||
return ( isset( $this->data['host'] ) and ( in_array( $this->data['host'], array( 'localhost', static::internal('')->data['host'] ) ) or ( filter_var( $this->data['host'], FILTER_VALIDATE_IP ) and filter_var( $this->data['host'], FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) === FALSE ) ) );
|
||||
$baseUrlHostname = static::internal('')->data['host'];
|
||||
|
||||
return (
|
||||
isset( $this->data['host'] )
|
||||
and
|
||||
(
|
||||
(
|
||||
$this->data['host'] == 'localhost' or
|
||||
preg_match( "#\." . preg_quote( $baseUrlHostname ) . "$#", '.' . $this->data['host'] ) or
|
||||
preg_match( "#\." . preg_quote( $this->data['host'] ) . "$#", '.' . $baseUrlHostname )
|
||||
)
|
||||
or
|
||||
(
|
||||
filter_var( $this->data['host'], FILTER_VALIDATE_IP ) and
|
||||
filter_var( $this->data['host'], FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) === FALSE
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -595,7 +613,7 @@ class _Url
|
||||
throw new \RuntimeException( "COULD_NOT_IMPORT" );
|
||||
}
|
||||
|
||||
return \IPS\File::create( $storageExtension, basename( $this->data[ static::COMPONENT_PATH ] ), $response );
|
||||
return \IPS\File::create( $storageExtension, basename( $this->data[ static::COMPONENT_PATH ] ), (string) $response );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1047,7 +1065,7 @@ class _Url
|
||||
* @param bool $encode If true, will encode for output
|
||||
* @return string
|
||||
*/
|
||||
protected static function convertQueryAsArrayToString( $query, $encode = FALSE )
|
||||
public static function convertQueryAsArrayToString( $query, $encode = FALSE )
|
||||
{
|
||||
$return = array();
|
||||
foreach ( $query as $k => $v )
|
||||
@@ -1082,19 +1100,30 @@ class _Url
|
||||
*
|
||||
* @param string $key The key for this query string parameter
|
||||
* @param array $value The query as an array (e.g. [ 'foo'=>'bar', 'moo'=>'baz' ])
|
||||
* @param bool $encode If true, will encode for output
|
||||
* @return string
|
||||
*/
|
||||
protected static function squashQueryStringArray( $key, $value )
|
||||
protected static function squashQueryStringArray( $key, $value, $encode = FALSE )
|
||||
{
|
||||
$return = array();
|
||||
foreach ( $value as $k => $v )
|
||||
{
|
||||
if ( $encode )
|
||||
{
|
||||
$k = static::encodeComponent( static::COMPONENT_QUERY_KEY, $k );
|
||||
}
|
||||
|
||||
if ( is_array( $v ) )
|
||||
{
|
||||
$return[] = static::squashQueryStringArray( "{$key}[{$k}]", $v );
|
||||
$return[] = static::squashQueryStringArray( "{$key}[{$k}]", $v, $encode );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( $encode )
|
||||
{
|
||||
$v = static::encodeComponent( static::COMPONENT_QUERY_VALUE, $v );
|
||||
}
|
||||
|
||||
$return[] = "{$key}[{$k}]={$v}";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user