Version 4.0.13.1

This commit is contained in:
Neo committed 2025-12-19 04:57:54 -08:00
1 parent f9e857d255
commit c6a86f0d9b
7517 files changed
+597400 -668041

No files matched your search

@@ -0,0 +1,137 @@
<?php
/**
* @brief Image Comment Model
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @subpackage Gallery
* @since 04 Mar 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\gallery\Image;
/* 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;
}
/**
* Image Comment Model
*/
class _Comment extends \IPS\Content\Comment implements \IPS\Content\EditHistory, \IPS\Content\ReportCenter, \IPS\Content\Hideable, \IPS\Content\Reputation, \IPS\Content\Searchable, \IPS\Content\Embeddable
{
/**
* @brief [ActiveRecord] Multiton Store
*/
protected static $multitons;
/**
* @brief [Content\Comment] Item Class
*/
public static $itemClass = 'IPS\gallery\Image';
/**
* @brief [ActiveRecord] Database Table
*/
public static $databaseTable = 'gallery_comments';
/**
* @brief [ActiveRecord] Database Prefix
*/
public static $databasePrefix = 'comment_';
/**
* @brief Database Column Map
*/
public static $databaseColumnMap = array(
'item' => 'img_id',
'author' => 'author_id',
'author_name' => 'author_name',
'content' => 'text',
'date' => 'post_date',
'ip_address' => 'ip_address',
'edit_time' => 'edit_time',
'edit_member_name' => 'edit_name',
'edit_show' => 'append_edit',
'approved' => 'approved'
);
/**
* @brief Application
*/
public static $application = 'gallery';
/**
* @brief Title
*/
public static $title = 'gallery_image_comment';
/**
* @brief Icon
*/
public static $icon = 'camera';
/**
* @brief Reputation Type
*/
public static $reputationType = 'comment_id';
/**
* @brief [Content] Key for hide reasons
*/
public static $hideLogKey = 'gallery-images';
/**
* Get items with permisison check
*
* @note We override in order to provide checking against album restrictions
* @param array $where Where clause
* @param string $order MySQL ORDER BY clause (NULL to order by date)
* @param int|array $limit Limit clause
* @param string $permissionKey A key which has a value in the permission map (either of the container or of this class) matching a column ID in core_permission_index
* @param bool|NULL $includeHiddenItems Include hidden files? Boolean or NULL to detect if currently logged member has permission
* @param int $queryFlags Select bitwise flags
* @param \IPS\Member $member The member (NULL to use currently logged in member)
* @param bool $joinContainer If true, will join container data (set to TRUE if your $where clause depends on this data)
* @param bool $joinComments If true, will join comment data (set to TRUE if your $where clause depends on this data)
* @param bool $joinReviews If true, will join review data (set to TRUE if your $where clause depends on this data)
* @return \IPS\Patterns\ActiveRecordIterator|int
*/
public static function getItemsWithPermission( $where=array(), $order=NULL, $limit=10, $permissionKey='read', $includeHiddenItems=NULL, $queryFlags=0, \IPS\Member $member=NULL, $joinContainer=FALSE, $joinComments=FALSE, $joinReviews=FALSE, $countOnly=FALSE, $joins=NULL )
{
$where[] = \IPS\gallery\Image::getItemsWithPermissionWhere( $where, $member, $joins );
return parent::getItemsWithPermission( $where, $order, $limit, $permissionKey, $includeHiddenItems, $queryFlags, $member, $joinContainer, $joinComments, $joinReviews, $countOnly, $joins );
}
/**
* Get URL for doing stuff
*
* @param string|NULL $action Action
* @return \IPS\Http\Url
*/
public function url( $action=NULL )
{
return parent::url( $action )->setQueryString( 'tab', 'comments' );
}
/**
* Do stuff after creating (abstracted as comments and reviews need to do different things)
*
* @return void
*/
public function postCreate()
{
parent::postCreate();
$item = $this->item();
if( $item->album_id )
{
\IPS\gallery\Album::load( $item->album_id )->setLastComment();
}
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,122 @@
<?php
/**
* @brief Custom table helper for gallery images to override move menu
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @subpackage Gallery
* @since 04 Apr 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\gallery\Image;
/* 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;
}
/**
* Custom table helper for gallery images to override move menu
*/
class _Table extends \IPS\Helpers\Table\Content
{
/**
* Constructor
*
* @param array $class Database table
* @param \IPS\Http\Url $baseUrl Base URL
* @param array|null $where WHERE clause (To restrict to a node, use $container instead)
* @param \IPS\Node\Model|NULL $container The container
* @param bool|null $includeHidden Flag to pass to getItemsWithPermission() method for $includeHiddenContent, defaults to NULL
* @param string|NULL $permCheck Permission key to check
* @return void
*/
public function __construct( $class, \IPS\Http\Url $baseUrl, $where=NULL, \IPS\Node\Model $container=NULL, $includeHidden=NULL, $permCheck='view', $honorPinned=TRUE )
{
/* Are we changing the thumbnail viewing size? */
if( isset( \IPS\Request::i()->thumbnailSize ) )
{
\IPS\Session::i()->csrfCheck();
\IPS\Request::i()->setCookie( 'thumbnailSize', \IPS\Request::i()->thumbnailSize, \IPS\DateTime::ts( time() )->add( new \DateInterval( 'P1Y' ) ) );
}
return parent::__construct( $class, $baseUrl, $where, $container, $includeHidden, $permCheck, $honorPinned );
}
/**
* Multimod
*
* @return void
*/
protected function multimod()
{
$class = $this->class;
$params = array();
if ( \IPS\Request::i()->modaction == 'move' )
{
$form = new \IPS\Helpers\Form( 'form', 'move' );
$form->add( new \IPS\Helpers\Form\Node( 'move_to_category', NULL, FALSE, array( 'class' => 'IPS\\gallery\\Category', 'url' => \IPS\Request::i()->url()->setQueryString( 'modaction', 'move' ) ) ) );
$form->add( new \IPS\Helpers\Form\Node( 'move_to_album', NULL, FALSE, array(
'class' => 'IPS\\gallery\\Album',
'url' => \IPS\Request::i()->url()->setQueryString( 'modaction', 'move' ),
'permissionCheck' => function( $node )
{
/* Have we hit an images per album limit? */
if( $node->owner()->group['g_img_album_limit'] AND ( $node->count_imgs + $node->count_imgs_hidden ) >= $node->owner()->group['g_img_album_limit'] )
{
return false;
}
return true;
}
) ) );
if ( $values = $form->values() )
{
if( ( !isset( $values['move_to_category'] ) OR !( $values['move_to_category'] instanceof \IPS\Node\Model ) ) AND
( !isset( $values['move_to_album'] ) OR !( $values['move_to_album'] instanceof \IPS\Node\Model ) ) )
{
$form->error = \IPS\Member::loggedIn()->language()->addToStack('gallery_cat_or_album');
\IPS\Output::i()->output = $form->customTemplate( array( call_user_func_array( array( \IPS\Theme::i(), 'getTemplate' ), array( 'forms', 'core' ) ), 'popupTemplate' ) );
return;
}
$params[] = ( isset( $values['move_to_category'] ) AND $values['move_to_category'] ) ? $values['move_to_category'] : $values['move_to_album'];
$params[] = FALSE;
}
else
{
\IPS\Output::i()->output = $form->customTemplate( array( call_user_func_array( array( \IPS\Theme::i(), 'getTemplate' ), array( 'forms', 'core' ) ), 'popupTemplate' ) );
if ( \IPS\Request::i()->isAjax() )
{
\IPS\Output::i()->sendOutput( \IPS\Output::i()->output );
}
else
{
\IPS\Output::i()->sendOutput( \IPS\Theme::i()->getTemplate( 'global', 'core' )->globalTemplate( \IPS\Output::i()->title, \IPS\Output::i()->output, array( 'app' => \IPS\Dispatcher::i()->application->directory, 'module' => \IPS\Dispatcher::i()->module->key, 'controller' => \IPS\Dispatcher::i()->controller ) ), 200, 'text/html', \IPS\Output::i()->httpHeaders );
}
return;
}
}
foreach ( array_keys( \IPS\Request::i()->moderate ) as $id )
{
try
{
$object = $class::loadAndCheckPerms( $id );
$object->modAction( \IPS\Request::i()->modaction, \IPS\Member::loggedIn(), $params );
}
catch ( \Exception $e ) {}
}
\IPS\Output::i()->redirect( $this->baseUrl );
}
}
Whitespace-only changes.