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

+29 -11
View File
@@ -2,9 +2,9 @@
/**
* @brief Admin CP Restrictions
* @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
* @since 04 Apr 2013
* @version SVN_VERSION_NUMBER
*/
@@ -241,6 +241,8 @@ class _admin extends \IPS\Dispatcher\Controller
$current = $current->first();
}
unset( \IPS\Data\Store::i()->administrators );
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=staff&controller=admin&do=edit&id={$current['row_id']}&type={$current['row_id_type']}" ) );
}
}
@@ -392,12 +394,22 @@ class _admin extends \IPS\Dispatcher\Controller
protected function delete()
{
$current = \IPS\Db::i()->select( '*', 'core_admin_permission_rows', array( "row_id=? AND row_id_type=?", intval( \IPS\Request::i()->id ), \IPS\Request::i()->type ) )->first();
if ( $current )
if ( $current['row_id_type'] === 'member' )
{
\IPS\Session::i()->log( 'acplog__acpr_deleted', array( ( $current['row_id_type'] == 'group' ? \IPS\Member\Group::load( $current['row_id'] )->name : \IPS\Member::load( $current['row_id'] )->name ) => FALSE ) );
\IPS\Db::i()->delete( 'core_admin_permission_rows', array( 'row_id=? AND row_id_type=?', intval( \IPS\Request::i()->id ), \IPS\Request::i()->type ) );
unset ( \IPS\Data\Store::i()->administrators );
\IPS\Dispatcher::i()->checkAcpPermission( 'restrictions_delete_member' );
}
else
{
\IPS\Dispatcher::i()->checkAcpPermission( 'restrictions_delete_group' );
}
/* Make sure the user confirmed the deletion */
\IPS\Request::i()->confirmedDelete();
\IPS\Session::i()->log( 'acplog__acpr_deleted', array( ( $current['row_id_type'] == 'group' ? \IPS\Member\Group::load( $current['row_id'] )->name : \IPS\Member::load( $current['row_id'] )->name ) => FALSE ) );
\IPS\Db::i()->delete( 'core_admin_permission_rows', array( 'row_id=? AND row_id_type=?', intval( \IPS\Request::i()->id ), \IPS\Request::i()->type ) );
unset ( \IPS\Data\Store::i()->administrators );
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=staff&controller=admin' ) );
}
@@ -417,16 +429,24 @@ class _admin extends \IPS\Dispatcher\Controller
$table->include = array( 'member_id', 'action', 'ip_address', 'ctime' );
$table->mainColumn = 'action';
$table->parsers = array(
'member_id' => function( $val )
'member_id' => function( $val, $row )
{
try
$member = \IPS\Member::load( $val );
if ( $member->member_id )
{
return htmlentities( \IPS\Member::load( $val )->name, \IPS\HTMLENTITIES, 'UTF-8', FALSE );
}
catch ( \OutOfRangeException $e )
else if ( $row['member_name'] != '' )
{
return htmlentities( $row['member_name'], \IPS\HTMLENTITIES, 'UTF-8', FALSE );
}
else
{
// Member doesn't exist anymore, but we also haven't stored the name
return '';
}
},
'action' => function( $val, $row )
{
@@ -467,9 +487,7 @@ class _admin extends \IPS\Dispatcher\Controller
'member_id' => \IPS\Helpers\Table\SEARCH_MEMBER,
'ip_address' => \IPS\Helpers\Table\SEARCH_CONTAINS_TEXT,
'ctime' => \IPS\Helpers\Table\SEARCH_DATE_RANGE,
'note' => \IPS\Helpers\Table\SEARCH_CONTAINS_TEXT,
);
$table->quickSearch = 'note';
/* Add a button for settings */
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'staff', 'restrictions_adminlogs_prune' ) )
@@ -2,9 +2,9 @@
/**
* @brief Staff directory management
* @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
* @since 18 Sep 2013
* @version SVN_VERSION_NUMBER
*/
@@ -35,6 +35,7 @@ class _directory extends \IPS\Node\Controller
*/
public function execute()
{
\IPS\Dispatcher::i()->checkAcpPermission( 'leaders_manage' );
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'staffdirectory/staffdirectory.css', 'core', 'admin' ) );
return parent::execute();
}
@@ -2,9 +2,9 @@
/**
* @brief moderators
* @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
* @since 24 Apr 2013
* @version SVN_VERSION_NUMBER
*/
@@ -154,37 +154,37 @@ class _moderators extends \IPS\Dispatcher\Controller
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'staff', 'moderators_add_member' ) and \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'staff', 'moderators_add_group' ) )
{
$form->add( new \IPS\Helpers\Form\Radio( 'acprestrictions_type', NULL, TRUE, array( 'options' => array( 'g' => 'group', 'm' => 'member' ), 'toggles' => array( 'g' => array( 'acprestrictions_group' ), 'm' => array( 'acprestrictions_member' ) ) ) ) );
$form->add( new \IPS\Helpers\Form\Radio( 'moderators_type', NULL, TRUE, array( 'options' => array( 'g' => 'group', 'm' => 'member' ), 'toggles' => array( 'g' => array( 'moderators_group' ), 'm' => array( 'moderators_member' ) ) ) ) );
}
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'staff', 'moderators_add_member' ) )
{
$form->add( new \IPS\Helpers\Form\Select( 'acprestrictions_group', NULL, FALSE, array( 'options' => \IPS\Member\Group::groups( TRUE, FALSE ), 'parse' => 'normal' ), NULL, NULL, NULL, 'acprestrictions_group' ) );
$form->add( new \IPS\Helpers\Form\Select( 'moderators_group', NULL, FALSE, array( 'options' => \IPS\Member\Group::groups( TRUE, FALSE ), 'parse' => 'normal' ), NULL, NULL, NULL, 'moderators_group' ) );
}
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'staff', 'moderators_add_group' ) )
{
$form->add( new \IPS\Helpers\Form\Member( 'acprestrictions_member', NULL, ( \IPS\Request::i()->acprestrictions_type === 'member' ), array(), NULL, NULL, NULL, 'acprestrictions_member' ) );
$form->add( new \IPS\Helpers\Form\Member( 'moderators_member', NULL, ( \IPS\Request::i()->moderators_type === 'member' ), array(), NULL, NULL, NULL, 'moderators_member' ) );
}
if ( $values = $form->values() )
{
$rowId = NULL;
if ( $values['acprestrictions_type'] === 'g' or !\IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'staff', 'moderators_add_member' ) )
if ( $values['moderators_type'] === 'g' or !\IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'staff', 'moderators_add_member' ) )
{
\IPS\Dispatcher::i()->checkAcpPermission( 'moderators_add_group' );
$rowId = $values['acprestrictions_group'];
$rowId = $values['moderators_group'];
}
elseif ( $values['acprestrictions_member'] )
elseif ( $values['moderators_member'] )
{
\IPS\Dispatcher::i()->checkAcpPermission( 'moderators_add_member' );
$rowId = $values['acprestrictions_member']->member_id;
$rowId = $values['moderators_member']->member_id;
}
if ( $rowId !== NULL )
{
try
{
$current = \IPS\Db::i()->select( '*', 'core_moderators', array( "id=? AND type=?", $rowId, $values['acprestrictions_type'] ) )->first();
$current = \IPS\Db::i()->select( '*', 'core_moderators', array( "id=? AND type=?", $rowId, $values['moderators_type'] ) )->first();
}
catch( \UnderflowException $e )
{
@@ -195,7 +195,7 @@ class _moderators extends \IPS\Dispatcher\Controller
{
$current = array(
'id' => $rowId,
'type' => $values['acprestrictions_type'],
'type' => $values['moderators_type'],
'perms' => '*',
'updated' => time()
);
@@ -207,7 +207,7 @@ class _moderators extends \IPS\Dispatcher\Controller
$ext->onChange( $current, $values );
}
\IPS\Session::i()->log( 'acplog__moderator_created', array( ( $values['acprestrictions_type'] == 'g' ? \IPS\Member::loggedIn()->language()->get( "core_group_{$values['acprestrictions_group']}" ) : $values['acprestrictions_member']->name ) => FALSE ) );
\IPS\Session::i()->log( 'acplog__moderator_created', array( ( $values['moderators_type'] == 'g' ? \IPS\Member::loggedIn()->language()->get( "core_group_{$values['moderators_group']}" ) : $values['moderators_member']->name ) => FALSE ) );
unset (\IPS\Data\Store::i()->moderators);
}
@@ -378,7 +378,8 @@ class _moderators extends \IPS\Dispatcher\Controller
/* For node fields, if the value is 0 translate it to -1 so mod permissions can merge properly */
if( in_array( $k, $nodeFields ) )
{
if( $v == 0 )
/* If nothing is checked we have '', but if 'all' is checked then the value is 0 */
if( $v === 0 )
{
$v = -1;
$values[ $k ] = $v;
@@ -489,11 +490,27 @@ class _moderators extends \IPS\Dispatcher\Controller
protected function delete()
{
/* Load */
$current = \IPS\Db::i()->select( '*', 'core_moderators', array( "id=? AND type=?", intval( \IPS\Request::i()->id ), \IPS\Request::i()->type ) )->first();
if ( !$current )
try
{
$current = \IPS\Db::i()->select( '*', 'core_moderators', array( "id=? AND type=?", intval( \IPS\Request::i()->id ), \IPS\Request::i()->type ) )->first();
}
catch( \UnderflowException $e )
{
\IPS\Output::i()->error( 'node_error', '2C118/4', 404, '' );
}
/* Check acp restrictions */
if ( $current['type'] === 'm' )
{
\IPS\Dispatcher::i()->checkAcpPermission( 'moderators_delete_member' );
}
else
{
\IPS\Dispatcher::i()->checkAcpPermission( 'moderators_delete_group' );
}
/* Make sure the user confirmed the deletion */
\IPS\Request::i()->confirmedDelete();
/* Delete */
\IPS\Db::i()->delete( 'core_moderators', array( array( "id=? AND type=?", $current['id'], $current['type'] ) ) );
@@ -524,14 +541,20 @@ class _moderators extends \IPS\Dispatcher\Controller
$table->include = array( 'member_id', 'action', 'ip_address', 'ctime' );
$table->mainColumn = 'action';
$table->parsers = array(
'member_id' => function( $val )
'member_id' => function( $val, $row )
{
try
$member = \IPS\Member::load( $val );
if ( $member->member_id )
{
return htmlentities( \IPS\Member::load( $val )->name, \IPS\HTMLENTITIES, 'UTF-8', FALSE );
}
catch ( \OutOfRangeException $e )
else if ( $row['member_name'] != '' )
{
return htmlentities( $row['member_name'], \IPS\HTMLENTITIES, 'UTF-8', FALSE );
}
else
{
// Member doesn't exist anymore, but we also haven't stored the name
return '';
}
},