Version 4.3.0
This commit is contained in:
1 parent
96997ddd8e
commit
fe1acf984a
1349 files changed
+116159
-67711
No files matched your search
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Content Router extension: Pages
|
||||
* @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
|
||||
* @subpackage Pages
|
||||
* @since 15 Dec 2017
|
||||
*/
|
||||
|
||||
namespace IPS\cms\extensions\core\ContentRouter;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Content Router extension: Pages
|
||||
*/
|
||||
class _Pages
|
||||
{
|
||||
/**
|
||||
* @brief Content Item Classes
|
||||
*/
|
||||
public $classes = array();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \IPS\Member|IPS\Member\Group|NULL $memberOrGroup If checking access, the member/group to check for, or NULL to not check access
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( $memberOrGroup = NULL )
|
||||
{
|
||||
if ( $memberOrGroup === NULL or $memberOrGroup->canAccessModule( \IPS\Application\Module::get( 'cms', 'pages', 'front' ) ) )
|
||||
{
|
||||
$this->classes[] = 'IPS\cms\Pages\PageItem';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,15 +34,24 @@ class _Records
|
||||
|
||||
foreach( \IPS\cms\Databases::databases() as $database )
|
||||
{
|
||||
if ( $database->page_id > 0 and $database->can('view') )
|
||||
$theOnlyCategory = NULL;
|
||||
if ( $database->page_id > 0 and $database->can('add') )
|
||||
{
|
||||
$catClass = '\IPS\cms\Categories' . $database->id;
|
||||
if ( $database->can('add') )
|
||||
if ( $catClass::canOnAny('add') )
|
||||
{
|
||||
try
|
||||
{
|
||||
$page = \IPS\cms\Pages\Page::load( $database->page_id );
|
||||
|
||||
|
||||
if( $database->use_categories AND $theOnlyCategory = $catClass::theOnlyNode() )
|
||||
{
|
||||
$items[ 'cms_create_menu_records_' . $database->id ] = array(
|
||||
'link' => $theOnlyCategory->url()->setQueryString('do', 'form')
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
$items[ 'cms_create_menu_records_' . $database->id ] = array(
|
||||
'link' => $page->url()->setQueryString('do', 'form'),
|
||||
'extraData' => ( $database->use_categories ) ? array( 'data-ipsDialog' => true, 'data-ipsDialog-size' => "narrow" ) : array(),
|
||||
|
||||
@@ -26,7 +26,7 @@ class _Cms
|
||||
/**
|
||||
* Anything need building?
|
||||
*
|
||||
* @return array
|
||||
* @return bool
|
||||
*/
|
||||
public function toBuild()
|
||||
{
|
||||
@@ -37,7 +37,7 @@ class _Cms
|
||||
/**
|
||||
* Designer's mode on
|
||||
*
|
||||
* @return array
|
||||
* @return bool
|
||||
*/
|
||||
public function on( $data=NULL )
|
||||
{
|
||||
@@ -51,7 +51,7 @@ class _Cms
|
||||
/**
|
||||
* Designer's mode off
|
||||
*
|
||||
* @return array
|
||||
* @return bool
|
||||
*/
|
||||
public function off( $data=NULL )
|
||||
{
|
||||
|
||||
@@ -23,6 +23,11 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
*/
|
||||
class _Records
|
||||
{
|
||||
/**
|
||||
* @brief Flag to indicate we don't want to be listed as a selectable area when configuring buttons
|
||||
*/
|
||||
public static $buttonLocation = FALSE;
|
||||
|
||||
/**
|
||||
* Can we use HTML in this editor?
|
||||
*
|
||||
@@ -70,7 +75,7 @@ class _Records
|
||||
|
||||
try
|
||||
{
|
||||
$recordClass = '\IPS\cms\Records' . str_replace( '-review', '', $id3 );
|
||||
$recordClass = '\IPS\cms\Records' . $id3;
|
||||
|
||||
return $recordClass::load( $id1 )->canView( $member );
|
||||
}
|
||||
@@ -95,7 +100,7 @@ class _Records
|
||||
{
|
||||
if ( $id3 )
|
||||
{
|
||||
$recordClass = '\IPS\cms\Records' . str_replace( '-review', '', $id3 );
|
||||
$recordClass = '\IPS\cms\Records' . $id3;
|
||||
$return = $recordClass::load( $id1 );
|
||||
$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;
|
||||
|
||||
@@ -74,8 +74,6 @@ class _Media
|
||||
if ( $new = \IPS\File::repairUrl( $media['media_file_object'] ) )
|
||||
{
|
||||
\IPS\Db::i()->update( 'cms_media', array( 'media_file_object' => $new ), array( 'media_id=?', $media['media_id'] ) );
|
||||
|
||||
unset( \IPS\Data\Store::i()->emoticons );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ class _Pages
|
||||
public function move( $offset, $storageConfiguration, $oldConfiguration=NULL )
|
||||
{
|
||||
/* Just remove page object data so it will rebuild on the next iteration */
|
||||
\IPS\cms\Pages\Page::deleteCachedIncludes();
|
||||
\IPS\cms\Pages\Page::deleteCachedIncludes( NULL, $oldConfiguration );
|
||||
|
||||
throw new \UnderflowException;
|
||||
}
|
||||
|
||||
@@ -38,6 +38,6 @@ class _Widget
|
||||
public static function runPlugin( $data, $options )
|
||||
{
|
||||
$config = ( isset( $options['config'] ) ) ? $options['config'] : array();
|
||||
return "\IPS\Widget::load( \IPS\Application::load( '" . $options['app'] . "' ), '" . $data . "', '" . uniqid() . "', " . $config . " );";
|
||||
return "\IPS\Widget::load( \IPS\Application::load( '" . $options['app'] . "' ), '" . $data . "', '" . mt_rand() . "', " . $config . " );";
|
||||
}
|
||||
}
|
||||
@@ -89,11 +89,11 @@ class _RebuildEditorFields
|
||||
if( isset( $classname::$itemClass ) )
|
||||
{
|
||||
$itemClass = $classname::$itemClass;
|
||||
$module = ucfirst( $itemClass::$module );
|
||||
$module = mb_ucfirst( $itemClass::$module );
|
||||
}
|
||||
else
|
||||
{
|
||||
$module = ucfirst( $classname::$module );
|
||||
$module = mb_ucfirst( $classname::$module );
|
||||
}
|
||||
|
||||
$extension = NULL;
|
||||
|
||||
@@ -69,6 +69,20 @@ class _Databases
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$page = \IPS\cms\Pages\Page::load( $database->page_id );
|
||||
|
||||
if( !$page->can( 'view', new \IPS\Member ) )
|
||||
{
|
||||
throw new \OutOfRangeException;
|
||||
}
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$class = '\IPS\cms\Records' . $database->id;
|
||||
|
||||
@@ -117,7 +131,7 @@ class _Databases
|
||||
$select = array();
|
||||
if ( in_array( 'IPS\Content\Permissions', class_implements( $nodeClass ) ) or in_array( 'IPS\Node\Permissions', class_implements( $nodeClass ) ) )
|
||||
{
|
||||
$select = new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', $nodeClass::$databaseTable, array( '(' . \IPS\Db::i()->findInSet( 'perm_view', array( \IPS\Settings::i()->guest_group ) ) . ' OR ' . 'perm_view=? )', '*' ) )->join( 'core_permission_index', array( "core_permission_index.app=? AND core_permission_index.perm_type=? AND core_permission_index.perm_type_id={$nodeClass::$databaseTable}.{$nodeClass::$databasePrefix}{$nodeClass::$databaseColumnId}", $nodeClass::$permApp, $nodeClass::$permType ) ), $nodeClass );
|
||||
$select = new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', $nodeClass::$databaseTable, array( 'category_database_id=? AND (' . \IPS\Db::i()->findInSet( 'perm_view', array( \IPS\Settings::i()->guest_group ) ) . ' OR ' . 'perm_view=? )', $databaseId, '*' ) )->join( 'core_permission_index', array( "core_permission_index.app=? AND core_permission_index.perm_type=? AND core_permission_index.perm_type_id={$nodeClass::$databaseTable}.{$nodeClass::$databasePrefix}{$nodeClass::$databaseColumnId}", $nodeClass::$permApp, $nodeClass::$permType ) ), $nodeClass );
|
||||
}
|
||||
else if ( $nodeClass::$ownerTypes !== NULL and is_subclass_of( $nodeClass, 'IPS\Node\Model' ) )
|
||||
{
|
||||
@@ -134,8 +148,9 @@ class _Databases
|
||||
if ( $priority !== -1 )
|
||||
{
|
||||
$data['priority'] = $priority;
|
||||
$entries[] = $data;
|
||||
}
|
||||
|
||||
$entries[] = $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -160,8 +175,9 @@ class _Databases
|
||||
if ( $priority !== -1 )
|
||||
{
|
||||
$data['priority'] = $priority;
|
||||
$entries[] = $data;
|
||||
}
|
||||
|
||||
$entries[] = $data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -120,4 +120,5 @@ class _Pages
|
||||
|
||||
$sitemap->buildSitemapFile( $filename, $entries );
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user