diff --git a/Sources/Subs-Compat.php b/Sources/Subs-Compat.php index 1af33ee207..1bfc34cfd0 100644 --- a/Sources/Subs-Compat.php +++ b/Sources/Subs-Compat.php @@ -30,1501 +30,1497 @@ * global functions as wrappers around class methods. */ if (!empty(SMF\Config::$backward_compatibility)) { - /**************************** - * Begin SMF\Actions\Activate - ****************************/ - /** - * Activate an users account. - * - * Checks for mail changes, resends password if needed. + * I solemly swear to no longer chase squirrels. */ - function Activate() + function AcceptAgreement(): void { - return SMF\Actions\Activate::call(); + SMF\Actions\AgreementAccept::call(); } - /***************************** - * Begin SMF\Actions\Admin\ACP - *****************************/ - /** - * The main admin handling function.
- * It initialises all the basic context required for the admin center.
- * It passes execution onto the relevant admin section.
- * If the passed section is not found it shows the admin home page. + * Handles the account section of the profile + * + * @param int $memID The ID of the member */ - function AdminMain() + function account(int $memID): void { - return SMF\Actions\Admin\ACP::call(); + if ((SMF\Profile::$member->id ?? NAN) !== $memID) { + unset(SMF\Profile::$member); + SMF\Profile::load($memID); + } + + SMF\Actions\Profile\Account::call(); } /** - * Helper function, it sets up the context for database settings. - * - * @todo see rev. 10406 from 2.1-requests + * Activate an users account. * - * @param array $config_vars An array of configuration variables + * Checks for mail changes, resends password if needed. */ - function prepareDBSettingContext(&$config_vars): void + function Activate() { - SMF\Actions\Admin\ACP::prepareDBSettingContext($config_vars); + return SMF\Actions\Activate::call(); } /** - * Helper function. Saves settings by putting them in Settings.php or saving them in the settings table. - * - * - Saves those settings set from ?action=admin;area=serversettings. - * - Requires the admin_forum permission. - * - Contains arrays of the types of data to save into Settings.php. + * Activate an account. * - * @param array $config_vars An array of configuration variables + * @param int $memID The ID of the member whose account we're activating */ - function saveSettings(&$config_vars): void + function activateAccount(int $memID): void { - SMF\Actions\Admin\ACP::saveSettings($config_vars); + if ((SMF\Profile::$member->id ?? NAN) !== $memID) { + unset(SMF\Profile::$member); + SMF\Profile::load($memID); + } + + SMF\Actions\Profile\Activate::call(); } /** - * Helper function for saving database settings. - * - * @todo see rev. 10406 from 2.1-requests + * Add a function for integration hook. + * Does nothing if the function is already added. + * Cleans up enabled/disabled variants before taking requested action. * - * @param array $config_vars An array of configuration variables + * @param string $name The complete hook name. + * @param string $function The function name. Can be a call to a method via Class::method. + * @param bool $permanent If true, updates the value in settings table. + * @param string $file The file. Must include one of the following wildcards: $boarddir, $sourcedir, $themedir, example: $sourcedir/Test.php + * @param bool $object Indicates if your class will be instantiated when its respective hook is called. If true, your function must be a method. */ - function saveDbSettings(&$config_vars): void - { - SMF\Actions\Admin\ACP::saveDBSettings($config_vars); + function add_integration_function( + string $name, + string $function, + bool $permanent = true, + string $file = '', + bool $object = false, + ): void { + SMF\IntegrationHook::add( + $name, + $function, + $permanent, + $file, + $object, + ); } /** - * Get a list of versions that are currently installed on the server. + * Add a block of inline css code to be executed later * - * @param array $checkFor An array of what to check versions for - can contain one or more of 'gd', 'imagemagick', 'db_server', 'phpa', 'memcache', 'php' or 'server' - * @return array An array of versions (keys are same as what was in $checkFor, values are the versions) + * - only use this if you have to, generally external css files are better, but for very small changes + * or for scripts that require help from PHP/whatever, this can be useful. + * - all code added with this function is added to the same