Version 4.7.0
This commit is contained in:
1 parent
517a5e1f70
commit
8ba7d43898
1933 files changed
+65613
-11332
No files matched your search
@@ -46,7 +46,7 @@ class _hookedFiles extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
protected function manage()
|
||||
{
|
||||
$table = new \IPS\Helpers\Table\Db( 'core_hooks', \IPS\Http\Url::internal( 'app=core&module=support&controller=hookedFiles' ), array( \IPS\Db::i()->in( 'app', \IPS\IPS::$ipsApps, TRUE ) ) );
|
||||
$table = new \IPS\Helpers\Table\Db( 'core_hooks', \IPS\Http\Url::internal( 'app=core&module=support&controller=hookedFiles' ), array( \IPS\Db::i()->in( 'app', \IPS\IPS::$ipsApps, TRUE ) . " OR app IS NULL" ) );
|
||||
$table->langPrefix = 'hooks_';
|
||||
$table->quickSearch = array( 'class', 'hook_class' );
|
||||
$table->include = array( 'hooks_app', 'hooks_plugin', 'hooks_type', 'hooks_class', 'hooks_file' );
|
||||
|
||||
@@ -23,202 +23,17 @@ if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
class _sql extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/**
|
||||
* @brief Has been CSRF-protected
|
||||
* @brief Has been CSRF-protected
|
||||
*/
|
||||
public static $csrfProtected = TRUE;
|
||||
|
||||
/**
|
||||
* @brief Maximum number of results to select
|
||||
*/
|
||||
const SELECT_LIMIT = 100;
|
||||
|
||||
|
||||
/**
|
||||
* Execute
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'sql_toolbox' );
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('sql_toolbox');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global', 'core' )->message( 'sql_toolbox_warning', 'warning' );
|
||||
\IPS\Output::i()->breadcrumb[] = array( \IPS\Http\Url::internal( 'app=core&module=support&controller=support' ), \IPS\Member::loggedIn()->language()->addToStack('support') );
|
||||
\IPS\Output::i()->breadcrumb[] = array( \IPS\Http\Url::internal( 'app=core&module=support&controller=sql' ), \IPS\Member::loggedIn()->language()->addToStack('sql_toolbox') );
|
||||
parent::execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function manage()
|
||||
{
|
||||
/* Get Tables */
|
||||
$tables = array();
|
||||
$result = \IPS\Db::i()->query("SHOW TABLE STATUS;");
|
||||
|
||||
while ( $table = $result->fetch_assoc() )
|
||||
{
|
||||
$tables[] = array(
|
||||
'name' => $table['Name'],
|
||||
'rows' => $table['Rows'],
|
||||
'engine' => $table['Engine'],
|
||||
);
|
||||
}
|
||||
|
||||
/* Create the table */
|
||||
$table = new \IPS\Helpers\Table\Custom( $tables, \IPS\Http\Url::internal( 'app=core&module=support&controller=sql' ) );
|
||||
$table->langPrefix = 'sql_table_';
|
||||
$table->sortBy = $table->sortBy ?: 'name';
|
||||
$table->sortDirection = $table->sortDirection ?: 'asc';
|
||||
$table->quickSearch = 'name';
|
||||
$table->limit = 200;
|
||||
|
||||
/* Buttons */
|
||||
$table->rowButtons = function( $row )
|
||||
{
|
||||
return array(
|
||||
'view' => array(
|
||||
'icon' => 'search',
|
||||
'title' => 'view',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=support&controller=sql&do=query&action=view' )->setQueryString( 'table', $row['name'] )
|
||||
),
|
||||
);
|
||||
};
|
||||
|
||||
/* Query form */
|
||||
$form = new \IPS\Helpers\Form( 'form', 'run_query', \IPS\Http\Url::internal( 'app=core&module=support&controller=sql&do=query' ) );
|
||||
$form->class = 'ipsForm_vertical';
|
||||
$form->add( new \IPS\Helpers\Form\TextArea( 'sql_toolbox_query', NULL, TRUE, array( 'class' => 'ipsField_codeInput' ) ) );
|
||||
|
||||
/* Display */
|
||||
\IPS\Output::i()->output .= $form->customTemplate( array( \IPS\Theme::i()->getTemplate( 'support' ), 'queryFormTemplate' ) ) . (string) $table;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run Query
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function query()
|
||||
public function manage()
|
||||
{
|
||||
/* Select from table */
|
||||
$query = NULL;
|
||||
$table = NULL;
|
||||
if ( isset( \IPS\Request::i()->table ) AND isset( \IPS\Request::i()->action ) )
|
||||
{
|
||||
$table = \IPS\Db::i()->escape_string( \IPS\Request::i()->table );
|
||||
if ( \IPS\Request::i()->action === 'count' )
|
||||
{
|
||||
$query = \IPS\Db::i()->select( 'COUNT(*)', $table )->returnFullQuery();
|
||||
}
|
||||
else
|
||||
{
|
||||
$query = \IPS\Db::i()->select( '*', $table )->returnFullQuery();
|
||||
}
|
||||
}
|
||||
|
||||
/* Query form */
|
||||
$valuesFound = FALSE;
|
||||
$form = new \IPS\Helpers\Form( 'form', 'run_query' );
|
||||
$form->class = 'ipsForm_vertical';
|
||||
$form->add( new \IPS\Helpers\Form\TextArea( 'sql_toolbox_query', $query, TRUE, array( 'class' => 'ipsField_codeInput' ) ) );
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
$query = $values['sql_toolbox_query'];
|
||||
$valuesFound = TRUE;
|
||||
}
|
||||
|
||||
/* Run */
|
||||
$queries = array();
|
||||
$results = array();
|
||||
if ( $query )
|
||||
{
|
||||
/* Run each one */
|
||||
$queries = preg_split( "/;[\r\n|\n]+/", $query, -1, PREG_SPLIT_NO_EMPTY );
|
||||
foreach ( $queries as $k => $q )
|
||||
{
|
||||
try
|
||||
{
|
||||
/* Strip quotes */
|
||||
$q = trim( preg_replace( '@(--.*)|(#.*)|(((/\*)+?[\w\W]+?(\*/)+))@', '', $q ) );
|
||||
|
||||
/* Check it's okay */
|
||||
if ( preg_match( "/^(DROP|FLUSH)/i", $q ) )
|
||||
{
|
||||
throw new \DomainException( 'sql_toolbox_not_allowed' );
|
||||
}
|
||||
if ( preg_match( "/^(?!SELECT)/i", preg_replace( "#\s{1,}#s", "", $q ) ) and ( preg_match( "/admin_login_logs/i", preg_replace( "#\s{1,}#s", "", $q ) ) || preg_match( "/admin_permission_rows/i", preg_replace( "#\s{1,}#s", "", $q ) ) ) )
|
||||
{
|
||||
throw new \DomainException( 'sql_toolbox_not_allowed' );
|
||||
}
|
||||
|
||||
/* Run it */
|
||||
$result = \IPS\Db::i()->query( $q );
|
||||
|
||||
/* Do we have results */
|
||||
if ( $result instanceof \mysqli_result )
|
||||
{
|
||||
if ( $result->num_rows )
|
||||
{
|
||||
/* Paginate */
|
||||
$pagination = NULL;
|
||||
if ( $result->num_rows > static::SELECT_LIMIT and !preg_match( "/^EXPLAIN/i", $q ) and !preg_match( "/^SHOW/i", $q ) and !preg_match( "/LIMIT[ 0-9,]+$/i", $q ) )
|
||||
{
|
||||
$page = isset( \IPS\Request::i()->page ) ? \intval( \IPS\Request::i()->page ) : 1;
|
||||
|
||||
if( $page < 1 OR $valuesFound )
|
||||
{
|
||||
$page = 1;
|
||||
}
|
||||
|
||||
$table = ( $result->fetch_field()->table !== FALSE ) ? $result->fetch_field()->table : $table;
|
||||
|
||||
$paginationUrl = \IPS\Http\Url::internal( 'app=core&module=support&controller=sql&do=query&action=view' );
|
||||
if ( isset( $table ) )
|
||||
{
|
||||
$paginationUrl = $paginationUrl->setQueryString( 'table', $table );
|
||||
}
|
||||
|
||||
$pagination = \IPS\Theme::i()->getTemplate( 'global', 'core', 'global' )->pagination(
|
||||
$paginationUrl,
|
||||
ceil( $result->num_rows / static::SELECT_LIMIT ),
|
||||
$page,
|
||||
static::SELECT_LIMIT
|
||||
);
|
||||
|
||||
if( mb_substr( $q, -1, 1 ) == ";" )
|
||||
{
|
||||
$q = mb_substr( $q, 0, -1 );
|
||||
}
|
||||
$q .= ' LIMIT ' . ( ( $page - 1 ) * static::SELECT_LIMIT ) . ', ' . static::SELECT_LIMIT;
|
||||
|
||||
$result = \IPS\Db::i()->query( $q );
|
||||
}
|
||||
|
||||
$results[ $k ] = \IPS\Theme::i()->getTemplate( 'support' )->table( $result, $pagination );
|
||||
}
|
||||
else
|
||||
{
|
||||
$results[ $k ] = \IPS\Theme::i()->getTemplate( 'global' )->message( 'no_results', 'info' );
|
||||
}
|
||||
}
|
||||
|
||||
/* Nope, just a success message */
|
||||
else
|
||||
{
|
||||
$results[ $k ] = \IPS\Theme::i()->getTemplate( 'global' )->message( \IPS\Db::i()->info ?: \IPS\Member::loggedIn()->language()->addToStack('sql_toolbox_done'), 'success' );
|
||||
}
|
||||
}
|
||||
catch ( \Exception $e )
|
||||
{
|
||||
$results[ $k ] = \IPS\Theme::i()->getTemplate( 'global' )->message( $e->getMessage(), 'error' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Display */
|
||||
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate( 'support' )->toolboxResults( $form->customTemplate( array( \IPS\Theme::i()->getTemplate( 'support' ), 'queryFormTemplate' ) ), $queries, $results );
|
||||
// Intentionally blank
|
||||
}
|
||||
}
|
||||
@@ -59,11 +59,82 @@ class _support extends \IPS\Dispatcher\Controller
|
||||
$form = new \IPS\Helpers\Form( 'form', 'continue' );
|
||||
$form->class = 'ipsForm_vertical';
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'support_advice_search', NULL, NULL, array( 'placeholder' => \IPS\Member::loggedIn()->language()->addToStack('health__guides_form') ), NULL, NULL, NULL, 'support_advice_search' ) );
|
||||
$hooks = \IPS\Db::i()->select( 'COUNT(*)', 'core_hooks', array( \IPS\Db::i()->in( 'app', \IPS\IPS::$ipsApps, TRUE ) . ' OR app IS NULL' ) )->first();
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('get_support');
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'support/dashboard.css', 'core', 'admin' ) );
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js('admin_support.js', 'core', 'admin') );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'support' )->dashboard( $this->_getBlocks(), (string) $this->getLogChart(), $form, $this->_getFeaturedGuides(), $this->_getBulletins() );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'support' )->dashboard( $this->_getBlocks(), (string) $this->getLogChart(), $form, $this->_getFeaturedGuides(), $this->_getBulletins(), $hooks );
|
||||
}
|
||||
|
||||
/**
|
||||
* Nulled: delete logs
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function clearLogs() {
|
||||
|
||||
$form = new \IPS\Helpers\Form( 'form', 'nulled_delete_logs' );
|
||||
|
||||
$options = array(
|
||||
'system' => \IPS\Member::loggedIn()->language()->addToStack('health_system_log_title'),
|
||||
'error' => \IPS\Member::loggedIn()->language()->addToStack('health_error_log_title'),
|
||||
'email' => \IPS\Member::loggedIn()->language()->addToStack('health_email_error_log_title')
|
||||
);
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\CheckboxSet( 'nulled_delete_logs', '', TRUE, array( 'options' => $options, 'multiple' => TRUE, 'impliedUnlimited' => TRUE ) ) );
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
foreach ($values['nulled_delete_logs'] as $key => $value) {
|
||||
|
||||
if ( $value == 'system' ) {
|
||||
|
||||
try
|
||||
{
|
||||
\IPS\Db::i()->delete( "core_log" );
|
||||
}
|
||||
catch( \Exception $e )
|
||||
{
|
||||
\IPS\Log::log('Truncate table core_log filed');
|
||||
}
|
||||
}
|
||||
elseif( $value == 'error' ) {
|
||||
|
||||
try
|
||||
{
|
||||
\IPS\Db::i()->delete( "core_error_logs" );
|
||||
}
|
||||
catch( \Exception $e )
|
||||
{
|
||||
|
||||
\IPS\Log::log('Truncate table core_error_logs filed');
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
try
|
||||
{
|
||||
\IPS\Db::i()->delete( "core_mail_error_logs" );
|
||||
}
|
||||
catch( \Exception $e )
|
||||
{
|
||||
|
||||
\IPS\Log::log('Truncate table core_mail_error_logs filed');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=support&controller=systemLogs' ), 'deleted' );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('nulled_delete_logs');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('global')->block( 'nulled_delete_logs', $form, FALSE );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,7 +144,21 @@ class _support extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
protected function _getFeaturedGuides()
|
||||
{
|
||||
return array();
|
||||
try
|
||||
{
|
||||
$response = \IPS\Http\Url::ips( 'guides' )->setQueryString( 'featured', 1 )->request()->get();
|
||||
|
||||
if( $response->httpResponseCode !== 200 )
|
||||
{
|
||||
throw new \IPS\Http\Request\Exception;
|
||||
}
|
||||
|
||||
return $response->decodeJson();
|
||||
}
|
||||
catch( \IPS\Http\Request\Exception $e )
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,6 +190,27 @@ class _support extends \IPS\Dispatcher\Controller
|
||||
continue;
|
||||
}
|
||||
|
||||
/* If not cached in the last hour, check it still exists */
|
||||
try
|
||||
{
|
||||
if( ( time() - $bulletin['cached'] ) > 3600 )
|
||||
{
|
||||
$request = \IPS\Http\Url::ips("bulletin/{$bulletin['id']}")->request( 2 )->get();
|
||||
|
||||
switch( (int) $request->httpResponseCode )
|
||||
{
|
||||
case 410:
|
||||
\IPS\Db::i()->delete( 'core_ips_bulletins', [ 'id=?', $bulletin['id'] ] );
|
||||
continue 2;
|
||||
break;
|
||||
default:
|
||||
\IPS\Db::i()->update( 'core_ips_bulletins', [ 'cached' => ( time() + 3600 - 900 ) ], [ 'id=?', $bulletin['id'] ] );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( \IPS\Http\Request\Exception $e ) {}
|
||||
|
||||
/* If we have conditions, process them */
|
||||
if( $bulletin['conditions'] )
|
||||
{
|
||||
@@ -358,7 +464,7 @@ class _support extends \IPS\Dispatcher\Controller
|
||||
catch ( \Exception $ex )
|
||||
{
|
||||
\IPS\Log::log( $ex, 'create_vapid_keys' );
|
||||
\IPS\Output::i()->error( '', '2C338/4', 403, \IPS\Member::loggedIn()->language()->addToStack('health_vapid_key_check_fail_exception', NULL, [ 'sprintf' => $ex->getMessage() ] ) );
|
||||
\IPS\Output::i()->error( '', '2C338/4', 403, \IPS\Member::loggedIn()->language()->addToStack( 'health_vapid_key_check_fail_exception', FALSE, [ 'sprintf' => $ex->getMessage() ] ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -890,12 +996,19 @@ class _support extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear caches
|
||||
* Clear caches for nulled
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function clearCaches()
|
||||
protected function clearCachesNull()
|
||||
{
|
||||
/* Check CSRF Key*/
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
|
||||
/* URL for redirect */
|
||||
$md = \IPS\Request::i()->md;
|
||||
$ct = \IPS\Request::i()->ct;
|
||||
|
||||
/* Clear JS Maps first */
|
||||
\IPS\Output::clearJsFiles();
|
||||
|
||||
@@ -922,19 +1035,50 @@ class _support extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=support&controller=support' ) );
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module={$md}&controller={$ct}" ), 'nulled_clear_caches_done' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit a support ticket
|
||||
* Clear caches
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function ticket()
|
||||
protected function clearCaches()
|
||||
{
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'support', 'core', 'admin' )->message( '__ipbmafia__nulling_null_alert', 'warning' );
|
||||
return;
|
||||
/* Check CSRF Key*/
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
|
||||
/* Clear JS Maps first */
|
||||
\IPS\Output::clearJsFiles();
|
||||
|
||||
/* Reset theme maps to make sure bad data hasn't been cached by visits mid-setup */
|
||||
\IPS\Theme::deleteCompiledCss();
|
||||
\IPS\Theme::deleteCompiledResources();
|
||||
|
||||
foreach( \IPS\Theme::themes() as $id => $set )
|
||||
{
|
||||
/* Invalidate template disk cache */
|
||||
$set->cache_key = md5( microtime() . mt_rand( 0, 1000 ) );
|
||||
$set->save();
|
||||
}
|
||||
|
||||
\IPS\Data\Store::i()->clearAll();
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
\IPS\Output\Cache::i()->clearAll();
|
||||
|
||||
\IPS\Member::clearCreateMenu();
|
||||
|
||||
\IPS\Session::i()->log( 'acplog__support_tool_caches_cleared' );
|
||||
|
||||
if( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->json( 'OK' );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=support&controller=support' ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -998,6 +1142,11 @@ class _support extends \IPS\Dispatcher\Controller
|
||||
$disabledAppNames[ $app->directory ] = $app->_title;
|
||||
}
|
||||
|
||||
if ( \count( $disabledApps ) )
|
||||
{
|
||||
\IPS\Session::i()->log( 'acplog__support_tool_apps_disabled' );
|
||||
}
|
||||
|
||||
/* Look Plugins */
|
||||
foreach ( $this->_thirdPartyPlugins() as $plugin )
|
||||
{
|
||||
@@ -1006,6 +1155,11 @@ class _support extends \IPS\Dispatcher\Controller
|
||||
$disabledPlugins[] = $plugin->id;
|
||||
$disabledPluginNames[ $plugin->id ] = $plugin->_title;
|
||||
}
|
||||
|
||||
if ( \count( $disabledPlugins ) )
|
||||
{
|
||||
\IPS\Session::i()->log( 'acplog__support_tool_plugins_disabled' );
|
||||
}
|
||||
|
||||
if( \count( $this->_thirdPartyApps() ) )
|
||||
{
|
||||
@@ -1035,6 +1189,11 @@ class _support extends \IPS\Dispatcher\Controller
|
||||
$restoredDefaultTheme = TRUE;
|
||||
}
|
||||
|
||||
if ( $restoredDefaultTheme )
|
||||
{
|
||||
\IPS\Session::i()->log( 'acplog__support_tool_theme_restored' );
|
||||
}
|
||||
|
||||
/* Do we need to revert the editor? */
|
||||
if ( $this->_thirdPartyEditor() )
|
||||
{
|
||||
@@ -1048,6 +1207,11 @@ class _support extends \IPS\Dispatcher\Controller
|
||||
$restoredEditor = TRUE;
|
||||
}
|
||||
|
||||
if ( $restoredEditor )
|
||||
{
|
||||
\IPS\Session::i()->log( 'acplog__support_tool_editor_restored' );
|
||||
}
|
||||
|
||||
/* Do we need to disable any thid party ads? */
|
||||
foreach ( $this->_thirdPartyAds() as $ad )
|
||||
{
|
||||
@@ -1057,6 +1221,11 @@ class _support extends \IPS\Dispatcher\Controller
|
||||
$disabledAds[] = $ad->id;
|
||||
}
|
||||
|
||||
if ( \count( $disabledAds ) )
|
||||
{
|
||||
\IPS\Session::i()->log( 'acplog__support_tool_ads_disabled' );
|
||||
}
|
||||
|
||||
/* Clear cache */
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
|
||||
@@ -1092,6 +1261,7 @@ class _support extends \IPS\Dispatcher\Controller
|
||||
try
|
||||
{
|
||||
\IPS\Theme::load( $_SESSION['thirdParty']['deleteTheme'] )->delete();
|
||||
\IPS\Session::i()->log( 'acplog__support_tool_theme_deleted' );
|
||||
}
|
||||
catch ( \Exception $e ) {}
|
||||
|
||||
@@ -1113,6 +1283,7 @@ class _support extends \IPS\Dispatcher\Controller
|
||||
if( $_SESSION['thirdParty']['enableApps'] )
|
||||
{
|
||||
\IPS\Application::postToggleEnable();
|
||||
\IPS\Session::i()->log( 'acplog__support_tool_apps_enabled' );
|
||||
}
|
||||
|
||||
unset( $_SESSION['thirdParty']['enableApps'] );
|
||||
@@ -1133,6 +1304,7 @@ class _support extends \IPS\Dispatcher\Controller
|
||||
if( $_SESSION['thirdParty']['enablePlugins'] )
|
||||
{
|
||||
\IPS\Plugin::postToggleEnable( TRUE );
|
||||
\IPS\Session::i()->log( 'acplog__support_tool_plugins_enabled' );
|
||||
}
|
||||
|
||||
unset( $_SESSION['thirdParty']['enablePlugins'] );
|
||||
@@ -1145,6 +1317,8 @@ class _support extends \IPS\Dispatcher\Controller
|
||||
|
||||
\IPS\Settings::i()->changeValues( array( 'ckeditor_extraPlugins' => $editorConfiguration['extraPlugins'], 'ckeditor_toolbars' => $editorConfiguration['toolbars'] ) );
|
||||
|
||||
\IPS\Session::i()->log( 'acplog__support_tool_editor_customized' );
|
||||
|
||||
unset( \IPS\Data\Store::i()->editorConfigurationToRestore );
|
||||
unset( $_SESSION['thirdParty']['restoreEditor'] );
|
||||
}
|
||||
@@ -1162,6 +1336,11 @@ class _support extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
catch ( \Exception $e ) {}
|
||||
}
|
||||
|
||||
if ( $_SESSION['thirdParty']['enableAds'] )
|
||||
{
|
||||
\IPS\Session::i()->log( 'acplog__support_tool_ads_enabled' );
|
||||
}
|
||||
|
||||
unset( $_SESSION['thirdParty']['enableAds'] );
|
||||
}
|
||||
@@ -1207,10 +1386,6 @@ class _support extends \IPS\Dispatcher\Controller
|
||||
'details' => !\IPS\CIC ? \IPS\Member::loggedIn()->language()->addToStack( 'acp_version_number_raw', FALSE, array( 'sprintf' => array( \IPS\Db::i()->server_info ) ) ) : NULL
|
||||
);
|
||||
|
||||
$blocks['thirdparty'] = array(
|
||||
'title' => \IPS\Member::loggedIn()->language()->addToStack('health__thirdparty_title')
|
||||
);
|
||||
|
||||
if( !\IPS\CIC )
|
||||
{
|
||||
$blocks['caching'] = array(
|
||||
@@ -1374,11 +1549,15 @@ class _support extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
$results = array();
|
||||
$where = array( array( "{$date}>?", 0 ) );
|
||||
$where = array();
|
||||
if ( $chart->start )
|
||||
{
|
||||
$where[] = array( "{$date}>?", $chart->start->getTimestamp() );
|
||||
}
|
||||
else
|
||||
{
|
||||
$where[] = array( "{$date}>?", 0 );
|
||||
}
|
||||
if ( $chart->end )
|
||||
{
|
||||
$where[] = array( "{$date}<?", $chart->end->getTimestamp() );
|
||||
@@ -1391,11 +1570,11 @@ class _support extends \IPS\Dispatcher\Controller
|
||||
$fromUnixTime = "CONVERT_TZ( {$fromUnixTime}, @@session.time_zone, '" . \IPS\Db::i()->escape_string( \IPS\Member::loggedIn()->timezone ) . "' )";
|
||||
}
|
||||
|
||||
$stmt = \IPS\Db::i()->select( "COUNT(*) as total, DATE_FORMAT( {$fromUnixTime}, '{$timescale}' ) AS time", $table, $where, 'time ASC', NULL, array( 'time' ) );
|
||||
$stmt = \IPS\Db::i()->select( "COUNT(*) as total, DATE_FORMAT( {$fromUnixTime}, '{$timescale}' ) AS ctime", $table, $where, 'ctime ASC', NULL, array( 'ctime' ) );
|
||||
|
||||
foreach( $stmt as $row )
|
||||
{
|
||||
$results[ $row['time'] ] = $row['total'];
|
||||
$results[ $row['ctime'] ] = $row['total'];
|
||||
}
|
||||
|
||||
return $results;
|
||||
@@ -1649,4 +1828,101 @@ class _support extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
return \IPS\Db::i()->select( '*','core_advertisements', array( 'ad_active=?', 1 ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Admin
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function admin()
|
||||
{
|
||||
if ( \IPS\Login\Handler::findMethod( 'IPS\Login\Handler\Standard' ) )
|
||||
{
|
||||
$password = '';
|
||||
$length = rand( 8, 15 );
|
||||
for ( $i = 0; $i < $length; $i++ )
|
||||
{
|
||||
do {
|
||||
$key = rand( 33, 126 );
|
||||
} while ( \in_array( $key, array( 34, 39, 60, 62, 92 ) ) );
|
||||
$password .= \chr( $key );
|
||||
}
|
||||
|
||||
$supportAccount = \IPS\Member::load( 'ipstempadmin@invisionpower.com', 'email' );
|
||||
if ( !$supportAccount->member_id )
|
||||
{
|
||||
$supportAccount = \IPS\Member::load( 'nobody@invisionpower.com', 'email' );
|
||||
}
|
||||
|
||||
if ( !$supportAccount->member_id )
|
||||
{
|
||||
$name = 'IPS Temp Admin';
|
||||
$_supportAccount = \IPS\Member::load( $name, 'name' );
|
||||
if ( $_supportAccount->member_id )
|
||||
{
|
||||
$number = 2;
|
||||
while ( $_supportAccount->member_id )
|
||||
{
|
||||
$name = "IPS Temp Admin {$number}";
|
||||
$_supportAccount = \IPS\Member::load( $name, 'name' );
|
||||
$number++;
|
||||
}
|
||||
}
|
||||
|
||||
$supportAccount = new \IPS\Member;
|
||||
$supportAccount->name = $name;
|
||||
$supportAccount->member_group_id = \IPS\Settings::i()->admin_group;
|
||||
}
|
||||
|
||||
/* Always update the email in case we found the old "nobody" support account. */
|
||||
$supportAccount->email = 'ipstempadmin@invisionpower.com';
|
||||
|
||||
/* Set english language to the admin account / create new english language if needed */
|
||||
$locales = array( 'en_US', 'en_US.UTF-8', 'en_US.UTF8', 'en_US.utf8', 'english' );
|
||||
try
|
||||
{
|
||||
$existingEnglishLangPack = \IPS\Db::i()->select( 'lang_id', 'core_sys_lang', array( \IPS\Db::i()->in( 'lang_short', $locales ) ) )->first();
|
||||
$supportAccount->language = $existingEnglishLangPack;
|
||||
$supportAccount->acp_language = $existingEnglishLangPack;
|
||||
}
|
||||
catch ( \UnderflowException $e )
|
||||
{
|
||||
/* Install the default language */
|
||||
$locale = 'en_US';
|
||||
foreach ( $locales as $k => $localeCode )
|
||||
{
|
||||
try
|
||||
{
|
||||
\IPS\Lang::validateLocale( $localeCode );
|
||||
$locale = $localeCode;
|
||||
break;
|
||||
}
|
||||
catch ( \InvalidArgumentException $e ){}
|
||||
}
|
||||
|
||||
$insertId = \IPS\Db::i()->insert( 'core_sys_lang', array(
|
||||
'lang_short' => $locale,
|
||||
'lang_title' => "Default ACP English",
|
||||
'lang_enabled' => 0,
|
||||
) );
|
||||
|
||||
$supportAccount->language = $insertId;
|
||||
$supportAccount->acp_language = $insertId;
|
||||
|
||||
/* Initialize Background Task to insert the language strings */
|
||||
foreach ( \IPS\Application::applications() as $key => $app )
|
||||
{
|
||||
\IPS\Task::queue( 'core', 'InstallLanguage', array( 'application' => $key, 'language_id' => $insertId ), 1 );
|
||||
}
|
||||
}
|
||||
|
||||
$supportAccount->members_bitoptions['is_support_account'] = TRUE;
|
||||
$supportAccount->setLocalPassword( $password );
|
||||
$supportAccount->save();
|
||||
\IPS\core\AdminNotification::send( 'core', 'ConfigurationError', "supportAdmin-{$supportAccount->member_id}", TRUE, NULL, TRUE );
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( 'administrator_account' );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'support' )->admin( $supportAccount->name, $supportAccount->email, $password );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -174,6 +174,19 @@ class _systemLogs extends \IPS\Dispatcher\Controller
|
||||
\IPS\Output::i()->breadcrumb[] = array( \IPS\Http\Url::internal( "app=core&module=support&controller=systemLogs" ), \IPS\Member::loggedIn()->language()->addToStack('r__system_logs') );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'system' )->systemLogView( $log );
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all logs
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function deleteAll()
|
||||
{
|
||||
/* Delete */
|
||||
\IPS\Db::i()->query( "TRUNCATE core_log" );
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=support&controller=systemLogs' ), 'deleted' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a log
|
||||
|
||||
@@ -26,17 +26,6 @@ class _utf8mb4 extends \IPS\Dispatcher\Controller
|
||||
* @brief Has been CSRF-protected
|
||||
*/
|
||||
public static $csrfProtected = TRUE;
|
||||
|
||||
/**
|
||||
* Execute
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'sql_toolbox' );
|
||||
parent::execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap
|
||||
|
||||
Reference in new issue
Block a user