Version 4.7.23
This commit is contained in:
1 parent
7124a02564
commit
25ddeb65d6
1791 files changed
+76990
-44452
No files matched your search
@@ -55,20 +55,25 @@ class _ranks extends \IPS\Node\Controller
|
||||
*/
|
||||
protected function manage()
|
||||
{
|
||||
static::$counts = [];
|
||||
$previousCount = NULL;
|
||||
|
||||
$allRanks = array_values( \IPS\core\Achievements\Rank::getStore() );
|
||||
$totalRanks = \count( $allRanks );
|
||||
for ( $i = 0; $i < $totalRanks; $i++ )
|
||||
/* If the members table is very large, this can take the whole thing down,
|
||||
so let's skip it. */
|
||||
if( !\IPS\Db::i()->recommendManualQuery( 'core_members' ) )
|
||||
{
|
||||
$where = [];
|
||||
$where[] = [ 'achievements_points>=' . \intval( $allRanks[ $i ]->points ) ];
|
||||
if ( isset( $allRanks[ $i + 1 ] ) )
|
||||
static::$counts = [];
|
||||
$previousCount = NULL;
|
||||
|
||||
$allRanks = array_values( \IPS\core\Achievements\Rank::getStore() );
|
||||
$totalRanks = \count( $allRanks );
|
||||
for ( $i = 0; $i < $totalRanks; $i++ )
|
||||
{
|
||||
$where[] = [ 'achievements_points<' . \intval( $allRanks[ $i + 1 ]->points ) ];
|
||||
$where = [];
|
||||
$where[] = [ 'achievements_points>=' . \intval( $allRanks[ $i ]->points ) ];
|
||||
if ( isset( $allRanks[ $i + 1 ] ) )
|
||||
{
|
||||
$where[] = [ 'achievements_points<' . \intval( $allRanks[ $i + 1 ]->points ) ];
|
||||
}
|
||||
static::$counts[ $allRanks[ $i ]->id ] = \IPS\Db::i()->select( 'COUNT(*)', 'core_members', $where )->first();
|
||||
}
|
||||
static::$counts[ $allRanks[ $i ]->id ] = \IPS\Db::i()->select( 'COUNT(*)', 'core_members', $where )->first();
|
||||
}
|
||||
|
||||
if( $data = \IPS\core\Achievements\Rule::getRebuildProgress() )
|
||||
@@ -215,6 +220,12 @@ class _ranks extends \IPS\Node\Controller
|
||||
*/
|
||||
public function _getRowHtml( $node )
|
||||
{
|
||||
/* If the counts are empty, then the table was too large, so ignore this. */
|
||||
if( empty( static::$counts ) )
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
$url = \IPS\Http\Url::internal("app=core&module=members&controller=members&advanced_search_submitted=1&members_achievements_points={$node->id}")->csrf();
|
||||
|
||||
return \IPS\Theme::i()->getTemplate('achievements')->memberCount( $url, static::$counts[ $node->id ] );
|
||||
|
||||
@@ -37,60 +37,68 @@ class _api extends \IPS\Dispatcher\Controller
|
||||
public function __call( $method, $args )
|
||||
{
|
||||
\IPS\Output::i()->responsive = FALSE;
|
||||
|
||||
/* Check htaccess is correct */
|
||||
if ( \IPS\Settings::i()->use_friendly_urls and \IPS\Settings::i()->htaccess_mod_rewrite OR \IPS\Request::i()->fromZapier )
|
||||
|
||||
/* We don't need to test Cloud */
|
||||
if( !\IPS\CIC )
|
||||
{
|
||||
$url = \IPS\Http\Url::external( rtrim( \IPS\Settings::i()->base_url, '/' ) . '/api/core/hello' );
|
||||
}
|
||||
else
|
||||
{
|
||||
$url = \IPS\Http\Url::external( rtrim( \IPS\Settings::i()->base_url, '/' ) . '/api/index.php?/core/hello' );
|
||||
}
|
||||
try
|
||||
{
|
||||
if ( \IPS\Request::i()->isCgi() )
|
||||
/* Check htaccess is correct */
|
||||
if ( \IPS\Settings::i()->use_friendly_urls and \IPS\Settings::i()->htaccess_mod_rewrite or \IPS\Request::i()->fromZapier )
|
||||
{
|
||||
$response = $url->setQueryString( 'key', 'test' )->request()->get();
|
||||
$url = \IPS\Http\Url::external( rtrim( \IPS\Settings::i()->base_url, '/' ) . '/api/core/hello' );
|
||||
}
|
||||
else
|
||||
{
|
||||
$response = $url->request()->login( 'test', '' )->get();
|
||||
$url = \IPS\Http\Url::external( rtrim( \IPS\Settings::i()->base_url, '/' ) . '/api/index.php?/core/hello' );
|
||||
}
|
||||
|
||||
$response = $response->decodeJson();
|
||||
|
||||
if( isset( $response['errorMessage'] ) )
|
||||
try
|
||||
{
|
||||
if ( $response['errorMessage'] === 'IP_ADDRESS_BANNED' )
|
||||
if ( \IPS\Request::i()->isCgi() )
|
||||
{
|
||||
\IPS\Output::i()->error( 'api_blocked_self', '3C402/1', 500, '' );
|
||||
$response = $url->setQueryString( 'key', 'test' )->request()->get();
|
||||
}
|
||||
else
|
||||
{
|
||||
$response = $url->request()->login( 'test', '' )->get();
|
||||
}
|
||||
|
||||
if ( $response['errorMessage'] !== 'INVALID_API_KEY' AND $response['errorMessage'] !== 'TOO_MANY_REQUESTS_WITH_BAD_KEY' )
|
||||
$response = $response->decodeJson();
|
||||
|
||||
if ( isset( $response['errorMessage'] ) )
|
||||
{
|
||||
/* Is it being blocked by a file? */
|
||||
if( @\file_exists( \IPS\ROOT_PATH . '/api/core' ) )
|
||||
if ( $response['errorMessage'] === 'IP_ADDRESS_BANNED' )
|
||||
{
|
||||
\IPS\Output::i()->error( \IPS\Member::loggedIn()->language()->addToStack( 'api_blocked_file', FALSE, array( 'sprintf' => array( \IPS\ROOT_PATH ) ) ), '3C402/2', 500, '' );
|
||||
\IPS\Output::i()->error( 'api_blocked_self', '3C402/1', 500, '' );
|
||||
}
|
||||
|
||||
/* Plain not working, so bubble up. */
|
||||
throw new \Exception($response['errorMessage']);
|
||||
if ( $response['errorMessage'] !== 'INVALID_API_KEY' and $response['errorMessage'] !== 'TOO_MANY_REQUESTS_WITH_BAD_KEY' )
|
||||
{
|
||||
/* Is it being blocked by a file? */
|
||||
if ( @\file_exists( \IPS\ROOT_PATH . '/api/core' ) )
|
||||
{
|
||||
\IPS\Output::i()->error( \IPS\Member::loggedIn()->language()->addToStack( 'api_blocked_file', FALSE, array( 'sprintf' => array( \IPS\ROOT_PATH ) ) ), '3C402/2', 500, '' );
|
||||
}
|
||||
|
||||
/* Plain not working, so bubble up. */
|
||||
throw new \Exception( $response['errorMessage'] );
|
||||
}
|
||||
}
|
||||
// Throw an exception if the response is null; This will be the case if the request was sent to api/core/hello but the htaccess file missing
|
||||
else
|
||||
{
|
||||
if ( $response === NULL )
|
||||
{
|
||||
throw new \Exception;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Throw an exception if the response is null; This will be the case if the request was sent to api/core/hello but the htaccess file missing
|
||||
else if ( $response === NULL )
|
||||
catch ( \Exception $e )
|
||||
{
|
||||
throw new \Exception;
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( 'menu__core_applications_api' );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'api' )->htaccess( isset( \IPS\Request::i()->recheck ), $url, $e->getMessage() );
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch ( \Exception $e )
|
||||
{
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__core_applications_api');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'api' )->htaccess( isset( \IPS\Request::i()->recheck ), $url, $e->getMessage() );
|
||||
return;
|
||||
}
|
||||
|
||||
/* Work out tabs */
|
||||
$tabs = array();
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
|
||||
namespace IPS\core\modules\admin\applications;
|
||||
|
||||
use IPS\Application;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
@@ -121,7 +123,20 @@ class _apiLogs extends \IPS\Dispatcher\Controller
|
||||
'endpoint' => array( \IPS\Helpers\Table\SEARCH_SELECT, array( 'options' => $endpoints ), function( $val )
|
||||
{
|
||||
$exploded = explode( ' ', $val );
|
||||
return array( 'method=? AND endpoint=?', $exploded[0], trim( $exploded[1], '/' ) );
|
||||
$endpoint = array();
|
||||
foreach( explode( '/', $exploded[1] ) AS $piece )
|
||||
{
|
||||
if ( str_starts_with( $piece, '{' ) )
|
||||
{
|
||||
$endpoint[] = '([a-zA-Z0-9-_]+)';
|
||||
}
|
||||
else
|
||||
{
|
||||
$endpoint[] = $piece;
|
||||
}
|
||||
}
|
||||
|
||||
return array( 'method=? AND endpoint REGEXP ?', $exploded[0], trim( implode( '/', $endpoint ), '/' ) . '$' );
|
||||
} ),
|
||||
'api_key' => array( \IPS\Helpers\Table\SEARCH_NODE, array( 'class' => 'IPS\Api\Key' ) ),
|
||||
'ip_address' => \IPS\Helpers\Table\SEARCH_CONTAINS_TEXT,
|
||||
@@ -156,7 +171,16 @@ class _apiLogs extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'applications', 'api_logs_settings' ) )
|
||||
{
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'forms' )->blurb( \IPS\Member::loggedIn()->language()->addToStack( 'api_log_blurb_change', FALSE, array( 'sprintf' => array( \IPS\Settings::i()->api_log_prune ) ) ), TRUE, TRUE ) . $table;
|
||||
if ( Application::appIsEnabled('cloud') )
|
||||
{
|
||||
$blurb = \IPS\Member::loggedIn()->language()->addTostack( 'api__log_blurb_change_cloud' );
|
||||
}
|
||||
else
|
||||
{
|
||||
$blurb = \IPS\Member::loggedIn()->language()->addToStack( 'api__log_blurb_change', options: [ 'sprintf' => [ \IPS\Settings::i()->api_log_prune ] ] );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'forms' )->blurb( $blurb, FALSE, TRUE ) . $table;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -223,18 +247,26 @@ class _apiLogs extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
protected function settings()
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'api_logs_settings' );
|
||||
|
||||
$form = new \IPS\Helpers\Form;
|
||||
$form->add( new \IPS\Helpers\Form\Interval( 'api_log_prune', \IPS\Settings::i()->api_log_prune, FALSE, array( 'valueAs' => \IPS\Helpers\Form\Interval::DAYS ), NULL, \IPS\Member::loggedIn()->language()->addToStack('after'), NULL ) );
|
||||
|
||||
if ( $values = $form->values() )
|
||||
if ( ! Application::appIsEnabled('cloud') )
|
||||
{
|
||||
$form->saveAsSettings();
|
||||
\IPS\Session::i()->log( 'acplogs__api_log_settings' );
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal('app=core&module=applications&controller=api&tab=apiLogs') );
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'api_logs_settings' );
|
||||
|
||||
$form = new \IPS\Helpers\Form;
|
||||
$form->add( new \IPS\Helpers\Form\Interval( 'api_log_prune', \IPS\Settings::i()->api_log_prune, FALSE, array( 'valueAs' => \IPS\Helpers\Form\Interval::DAYS ), NULL, \IPS\Member::loggedIn()->language()->addToStack('after'), NULL ) );
|
||||
$form->add( new \IPS\Helpers\Form\Interval( 'api_log_prune_failures', \IPS\Settings::i()->api_log_prune_failures, FALSE, array( 'valueAs' => \IPS\Helpers\Form\Interval::DAYS ), NULL, \IPS\Member::loggedIn()->language()->addToStack('after'), NULL ) );
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
$form->saveAsSettings();
|
||||
\IPS\Session::i()->log( 'acplogs__api_log_settings' );
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal('app=core&module=applications&controller=api&tab=apiLogs') );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->output = $form;
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->error( 'api__log_no_cloud', '2C293/3', 403 );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->output = $form;
|
||||
}
|
||||
}
|
||||
@@ -60,15 +60,6 @@ class _applications extends \IPS\Node\Controller
|
||||
{
|
||||
if( \IPS\IPS::canManageResources() )
|
||||
{
|
||||
foreach( \IPS\Application::applications() as $app )
|
||||
{
|
||||
if( $app->marketplace_id )
|
||||
{
|
||||
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate('marketplace')->removalBanner(FALSE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate('forms')->blurb( 'applications_blurb' );
|
||||
}
|
||||
else
|
||||
@@ -685,10 +676,11 @@ class _applications extends \IPS\Node\Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Export an application from ipbmafia.ru
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function customDownload()
|
||||
public function downloadMafia()
|
||||
{
|
||||
$application = \IPS\Application::load( \IPS\Request::i()->appKey );
|
||||
|
||||
@@ -802,10 +794,6 @@ class _applications extends \IPS\Node\Controller
|
||||
unset( \IPS\Data\Store::i()->syncCompleted );
|
||||
|
||||
$url = \IPS\Http\Url::internal( "app=core&module=applications&controller=applications&do=upgrade&appKey=" . \IPS\Request::i()->appKey )->csrf();
|
||||
if ( isset( \IPS\Request::i()->marketplace ) )
|
||||
{
|
||||
$url = $url->setQueryString( 'marketplace', \IPS\Request::i()->marketplace );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->output = new \IPS\Helpers\MultipleRedirect(
|
||||
$url,
|
||||
@@ -1050,7 +1038,6 @@ class _applications extends \IPS\Node\Controller
|
||||
/* Return null to indicate we are done */
|
||||
if( $laststep === NULL )
|
||||
{
|
||||
\IPS\Application::load( $data['key'] )->marketplace_id = \IPS\Request::i()->marketplace ? (int) \IPS\Request::i()->marketplace : NULL;
|
||||
\IPS\Application::load( $data['key'] )->save();
|
||||
|
||||
\IPS\Session::i()->log( 'acplog__application_updated', array( \IPS\Application::load( $data['key'] )->titleForLog() => FALSE, \IPS\Application::load( $data['key'] )->version => TRUE ) );
|
||||
@@ -1081,22 +1068,11 @@ class _applications extends \IPS\Node\Controller
|
||||
/* If CMS Template install had conflicts, solve those now */
|
||||
if( !empty( $_SESSION['cmsConflictKey'] ) )
|
||||
{
|
||||
if( $application->marketplace_id )
|
||||
{
|
||||
$_SESSION['cmsConflictKey'] = $_SESSION['cmsConflictKey']->setQueryString( 'marketplace', $application->marketplace_id );
|
||||
}
|
||||
\IPS\Output::i()->redirect( $_SESSION['cmsConflictKey'] );
|
||||
}
|
||||
|
||||
/* And redirect back to the overview screen (or marketplace if it was installed from there) */
|
||||
if( $application->marketplace_id )
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=marketplace&controller=marketplace&do=viewFile&id=' . $application->marketplace_id ), 'application_now_updated' );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=applications&controller=applications' ), 'application_now_updated' );
|
||||
}
|
||||
/* And redirect back to the overview screen */
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=applications&controller=applications' ), 'application_now_updated' );
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -1116,10 +1092,6 @@ class _applications extends \IPS\Node\Controller
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('installing_application');
|
||||
|
||||
$url = \IPS\Http\Url::internal( "app=core&module=applications&controller=applications&do=install&appKey=" . \IPS\Request::i()->appKey )->csrf();
|
||||
if ( isset( \IPS\Request::i()->marketplace ) )
|
||||
{
|
||||
$url = $url->setQueryString( 'marketplace', \IPS\Request::i()->marketplace );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->output = new \IPS\Helpers\MultipleRedirect(
|
||||
$url,
|
||||
@@ -1307,7 +1279,6 @@ class _applications extends \IPS\Node\Controller
|
||||
/* Return null to indicate we are done */
|
||||
if( $laststep === NULL )
|
||||
{
|
||||
\IPS\Application::load( $data['key'] )->marketplace_id = \IPS\Request::i()->marketplace ? (int) \IPS\Request::i()->marketplace : NULL;
|
||||
\IPS\Application::load( $data['key'] )->save();
|
||||
|
||||
\IPS\Session::i()->log( 'acplog__application_installed', array( "__app_" . $data['key'] => TRUE ) );
|
||||
@@ -1341,22 +1312,11 @@ class _applications extends \IPS\Node\Controller
|
||||
/* If CMS Template install had conflicts, solve those now */
|
||||
if( !empty( $_SESSION['cmsConflictKey'] ) )
|
||||
{
|
||||
if( $application->marketplace_id )
|
||||
{
|
||||
$_SESSION['cmsConflictKey'] = $_SESSION['cmsConflictKey']->setQueryString( 'marketplace', $application->marketplace_id );
|
||||
}
|
||||
\IPS\Output::i()->redirect( $_SESSION['cmsConflictKey'] );
|
||||
}
|
||||
|
||||
/* And redirect back to the overview screen (or marketplace if it was installed from there) */
|
||||
if( $application->marketplace_id )
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=marketplace&controller=marketplace&do=viewFile&id=' . $application->marketplace_id ), 'application_now_installed' );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=applications&controller=applications' ), 'application_now_installed' );
|
||||
}
|
||||
/* And redirect back to the overview screen */
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=applications&controller=applications' ), 'application_now_installed' );
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -1622,10 +1582,6 @@ class _applications extends \IPS\Node\Controller
|
||||
}
|
||||
|
||||
$form = new \IPS\Helpers\Form( 'form', 'install' );
|
||||
if( $_type == 'upgrade' AND $app->marketplace_id )
|
||||
{
|
||||
$form->addMessage( 'marketplace_resource_manual_upgrade', 'ipsMessage ipsMessage_info' );
|
||||
}
|
||||
$form->addMessage('applications_manual_install_warning');
|
||||
$form->add( new \IPS\Helpers\Form\Upload( 'application_file', NULL, TRUE, array( 'allowedFileTypes' => array( 'tar' ), 'temporary' => TRUE ) ) );
|
||||
|
||||
|
||||
@@ -74,15 +74,6 @@ class _plugins extends \IPS\Node\Controller
|
||||
|
||||
if ( !\IPS\Request::i()->isAjax() AND \IPS\IPS::canManageResources() )
|
||||
{
|
||||
foreach( \IPS\Plugin::plugins() as $app )
|
||||
{
|
||||
if( $app->marketplace_id )
|
||||
{
|
||||
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate('marketplace')->removalBanner(FALSE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate('forms')->blurb( 'plugins_blurb' );
|
||||
}
|
||||
|
||||
@@ -210,11 +201,6 @@ class _plugins extends \IPS\Node\Controller
|
||||
if ( isset( \IPS\Request::i()->id ) )
|
||||
{
|
||||
$form->hiddenValues['id'] = \IPS\Request::i()->id;
|
||||
|
||||
if( \IPS\Plugin::load( (int) \IPS\Request::i()->id,'plugin_id')->marketplace_id )
|
||||
{
|
||||
$form->addMessage( 'marketplace_resource_manual_upgrade', 'ipsMessage ipsMessage_info' );
|
||||
}
|
||||
}
|
||||
$form->addMessage('plugins_manual_install_warning');
|
||||
$form->add( new \IPS\Helpers\Form\Upload( 'plugin_upload', NULL, TRUE, array( 'allowedFileTypes' => array( 'xml' ), 'temporary' => TRUE ) ) );
|
||||
@@ -273,10 +259,6 @@ class _plugins extends \IPS\Node\Controller
|
||||
}
|
||||
|
||||
$url = \IPS\Http\Url::internal( 'app=core&module=applications&controller=plugins&do=doInstall' )->setQueryString( array( 'file' => \IPS\Request::i()->file, 'key' => \IPS\Request::i()->key, 'id' => \IPS\Request::i()->id ) )->csrf();
|
||||
if ( isset( \IPS\Request::i()->marketplace ) )
|
||||
{
|
||||
$url = $url->setQueryString( 'marketplace', \IPS\Request::i()->marketplace );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->output = new \IPS\Helpers\MultipleRedirect(
|
||||
$url,
|
||||
@@ -368,6 +350,7 @@ class _plugins extends \IPS\Node\Controller
|
||||
}
|
||||
}
|
||||
|
||||
// nulled by ipbmafia.ru
|
||||
\file_put_contents( \IPS\ROOT_PATH . "/plugins/{$plugin->location}/{$plugin->name}_{$plugin->version_human}.xml", \file_get_contents( \IPS\Request::i()->file ) );
|
||||
@chmod( \IPS\ROOT_PATH . "/plugins/{$plugin->location}/{$plugin->name}_{$plugin->version_human}.xml", \IPS\IPS_FILE_PERMISSION );
|
||||
|
||||
@@ -1187,9 +1170,6 @@ class _plugins extends \IPS\Node\Controller
|
||||
/* Log */
|
||||
\IPS\Session::i()->log( 'acplog__plugin_installed', array( $plugin->name => FALSE ) );
|
||||
|
||||
/* Set Marketplace ID. */
|
||||
$plugin->marketplace_id = \IPS\Request::i()->marketplace ? (int) \IPS\Request::i()->marketplace : NULL;
|
||||
|
||||
/* Re-enable the plugin */
|
||||
$plugin->enabled = TRUE;
|
||||
$plugin->save();
|
||||
@@ -1222,19 +1202,9 @@ class _plugins extends \IPS\Node\Controller
|
||||
/* If CMS Template install had conflicts, solve those now */
|
||||
if( !empty( $_SESSION['cmsConflictKey'] ) )
|
||||
{
|
||||
if( \IPS\Request::i()->marketplace )
|
||||
{
|
||||
$_SESSION['cmsConflictKey'] = $_SESSION['cmsConflictKey']->setQueryString( 'marketplace', \IPS\Request::i()->marketplace );
|
||||
}
|
||||
\IPS\Output::i()->redirect( $_SESSION['cmsConflictKey'] );
|
||||
}
|
||||
|
||||
/* Redirect back to marketplace if it was installed from there. */
|
||||
if( \IPS\Request::i()->marketplace )
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=marketplace&controller=marketplace&do=viewFile&id=' . \IPS\Request::i()->marketplace ), 'plugin_now_installed' );
|
||||
}
|
||||
|
||||
/* And redirect back to the overview screen */
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=applications&controller=plugins' ) );
|
||||
}
|
||||
|
||||
@@ -144,20 +144,28 @@ class _rss extends \IPS\Node\Controller
|
||||
}
|
||||
|
||||
$response = $response->decodeXml();
|
||||
|
||||
if ( !( $response instanceof \IPS\Xml\Rss ) and !( $response instanceof \IPS\Xml\Atom ) )
|
||||
{
|
||||
$form->error = \IPS\Member::loggedIn()->language()->addToStack( 'rss_import_invalid' );
|
||||
\IPS\Log::log( (string) $response, 'rss_import' );
|
||||
return $form;
|
||||
}
|
||||
}
|
||||
catch ( \IPS\Http\Request\Exception $e )
|
||||
{
|
||||
$form->error = \IPS\Member::loggedIn()->language()->addToStack( 'form_url_bad' );
|
||||
\IPS\Log::log( $e, 'rss_import');
|
||||
return $form;
|
||||
}
|
||||
catch ( \Exception $e )
|
||||
{
|
||||
$form->error = \IPS\Member::loggedIn()->language()->addToStack( 'rss_import_invalid' );
|
||||
if( isset( $response ) )
|
||||
{
|
||||
\IPS\Log::log( (string) $response, 'rss_import');
|
||||
}
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
|
||||
@@ -322,6 +322,13 @@ class _stats extends \IPS\Dispatcher\Controller
|
||||
$where = array();
|
||||
$join = NULL;
|
||||
|
||||
/* Get our container IDs */
|
||||
$containerIds = array();
|
||||
foreach( $clubNodes[ $classMap[ $class ] ] as $node )
|
||||
{
|
||||
$containerIds[] = $node->id;
|
||||
}
|
||||
|
||||
if( is_subclass_of( $class, '\IPS\Content\Comment' ) )
|
||||
{
|
||||
/* We're going to need a subquery... */
|
||||
@@ -329,7 +336,7 @@ class _stats extends \IPS\Dispatcher\Controller
|
||||
|
||||
$where[] = array(
|
||||
$class::$databasePrefix . $class::$databaseColumnMap['item'] . " IN(" .
|
||||
(string) \IPS\Db::i()->select( $parentClass::$databasePrefix . $parentClass::$databaseColumnId, $parentClass::$databaseTable, array( \IPS\Db::i()->in( $parentClass::$databasePrefix . $parentClass::$databaseColumnMap['container'], array_keys( $clubNodes[ $classMap[ $class ] ] ) ) ) )
|
||||
(string) \IPS\Db::i()->select( $parentClass::$databasePrefix . $parentClass::$databaseColumnId, $parentClass::$databaseTable, array( \IPS\Db::i()->in( $parentClass::$databasePrefix . $parentClass::$databaseColumnMap['container'], $containerIds ) ) )
|
||||
. ")"
|
||||
);
|
||||
|
||||
@@ -347,7 +354,7 @@ class _stats extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
else
|
||||
{
|
||||
$where[] = array( \IPS\Db::i()->in( $class::$databasePrefix . $class::$databaseColumnMap['container'], array_keys( $clubNodes[ $classMap[ $class ] ] ) ) );
|
||||
$where[] = array( \IPS\Db::i()->in( $class::$databasePrefix . $class::$databaseColumnMap['container'], $containerIds ) );
|
||||
|
||||
if( mb_strpos( $chart->identifier, 'byclub' ) !== FALSE )
|
||||
{
|
||||
@@ -385,7 +392,15 @@ class _stats extends \IPS\Dispatcher\Controller
|
||||
foreach( \IPS\Member\Club::availableNodeTypes( NULL ) as $nodeType )
|
||||
{
|
||||
$contentClass = $nodeType::$contentItemClass;
|
||||
$results[ $row['time'] ][ \IPS\Member::loggedIn()->language()->get( $contentClass::$title . '_pl' ) ] = 0;
|
||||
$languageKey = \IPS\Member::loggedIn()->language()->words[ $contentClass::$title . '_pl'];
|
||||
|
||||
/* Pages Databases may need the language string parsing */
|
||||
if( mb_substr( $contentClass, 0, 15 ) === 'IPS\cms\Records' )
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->parseOutputForDisplay( $languageKey );
|
||||
}
|
||||
|
||||
$results[ $row['time'] ][ $languageKey ] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -394,12 +409,24 @@ class _stats extends \IPS\Dispatcher\Controller
|
||||
|
||||
if( mb_strpos( $chart->identifier, 'byclub' ) !== FALSE )
|
||||
{
|
||||
$results[ $row['time'] ][ \IPS\Member\Club::load( $clubNodeMap[ $class::$databaseTable . '-' . $row['container'] ] )->name ] += $row['total'];
|
||||
try
|
||||
{
|
||||
$results[ $row['time'] ][ \IPS\Member\Club::load( $clubNodeMap[ $class::$databaseTable . '-' . $row['container'] ] )->name ] += $row['total'];
|
||||
}
|
||||
catch( \OutOfRangeException $e ){}
|
||||
}
|
||||
else
|
||||
{
|
||||
$languageKey = \IPS\Member::loggedIn()->language()->words[ $contentClass::$title . '_pl'];
|
||||
|
||||
/* Pages Databases may need the language string parsing */
|
||||
if( mb_substr( $contentClass, 0, 15 ) === 'IPS\cms\Records' )
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->parseOutputForDisplay( $languageKey );
|
||||
}
|
||||
|
||||
$contentClass = $classMap[ $class ]::$contentItemClass;
|
||||
$results[ $row['time'] ][ \IPS\Member::loggedIn()->language()->get( $contentClass::$title . '_pl' ) ] += $row['total'];
|
||||
$results[ $row['time'] ][ $languageKey ] += $row['total'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,18 +66,6 @@ class _themes extends \IPS\Node\Controller
|
||||
*/
|
||||
protected function manage()
|
||||
{
|
||||
if ( !\IPS\Request::i()->isAjax() AND \IPS\IPS::canManageResources() )
|
||||
{
|
||||
foreach( \IPS\Theme::themes() as $app )
|
||||
{
|
||||
if( $app->marketplace_id )
|
||||
{
|
||||
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate('marketplace')->removalBanner(FALSE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( \IPS\Theme::designersModeEnabled() and ! isset( \IPS\Request::i()->root ) )
|
||||
{
|
||||
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate( 'global', 'core', 'global' )->message( \IPS\Member::loggedIn()->language()->addToStack('theme_designer_mode_warning'), 'information', NULL, FALSE );
|
||||
@@ -1136,13 +1124,6 @@ class _themes extends \IPS\Node\Controller
|
||||
if ( !\is_array( $data ) )
|
||||
{
|
||||
$_SESSION['theme_import'] = array( 'css' => array(), 'isNewSet' => false );
|
||||
|
||||
/* Remove marketplace link */
|
||||
if( \IPS\Theme::load( \IPS\Request::i()->id )->marketplace_id AND \IPS\Request::i()->manual )
|
||||
{
|
||||
\IPS\Theme::load( \IPS\Request::i()->id )->marketplace_id = NULL;
|
||||
\IPS\Theme::load( \IPS\Request::i()->id )->save();
|
||||
}
|
||||
|
||||
/* Save snapshot */
|
||||
\IPS\Theme::load( \IPS\Request::i()->id )->saveHistorySnapshot();
|
||||
@@ -1572,10 +1553,6 @@ class _themes extends \IPS\Node\Controller
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=customization&controller=themes&do=conflicts&id=' . \IPS\Request::i()->id ) );
|
||||
}
|
||||
elseif( $set->marketplace_id )
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=marketplace&controller=marketplace&do=viewFile&id=' . $set->marketplace_id ), 'theme_now_installed' );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=customization&controller=themes' ) );
|
||||
@@ -1886,10 +1863,6 @@ class _themes extends \IPS\Node\Controller
|
||||
}
|
||||
|
||||
$form = new \IPS\Helpers\Form( 'form', 'theme_set_import_button' );
|
||||
if( $themeSet->marketplace_id )
|
||||
{
|
||||
$form->addMessage( 'marketplace_resource_manual_upgrade', 'ipsMessage ipsMessage_info' );
|
||||
}
|
||||
$form->addMessage('themes_manual_install_warning');
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Upload( 'core_theme_set_new_import', NULL, FALSE, array( 'allowedFileTypes' => array( 'xml' ), 'temporary' => TRUE ), NULL, NULL, NULL, 'core_theme_set_new_import' ) );
|
||||
|
||||
@@ -179,7 +179,8 @@ class _streams extends \IPS\Node\Controller
|
||||
$toSave[ 'activity_stream_rss' ] = $values['activity_stream_rss'];
|
||||
$toSave[ 'activity_stream_subscriptions' ] = $values['activity_stream_subscriptions'];
|
||||
$toSave[ 'activity_stream_subscriptions_max' ] = $values['activity_stream_subscriptions_max'];
|
||||
|
||||
$toSave[ 'activity_stream_subscriptions_inactive_limit' ] = $values['activity_stream_subscriptions_inactive_limit'];
|
||||
|
||||
\IPS\Session::i()->Log( 'acplog__all_activity_settings' );
|
||||
|
||||
$form->saveAsSettings( $toSave );
|
||||
|
||||
@@ -478,7 +478,7 @@ class _emoticons extends \IPS\Dispatcher\Controller
|
||||
* Returns the filename and extension for given emoticon path
|
||||
*
|
||||
* @param string $path Emoticon path
|
||||
* @return array
|
||||
* @return string
|
||||
*/
|
||||
protected function _getRawFilename( $path )
|
||||
{
|
||||
|
||||
@@ -84,18 +84,6 @@ class _languages extends \IPS\Node\Controller
|
||||
protected function manage()
|
||||
{
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'flags.css', 'core', 'global' ) );
|
||||
|
||||
if ( !\IPS\Request::i()->isAjax() AND \IPS\IPS::canManageResources() )
|
||||
{
|
||||
foreach ( \IPS\Lang::languages() as $app )
|
||||
{
|
||||
if ( $app->marketplace_id )
|
||||
{
|
||||
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate( 'marketplace' )->removalBanner( FALSE );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'languages', 'lang_words' ) )
|
||||
{
|
||||
@@ -698,7 +686,6 @@ class _languages extends \IPS\Node\Controller
|
||||
|
||||
$lang['lang_title'] = $lang['lang_title'] . ' ' . \IPS\Member::loggedIn()->language()->get('copy_noun');
|
||||
$lang['lang_default'] = FALSE;
|
||||
$lang['lang_marketplace_id'] = NULL;
|
||||
|
||||
$insertId = \IPS\Db::i()->insert( 'core_sys_lang', $lang );
|
||||
|
||||
@@ -896,10 +883,6 @@ class _languages extends \IPS\Node\Controller
|
||||
$language = \IPS\Lang::load( \IPS\Request::i()->id );
|
||||
|
||||
$form = new \IPS\Helpers\Form;
|
||||
if( $language->marketplace_id )
|
||||
{
|
||||
$form->addMessage( 'marketplace_resource_manual_upgrade', 'ipsMessage ipsMessage_info' );
|
||||
}
|
||||
$form->add( new \IPS\Helpers\Form\Upload( 'lang_upload', NULL, TRUE, array( 'allowedFileTypes' => array( 'xml' ), 'temporary' => TRUE ) ) );
|
||||
|
||||
/* Handle submissions */
|
||||
@@ -935,10 +918,6 @@ class _languages extends \IPS\Node\Controller
|
||||
{
|
||||
$url = $url->setQueryString( 'into', \IPS\Request::i()->into );
|
||||
}
|
||||
if ( isset( \IPS\Request::i()->marketplace ) )
|
||||
{
|
||||
$url = $url->setQueryString( 'marketplace', \IPS\Request::i()->marketplace );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->output = new \IPS\Helpers\MultipleRedirect(
|
||||
$url,
|
||||
@@ -1002,8 +981,7 @@ class _languages extends \IPS\Node\Controller
|
||||
'lang_version_long' => $xml->getAttribute('long_version'),
|
||||
'lang_author_name' => $xml->getAttribute('author_name'),
|
||||
'lang_author_url' => $xml->getAttribute('author_url'),
|
||||
'lang_update_url' => $xml->getAttribute('update_check'),
|
||||
'lang_marketplace_id' => \IPS\Request::i()->marketplace ? (int) \IPS\Request::i()->marketplace : NULL
|
||||
'lang_update_url' => $xml->getAttribute('update_check')
|
||||
) );
|
||||
|
||||
/* Copy over default language strings */
|
||||
@@ -1084,14 +1062,8 @@ class _languages extends \IPS\Node\Controller
|
||||
|
||||
@unlink( \IPS\Request::i()->file );
|
||||
|
||||
/* Redirect back to marketplace if it was installed from there. */
|
||||
if( \IPS\Request::i()->marketplace )
|
||||
if ( isset( \IPS\Request::i()->into ) )
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=marketplace&controller=marketplace&do=viewFile&id=' . \IPS\Request::i()->marketplace ), 'lang_installed' );
|
||||
}
|
||||
elseif ( isset( \IPS\Request::i()->into ) )
|
||||
{
|
||||
\IPS\Lang::load( (int) \IPS\Request::i()->into )->marketplace_id = NULL;
|
||||
\IPS\Lang::load( (int) \IPS\Request::i()->into )->save();
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,245 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Marketplace Onboarding Controller
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 1 May 2020
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\marketplace;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Marketplace Onboarding Controller
|
||||
*/
|
||||
class _onboard extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/**
|
||||
* @brief Has been CSRF-protected
|
||||
*/
|
||||
public static $csrfProtected = TRUE;
|
||||
|
||||
/**
|
||||
* Run
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
final public function manage()
|
||||
{
|
||||
/* Has onboarding been completed? */
|
||||
if( \IPS\Settings::i()->mp_onboard_complete )
|
||||
{
|
||||
\IPS\Output::i()->error( 'marketplace_onboard_already_complete', '2C420/1', 403, '' );
|
||||
}
|
||||
|
||||
$steps = [];
|
||||
if ( array_filter( array_keys( \IPS\Application::applications() ), function( $k ) { return !\in_array( $k, \IPS\IPS::$ipsApps ); } ) )
|
||||
{
|
||||
$steps['marketplace_onboard_applications'] = array( $this, '_applications' );
|
||||
}
|
||||
if ( \IPS\Plugin::plugins() )
|
||||
{
|
||||
$steps['marketplace_onboard_plugins'] = array( $this, '_plugins' );
|
||||
}
|
||||
if ( array_filter( \IPS\Theme::themes(), function( $t ) { return $t->isCustomized(); } ) )
|
||||
{
|
||||
$steps['marketplace_onboard_themes'] = array( $this, '_themes' );
|
||||
}
|
||||
if ( \IPS\Db::i()->select( 'COUNT(*)', 'core_sys_lang_words', array( 'word_custom IS NOT NULL AND word_export=1' ) )->first() )
|
||||
{
|
||||
$steps['marketplace_onboard_languages'] = array( $this, '_languages' );
|
||||
}
|
||||
$steps['marketplace_onboard_complete'] = array( $this, '_complete' );
|
||||
if ( !$steps )
|
||||
{
|
||||
$this->_complete();
|
||||
}
|
||||
|
||||
$wizard = new \IPS\Helpers\Wizard( $steps, \IPS\Http\Url::internal('app=core&module=marketplace&controller=onboard') );
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('marketplace_onboard_title');
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'admin_marketplace.js', 'core', 'admin' ) );
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'marketplace/marketplace.css', 'core', 'admin' ) );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'forms', 'core' )->blurb( \IPS\Member::loggedIn()->language()->addToStack( 'marketplace_onboard_blurb' ) ) . $wizard;
|
||||
}
|
||||
|
||||
/**
|
||||
* Applications
|
||||
*
|
||||
* @param mixed $data Wizard data
|
||||
* @return mixed
|
||||
*/
|
||||
final public function _applications( $data )
|
||||
{
|
||||
if ( \IPS\Request::i()->match_apps )
|
||||
{
|
||||
foreach ( \IPS\Application::applications() as $application )
|
||||
{
|
||||
if ( isset( \IPS\Request::i()->match_apps[ $application->directory ] ) and \IPS\Request::i()->match_apps[ $application->directory ] )
|
||||
{
|
||||
$application->marketplace_id = \IPS\Request::i()->match_apps[ $application->directory ];
|
||||
$application->save();
|
||||
}
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
$rows = [];
|
||||
foreach ( \IPS\Application::applications() as $application )
|
||||
{
|
||||
if ( !\in_array( $application->directory, \IPS\IPS::$ipsApps ) )
|
||||
{
|
||||
$rows[ $application->directory ] = \IPS\Theme::i()->getTemplate('marketplace')->onboardRow( $application->directory, $application->marketplace_id, 'apps', $application->_title, $application->version, $application->author, $application->website, 'apps' );
|
||||
}
|
||||
}
|
||||
if ( $rows )
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate('marketplace')->onboardTemplate( $rows );
|
||||
}
|
||||
else
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Plugins
|
||||
*
|
||||
* @param mixed $data Wizard data
|
||||
* @return mixed
|
||||
*/
|
||||
final public function _plugins( $data )
|
||||
{
|
||||
if ( \IPS\Request::i()->match_plugins )
|
||||
{
|
||||
foreach ( \IPS\Plugin::plugins() as $plugin )
|
||||
{
|
||||
if ( isset( \IPS\Request::i()->match_plugins[ $plugin->id ] ) and \IPS\Request::i()->match_plugins[ $plugin->id ] )
|
||||
{
|
||||
$plugin->marketplace_id = \IPS\Request::i()->match_plugins[ $plugin->id ];
|
||||
$plugin->save();
|
||||
}
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
$rows = [];
|
||||
foreach ( \IPS\Plugin::plugins() as $plugin )
|
||||
{
|
||||
$rows[ $plugin->id ] = \IPS\Theme::i()->getTemplate('marketplace')->onboardRow( $plugin->id, $plugin->marketplace_id, 'apps', $plugin->name, $plugin->version_human, $plugin->author, $plugin->website, 'plugins' );
|
||||
}
|
||||
if ( $rows )
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate('marketplace')->onboardTemplate( $rows );
|
||||
}
|
||||
else
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Themes
|
||||
*
|
||||
* @param mixed $data Wizard data
|
||||
* @return mixed
|
||||
*/
|
||||
final public function _themes( $data )
|
||||
{
|
||||
if ( \IPS\Request::i()->match_themes )
|
||||
{
|
||||
foreach ( \IPS\Theme::themes() as $theme )
|
||||
{
|
||||
if ( isset( \IPS\Request::i()->match_themes[ $theme->id ] ) and \IPS\Request::i()->match_themes[ $theme->id ] )
|
||||
{
|
||||
$theme->marketplace_id = \IPS\Request::i()->match_themes[ $theme->id ];
|
||||
$theme->save();
|
||||
}
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
$rows = [];
|
||||
foreach ( \IPS\Theme::themes() as $theme )
|
||||
{
|
||||
if ( $theme->isCustomized() )
|
||||
{
|
||||
$rows[ $theme->id ] = \IPS\Theme::i()->getTemplate('marketplace')->onboardRow( $theme->id, $theme->marketplace_id, 'themes', $theme->_title, $theme->version, $theme->author_name, $theme->author_url, 'themes' );
|
||||
}
|
||||
}
|
||||
if ( $rows )
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate('marketplace')->onboardTemplate( $rows );
|
||||
}
|
||||
else
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Languages
|
||||
*
|
||||
* @param mixed $data Wizard data
|
||||
* @return mixed
|
||||
*/
|
||||
final public function _languages( $data )
|
||||
{
|
||||
if ( \IPS\Request::i()->match_languages )
|
||||
{
|
||||
foreach ( \IPS\Lang::languages() as $language )
|
||||
{
|
||||
if ( isset( \IPS\Request::i()->match_languages[ $language->id ] ) and \IPS\Request::i()->match_languages[ $language->id ] )
|
||||
{
|
||||
$language->marketplace_id = \IPS\Request::i()->match_languages[ $language->id ];
|
||||
$language->save();
|
||||
}
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
$rows = [];
|
||||
foreach ( \IPS\Lang::languages() as $language )
|
||||
{
|
||||
if ( \IPS\Db::i()->select( 'COUNT(*)', 'core_sys_lang_words', array( 'lang_id=? AND word_custom IS NOT NULL AND word_export=1', $language->_id ) )->first() )
|
||||
{
|
||||
$rows[ $language->id ] = \IPS\Theme::i()->getTemplate('marketplace')->onboardRow( $language->id, $language->marketplace_id, 'languages', $language->_title, $language->version, $language->author_name, $language->author_url, 'languages' );
|
||||
}
|
||||
}
|
||||
if ( $rows )
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate('marketplace')->onboardTemplate( $rows );
|
||||
}
|
||||
else
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Complete
|
||||
*
|
||||
* @param mixed $data Wizard data
|
||||
* @return mixed
|
||||
*/
|
||||
final public function _complete()
|
||||
{
|
||||
/* Set onboard complete flag */
|
||||
\IPS\Settings::i()->changeValues( array( 'mp_onboard_complete' => 1 ) );
|
||||
|
||||
\IPS\core\AdminNotification::remove( 'core', 'ConfigurationError', 'marketplaceSetup' );
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal('app=core&module=marketplace&controller=marketplace') );
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,8 @@
|
||||
|
||||
namespace IPS\core\modules\admin\members;
|
||||
|
||||
use IPS\Text\Encrypt;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
@@ -123,6 +125,7 @@ class _members extends \IPS\Helpers\CoverPhoto\Controller
|
||||
/* Create the table */
|
||||
$table = new \IPS\Helpers\Table\Db( 'core_members', \IPS\Http\Url::internal( 'app=core&module=members&controller=members' ), array( array( 'core_members.email<>?', '' ) ), $forceIndex );
|
||||
$table->langPrefix = 'members_';
|
||||
$table->keyField = 'member_id';
|
||||
|
||||
/* Columns we need */
|
||||
$table->include = array( 'photo', 'name', 'email', 'joined', 'group_name' );
|
||||
@@ -196,7 +199,7 @@ class _members extends \IPS\Helpers\CoverPhoto\Controller
|
||||
$options = array( '' => "");
|
||||
}
|
||||
|
||||
if( \count( $field->options['options'] ) )
|
||||
if( \is_array( $field->options['options'] ) AND \count( $field->options['options'] ) )
|
||||
{
|
||||
foreach ( $field->options['options'] as $option )
|
||||
{
|
||||
@@ -2530,7 +2533,9 @@ class _members extends \IPS\Helpers\CoverPhoto\Controller
|
||||
{
|
||||
\IPS\Output::i()->error( 'node_error', '2C114/9', 404, '' );
|
||||
}
|
||||
$member->failed_logins = array();
|
||||
/* Remove login failures */
|
||||
\IPS\Db::i()->delete( 'core_login_failures', [ 'login_member_id=?', $member->member_id ] );
|
||||
$member->failed_login_count = 0;
|
||||
$member->failed_mfa_attempts = 0;
|
||||
$mfaDetails = $member->mfa_details;
|
||||
if ( isset( $mfaDetails['_lockouttime'] ) )
|
||||
@@ -2682,25 +2687,31 @@ class _members extends \IPS\Helpers\CoverPhoto\Controller
|
||||
{
|
||||
if ( !$row['user_verified'] )
|
||||
{
|
||||
$plainTextKey = '';
|
||||
if( !empty( $row['security_key'] ) )
|
||||
{
|
||||
$plainTextKey = Encrypt::fromTag( $row['security_key'] )->decrypt();
|
||||
}
|
||||
|
||||
/* Lost Pass */
|
||||
if ( $row['lost_pass'] )
|
||||
{
|
||||
\IPS\Email::buildFromTemplate( 'core', 'lost_password_init', array( $member, $row['vid'] ), \IPS\Email::TYPE_TRANSACTIONAL )->send( $member );
|
||||
\IPS\Email::buildFromTemplate( 'core', 'lost_password_init', array( $member, $row['vid'], $plainTextKey ), \IPS\Email::TYPE_TRANSACTIONAL )->send( $member );
|
||||
}
|
||||
/* New Reg */
|
||||
elseif ( $row['new_reg'] )
|
||||
{
|
||||
\IPS\Email::buildFromTemplate( 'core', 'registration_validate', array( $member, $row['vid'] ), \IPS\Email::TYPE_TRANSACTIONAL )->send( $member );
|
||||
\IPS\Email::buildFromTemplate( 'core', 'registration_validate', array( $member, $row['vid'], $plainTextKey ), \IPS\Email::TYPE_TRANSACTIONAL )->send( $member );
|
||||
}
|
||||
/* Email Change */
|
||||
elseif ( $row['email_chg'] )
|
||||
{
|
||||
\IPS\Email::buildFromTemplate( 'core', 'email_change', array( $member, $row['vid'] ), \IPS\Email::TYPE_TRANSACTIONAL )->send( $member );
|
||||
\IPS\Email::buildFromTemplate( 'core', 'email_change', array( $member, $row['vid'], $plainTextKey ), \IPS\Email::TYPE_TRANSACTIONAL )->send( $member );
|
||||
}
|
||||
/* Forgot security answers */
|
||||
elseif ( $row['forgot_security'] )
|
||||
{
|
||||
\IPS\Email::buildFromTemplate( 'core', 'forgotSecurityAnswers', array( $member, $row['vid'] ), \IPS\Email::TYPE_TRANSACTIONAL )->send( $member );
|
||||
\IPS\Email::buildFromTemplate( 'core', 'mfaRecovery', array( $member, $row['vid'], $plainTextKey ), \IPS\Email::TYPE_TRANSACTIONAL )->send( $member );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3028,7 +3039,7 @@ class _members extends \IPS\Helpers\CoverPhoto\Controller
|
||||
|
||||
\IPS\Session::i()->log( 'acplog__deleted_guest_content', array( $values['guest_name_to_delete'] => FALSE ) );
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=moderation&controller=spam&searchResult=guest_captcha" ), 'deleted' );
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=moderation&controller=spam" ), 'deleted' );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->output = $form;
|
||||
@@ -3573,7 +3584,7 @@ class _members extends \IPS\Helpers\CoverPhoto\Controller
|
||||
break;
|
||||
}
|
||||
|
||||
$matrix->rows[] = array( 'import_column' => $header, 'import_as' => $value );
|
||||
$matrix->rows[] = array( 'import_column' => htmlspecialchars( $header, ENT_DISALLOWED | ENT_QUOTES, 'UTF-8', FALSE ), 'import_as' => $value );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3634,7 +3645,11 @@ class _members extends \IPS\Helpers\CoverPhoto\Controller
|
||||
{
|
||||
fseek( $fh, $mrData['currentPosition'] );
|
||||
}
|
||||
|
||||
$count = 0;
|
||||
begin:
|
||||
$line = fgetcsv( $fh );
|
||||
$count++;
|
||||
|
||||
/* Are we done/ */
|
||||
if ( !$line )
|
||||
@@ -3883,6 +3898,12 @@ class _members extends \IPS\Helpers\CoverPhoto\Controller
|
||||
\IPS\Email::buildFromTemplate( 'core', 'admin_reg', array( $member, $member->members_bitoptions['password_reset_forced'], md5( \IPS\SUITE_UNIQUE_KEY . $member->email . $member->real_name ) ), \IPS\Email::TYPE_TRANSACTIONAL )->send( $member );
|
||||
}
|
||||
|
||||
/* If we haven't hit our limit, go again. */
|
||||
if ( $count <= 100 )
|
||||
{
|
||||
goto begin;
|
||||
}
|
||||
|
||||
/* Continue */
|
||||
$mrData['currentPosition'] = ftell( $fh );
|
||||
fclose( $fh );
|
||||
@@ -4128,9 +4149,9 @@ class _members extends \IPS\Helpers\CoverPhoto\Controller
|
||||
$mrData['count'] = $query->first();
|
||||
}
|
||||
|
||||
/* Compile query */
|
||||
$query = \IPS\Db::i()->select( implode( ',', $select ), 'core_members', $where, 'core_members.member_id', array( $mrData['offset'], $doPerLoop ) );
|
||||
|
||||
/* Compile member_id query. Just getting the member_ids first is more efficient on larger tables */
|
||||
$query = \IPS\Db::i()->select( 'core_members.member_id', 'core_members', $where, 'core_members.member_id', array( $mrData['offset'], $doPerLoop ) );
|
||||
|
||||
/* Run callbacks */
|
||||
foreach ( \IPS\Application::allExtensions( 'core', 'MemberFilter', TRUE, 'core' ) as $key => $extension )
|
||||
{
|
||||
@@ -4145,36 +4166,73 @@ class _members extends \IPS\Helpers\CoverPhoto\Controller
|
||||
}
|
||||
}
|
||||
|
||||
/* Finished? */
|
||||
if ( !$query->count() )
|
||||
/* Get the IDs */
|
||||
$memberIds = iterator_to_array( $query );
|
||||
|
||||
/* Nothing to do? */
|
||||
if ( ! count( $memberIds ) )
|
||||
{
|
||||
if( \count( $mrData['removedData'] ) AND ( !isset( $wizardData['includeInsecure'] ) OR !$wizardData['includeInsecure'] ) )
|
||||
{
|
||||
$_SESSION['removedData'] = $mrData['removedData'];
|
||||
}
|
||||
|
||||
/* Finish here as we got everything */
|
||||
\IPS\Output::i()->redirect( $baseUrl->setQueryString( array( 'buildDone' => 1 ) ) );
|
||||
}
|
||||
|
||||
|
||||
/* Now prepare the actual query to get all the data */
|
||||
$where[] = [ \IPS\Db::i()->in( 'core_members.member_id', $memberIds ) ];
|
||||
$dataQuery = \IPS\Db::i()->select( implode( ',', $select ), 'core_members', $where, 'core_members.member_id' );
|
||||
|
||||
/* Run callbacks */
|
||||
foreach ( \IPS\Application::allExtensions( 'core', 'MemberFilter', TRUE, 'core' ) as $key => $extension )
|
||||
{
|
||||
if( method_exists( $extension, 'queryCallback' ) )
|
||||
{
|
||||
/* Grab our fields and add to the form */
|
||||
if( !empty( $wizardData['filters'][ $key ] ) )
|
||||
{
|
||||
$data = $wizardData['filters'][ $key ];
|
||||
$extension->queryCallback( $data, $dataQuery );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Open file */
|
||||
$fh = fopen( $wizardData['file'], 'a' );
|
||||
|
||||
|
||||
/* Run */
|
||||
foreach ( $query as $member )
|
||||
$done = 0;
|
||||
foreach ( $dataQuery as $member )
|
||||
{
|
||||
$dataToWrite = $this->_getDataToWriteCsv( $member, $wizardData, $mrData );
|
||||
|
||||
$done++; /* This is here because the query fetched 2500 but fewer than 2500 may be processed throwing the last bit out */
|
||||
|
||||
if( $dataToWrite === FALSE )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
/* Write */
|
||||
fputcsv( $fh, $dataToWrite );
|
||||
}
|
||||
|
||||
|
||||
/* Close and loop */
|
||||
fclose( $fh );
|
||||
|
||||
if ( $done < $doPerLoop )
|
||||
{
|
||||
if( \count( $mrData['removedData'] ) AND ( !isset( $wizardData['includeInsecure'] ) OR !$wizardData['includeInsecure'] ) )
|
||||
{
|
||||
$_SESSION['removedData'] = $mrData['removedData'];
|
||||
}
|
||||
|
||||
/* Just finish here as we got everything */
|
||||
\IPS\Output::i()->redirect( $baseUrl->setQueryString( array( 'buildDone' => 1 ) ) );
|
||||
}
|
||||
|
||||
$mrData['offset'] += $doPerLoop;
|
||||
return array( $mrData, \IPS\Member::loggedIn()->language()->addToStack('export_members_processing'), ( $mrData['offset'] > $mrData['count'] ) ? 100 : ( 100 / $mrData['count'] ) * $mrData['offset'] );
|
||||
},
|
||||
@@ -4289,7 +4347,14 @@ class _members extends \IPS\Helpers\CoverPhoto\Controller
|
||||
if ( mb_substr( $column, 0, 7 ) == 'pfield_' )
|
||||
{
|
||||
$fieldId = mb_substr( $column, 7 );
|
||||
$valueToWrite = $member[ 'field_' . $fieldId ] ? \IPS\core\ProfileFields\Field::load( $fieldId )->displayValue( $member[ 'field_' . $fieldId ], FALSE, 0, NULL, TRUE, ',' ) : '';
|
||||
|
||||
/* If this is a Checkbox or YesNo field, then we can't use the displayValue() as it will just come out as a hashed string, and the CSV file can be large, so just replace these at generation time rather than parsing the entire file. */
|
||||
$field = \IPS\core\ProfileFields\Field::load( $fieldId );
|
||||
|
||||
$valueToWrite = match( $field->type ) {
|
||||
'YesNo', 'Checkbox' => (bool) $member[ 'field_' . $fieldId ] ? \IPS\Member::loggedIn()->language()->get('yes') : \IPS\Member::loggedIn()->language()->get('no'),
|
||||
default => $member[ 'field_' . $fieldId ] ? \IPS\core\ProfileFields\Field::load( $fieldId )->displayValue( $member[ 'field_' . $fieldId ], FALSE, 0, NULL, TRUE, ',' ) : ''
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
|
||||
namespace IPS\core\modules\admin\membersettings;
|
||||
|
||||
use IPS\Application;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
@@ -133,6 +135,11 @@ class _profilesettings extends \IPS\Dispatcher\Controller
|
||||
$form->addHeader( 'profile_member_history' );
|
||||
$form->add( new \IPS\Helpers\Form\Interval( 'prune_member_history', \IPS\Settings::i()->prune_member_history, FALSE, array( 'valueAs' => \IPS\Helpers\Form\Interval::DAYS, 'unlimited' => 0, 'unlimitedLang' => 'never' ), NULL, \IPS\Member::loggedIn()->language()->addToStack('after'), NULL, 'prune_member_history' ) );
|
||||
|
||||
if ( Application::appIsEnabled('nexus') )
|
||||
{
|
||||
$form->add( new \IPS\Helpers\Form\Interval( 'nexus_prune_history', \IPS\Settings::i()->nexus_prune_history, FALSE, array( 'valueAs' => \IPS\Helpers\Form\Interval::DAYS, 'unlimited' => 0, 'unlimitedLang' => 'never' ), NULL, \IPS\Member::loggedIn()->language()->addToStack('after'), NULL, 'nexus_prune_history' ) );
|
||||
}
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Interval( 'prune_known_ips', \IPS\Settings::i()->prune_known_ips, FALSE, array( 'valueAs' => \IPS\Helpers\Form\Interval::DAYS, 'unlimited' => 0, 'unlimitedLang' => 'never' ), function( $val ) {
|
||||
if( $val > 0 AND $val < 7 )
|
||||
{
|
||||
@@ -227,7 +234,7 @@ class _profilesettings extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
\IPS\Task::queue( 'core', 'PruneLargeTable', array(
|
||||
'table' => 'core_member_history',
|
||||
'where' => array( 'log_date < ?', \IPS\DateTime::create()->sub( new \DateInterval( 'P' . $values['prune_member_history'] . 'D' ) )->getTimestamp() ),
|
||||
'where' => array( 'log_date < ? and log_app != ?', \IPS\DateTime::create()->sub( new \DateInterval( 'P' . $values['prune_member_history'] . 'D' ) )->getTimestamp(), 'nexus' ),
|
||||
'setting' => 'prune_member_history',
|
||||
), 4 );
|
||||
}
|
||||
|
||||
@@ -0,0 +1,262 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief report
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
|
||||
* @since 17 Sep 2024
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\moderation;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
|
||||
use IPS\Db;
|
||||
use IPS\Dispatcher;
|
||||
use IPS\Dispatcher\Controller;
|
||||
use IPS\Helpers\Form;
|
||||
use IPS\Helpers\Form\Number;
|
||||
use IPS\Helpers\Form\YesNo;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Member;
|
||||
use IPS\Output;
|
||||
use IPS\Session;
|
||||
use IPS\Settings;
|
||||
use IPS\Theme;
|
||||
use function defined;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* report
|
||||
*/
|
||||
class _report extends Controller
|
||||
{
|
||||
/**
|
||||
* @brief Has been CSRF-protected
|
||||
*/
|
||||
public static $csrfProtected = TRUE;
|
||||
|
||||
/**
|
||||
* Execute
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
/* Add a button for settings */
|
||||
\IPS\Output::i()->sidebar['actions'] = array(
|
||||
'automatic' => array(
|
||||
'title' => 'manage_automatic_rules',
|
||||
'icon' => 'bolt',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=moderation&controller=reportedContent' )
|
||||
),
|
||||
'settings' => array(
|
||||
'title' => 'reportedContent_types',
|
||||
'icon' => 'cog',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=moderation&controller=reportedContentTypes' )
|
||||
)
|
||||
);
|
||||
|
||||
Dispatcher::i()->checkAcpPermission( 'reportedContentTypes_manage' );
|
||||
parent::execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function manage()
|
||||
{
|
||||
Dispatcher::i()->checkAcpPermission( 'reportedContent_manage' );
|
||||
|
||||
/* Work out output */
|
||||
\IPS\Request::i()->tab = isset( \IPS\Request::i()->tab ) ? \IPS\Request::i()->tab : 'settings';
|
||||
if ( $pos = mb_strpos( \IPS\Request::i()->tab, '-' ) )
|
||||
{
|
||||
$tabMethod = '_manage' . mb_ucfirst( mb_substr( \IPS\Request::i()->tab, 0, $pos ) );
|
||||
$activeTabContents = $this->$tabMethod( mb_substr( \IPS\Request::i()->tab, $pos + 1 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$tabMethod = '_manage' . mb_ucfirst( \IPS\Request::i()->tab );
|
||||
$activeTabContents = $this->$tabMethod();
|
||||
}
|
||||
|
||||
/* If this is an AJAX request, just return it */
|
||||
if( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->output = $activeTabContents;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Build tab list */
|
||||
$tabs = [
|
||||
'settings' => 'menu__core_moderation_report',
|
||||
'notifications' => 'report_author_notification_title'
|
||||
];
|
||||
|
||||
/* Display */
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__core_moderation_report');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->tabs( $tabs, \IPS\Request::i()->tab, $activeTabContents, \IPS\Http\Url::internal( "app=core&module=moderation&controller=report" ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage settings
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function _manageSettings(): string
|
||||
{
|
||||
$form = new Form;
|
||||
|
||||
/* Can guests report */
|
||||
$guest = new \IPS\Member;
|
||||
$guestDisabled = false;
|
||||
$guestSetting = Settings::i()->report_capture_guest_details;
|
||||
if ( ! $guest->group['g_can_report'] )
|
||||
{
|
||||
$guestDisabled = true;
|
||||
$guestSetting = false;
|
||||
\IPS\Member::loggedIn()->language()->words['report_capture_guest_details_warning'] = \IPS\Member::loggedIn()->language()->addToStack( 'report_capture_guest_details__warning' );
|
||||
}
|
||||
|
||||
$form->add( new YesNo( 'report_capture_guest_details', $guestSetting, FALSE, array( 'disabled' => $guestDisabled, 'togglesOn' => [ 'report_guest_details_name_mandatory', 'report_guest_details_store_days'] ), NULL, NULL, NULL, 'report_capture_guest_details' ) );
|
||||
$form->add( new YesNo( 'report_guest_details_name_mandatory', Settings::i()->report_guest_details_name_mandatory, FALSE, array(), NULL, NULL, NULL, 'report_guest_details_name_mandatory' ) );
|
||||
$form->add( new Number( 'report_guest_details_store_days', Settings::i()->report_guest_details_store_days, FALSE, array( 'unlimited' => -1, 'unlimitedLang' => 'report_guest_details_store_unlimited' ), NULL, NULL, Member::loggedIn()->language()->addToStack('days'), 'report_guest_details_store_days' ) );
|
||||
|
||||
$form->add( new YesNo( 'report_content_mandatory', Settings::i()->report_content_mandatory, FALSE, array(), NULL, NULL, NULL, 'report_content_mandatory' ) );
|
||||
|
||||
$form->add( new YesNo( 'automoderation_enabled', Settings::i()->automoderation_enabled, FALSE, array( 'togglesOn' => [ 'automoderation_report_again_mins' ] ), NULL, NULL, NULL, 'automoderation_enabled' ) );
|
||||
$form->add( new Number( 'automoderation_report_again_mins', Settings::i()->automoderation_report_again_mins, FALSE, array(), NULL, NULL, Member::loggedIn()->language()->addToStack('automoderation_report_again_mins_suffix'), 'automoderation_report_again_mins' ) );
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
$form->saveAsSettings();
|
||||
|
||||
Db::i()->update( 'core_tasks', array( 'enabled' => (int) $values['automoderation_enabled'] ), array( '`key`=?', 'automaticmoderation' ) );
|
||||
|
||||
Session::i()->log( 'acplog__automoderation_settings' );
|
||||
Output::i()->redirect( Url::internal( 'app=core&module=moderation&controller=report&tab=settings' ), 'saved' );
|
||||
}
|
||||
|
||||
return Theme::i()->getTemplate('forms')->blurb( 'reporting_content_blurb', true, true ) . $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function _manageNotifications(): string
|
||||
{
|
||||
/* Init */
|
||||
$table = new \IPS\Helpers\Table\Db( 'core_rc_author_notification_text', \IPS\Http\Url::internal( 'app=core&module=moderation&controller=report&tab=notifications' ) );
|
||||
$table->include = array( 'title' );
|
||||
$table->sortBy = $table->sortBy ?: 'title';
|
||||
$table->sortDirection = $table->sortDirection ?: 'asc';
|
||||
|
||||
/* Row buttons */
|
||||
$table->rowButtons = function( $row )
|
||||
{
|
||||
$return = array();
|
||||
|
||||
$return['edit'] = array(
|
||||
'icon' => 'pencil',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=moderation&controller=report&tab=notifications&do=notificationForm&id=' ) . $row['id'],
|
||||
'title' => 'edit',
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('edit') )
|
||||
);
|
||||
|
||||
$return['delete'] = array(
|
||||
'icon' => 'times-circle',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=moderation&controller=report&tab=notifications&do=notificationDelete&id=' ) . $row['id'],
|
||||
'title' => 'delete',
|
||||
'data' => array( 'delete' => '' )
|
||||
);
|
||||
|
||||
return $return;
|
||||
};
|
||||
|
||||
/* Add button */
|
||||
$table->rootButtons = array(
|
||||
'add' => array(
|
||||
'icon' => 'plus',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=moderation&controller=report&tab=notifications&do=notificationForm' ),
|
||||
'title' => 'add',
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('add') )
|
||||
)
|
||||
);
|
||||
|
||||
/* Display */
|
||||
return Theme::i()->getTemplate('forms')->blurb( 'reporting_content_notifications_blurb', true, true ) . $table;
|
||||
}
|
||||
|
||||
/**
|
||||
* Report notification to author of content form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function notificationForm()
|
||||
{
|
||||
$current = NULL;
|
||||
if ( \IPS\Request::i()->id )
|
||||
{
|
||||
$current = \IPS\Db::i()->select( '*', 'core_rc_author_notification_text', array( 'id=?', \IPS\Request::i()->id ) )->first();
|
||||
}
|
||||
|
||||
$form = new \IPS\Helpers\Form;
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'report_notifications_title', ( $current ? $current['title'] : '' ), true ) );
|
||||
$form->add( new \IPS\Helpers\Form\TextArea( 'report_notifications_text', ( $current ? $current['text'] : '' ), true, [ 'rows' => 20 ] ) );
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
$save = [
|
||||
'title' => $values['report_notifications_title'],
|
||||
'text' => $values['report_notifications_text']
|
||||
];
|
||||
|
||||
if ( $current )
|
||||
{
|
||||
\IPS\Db::i()->update( 'core_rc_author_notification_text', $save, array( 'id=?', $current['id'] ) );
|
||||
\IPS\Session::i()->log( 'acplog__report_author_notification_edited', array( $current['title'] => true ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Db::i()->insert( 'core_rc_author_notification_text', $save );
|
||||
\IPS\Session::i()->log( 'acplog__report_author_notification_created', array( $save['title'] => true ) );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=moderation&controller=report&tab=notifications' ), 'saved' );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate( 'global' )->block( 'report_author_notification_title', $form, FALSE );
|
||||
}
|
||||
|
||||
/**
|
||||
* Report notification to author of content delete
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function notificationDelete()
|
||||
{
|
||||
/* Make sure the user confirmed the deletion */
|
||||
\IPS\Request::i()->confirmedDelete();
|
||||
|
||||
try
|
||||
{
|
||||
$current = \IPS\Db::i()->select( '*', 'core_rc_author_notification_text', array( 'id=?', \IPS\Request::i()->id ) )->first();
|
||||
|
||||
\IPS\Session::i()->log( 'acplog__report_author_notification_deleted', array( $current['title'] => true ) );
|
||||
\IPS\Db::i()->delete( 'core_rc_author_notification_text', array( 'id=?', \IPS\Request::i()->id ) );
|
||||
}
|
||||
catch ( \UnderflowException $e ) { }
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=moderation&controller=report&tab=notifications' ), 'deleted' );
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,10 @@
|
||||
namespace IPS\core\modules\admin\moderation;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
|
||||
use IPS\Http\Url;
|
||||
use IPS\Output;
|
||||
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
@@ -40,20 +44,8 @@ class _reportedContent extends \IPS\Node\Controller
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
/* Add a button for settings */
|
||||
\IPS\Output::i()->sidebar['actions'] = array(
|
||||
'settings' => array(
|
||||
'title' => 'reportedContent_settings',
|
||||
'icon' => 'cog',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=moderation&controller=reportedContent&do=settings' ),
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('reportedContent_settings') )
|
||||
),
|
||||
'types' => array(
|
||||
'title' => 'reportedContent_types',
|
||||
'icon' => 'cog',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=moderation&controller=reportedContentTypes' )
|
||||
)
|
||||
);
|
||||
Output::i()->breadcrumb[] = array( Url::internal( "app=core&module=moderation&controller=report" ), 'menu__core_moderation_report' );
|
||||
Output::i()->breadcrumb[] = array( NULL, 'manage_automatic_rules' );
|
||||
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('forms')->blurb( 'automaticmoderation_blurb' );
|
||||
|
||||
@@ -65,32 +57,4 @@ class _reportedContent extends \IPS\Node\Controller
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'reportedContent_manage' );
|
||||
parent::execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Profile Settings
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function settings()
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'reportedContent_manage' );
|
||||
|
||||
$form = new \IPS\Helpers\Form;
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'automoderation_enabled', \IPS\Settings::i()->automoderation_enabled, FALSE, array(), NULL, NULL, NULL, 'automoderation_enabled' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'automoderation_report_again_mins', \IPS\Settings::i()->automoderation_report_again_mins, FALSE, array(), NULL, NULL, \IPS\Member::loggedIn()->language()->addToStack('automoderation_report_again_mins_suffix'), 'automoderation_report_again_mins' ) );
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
$form->saveAsSettings();
|
||||
|
||||
\IPS\Db::i()->update( 'core_tasks', array( 'enabled' => (int) $values['automoderation_enabled'] ), array( '`key`=?', 'automaticmoderation' ) );
|
||||
|
||||
\IPS\Session::i()->log( 'acplog__automoderation_settings' );
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=moderation&controller=reportedContent' ), 'saved' );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('reportedContent_settings');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('global')->block( 'reportedContent_settings', $form, FALSE );
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,12 @@
|
||||
namespace IPS\core\modules\admin\moderation;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
|
||||
use IPS\Http\Url;
|
||||
use IPS\Output;
|
||||
use IPS\Request;
|
||||
use IPS\Theme;
|
||||
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
@@ -40,6 +46,14 @@ class _reportedContentTypes extends \IPS\Node\Controller
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
Output::i()->breadcrumb[] = array( Url::internal( "app=core&module=moderation&controller=report" ), 'menu__core_moderation_report' );
|
||||
Output::i()->breadcrumb[] = array( NULL, 'reportedContent_types' );
|
||||
|
||||
if ( ! Request::i()->do )
|
||||
{
|
||||
Output::i()->output = Theme::i()->getTemplate( 'forms', 'core' )->blurb( 'moderation_reporttypes_desc' );
|
||||
}
|
||||
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'reportedContentTypes_manage' );
|
||||
parent::execute();
|
||||
}
|
||||
|
||||
@@ -11,6 +11,12 @@
|
||||
namespace IPS\core\modules\admin\moderation;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
|
||||
use IPS\Helpers\Form;
|
||||
use IPS\Helpers\Form\Radio;
|
||||
use IPS\Helpers\Form\Text;
|
||||
use IPS\Settings;
|
||||
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
@@ -116,26 +122,45 @@ class _spam extends \IPS\Dispatcher\Controller
|
||||
* @param string $type 'options' for the select options, 'toggles' for the toggles
|
||||
* @return array
|
||||
*/
|
||||
protected function getCaptchaOptions( $type='options' )
|
||||
protected static function getCaptchaOptions( string $type='options' ) : array
|
||||
{
|
||||
switch( $type )
|
||||
{
|
||||
case 'options':
|
||||
return array( 'none' => 'captcha_type_none', 'invisible' => 'captcha_type_invisible', 'recaptcha2' => 'captcha_type_recaptcha2', 'keycaptcha' => 'captcha_type_keycaptcha', 'hcaptcha' => 'captcha_type_hcaptcha' );
|
||||
break;
|
||||
$options = [
|
||||
'none' => 'captcha_type_none',
|
||||
'turnstile' => 'captcha_type_turnstile',
|
||||
'invisible' => 'captcha_type_invisible',
|
||||
'recaptcha2' => 'captcha_type_recaptcha2',
|
||||
'keycaptcha' => 'captcha_type_keycaptcha',
|
||||
'hcaptcha' => 'captcha_type_hcaptcha'
|
||||
];
|
||||
|
||||
if( \IPS\Settings::i()->bot_antispam_type != 'keycaptcha' )
|
||||
{
|
||||
unset( $options['keycaptcha'] );
|
||||
}
|
||||
|
||||
return $options;
|
||||
|
||||
case 'toggles':
|
||||
return array(
|
||||
'none' => array( 'bot_antispam_type_warning' ),
|
||||
'recaptcha2' => array( 'guest_captcha', 'recaptcha2_public_key', 'recaptcha2_private_key' ),
|
||||
'invisible' => array( 'guest_captcha', 'recaptcha2_public_key', 'recaptcha2_private_key' ),
|
||||
'keycaptcha' => array( 'guest_captcha', 'keycaptcha_privatekey' ),
|
||||
'hcaptcha' => array( 'guest_captcha', 'hcaptcha_sitekey', 'hcaptcha_secret')
|
||||
);
|
||||
break;
|
||||
$toggles = [
|
||||
'none' => [ 'bot_antispam_type_warning' ],
|
||||
'turnstile' => [ 'turnstile_site_key', 'turnstile_secret_key' ],
|
||||
'recaptcha2' => [ 'recaptcha2_public_key', 'recaptcha2_private_key' ],
|
||||
'invisible' => [ 'recaptcha2_public_key', 'recaptcha2_private_key' ],
|
||||
'keycaptcha' => [ 'keycaptcha_privatekey' ],
|
||||
'hcaptcha' => [ 'hcaptcha_sitekey', 'hcaptcha_secret' ]
|
||||
];
|
||||
|
||||
if( \IPS\Settings::i()->bot_antispam_type != 'keycaptcha' )
|
||||
{
|
||||
unset( $toggles['keycaptcha'] );
|
||||
}
|
||||
return $toggles;
|
||||
}
|
||||
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -147,16 +172,7 @@ class _spam extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/* Build Form */
|
||||
$form = new \IPS\Helpers\Form;
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'bot_antispam_type', \IPS\Settings::i()->bot_antispam_type, TRUE, array(
|
||||
'options' => $this->getCaptchaOptions( 'options' ),
|
||||
'toggles' => $this->getCaptchaOptions( 'toggles' ),
|
||||
), NULL, NULL, NULL, 'bot_antispam_type' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'recaptcha2_public_key', \IPS\Settings::i()->recaptcha2_public_key, FALSE, array(), NULL, NULL, NULL, 'recaptcha2_public_key' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'recaptcha2_private_key', \IPS\Settings::i()->recaptcha2_private_key, FALSE, array(), NULL, NULL, NULL, 'recaptcha2_private_key' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'keycaptcha_privatekey', \IPS\Settings::i()->keycaptcha_privatekey, FALSE, array(), NULL, NULL, NULL, 'keycaptcha_privatekey' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'hcaptcha_sitekey', \IPS\Settings::i()->hcaptcha_sitekey, FALSE, array(), NULL, NULL, NULL, 'hcaptcha_sitekey' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'hcaptcha_secret', \IPS\Settings::i()->hcaptcha_secret, FALSE, array(), NULL, NULL, NULL, 'hcaptcha_secret' ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'guest_captcha', \IPS\Settings::i()->guest_captcha, FALSE, array(), NULL, NULL, NULL, 'guest_captcha' ) );
|
||||
static::captchaForm( $form );
|
||||
|
||||
/* Save values */
|
||||
if ( $form->values() )
|
||||
@@ -172,6 +188,35 @@ class _spam extends \IPS\Dispatcher\Controller
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \IPS\Helpers\Form $form
|
||||
* @return void
|
||||
*/
|
||||
public static function captchaForm( Form $form ): void
|
||||
{
|
||||
$form->add( new Radio( 'bot_antispam_type', Settings::i()->bot_antispam_type, TRUE, array(
|
||||
'options' => static::getCaptchaOptions( 'options' ),
|
||||
'toggles' => static::getCaptchaOptions( 'toggles' ),
|
||||
), NULL, NULL, NULL, 'bot_antispam_type' ) );
|
||||
$form->add( new Text( 'turnstile_site_key', Settings::i()->turnstile_site_key, id: 'turnstile_site_key' ) );
|
||||
$form->add( new Text( 'turnstile_secret_key', Settings::i()->turnstile_secret_key, id: 'turnstile_secret_key' ) );
|
||||
|
||||
if( \IPS\CIC )
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words['turnstile_secret_key_desc'] = \IPS\Member::loggedIn()->language()->addToStack('turnstile_secret_key_cloud_desc');
|
||||
}
|
||||
|
||||
$form->add( new Text( 'recaptcha2_public_key', Settings::i()->recaptcha2_public_key, FALSE, array(), NULL, NULL, NULL, 'recaptcha2_public_key' ) );
|
||||
$form->add( new Text( 'recaptcha2_private_key', Settings::i()->recaptcha2_private_key, FALSE, array(), NULL, NULL, NULL, 'recaptcha2_private_key' ) );
|
||||
if( \IPS\Settings::i()->bot_antispam_type == 'keycaptcha' )
|
||||
{
|
||||
$form->add( new Text( 'keycaptcha_privatekey', Settings::i()->keycaptcha_privatekey, FALSE, [], NULL, NULL, NULL, 'keycaptcha_privatekey' ) );
|
||||
}
|
||||
$form->add( new Text( 'hcaptcha_sitekey', Settings::i()->hcaptcha_sitekey, FALSE, array(), NULL, NULL, NULL, 'hcaptcha_sitekey' ) );
|
||||
$form->add( new Text( 'hcaptcha_secret', Settings::i()->hcaptcha_secret, FALSE, array(), NULL, NULL, NULL, 'hcaptcha_secret' ) );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Show spammer flagging settings
|
||||
*
|
||||
@@ -217,16 +262,16 @@ class _spam extends \IPS\Dispatcher\Controller
|
||||
$disabled = TRUE;
|
||||
if( !\IPS\Settings::i()->ipb_reg_number )
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words['spam_service_enabled_desc'] = \IPS\Member::loggedIn()->language()->addToStack( '__nulling_null_alert' ); //Changing error message to custom
|
||||
\IPS\Member::loggedIn()->language()->words['spam_service_enabled_desc'] = \IPS\Member::loggedIn()->language()->addToStack( '__ipbmafia__nulling_null_alert' ); //Changing error message to custom
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words['spam_service_enabled_desc'] = \IPS\Member::loggedIn()->language()->addToStack( '__nulling_null_alert' ); //Changing error message to custom
|
||||
\IPS\Member::loggedIn()->language()->words['spam_service_enabled_desc'] = \IPS\Member::loggedIn()->language()->addToStack( '__ipbmafia__nulling_null_alert' ); //Changing error message to custom
|
||||
}
|
||||
}
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'spam_service_enabled', 0, FALSE, array( 'disabled' => $disabled, 'togglesOn' => array( 'spam_service_send_to_ips', 'spam_service_action_0', 'spam_service_action_1', 'spam_service_action_2', 'spam_service_action_3', 'spam_service_action_4', 'spam_service_disposable' ) ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'spam_service_send_to_ips', 0, FALSE, array( 'disabled' => $disabled ), NULL, NULL, NULL, 'spam_service_send_to_ips' ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'spam_service_enabled', \IPS\Settings::i()->spam_service_enabled, FALSE, array( 'disabled' => $disabled, 'togglesOn' => array( 'spam_service_send_to_ips', 'spam_service_action_0', 'spam_service_action_1', 'spam_service_action_2', 'spam_service_action_3', 'spam_service_action_4', 'spam_service_disposable' ) ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'spam_service_send_to_ips', \IPS\Settings::i()->spam_service_send_to_ips, FALSE, array( 'disabled' => $disabled ), NULL, NULL, NULL, 'spam_service_send_to_ips' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Select( 'spam_service_action_1', \IPS\Settings::i()->spam_service_action_1, FALSE, array( 'disabled' => $disabled, 'options' => $actions, 'toggles' => array( '5' => array( 'spam_service_action_1_num' ) ) ), NULL, NULL, NULL, 'spam_service_action_1' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'spam_service_action_1_num', ( isset( $days[1] ) ? $days[1] : -1 ), FALSE, array( 'unlimited' => -1, 'unlimitedLang' => 'spam_service_action_unlimited_days'), NULL, NULL, \IPS\Member::loggedIn()->language()->addToStack('days'), 'spam_service_action_1_num' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Select( 'spam_service_action_2', \IPS\Settings::i()->spam_service_action_2, FALSE, array( 'disabled' => $disabled, 'options' => $actions, 'toggles' => array( '5' => array( 'spam_service_action_2_num' ) ) ), NULL, NULL, NULL, 'spam_service_action_2' ) );
|
||||
@@ -697,11 +742,11 @@ class _spam extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
if( !\IPS\Settings::i()->ipb_reg_number )
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words['spam_service_enabled_desc'] = \IPS\Member::loggedIn()->language()->addToStack( '__nulling_null_alert' ); //Changing error message to custom
|
||||
\IPS\Member::loggedIn()->language()->words['spam_service_enabled_desc'] = \IPS\Member::loggedIn()->language()->addToStack( '__ipbmafia__nulling_null_alert' ); //Changing error message to custom
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words['spam_service_enabled_desc'] = \IPS\Member::loggedIn()->language()->addToStack( '__nulling_null_alert' ); //Changing error message to custom
|
||||
\IPS\Member::loggedIn()->language()->words['spam_service_enabled_desc'] = \IPS\Member::loggedIn()->language()->addToStack( '__ipbmafia__nulling_null_alert' ); //Changing error message to custom
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -325,6 +325,11 @@ class _files extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
$cicDisabled[ $row['id'] ] = $row['id'];
|
||||
}
|
||||
|
||||
if ( $row['method'] == 'Amazon' AND \IPS\CIC AND json_decode( $row['configuration'], TRUE )['bucket'] == 'ips-cic-filestore' )
|
||||
{
|
||||
$cicDisabled[ $row['id'] ] = $row['id'];
|
||||
}
|
||||
}
|
||||
|
||||
$form = new \IPS\Helpers\Form;
|
||||
@@ -492,6 +497,18 @@ class _files extends \IPS\Dispatcher\Controller
|
||||
|
||||
$table->rowButtons = function( $row )
|
||||
{
|
||||
$config = json_decode( $row['configuration'], true );
|
||||
if( \IPS\CIC AND ( ( $row['method'] == 'Amazon' AND $config['bucket'] == 'ips-cic-filestore' ) OR $row['method'] == 'Cloud' ) )
|
||||
{
|
||||
return array(
|
||||
'log' => array(
|
||||
'icon' => 'search',
|
||||
'title' => 'file_config_log_title',
|
||||
'link' => \IPS\Http\Url::internal( "app=core&module=overview&controller=files&do=configurationLog&id={$row['id']}" )
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return array(
|
||||
'edit' => array(
|
||||
'icon' => 'pencil',
|
||||
@@ -576,6 +593,18 @@ class _files extends \IPS\Dispatcher\Controller
|
||||
$current = \IPS\Db::i()->select( '*', 'core_file_storage', array( 'id=?', \intval( \IPS\Request::i()->id ) ) )->first();
|
||||
$currentHandlerSettings = json_decode( $current['configuration'], TRUE );
|
||||
|
||||
/* If this is the special S3 handler for Cloud, throw error */
|
||||
if ( \IPS\CIC AND $current['method'] == 'Amazon' AND $currentHandlerSettings['bucket'] == 'ips-cic-filestore' )
|
||||
{
|
||||
throw new \UnderflowException;
|
||||
}
|
||||
|
||||
/* If this is CiC and is FileSystem, error */
|
||||
if ( \IPS\CIC AND $current['method'] == 'FileSystem' )
|
||||
{
|
||||
throw new \UnderflowException;
|
||||
}
|
||||
|
||||
if ( \in_array( \intval( \IPS\Request::i()->id ), array_filter( json_decode( \IPS\Settings::i()->upload_settings, TRUE ), function( $key ){ return $key != 'filestorage_move'; }, ARRAY_FILTER_USE_KEY ) ) )
|
||||
{
|
||||
if ( isset( \IPS\Request::i()->delete ) )
|
||||
@@ -626,6 +655,11 @@ class _files extends \IPS\Dispatcher\Controller
|
||||
$toggles = array();
|
||||
foreach ( \IPS\File::storageHandlers( $current ) as $key => $class )
|
||||
{
|
||||
if ( \IPS\CIC AND $key == 'Cloud' AND !\IPS\Member::loggedIn()->members_bitoptions['is_support_account'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$handlers[ $key ] = 'filehandler__' . $key;
|
||||
foreach ( $class::settings( $currentHandlerSettings ) as $k => $v )
|
||||
{
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
namespace IPS\core\modules\admin\overview;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
|
||||
use IPS\core\modules\admin\moderation\spam;
|
||||
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
@@ -205,6 +208,10 @@ class _onboard extends \IPS\Dispatcher\Controller
|
||||
/* Get the htaccess mod_Rewrite setting */
|
||||
$form->addTab( 'onboard_tab_furls' );
|
||||
\IPS\core\modules\admin\promotion\seo::htaccessSetting( $form );
|
||||
|
||||
/* Add captcha. */
|
||||
$form->addTab( 'onboard_tab_spamprevention' );
|
||||
spam::captchaForm( $form );
|
||||
}
|
||||
|
||||
/* Add the terms/privacy policy/etc. */
|
||||
|
||||
@@ -116,9 +116,16 @@ class _promote extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
try
|
||||
{
|
||||
$response = \IPS\Http\Url::external( "https://api-ssl.bitly.com/v3/shorten" )->setQueryString( array( 'access_token' => $val, 'longUrl' => 'https://www.invisioncommunity.com' ) )->request()->get()->decodeJson();
|
||||
$request = \IPS\Http\Url::external( "https://api-ssl.bitly.com/v4/shorten" )->request()
|
||||
->setHeaders([
|
||||
'Content-Type' => 'application/json',
|
||||
'Authorization' => 'Bearer ' . $val
|
||||
])
|
||||
->post( json_encode( [
|
||||
'long_url' => 'https://www.invisioncommunity.com',
|
||||
] ) );
|
||||
|
||||
if ( $response['status_code'] !== 200 )
|
||||
if ( (int) $request->httpResponseCode !== 201 )
|
||||
{
|
||||
throw new \DomainException("bitly_auth_failed");
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ class _seo extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'seo_manage' );
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'seo_furls' );
|
||||
|
||||
/* Get tab content */
|
||||
$this->activeTab = \IPS\Request::i()->tab ?: 'urls';
|
||||
@@ -189,6 +189,8 @@ class _seo extends \IPS\Dispatcher\Controller
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Codemirror( 'use_robotstxt_custom_editor', ( $value === 'custom' ? \IPS\Settings::i()->robots_txt : '' ), FALSE, [], NULL, NULL, NULL, 'use_robotstxt_custom_editor' ) );
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'seo_reduce_links', \IPS\Settings::i()->seo_reduce_links, TRUE, [], NULL, NULL, NULL, 'seo_reduce_links' ) );
|
||||
|
||||
/* Are we saving? */
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
@@ -199,7 +201,7 @@ class _seo extends \IPS\Dispatcher\Controller
|
||||
$value = $values['use_robotstxt_custom_editor'];
|
||||
}
|
||||
|
||||
$form->saveAsSettings( [ 'robots_txt' => $value ] );
|
||||
$form->saveAsSettings( [ 'robots_txt' => $value, 'seo_reduce_links' => $values['seo_reduce_links'] ] );
|
||||
|
||||
\IPS\Session::i()->log( 'acplog__robotstxt_edited' );
|
||||
|
||||
@@ -275,7 +277,10 @@ class _seo extends \IPS\Dispatcher\Controller
|
||||
/* Init */
|
||||
$form = new \IPS\Helpers\Form;
|
||||
$form->addMessage( 'sitemap_blurb', 'ipsMessage ipsMessage_info' );
|
||||
$form->add( new \IPS\Helpers\Form\Url( 'sitemap_url', \IPS\Settings::i()->sitemap_url ?: \IPS\Settings::i()->base_url . 'sitemap.php', FALSE ) );
|
||||
if( !\IPS\CIC )
|
||||
{
|
||||
$form->add( new \IPS\Helpers\Form\Url( 'sitemap_url', \IPS\Settings::i()->sitemap_url ?: \IPS\Settings::i()->base_url . 'sitemap.php', FALSE ) );
|
||||
}
|
||||
|
||||
/* Get extension settings */
|
||||
$useRecommendedSettings = TRUE;
|
||||
@@ -312,34 +317,37 @@ class _seo extends \IPS\Dispatcher\Controller
|
||||
/* Are we saving? */
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
if ( $values['sitemap_configuration_info'] )
|
||||
if( $values[ 'sitemap_configuration_info' ] )
|
||||
{
|
||||
$values = array_merge( $values, $recommendedSettings );
|
||||
}
|
||||
|
||||
try
|
||||
if( !\IPS\CIC )
|
||||
{
|
||||
if( !( $values['sitemap_url'] instanceof \IPS\Http\Url ) )
|
||||
try
|
||||
{
|
||||
throw new \RuntimeException;
|
||||
if( !( $values[ 'sitemap_url' ] instanceof \IPS\Http\Url ) )
|
||||
{
|
||||
throw new \RuntimeException;
|
||||
}
|
||||
$response = $values[ 'sitemap_url' ]->setQueryString( 'testsettings', 1 )->request()->get();
|
||||
|
||||
if( $response->httpResponseCode != 200 or !mb_strpos( $values[ 'sitemap_url' ], 'sitemap.php' ) )
|
||||
{
|
||||
$form->error = \IPS\Member::loggedIn()->language()->addToStack( 'invalid_sitemap_url' );
|
||||
}
|
||||
}
|
||||
|
||||
$response = $values['sitemap_url']->setQueryString( 'testsettings', 1 )->request()->get();
|
||||
|
||||
if ( $response->httpResponseCode != 200 or !mb_strpos( $values['sitemap_url'], "sitemap.php" ) )
|
||||
catch( \RuntimeException $e )
|
||||
{
|
||||
$form->error = \IPS\Member::loggedIn()->language()->addToStack( 'invalid_sitemap_url' );
|
||||
$form->error = \IPS\Member::loggedIn()->language()->addToStack( 'form_url_bad' );
|
||||
}
|
||||
|
||||
}
|
||||
catch ( \RuntimeException $e )
|
||||
{
|
||||
$form->error = \IPS\Member::loggedIn()->language()->addToStack( 'form_url_bad' );
|
||||
}
|
||||
|
||||
if( !$form->error )
|
||||
{
|
||||
$values['sitemap_url'] = (string) $values['sitemap_url'];
|
||||
if( isset( $values[ 'sitemap_url' ] ) )
|
||||
{
|
||||
$values['sitemap_url'] = (string) $values['sitemap_url'];
|
||||
}
|
||||
|
||||
|
||||
foreach( \IPS\Application::allExtensions( 'core', 'Sitemap', FALSE, 'core' ) as $extKey => $extension )
|
||||
{
|
||||
@@ -348,9 +356,10 @@ class _seo extends \IPS\Dispatcher\Controller
|
||||
$extension->saveSettings( $values );
|
||||
}
|
||||
}
|
||||
|
||||
$form->saveAsSettings( array( 'sitemap_url' => $values['sitemap_url'] ) );
|
||||
|
||||
if( !\IPS\CIC )
|
||||
{
|
||||
$form->saveAsSettings( ['sitemap_url' => $values[ 'sitemap_url' ]] );
|
||||
}
|
||||
/* Clear guest page caches */
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
|
||||
|
||||
@@ -354,6 +354,22 @@ class _dataLayer extends \IPS\Dispatcher\Controller
|
||||
|
||||
if ( $property['custom'] ?? 0 )
|
||||
{
|
||||
$defaults = [
|
||||
'pii' => false,
|
||||
'value' => null,
|
||||
'page_level' => true,
|
||||
'short' => "",
|
||||
'description' => "",
|
||||
'event_keys' => []
|
||||
];
|
||||
|
||||
foreach ( $defaults as $key => $value )
|
||||
{
|
||||
if ( !array_key_exists( $key, $property ) )
|
||||
{
|
||||
$property[$key] = $value;
|
||||
}
|
||||
}
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'datalayer_property_value', $property['value'], true ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'datalayer_property_page_level', $property['page_level'], true ) );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'datalayer_property_short', $property['short'], false, array( 'maxLength' => 50 ) ) );
|
||||
|
||||
@@ -10,6 +10,30 @@
|
||||
|
||||
namespace IPS\core\modules\admin\settings;
|
||||
|
||||
use IPS\core\AdminNotification;
|
||||
use IPS\DateTime;
|
||||
use IPS\Db;
|
||||
use IPS\Dispatcher;
|
||||
use IPS\Email;
|
||||
use IPS\File;
|
||||
use IPS\Helpers\Form;
|
||||
use IPS\Helpers\Form\Color;
|
||||
use IPS\Helpers\Form\Email as FormEmail;
|
||||
use IPS\Helpers\Form\Interval;
|
||||
use IPS\Helpers\Form\Radio;
|
||||
use IPS\Helpers\Form\Text;
|
||||
use IPS\Helpers\Form\TextArea;
|
||||
use IPS\Helpers\Form\Upload;
|
||||
use IPS\Helpers\Form\YesNo;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Member;
|
||||
use IPS\Output;
|
||||
use IPS\Request;
|
||||
use IPS\Session;
|
||||
use IPS\Settings;
|
||||
use IPS\Theme;
|
||||
use const IPS\DEMO_MODE;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
@@ -34,7 +58,7 @@ class _email extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'email_manage' );
|
||||
Dispatcher::i()->checkAcpPermission( 'email_manage' );
|
||||
parent::execute();
|
||||
}
|
||||
|
||||
@@ -48,32 +72,32 @@ class _email extends \IPS\Dispatcher\Controller
|
||||
/* Build the settings form */
|
||||
$messageHtml = '';
|
||||
|
||||
$settingsForm = new \IPS\Helpers\Form( 'settings_form' );
|
||||
$settingsForm = new Form( 'settings_form' );
|
||||
$settingsForm->addHeader( 'basic_settings' );
|
||||
$settingsForm->add( new \IPS\Helpers\Form\Email( 'email_out', \IPS\Settings::i()->email_out, TRUE, array(), NULL, NULL, NULL, 'email_out' ) );
|
||||
$settingsForm->add( new \IPS\Helpers\Form\Email( 'email_in', \IPS\Settings::i()->email_in, TRUE ) );
|
||||
$settingsForm->add( new \IPS\Helpers\Form\Color( 'email_color', \IPS\Settings::i()->email_color, TRUE ) );
|
||||
$settingsForm->add( new \IPS\Helpers\Form\Upload( 'email_logo', \IPS\Settings::i()->email_logo ? \IPS\File::get( 'core_Theme', \IPS\Settings::i()->email_logo ) : NULL, FALSE, array( 'image' => TRUE, 'storageExtension' => 'core_Theme' ) ) );
|
||||
$settingsForm->add( new \IPS\Helpers\Form\YesNo( 'social_links_in_email', \IPS\Settings::i()->social_links_in_email, FALSE, array(), NULL, NULL, NULL, 'social_links_in_email' ) );
|
||||
$settingsForm->add( new FormEmail( 'email_out', Settings::i()->email_out, TRUE, [], NULL, NULL, NULL, 'email_out' ) );
|
||||
$settingsForm->add( new FormEmail( 'email_in', Settings::i()->email_in, TRUE ) );
|
||||
$settingsForm->add( new Color( 'email_color', Settings::i()->email_color, TRUE ) );
|
||||
$settingsForm->add( new Upload( 'email_logo', Settings::i()->email_logo ? File::get( 'core_Theme', Settings::i()->email_logo ) : NULL, FALSE, [ 'image' => TRUE, 'storageExtension' => 'core_Theme' ] ) );
|
||||
$settingsForm->add( new YesNo( 'social_links_in_email', Settings::i()->social_links_in_email, FALSE, [], NULL, NULL, NULL, 'social_links_in_email' ) );
|
||||
|
||||
if ( \IPS\Settings::i()->promote_community_enabled )
|
||||
if ( Settings::i()->promote_community_enabled )
|
||||
{
|
||||
$settingsForm->add( new \IPS\Helpers\Form\YesNo( 'our_picks_in_email', \IPS\Settings::i()->our_picks_in_email, FALSE, array(), NULL, NULL, NULL, 'our_picks_in_email' ) );
|
||||
$settingsForm->add( new YesNo( 'our_picks_in_email', Settings::i()->our_picks_in_email, FALSE, [], NULL, NULL, NULL, 'our_picks_in_email' ) );
|
||||
}
|
||||
|
||||
$settingsForm->add( new \IPS\Helpers\Form\YesNo( 'email_truncate', ( \IPS\Settings::i()->email_truncate ), FALSE, array(), NULL, NULL, NULL, 'email_truncate' ) );
|
||||
$settingsForm->add( new \IPS\Helpers\Form\YesNo( 'email_log_do', ( \IPS\Settings::i()->prune_log_emailstats != 0 ), FALSE, array( 'togglesOn' => array( 'prune_log_emailstats' ) ), NULL, NULL, NULL, 'email_log_do' ) );
|
||||
$settingsForm->add( new \IPS\Helpers\Form\Interval( 'prune_log_emailstats', \IPS\Settings::i()->prune_log_emailstats ?: 60, FALSE, array( 'valueAs' => 'd', 'unlimited' => '-1', 'unlimitedLang' => 'never' ), NULL, NULL, NULL, 'prune_log_emailstats' ) );
|
||||
if ( !\IPS\DEMO_MODE )
|
||||
$settingsForm->add( new YesNo( 'email_truncate', ( Settings::i()->email_truncate ), FALSE, [], NULL, NULL, NULL, 'email_truncate' ) );
|
||||
$settingsForm->add( new YesNo( 'email_log_do', ( Settings::i()->prune_log_emailstats != 0 ), FALSE, [ 'togglesOn' => [ 'prune_log_emailstats' ] ], NULL, NULL, NULL, 'email_log_do' ) );
|
||||
$settingsForm->add( new Interval( 'prune_log_emailstats', Settings::i()->prune_log_emailstats ?: 60, FALSE, [ 'valueAs' => 'd', 'unlimited' => '-1', 'unlimitedLang' => 'never' ], NULL, NULL, NULL, 'prune_log_emailstats' ) );
|
||||
if ( !DEMO_MODE )
|
||||
{
|
||||
$settingsForm->addHeader( 'advanced_settings' );
|
||||
|
||||
$method = \IPS\Settings::i()->mail_method;
|
||||
$disabled = array();
|
||||
$method = Settings::i()->mail_method;
|
||||
$disabled = [];
|
||||
|
||||
if ( \IPS\Settings::i()->sendgrid_api_key AND \IPS\Settings::i()->sendgrid_use_for > 0 )
|
||||
if ( Settings::i()->sendgrid_api_key AND Settings::i()->sendgrid_use_for > 0 )
|
||||
{
|
||||
if ( \IPS\Settings::i()->sendgrid_use_for == 2 )
|
||||
if ( Settings::i()->sendgrid_use_for == 2 )
|
||||
{
|
||||
$method = 'sendgrid';
|
||||
}
|
||||
@@ -89,23 +113,49 @@ class _email extends \IPS\Dispatcher\Controller
|
||||
$method = 'php';
|
||||
}
|
||||
|
||||
$settingsForm->add( new \IPS\Helpers\Form\Radio( 'mail_method', $method, TRUE, array(
|
||||
'options' => array( 'php' => ( \IPS\CIC ? 'mail_method_cic' : 'mail_method_php' ), 'smtp' => 'mail_method_smtp', 'sendgrid' => 'mail_method_sendgrid' ),
|
||||
'disabled' => $disabled,
|
||||
'toggles' => array(
|
||||
'php' => array( 'php_mail_extra' ),
|
||||
'smtp' => array( 'smtp_host', 'smtp_port', 'smtp_user', 'smtp_pass', 'smtp_helo', 'smtp_protocol' ),
|
||||
)
|
||||
) ) );
|
||||
$options = array( 'plain' => 'smtp_plaintext', 'ssl' => 'smtp_ssl', 'tls' => 'smtp_tls' );
|
||||
$settingsForm->add( new \IPS\Helpers\Form\Text( 'smtp_host', \IPS\Settings::i()->smtp_host, FALSE, array(), NULL, NULL, NULL, 'smtp_host' ) );
|
||||
$settingsForm->add( new \IPS\Helpers\Form\Select( 'smtp_protocol', \IPS\Settings::i()->smtp_protocol, FALSE, array( 'options' => $options ), NULL, NULL, NULL, 'smtp_protocol' ) );
|
||||
$settingsForm->add( new \IPS\Helpers\Form\Number( 'smtp_port', \IPS\Settings::i()->smtp_port, FALSE, array(), NULL, NULL, NULL, 'smtp_port' ) );
|
||||
$settingsForm->add( new \IPS\Helpers\Form\Text( 'smtp_user', \IPS\Settings::i()->smtp_user, FALSE, array(), NULL, NULL, NULL, 'smtp_user' ) );
|
||||
$settingsForm->add( new \IPS\Helpers\Form\Password( 'smtp_pass', \IPS\Settings::i()->smtp_pass, FALSE, array( 'enforceMaxLimit' => FALSE ), NULL, NULL, NULL, 'smtp_pass' ) );
|
||||
if ( !\IPS\CIC )
|
||||
$debug = FALSE;
|
||||
if( Email::classToUse( Email::TYPE_TRANSACTIONAL ) == 'IPS\\Email\\Outgoing\\Debug' )
|
||||
{
|
||||
$settingsForm->add( new \IPS\Helpers\Form\Text( 'php_mail_extra', \IPS\Settings::i()->php_mail_extra, FALSE, array(), NULL, NULL, NULL, 'php_mail_extra' ) );
|
||||
$debug = true;
|
||||
$method = 'debug';
|
||||
}
|
||||
|
||||
$mailOptions = $toggles = $fields = [];
|
||||
foreach( Email::outgoingHandlers() as $key => $handler )
|
||||
{
|
||||
if( ! $handler::isUsable( Email::TYPE_TRANSACTIONAL ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$mailOptions[ $key ] = 'mail_method_' . $key;
|
||||
|
||||
$formFields = $handler::form();
|
||||
$toggles[ $key ] = array_keys( $formFields );
|
||||
$fields = $fields + $formFields;
|
||||
}
|
||||
|
||||
/* Change value back to default for platform */
|
||||
if( !\in_array( $method, array_keys( $mailOptions ) ) )
|
||||
{
|
||||
$method = \IPS\CIC ? 'cloud' : 'php';
|
||||
}
|
||||
|
||||
if( !$debug )
|
||||
{
|
||||
$settingsForm->add( new Radio( 'mail_method', $method, TRUE, [
|
||||
'options' => $mailOptions,
|
||||
'disabled' => $disabled,
|
||||
'toggles' => $toggles
|
||||
] ) );
|
||||
|
||||
foreach( $fields as $f )
|
||||
{
|
||||
$settingsForm->add( $f );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$settingsForm->addDummy( 'mail_method', Member::loggedIn()->language()->addToStack('mail_method_debug', false, [ 'sprintf' => [ \IPS\EMAIL_DEBUG_PATH ] ] ) );
|
||||
}
|
||||
}
|
||||
if ( $values = $settingsForm->values() )
|
||||
@@ -114,7 +164,7 @@ class _email extends \IPS\Dispatcher\Controller
|
||||
|
||||
foreach( array( 'mail_method', 'smtp_host', 'smtp_port', 'smtp_pass', 'smtp_user', 'php_mail_extra', 'smtp_protocol' ) as $setting )
|
||||
{
|
||||
if( $values[ $setting ] != \IPS\Settings::i()->$setting )
|
||||
if( isset( $values[ $setting ] ) AND $values[ $setting ] != Settings::i()->$setting )
|
||||
{
|
||||
$sendTestEmail = TRUE;
|
||||
}
|
||||
@@ -126,14 +176,11 @@ class _email extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
unset( $values['email_log_do'] );
|
||||
|
||||
if ( $values['mail_method'] != 'sendgrid' and \IPS\Settings::i()->sendgrid_use_for == 2 )
|
||||
|
||||
/* Allow individual handlers to save settings */
|
||||
foreach( Email::outgoingHandlers() as $key => $handler )
|
||||
{
|
||||
$values['sendgrid_use_for'] = 1;
|
||||
}
|
||||
elseif ( $values['mail_method'] == 'sendgrid' )
|
||||
{
|
||||
$values['sendgrid_use_for'] = 2;
|
||||
$values = $handler::processSettings( $values );
|
||||
}
|
||||
|
||||
if ( $values['email_logo'] )
|
||||
@@ -142,57 +189,56 @@ class _email extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
$settingsForm->saveAsSettings( $values );
|
||||
\IPS\Session::i()->log( 'acplogs__email_settings' );
|
||||
Session::i()->log( 'acplogs__email_settings' );
|
||||
|
||||
if( $sendTestEmail )
|
||||
{
|
||||
$email = \IPS\Email::buildFromContent( \IPS\Member::loggedIn()->language()->get('email_test_subject'), \IPS\Member::loggedIn()->language()->addToStack('email_test_message'), \IPS\Member::loggedIn()->language()->addToStack('email_test_message'), \IPS\Email::TYPE_TRANSACTIONAL );
|
||||
$email = Email::buildFromContent( Member::loggedIn()->language()->get('email_test_subject'), Member::loggedIn()->language()->addToStack('email_test_message'), Member::loggedIn()->language()->addToStack('email_test_message'), Email::TYPE_BULK );
|
||||
|
||||
try
|
||||
{
|
||||
$result = $email->_send( \IPS\Member::loggedIn(), array(), array(), \IPS\Settings::i()->email_out );
|
||||
$messageHtml = \IPS\Theme::i()->getTemplate( 'global', 'core', 'global' )->message( 'email_test_okay_auto', 'success' );
|
||||
$email->_send( Member::loggedIn(), fromEmail: Settings::i()->email_out );
|
||||
$messageHtml = Theme::i()->getTemplate( 'global', 'core', 'global' )->message( 'email_test_okay_auto', 'success' );
|
||||
|
||||
/* Sent successfully, remove notification */
|
||||
\IPS\core\AdminNotification::remove( 'core', 'ConfigurationError', 'failedMail' );
|
||||
\IPS\Db::i()->update( 'core_mail_error_logs', array( 'mlog_notification_sent' => TRUE ) );
|
||||
AdminNotification::remove( 'core', 'ConfigurationError', 'failedMail' );
|
||||
Db::i()->update( 'core_mail_error_logs', [ 'mlog_notification_sent' => TRUE ] );
|
||||
}
|
||||
catch ( \Exception $e )
|
||||
{
|
||||
$messageHtml = \IPS\Theme::i()->getTemplate( 'global', 'core', 'global' )->message( 'email_test_error_auto', 'error', $e->getMessage() );
|
||||
$messageHtml = Theme::i()->getTemplate( 'global', 'core', 'global' )->message( 'email_test_error_auto', 'error', $e->getMessage() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Build the test form */
|
||||
$testFormHtml = '';
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'settings', 'email_test' ) )
|
||||
if ( !DEMO_MODE AND Member::loggedIn()->hasAcpRestriction( 'core', 'settings', 'email_test' ) )
|
||||
{
|
||||
\IPS\Output::i()->sidebar['actions']['test'] = array(
|
||||
Output::i()->sidebar['actions']['test'] = array(
|
||||
'title' => 'email_test',
|
||||
'icon' => 'cog',
|
||||
'link' => \IPS\Http\Url::internal( '#testForm' ),
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('email_test'), 'ipsDialog-content' => '#testForm' )
|
||||
'link' => Url::internal( '#testForm' ),
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => Member::loggedIn()->language()->addToStack('email_test'), 'ipsDialog-content' => '#testForm' )
|
||||
);
|
||||
|
||||
$testForm = new \IPS\Helpers\Form( 'test_form' );
|
||||
$testForm->add( new \IPS\Helpers\Form\Email( 'from', \IPS\Settings::i()->email_out, TRUE ) );
|
||||
$testForm->add( new \IPS\Helpers\Form\Email( 'to', \IPS\Member::loggedIn()->email, TRUE ) );
|
||||
$testForm->add( new \IPS\Helpers\Form\Text( 'subject', \IPS\Member::loggedIn()->language()->addToStack('email_test_subject'), TRUE ) );
|
||||
$testForm->add( new \IPS\Helpers\Form\TextArea( 'message', \IPS\Member::loggedIn()->language()->addToStack('email_test_message'), TRUE ) );
|
||||
$testForm = new Form( 'test_form' );
|
||||
$testForm->add( new FormEmail( 'from', Settings::i()->email_out, TRUE ) );
|
||||
$testForm->add( new FormEmail( 'to', Member::loggedIn()->email, TRUE ) );
|
||||
$testForm->add( new Text( 'subject', Member::loggedIn()->language()->addToStack('email_test_subject'), TRUE ) );
|
||||
$testForm->add( new TextArea( 'message', Member::loggedIn()->language()->addToStack('email_test_message'), TRUE ) );
|
||||
if ( $values = $testForm->values() )
|
||||
{
|
||||
try
|
||||
{
|
||||
$email = \IPS\Email::buildFromContent( $values['subject'], $values['message'], $values['message'], \IPS\Email::TYPE_TRANSACTIONAL );
|
||||
$result = $email->_send( $values['to'], array(), array(), $values['from'] );
|
||||
$email = Email::buildFromContent( $values['subject'], $values['message'], $values['message'], Email::TYPE_BULK );
|
||||
$email->_send( $values['to'], fromEmail: $values['from'] );
|
||||
|
||||
/* Sent successfully, remove notification */
|
||||
\IPS\core\AdminNotification::remove( 'core', 'ConfigurationError', 'failedMail' );
|
||||
\IPS\Db::i()->update( 'core_mail_error_logs', array( 'mlog_notification_sent' => TRUE ) );
|
||||
AdminNotification::remove( 'core', 'ConfigurationError', 'failedMail' );
|
||||
Db::i()->update( 'core_mail_error_logs', array( 'mlog_notification_sent' => TRUE ) );
|
||||
|
||||
$messageHtml = \IPS\Theme::i()->getTemplate( 'global', 'core', 'global' )->message( 'email_test_okay', 'success' );
|
||||
$messageHtml = Theme::i()->getTemplate( 'global', 'core', 'global' )->message( 'email_test_okay', 'success' );
|
||||
}
|
||||
catch ( \Exception $exception )
|
||||
{
|
||||
@@ -201,28 +247,28 @@ class _email extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
$content = \get_class( $exception ) . ": " . $exception->getMessage() . " (" . $exception->getCode() . ")";
|
||||
}
|
||||
$messageHtml = \IPS\Theme::i()->getTemplate( 'global', 'core', 'global' )->message( $content, 'error' );
|
||||
$messageHtml = Theme::i()->getTemplate( 'global', 'core', 'global' )->message( $content ?: 'email_test_error_auto', 'error' );
|
||||
}
|
||||
}
|
||||
|
||||
$testFormHtml = \IPS\Theme::i()->getTemplate( 'global' )->block( 'email_test', $testForm, FALSE, 'ipsJS_hide', 'testForm' );
|
||||
$testFormHtml = Theme::i()->getTemplate( 'global' )->block( 'email_test', $testForm, FALSE, 'ipsJS_hide', 'testForm' );
|
||||
}
|
||||
|
||||
/* Add a button for logs */
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'settings', 'email_errorlog' ) )
|
||||
if ( Member::loggedIn()->hasAcpRestriction( 'core', 'settings', 'email_errorlog' ) )
|
||||
{
|
||||
\IPS\Output::i()->sidebar['actions']['errorLog'] = array(
|
||||
Output::i()->sidebar['actions']['errorLog'] = array(
|
||||
'title' => 'emailerrorlogs',
|
||||
'icon' => 'exclamation-triangle',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=settings&controller=email&do=errorLog' ),
|
||||
'link' => Url::internal( 'app=core&module=settings&controller=email&do=errorLog' ),
|
||||
);
|
||||
}
|
||||
|
||||
/* Display */
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('email_settings');
|
||||
\IPS\Output::i()->output = $messageHtml;
|
||||
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate( 'global' )->block( 'email_settings', $settingsForm );
|
||||
\IPS\Output::i()->output .= $testFormHtml;
|
||||
Output::i()->title = Member::loggedIn()->language()->addToStack('email_settings');
|
||||
Output::i()->output = $messageHtml;
|
||||
Output::i()->output .= Theme::i()->getTemplate( 'global' )->block( 'email_settings', $settingsForm );
|
||||
Output::i()->output .= $testFormHtml;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -232,34 +278,34 @@ class _email extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
protected function errorLog()
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'email_errorlog' );
|
||||
Dispatcher::i()->checkAcpPermission( 'email_errorlog' );
|
||||
|
||||
/* Add a button for settings */
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'settings', 'email_errorlog_prune' ) )
|
||||
if ( Member::loggedIn()->hasAcpRestriction( 'core', 'settings', 'email_errorlog_prune' ) )
|
||||
{
|
||||
\IPS\Output::i()->sidebar['actions'] = array(
|
||||
Output::i()->sidebar['actions'] = array(
|
||||
'settings' => array(
|
||||
'title' => 'prunesettings',
|
||||
'icon' => 'cog',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=settings&controller=email&do=errorLogSettings' ),
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('prunesettings') )
|
||||
'link' => Url::internal( 'app=core&module=settings&controller=email&do=errorLogSettings' ),
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => Member::loggedIn()->language()->addToStack('prunesettings') )
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/* Display */
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('emailerrorlogs');
|
||||
\IPS\Output::i()->output = (string) static::emailErrorLogTable( \IPS\Http\Url::internal( 'app=core&module=settings&controller=email&do=errorLog' ) );
|
||||
Output::i()->title = Member::loggedIn()->language()->addToStack('emailerrorlogs');
|
||||
Output::i()->output = (string) static::emailErrorLogTable( Url::internal( 'app=core&module=settings&controller=email&do=errorLog' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get email error log table
|
||||
*
|
||||
* @param \IPS\Http\Url $url Base URL for table
|
||||
* @param Url $url Base URL for table
|
||||
* @param array $where Where Array
|
||||
* @return \IPS\Helpers\Table\Db
|
||||
*/
|
||||
public static function emailErrorLogTable( \IPS\Http\Url $url, array $where=array() ): \IPS\Helpers\Table\Db
|
||||
public static function emailErrorLogTable( Url $url, array $where=array() ): \IPS\Helpers\Table\Db
|
||||
{
|
||||
/* Create the table */
|
||||
$table = new \IPS\Helpers\Table\Db( 'core_mail_error_logs', $url, $where );
|
||||
@@ -287,13 +333,13 @@ class _email extends \IPS\Dispatcher\Controller
|
||||
$table->parsers = array(
|
||||
'mlog_date' => function( $val, $row )
|
||||
{
|
||||
return \IPS\DateTime::ts( $val );
|
||||
return DateTime::ts( $val );
|
||||
},
|
||||
'mlog_msg' => function( $val, $row )
|
||||
{
|
||||
if( !$val )
|
||||
{
|
||||
$val = \IPS\Member::loggedIn()->language()->get('phpmail_not_sent');
|
||||
$val = Member::loggedIn()->language()->get('phpmail_not_sent');
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -303,17 +349,17 @@ class _email extends \IPS\Dispatcher\Controller
|
||||
if( isset( $data['message'] ) )
|
||||
{
|
||||
$val = \is_string( $data['message'] ) ?
|
||||
( ( isset( $data['details'] ) AND $data['details'] ) ? \IPS\Member::loggedIn()->language()->addToStack( $data['message'], FALSE, array( 'sprintf' => $data['details'] ) ) : \IPS\Member::loggedIn()->language()->addToStack( $data['message'] ) ) :
|
||||
( ( isset( $data['details'] ) AND $data['details'] ) ? Member::loggedIn()->language()->addToStack( $data['message'], FALSE, array( 'sprintf' => $data['details'] ) ) : Member::loggedIn()->language()->addToStack( $data['message'] ) ) :
|
||||
$val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return \IPS\Theme::i()->getTemplate( 'logs' )->emailErrorLog( nl2br( htmlspecialchars( $val, ENT_DISALLOWED, 'UTF-8', FALSE ) ), $row );
|
||||
return Theme::i()->getTemplate( 'logs' )->emailErrorLog( nl2br( htmlspecialchars( $val, ENT_DISALLOWED, 'UTF-8', FALSE ) ), $row );
|
||||
},
|
||||
'mlog_content' => function( $val, $row )
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate( 'logs' )->emailErrorBody( $val, $row );
|
||||
return Theme::i()->getTemplate( 'logs' )->emailErrorBody( $val, $row );
|
||||
},
|
||||
);
|
||||
|
||||
@@ -325,15 +371,15 @@ class _email extends \IPS\Dispatcher\Controller
|
||||
$return['view'] = array(
|
||||
'icon' => 'search',
|
||||
'title' => 'view_email_error_body',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=settings&controller=email&do=errorLogView&id=' ) . $row['mlog_id'],
|
||||
'link' => Url::internal( 'app=core&module=settings&controller=email&do=errorLogView&id=' ) . $row['mlog_id'],
|
||||
'hotkey' => 'Return',
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('emailerrorlogs_mlog_content') )
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => Member::loggedIn()->language()->addToStack('emailerrorlogs_mlog_content') )
|
||||
);
|
||||
|
||||
$return['resend'] = array(
|
||||
'icon' => 'refresh',
|
||||
'title' => 'resend_email_error',
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=settings&controller=email&do=errorLogResend&id=' . $row['mlog_id'] )->csrf(),
|
||||
'link' => Url::internal( 'app=core&module=settings&controller=email&do=errorLogResend&id=' . $row['mlog_id'] )->csrf(),
|
||||
);
|
||||
|
||||
return $return;
|
||||
@@ -350,11 +396,11 @@ class _email extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
public function errorLogResend()
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'email_errorlog' );
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
Dispatcher::i()->checkAcpPermission( 'email_errorlog' );
|
||||
Session::i()->csrfCheck();
|
||||
|
||||
$id = (int) \IPS\Request::i()->id;
|
||||
$log = \IPS\Db::i()->select( '*', 'core_mail_error_logs', array( 'mlog_id=?', $id ) )->first();
|
||||
$id = (int) Request::i()->id;
|
||||
$log = Db::i()->select( '*', 'core_mail_error_logs', array( 'mlog_id=?', $id ) )->first();
|
||||
$emailData = json_decode( $log['mlog_resend_data'], true );
|
||||
|
||||
try
|
||||
@@ -370,7 +416,7 @@ class _email extends \IPS\Dispatcher\Controller
|
||||
unset( $emailData['headers']['Content-Type'] );
|
||||
unset( $emailData['headers']['Content-Transfer-Encoding'] );
|
||||
|
||||
$email = \IPS\Email::buildFromContent( $log['mlog_subject'], $emailData['body']['html'], $emailData['body']['plain'], isset( $emailData['type'] ) ? $emailData['type'] : \IPS\Email::TYPE_TRANSACTIONAL );
|
||||
$email = Email::buildFromContent( $log['mlog_subject'], $emailData['body']['html'], $emailData['body']['plain'], isset( $emailData['type'] ) ? $emailData['type'] : Email::TYPE_TRANSACTIONAL );
|
||||
$email->_send(
|
||||
array_map( 'trim', explode( ',', $log['mlog_to'] ) ),
|
||||
isset( $emailData['headers']['Cc'] ) ? array_map( 'trim', explode( ',', $emailData['headers']['Cc'] ) ) : array(),
|
||||
@@ -382,19 +428,19 @@ class _email extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
catch( \Exception $e )
|
||||
{
|
||||
\IPS\Output::i()->error( $e->getMessage(), '4C143/1', 500, '' );
|
||||
Output::i()->error( $e->getMessage(), '4C143/1', 500, '' );
|
||||
}
|
||||
|
||||
\IPS\Db::i()->delete( 'core_mail_error_logs', array( 'mlog_id=?', $id ) );
|
||||
Db::i()->delete( 'core_mail_error_logs', array( 'mlog_id=?', $id ) );
|
||||
|
||||
/* Remove notification since this was re-sent with success and it is below the recent threshold */
|
||||
if( \IPS\Email::countFailedMail( \IPS\DateTime::create()->sub( new \DateInterval( 'P3D' ) ), FALSE, TRUE ) <= 3 )
|
||||
if( Email::countFailedMail( DateTime::create()->sub( new \DateInterval( 'P3D' ) ), FALSE, TRUE ) <= 3 )
|
||||
{
|
||||
\IPS\core\AdminNotification::remove( 'core', 'ConfigurationError', 'failedMail' );
|
||||
\IPS\Db::i()->update( 'core_mail_error_logs', array( 'mlog_notification_sent' => TRUE ), array( 'mlog_id=?', $id ) );
|
||||
AdminNotification::remove( 'core', 'ConfigurationError', 'failedMail' );
|
||||
Db::i()->update( 'core_mail_error_logs', array( 'mlog_notification_sent' => TRUE ), array( 'mlog_id=?', $id ) );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=settings&controller=email&do=errorLog" ), 'emailerror_resent' );
|
||||
Output::i()->redirect( Url::internal( "app=core&module=settings&controller=email&do=errorLog" ), 'emailerror_resent' );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -404,12 +450,12 @@ class _email extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
public function errorLogView()
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'email_errorlog' );
|
||||
Dispatcher::i()->checkAcpPermission( 'email_errorlog' );
|
||||
|
||||
$id = (int) \IPS\Request::i()->id;
|
||||
$log = \IPS\Db::i()->select( '*', 'core_mail_error_logs', array( 'mlog_id=?', $id ) )->first();
|
||||
$id = (int) Request::i()->id;
|
||||
$log = Db::i()->select( '*', 'core_mail_error_logs', array( 'mlog_id=?', $id ) )->first();
|
||||
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('logs')->emailErrorBody( $log );
|
||||
Output::i()->output = Theme::i()->getTemplate('logs')->emailErrorBody( $log );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -419,19 +465,19 @@ class _email extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
protected function errorLogSettings()
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'email_errorlog_prune' );
|
||||
Dispatcher::i()->checkAcpPermission( 'email_errorlog_prune' );
|
||||
|
||||
$form = new \IPS\Helpers\Form;
|
||||
$form->add( new \IPS\Helpers\Form\Interval( 'prune_log_email_error', \IPS\Settings::i()->prune_log_email_error, FALSE, array( 'valueAs' => \IPS\Helpers\Form\Interval::DAYS, 'unlimited' => 0, 'unlimitedLang' => 'never' ), NULL, \IPS\Member::loggedIn()->language()->addToStack('after'), NULL, 'prune_log_email_error' ) );
|
||||
$form = new Form;
|
||||
$form->add( new Interval( 'prune_log_email_error', Settings::i()->prune_log_email_error, FALSE, array( 'valueAs' => Interval::DAYS, 'unlimited' => 0, 'unlimitedLang' => 'never' ), NULL, Member::loggedIn()->language()->addToStack('after'), NULL, 'prune_log_email_error' ) );
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
$form->saveAsSettings();
|
||||
\IPS\Session::i()->log( 'acplog__emailerrorlog_settings' );
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=settings&controller=email&do=errorLog' ), 'saved' );
|
||||
Session::i()->log( 'acplog__emailerrorlog_settings' );
|
||||
Output::i()->redirect( Url::internal( 'app=core&module=settings&controller=email&do=errorLog' ), 'saved' );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('emailerrorlogssettings');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('global')->block( 'emailerrorlogssettings', $form, FALSE );
|
||||
Output::i()->title = Member::loggedIn()->language()->addToStack('emailerrorlogssettings');
|
||||
Output::i()->output = Theme::i()->getTemplate('global')->block( 'emailerrorlogssettings', $form, FALSE );
|
||||
}
|
||||
}
|
||||
@@ -60,11 +60,7 @@ class _general extends \IPS\Dispatcher\Controller
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'site_site_elsewhere', \IPS\Settings::i()->site_site_elsewhere, FALSE, [ 'togglesOn' => [ 'site_main_url', 'site_main_title' ] ] ) );
|
||||
$form->add( new \IPS\Helpers\Form\Url( 'site_main_url', \IPS\Settings::i()->site_main_url, FALSE, [], NULL, NULL, NULL, 'site_main_url' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'site_main_title', \IPS\Settings::i()->site_main_title, FALSE, [], NULL, NULL, NULL, 'site_main_title' ) );
|
||||
/* $form->add( new \IPS\Helpers\Form\CheckboxSet( 'diagnostics_reporting', array( 'usage' => ( (bool) \IPS\Settings::i()->usage_reporting ), 'diagnostics' => ( (bool) \IPS\Settings::i()->diagnostics_reporting ) ), FALSE, array( 'options' => array(
|
||||
'usage' => 'diagnostics_reporting_usage',
|
||||
'diagnostics' => 'diagnostics_reporting_diagnostics',
|
||||
) ) ) ); */
|
||||
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
\IPS\Lang::saveCustom( 'core', "copyright_line_value", $values['copyright_line'] );
|
||||
@@ -78,11 +74,7 @@ class _general extends \IPS\Dispatcher\Controller
|
||||
} ) );
|
||||
|
||||
$values['site_address'] = json_encode( $values['site_address'] );
|
||||
|
||||
// $values['usage_reporting'] = \in_array( 'usage', $values['diagnostics_reporting'] );
|
||||
// $values['diagnostics_reporting'] = \in_array( 'diagnostics', $values['diagnostics_reporting'] );
|
||||
// \IPS\Db::i()->update( 'core_tasks', array( 'enabled' => \intval( $values['usage_reporting'] ) ), array( '`key`=?', 'usagereporting' ) );
|
||||
|
||||
|
||||
$form->saveAsSettings( $values );
|
||||
|
||||
if ( $values['site_online'] )
|
||||
|
||||
@@ -242,7 +242,7 @@ class _login extends \IPS\Node\Controller
|
||||
}
|
||||
|
||||
/* Clear caches */
|
||||
unset( \IPS\Data\Store::i()->loginMethods );
|
||||
unset( \IPS\Data\Store::i()->loginMethods, \IPS\Data\Store::i()->essentialCookieNames );
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
|
||||
/* Toggle */
|
||||
@@ -297,12 +297,18 @@ class _login extends \IPS\Node\Controller
|
||||
|
||||
/* Build Form */
|
||||
$form = new \IPS\Helpers\Form();
|
||||
$form->addHeader( 'ipb_bruteforce_attempts' );
|
||||
$form->addHeader( 'ipb_bruteforce_attempts_title' );
|
||||
$form->addMessage( 'ipb_bruteforce_attempts_block_desc', 'ipsMessage ipsMessage_info' );
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'ipb_bruteforce_attempts', \IPS\Settings::i()->ipb_bruteforce_attempts, FALSE, array( 'min' => 0, 'unlimited' => 0, 'unlimitedLang' => 'never' ), NULL, \IPS\Member::loggedIn()->language()->addToStack('after'), \IPS\Member::loggedIn()->language()->addToStack('failed_logins'), 'ipb_bruteforce_attempts' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Interval( 'ipb_bruteforce_period', \IPS\Settings::i()->ipb_bruteforce_period, FALSE, array( 'valueAs' => \IPS\Helpers\Form\Interval::MINUTES, 'min' => 0, 'max' => 10000, 'unlimited' => 0, 'unlimitedLang' => 'never' ), NULL, \IPS\Member::loggedIn()->language()->addToStack('after'), NULL, 'ipb_bruteforce_period' ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'ipb_bruteforce_unlock', \IPS\Settings::i()->ipb_bruteforce_unlock, FALSE, array(), NULL, NULL, NULL, 'ipb_bruteforce_unlock' ) );
|
||||
$form->addHeader( 'bruteforce_global_attempts_title' );
|
||||
$form->addMessage( 'bruteforce_global_attempts_block_desc', 'ipsMessage ipsMessage_info' );
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'bruteforce_global_attempts', \IPS\Settings::i()->bruteforce_global_attempts, FALSE, array( 'min' => 5 ), NULL, \IPS\Member::loggedIn()->language()->addToStack('after'), \IPS\Member::loggedIn()->language()->addToStack('failed_logins'), 'bruteforce_global_attempts' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Interval( 'bruteforce_global_period', \IPS\Settings::i()->bruteforce_global_period, FALSE, array( 'valueAs' => \IPS\Helpers\Form\Interval::MINUTES, 'min' => 0, 'max' => 10000 ), NULL, \IPS\Member::loggedIn()->language()->addToStack('after'), NULL, 'bruteforce_global_period' ) );
|
||||
$form->addHeader( 'login_settings' );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'new_device_email', \IPS\Settings::i()->new_device_email, FALSE ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'login_after_inactivity_notification', \IPS\Settings::i()->login_after_inactivity_notification, FALSE ) );
|
||||
|
||||
/* Save */
|
||||
if ( $values = $form->values() )
|
||||
@@ -310,7 +316,8 @@ class _login extends \IPS\Node\Controller
|
||||
/* unlock all locked members if we have disabled the locking */
|
||||
if ( \IPS\Settings::i()->ipb_bruteforce_attempts > 0 AND $values['ipb_bruteforce_attempts'] == 0 )
|
||||
{
|
||||
\IPS\Member::updateAllMembers( array( 'failed_logins' => NULL , 'failed_login_count' => 0 ) );
|
||||
\IPS\Member::updateAllMembers( array( 'failed_login_count' => 0 ) );
|
||||
\IPS\Db::i()->delete( 'core_login_failures', [ 'login_member_id IS NOT NULL' ] );
|
||||
|
||||
/* disable task */
|
||||
\IPS\Db::i()->update( 'core_tasks', array( 'enabled' => 0 ), "`key`='unlockmembers'" );
|
||||
@@ -360,7 +367,7 @@ class _login extends \IPS\Node\Controller
|
||||
protected function _registration()
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'registration_settings' );
|
||||
|
||||
|
||||
/* Build Form */
|
||||
$form = new \IPS\Helpers\Form();
|
||||
$form->addHeader('registration_standard_settings');
|
||||
@@ -438,9 +445,10 @@ class _login extends \IPS\Node\Controller
|
||||
/* Redirect */
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=settings&controller=login&tab=registration' ), 'saved' );
|
||||
}
|
||||
$desc = \IPS\Theme::i()->getTemplate( 'global', 'core' )->message( \IPS\Member::loggedIn()->language()->addToStack('registration_default_group_info', NULL, [ 'sprintf' => [\IPS\Member\Group::load( \IPS\Settings::i()->member_group )->formattedName ] ] ), 'info' );
|
||||
|
||||
/* Display */
|
||||
return (string) $form;
|
||||
return (string) $desc . $form;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -121,7 +121,23 @@ class _posting extends \IPS\Dispatcher\Controller
|
||||
$form->addHeader('posting_images');
|
||||
$form->add( new \IPS\Helpers\Form\WidthHeight( 'attachment_resample_size', \IPS\Settings::i()->attachment_resample_size ? explode( 'x', \IPS\Settings::i()->attachment_resample_size ) : array( 0, 0 ), FALSE, array( 'resizableDiv' => FALSE, 'unlimited' => array( 0, 0 ) ), NULL, NULL, NULL, 'attachment_resample_size' ) );
|
||||
$current = ( isset( \IPS\Settings::i()->attachment_image_size ) ) ? explode( 'x', \IPS\Settings::i()->attachment_image_size ) : array( 1000, 750 );
|
||||
$form->add( new \IPS\Helpers\Form\WidthHeight( 'attachment_image_size', $current, FALSE, array( 'resizableDiv' => FALSE, 'unlimited' => array( 0, 0 ) ), function( $value ){ if( $value[0] > 4800 OR $value[1] > 4800 ) { throw new \InvalidArgumentException('form_image_too_large'); } }, NULL, NULL, 'attachment_image_size' ) );
|
||||
$form->add( new \IPS\Helpers\Form\WidthHeight( 'attachment_image_size', $current, FALSE, array( 'resizableDiv' => FALSE, 'unlimited' => array( 0, 0 ) ), function( $value ){
|
||||
|
||||
if( $value[0] > 4800 OR $value[1] > 4800 )
|
||||
{
|
||||
throw new \InvalidArgumentException('form_image_too_large');
|
||||
}
|
||||
$notAllowed = [ 0, NULL, "" ];
|
||||
|
||||
if( in_array( $value[0], $notAllowed ) or in_array( $value[1], $notAllowed ) )
|
||||
{
|
||||
if( $value[0] == 0 AND $value[1] == 0 )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
throw new \InvalidArgumentException('form_image_not_null');
|
||||
}
|
||||
}, NULL, NULL, 'attachment_image_size' ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'editor_embeds', \IPS\Settings::i()->editor_embeds, FALSE, array( 'togglesOn' => array( 'max_video_width', 'max_internalembed_width' ) ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'max_video_width', \IPS\Settings::i()->max_video_width, FALSE, array( 'unlimited' => 0 ), NULL, NULL, 'px', 'max_video_width' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'max_internalembed_width', \IPS\Settings::i()->max_internalembed_width, FALSE, array( 'unlimited' => 0 ), NULL, NULL, 'px', 'max_internalembed_width' ) );
|
||||
@@ -137,7 +153,12 @@ class _posting extends \IPS\Dispatcher\Controller
|
||||
$form->addHeader('posting_content');
|
||||
if ( \IPS\Login::registrationType() != 'disabled' )
|
||||
{
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'post_before_registering', \IPS\Settings::i()->post_before_registering, FALSE, array( 'options' => array( 1 => 'post_before_registering_on', 0 => 'post_before_registering_off' ) ), NULL, NULL, NULL, 'post_before_registering' ) );
|
||||
$disabled = ( \IPS\Settings::i()->bot_antispam_type === 'none' );
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'post_before_registering', \IPS\Settings::i()->post_before_registering, FALSE, [ 'options' => [ 1 => 'post_before_registering_on', 0 => 'post_before_registering_off' ], 'disabled' => $disabled ], id:'post_before_registering' ) );
|
||||
if( $disabled )
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words['post_before_registering_desc'] = \IPS\Member::loggedIn()->language()->addToStack('post_before_registering_captcha_req');
|
||||
}
|
||||
}
|
||||
\IPS\Member::loggedIn()->language()->words['post_before_registering_on'] = sprintf( \IPS\Member::loggedIn()->language()->get('post_before_registering_on'), \IPS\Member::loggedIn()->language()->addToStack( 'core_group_' . \IPS\Settings::i()->member_group ) );
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'max_title_length', \IPS\Settings::i()->max_title_length, FALSE, array( 'max' => 255 ), NULL, NULL, \IPS\Member::loggedIn()->language()->addToStack('max_title_length_suffix') ) );
|
||||
|
||||
@@ -164,7 +164,7 @@ class _webapp extends \IPS\Dispatcher\Controller
|
||||
|
||||
unset( $values['configure_manifest'], $values['manifest_shortname'], $values['manifest_fullname'], $values['manifest_description'], $values['manifest_display'], $values['manifest_bgcolor'], $values['manifest_themecolor'], $values['manifest_custom_url_toggle'], $values['manifest_short_url'] );
|
||||
|
||||
$values['manifest_details'] = json_encode( $values['manifest_details'] );
|
||||
$values['manifest_details'] = json_encode( array_merge( $values['manifest_details'], [ 'cache_key' => time() ] ) );
|
||||
|
||||
/* Save the settings */
|
||||
$form->saveAsSettings( $values );
|
||||
@@ -473,6 +473,10 @@ class _webapp extends \IPS\Dispatcher\Controller
|
||||
},
|
||||
function() use( $self )
|
||||
{
|
||||
$manifest = json_decode( \IPS\Settings::i()->manifest_details, TRUE );
|
||||
$manifest['cache_key'] = time();
|
||||
|
||||
\IPS\Settings::i()->changeValues( [ 'manifest_details' => json_encode( $manifest ) ] );
|
||||
\IPS\Output::i()->redirect( $self->url, 'completed' );
|
||||
}
|
||||
);
|
||||
|
||||
@@ -22,6 +22,11 @@ if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
*/
|
||||
class _moderators extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/**
|
||||
* @brief Allow MySQL RW separation for efficiency
|
||||
*/
|
||||
public static $allowRWSeparation = TRUE;
|
||||
|
||||
/**
|
||||
* @brief Has been CSRF-protected
|
||||
*/
|
||||
|
||||
@@ -133,7 +133,7 @@ class _membersactivity extends \IPS\Dispatcher\Controller
|
||||
/* And now build the table */
|
||||
$table = new \IPS\Helpers\Table\Db( 'core_members', \IPS\Request::i()->url()->setQueryString( array( 'postDateStart' => $startTime, 'postDateEnd' => $endTime, 'postGroups' => \is_array( $groups ) ? implode( ',', $groups ) : NULL ) ), $where );
|
||||
|
||||
$table->include = array( 'name', 'email', 'member_posts', 'member_last_post', 'group_name', 'ip_address' );
|
||||
$table->include = array( 'name', 'email', 'member_last_post', 'group_name', 'ip_address' );
|
||||
$table->mainColumn = 'name';
|
||||
$table->langPrefix = 'activity_';
|
||||
$table->rowClasses = array( 'email' => array( 'ipsTable_wrap' ), 'group_name' => array( 'ipsTable_wrap' ) );
|
||||
|
||||
@@ -11,8 +11,21 @@
|
||||
|
||||
namespace IPS\core\modules\admin\stats;
|
||||
|
||||
use IPS\Dispatcher;
|
||||
use IPS\Dispatcher\Controller;
|
||||
use IPS\Member;
|
||||
use IPS\Request;
|
||||
use IPS\Output;
|
||||
use IPS\Theme;
|
||||
use IPS\Http\Url;
|
||||
use IPS\core\Statistics\Chart;
|
||||
use IPS\Helpers\Table\Db as TableDb;
|
||||
|
||||
use function defined;
|
||||
use function header;
|
||||
|
||||
/* 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;
|
||||
@@ -21,13 +34,18 @@ if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
/**
|
||||
* moderators
|
||||
*/
|
||||
class _moderators extends \IPS\Dispatcher\Controller
|
||||
class _moderators extends Controller
|
||||
{
|
||||
/**
|
||||
* @brief Has been CSRF-protected
|
||||
*/
|
||||
public static $csrfProtected = TRUE;
|
||||
|
||||
/**
|
||||
* @brief Allow MySQL RW separation for efficiency
|
||||
*/
|
||||
public static $allowRWSeparation = TRUE;
|
||||
|
||||
/**
|
||||
* Execute
|
||||
*
|
||||
@@ -35,7 +53,7 @@ class _moderators extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'moderatorstats_manage' );
|
||||
Dispatcher::i()->checkAcpPermission( 'moderatorstats_manage' );
|
||||
parent::execute();
|
||||
}
|
||||
|
||||
@@ -46,14 +64,27 @@ class _moderators extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
protected function manage()
|
||||
{
|
||||
if ( \IPS\Request::i()->isAjax() )
|
||||
$tabs = array(
|
||||
'users' => 'stats_moderators_users',
|
||||
'actions' => 'stats_moderators_actions'
|
||||
);
|
||||
|
||||
Request::i()->tab ??= 'users';
|
||||
$activeTab = ( array_key_exists( Request::i()->tab, $tabs ) ) ? Request::i()->tab : 'users';
|
||||
|
||||
$output = match( $activeTab ) {
|
||||
'users' => Chart::loadFromExtension( 'core', 'Moderators' )->getChart( Url::internal( 'app=core&module=stats&controller=moderators&tab=users' ) ),
|
||||
'actions' => Chart::loadFromExtension( 'core', 'ModeratorsByAction' )->getChart( Url::internal( "app=core&module=stats&controller=moderators&tab=actions" ) )
|
||||
};
|
||||
|
||||
if ( Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->output = (string) \IPS\core\Statistics\Chart::loadFromExtension( 'core', 'Moderators' )->getChart( \IPS\Http\Url::internal( 'app=core&module=stats&controller=moderators' ) );
|
||||
Output::i()->output = (string) $output;
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__core_stats_moderators');
|
||||
\IPS\Output::i()->output = (string) \IPS\core\Statistics\Chart::loadFromExtension( 'core', 'Moderators' )->getChart( \IPS\Http\Url::internal( 'app=core&module=stats&controller=moderators' ) );
|
||||
Output::i()->title = Member::loggedIn()->language()->addToStack('menu__core_stats_moderators');
|
||||
Output::i()->output = Theme::i()->getTemplate( 'global', 'core' )->tabs( $tabs, $activeTab, (string) $output, Url::internal( "app=core&module=stats&controller=moderators" ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -79,12 +79,12 @@ class _referrals extends \IPS\Dispatcher\Controller
|
||||
|
||||
if( $params['start'] )
|
||||
{
|
||||
$where[] = array( 'joined>?', $params['start'] );
|
||||
$where[] = array( 'core_members.joined>?', $params['start'] );
|
||||
}
|
||||
|
||||
if( $params['end'] )
|
||||
{
|
||||
$where[] = array( 'joined<?', $params['end'] );
|
||||
$where[] = array( 'core_members.joined<?', $params['end'] );
|
||||
}
|
||||
|
||||
$page = isset( \IPS\Request::i()->page ) ? \intval( \IPS\Request::i()->page ) : 1;
|
||||
@@ -96,7 +96,8 @@ class _referrals extends \IPS\Dispatcher\Controller
|
||||
|
||||
try
|
||||
{
|
||||
$total = \IPS\Db::i()->select( 'COUNT(DISTINCT(core_referrals.referred_by))', 'core_referrals', $where )->join( 'core_members', 'core_members.member_id = core_referrals.referred_by')->first();
|
||||
$total = \IPS\Db::i()->select( 'COUNT(DISTINCT(core_referrals.referred_by))', 'core_referrals', $where )
|
||||
->join( 'core_members', 'core_members.member_id = core_referrals.member_id')->first();
|
||||
}
|
||||
catch ( \UnderflowException $e )
|
||||
{
|
||||
@@ -105,7 +106,8 @@ class _referrals extends \IPS\Dispatcher\Controller
|
||||
|
||||
if( $total )
|
||||
{
|
||||
$select = \IPS\Db::i()->select( 'core_referrals.referred_by as member_id, count(*) as count', 'core_referrals', $where, 'count DESC', array( ( $page - 1 ) * static::PER_PAGE, static::PER_PAGE ), 'member_id' )->join( 'core_members', 'core_members.member_id = core_referrals.referred_by');
|
||||
$select = \IPS\Db::i()->select( 'core_referrals.referred_by as member_id, count(*) as count', 'core_referrals', $where, 'count DESC', array( ( $page - 1 ) * static::PER_PAGE, static::PER_PAGE ), 'member_id' )
|
||||
->join( 'core_members', 'core_members.member_id = core_referrals.member_id');
|
||||
$mids = array();
|
||||
|
||||
foreach( $select as $row )
|
||||
|
||||
@@ -253,7 +253,7 @@ class _support extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
protected function guideSearch()
|
||||
{
|
||||
\IPS\Output::i()->json( array() );
|
||||
\IPS\Output::i()->json( $guides );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -308,7 +308,14 @@ class _support extends \IPS\Dispatcher\Controller
|
||||
switch( $k )
|
||||
{
|
||||
case 'php':
|
||||
$requirements['list'][ $k ]['detail'] = \IPS\Member::loggedIn()->language()->addToStack( 'health_check_update_recommended' );
|
||||
if( $v['downgrade'] === TRUE )
|
||||
{
|
||||
$requirements['list'][ $k ]['detail'] = \IPS\Member::loggedIn()->language()->addToStack( 'health_check_downgrade_recommended' );
|
||||
}
|
||||
else
|
||||
{
|
||||
$requirements['list'][ $k ]['detail'] = \IPS\Member::loggedIn()->language()->addToStack( 'health_check_update_recommended' );
|
||||
}
|
||||
break;
|
||||
|
||||
case 'curl':
|
||||
@@ -479,7 +486,7 @@ class _support extends \IPS\Dispatcher\Controller
|
||||
/**
|
||||
* Get block: Invision Community
|
||||
*
|
||||
* @return void
|
||||
* @return array
|
||||
*/
|
||||
protected function _showBlockVersion()
|
||||
{
|
||||
@@ -531,19 +538,23 @@ class _support extends \IPS\Dispatcher\Controller
|
||||
);
|
||||
}
|
||||
|
||||
/* Run MD5 check */
|
||||
$modifiedFiles = $this->_md5Checker( (bool) \IPS\Request::i()->fix );
|
||||
|
||||
if( $modifiedFiles )
|
||||
/* V5 */
|
||||
$v5Actions = ( new \IPS\core\modules\admin\support\v5 )->v5Actions();
|
||||
foreach( $v5Actions as $action )
|
||||
{
|
||||
$requirements['failures']++;
|
||||
$requirements['list'][] = array(
|
||||
'critical' => TRUE,
|
||||
'advice' => FALSE,
|
||||
'success' => FALSE,
|
||||
'link' => \IPS\Http\Url::internal( "app=core&module=support&controller=support&do=getBlock&block=version&fix=1" ),
|
||||
'detail' => \IPS\Member::loggedIn()->language()->addToStack('md5_check_fail')
|
||||
);
|
||||
if( $action === FALSE or \is_array( $action ) AND count( $action ) )
|
||||
{
|
||||
$requirements['advice']++;
|
||||
$requirements['list'][] = [
|
||||
'critical' => FALSE,
|
||||
'advice' => TRUE,
|
||||
'success' => FALSE,
|
||||
'button' => array( 'lang' => 'health_info', 'href' => \IPS\Http\Url::internal( 'app=core&module=support&controller=v5' ), 'css' => 'ipsButton_intermediate' ),
|
||||
'link' => \IPS\Http\Url::internal( "app=core&module=support&controller=v5" ),
|
||||
'detail' => \IPS\Member::loggedIn()->language()->addToStack('health_v5_upgrade_attention')
|
||||
];
|
||||
break; # At least one thing needs attention
|
||||
}
|
||||
}
|
||||
|
||||
return array(
|
||||
@@ -852,6 +863,7 @@ class _support extends \IPS\Dispatcher\Controller
|
||||
'success' => FALSE,
|
||||
'link' => \IPS\Http\Url::internal( 'app=core&module=support&controller=redis' ),
|
||||
'detail' => $detail,
|
||||
'button' => array( 'lang' => 'health_view_redis_config' ),
|
||||
'dialogTitle' => 'health__more_information',
|
||||
);
|
||||
}
|
||||
@@ -1131,6 +1143,7 @@ class _support extends \IPS\Dispatcher\Controller
|
||||
'advice' => FALSE,
|
||||
'success' => FALSE,
|
||||
'link' => NULL,
|
||||
'downgrade' => NULL,
|
||||
'detail' => $requirement['message']
|
||||
);
|
||||
|
||||
@@ -1154,6 +1167,7 @@ class _support extends \IPS\Dispatcher\Controller
|
||||
'advice' => TRUE,
|
||||
'success' => FALSE,
|
||||
'link' => NULL,
|
||||
'downgrade' => $requirements['requirements'][ $category ]['version']['downgrade'] ?? NULL,
|
||||
'detail' => $requirement
|
||||
);
|
||||
}
|
||||
@@ -1848,17 +1862,6 @@ class _support extends \IPS\Dispatcher\Controller
|
||||
\IPS\Output::i()->sendOutput( \IPS\Theme::i()->getTemplate( 'global', 'core' )->blankTemplate( \IPS\Output::i()->output ), 200, 'text/html' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Run MD5 checker
|
||||
*
|
||||
* @param bool $fix Fix the issue instead of returning the count
|
||||
* @return mixed
|
||||
*/
|
||||
protected function _md5Checker( $fix = FALSE )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a count of third party apps and plugins
|
||||
*
|
||||
@@ -1908,37 +1911,22 @@ class _support extends \IPS\Dispatcher\Controller
|
||||
/**
|
||||
* Get third-party applications
|
||||
*
|
||||
* @param bool $separateMarketplace If TRUE, will separate ones installed from the marketplace and custom ones
|
||||
* @return array
|
||||
*/
|
||||
protected function _thirdPartyApps( $separateMarketplace = FALSE )
|
||||
protected function _thirdPartyApps()
|
||||
{
|
||||
if ( \IPS\NO_WRITES )
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
$apps = $separateMarketplace ? [ 'marketplace' => [], 'custom' => [] ] : [];
|
||||
$apps = [];
|
||||
|
||||
foreach ( \IPS\Application::applications() as $app )
|
||||
{
|
||||
if ( $app->enabled and !\in_array( $app->directory, \IPS\IPS::$ipsApps ) )
|
||||
{
|
||||
if ( $separateMarketplace )
|
||||
{
|
||||
if ( $app->marketplace_id )
|
||||
{
|
||||
$apps['marketplace'][] = $app;
|
||||
}
|
||||
else
|
||||
{
|
||||
$apps['custom'][] = $app;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$apps[] = $app;
|
||||
}
|
||||
$apps[] = $app;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1948,37 +1936,22 @@ class _support extends \IPS\Dispatcher\Controller
|
||||
/**
|
||||
* Get third-party plugins
|
||||
*
|
||||
* @param bool $separateMarketplace If TRUE, will separate ones installed from the marketplace and custom ones
|
||||
* @return array
|
||||
*/
|
||||
protected function _thirdPartyPlugins( $separateMarketplace = FALSE )
|
||||
protected function _thirdPartyPlugins()
|
||||
{
|
||||
if ( \IPS\NO_WRITES )
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
$plugins = $separateMarketplace ? [ 'marketplace' => [], 'custom' => [] ] : [];
|
||||
$plugins = [];
|
||||
|
||||
foreach ( \IPS\Plugin::plugins() as $plugin )
|
||||
{
|
||||
if ( $plugin->enabled )
|
||||
{
|
||||
if ( $separateMarketplace )
|
||||
{
|
||||
if ( $plugin->marketplace_id )
|
||||
{
|
||||
$plugins['marketplace'][] = $plugin;
|
||||
}
|
||||
else
|
||||
{
|
||||
$plugins['custom'][] = $plugin;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$plugins[] = $plugin;
|
||||
}
|
||||
$plugins[] = $plugin;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ class _systemLogs extends \IPS\Dispatcher\Controller
|
||||
protected function deleteAll()
|
||||
{
|
||||
/* Delete */
|
||||
\IPS\Db::i()->query( "TRUNCATE core_log" );
|
||||
\IPS\Db::i()->query( "TRUNCATE " . \IPS\Settings::i()->sql_tbl_prefix . "core_log" );
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=support&controller=systemLogs' ), 'deleted' );
|
||||
}
|
||||
|
||||
@@ -134,7 +134,8 @@ class _utf8mb4 extends \IPS\Dispatcher\Controller
|
||||
try
|
||||
{
|
||||
$app = \IPS\Application::load( $appName );
|
||||
$schema = json_decode( file_get_contents( \IPS\ROOT_PATH . "/applications/{$app->directory}/data/schema.json" ), TRUE );
|
||||
$schemaRoot = \in_array( $app->directory, \IPS\IPS::$ipsApps ) ? \IPS\ROOT_PATH : \IPS\SITE_FILES_PATH;
|
||||
$schema = json_decode( file_get_contents( $schemaRoot . "/applications/{$app->directory}/data/schema.json" ), TRUE );
|
||||
if ( !array_key_exists( $table, $schema ) )
|
||||
{
|
||||
/* Make a special exception for CMS database tables */
|
||||
|
||||
@@ -0,0 +1,215 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief v5
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
|
||||
* @since 19 Sep 2024
|
||||
*/
|
||||
|
||||
namespace IPS\core\modules\admin\support;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
|
||||
use IPS\Application;
|
||||
use IPS\Db;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Login;
|
||||
use IPS\Member;
|
||||
use IPS\Output;
|
||||
use IPS\Settings;
|
||||
use IPS\Theme;
|
||||
use function count;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* v5
|
||||
*/
|
||||
class _v5 extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
public static bool $csrfProtected = true;
|
||||
|
||||
/**
|
||||
* ...
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function manage()
|
||||
{
|
||||
$actions = $this->v5Actions();
|
||||
|
||||
Output::i()->cssFiles = array_merge( Output::i()->cssFiles, Theme::i()->css( 'support/dashboard.css', 'core', 'admin' ) );
|
||||
Output::i()->title = Member::loggedIn()->language()->addToStack( 'prepare_v5_title' );
|
||||
Output::i()->output = Theme::i()->getTemplate( 'support' )->v5( ...$actions );
|
||||
}
|
||||
|
||||
public function v5actions()
|
||||
{
|
||||
if( \IPS\CIC )
|
||||
{
|
||||
$phpCheck = true;
|
||||
$mySqlCheck = true;
|
||||
$innoDb = true;
|
||||
$elasticsearch = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Check PHP */
|
||||
$phpCheck = ( version_compare( PHP_VERSION, "8.1.0" ) >= 0 );
|
||||
|
||||
/* Check MySQL */
|
||||
$mySqlVersion = Db::i()->server_info;
|
||||
$mySqlCheck = ( version_compare( $mySqlVersion, "8.0.13" ) >=0 );
|
||||
|
||||
/* Check InnoDb */
|
||||
$innoDb = !count( iterator_to_array( Db::i()->query( "SHOW TABLE STATUS WHERE Engine!='InnoDB'" ) ) );
|
||||
|
||||
/* Are we using elasticsearch */
|
||||
$elasticsearch = ( \IPS\Settings::i()->search_method == 'elastic' AND \IPS\Settings::i()->search_elastic_server );
|
||||
}
|
||||
|
||||
Output::i()->sidebar['actions']['deprecations'] = array(
|
||||
'icon' => 'question-circle',
|
||||
'title' => 'deprecation_tracker',
|
||||
'link' => Url::ips( 'docs/deprecation_tracker' ),
|
||||
'target' => '_blank'
|
||||
);
|
||||
|
||||
$deprecations = [];
|
||||
|
||||
$status = (bool) Db::i()->select( 'count(*)', 'core_member_status_updates' )->first();
|
||||
if( $status )
|
||||
{
|
||||
$deprecations['status'] = Member::loggedIn()->language()->addToStack( 'v5_deprecate_status' );
|
||||
}
|
||||
|
||||
$login = (bool) Db::i()->select( 'count(*)', 'core_login_methods', [
|
||||
[ 'login_enabled=?', 1 ],
|
||||
[ Db::i()->in( 'login_classname', [
|
||||
'IPS\Login\Handler\Standard',
|
||||
'IPS\Login\Handler\OAuth2\Apple',
|
||||
'IPS\Login\Handler\OAuth2\Facebook',
|
||||
'IPS\Login\Handler\OAuth2\Google',
|
||||
'IPS\Login\Handler\OAuth2\LinkedIn',
|
||||
'IPS\Login\Handler\OAuth2\Microsoft',
|
||||
'IPS\Login\Handler\OAuth1\Twitter',
|
||||
'IPS\Login\Handler\OAuth2\Invision',
|
||||
'IPS\Login\Handler\OAuth2\Wordpress',
|
||||
'IPS\Login\Handler\OAuth2\Custom',
|
||||
'IPS\Login\Handler\ExternalDatabase',
|
||||
'IPS\Login\Handler\LDAP',
|
||||
'IPS\convert\Login'
|
||||
], true ) ]
|
||||
] )->first();
|
||||
if( $login )
|
||||
{
|
||||
$deprecations['login'] = Member::loggedIn()->language()->addToStack( 'v5_deprecate_login' );
|
||||
}
|
||||
|
||||
$login = new Login;
|
||||
if( $login->authType() & Login::AUTH_TYPE_USERNAME )
|
||||
{
|
||||
$deprecations['display_names'] = Member::loggedIn()->language()->addToStack( 'v5_deprecate_display_name_login' );
|
||||
}
|
||||
|
||||
if( \IPS\CP_DIRECTORY != 'admin' )
|
||||
{
|
||||
$deprecations['cp_directory'] = Member::loggedIn()->language()->addToStack( 'v5_deprecate_cp_directory' );
|
||||
}
|
||||
|
||||
if( Settings::i()->tags_open_system )
|
||||
{
|
||||
$deprecations['open_tagging'] = Member::loggedIn()->language()->addToStack( 'v5_deprecate_open_tagging' );
|
||||
}
|
||||
|
||||
if( (bool) Db::i()->select('count(*)', 'core_social_promote_sharers', [ 'sharer_key!=? AND sharer_enabled=?', 'Internal', 1 ] )->first() )
|
||||
{
|
||||
$deprecations['social_promotes'] = Member::loggedIn()->language()->addToStack( 'v5_deprecate_social_promotes' );
|
||||
}
|
||||
|
||||
if( !\IPS\CIC )
|
||||
{
|
||||
if( !Settings::i()->use_friendly_urls )
|
||||
{
|
||||
$deprecations['core_furls'] = Member::loggedIn()->language()->addToStack( 'v5_deprecate_core_furls' );
|
||||
}
|
||||
|
||||
$dummyRequest = Url::external('https://invisioncommunity.com')->request();
|
||||
if( ( $dummyRequest instanceof \IPS\Http\Request\Sockets ) )
|
||||
{
|
||||
$deprecations['classic_sockets'] = Member::loggedIn()->language()->addToStack( 'v5_deprecate_classic_sockets' );
|
||||
}
|
||||
}
|
||||
|
||||
/* Pages Checks */
|
||||
if( Application::appIsEnabled( 'cms' ) )
|
||||
{
|
||||
$appName = Application::load('cms')->_title;
|
||||
foreach( Db::i()->select( '*', 'cms_blocks', [ 'block_type=?', 'custom'] ) as $row )
|
||||
{
|
||||
$config = json_decode( $row['block_config'], true );
|
||||
if( isset( $config['editor'] ) and $config['editor'] == 'php' )
|
||||
{
|
||||
$deprecations['php_blocks'] = Member::loggedIn()->language()->addToStack( 'v5_deprecate_php_blocks', false, [ 'sprintf' => [ $appName ] ] );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Commerce checks */
|
||||
if( Application::appIsEnabled( 'nexus' ) )
|
||||
{
|
||||
$appName = Application::load('nexus')->_title;
|
||||
$physical = (bool) Db::i()->select( 'count(*)', 'nexus_packages_products', [ 'p_physical=?', 1 ] )->first();
|
||||
if( $physical )
|
||||
{
|
||||
$deprecations['physical'] = Member::loggedIn()->language()->addToStack( 'v5_deprecate_physical', false, [ 'sprintf' => [ $appName ] ] );
|
||||
}
|
||||
|
||||
$shipping = (bool) Db::i()->select( 'count(*)', 'nexus_shipping' )->first();
|
||||
$shipOrders = (bool) Db::i()->select( 'count(*)', 'nexus_ship_orders' )->first();
|
||||
if( $shipping or $shipOrders )
|
||||
{
|
||||
$deprecations['shipping'] = Member::loggedIn()->language()->addToStack( 'v5_deprecate_shipping', false, [ 'sprintf' => [ $appName ] ] );
|
||||
}
|
||||
|
||||
$requests = (bool) Db::i()->select( 'count(*)', 'nexus_support_requests' )->first();
|
||||
if( $requests )
|
||||
{
|
||||
$deprecations['support'] = Member::loggedIn()->language()->addToStack( 'v5_deprecate_support', false, [ 'sprintf' => [ $appName ] ] );
|
||||
}
|
||||
|
||||
$gateways = iterator_to_array(
|
||||
Db::i()->select( 'distinct m_gateway', 'nexus_paymethods', Db::i()->in( 'm_gateway', [ 'Braintree', 'AuthorizeNet', 'TwoCheckout' ] ) )
|
||||
);
|
||||
if( count( $gateways ) )
|
||||
{
|
||||
$deprecations['gateways'] = Member::loggedIn()->language()->addToStack( 'v5_deprecate_gateways', false, [ 'sprintf' => [ $appName, implode( ", ", $gateways ) ] ] );
|
||||
}
|
||||
|
||||
if( Settings::i()->easypost_enable )
|
||||
{
|
||||
$deprecations['easypost'] = Member::loggedIn()->language()->addToStack( 'v5_deprecate_easypost', false, [ 'sprintf' => [ $appName ] ] );
|
||||
}
|
||||
}
|
||||
|
||||
/* Forums checks */
|
||||
if( Application::appIsEnabled( 'forums' ) )
|
||||
{
|
||||
$appName = Application::load('forums')->_title;
|
||||
if( (bool) \IPS\Db::i()->select( 'COUNT(*)', 'forums_forums', \IPS\Db::i()->bitwiseWhere( \IPS\forums\Forum::$bitOptions['forums_bitoptions'], 'bw_enable_answers' ) )->first() )
|
||||
{
|
||||
$deprecations['qa'] = Member::loggedIn()->language()->addToStack( 'v5_deprecate_forums_qa', false, [ 'sprintf' => [ $appName ] ] );
|
||||
}
|
||||
}
|
||||
|
||||
return [ 'phpCheck' => $phpCheck, 'mySqlCheck' => $mySqlCheck, 'innoDb' => $innoDb, 'elasticsearch' => $elasticsearch, 'deprecations' => $deprecations ];
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,9 @@
|
||||
|
||||
namespace IPS\core\modules\admin\system;
|
||||
|
||||
use IPS\Http\Url;
|
||||
use IPS\Output;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
@@ -303,7 +306,10 @@ class _login extends \IPS\Dispatcher\Controller
|
||||
public function getCsrfKey()
|
||||
{
|
||||
/* Don't cache the CSRF key */
|
||||
\IPS\Output::i()->pageCaching = FALSE;
|
||||
\IPS\Output::setCacheTime( false );
|
||||
|
||||
/* Restrict endpoint to our origin JS */
|
||||
Output::i()->httpHeaders['Access-Control-Allow-Origin'] = Url::baseUrl()->data[ Url::COMPONENT_SCHEME ] . '://' . Url::baseUrl()->data[ Url::COMPONENT_HOST ];
|
||||
|
||||
\IPS\Output::i()->json( [ 'key' => \IPS\Session::i()->csrfKey ] );
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ class _upgrade extends \IPS\Dispatcher\Controller
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'upgrade_manage', 'core', 'overview' );
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('ips_suite_upgrade');
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::external( "https://nullcave.club/resources/invision-community.979/" ) );
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::external( "https://ipbmafia.ru/files/file/2342-invision-community-nulled/" ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -190,29 +190,8 @@ class _upgrade extends \IPS\Dispatcher\Controller
|
||||
/* Do a database check */
|
||||
if( !\IPS\IPS_ALPHA_BUILD )
|
||||
{
|
||||
$md5CheckVersion = NULL;
|
||||
/* If the files on disk are already newer, set version for MD5 check (i.e. if the files were already applied, but the upgrade hasn't happened) */
|
||||
/* If the files on disk are already newer (i.e. if the files were already applied, but the upgrade hasn't happened), go to upgrade now */
|
||||
if( (int) \IPS\Application::getAvailableVersion('core') > \IPS\Application::load('core')->long_version AND \IPS\Application::load('core')->version != \IPS\Application::getAvailableVersion( 'core', TRUE ) )
|
||||
{
|
||||
$md5CheckVersion = (int) \IPS\Application::getAvailableVersion('core');
|
||||
}
|
||||
|
||||
/* Check our files aren't modified */
|
||||
if ( !\IPS\Request::i()->skip_md5_check )
|
||||
{
|
||||
try
|
||||
{
|
||||
$files = \IPS\Application::md5Check( $md5CheckVersion );
|
||||
if ( \count( $files ) )
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate('system')->upgradeDeltaMd5( $values['version'], $files );
|
||||
}
|
||||
}
|
||||
catch ( \Exception $e ) {}
|
||||
}
|
||||
|
||||
/* If we set a custom md5 check version and it passed, proceed to full upgrader */
|
||||
if( $md5CheckVersion )
|
||||
{
|
||||
\IPS\Output::i()->redirect( 'upgrade/?autologin=1' );
|
||||
}
|
||||
@@ -236,17 +215,16 @@ class _upgrade extends \IPS\Dispatcher\Controller
|
||||
/* Check apps and plugins */
|
||||
$row = \IPS\Db::i()->union(
|
||||
array(
|
||||
\IPS\Db::i()->select( "'applications' AS `table`, app_directory AS `id`, app_version AS `current`, app_long_version AS `long`, app_marketplace_id as `marketplace_id`", 'core_applications', [ \IPS\Db::i()->in( 'app_directory', \IPS\IPS::$ipsApps, TRUE ) ] ),
|
||||
\IPS\Db::i()->select( "'plugins' AS `table`, plugin_id AS id, plugin_version_human AS `current`, plugin_version_long AS `long`, plugin_marketplace_id as `marketplace_id`", 'core_plugins' ),
|
||||
\IPS\Db::i()->select( "'themes' AS `table`, set_id AS `id`, set_version AS `current`, set_long_version AS `long`, set_marketplace_id as `marketplace_id`", 'core_themes', [ 'set_customized=?', 1 ] ),
|
||||
\IPS\Db::i()->select( "'languages' AS `table`, lang_id AS `id`, `lang_version` AS `current`, `lang_version_long` AS `long`, `lang_marketplace_id` as `marketplace_id`", "core_sys_lang" )
|
||||
\IPS\Db::i()->select( "'applications' AS `table`, app_directory AS `id`, app_version AS `current`, app_long_version AS `long`", 'core_applications', [ \IPS\Db::i()->in( 'app_directory', \IPS\IPS::$ipsApps, TRUE ) ] ),
|
||||
\IPS\Db::i()->select( "'plugins' AS `table`, plugin_id AS id, plugin_version_human AS `current`, plugin_version_long AS `long`", 'core_plugins' ),
|
||||
\IPS\Db::i()->select( "'themes' AS `table`, set_id AS `id`, set_version AS `current`, set_long_version AS `long`", 'core_themes', [ 'set_customized=?', 1 ] ),
|
||||
\IPS\Db::i()->select( "'languages' AS `table`, lang_id AS `id`, `lang_version` AS `current`, `lang_version_long` AS `long`", "core_sys_lang" )
|
||||
),
|
||||
NULL,
|
||||
200
|
||||
);
|
||||
|
||||
$marketplaceCheck = [];
|
||||
$output = [ 'updates' => [], 'noupdate' => [], 'compatible' => [], 'custom' => [] ];
|
||||
$output = [ 'custom' => [] ];
|
||||
foreach ( $row as $r )
|
||||
{
|
||||
/* Load title */
|
||||
@@ -274,49 +252,7 @@ class _upgrade extends \IPS\Dispatcher\Controller
|
||||
continue;
|
||||
}
|
||||
|
||||
$output[ ( $r['marketplace_id'] ? 'updates' : 'custom' )][ $r['table'] . $r['id'] ] = $r;
|
||||
if ( $r['marketplace_id'] )
|
||||
{
|
||||
$marketplaceCheck[] = $r;
|
||||
}
|
||||
}
|
||||
|
||||
/* Actually Check */
|
||||
if( \count( $marketplaceCheck ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
$marketplaceController = new \IPS\core\modules\admin\marketplace\marketplace;
|
||||
$response = $marketplaceController->_updateCheck( array_column( $marketplaceCheck, 'long', 'marketplace_id' ), (int) $values['version'] );
|
||||
|
||||
foreach ( $marketplaceCheck as $mp )
|
||||
{
|
||||
if( !empty( $response[ $mp['marketplace_id'] ] ) )
|
||||
{
|
||||
$mp['update'] = $response[ $mp['marketplace_id'] ];
|
||||
|
||||
if( $response[ $mp['marketplace_id'] ]['longversion'] == $mp['long'] )
|
||||
{
|
||||
$output['compatible'][ $mp['table'] . $mp['id'] ] = $mp;
|
||||
unset( $output['updates'][ $mp['table'] . $mp['id'] ] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$output['updates'][ $mp['table'] . $mp['id'] ] = $mp;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
unset( $output['updates'][ $mp['table'] . $mp['id'] ] );
|
||||
$output['noupdate'][ $mp['table'] . $mp['id'] ] = $mp;
|
||||
}
|
||||
}
|
||||
catch( \RuntimeException | \UnexpectedValueException $e )
|
||||
{
|
||||
$output['nocheck'] = $marketplaceCheck;
|
||||
$output['updates'] = [];
|
||||
}
|
||||
$output['custom'][ $r['table'] . $r['id'] ] = $r;
|
||||
}
|
||||
|
||||
return \IPS\Theme::i()->getTemplate('system')->upgradeDeltaResourceIssues( $values['version'], $output );
|
||||
@@ -502,18 +438,18 @@ class _upgrade extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
if ( \IPS\CIC2 )
|
||||
{
|
||||
/* Deliberately no try/catch because if it does fail, the site will never know and it will always be an issue cloud-side. */
|
||||
\IPS\IPS::applyLatestFilesIPSCloud();
|
||||
|
||||
/* Log who started the upgrade */
|
||||
\IPS\Session::i()->log( 'acplog__upgrade_started' );
|
||||
|
||||
if ( isset( \IPS\Request::i()->check ) )
|
||||
{
|
||||
return $data;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Deliberately no try/catch because if it does fail, the site will never know and it will always be an issue cloud-side. */
|
||||
\IPS\IPS::applyLatestFilesIPSCloud();
|
||||
|
||||
/* Log who started the upgrade */
|
||||
\IPS\Session::i()->log( 'acplog__upgrade_started' );
|
||||
|
||||
return \IPS\Theme::i()->getTemplate('system')->upgradeExtractCic2();
|
||||
}
|
||||
}
|
||||
@@ -944,40 +880,6 @@ class _upgrade extends \IPS\Dispatcher\Controller
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal('app=core&module=system&controller=upgrade&check=1') );
|
||||
} );
|
||||
}
|
||||
|
||||
/* Run md5 check */
|
||||
try
|
||||
{
|
||||
$files = \IPS\Application::md5Check();
|
||||
if ( \count( $files ) )
|
||||
{
|
||||
/* Log */
|
||||
\IPS\Log::debug( "MD5 check of delta download failed with " . \count( $files ) . " reported as modified", 'auto_upgrade' );
|
||||
|
||||
/* If we'rve already tried to fix them and failed, show an error */
|
||||
if ( isset( $data['md5Fix'] ) and $data['md5Fix'] )
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate('system')->upgradeDeltaFailed( 'exception', NULL );
|
||||
}
|
||||
|
||||
/* Otherwise try to just fix them - first get a new download key */
|
||||
$files = array_map( function( $file ) {
|
||||
return str_replace( \IPS\ROOT_PATH, '', $file );
|
||||
}, $files );
|
||||
$this->_clientAreaPassword = $data['ips_pass'];
|
||||
$newDownloadKey = $this->_getDownloadKey( $data['ips_email'], $data['version'], $files );
|
||||
|
||||
/* Manipulate the wizard data */
|
||||
$data = $_SESSION[ 'wizard-' . md5( \IPS\Http\Url::internal( 'app=core&module=system&controller=upgrade' ) ) . '-data' ];
|
||||
$data['key'] = $newDownloadKey;
|
||||
$data['md5Fix'] = TRUE;
|
||||
$_SESSION[ 'wizard-' . md5( \IPS\Http\Url::internal( 'app=core&module=system&controller=upgrade' ) ) . '-data' ] = $data;
|
||||
|
||||
/* Redirect back in */
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal('app=core&module=system&controller=upgrade') );
|
||||
}
|
||||
}
|
||||
catch ( \Exception $e ) {}
|
||||
|
||||
/* Nope, we're good! */
|
||||
return $data;
|
||||
@@ -1088,6 +990,12 @@ class _upgrade extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
$databaseErrors = TRUE;
|
||||
}
|
||||
|
||||
/* If this is not a patch, send v5 notification */
|
||||
if( $app->directory === 'core' AND $versions[ $data['oldVersion'] ] !== $latestHVersion AND !\IPS\IPS::isManaged() )
|
||||
{
|
||||
\IPS\core\AdminNotification::send( 'core', 'VersionFive', NULL, TRUE );
|
||||
}
|
||||
}
|
||||
}
|
||||
unset( \IPS\Data\Store::i()->applications, \IPS\Data\Store::i()->updatecount_applications );
|
||||
|
||||
Reference in new issue
Block a user