Version 4.1.19
This commit is contained in:
1 parent
28bd025b35
commit
2bd5025018
2674 files changed
+233518
-77766
No files matched your search
@@ -2,9 +2,10 @@
|
||||
/**
|
||||
* @brief Editor Extension: Block Form
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @package IPS Community Suite
|
||||
* @subpackage Content
|
||||
* @since 20 Feb 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
@@ -44,7 +45,7 @@ class _BlockContent
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Permission check for attachments
|
||||
*
|
||||
@@ -52,9 +53,10 @@ class _BlockContent
|
||||
* @param int|null $id1 Primary ID
|
||||
* @param int|null $id2 Secondary ID
|
||||
* @param string|null $id3 Arbitrary data
|
||||
* @param array $attachment The attachment data
|
||||
* @return bool
|
||||
*/
|
||||
public function attachmentPermissionCheck( $member, $id1, $id2, $id3 )
|
||||
public function attachmentPermissionCheck( $member, $id1, $id2, $id3, $attachment )
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
/**
|
||||
* @brief Editor Extension: Contact Form
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @package IPS Community Suite
|
||||
* @subpackage Content
|
||||
* @since 12 Nov 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
@@ -44,7 +45,7 @@ class _PageContent
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Permission check for attachments
|
||||
*
|
||||
@@ -52,9 +53,10 @@ class _PageContent
|
||||
* @param int|null $id1 Primary ID
|
||||
* @param int|null $id2 Secondary ID
|
||||
* @param string|null $id3 Arbitrary data
|
||||
* @param array $attachment The attachment data
|
||||
* @return bool
|
||||
*/
|
||||
public function attachmentPermissionCheck( $member, $id1, $id2, $id3 )
|
||||
public function attachmentPermissionCheck( $member, $id1, $id2, $id3, $attachment )
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
/**
|
||||
* @brief Editor Extension: Record Form
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @package IPS Community Suite
|
||||
* @subpackage Content
|
||||
* @since 20 Feb 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
@@ -44,7 +45,7 @@ class _Records
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Permission check for attachments
|
||||
*
|
||||
@@ -52,9 +53,10 @@ class _Records
|
||||
* @param int|null $id1 Primary ID
|
||||
* @param int|null $id2 Secondary ID
|
||||
* @param string|null $id3 Arbitrary data
|
||||
* @param array $attachment The attachment data
|
||||
* @return bool
|
||||
*/
|
||||
public function attachmentPermissionCheck( $member, $id1, $id2, $id3 )
|
||||
public function attachmentPermissionCheck( $member, $id1, $id2, $id3, $attachment )
|
||||
{
|
||||
if ( ! $id3 )
|
||||
{
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
/**
|
||||
* @brief Editor Extension: Record Form
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @package IPS Community Suite
|
||||
* @subpackage Content
|
||||
* @since 20 Feb 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
@@ -44,7 +45,7 @@ class _Widgets
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Permission check for attachments
|
||||
*
|
||||
@@ -52,23 +53,34 @@ class _Widgets
|
||||
* @param int|null $id1 Primary ID
|
||||
* @param int|null $id2 Secondary ID
|
||||
* @param string|null $id3 Arbitrary data
|
||||
* @param array $attachment The attachment data
|
||||
* @return bool
|
||||
*/
|
||||
public function attachmentPermissionCheck( $member, $id1, $id2, $id3 )
|
||||
public function attachmentPermissionCheck( $member, $id1, $id2, $id3, $attachment )
|
||||
{
|
||||
if ( ! $id3 )
|
||||
{
|
||||
throw new \OutOfRangeException;
|
||||
}
|
||||
|
||||
/* See if it's on a page in Pages */
|
||||
$pageId = $this->getPageIdFromWidgetUniqueId( $id3 );
|
||||
|
||||
if ( $pageId === NULL )
|
||||
if ( $pageId !== NULL )
|
||||
{
|
||||
throw new \OutOfRangeException;
|
||||
return \IPS\cms\Pages\Page::load( $pageId )->can( 'view', $member );
|
||||
}
|
||||
|
||||
return \IPS\cms\Pages\Page::load( $pageId )->can( 'view', $member );
|
||||
/* Still here? Look elsewhere */
|
||||
$area = $this->getAreaFromWidgetUniqueId( $id3 );
|
||||
|
||||
if ( $area !== NULL )
|
||||
{
|
||||
return \IPS\Application\Module::get( $area[0], $area[1], 'front' )->can( 'view', $member );
|
||||
}
|
||||
|
||||
/* Still here? */
|
||||
throw new \OutOfRangeException;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,12 +96,19 @@ class _Widgets
|
||||
{
|
||||
$pageId = $this->getPageIdFromWidgetUniqueId( $id3 );
|
||||
|
||||
if ( $pageId === NULL )
|
||||
if ( $pageId !== NULL )
|
||||
{
|
||||
return FALSE;
|
||||
return \IPS\cms\Pages\Page::load( $pageId );
|
||||
}
|
||||
|
||||
return \IPS\cms\Pages\Page::load( $pageId );
|
||||
$area = $this->getAreaFromWidgetUniqueId( $id3 );
|
||||
|
||||
if ( $area !== NULL )
|
||||
{
|
||||
return \IPS\Application\Module::get( $area[0], $area[1] );
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,4 +135,29 @@ class _Widgets
|
||||
|
||||
return $pageId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns area information if the widget is not on a cms page
|
||||
*
|
||||
* @param string $uniqueId The widget's unique ID
|
||||
* @return array|null Index 0 = Application, Index 1 = Module, Index 2 = Controller
|
||||
*/
|
||||
protected function getAreaFromWidgetUniqueId( $uniqueId )
|
||||
{
|
||||
$return = NULL;
|
||||
foreach( \IPS\Db::i()->select( '*', 'core_widget_areas' ) AS $row )
|
||||
{
|
||||
$widgets = json_decode( $row['widgets'], TRUE );
|
||||
|
||||
foreach( $widgets AS $widget )
|
||||
{
|
||||
if ( $widget['unique'] == $uniqueId )
|
||||
{
|
||||
$return = array( $row['app'], $row['module'], $row['controller'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user