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

+68 -3
View File
@@ -2,9 +2,9 @@
/**
* @brief Support Status Model
* @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 Nexus
* @since 8 Apr 2014
* @version SVN_VERSION_NUMBER
@@ -53,6 +53,11 @@ class _Status extends \IPS\Node\Model
* @brief [ActiveRecord] Database ID Fields
*/
protected static $databaseIdFields = array( 'status_default_member', 'status_default_staff' );
/**
* @brief [ActiveRecord] Multiton Map
*/
protected static $multitonMap = array();
/**
* @brief [Node] ACP Restrictions
@@ -75,7 +80,51 @@ class _Status extends \IPS\Node\Model
'module' => 'support',
'all' => 'statuses_manage'
);
/**
* Load Record
*
* @see \IPS\Db::build
* @param int|string $id ID
* @param string $idField The database column that the $id parameter pertains to (NULL will use static::$databaseColumnId)
* @param mixed $extraWhereClause Additional where clause(s) (see \IPS\Db::build for details)
* @return static
* @throws \InvalidArgumentException
* @throws \OutOfRangeException
*/
public static function load( $id, $idField=NULL, $extraWhereClause=NULL )
{
try
{
return parent::load( $id, $idField, $extraWhereClause );
}
catch ( \OutOfRangeException $e )
{
/* A default status (both user and staff) is required. If none are set as the fault (for example, bad data from upgrade), find or create one */
if ( $id === TRUE and ( $idField === 'status_default_member' OR $idField === 'status_default_staff' ) and $extraWhereClause === NULL )
{
try
{
$return = parent::constructFromData( \IPS\Db::i()->select( '*', 'nexus_support_statuses' )->first() );
}
catch ( \UnderflowException $e )
{
$return = new static;
$return->open = 1;
$return->log = 1;
$return->position = 0;
}
$col = str_replace( 'status_', '', $idField );
$return->$col = TRUE;
$return->save();
return $return;
}
throw $e;
}
}
/**
* Statuses that the member can set
*
@@ -274,4 +323,20 @@ class _Status extends \IPS\Node\Model
\IPS\Lang::saveCustom( 'nexus', "nexus_status_{$this->id}_front", iterator_to_array( \IPS\Db::i()->select( 'word_custom, lang_id', 'core_sys_lang_words', array( 'word_key=?', "nexus_status_{$oldId}_front" ) )->setKeyField( 'lang_id' )->setValueField('word_custom') ) );
\IPS\Lang::saveCustom( 'nexus', "nexus_status_{$this->id}_set", iterator_to_array( \IPS\Db::i()->select( 'word_custom, lang_id', 'core_sys_lang_words', array( 'word_key=?', "nexus_status_{$oldId}_set" ) )->setKeyField( 'lang_id' )->setValueField('word_custom') ) );
}
/**
* Get output for API
*
* @return array
* @apiresponse int id ID number
* @apiresponse string name Name
*/
public function apiOutput()
{
return array(
'id' => $this->_id,
'publicName' => \IPS\Member::loggedIn()->language()->addToStack( 'nexus_status_' . $this->id . '_front' ),
'internalName' => \IPS\Member::loggedIn()->language()->addToStack( 'nexus_status_' . $this->id . '_admin' )
);
}
}