Version 5.0.13
This commit is contained in:
1 parent
b89858b2ff
commit
5efe744c5f
1407 files changed
+69690
-30177
No files matched your search
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Club plugin
|
||||
* @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 Blogs
|
||||
* @since 08 Jul 2025
|
||||
*/
|
||||
|
||||
namespace IPS\blog\extensions\core\Club;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
|
||||
use IPS\blog\Blog as BlogClass;
|
||||
use IPS\Content\ContentMenuLink;
|
||||
use IPS\Helpers\Menu\MenuItem;
|
||||
use IPS\Member\Club;
|
||||
use IPS\Extensions\ClubAbstract;
|
||||
use IPS\Member\Club\Page as ClubPage;
|
||||
use IPS\Node\Model;
|
||||
use function defined;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Club Menu plugin
|
||||
*/
|
||||
class Blog extends ClubAbstract
|
||||
{
|
||||
/**
|
||||
* Return an array of menu elements to add to the club menu
|
||||
*
|
||||
* @param Club $club
|
||||
* @param Model|ClubPage|null $container
|
||||
* @return array<string,MenuItem>
|
||||
*/
|
||||
public function menu( Club $club, Model|ClubPage|null $container = null ) : array
|
||||
{
|
||||
if( $container instanceof BlogClass and $container->canEdit() )
|
||||
{
|
||||
$categoryLink = new ContentMenuLink( $container->url()->setQueryString( 'do', 'manageCategories' ), 'blog_manage_entry_categories' );
|
||||
$categoryLink->opensDialog( 'blog_manage_entry_categories' );
|
||||
return [ $categoryLink ];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ namespace IPS\blog\extensions\core\EditorLocations;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
|
||||
use Exception;
|
||||
use InvalidArgumentException;
|
||||
use IPS\blog\Blog;
|
||||
use IPS\blog\Entry\Comment;
|
||||
@@ -27,6 +28,7 @@ use IPS\Text\Parser;
|
||||
use LogicException;
|
||||
use RuntimeException;
|
||||
use function defined;
|
||||
use function is_array;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
@@ -127,14 +129,20 @@ class Blogs extends EditorLocationsAbstract
|
||||
*/
|
||||
public function attachmentLookup( ?int $id1=null, ?int $id2=null, ?string $id3=null ): Model|Content|Url|Member|null
|
||||
{
|
||||
/* The attachment is attached to a comment */
|
||||
if ( $id2 )
|
||||
{
|
||||
return Comment::load( $id2 );
|
||||
try
|
||||
{/* The attachment is attached to a comment */
|
||||
if( $id2 )
|
||||
{
|
||||
return Comment::load( $id2 );
|
||||
}
|
||||
else
|
||||
{
|
||||
return Blog::load( $id1 );
|
||||
}
|
||||
}
|
||||
else
|
||||
catch( Exception $e )
|
||||
{
|
||||
return Blog::load( $id1 );
|
||||
throw new LogicException( );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,7 +216,7 @@ class Blogs extends EditorLocationsAbstract
|
||||
}
|
||||
catch( InvalidArgumentException $e )
|
||||
{
|
||||
if( $callback[1] == 'parseStatic' AND $e->getcode() == 103014 )
|
||||
if( is_array( $callback ) and $callback[1] == 'parseStatic' AND $e->getcode() == 103014 )
|
||||
{
|
||||
$rebuilt = preg_replace( "#\[/?([^\]]+?)\]#", '', $word['word_custom'] );
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace IPS\blog\extensions\core\EditorLocations;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
|
||||
use Exception;
|
||||
use InvalidArgumentException;
|
||||
use IPS\Content;
|
||||
use IPS\Db;
|
||||
@@ -24,6 +25,7 @@ use IPS\Node\Model;
|
||||
use IPS\Text\Parser;
|
||||
use LogicException;
|
||||
use function defined;
|
||||
use function is_array;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
@@ -78,7 +80,14 @@ class Categories extends EditorLocationsAbstract
|
||||
switch ( $id3 )
|
||||
{
|
||||
case 'bcategory':
|
||||
return Url::internal( "app=blog&module=blogs&controller=categories&do=form&id={$id1}", 'admin' );
|
||||
try
|
||||
{
|
||||
return Url::internal( "app=blog&module=blogs&controller=categories&do=form&id={$id1}", 'admin' );
|
||||
}
|
||||
catch( Exception $e )
|
||||
{
|
||||
throw new LogicException;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -142,7 +151,7 @@ class Categories extends EditorLocationsAbstract
|
||||
}
|
||||
catch( InvalidArgumentException $e )
|
||||
{
|
||||
if( $callback[1] == 'parseStatic' AND $e->getcode() == 103014 )
|
||||
if( is_array( $callback ) and $callback[1] == 'parseStatic' AND $e->getcode() == 103014 )
|
||||
{
|
||||
$rebuilt = preg_replace( "#\[/?([^\]]+?)\]#", '', $word['word_custom'] );
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace IPS\blog\extensions\core\EditorLocations;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
|
||||
use Exception;
|
||||
use IPS\blog\Entry;
|
||||
use IPS\Content;
|
||||
use IPS\Extensions\EditorLocationsAbstract;
|
||||
@@ -99,7 +100,14 @@ class Entries extends EditorLocationsAbstract
|
||||
*/
|
||||
public function attachmentLookup( ?int $id1=null, ?int $id2=null, ?string $id3=null ): Model|Content|Url|Member|null
|
||||
{
|
||||
return Entry::load( $id1 );
|
||||
try
|
||||
{
|
||||
return Entry::load( $id1 );
|
||||
}
|
||||
catch( Exception $e )
|
||||
{
|
||||
throw new LogicException;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -71,9 +71,9 @@ class Blog extends GroupFormAbstract
|
||||
/* We intval here because (some of) the columns do not accept null values, but these are null when creating a new group */
|
||||
$group->g_blog_allowlocal = (int) $values['g_blog_allowlocal'];
|
||||
$group->g_blog_maxblogs = (int) $values['g_blog_maxblogs'];
|
||||
$group->g_blog_allowprivate = (int) $values['g_blog_allowprivate'];
|
||||
$group->g_blog_allowownmod = (int) $values['g_blog_allowownmod'];
|
||||
$group->g_blog_allowdelete = (int) $values['g_blog_allowdelete'];
|
||||
$group->g_blog_allowprivate = $values['g_blog_allowlocal'] ? (int) $values['g_blog_allowprivate'] : 0;
|
||||
$group->g_blog_allowownmod = $values['g_blog_allowlocal'] ? (int) $values['g_blog_allowownmod'] : 0;
|
||||
$group->g_blog_allowdelete = $values['g_blog_allowlocal'] ? (int) $values['g_blog_allowdelete'] : 0;
|
||||
}
|
||||
|
||||
$group->g_blog_allowcomment = $values['g_blog_allowcomment'];
|
||||
|
||||
@@ -67,8 +67,23 @@ class Blogs extends OverviewStatisticsAbstract
|
||||
*/
|
||||
public function getBlock( array|string|null $dateRange = NULL, string $subBlock = NULL ): string
|
||||
{
|
||||
$total = Db::i()->select( 'COUNT(*)', 'blog_blogs' )->first();
|
||||
return Theme::i()->getTemplate( 'stats' )->overviewComparisonCount(
|
||||
$this->getBlockNumbers( $dateRange, $subBlock )['statsreports_current_count'],
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
return Theme::i()->getTemplate( 'stats' )->overviewComparisonCount( $total, NULL, NULL );
|
||||
/**
|
||||
* @param array|string $dateRange=null
|
||||
* @param string $subBlock = null
|
||||
*
|
||||
* @return array{statsreports_current_count: number}
|
||||
*/
|
||||
public function getBlockNumbers( array|string $dateRange = null, string $subBlock = null ) : array
|
||||
{
|
||||
return [
|
||||
'statsreports_current_count' => Db::i()->select( "COUNT(*)", 'blog_blogs' )->first()
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -45,17 +45,6 @@ class RssImport extends RssImportAbstract
|
||||
$this->classes = array( 'IPS\\blog\\Entry' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return available options for a Form\Select
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function availableOptions(): array
|
||||
{
|
||||
/* We don't want to set up Blog feeds in the ACP */
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show in the Admin CP?
|
||||
*
|
||||
@@ -115,7 +104,7 @@ class RssImport extends RssImportAbstract
|
||||
*/
|
||||
public function form( Form $form, ?Import $rss=NULL ): void
|
||||
{
|
||||
/* Blogs has it's own front end controller */
|
||||
/* Blogs has its own front end controller */
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -127,7 +116,7 @@ class RssImport extends RssImportAbstract
|
||||
*/
|
||||
public function saveForm( array &$values, Import $rss ): array
|
||||
{
|
||||
/* Blogs has it's own front end controller */
|
||||
/* Blogs has its own front end controller */
|
||||
return array( $values );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user