Version 4.5.0
This commit is contained in:
1 parent
1a0c7fd3c2
commit
f79dcf067a
3791 files changed
+248032
-76372
No files matched your search
@@ -12,7 +12,7 @@
|
||||
namespace IPS\nexus\modules\admin\hosting;
|
||||
|
||||
/* 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;
|
||||
@@ -23,6 +23,11 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
*/
|
||||
class _servers extends \IPS\Node\Controller
|
||||
{
|
||||
/**
|
||||
* @brief Has been CSRF-protected
|
||||
*/
|
||||
public static $csrfProtected = TRUE;
|
||||
|
||||
/**
|
||||
* Node Class
|
||||
*/
|
||||
@@ -98,7 +103,7 @@ class _servers extends \IPS\Node\Controller
|
||||
$return['reboot'] = array(
|
||||
'title' => 'reboot',
|
||||
'icon' => 'refresh',
|
||||
'link' => \IPS\Http\Url::internal( 'app=nexus&module=hosting&controller=servers&do=reboot&id=' . $row['server_id'] )
|
||||
'link' => \IPS\Http\Url::internal( 'app=nexus&module=hosting&controller=servers&do=reboot&id=' . $row['server_id'] )->csrf()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -248,7 +253,7 @@ class _servers extends \IPS\Node\Controller
|
||||
}
|
||||
|
||||
\IPS\Output::i()->title = $server->hostname;
|
||||
\IPS\Output::i()->output = call_user_func_array( array( \IPS\Theme::i()->getTemplate( 'hosting' ), 'viewAccounts' ), $this->_audit( $server ) );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'hosting' )->viewAccounts( ...$this->_audit( $server ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -259,6 +264,7 @@ class _servers extends \IPS\Node\Controller
|
||||
protected function reboot()
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'servers_reboot' );
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
|
||||
try
|
||||
{
|
||||
@@ -299,7 +305,7 @@ class _servers extends \IPS\Node\Controller
|
||||
\IPS\Http\Url::internal('app=nexus&module=hosting&controller=servers&do=audit'),
|
||||
function( $data ) use ( $self )
|
||||
{
|
||||
if ( !is_array( $data ) )
|
||||
if ( !\is_array( $data ) )
|
||||
{
|
||||
$_SESSION['serverAudit'] = array();
|
||||
$data = array( 'offset' => 0, 'bad' => array() );
|
||||
@@ -307,7 +313,7 @@ class _servers extends \IPS\Node\Controller
|
||||
|
||||
try
|
||||
{
|
||||
$select = \IPS\Db::i()->select( '*', 'nexus_hosting_servers', array(), 'server_hostname', array( $data['offset'], 1 ), NULL, NULL, \IPS\Db::SELECT_SQL_CALC_FOUND_ROWS );
|
||||
$select = \IPS\Db::i()->select( '*', 'nexus_hosting_servers', array(), 'server_hostname', array( $data['offset'], 1 ) );
|
||||
$server = \IPS\nexus\Hosting\Server::constructFromData( $select->first() );
|
||||
|
||||
$results = $self->_audit( $server );
|
||||
@@ -321,7 +327,7 @@ class _servers extends \IPS\Node\Controller
|
||||
}
|
||||
|
||||
$data['offset']++;
|
||||
return array( $data, \IPS\Member::loggedIn()->language()->get('hserv_audit_running'), 100 / $select->count(TRUE) * $data['offset'] );
|
||||
return array( $data, \IPS\Member::loggedIn()->language()->get('hserv_audit_running'), 100 / \IPS\Db::i()->select( '*', 'nexus_hosting_servers' )->first() * $data['offset'] );
|
||||
}
|
||||
catch ( \UnderflowException $e )
|
||||
{
|
||||
@@ -466,19 +472,10 @@ class _servers extends \IPS\Node\Controller
|
||||
*/
|
||||
protected function form()
|
||||
{
|
||||
$availableTypes = array();
|
||||
|
||||
foreach ( new \DirectoryIterator( \IPS\ROOT_PATH . '/applications/nexus/sources/Hosting' ) as $file )
|
||||
$availableTypes = \IPS\nexus\Hosting\Server::serverTypes();
|
||||
if( isset( \IPS\Request::i()->server_type ) and \array_key_exists( \IPS\Request::i()->server_type, $availableTypes ) )
|
||||
{
|
||||
if (!$file->isDot() and mb_substr($file, 0, 1) !== '.' and $file->isDir())
|
||||
{
|
||||
$availableTypes[] = (string) $file;
|
||||
}
|
||||
}
|
||||
|
||||
if( isset( \IPS\Request::i()->server_type ) and in_array( \IPS\Request::i()->server_type, $availableTypes ) )
|
||||
{
|
||||
$this->nodeClass = "IPS\\nexus\\Hosting\\" . mb_ucfirst( \IPS\Request::i()->server_type ) . "\\Server";
|
||||
$this->nodeClass = $availableTypes[ mb_ucfirst( \IPS\Request::i()->server_type ) ];
|
||||
}
|
||||
|
||||
parent::form();
|
||||
|
||||
Reference in new issue
Block a user