Version 4.2.0
This commit is contained in:
1 parent
0dc2aee5ed
commit
96997ddd8e
2074 files changed
+125454
-55780
No files matched your search
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief HTTP Ranges Request/Response Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 19 May 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
* @note This class facilitates parsing of HTTP Range requests and sending the appropriate response
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief cURL REST Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 18 Mar 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\Http\Request;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Request Exception Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 26 Aug 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\Http\Request;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Sockets REST Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 18 Mar 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\Http\Request;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief HTTP Response Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 18 Mar 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\Http;
|
||||
|
||||
+5
-8
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief URL Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 10 Jun 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\Http;
|
||||
@@ -573,7 +572,7 @@ class _Url
|
||||
}
|
||||
|
||||
/* Set a default user-agent (some services, e.g. spotify, block requests without one but it's good to do so anyway) */
|
||||
$requestObj->setHeaders( array( 'User-Agent' => 'IPS Community Suite 4' ) );
|
||||
$requestObj->setHeaders( array( 'User-Agent' => 'Invision Community 4' ) );
|
||||
|
||||
/* Return */
|
||||
return $requestObj;
|
||||
@@ -1113,8 +1112,6 @@ class _Url
|
||||
{
|
||||
$return = array();
|
||||
|
||||
/* 3.x accepted both & and ? as query string parameters, so we need to normalize */
|
||||
$query = str_replace( '?', '&', $query );
|
||||
if ( $query !== NULL )
|
||||
{
|
||||
foreach ( explode( '&', $query ) as $part )
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief URL Exception
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 12 May 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\Http\Url;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Friendly URL
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 11 May 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\Http\Url;
|
||||
@@ -252,7 +251,19 @@ class _Friendly extends \IPS\Http\Url\Internal
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* And it also used to do index.php?/topic/123-example/?p=456 - with the double ? */
|
||||
foreach ( $correctUrl->queryString as $k => $v )
|
||||
{
|
||||
if ( preg_match( '/^\/' . preg_quote( $correctUrl->friendlyUrlComponent, '/' ) . '\/\?(.+)$/', $k, $matches ) )
|
||||
{
|
||||
$correctUrl = $correctUrl->setQueryString( array(
|
||||
$matches[0] => NULL,
|
||||
$matches[1] => $v
|
||||
) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( (string) $correctUrl->normaliseForEqualityCheck() !== (string) $this->normaliseForEqualityCheck() )
|
||||
{
|
||||
return $correctUrl;
|
||||
@@ -502,7 +513,7 @@ class _Friendly extends \IPS\Http\Url\Internal
|
||||
$definitions = array();
|
||||
foreach ( $data['pages'] as $k => $page )
|
||||
{
|
||||
$definitions[ $k ] = static::buildFurlDefinition( $page['friendly'], $page['real'], $topLevel, $app->default, isset( $page['alias'] ) ? $page['alias'] : NULL, FALSE, isset( $page['verify'] ) ? $page['verify'] : NULL );
|
||||
$definitions[ $k ] = static::buildFurlDefinition( $page['friendly'], $page['real'], $topLevel, $app->default, isset( $page['alias'] ) ? $page['alias'] : NULL, FALSE, isset( $page['verify'] ) ? $page['verify'] : NULL, isset( $page['seoTitles'] ) ? $page['seoTitles'] : NULL );
|
||||
}
|
||||
|
||||
/* Add it in */
|
||||
@@ -527,9 +538,10 @@ class _Friendly extends \IPS\Http\Url\Internal
|
||||
* @param NULL|string $alias Friendly URL alias
|
||||
* @param bool $custom Flag to indicate if this is a custom FURL definition
|
||||
* @param string $verify The name of a class that contains a loadFromUrl() and an url() method for verifying the friendly URL is correct
|
||||
* @param array $seoTitles The class, query param and property to load from to rebuild seo titles
|
||||
* @return array
|
||||
*/
|
||||
public static function buildFurlDefinition( $friendly, $real, $appTopLevel = NULL, $appIsDefault = FALSE, $alias = NULL, $custom = FALSE, $verify = NULL )
|
||||
public static function buildFurlDefinition( $friendly, $real, $appTopLevel = NULL, $appIsDefault = FALSE, $alias = NULL, $custom = FALSE, $verify = NULL, $seoTitles = NULL )
|
||||
{
|
||||
/* Init */
|
||||
$return = array(
|
||||
@@ -544,6 +556,10 @@ class _Friendly extends \IPS\Http\Url\Internal
|
||||
{
|
||||
$return['custom'] = TRUE;
|
||||
}
|
||||
if ( $seoTitles )
|
||||
{
|
||||
$return['seoTitles'] = $seoTitles;
|
||||
}
|
||||
|
||||
/* If it has a top-level (e.g. "/forums") we need to store the definition either with that if it's the default app, or
|
||||
without it if it isn't, so that if the default app changes we can redirect accordingly */
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Internal URL
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 11 May 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\Http\Url;
|
||||
@@ -174,7 +173,7 @@ class _Internal extends \IPS\Http\Url
|
||||
/* Check the currently logged in user can view it, as we don't want to reveal the correct
|
||||
URL to something the user has no permission to view */
|
||||
$canView = TRUE;
|
||||
if ( $contentObject instanceof \IPS\Content )
|
||||
if ( $contentObject instanceof \IPS\Content or $contentObject instanceof \IPS\Member\Club )
|
||||
{
|
||||
$canView = $contentObject->canView();
|
||||
}
|
||||
|
||||
+39
-123
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief User-Agent Management Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 20 Aug 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\Http;
|
||||
@@ -26,28 +25,33 @@ class _Useragent
|
||||
/**
|
||||
* @brief Search engine spider?
|
||||
*/
|
||||
public $spider = FALSE;
|
||||
public $spider = FALSE;
|
||||
|
||||
/**
|
||||
* @brief Mobile or tablet device?
|
||||
*/
|
||||
public $mobile = FALSE;
|
||||
public $mobile = FALSE;
|
||||
|
||||
/**
|
||||
* @brief Browser or user agent key
|
||||
* @brief Browser name
|
||||
*/
|
||||
public $useragentKey = NULL;
|
||||
public $browser = NULL;
|
||||
|
||||
/**
|
||||
* @brief Browser version
|
||||
*/
|
||||
public $useragentVersion = NULL;
|
||||
|
||||
public $browserVersion = NULL;
|
||||
|
||||
/**
|
||||
* @brief Platform Name
|
||||
*/
|
||||
public $platform = NULL;
|
||||
|
||||
/**
|
||||
* @brief Full user agent string
|
||||
*/
|
||||
public $useragent = NULL;
|
||||
|
||||
public $useragent = NULL;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@@ -56,9 +60,9 @@ class _Useragent
|
||||
*/
|
||||
protected function __construct( $userAgent )
|
||||
{
|
||||
$this->useragent = $userAgent;
|
||||
$this->useragent = $userAgent;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@@ -75,23 +79,6 @@ class _Useragent
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Human-Readable Browser Name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if ( \IPS\Member::loggedIn()->language()->checkKeyExists( 'useragent-' . $this->useragentKey ) )
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->get( 'useragent-' . $this->useragentKey ) . ( $this->useragentVersion ? " {$this->useragentVersion}" : '' );
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->useragentKey;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the user agent data
|
||||
*
|
||||
@@ -99,8 +86,15 @@ class _Useragent
|
||||
*/
|
||||
public function parseUserAgent()
|
||||
{
|
||||
/* Set basic data */
|
||||
require_once( \IPS\ROOT_PATH . '/system/3rd_party/PhpUserAgent/UserAgentParser.php' );
|
||||
$data = parse_user_agent( $this->useragent );
|
||||
$this->platform = $data['platform'];
|
||||
$this->browser = $data['browser'];
|
||||
$this->browserVersion = $data['version'];
|
||||
|
||||
/* Is this a spider? */
|
||||
foreach( array_merge( $this->searchEngineUseragents, $this->mobileEngineUseragents, $this->standardEngineUseragents ) as $key => $regex )
|
||||
foreach( $this->searchEngineUseragents as $key => $regex )
|
||||
{
|
||||
if( is_array( $regex ) )
|
||||
{
|
||||
@@ -108,13 +102,7 @@ class _Useragent
|
||||
{
|
||||
if( preg_match( "#" . $_expression . "#im", $this->useragent, $matches ) )
|
||||
{
|
||||
$this->useragentKey = $key;
|
||||
|
||||
if( isset( $matches[1] ) AND !empty( $matches[1] ) )
|
||||
{
|
||||
$this->useragentVersion = $matches[1];
|
||||
}
|
||||
|
||||
$this->spider = $key;
|
||||
break 2;
|
||||
}
|
||||
}
|
||||
@@ -123,36 +111,13 @@ class _Useragent
|
||||
{
|
||||
if( preg_match( "#" . $regex . "#im", $this->useragent, $matches ) )
|
||||
{
|
||||
$this->useragentKey = $key;
|
||||
|
||||
if( isset( $matches[1] ) AND !empty( $matches[1] ) )
|
||||
{
|
||||
$this->useragentVersion = $matches[1];
|
||||
}
|
||||
|
||||
$this->spider = $key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Set mobile/spider flag as appropriate */
|
||||
if( $this->useragentKey )
|
||||
{
|
||||
if( array_key_exists( $this->useragentKey, $this->searchEngineUseragents ) )
|
||||
{
|
||||
$this->spider = TRUE;
|
||||
}
|
||||
else if( array_key_exists( $this->useragentKey, $this->mobileEngineUseragents ) )
|
||||
{
|
||||
$this->mobile = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->useragentKey = 'unknown';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief List of search engine user agent strings with regex to parse out the data.
|
||||
* @note Matches will be checked based on the order of this list - put more specific matches first and more generic matches later
|
||||
@@ -187,66 +152,17 @@ class _Useragent
|
||||
'yahoo' => "Yahoo(?:.*?)(?:Slurp|FeedSeeker)",
|
||||
'yandex' => "Yandex(?:[^\/]+?)\/([0-9.]{1,10})",
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* @brief List of mobile device user agent strings with regex to parse out the data.
|
||||
* @note Matches will be checked based on the order of this list - put more specific matches first and more generic matches later
|
||||
* @note If you wish to capture a version, be sure to have just ONE capturing parenthesis group (i.e. $matches[1])
|
||||
* @note You may put multiple regex definitions for a single key into an array
|
||||
* @note If the UA matches an entry in this array, $this->mobile will be set to TRUE
|
||||
* Human-Readable Browser Name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected $mobileEngineUseragents = array(
|
||||
'transformer' => ";\s+?Transformer\s+?",
|
||||
'android' => "\sandroid\s+?([A-Za-z0-9.]{1,10}).+?mobile",
|
||||
'firefoxmobile' => "Mozilla(?:[^\(]+?)\((?:android|tablet)",
|
||||
'androidtablet' => "\sandroid\s+?([A-Za-z0-9.]{1,10})",
|
||||
'blackberry' => "blackberry\s?(\d+?)[\/;]",
|
||||
'iphone' => "iphone;",
|
||||
'ipodtouch' => "ipod;",
|
||||
'iPad' => "iPad;",
|
||||
'sonyericsson' => "^SonyEricsson[A-Za-z0-9]",
|
||||
'nokia' => "Nokia[A-Za-z0-9]",
|
||||
'motorola' => "^mot-[A-Za-z0-9]",
|
||||
'samsung' => "^samsung-[A-Za-z0-9]",
|
||||
'siemens' => "^sie-[A-Za-z0-9]",
|
||||
'htc' => "(?:htc-|htc_)([A-Za-z0-9.]{1,10})",
|
||||
'lg' => "^(?:lg|lge)-[A-Za-z0-9]",
|
||||
'palm' => "(?:palmsource/| pre/[0-9.]{1,10}|palm webos)",
|
||||
'operamini' => "opera (?:mobi|mini)",
|
||||
'windows7' => "Windows Phone OS ([^;]+);",
|
||||
'windows8' => "Windows Phone ([^;]+);",
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief List of other user agent strings (desktop browsers) with regex to parse out the data.
|
||||
* @note Matches will be checked based on the order of this list - put more specific matches first and more generic matches later
|
||||
* @note If you wish to capture a version, be sure to have just ONE capturing parenthesis group (i.e. $matches[1])
|
||||
* @note You may put multiple regex definitions for a single key into an array
|
||||
*/
|
||||
protected $standardEngineUseragents = array(
|
||||
'edge' => "edge/([0-9.]{1,10})",
|
||||
'amaya' => "amaya/([0-9.]{1,10})",
|
||||
'aol' => "aol[ /\-]([0-9.]{1,10})",
|
||||
'camino' => "camino/([0-9.+]{1,10})",
|
||||
'chimera' => "chimera/([0-9.+]{1,10})",
|
||||
'chrome' => "Chrome/([0-9.]{1,10})",
|
||||
'curl' => "curl[ /]([0-9.]{1,10})",
|
||||
'firebird' => "Firebird/([0-9.+]{1,10})",
|
||||
'firefox' => "Firefox/([0-9.+]{1,10})",
|
||||
'lotus' => "Lotus[ \-]?Notes[ /]([0-9.]{1,10})",
|
||||
'konqueror' => "konqueror/([0-9.]{1,10})",
|
||||
'lynx' => "lynx/([0-9a-z.]{1,10})",
|
||||
'maxthon' => " Maxthon[\);]",
|
||||
'omniweb' => "omniweb/[ a-z]?([0-9.]{1,10})$",
|
||||
'opera' => "opera[ /]([0-9.]{1,10})",
|
||||
'safari' => "version/([0-9.]{1,10})\s+?safari/([0-9.]{1,10})",
|
||||
'webtv' => "webtv[ /]([0-9.]{1,10})",
|
||||
'netscape' => "^mozilla/([0-4]\.[0-9.]{1,10})",
|
||||
'mozilla' => "^mozilla/([5-9]\.[0-9a-z.]{1,10})",
|
||||
'xbox' => "\(compatible; MSIE[ /]([0-9.]{1,10})(.*)Xbox",
|
||||
'explorer' => "\(compatible; MSIE[ /]([0-9.]{1,10})",
|
||||
);
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'user_agent_parsed', FALSE, array( 'sprintf' => array( $this->browser, $this->browserVersion, $this->platform ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief List of Facebook IP addresses
|
||||
* @see <a href='https://developers.facebook.com/docs/ApplicationSecurity/#facebook_scraper'>Facebook application security</a>
|
||||
|
||||
Reference in new issue
Block a user