Version 4.5.0
This commit is contained in:
1 parent
1a0c7fd3c2
commit
f79dcf067a
3791 files changed
+248032
-76372
No files matched your search
@@ -12,7 +12,7 @@
|
||||
namespace IPS\cms\extensions\core\EditorLocations;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
namespace IPS\cms\extensions\core\EditorLocations;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -73,18 +73,48 @@ class _Records
|
||||
{
|
||||
throw new \OutOfRangeException;
|
||||
}
|
||||
|
||||
$className = $this->_getClassName( $id3 );
|
||||
$id = ( mb_strpos( $className, 'Review' ) !== FALSE OR mb_strpos( $className, 'Comment' ) !== FALSE ) ? $id2 : $id1;
|
||||
|
||||
try
|
||||
{
|
||||
$recordClass = '\IPS\cms\Records' . $id3;
|
||||
|
||||
return $recordClass::load( $id1 )->canView( $member );
|
||||
return $className::load( $id )->canView( $member );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Figure out the correct class name to return
|
||||
*
|
||||
* @param string|int $id3 The id3 value stored
|
||||
* @return string
|
||||
*/
|
||||
protected function _getClassName( $id3 )
|
||||
{
|
||||
/* Review? */
|
||||
if( mb_strpos( $id3, '-review' ) )
|
||||
{
|
||||
$bits = explode( '-', $id3 );
|
||||
$className = '\IPS\cms\Records\Review' . $bits[0];
|
||||
}
|
||||
/* Comment? */
|
||||
elseif( mb_strpos( $id3, '-comment' ) )
|
||||
{
|
||||
$bits = explode( '-', $id3 );
|
||||
$className = '\IPS\cms\Records\Comment' . $bits[0];
|
||||
}
|
||||
/* Record */
|
||||
else
|
||||
{
|
||||
$className = '\IPS\cms\Records' . $id3;
|
||||
}
|
||||
|
||||
return $className;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attachment lookup
|
||||
@@ -101,8 +131,10 @@ class _Records
|
||||
{
|
||||
if ( $id3 )
|
||||
{
|
||||
$recordClass = '\IPS\cms\Records' . $id3;
|
||||
$return = $recordClass::load( $id1 );
|
||||
$className = $this->_getClassName( $id3 );
|
||||
$id = ( mb_strpos( $className, 'Review' ) !== FALSE OR mb_strpos( $className, 'Comment' ) !== FALSE ) ? $id2 : $id1;
|
||||
|
||||
$return = $className::load( $id );
|
||||
$return->url(); // Need to check that won't throw an exception later, which might happen if the database no longer has a page
|
||||
return $return;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
namespace IPS\cms\extensions\core\EditorLocations;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
|
||||
Reference in new issue
Block a user