Version 4.1.2

This commit is contained in:
Neo committed 2025-12-19 05:32:19 -08:00
1 parent 3ba79295ee
commit 28bd025b35
1131 files changed
+63658 -20579

No files matched your search

@@ -66,6 +66,7 @@ class _sql extends \IPS\Dispatcher\Controller
$table->sortBy = $table->sortBy ?: 'name';
$table->sortDirection = $table->sortDirection ?: 'asc';
$table->quickSearch = 'name';
$table->limit = 200;
/* Buttons */
$table->rowButtons = function( $row )
@@ -7,7 +7,6 @@
* @package IPS Social Suite
* @since 21 May 2014
* @version SVN_VERSION_NUMBER
* @modified 13.09.2015 by IAF
*/
namespace IPS\core\modules\admin\support;
@@ -159,12 +158,7 @@ class _support extends \IPS\Dispatcher\Controller
$baseUrl = $baseUrl->setQueryString( 'next', $overrideThingToTry );
}
$possibleSolutions = array( '_requirementsChecker', '_databaseChecker', '_clearCaches', '_connectionChecker', '_md5sumChecker', '_upgradeCheck', '_defaultTheme' );
if ( !\IPS\NO_WRITES )
{
$possibleSolutions[] = '_disableThirdParty';
}
$possibleSolutions[] = '_knowledgebase';
$possibleSolutions = array( '_requirementsChecker', '_databaseChecker', '_clearCaches', '_connectionChecker', '_md5sumChecker', '_upgradeCheck', '_disableAdvertisements', '_disableThirdParty', '_knowledgebase' );
$self = $this;
return new \IPS\Helpers\MultipleRedirect(
@@ -298,42 +292,17 @@ class _support extends \IPS\Dispatcher\Controller
* @return string|NULL
*/
public function _md5sumChecker( $id )
{
return NULL;
}
/**
* Step 2: md5sum Checker Iterator
*
* @param string $directory Directory to look through
* @return array
*/
public function _md5sumCheckerIterator( $directory, $correctMd5s )
{
$return = array();
foreach( new \DirectoryIterator( $directory ) as $file )
{
try
{
if ( mb_substr( $file, 0, 1 ) === '.' or mb_substr( $file, 0, 1 ) === '_' or $file == 'index.html' )
$files = \IPS\Application::md5Check();
if ( count( $files ) )
{
continue;
}
if ( $file->isDir() )
{
$return = array_merge( $return, $this->_md5sumCheckerIterator( $file->getPathname(), $correctMd5s ) );
}
elseif ( mb_substr( $file, -4 ) === '.php' )
{
$fullPath = $file->getPathname();
$shortPath = mb_substr( $fullPath, mb_strlen( \IPS\ROOT_PATH ) );
if ( $shortPath != '/init.php' and isset( $correctMd5s[ $shortPath ] ) and md5( preg_replace( '#\s#', '', file_get_contents( $fullPath ) ) ) != $correctMd5s[ $shortPath ] ) // We strip whitespace since FTP in ASCII mode will change the whitespace characters
{
$return[] = $fullPath;
}
return \IPS\Theme::i()->getTemplate( 'support' )->md5sum( $files, $id );
}
}
return $return;
catch ( \Exception $e ) {}
return NULL;
}
/**
@@ -400,47 +369,49 @@ class _support extends \IPS\Dispatcher\Controller
}
/**
* Step 2: Self Service - Instruct user to try using default theme
* Step 2: Self Service - Disable advertisements
*
* @param int $id The current ID
* @return string|NULL
*/
public function _defaultTheme( $id )
public function _disableAdvertisements( $id )
{
if ( isset( \IPS\Request::i()->deleteTheme ) )
if ( isset( \IPS\Request::i()->enableAds ) )
{
try
{
\IPS\Theme::load( \IPS\Request::i()->deleteTheme )->delete();
foreach ( explode( ',', \IPS\Request::i()->enableAds ) as $ad )
{
try
{
$ad = \IPS\core\Advertisement::load( $ad );
$ad->active = 1;
$ad->save();
}
catch ( \Exception $e ) {}
}
catch ( \Exception $e ) {}
return NULL;
}
if ( \IPS\Db::i()->select( 'COUNT(*)', 'core_theme_templates', 'template_set_id>0' )->first() or \IPS\Db::i()->select( 'COUNT(*)', 'core_theme_css', 'css_set_id>0' )->first() )
{
$newTheme = new \IPS\Theme;
$newTheme->permissions = \IPS\Member::loggedIn()->member_group_id;
$newTheme->save();
$newTheme->installThemeSettings();
$newTheme->copyResourcesFromSet();
\IPS\Lang::saveCustom( 'core', "core_theme_set_title_" . $newTheme->id, "IPS Support" );
\IPS\Member::loggedIn()->skin = $newTheme->id;
if( \IPS\Member::loggedIn()->acp_skin !== NULL )
{
\IPS\Member::loggedIn()->acp_skin = $newTheme->id;
}
\IPS\Member::loggedIn()->save();
return \IPS\Theme::i()->getTemplate( 'support' )->tryNow( $id, 'try_default_theme', '&deleteTheme=' . $newTheme->id );
}
$disabledAds = array();
return NULL;
/* Loop ads */
foreach( \IPS\Db::i()->select( '*' ,'core_advertisements', array( 'ad_active=?', 1 ) ) as $ad )
{
$ad = \IPS\core\Advertisement::constructFromData( $ad );
$ad->active = 0;
$disabledAds[] = $ad->id;
}
/* Do any? */
if ( count( $disabledAds ) )
{
return \IPS\Theme::i()->getTemplate( 'support' )->disabledAdvertisements( $id, '&enableAds=' . implode( ',', $disabledAds ) );
}
else
{
return NULL;
}
}
/**
@@ -451,8 +422,28 @@ class _support extends \IPS\Dispatcher\Controller
*/
public function _disableThirdParty( $id )
{
if ( isset( \IPS\Request::i()->enableApps ) or isset( \IPS\Request::i()->enablePlugins ) )
/* Button to put stuff back */
if ( isset( \IPS\Request::i()->deleteTheme ) or isset( \IPS\Request::i()->enableApps ) or isset( \IPS\Request::i()->enablePlugins ) )
{
/* Theme */
if ( isset( \IPS\Request::i()->deleteTheme ) )
{
try
{
\IPS\Theme::load( \IPS\Request::i()->deleteTheme )->delete();
}
catch ( \Exception $e ) {}
if( isset( $_SESSION['old_acp_theme'] ) )
{
\IPS\Member::loggedIn()->acp_skin = $_SESSION['old_acp_theme'];
\IPS\Member::loggedIn()->save();
unset( $_SESSION['old_acp_theme'] );
}
}
/* Apps */
foreach ( explode( ',', \IPS\Request::i()->enableApps ) as $app )
{
try
@@ -464,6 +455,7 @@ class _support extends \IPS\Dispatcher\Controller
catch ( \Exception $e ) {}
}
/* Plugins */
foreach ( explode( ',', \IPS\Request::i()->enablePlugins ) as $plugin )
{
try
@@ -478,41 +470,71 @@ class _support extends \IPS\Dispatcher\Controller
return NULL;
}
/* Init */
$restoredDefaultTheme = FALSE;
$disabledApps = array();
$disabledPlugins = array();
$disabledAppNames = array();
$disabledPluginNames = array();
/* Loop Apps */
foreach ( \IPS\Application::applications() as $app )
/* Do we need to restore the default theme? */
if ( \IPS\Db::i()->select( 'COUNT(*)', 'core_theme_templates', 'template_set_id>0' )->first() or \IPS\Db::i()->select( 'COUNT(*)', 'core_theme_css', 'css_set_id>0' )->first() )
{
if ( $app->enabled and !in_array( $app->directory, \IPS\Application::$ipsApps ) )
$newTheme = new \IPS\Theme;
$newTheme->permissions = \IPS\Member::loggedIn()->member_group_id;
$newTheme->save();
$newTheme->installThemeSettings();
$newTheme->copyResourcesFromSet();
\IPS\Lang::saveCustom( 'core', "core_theme_set_title_" . $newTheme->id, "IPS Support" );
\IPS\Member::loggedIn()->skin = $newTheme->id;
if( \IPS\Member::loggedIn()->acp_skin !== NULL )
{
$app->enabled = FALSE;
$app->save();
$disabledApps[] = $app->directory;
$disabledAppNames[] = $app->_title;
$_SESSION['old_acp_theme'] = \IPS\Member::loggedIn()->acp_skin;
\IPS\Member::loggedIn()->acp_skin = $newTheme->id;
}
\IPS\Member::loggedIn()->save();
$restoredDefaultTheme = TRUE;
}
/* Do we need to disable any third party apps/plugins? */
if ( !\IPS\NO_WRITES )
{
/* Loop Apps */
foreach ( \IPS\Application::applications() as $app )
{
if ( $app->enabled and !in_array( $app->directory, \IPS\Application::$ipsApps ) )
{
$app->enabled = FALSE;
$app->save();
$disabledApps[] = $app->directory;
$disabledAppNames[] = $app->_title;
}
}
/* Look Plugins */
foreach ( \IPS\Plugin::plugins() as $plugin )
{
if ( $plugin->enabled )
{
$plugin->enabled = FALSE;
$plugin->save();
$disabledPlugins[] = $plugin->id;
$disabledPluginNames[] = $plugin->_title;
}
}
}
/* Look Plugins */
foreach ( \IPS\Plugin::plugins() as $plugin )
/* Did we do anything? */
if ( $restoredDefaultTheme or count( $disabledApps ) or count( $disabledPlugins ) )
{
if ( $plugin->enabled )
{
$plugin->enabled = FALSE;
$plugin->save();
$disabledPlugins[] = $plugin->id;
$disabledPluginNames[] = $plugin->_title;
}
}
/* Do any? */
if ( count( $disabledApps ) or count( $disabledPlugins ) )
{
return \IPS\Theme::i()->getTemplate( 'support' )->thirdParty( $id, $disabledAppNames, $disabledPluginNames, '&enableApps=' . implode( ',', $disabledApps ) . '&enablePlugins=' . implode( ',', $disabledPlugins ) );
return \IPS\Theme::i()->getTemplate( 'support' )->thirdParty( $id, $disabledAppNames, $disabledPluginNames, $restoredDefaultTheme, '&enableApps=' . implode( ',', $disabledApps ) . '&enablePlugins=' . implode( ',', $disabledPlugins ) . ( $restoredDefaultTheme ? '&deleteTheme=' . $newTheme->id : '' ) );
}
else
{
@@ -550,7 +572,123 @@ class _support extends \IPS\Dispatcher\Controller
*/
public function _contactSupport( $data )
{
return \IPS\Theme::i()->getTemplate( 'global' )->message( '__iaf__nulling_null_alert', 'error' );
$licenseData = \IPS\IPS::licenseKey();
if ( !$licenseData or strtotime( $licenseData['expires'] ) < time() )
{
return \IPS\Theme::i()->getTemplate( 'global' )->message( 'get_support_no_license', 'warning' );
}
try
{
$supportedVerions = \IPS\Http\Url::ips('support/versions')->request()->get()->decodeJson();
if ( \IPS\Application::load('core')->long_version > $supportedVerions['max'] )
{
return \IPS\Theme::i()->getTemplate( 'global' )->message( 'get_support_unsupported_prerelease', 'warning' );
}
if ( \IPS\Application::load('core')->long_version < $supportedVerions['min'] )
{
return \IPS\Theme::i()->getTemplate( 'global' )->message( 'get_support_unsupported_obsolete', 'warning' );
}
}
catch ( \Exception $e ) {}
$form = new \IPS\Helpers\Form( 'contact_support', 'contact_support_submit' );
$form->class = 'ipsForm_vertical ipsPad';
$extraOptions = array( 'admin' => 'support_request_admin' );
if ( $this->_supportLog( TRUE ) )
{
$form->hiddenValues['_log'] = '1';
$extraOptions['log'] = 'support_request_log';
}
$form->add( new \IPS\Helpers\Form\Text( 'support_request_title', NULL, TRUE, array( 'maxLength' => 128 ) ) );
$form->add( new \IPS\Helpers\Form\Editor( 'support_request_body', NULL, TRUE, array( 'app' => 'core', 'key' => 'Admin', 'autoSaveKey' => 'acp-support-request' ) ) );
$form->add( new \IPS\Helpers\Form\CheckboxSet( 'support_request_extra', array( 'admin', 'log' ), FALSE, array( 'options' => $extraOptions ) ) );
if ( $values = $form->values() )
{
$admin = NULL;
if ( in_array( 'admin', $values['support_request_extra'] ) )
{
$password = '';
$length = rand( 8, 15 );
for ( $i = 0; $i < $length; $i++ )
{
do {
$key = rand( 33, 126 );
} while ( in_array( $key, array( 34, 39, 60, 62, 92 ) ) );
$password .= chr( $key );
}
$supportAccount = \IPS\Member::load( 'nobody@invisionpower.com', 'email' );
if ( !$supportAccount->member_id )
{
$name = 'IPS Support';
$_supportAccount = \IPS\Member::load( $name, 'name' );
if ( $_supportAccount->member_id )
{
$number = 2;
while ( $_supportAccount->member_id )
{
$name = "IPS Support {$number}";
$_supportAccount = \IPS\Member::load( $name, 'name' );
$number++;
}
}
$supportAccount = new \IPS\Member;
$supportAccount->name = $name;
$supportAccount->email = 'nobody@invisionpower.com';
$supportAccount->member_group_id = \IPS\Settings::i()->admin_group;
}
$supportAccount->members_pass_salt = $supportAccount->generateSalt();
$supportAccount->members_pass_hash = $supportAccount->encryptedPassword( $password );
$supportAccount->save();
$admin = json_encode( array( 'name' => $supportAccount->name, 'email' => $supportAccount->email, 'password' => $password, 'dir' => \IPS\CP_DIRECTORY ) );
}
$log = NULL;
if ( in_array( 'log', $values['support_request_extra'] ) )
{
$log = $this->_supportLog( FALSE );
}
$key = md5( \IPS\Http\Url::internal('app=core&module=support&controller=support') );
unset( $_SESSION["wizard-{$key}-step"] );
unset( $_SESSION["wizard-{$key}-data"] );
\IPS\Output::i()->parseFileObjectUrls( $values['support_request_body'] );
$response = \IPS\Http\Url::ips('support')->request()->login( \IPS\Settings::i()->ipb_reg_number, '' )->post( array(
'title' => $values['support_request_title'],
'message' => $values['support_request_body'],
'admin' => $admin,
'log' => $log,
'_log' => intval( isset( $values['_log'] ) )
) );
switch ( $response->httpResponseCode )
{
case 200:
case 201:
return \IPS\Theme::i()->getTemplate( 'global' )->message( \IPS\Member::loggedIn()->language()->addToStack( 'get_support_done', FALSE, array( 'pluralize' => array( intval( (string) $response ) ) ) ), 'success' );
case 401:
case 403:
return \IPS\Theme::i()->getTemplate( 'global' )->message( 'get_support_no_license', 'warning' );
case 429:
return \IPS\Theme::i()->getTemplate( 'global' )->message( 'get_support_duplicate', 'error' );
case 502:
default:
return \IPS\Theme::i()->getTemplate( 'global' )->message( 'get_support_error', 'error' );
}
}
return (string) $form;
}
/**
@@ -597,6 +735,4 @@ class _support extends \IPS\Dispatcher\Controller
{
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('support')->logToSend( $this->_supportLog( FALSE ) );
}
}
/* Nulled by IandroidFan (IAF) */
}
@@ -58,7 +58,7 @@ class _systemLogs extends \IPS\Dispatcher\Controller
krsort( $dataSource );
/* Create the table */
$table = new \IPS\Helpers\Table\Custom( array_slice( $dataSource, 0, 50 ), \IPS\Http\Url::internal( 'app=core&module=support&controller=systemLogs' ) );
$table = new \IPS\Helpers\Table\Custom( $dataSource, \IPS\Http\Url::internal( 'app=core&module=support&controller=systemLogs' ) );
$table->langPrefix = 'systemlogs_';
$table->mainColumn = 'title';