Version 4.1.19

This commit is contained in:
Neo committed 2025-12-19 05:38:56 -08:00
1 parent 28bd025b35
commit 2bd5025018
2674 files changed
+233518 -77766

No files matched your search

@@ -2,9 +2,9 @@
/**
* @brief ACP Dashboard
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 2 July 2013
* @version SVN_VERSION_NUMBER
*/
@@ -30,6 +30,8 @@ class _dashboard extends \IPS\Dispatcher\Controller
*/
protected function manage()
{
\IPS\Dispatcher::i()->checkAcpPermission( 'view_dashboard' );
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js('admin_dashboard.js', 'core') );
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'system/dashboard.css', 'core', 'admin' ) );
@@ -72,7 +74,7 @@ class _dashboard extends \IPS\Dispatcher\Controller
$bulletins = \IPS\Http\Url::ips('bulletin')->request()->get()->decodeJson();
\IPS\Data\Store::i()->acpBulletin = array(
'time' => time(),
'content' => $bulletins
'content' => $bulletins ?: array()
);
}
catch( \RuntimeException $e )
@@ -84,21 +86,24 @@ class _dashboard extends \IPS\Dispatcher\Controller
{
$bulletins = $bulletin['content'];
}
foreach ( $bulletins as $k => $data )
if( !empty( $bulletins ) )
{
if ( count( $data['files'] ) )
foreach ( $bulletins as $k => $data )
{
$skip = TRUE;
foreach ( $data['files'] as $file )
if ( count( $data['files'] ) )
{
if ( filemtime( \IPS\ROOT_PATH . '/' . $file ) < $data['timestamp'] )
$skip = TRUE;
foreach ( $data['files'] as $file )
{
$skip = FALSE;
if ( filemtime( \IPS\ROOT_PATH . '/' . $file ) < $data['timestamp'] )
{
$skip = FALSE;
}
}
if ( $skip )
{
unset( $bulletins[ $k ] );
}
}
if ( $skip )
{
unset( $bulletins[ $k ] );
}
}
}
@@ -139,6 +144,61 @@ class _dashboard extends \IPS\Dispatcher\Controller
);
}
/* Check Tasks */
try
{
$task = \IPS\DateTime::ts( \IPS\Db::i()->select( 'next_run', 'core_tasks', array( 'enabled=?', TRUE ), 'next_run ASC' )->first() );
$today = new \IPS\DateTime;
$difference = $today->diff( $task )->h + ( $today->diff( $task )->days * 24 );
if ( $difference >= 36 )
{
if( \IPS\Settings::i()->task_use_cron == 'cron' )
{
$warnings[] = array(
'title' => \IPS\Member::loggedIn()->language()->addToStack( 'dashboard_tasks_broken' ),
'description' => \IPS\Member::loggedIn()->language()->addToStack( 'dashboard_tasks_cron_broken_desc' )
);
}
elseif( \IPS\Settings::i()->task_use_cron == 'web' )
{
$warnings[] = array(
'title' => \IPS\Member::loggedIn()->language()->addToStack( 'dashboard_tasks_broken' ),
'description' => \IPS\Member::loggedIn()->language()->addToStack( 'dashboard_tasks_web_broken_desc' )
);
}
else
{
$warnings[] = array(
'title' => \IPS\Member::loggedIn()->language()->addToStack( 'dashboard_tasks_broken' ),
'description' => \IPS\Member::loggedIn()->language()->addToStack( 'dashboard_tasks_not_enough_desc' )
);
}
}
}
catch ( \UnderflowException $e ) { }
if ( !\IPS\Settings::i()->site_online AND \IPS\Settings::i()->task_use_cron == 'normal' AND !\IPS\CIC )
{
$warnings[] = array(
'title' => \IPS\Member::loggedIn()->language()->addToStack('dasbhoard_tasks_site_offline'),
'description' => \IPS\Member::loggedIn()->language()->addToStack('dasbhoard_tasks_site_offline_desc')
);
}
/* If there have been more than 10 datastore failurs in the last hour, or if an instant test fails, show a message */
if( !\IPS\Data\Store::i()->test() OR \IPS\Db::i()->select( 'COUNT(*)', 'core_log', array( '`category`=? AND `time`>?', 'datastore', \IPS\DateTime::create()->sub( new \DateInterval( 'PT1H' ) )->getTimestamp() ) )->first() >= 10 )
{
/* Have we just recently updated the configuration? If so, ignore this warning for 24 hours */
if( \IPS\Settings::i()->last_data_store_update < \IPS\DateTime::create()->sub( new \DateInterval( 'PT24H' ) )->getTimestamp() )
{
$warnings[] = array(
'title' => \IPS\Member::loggedIn()->language()->addToStack( 'dashboard_datastore_broken' ),
'description' => \IPS\Member::loggedIn()->language()->addToStack( 'dashboard_datastore_broken_desc' )
);
}
}
/* Get new core update available data */
$update = \IPS\Application::load( 'core' )->availableUpgrade( TRUE );
@@ -171,8 +231,8 @@ class _dashboard extends \IPS\Dispatcher\Controller
if( !$toShow OR !isset( $toShow['main'] ) OR !isset( $toShow['side'] ) )
{
$toShow = array(
'main' => array( 'core_BackgroundQueue', 'core_Registrations' ),
'side' => array( 'core_AdminNotes', 'core_OnlineUsers' ),
'main' => array( 'core_AdminNotes', 'core_Registrations', 'core_AwaitingValidation', 'core_BackgroundQueue' ),
'side' => array( 'core_OnlineAdmins', 'core_FailedLogins', 'core_OnlineUsers' ),
);
$blocks[ \IPS\Member::loggedIn()->member_id ] = $toShow;
@@ -2,9 +2,9 @@
/**
* @brief File Settings
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 06 May 2013
* @version SVN_VERSION_NUMBER
*/
@@ -61,6 +61,7 @@ class _files extends \IPS\Dispatcher\Controller
);
}
/* @todo - This needs fixing but has been temporarily been disabled
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'overview', 'orphaned_files' ) )
{
\IPS\Output::i()->sidebar['actions']['orphaned'] = array(
@@ -69,7 +70,7 @@ class _files extends \IPS\Dispatcher\Controller
'title' => 'orphaned_files',
'data' => array( 'confirm' => '', 'confirmMessage' => \IPS\Member::loggedIn()->language()->addToStack('orphaned_files_confirm') )
);
}
}*/
$table = new \IPS\Helpers\Table\Db( 'core_attachments', \IPS\Http\Url::internal( 'app=core&module=overview&controller=files' ) );
$table->filters = array(
@@ -127,7 +128,15 @@ class _files extends \IPS\Dispatcher\Controller
},
'attach_member_id' => function( $val )
{
return "<a href='" . \IPS\Http\Url::internal( 'app=core&module=members&controller=members&do=edit&id=' . $val ) . "'>" . htmlentities( \IPS\Member::load( $val )->name, \IPS\HTMLENTITIES, 'UTF-8', FALSE ) . '</a>';
if ( $val == 0 )
{
return \IPS\Member::load( $val )->name;
}
else
{
return "<a href='" . \IPS\Http\Url::internal( 'app=core&module=members&controller=members&do=edit&id=' . $val ) . "'>" . htmlentities( \IPS\Member::load( $val )->name, \IPS\HTMLENTITIES, 'UTF-8', FALSE ) . '</a>';
}
}
);
$table->advancedSearch = array(
@@ -216,6 +225,9 @@ class _files extends \IPS\Dispatcher\Controller
public function delete()
{
\IPS\Dispatcher::i()->checkAcpPermission( 'files_delete' );
/* Make sure the user confirmed the deletion */
\IPS\Request::i()->confirmedDelete();
try
{
@@ -249,9 +261,9 @@ class _files extends \IPS\Dispatcher\Controller
$form = new \IPS\Helpers\Form;
$form->add( new \IPS\Helpers\Form\Radio( 'image_suite', \IPS\Settings::i()->image_suite, TRUE, array(
$form->add( new \IPS\Helpers\Form\Radio( 'image_suite', class_exists( 'Imagick', FALSE ) ? \IPS\Settings::i()->image_suite : 'gd', TRUE, array(
'options' => array( 'gd' => 'imagesuite_gd', 'imagemagick' => 'imagesuite_imagemagick' ),
'toggles' => array( 'imagemagick' => array(), 'gd' => array( 'image_jpg_quality', 'image_png_quality_gd' ) ),
'toggles' => array( 'imagemagick' => array( 'image_jpg_quality' ), 'gd' => array( 'image_jpg_quality', 'image_png_quality_gd' ) ),
'disabled'=> class_exists( 'Imagick', FALSE ) ? array() : array( 'imagemagick' )
) ) );
@@ -314,8 +326,8 @@ class _files extends \IPS\Dispatcher\Controller
$value = $settings[ "filestorage__{$name}" ];
}
}
$form->add( new \IPS\Helpers\Form\Select( 'filestorage__' . $name, $value, TRUE, array( 'options' => $configurations, 'disabled' => $disabled ) ) );
$form->add( new \IPS\Helpers\Form\Select( 'filestorage__' . $name, (int) $value, TRUE, array( 'options' => $configurations, 'disabled' => $disabled ) ) );
if ( $disabled )
{
@@ -344,19 +356,34 @@ class _files extends \IPS\Dispatcher\Controller
{
if ( $settings[ $k ] != $v and $k != 'filestorage__core_Theme' )
{
$rebuild = TRUE;
/* Do we need to move files at all? */
$configurations = \IPS\File::getConfigurations();
$exploded = explode( '_', $k );
$classname = "IPS\\{$exploded[2]}\\extensions\\core\\FileStorage\\{$exploded[3]}";
$extension = new $classname;
$count = $extension->count();
$currentClass = \IPS\File::getClass( intval( $settings[ $k ] ) );
$newClass = \IPS\File::getClass( intval( $v ) );
if ( $count )
if ( ( isset( $configurations[ $v ] ) and isset( $configurations[ $settings[ $k ] ] ) ) and ( get_class( $currentClass ) == get_class( $newClass ) ) and ! $newClass::moveCheck( $newClass->configuration, $currentClass->configuration ) )
{
\IPS\Task::queue( 'core', 'MoveFiles', array( 'storageExtension' => $k, 'oldConfiguration' => $settings[ $k ], 'newConfiguration' => $values[ $k ], 'count' => $count ), 2 );
$rebuild = FALSE;
}
else
{
$rebuild = TRUE;
}
if ( $rebuild )
{
$count = $extension->count();
/* Add to allowed storage methods so when moving files, we can accept old config or new config if move is in progress. Important: order is array(x, y) x is the new location (pos 0), y is the old location (pos 1)*/
$values[ $k ] = array( $v, $settings[ $k ] );
if ( $count )
{
\IPS\Task::queue( 'core', 'MoveFiles', array( 'storageExtension' => $k, 'oldConfiguration' => $settings[ $k ], 'newConfiguration' => $values[ $k ], 'count' => $count ), 2 );
/* Add to allowed storage methods so when moving files, we can accept old config or new config if move is in progress. Important: order is array(x, y) x is the new location (pos 0), y is the old location (pos 1)*/
$values[ $k ] = array( $v, $settings[ $k ] );
}
}
}
}
@@ -421,6 +448,16 @@ class _files extends \IPS\Dispatcher\Controller
$activeTabContents = $table;
}
/* Add a button for settings */
\IPS\Output::i()->sidebar['actions'] = array(
'settings' => array(
'title' => 'settings',
'icon' => 'cog',
'link' => \IPS\Http\Url::internal( 'app=core&module=overview&controller=files&do=fileLogSettings' ),
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('settings') )
),
);
/* Display */
if ( \IPS\Request::i()->isAjax() and !isset( \IPS\Request::i()->ajaxValidate ) )
@@ -434,6 +471,27 @@ class _files extends \IPS\Dispatcher\Controller
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->tabs( array( 'settings' => 'filestorage_settings', 'configurations' => 'filestorage_configurations' ), $activeTab, $activeTabContents, \IPS\Http\Url::internal( "app=core&module=overview&controller=files&do=settings" ) );
}
}
/**
* Settings
*
* @return void
*/
protected function fileLogSettings()
{
$form = new \IPS\Helpers\Form;
$form->add( new \IPS\Helpers\Form\Number( 'file_log_pruning', \IPS\Settings::i()->file_log_pruning, FALSE, array( 'unlimited' => 0, 'unlimitedLang' => 'never' ), NULL, \IPS\Member::loggedIn()->language()->addToStack('after'), \IPS\Member::loggedIn()->language()->addToStack('days'), 'file_log_pruning' ) );
if ( $values = $form->values() )
{
$form->saveAsSettings();
\IPS\Session::i()->log( 'acplog__filelog_settings' );
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=overview&controller=files&do=settings' ), 'saved' );
}
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('filelog_settings');
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('global')->block( 'filelog_settings', $form, FALSE );
}
/**
* Add/Edit Configuration
@@ -563,7 +621,7 @@ class _files extends \IPS\Dispatcher\Controller
{
foreach ( $toggles[ $values['filestorage_method'] ] as $k => $v )
{
$currentHandlerSettings[ $k ] = str_replace( \IPS\ROOT_PATH, '{root}', $values[ 'filehandler__' . $v ] );
$currentHandlerSettings[ $k ] = ( \IPS\ROOT_PATH !== '/' ) ? str_replace( \IPS\ROOT_PATH, '{root}', $values[ 'filehandler__' . $v ] ) : $values[ 'filehandler__' . $v ];
}
}
@@ -572,6 +630,37 @@ class _files extends \IPS\Dispatcher\Controller
{
$classname::testSettings( $currentHandlerSettings );
}
$existingWithSameConfig = false;
/* Make sure there are no other configurations that are exactly the same */
foreach( \IPS\Db::i()->select( '*', 'core_file_storage', array( 'method=?', $values['filestorage_method'] ) ) as $existing )
{
if ( $current and $current['id'] == $existing['id'] )
{
continue;
}
$existingWithSameConfig = true;
$existingConfiguration = json_decode( $existing['configuration'], true );
foreach( $existingConfiguration as $k => $v )
{
$v = str_replace( \IPS\ROOT_PATH, '{root}', $v );
if ( array_key_exists( $k, $currentHandlerSettings ) )
{
if ( $v != $currentHandlerSettings[ $k ] )
{
$existingWithSameConfig = false;
}
}
}
}
if ( $existingWithSameConfig )
{
/* Let's not allow this to be saved as someone can start a move to the same location, which will end up deleting the files */
throw new \DomainException( \IPS\Member::loggedIn()->language()->addToStack( 'file_config_is_the_same_as_existing', FALSE ) );
}
/* Do we really need to create and move? */
if ( $current AND $createNewAndMove )
@@ -2,9 +2,9 @@
/**
* @brief Security Settings
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 11 Jun 2013
* @version SVN_VERSION_NUMBER
*/
@@ -146,7 +146,7 @@ class _security extends \IPS\Dispatcher\Controller
}
/* ACP Directory Name */
if ( \IPS\CP_DIRECTORY == 'admin' )
if ( \IPS\CP_DIRECTORY == 'admin' and !\IPS\CIC )
{
$content[] = array(
'title' => \IPS\Member::loggedIn()->language()->addToStack('rename_admin_title'),
@@ -182,12 +182,38 @@ class _security extends \IPS\Dispatcher\Controller
$form = new \IPS\Helpers\Form;
$form->add( new \IPS\Helpers\Form\YesNo( 'security_remove_acp_link', !\IPS\Settings::i()->security_remove_acp_link, FALSE ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'xforward_matching', \IPS\Settings::i()->xforward_matching, FALSE ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'match_ipaddress', \IPS\Settings::i()->match_ipaddress, FALSE ) ); //
if ( !\IPS\CIC )
{
$form->add( new \IPS\Helpers\Form\YesNo( 'xforward_matching', \IPS\Settings::i()->xforward_matching, FALSE ) );
}
$form->add( new \IPS\Helpers\Form\YesNo( 'match_ipaddress', \IPS\Settings::i()->match_ipaddress, FALSE ) );
/* If we are overriding IP address checking for the ACP, show a warning */
if( \IPS\BYPASS_ACP_IP_CHECK === TRUE )
{
\IPS\Member::loggedIn()->language()->words['match_ipaddress_warning'] = \IPS\Member::loggedIn()->language()->addToStack('ip_override_warn');
}
/* Password Strength */
$form->add( new \IPS\Helpers\Form\YesNo( 'password_strength_meter', \IPS\Settings::i()->password_strength_meter, FALSE, array( 'togglesOn' => array( 'password_strength_meter_enforce' ) ), NULL, NULL, NULL, 'password_strength_meter' ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'password_strength_meter_enforce', \IPS\Settings::i()->password_strength_meter_enforce, FALSE, array( 'togglesOn' => array( 'password_strength_option' ) ), NULL, NULL, NULL, 'password_strength_meter_enforce' ) );
$strengthOptions = array(
'3' => 'strength_3',
'4' => 'strength_4',
'5' => 'strength_5',
);
$form->add( new \IPS\Helpers\Form\Radio( 'password_strength_option', \IPS\Settings::i()->password_strength_option, FALSE, array( 'options' => $strengthOptions ), NULL, NULL, NULL, 'password_strength_option' ) );
if ( $values = $form->values() )
{
$values['security_remove_acp_link'] = $values['security_remove_acp_link'] ? FALSE : TRUE;
/* Disabling the password strength meter should also disable enforcing a strength */
$values['password_strength_meter_enforce'] = $values['password_strength_meter'] ? $values['password_strength_meter_enforce'] : FALSE;
$form->saveAsSettings( $values );
\IPS\Session::i()->log( 'acplogs__security_settings' );
@@ -210,7 +236,7 @@ class _security extends \IPS\Dispatcher\Controller
$done = FALSE;
/* Try... */
if ( !@chmod( \IPS\ROOT_PATH . '/conf_global.php', 0444 ) )
if ( \IPS\NO_WRITES or !@chmod( \IPS\ROOT_PATH . '/conf_global.php', 0444 ) )
{
\IPS\Output::i()->error( 'conf_not_altered', '2C258/2', 500, '' );
}
@@ -227,11 +253,16 @@ class _security extends \IPS\Dispatcher\Controller
*/
protected function htaccess()
{
if ( \IPS\NO_WRITES )
{
\IPS\Output::i()->error( 'no_writes', '1C258/7', 403, '' );
}
/* INIT */
$errors = array();
$deny = <<<EOF
#<ipb-protection>
<Files ~ "^.*\.(php|cgi|pl|php3|php4|php5|php6|phtml|shtml)">
<Files ~ "^.*\.(php|cgi|pl|php3|php4|php5|php6|phtml|shtml|([a-z0-9]{32}))$">
Order allow,deny
Deny from all
</Files>
@@ -306,14 +337,19 @@ EOF;
*/
protected function acpHtaccess()
{
if ( \IPS\NO_WRITES )
{
\IPS\Output::i()->error( 'no_writes', '1C258/6', 403, '' );
}
if ( !is_writable( \IPS\ROOT_PATH . '/' . \IPS\CP_DIRECTORY ) )
{
\IPS\Output::i()->error( \IPS\Member::loggedIn()->language()->addToStack( 'err_not_writable', FALSE, array( 'sprintf' => array( \IPS\ROOT_PATH . '/' . \IPS\CP_DIRECTORY ) ) ), '1C258/5', 403, '' );
}
$form = new \IPS\Helpers\Form;
$form->add( new \IPS\Helpers\Form\Text( 'username', NULL, TRUE ) );
$form->add( new \IPS\Helpers\Form\Password( 'password', NULL, TRUE ) );
$form->add( new \IPS\Helpers\Form\Text( 'htaccess_username', NULL, TRUE ) );
$form->add( new \IPS\Helpers\Form\Password( 'htaccess_password', NULL, TRUE ) );
if ( $values = $form->values() )
{
@@ -325,8 +361,8 @@ EOF;
. 'AuthUserFile "' . \IPS\ROOT_PATH . '/' . \IPS\CP_DIRECTORY . "/.htpasswd\"\n"
. "Require valid-user\n";
$htaccess_pw = $values['username'] . ":" .
( ( mb_strtoupper( mb_substr( PHP_OS, 0, 3 ) ) === 'WIN' ) ? $values['password'] : crypt( $values['password'], base64_encode( $values['password'] ) ) );
$htaccess_pw = $values['htaccess_username'] . ":" .
( ( mb_strtoupper( mb_substr( PHP_OS, 0, 3 ) ) === 'WIN' ) ? $values['htaccess_password'] : crypt( $values['htaccess_password'], base64_encode( $values['htaccess_password'] ) ) );
if ( $FH = @\fopen( \IPS\ROOT_PATH . '/' . \IPS\CP_DIRECTORY . '/.htpasswd', 'w' ) )
{
@@ -340,6 +376,7 @@ EOF;
$done = TRUE;
\IPS\Session::i()->log( 'acplogs__security_acp_password' );
\IPS\IPS::resyncIPSCloud();
}
/* All Done */