Version 4.1.19

This commit is contained in:
Neo committed 2025-12-19 05:38:56 -08:00
1 parent 28bd025b35
commit 2bd5025018
2674 files changed
+233518 -77766

No files matched your search

@@ -0,0 +1,72 @@
<?php
/**
* @brief BBCode Tag
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @subpackage Blogs
* @since 05 Feb 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\blog\extensions\core\BBCode;
/* 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;
}
/**
* BBCode Tag
*/
class _blog
{
/**
* Permission Check
*
* @param \IPS\Member $member The member
* @param string $area The Editor area
* @return bool
*/
public function permissionCheck( \IPS\Member $member, $area )
{
return \IPS\Text\Parser::canUse( $member, 'ipsLink', $area );
}
/**
* Get Configuration
*
* @code
return array(
'tag' => 'span', // The HTML tag to use
'attributes' => array( ... ) // Key/Value pairs of attributes to use (optional) - can use {option} to get the [tag=option] value
'callback' => function( $node, $matches, $document ) // A callback to modify the DOMNode object
{
...
},
'block' => FALSE, // If this is a block-level tag (optional, default false)
'single' => FALSE, // If this is a single tag, with no content (optional, default false)
)
* @endcode
* @return array
*/
public function getConfiguration()
{
return array(
'tag' => 'a',
'callback' => function( \DOMElement $node, $matches, \DOMDocument $document )
{
try
{
$node->setAttribute( 'href', (string) \IPS\blog\Blog::load( intval( $matches[2] ) )->url() );
}
catch ( \Exception $e ) {}
return $node;
},
);
}
}
@@ -0,0 +1,72 @@
<?php
/**
* @brief BBCode Tag
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @subpackage Blogs
* @since 08 Feb 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\blog\extensions\core\BBCode;
/* 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;
}
/**
* BBCode Tag
*/
class _entry
{
/**
* Permission Check
*
* @param \IPS\Member $member The member
* @param string $area The Editor area
* @return bool
*/
public function permissionCheck( \IPS\Member $member, $area )
{
return \IPS\Text\Parser::canUse( $member, 'ipsLink', $area );
}
/**
* Get Configuration
*
* @code
return array(
'tag' => 'span', // The HTML tag to use
'attributes' => array( ... ) // Key/Value pairs of attributes to use (optional) - can use {option} to get the [tag=option] value
'callback' => function( $node, $matches, $document ) // A callback to modify the DOMNode object
{
...
},
'block' => FALSE, // If this is a block-level tag (optional, default false)
'single' => FALSE, // If this is a single tag, with no content (optional, default false)
)
* @endcode
* @return array
*/
public function getConfiguration()
{
return array(
'tag' => 'a',
'callback' => function( \DOMElement $node, $matches, \DOMDocument $document )
{
try
{
$node->setAttribute( 'href', (string) \IPS\blog\Entry::load( intval( $matches[2] ) )->url() );
}
catch ( \Exception $e ) {}
return $node;
},
);
}
}
@@ -2,10 +2,10 @@
/**
* @brief Content Router extension: Blog
* @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
* @subpackage
* @package IPS Community Suite
* @subpackage Blog
* @since 04 Mar 2014
* @version SVN_VERSION_NUMBER
*/
@@ -2,10 +2,10 @@
/**
* @brief Create Menu Extension : Entry
* @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
* @subpackage
* @package IPS Community Suite
* @subpackage Blog
* @since 10 Mar 2014
* @version SVN_VERSION_NUMBER
*/
@@ -2,10 +2,10 @@
/**
* @brief Dashboard extension: Overview
* @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
* @subpackage
* @package IPS Community Suite
* @subpackage Blog
* @since 20 Mar 2014
* @version SVN_VERSION_NUMBER
*/
@@ -2,10 +2,10 @@
/**
* @brief Editor Extension: Blogs
* @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
* @subpackage
* @package IPS Community Suite
* @subpackage Blog
* @since 04 Mar 2014
* @version SVN_VERSION_NUMBER
*/
@@ -54,11 +54,20 @@ class _Blogs
* @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 )
{
return \IPS\blog\Blog::load( $id1 )->can( 'view', $member );
/* The attachment is attached to a comment */
if ( $id2 )
{
return \IPS\blog\Entry\Comment::load( $id2 )->canView( $member );
}
else
{
return \IPS\blog\Blog::load( $id1 )->can( 'view', $member );
}
}
/**
@@ -72,7 +81,15 @@ class _Blogs
*/
public function attachmentLookup( $id1, $id2, $id3 )
{
return \IPS\blog\Blog::load( $id1 );
/* The attachment is attached to a comment */
if ( $id2 )
{
return \IPS\blog\Entry\Comment::load( $id2 )->canView( $member );
}
else
{
return \IPS\blog\Blog::load( $id1 );
}
}
/**
@@ -2,10 +2,10 @@
/**
* @brief Editor Extension: Blog Entries
* @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
* @subpackage
* @package IPS Community Suite
* @subpackage Blog
* @since 10 Mar 2014
* @version SVN_VERSION_NUMBER
*/
@@ -46,7 +46,7 @@ class _Entries
{
return NULL;
}
/**
* Permission check for attachments
*
@@ -54,9 +54,10 @@ class _Entries
* @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 )
{
return \IPS\blog\Entry::load( $id1 )->canView( $member );
}
@@ -2,9 +2,9 @@
/**
* @brief File Storage Extension: Blogs (cover photos)
* @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 Blog
* @since 16 Jun 2014
* @version SVN_VERSION_NUMBER
@@ -2,9 +2,9 @@
/**
* @brief File Storage Extension: Blog Entries (cover photos)
* @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 Blog
* @since 30 May 2014
* @version SVN_VERSION_NUMBER
@@ -2,10 +2,10 @@
/**
* @brief Front Navigation Extension: Blogs
* @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
* @subpackage
* @package IPS Community Suite
* @subpackage Blog
* @since 03 Mar 2014
* @version SVN_VERSION_NUMBER
*/
@@ -35,13 +35,13 @@ class _Blogs extends \IPS\core\FrontNavigation\FrontNavigationAbstract
}
/**
* Can access?
* Can the currently logged in user access the content this item links to?
*
* @return bool
*/
public function canView()
public function canAccessContent()
{
return parent::canView() and \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'blog', 'blogs' ) );
return \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'blog', 'blogs' ) );
}
/**
@@ -2,10 +2,10 @@
/**
* @brief Admin CP Group 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
* @subpackage
* @package IPS Community Suite
* @subpackage Blog
* @since 11 Jul 2014
* @version SVN_VERSION_NUMBER
*/
@@ -56,11 +56,12 @@ class _Blog
{
if( $group->g_id != \IPS\Settings::i()->guest_group )
{
$group->g_blog_allowlocal = $values['g_blog_allowlocal'];
$group->g_blog_maxblogs = $values['g_blog_maxblogs'];
$group->g_blog_allowprivate = $values['g_blog_allowprivate'];
$group->g_blog_allowownmod = $values['g_blog_allowownmod'];
$group->g_blog_allowdelete = $values['g_blog_allowdelete'];
/* 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_allowcomment = $values['g_blog_allowcomment'];
@@ -2,10 +2,10 @@
/**
* @brief ACP Live Search Extension
* @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
* @subpackage
* @package IPS Community Suite
* @subpackage Blog
* @since 20 Mar 2014
* @version SVN_VERSION_NUMBER
*/
@@ -73,4 +73,14 @@ class _Blogs
return $results;
}
/**
* Is default for current page?
*
* @return bool
*/
public function isDefault()
{
return \IPS\Dispatcher::i()->application->directory == 'blog';
}
}
@@ -2,9 +2,9 @@
/**
* @brief Member Sync
* @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 Blog
* @since 20 Mar 2014
* @version SVN_VERSION_NUMBER
@@ -55,8 +55,12 @@ class _Blog
foreach( \IPS\blog\Blog::loadByOwner( $member ) as $blog )
{
$blog->member_id = 0;
$blog->save();
/* We only want to do this if the blog is owned by the member - loadByOwner() also returns Blogs that are assigned to member groups */
if ( !$blog->groupblog_ids )
{
/* Delete blog entries & blog */
\IPS\Task::queue( 'core', 'DeleteOrMoveContent', array( 'class' => 'IPS\blog\Blog', 'id' => $blog->id, 'deleteWhenDone' => TRUE ) );
}
}
}
}
@@ -2,9 +2,9 @@
/**
* @brief Profile extension: Blogs
* @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 Blog
* @since 02 Apr 2014
* @version SVN_VERSION_NUMBER
@@ -0,0 +1,128 @@
<?php
/**
* @brief Background Task
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @subpackage Blogs
* @since 12 Apr 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\blog\extensions\core\Queue;
/* 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;
}
/**
* Background Task
*/
class _RebuildEntryImages
{
/**
* @brief Number of entry images to rebuild per cycle
*/
public $rebuild = 10;
/**
* Parse data before queuing
*
* @param array $data
* @return array
*/
public function preQueueData( $data )
{
$data['count'] = (int) \IPS\Db::i()->select( 'count(*)', 'blog_entries', "entry_image<>''" )->first();
if( $data['count'] == 0 )
{
return NULL;
}
return $data;
}
/**
* Run Background Task
*
* @param mixed $data Data as it was passed to \IPS\Task::queue()
* @param int $offset Offset
* @return int New offset
* @throws \IPS\Task\Queue\OutOfRangeException Indicates offset doesn't exist and thus task is complete
*/
public function run( $data, $offset )
{
$select = \IPS\Db::i()->select( '*', 'blog_entries', "entry_image<>''", 'entry_id ASC', array( $offset, $this->rebuild ) );
if ( !$select->count() )
{
throw new \IPS\Task\Queue\OutOfRangeException;
}
foreach ( $select as $entry )
{
try
{
$filePath = \IPS\ROOT_PATH . '/uploads/' . $entry['entry_image'];
if ( ! file_exists( $filePath ) )
{
continue;
}
/* Have we processed this before? It's a bit crude but it is accurate */
if ( mb_substr( trim( $entry['entry_content'] ), 0, 37 ) === '<a href="<fileStore.core_Attachment>/' and mb_stristr( $entry['entry_content'], '/' . $entry['entry_image'] . '.' ) and mb_stristr( $entry['entry_content'], 'data-fileid="' ) )
{
continue;
}
$file = \IPS\File::create( 'core_Attachment', $entry['entry_image'], NULL, NULL, FALSE, $filePath );
$attachment = $file->makeAttachment('', \IPS\Member::load( $entry['entry_author_id'] ) );
$fileName = htmlspecialchars( $attachment['attach_file'], \IPS\HTMLENTITIES, 'UTF-8', TRUE );
$image = <<<IMAGE
<a href="<fileStore.core_Attachment>/{$file}" class="ipsAttachLink ipsAttachLink_image" style="float:left;"><img data-fileid="{$attachment['attach_id']}" src="<fileStore.core_Attachment>/{$file}" class="ipsImage ipsImage_thumbnailed" style="margin:10px;" alt="{$fileName}"></a>
IMAGE;
\IPS\Db::i()->update( 'blog_entries', array( 'entry_content' => $image . $entry['entry_content'] ), array( 'entry_id=?', $entry['entry_id'] ) );
$map = array(
'attachment_id' => $attachment['attach_id'],
'location_key' => 'blog_Entries',
'id1' => $entry['entry_id'],
'id2' => NULL,
'id3' => NULL,
'temp' => NULL,
);
\IPS\Db::i()->replace( 'core_attachments_map', $map );
}
catch ( \Exception $e ) {}
}
return $offset + $this->rebuild;
}
/**
* Get Progress
*
* @param mixed $data Data as it was passed to \IPS\Task::queue()
* @param int $offset Offset
* @return array( 'text' => 'Doing something...', 'complete' => 50 ) Text explaining task and percentage complete
* @throws \OutOfRangeException Indicates offset doesn't exist and thus task is complete
*/
public function getProgress( $data, $offset )
{
return array(
'text' => \IPS\Member::loggedIn()->language()->addToStack( 'rebuilding_blog_entry_images', FALSE ),
'complete' => ( isset( $data['count'] ) AND $data['count'] )
? ( round( 100 / $data['count'] * $offset, 2 ) )
: 100
);
}
}