Unofficial SMF API Documentation

./Sources/ManageServer.php

ModifySettings

function ModifySettings(): void

This is the main dispatcher. Sets up all the available sub-actions, all the tabs and selects the appropriate one based on the sub-action.

Requires the admin_forum permission. Redirects to the appropriate function based on the sub-action.

Uses edit_settings adminIndex.

Integration hooks
integrate_server_settings

ModifyGeneralSettings

function ModifyGeneralSettings(bool $return_config = false): void|array

General forum settings - forum name, maintenance mode, etc.

Practically, this shows an interface for the settings in Settings.php to be changed.

Type Parameter Description
bool $return_config Whether to return the $config_vars array (for pagination purposes)
Integration hooks
integrate_general_settings
integrate_save_general_settings

AlignURLsWithSSLSetting

function AlignURLsWithSSLSetting(int $new_force_ssl = 0): void

Align URLs with SSL Setting.

If force_ssl has changed, ensure all URLs are aligned with the new setting. This includes: - $boardurl - $modSettings[‘smileys_url’] - $modSettings[‘avatar_url’] - $modSettings[‘custom_avatar_url’] - if found - theme_url - all entries in the themes table - images_url - all entries in the themes table

This function will NOT overwrite URLs that are not subfolders of $boardurl. The admin must have pointed those somewhere else on purpose, so they must be updated manually.

A word of caution: You can’t trust the http/https scheme reflected for these URLs in $globals (e.g., $boardurl) or in $modSettings. This is because SMF may change them in memory to comply with the force_ssl setting - a soft redirect may be in effect… Thus, conditional updates to these values do not work. You gotta just brute force overwrite them based on force_ssl.

Type Parameter Description
int $new_force_ssl is the current force_ssl setting.

BoardurlMatch

function BoardurlMatch(string $url = ''): bool

$boardurl Match.

Helper function to see if the url being checked is based off of $boardurl. If not, it was overridden by the admin to some other value on purpose, and should not be stepped on by SMF when aligning URLs with the force_ssl setting. The site admin must change URLs that are not aligned with $boardurl manually.

Type Parameter Description
string $url is the url to check.

ModifyDatabaseSettings

function ModifyDatabaseSettings(bool $return_config = false): void|array

Basic database and paths settings - database name, host, etc.

Type Parameter Description
bool $return_config Whether or not to return the config_vars array (used for admin search)
Integration hooks
integrate_database_settings
integrate_save_database_settings

ModifyCookieSettings

function ModifyCookieSettings(bool $return_config = false): void|array

This function handles cookies settings modifications.

Type Parameter Description
bool $return_config Whether or not to return the config_vars array (used for admin search)
Integration hooks
integrate_cookie_settings
integrate_save_cookie_settings

ModifyGeneralSecuritySettings

function ModifyGeneralSecuritySettings(bool $return_config = false): void|array

Settings really associated with general security aspects.

Type Parameter Description
bool $return_config Whether or not to return the config_vars array (used for admin search)
Integration hooks
integrate_general_security_settings
integrate_save_general_security_settings

ModifyCacheSettings

function ModifyCacheSettings(bool $return_config = false): void|array

Simply modifying cache functions

Type Parameter Description
bool $return_config Whether or not to return the config_vars array (used for admin search)
Integration hooks
integrate_modify_cache_settings
integrate_save_cache_settings

ModifyExportSettings

function ModifyExportSettings(bool $return_config = false): void|array

Controls settings for data export functionality

Type Parameter Description
bool $return_config Whether or not to return the config_vars array (used for admin search)
Integration hooks
integrate_export_settings
integrate_save_export_settings

ModifyLoadBalancingSettings

function ModifyLoadBalancingSettings(bool $return_config = false): void|array

Allows to edit load balancing settings.

Type Parameter Description
bool $return_config Whether or not to return the config_vars array
Integration hooks
integrate_loadavg_settings
integrate_save_loadavg_settings

prepareServerSettingsContext

function prepareServerSettingsContext(array &$config_vars): void

Helper function, it sets up the context for the manage server settings.

the following named keys are also permitted ‘disabled’ => A string of code that will determine whether or not the setting should be disabled ‘postinput’ => Text to display after the input field ‘preinput’ => Text to display before the input field ‘subtext’ => Additional descriptive text to display under the field’s label ‘min’ => minimum allowed value (for int/float). Defaults to 0 if not set. ‘max’ => maximum allowed value (for int/float) ‘step’ => how much to increment/decrement the value by (only for int/float - mostly used for float values).

Type Parameter Description
array $config_vars An array of configuration variables

prepareDBSettingContext

function prepareDBSettingContext(array &$config_vars): void

Helper function, it sets up the context for database settings.

Type Parameter Description
array $config_vars An array of configuration variables
Integration hooks
integrate_prepare_db_settings

saveSettings

function saveSettings(array &$config_vars): void

Helper function. Saves settings by putting them in Settings.php or saving them in the settings table.

Type Parameter Description
array $config_vars An array of configuration variables

saveDBSettings

function saveDBSettings(array &$config_vars): void

Helper function for saving database settings.

Type Parameter Description
array $config_vars An array of configuration variables

ShowPHPinfoSettings

function ShowPHPinfoSettings(): void

Allows us to see the servers php settings

loadCacheAPIs

function loadCacheAPIs(): void

Get the installed Cache API implementations.

Integration hooks
integrate_load_cache_apis

registerSMStats

function registerSMStats(): void

Registers the site with the Simple Machines Stat collection. This function purposely does not use updateSettings.php as it will be called shortly after this process completes by the saveSettings() function.

Suggest an edit to this page on GitHub