Version 5.0.0 beta 3

This commit is contained in:
Neo committed 2025-12-19 16:47:22 -08:00
1 parent f61b0da85d
commit e86153356a
108 files changed
+2927 -1573

No files matched your search

+3 -3
View File
@@ -4127,7 +4127,7 @@ EOF;
{
$mapping[ $row['cat_id'] ] = $row['cat_key'];
$categoryData = [
'cat_name' => $lang->get( 'themeeditor_cat_' . $row['cat_id'] ),
'cat_name' => $lang->get( 'themeeditor_cat_' . $row['cat_key'] ),
'cat_key' => $row['cat_key'],
'cat_icon' => Category::constructFromData( $row )->icon()
];
@@ -4168,8 +4168,8 @@ EOF;
$settingData = [
'key' => $row['setting_key'],
'type' => $row['setting_type'],
'name' => $lang->get( 'themeeditor_var_' . $row['setting_id'] ),
'desc' => ( $lang->checkKeyExists( 'themeeditor_var_' . $row['setting_id'] . '_desc' ) ? $lang->get( 'themeeditor_var_' . $row['setting_id'] . '_desc' ) : '' ),
'name' => $lang->get( 'themeeditor_var_' . $row['setting_key'] ),
'desc' => ( $lang->checkKeyExists( 'themeeditor_var_' . $row['setting_key'] . '_desc' ) ? $lang->get( 'themeeditor_var_' . $row['setting_key'] . '_desc' ) : '' ),
'refresh' => (bool) $row['setting_refresh']
];
+3 -3
View File
@@ -438,7 +438,7 @@ abstract class Comment extends Content
}
}
if ( IPS::classUsesTrait( $this, 'IPS\Content\Hideable' ) and ( !$this->hidden() or $item->approvedButHidden() ) )
if ( !IPS::classUsesTrait( $this, 'IPS\Content\Hideable' ) or ( !$this->hidden() or $item->approvedButHidden() ) )
{
if ( isset( $item::$databaseColumnMap['last_comment'] ) )
{
@@ -468,14 +468,14 @@ abstract class Comment extends Content
$item->save();
if ( !$item->hidden() and ! $item->approvedButHidden() and $item->containerWrapper() and $item->container()->_comments !== NULL and ( !IPS::classUsesTrait( $item, 'IPS\Content\FuturePublishing' ) OR !$item->isFutureDate() ) )
if ( ( !IPS::classUsesTrait( $item, Hideable::class ) or ( !$item->hidden() and ! $item->approvedButHidden() ) ) and $item->containerWrapper() and $item->container()->_comments !== NULL and ( !IPS::classUsesTrait( $item, 'IPS\Content\FuturePublishing' ) OR !$item->isFutureDate() ) )
{
$item->container()->_comments = ( $item->container()->_comments + 1 );
$item->container()->setLastComment( $this, $item );
$item->container()->save();
}
}
else
elseif( IPS::classUsesTrait( $this, Hideable::class ) )
{
$item->save();
+8 -2
View File
@@ -1435,12 +1435,18 @@ abstract class Content extends ActiveRecord
/**
* Get quote and mention notifications
*
* @param string $content The content
* @param string|null $content The content
* @return array array( 'quotes' => array( ... member IDs ... ), 'mentions' => array( ... member IDs ... ), 'embeds' => array( ... member IDs ... ) )
*/
protected static function _getQuoteAndMentionIdsFromContent( string $content ): array
protected static function _getQuoteAndMentionIdsFromContent( ?string $content ): array
{
$return = array( 'quotes' => array(), 'mentions' => array(), 'embeds' => array() );
/* If we have no content, don't bother with this */
if( empty( $content ) )
{
return $return;
}
$document = new DOMDocument( '1.0', 'UTF-8' );
if ( @$document->loadHTML( DOMDocument::wrapHtml( '<div>' . $content . '</div>' ) ) !== FALSE )
+5
View File
@@ -99,6 +99,11 @@ class Tag extends Model
*/
public static ?string $databaseColumnEnabledDisabled = 'enabled';
/**
* @brief [Node] Order Database Column
*/
public static ?string $databaseColumnOrder = 'text_seo';
/**
* @brief Cover Photo Storage Extension
*/
+5 -4
View File
@@ -84,7 +84,7 @@ class Number extends FormAbstract
{
/* Specify there's a value if the unlimited element contains a value */
$unlimitedName = "{$name}_unlimited";
if( isset( $options['unlimited'] ) and $options['unlimited'] !== NULL and isset( Request::i()->$unlimitedName ) )
if( isset( $options['unlimited'] ) and isset( Request::i()->$unlimitedName ) )
{
Request::i()->$name = $options['unlimited'];
}
@@ -231,12 +231,13 @@ class Number extends FormAbstract
{
throw new InvalidArgumentException( 'form_number_bad' );
}
if ( $this->options['min'] !== NULL and (int) $this->value < $this->options['min'] )
$valueToCheck = ( isset( $this->options['decimals'] ) and $this->options['decimals'] ) ? floatval( $this->value ) : (int) $this->value;
if ( $this->options['min'] !== NULL and $valueToCheck < $this->options['min'] )
{
throw new LengthException( Member::loggedIn()->language()->addToStack('form_number_min', FALSE, array( 'sprintf' => array( $this->options['min'] ) ) ) );
}
if ( $this->options['max'] !== NULL and (int) $this->value > $this->options['max'] )
if ( $this->options['max'] !== NULL and $valueToCheck > $this->options['max'] )
{
throw new LengthException( Member::loggedIn()->language()->addToStack('form_number_max', FALSE, array( 'sprintf' => array( $this->options['max'] ) ) ) );
}
+1 -1
View File
@@ -316,7 +316,7 @@ class Facebook extends OAuth2
$photoVars = explode( ':', $member->group['g_photo_max_vars'] );
$response = $this->_authorizedRequest( "{$link['token_identifier']}/picture?width={$photoVars[1]}&redirect=false", $link['token_access_token'], NULL, 'get' );
if ( !$response['data']['is_silhouette'] )
if ( !$response['data']['is_silhouette'] and isset( $response['data']['url'] ) and $response['data']['url'] )
{
return Url::external( $response['data']['url'] );
}
+1 -1
View File
@@ -130,7 +130,7 @@ class Login
/**
* Get methods
*
* @return array
* @return array<Handler>
*/
public static function methods(): array
{
+20 -3
View File
@@ -143,9 +143,17 @@ class Controller extends DispatcherController
$this->protectRoots = TRUE;
}
$tree = new Tree( $this->url, $nodeClass::$nodeTitle, array( $this, '_getRoots' ), array( $this, '_getRow' ), array( $this, '_getRowParentId' ), array( $this, '_getChildren' ), array( $this, '_getRootButtons' ), TRUE, $this->lockParents, $this->protectRoots );
$tree = new Tree( $this->url, $nodeClass::$nodeTitle, array( $this, '_getRoots' ), array( $this, '_getRow' ), array( $this, '_getRowParentId' ), array( $this, '_getChildren' ), array( $this, '_getRootButtons' ), TRUE, $this->lockParents, $this->protectRoots, $this->_getRootsPerPage(), array( $this, '_getTotalRoots' ) );
Output::i()->output .= $tree;
}
/**
* @return int|null
*/
public function _getRootsPerPage(): ?int
{
return null;
}
/**
* Get Root Rows
@@ -163,7 +171,16 @@ class Controller extends DispatcherController
return $rows;
}
/**
* @return int
*/
public function _getTotalRoots(): int
{
$nodeClass = $this->nodeClass;
return count( $nodeClass::roots( NULL ) );
}
/**
* Show the "add" button in the page root rather than the table root
*/
@@ -460,7 +477,7 @@ class Controller extends DispatcherController
if ( $new and isset( $node::$databaseColumnOrder ) AND $node::$automaticPositionDetermination === TRUE )
{
$orderColumn = $node::$databaseColumnOrder;
$node->$orderColumn = Db::i()->select( 'MAX(' . $node::$databasePrefix . $orderColumn . ')', $node::$databaseTable )->first() + 1;
$node->$orderColumn = intval( Db::i()->select( 'MAX(' . $node::$databasePrefix . $orderColumn . ')', $node::$databaseTable )->first() ) + 1;
}
$old = NULL;
+1 -1
View File
@@ -964,7 +964,7 @@ abstract class Model extends ActiveRecord
protected function get__position(): int|null
{
$orderColumn = static::$databaseColumnOrder;
return $this->$orderColumn;
return (int) $this->$orderColumn;
}
/**
+17 -6
View File
@@ -570,6 +570,12 @@ class Poll extends ActiveRecord implements SplSubject
*/
public function canViewResults(): bool
{
/* The owner of the poll should always be able to see the results */
if( Member::loggedIn()->member_id == $this->author()->member_id )
{
return true;
}
/* If the poll is closed, check the group permissions.
0 = Never
1 = Always
@@ -580,11 +586,7 @@ class Poll extends ActiveRecord implements SplSubject
}
elseif( Member::loggedIn()->group['g_poll_results'] == 1 )
{
if ( Settings::i()->allow_result_view )
{
return true;
}
else if ( isset( Request::i()->nullVote ) and Member::loggedIn()->member_id )
if ( isset( Request::i()->nullVote ) and Member::loggedIn()->member_id )
{
if ( ! $this->getVote() )
{
@@ -594,8 +596,17 @@ class Poll extends ActiveRecord implements SplSubject
return TRUE;
}
}
elseif( Settings::i()->allow_result_view )
{
return true;
}
else
{
/* If the setting is disabled, check if we have voted */
return (bool) $this->getVote();
}
}
return FALSE;
}
+8 -1
View File
@@ -36,6 +36,7 @@ use OutOfRangeException;
use ParseError;
use UnderflowException;
use UnexpectedValueException;
use function array_keys;
use function array_merge;
use function count;
use function defined;
@@ -138,7 +139,7 @@ class CustomTemplate extends Model
*/
public static function all(): ActiveRecordIterator
{
return new ActiveRecordIterator( Db::i()->select( '*', static::$databaseTable, Db::i()->in( 'template_app', array_keys( Application::enabledApplications() ) ), static::$databasePrefix . static::$databaseColumnOrder ), 'IPS\Theme\CustomTemplate' );
return new ActiveRecordIterator( Db::i()->select( '*', static::$databaseTable, null, static::$databasePrefix . static::$databaseColumnOrder ), 'IPS\Theme\CustomTemplate' );
}
/**
@@ -305,6 +306,12 @@ class CustomTemplate extends Model
$organised = [];
foreach( static::all() as $template )
{
/* Only use templates that are enabled */
if ( $template->app and ! in_array( $template->app, array_keys( Application::enabledApplications() ) ) )
{
continue;
}
if ( ! $template->hookpoint )
{
if ( $template->key )
+1 -1
View File
@@ -318,7 +318,7 @@ class Category extends Model
{
$form->add( new Translatable( 'themeeditor_cat_name', null, true, array(
'app' => 'core',
'key' => ( $this->id ? 'themeeditor_cat_' . $this->id : null )
'key' => ( $this->id ? 'themeeditor_cat_' . $this->key : null )
) ) );
$form->add( new Text( 'themeeditor_cat_key', $this->key, true, array(
+5 -5
View File
@@ -242,7 +242,7 @@ class Setting extends Model
*/
public function get_name() : string
{
return Member::loggedIn()->language()->addToStack( 'themeeditor_var_' . $this->id );
return Member::loggedIn()->language()->addToStack( 'themeeditor_var_' . $this->key );
}
/**
@@ -250,9 +250,9 @@ class Setting extends Model
*/
public function get_desc() : string
{
if( Member::loggedIn()->language()->checkKeyExists( 'themeeditor_var_' . $this->id . '_desc' ) )
if( Member::loggedIn()->language()->checkKeyExists( 'themeeditor_var_' . $this->key . '_desc' ) )
{
return Member::loggedIn()->language()->addToStack( 'themeeditor_var_' . $this->id . '_desc' );
return Member::loggedIn()->language()->addToStack( 'themeeditor_var_' . $this->key . '_desc' );
}
return '';
@@ -489,12 +489,12 @@ class Setting extends Model
{
$form->add( new Translatable( 'themeeditor_setting_name', null, true, array(
'app' => 'core',
'key' => ( $this->id ? 'themeeditor_var_' . $this->id : null )
'key' => ( $this->id ? 'themeeditor_var_' . $this->key : null )
) ) );
$form->add( new Translatable( 'themeeditor_setting_desc', null, false, array(
'app' => 'core',
'key' => ( $this->id ? 'themeeditor_var_' . $this->id . '_desc' : null )
'key' => ( $this->id ? 'themeeditor_var_' . $this->key . '_desc' : null )
) ) );
$form->add( new Text( 'themeeditor_setting_key', $this->key, true, array(
+4 -1
View File
@@ -57,6 +57,7 @@ class Area
'columnLeft',
'columnRight',
'minimal',
'minimal-carousel',
'featured',
'featured-carousel',
'mini-grid',
@@ -75,6 +76,7 @@ class Area
'grid-carousel',
//'list',
'minimal',
'minimal-carousel',
'featured',
'featured-carousel',
'mini-grid',
@@ -115,7 +117,8 @@ class Area
* @var array
*/
public static array $carouselToRegularLayouts = [
"mini-grid-carousel" => ["mini-grid", "minimal"],
"mini-grid-carousel" => ["mini-grid"],
"minimal-carousel" => ["minimal"],
"grid-carousel" => ['grid'],
'table-carousel' => ['table'],
'wallpaper-carousel' => ['wallpaper'],
+1
View File
@@ -149,6 +149,7 @@ abstract class Widget
"grid",
"grid-carousel",
"minimal",
'minimal-carousel',
"mini-grid",
"mini-grid-carousel",
"table",