Version 5.0.13
This commit is contained in:
1 parent
b89858b2ff
commit
5efe744c5f
1407 files changed
+69690
-30177
No files matched your search
@@ -665,12 +665,6 @@ class category extends Controller
|
||||
}
|
||||
else
|
||||
{
|
||||
Output::i()->metaTags['title'] = $category->metaTitle();
|
||||
Output::i()->metaTags['description'] = $category->metaDescription();
|
||||
Output::i()->metaTags['og:title'] = $category->metaTitle();
|
||||
Output::i()->metaTags['og:description'] = $category->metaDescription();
|
||||
Output::i()->linkTags['canonical'] = (string) $category->url();
|
||||
|
||||
/* Set breadcrumb */
|
||||
if ( $club = $category->_club )
|
||||
{
|
||||
@@ -687,6 +681,12 @@ class category extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
Output::i()->metaTags['title'] = $category->metaTitle();
|
||||
Output::i()->metaTags['description'] = $category->metaDescription();
|
||||
Output::i()->metaTags['og:title'] = $category->metaTitle();
|
||||
Output::i()->metaTags['og:description'] = $category->metaDescription();
|
||||
Output::i()->linkTags['canonical'] = (string) $category->url();
|
||||
|
||||
/* Node handler does not support keywords, so we need to do it manually */
|
||||
if ( $category->meta_keywords )
|
||||
{
|
||||
@@ -772,7 +772,6 @@ class category extends Controller
|
||||
}
|
||||
|
||||
$this->showClubHeader( $category );
|
||||
Output::i()->allowDefaultWidgets = FALSE;
|
||||
Output::i()->sidebar['enabled'] = FALSE;
|
||||
Output::i()->output = $form->customTemplate( array( \IPS\cms\Theme::i()->getTemplate( $database->template_form, 'cms', 'database' ), 'recordForm' ), NULL, $category, $database, Page::$currentPage, $title, $hasModOptions );
|
||||
Dispatcher::i()->output .= Output::i()->output;
|
||||
|
||||
@@ -88,6 +88,7 @@ class record extends Controller
|
||||
protected function manage() : mixed
|
||||
{
|
||||
/* Load record */
|
||||
/** @var Records $record */
|
||||
try
|
||||
{
|
||||
$record = parent::manage();
|
||||
@@ -318,11 +319,11 @@ class record extends Controller
|
||||
}
|
||||
|
||||
$logo = NULL;
|
||||
if( Theme::i()->logo['front'] )
|
||||
if( !empty( Theme::i()->logo['front']['url'] ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
$logo = File::get( 'core_Theme', Theme::i()->logo['front']['url'] )->url;
|
||||
$logo = Theme::i()->logo['front']['url'];
|
||||
}
|
||||
/* File doesn't exist */
|
||||
catch ( RuntimeException | DomainException $e ){}
|
||||
@@ -795,7 +796,6 @@ class record extends Controller
|
||||
Output::i()->redirect( $record->url() );
|
||||
}
|
||||
|
||||
Output::i()->allowDefaultWidgets = FALSE;
|
||||
Output::i()->sidebar['enabled'] = FALSE;
|
||||
Output::i()->title = Member::loggedIn()->language()->addToStack( $title );
|
||||
Output::i()->cssFiles = array_merge( Output::i()->cssFiles, Theme::i()->css( 'records/form.css', 'cms', 'front' ) );
|
||||
|
||||
@@ -220,6 +220,7 @@ class topic extends Controller
|
||||
$fakeRecord->$titleField = $this->topic->mapped('title');
|
||||
$fakeRecord->$contentField = $this->topic->content();
|
||||
$fakeRecord->category_id = Request::i()->category_id;
|
||||
Request::i()->tags = $this->topic->tags();
|
||||
|
||||
if( $fakeRecord->_forum_record AND $fakeRecord->_forum_comments )
|
||||
{
|
||||
@@ -322,6 +323,12 @@ class topic extends Controller
|
||||
$obj->rebuildFirstAndLastCommentData();
|
||||
}
|
||||
|
||||
/* Remove tags from the original topic, so that we don't have duplicates on the tag page */
|
||||
$this->topic->setTags( [] );
|
||||
|
||||
/* Now we want to update the original topic in case we made any changes */
|
||||
$record->syncTopic();
|
||||
|
||||
try
|
||||
{
|
||||
/* If the database is on a page, go to the record */
|
||||
|
||||
@@ -16,6 +16,7 @@ use IPS\cms\Categories;
|
||||
use IPS\cms\Pages\Folder;
|
||||
use IPS\cms\Pages\Page;
|
||||
use IPS\cms\Records;
|
||||
use IPS\Content\Filter;
|
||||
use IPS\Db;
|
||||
use IPS\Patterns\ActiveRecordIterator;
|
||||
use IPS\Theme;
|
||||
@@ -69,19 +70,21 @@ class ajax extends \IPS\cms\modules\admin\pages\ajax
|
||||
{
|
||||
/* @var Categories $containerClass */
|
||||
$containerClass = 'IPS\cms\Categories' . Request::i()->navId;
|
||||
|
||||
try
|
||||
{
|
||||
$container = $containerClass::load( Request::i()->container );
|
||||
$items = [];
|
||||
foreach( $container->getContentItems( null, null ) as $item )
|
||||
{
|
||||
/* Only show items that we can actually see, and if they're not pending deletion */
|
||||
/* @var Records $item */
|
||||
if( $item->canView() and $item->hidden() !== -2 )
|
||||
{
|
||||
$items[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
/* @var Records $itemClass */
|
||||
$itemClass = $containerClass::$contentItemClass;
|
||||
|
||||
$sort = ( $container::database()->field_sort ? $itemClass::$databaseTable . '.' . $itemClass::$databasePrefix . $container::database()->field_sort : 'record_last_comment' ) . ' ' . ( $container::database()->field_direction ?? 'desc' );
|
||||
|
||||
$items = iterator_to_array(
|
||||
$itemClass::getItemsWithPermission( [
|
||||
[ $itemClass::$databaseTable . '.category_id=?', $container->_id ]
|
||||
], $sort, null )
|
||||
);
|
||||
|
||||
Output::i()->sendOutput( Theme::i()->getTemplate( 'widgets', 'cms', 'front' )->databaseNavigationItems( $items ) );
|
||||
}
|
||||
|
||||
@@ -168,15 +168,7 @@ class builder extends widgets
|
||||
try
|
||||
{
|
||||
$block = Block::load( Request::i()->id );
|
||||
|
||||
try
|
||||
{
|
||||
$widget = $block->widget();
|
||||
}
|
||||
catch ( OutOfRangeException )
|
||||
{
|
||||
$widget = new Blocks( "", ['cms_widget_custom_block' => $block->key] );
|
||||
}
|
||||
$widget = new Blocks( "", ['cms_widget_custom_block' => $block->key] );
|
||||
Output::i()->json( [ "content" => (string) $widget, "configuration" => $widget->dataAttributes(), 'block_key' => $block->key ], 200 );
|
||||
}
|
||||
catch ( UnderFlowException|OutOfRangeException $e )
|
||||
|
||||
@@ -13,8 +13,10 @@ namespace IPS\cms\modules\front\pages;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
|
||||
use IPS\Member;
|
||||
use IPS\cms\Databases\Dispatcher;
|
||||
use IPS\cms\Pages\Page as PageClass;
|
||||
use IPS\cms\Pages\Revision;
|
||||
use IPS\Dispatcher\Controller;
|
||||
use IPS\Http\Url;
|
||||
use IPS\IPS;
|
||||
@@ -46,9 +48,32 @@ class page extends Controller
|
||||
*/
|
||||
public function manage() : void
|
||||
{
|
||||
Output::i()->bodyAttributes['contentClass'] = PageClass::class;
|
||||
$this->view();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function storeRevision(): void
|
||||
{
|
||||
if( ! Member::loggedIn()->modPermission('can_manage_sidebar') )
|
||||
{
|
||||
Output::i()->error( 'content_err_page_403', '2T187/5', 403 );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$page = static::getPage();
|
||||
Revision::store( $page, true );
|
||||
Output::i()->json( [ 'result' => 'ok' ] );
|
||||
}
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
Output::i()->error( 'content_err_page_404', '2T187/6', 404 );
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Display a page. Sounds simple doesn't it? Well it's not.
|
||||
*
|
||||
@@ -57,6 +82,11 @@ class page extends Controller
|
||||
protected function view() : void
|
||||
{
|
||||
$page = $this::getPage();
|
||||
|
||||
if( isset( Request::i()->version ) and Member::loggedIn()->modPermission('can_manage_sidebar') )
|
||||
{
|
||||
$page->setVersion( Request::i()->version );
|
||||
}
|
||||
|
||||
/* Database specific checks */
|
||||
if ( isset( Request::i()->advancedSearchForm ) AND isset( Request::i()->d ) )
|
||||
@@ -150,7 +180,7 @@ class page extends Controller
|
||||
else if ( isset( Request::i()->path ) AND Request::i()->path != '/' )
|
||||
{
|
||||
/* Sort out pagination for pages */
|
||||
list( $path, $pageNumber ) = PageClass::getStrippedPagePath( Request::i()->path );
|
||||
[ $path, $pageNumber ] = PageClass::getStrippedPagePath( Request::i()->path );
|
||||
if( $pageNumber AND !Request::i()->page )
|
||||
{
|
||||
Request::i()->page = $pageNumber;
|
||||
@@ -183,7 +213,7 @@ class page extends Controller
|
||||
{
|
||||
try
|
||||
{
|
||||
$page = PageClass::getDefaultPage();
|
||||
$page = PageClass::getDefaultForMember();
|
||||
}
|
||||
catch ( OutOfRangeException $e )
|
||||
{
|
||||
@@ -211,6 +241,48 @@ class page extends Controller
|
||||
|
||||
return $page;
|
||||
}
|
||||
|
||||
/**
|
||||
* Revert a page to a specific version
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function revertToVersion() : void
|
||||
{
|
||||
Request::i()->confirmedDelete();
|
||||
|
||||
if( !\IPS\Dispatcher::i()->application->canManageWidgets() )
|
||||
{
|
||||
Output::i()->error( 'content_err_page_403', '2T187/8', 403 );
|
||||
}
|
||||
|
||||
$page = static::getPage();
|
||||
|
||||
$version = null;
|
||||
if( isset( Request::i()->version ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
$version = Revision::load( Request::i()->version );
|
||||
}
|
||||
catch( OutOfRangeException )
|
||||
{
|
||||
Output::i()->error( 'content_err_page_404', '2T187/6', 404 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$version = Revision::previousVersion( $page );
|
||||
if( $version === null )
|
||||
{
|
||||
Output::i()->error( 'content_err_page_404', '2T187/7', 404 );
|
||||
}
|
||||
}
|
||||
|
||||
$version->revert();
|
||||
|
||||
Output::i()->redirect( $page->url() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Capture database specific things
|
||||
|
||||
Reference in new issue
Block a user