Version 4.1.2

This commit is contained in:
Neo committed 2025-12-19 05:32:19 -08:00
1 parent 3ba79295ee
commit 28bd025b35
1131 files changed
+63658 -20579

No files matched your search

@@ -146,7 +146,7 @@ class _Databases extends \IPS\Node\Model implements \IPS\Node\Permissions
)
)
);
/**
* Return all databases
*
@@ -156,21 +156,38 @@ class _Databases extends \IPS\Node\Model implements \IPS\Node\Permissions
{
if ( ! static::$gotAll )
{
if ( \IPS\Db::i()->checkForTable( static::$databaseTable ) )
if ( ! isset( \IPS\Data\Store::i()->cms_databases ) )
{
\IPS\Data\Store::i()->cms_databases = iterator_to_array( \IPS\Db::i()->select( '*', static::$databaseTable )->setKeyField('database_id') );
}
/* Avoid using SHOW TABLES LIKE / checkForTable() */
try
{
foreach( \IPS\Db::i()->select( '*', static::$databaseTable ) as $db )
foreach( \IPS\Data\Store::i()->cms_databases as $db )
{
$id = $db[ static::$databasePrefix . static::$databaseColumnId ];
static::$multitons[ $id ] = static::constructFromData( $db );
}
}
catch( \Exception $e ) { }
static::$gotAll = true;
}
return static::$multitons;
}
/**
* Can we promote stuff to Pages?
*
* @return boolean
*/
public static function canPromote()
{
return TRUE;
}
/**
* Construct ActiveRecord from database row
*
@@ -329,9 +346,19 @@ class _Databases extends \IPS\Node\Model implements \IPS\Node\Permissions
foreach( \IPS\Lang::languages() as $id => $lang )
{
/* Try to get the actual database noun if it has been created */
try
{
$title = $lang->get( 'content_db_lang_pu_' . $database->id );
}
catch( \Exception $e )
{
$title = $lang->get('content_database_noun_pu');
}
$fieldTitle[ $id ] = $lang->get('content_fields_is_title');
$fieldContent[ $id ] = $lang->get('content_fields_is_content');
$catTitle[ $id ] = $lang->get('content_database_noun_pu');
$catTitle[ $id ] = $title;
$catDesc[ $id ] = '';
}
@@ -660,7 +687,7 @@ class _Databases extends \IPS\Node\Model implements \IPS\Node\Permissions
public function preLoadWords()
{
/* Skip this during installation / uninstallation as the words won't be loaded */
if ( !\IPS\Dispatcher::hasInstance() or \IPS\Dispatcher::i()->controllerLocation === 'setup' OR ( \IPS\Dispatcher::i()->controllerLocation === 'admin' AND ( !\IPS\Dispatcher::i()->module OR \IPS\Dispatcher::i()->module->key === 'applications' ) ) )
if ( !\IPS\Dispatcher::hasInstance() or \IPS\Dispatcher::i()->controllerLocation === 'setup' OR ( \IPS\Dispatcher::i()->controllerLocation === 'admin' AND \IPS\Dispatcher::i()->module->key === 'applications' ) )
{
$this->langLoaded = TRUE;
return;
@@ -671,17 +698,20 @@ class _Databases extends \IPS\Node\Model implements \IPS\Node\Permissions
\IPS\Member::loggedIn()->language()->words['__indefart_content_record_comments_title_' . $this->id ] = \IPS\Member::loggedIn()->language()->addToStack( '__indefart_content_record_comments_title' );
\IPS\Member::loggedIn()->language()->words['__indefart_content_record_reviews_title_' . $this->id ] = \IPS\Member::loggedIn()->language()->addToStack( '__indefart_content_record_reviews_title' );
\IPS\Member::loggedIn()->language()->words['content_record_comments_title_' . $this->id ] = \IPS\Member::loggedIn()->language()->addToStack( 'content_record_comments_title', FALSE, array( 'sprintf' => array( $this->recordWord( 1, TRUE ) ) ) );
\IPS\Member::loggedIn()->language()->words['content_record_reviews_title_' . $this->id ] = \IPS\Member::loggedIn()->language()->addToStack( 'content_record_reviews_title', FALSE, array( 'sprintf' => array( $this->recordWord( 1, TRUE ) ) ) );
\IPS\Member::loggedIn()->language()->words['content_record_comments_title_' . $this->id ] = \IPS\Member::loggedIn()->language()->addToStack( 'content_record_comment_title', FALSE, array( 'sprintf' => array( $this->recordWord( 1, TRUE ) ) ) );
\IPS\Member::loggedIn()->language()->words['content_record_reviews_title_' . $this->id ] = \IPS\Member::loggedIn()->language()->addToStack( 'content_record_review_title', FALSE, array( 'sprintf' => array( $this->recordWord( 1, TRUE ) ) ) );
\IPS\Member::loggedIn()->language()->words['content_record_comments_title_' . $this->id . '_pl' ] = \IPS\Member::loggedIn()->language()->addToStack( 'content_record_comments_title', FALSE, array( 'sprintf' => array( $this->recordWord( 1, TRUE ) ) ) );
\IPS\Member::loggedIn()->language()->words['content_record_reviews_title_' . $this->id . '_pl' ] = \IPS\Member::loggedIn()->language()->addToStack( 'content_record_reviews_title', FALSE, array( 'sprintf' => array( $this->recordWord( 1, TRUE ) ) ) );
\IPS\Member::loggedIn()->language()->words['content_db_lang_su_' . $this->id . '_pl' ] = \IPS\Member::loggedIn()->language()->addToStack( 'content_db_lang_pu_' . $this->id );
\IPS\Member::loggedIn()->language()->words['content_db_lang_sl_' . $this->id . '_pl_lc' ] = \IPS\Member::loggedIn()->language()->addToStack( 'content_db_lang_pl_' . $this->id );
$fieldsClass = '\IPS\cms\Fields' . $this->id;
$customFields = $fieldsClass::data( 'view', $this );
$customFields = $fieldsClass::databaseFieldIds();
foreach ( $customFields AS $id => $field)
foreach ( $customFields AS $id )
{
\IPS\Member::loggedIn()->language()->words['sort_field_' . $id] = $field->_title;
\IPS\Member::loggedIn()->language()->words['sort_field_' . $id] = \IPS\Member::loggedIn()->language()->addToStack( 'content_field_' . $id );
}
if ( \IPS\Dispatcher::i()->controllerLocation === 'admin' )
@@ -722,6 +752,21 @@ class _Databases extends \IPS\Node\Model implements \IPS\Node\Permissions
return $number == 1 ? \IPS\Member::loggedIn()->language()->addToStack("content_db_lang_s{$case}_{$this->id}") : \IPS\Member::loggedIn()->language()->addToStack("content_db_lang_p{$case}_{$this->id}");
}
/**
* [ActiveRecord] Save Record
*
* @return void
*/
public function save()
{
if ( isset( \IPS\Data\Store::i()->cms_databases ) )
{
unset( \IPS\Data\Store::i()->cms_databases );
}
parent::save();
}
/**
* [ActiveRecord] Delete Record
*
@@ -742,9 +787,18 @@ class _Databases extends \IPS\Node\Model implements \IPS\Node\Permissions
$field->delete( TRUE );
}
if ( isset( \IPS\Data\Store::i()->cms_databases ) )
{
unset( \IPS\Data\Store::i()->cms_databases );
}
/* Delete comments */
\IPS\Db::i()->delete( 'cms_database_comments', array( 'comment_database_id=?', $this->id ) );
/* Delete from search index */
\IPS\Db::i()->delete( 'core_search_index', array( 'index_class=?', "IPS\cms\Records\Comment" . $this->id ) );
\IPS\Db::i()->delete( 'core_search_index', array( 'index_class=?', "IPS\cms\Records\Review" . $this->id ) );
/* Delete records */
\IPS\Db::i()->dropTable( 'cms_custom_database_' . $this->id, TRUE );