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 _errors extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/**
|
||||
* @brief Has been CSRF-protected
|
||||
*/
|
||||
public static $csrfProtected = TRUE;
|
||||
|
||||
/**
|
||||
* Execute
|
||||
*
|
||||
@@ -35,14 +40,15 @@ class _errors extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage
|
||||
* Table
|
||||
*
|
||||
* @param \IPS\Http\Url $url The URL the table will be shown on
|
||||
* @return void
|
||||
*/
|
||||
protected function manage()
|
||||
{
|
||||
public static function table( $url )
|
||||
{
|
||||
/* Create the table */
|
||||
$table = new \IPS\Helpers\Table\Db( 'nexus_hosting_errors', \IPS\Http\Url::internal( 'app=nexus&module=hosting&controller=errors' ) );
|
||||
$table = new \IPS\Helpers\Table\Db( 'nexus_hosting_errors', $url );
|
||||
$table->include = array( 'e_time', 'e_server', 'e_account', 'e_function', 'e_message' );
|
||||
$table->langPrefix = 'hosting_';
|
||||
$table->rowClasses = array( 'e_message' => array( 'ipsTable_wrap' ) );
|
||||
@@ -93,7 +99,7 @@ class _errors extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
if ( $username )
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate('hosting')->accountLink( $username );
|
||||
return \IPS\Theme::i()->getTemplate('hosting', 'nexus')->accountLink( $username );
|
||||
}
|
||||
return '';
|
||||
},
|
||||
@@ -123,7 +129,7 @@ class _errors extends \IPS\Dispatcher\Controller
|
||||
'retry' => array(
|
||||
'icon' => 'refresh',
|
||||
'title' => 'retry',
|
||||
'link' => \IPS\Http\Url::internal( 'app=nexus&module=hosting&controller=errors&do=retry&id=' . $row['e_id'] )
|
||||
'link' => \IPS\Http\Url::internal( 'app=nexus&module=hosting&controller=errors&do=retry&id=' . $row['e_id'] )->csrf()
|
||||
),
|
||||
'delete'=> array(
|
||||
'icon' => 'times-circle',
|
||||
@@ -134,15 +140,19 @@ class _errors extends \IPS\Dispatcher\Controller
|
||||
);
|
||||
};
|
||||
|
||||
/* Display */
|
||||
\IPS\Output::i()->sidebar['actions'][] = array(
|
||||
'icon' => 'envelope',
|
||||
'title' => 'notifications',
|
||||
'link' => \IPS\Http\Url::internal( "app=nexus&module=hosting&controller=errors&do=settings" ),
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('notifications') )
|
||||
);
|
||||
/* Return */
|
||||
return $table;
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function manage()
|
||||
{
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__nexus_hosting_errors');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'forms', 'core' )->blurb( 'hosting_errors_blurb' ) . (string) $table;
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'forms', 'core' )->blurb( 'hosting_errors_blurb' ) . (string) static::table( \IPS\Http\Url::internal( 'app=nexus&module=hosting&controller=errors' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -172,6 +182,8 @@ class _errors extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
public function retry()
|
||||
{
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
|
||||
try
|
||||
{
|
||||
$log = \IPS\Db::i()->select( '*', 'nexus_hosting_errors', array( 'e_id=?', \IPS\Request::i()->id ) )->first();
|
||||
@@ -216,24 +228,4 @@ class _errors extends \IPS\Dispatcher\Controller
|
||||
\IPS\Db::i()->delete( 'nexus_hosting_errors', array( 'e_id=?', \IPS\Request::i()->id ) );
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal('app=nexus&module=hosting&controller=errors'), 'deleted' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function settings()
|
||||
{
|
||||
$form = new \IPS\Helpers\Form;
|
||||
$form->add( new \IPS\Helpers\Form\Stack( 'nexus_hosting_error_emails', explode( ',', \IPS\Settings::i()->nexus_hosting_error_emails ), FALSE, array( 'stackFieldType' => 'Email' ) ) );
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
$values['nexus_hosting_error_emails'] = implode( ',', $values['nexus_hosting_error_emails'] );
|
||||
$form->saveAsSettings( $values );
|
||||
\IPS\Session::i()->log( 'acplogs__host_err_settings' );
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal('app=nexus&module=hosting&controller=errors'), 'saved' );
|
||||
}
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__nexus_hosting_errors');
|
||||
\IPS\Output::i()->output = $form;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user