Version 4.5.0
This commit is contained in:
1 parent
1a0c7fd3c2
commit
f79dcf067a
3791 files changed
+248032
-76372
No files matched your search
@@ -11,7 +11,7 @@
|
||||
namespace IPS\core\modules\admin\membersettings;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -22,6 +22,11 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
*/
|
||||
class _ranks extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/**
|
||||
* @brief Has been CSRF-protected
|
||||
*/
|
||||
public static $csrfProtected = TRUE;
|
||||
|
||||
/**
|
||||
* Execute
|
||||
*
|
||||
@@ -62,7 +67,7 @@ class _ranks extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
else
|
||||
{
|
||||
return str_repeat("<span class='ipsPip'></span>", intval($val) );
|
||||
return str_repeat("<span class='ipsPip'></span>", \intval($val) );
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -71,44 +76,34 @@ class _ranks extends \IPS\Dispatcher\Controller
|
||||
$table->sortDirection = $table->sortDirection ?: 'asc';
|
||||
|
||||
/* Root Buttons */
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'membersettings', 'ranks_manage' ) )
|
||||
{
|
||||
\IPS\Output::i()->sidebar['actions'] = array(
|
||||
'add' => array(
|
||||
'primary' => TRUE,
|
||||
'icon' => 'plus',
|
||||
'title' => 'member_ranks_add',
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('member_ranks_add') ),
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=ranks&do=form' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
\IPS\Output::i()->sidebar['actions'] = array(
|
||||
'add' => array(
|
||||
'primary' => TRUE,
|
||||
'icon' => 'plus',
|
||||
'title' => 'member_ranks_add',
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('member_ranks_add') ),
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=ranks&do=form' ),
|
||||
)
|
||||
);
|
||||
|
||||
/* Row buttons */
|
||||
$table->rowButtons = function( $row )
|
||||
{
|
||||
$return = array();
|
||||
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'membersettings', 'ranks_manage' ) )
|
||||
{
|
||||
$return['edit'] = array(
|
||||
'icon' => 'pencil',
|
||||
'title' => 'edit',
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('edit') ),
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=ranks&do=form&id=' ) . $row['id'],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'membersettings', 'ranks_manage' ) )
|
||||
{
|
||||
$return['delete'] = array(
|
||||
'icon' => 'times-circle',
|
||||
'title' => 'delete',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=ranks&do=delete&id=' ) . $row['id'],
|
||||
'data' => array( 'delete' => '' ),
|
||||
);
|
||||
}
|
||||
|
||||
$return['edit'] = array(
|
||||
'icon' => 'pencil',
|
||||
'title' => 'edit',
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('edit') ),
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=ranks&do=form&id=' ) . $row['id'],
|
||||
);
|
||||
|
||||
$return['delete'] = array(
|
||||
'icon' => 'times-circle',
|
||||
'title' => 'delete',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=ranks&do=delete&id=' ) . $row['id'],
|
||||
'data' => array( 'delete' => '' ),
|
||||
);
|
||||
|
||||
return $return;
|
||||
};
|
||||
@@ -142,6 +137,8 @@ class _ranks extends \IPS\Dispatcher\Controller
|
||||
|
||||
/**
|
||||
* Add/Edit Rank
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function form()
|
||||
{
|
||||
@@ -158,7 +155,7 @@ class _ranks extends \IPS\Dispatcher\Controller
|
||||
$form->add( new \IPS\Helpers\Form\Translatable( 'member_ranks_word_custom', NULL, TRUE, array( 'app' => 'core', 'key' => ( $current ? "core_member_rank_{$current['id']}" : NULL ) ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'member_ranks_posts', $current ? $current['posts'] : 0, TRUE, array( 'min' => 0 ) ) );
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'member_use_icon', $current['use_icon'], FALSE, array(
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'member_use_icon', $current ? $current['use_icon'] : NULL, FALSE, array(
|
||||
'parse' => 'raw',
|
||||
'options' => array( 0 => \IPS\Member::loggedIn()->language()->addToStack('member_ranks_pip_number', FALSE, array( 'htmlsprintf' => array( "<span class='ipsPip'></span>" ) ) ), 1 => \IPS\Member::loggedIn()->language()->addToStack('member_ranks_pip_icon') ),
|
||||
'toggles' => array( 0 => array('member_ranks_pips'), 1 => array('member_ranks_icon') )
|
||||
@@ -166,7 +163,7 @@ class _ranks extends \IPS\Dispatcher\Controller
|
||||
|
||||
/* Pip Icon */
|
||||
$pip = NULL;
|
||||
if ( $current['icon'] )
|
||||
if ( $current AND $current['icon'] )
|
||||
{
|
||||
$pip = \IPS\File::get( 'core_Theme', $current['icon'] );
|
||||
}
|
||||
@@ -176,9 +173,9 @@ class _ranks extends \IPS\Dispatcher\Controller
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
$save = array(
|
||||
'posts' => intval( $values['member_ranks_posts'] ),
|
||||
'pips' => intval( $values['member_ranks_num_pips'] ),
|
||||
'use_icon' => intval( $values['member_use_icon'] ),
|
||||
'posts' => \intval( $values['member_ranks_posts'] ),
|
||||
'pips' => \intval( $values['member_ranks_num_pips'] ),
|
||||
'use_icon' => \intval( $values['member_use_icon'] ),
|
||||
'icon' => '',
|
||||
);
|
||||
|
||||
|
||||
Reference in new issue
Block a user