Forum
in package
The root Forum class. Used when browsing the forum normally.
This, as you have probably guessed, is the crux on which SMF functions.
The most interesting part of this file for modification authors is the action array. It is formatted as so:
'action-in-url' => array('Source-File.php', 'FunctionToCall'),
Then, you can access the FunctionToCall() function from Source-File.php with the URL index.php?action=action-in-url. Relatively simple, no?
Table of Contents
Properties
- $actions : array<string|int, mixed>
- $guest_access_actions : array<string|int, mixed>
- $unlogged_actions : array<string|int, mixed>
Methods
- __construct() : mixed
- Constructor
- execute() : mixed
- This is the one that gets stuff done.
- inMaintenance() : mixed
- Display a message about the forum being in maintenance mode.
- main() : array<string|int, mixed>|string|void
- The main dispatcher.
Properties
$actions
public
static array<string|int, mixed>
$actions
= [
'agreement' => ['', 'SMF\\Actions\\Agreement::call'],
'acceptagreement' => ['', 'SMF\\Actions\\AgreementAccept::call'],
'activate' => ['', 'SMF\\Actions\\Activate::call'],
'admin' => ['', 'SMF\\Actions\\Admin\\ACP::call'],
'announce' => ['', 'SMF\\Actions\\Announce::call'],
'attachapprove' => ['', 'SMF\\Actions\\AttachmentApprove::call'],
'buddy' => ['', 'SMF\\Actions\\BuddyListToggle::call'],
'calendar' => ['', 'SMF\\Actions\\Calendar::call'],
'clock' => ['', 'SMF\\Actions\\Calendar::call'],
// Deprecated; is now a sub-action
'coppa' => ['', 'SMF\\Actions\\CoppaForm::call'],
'credits' => ['', 'SMF\\Actions\\Credits::call'],
'deletemsg' => ['', 'SMF\\Actions\\MsgDelete::call'],
'dlattach' => ['', 'SMF\\Actions\\AttachmentDownload::call'],
'editpoll' => ['', 'SMF\\Poll::edit'],
'editpoll2' => ['', 'SMF\\Poll::edit2'],
'findmember' => ['', 'SMF\\Actions\\FindMember::call'],
'groups' => ['', 'SMF\\Actions\\Groups::call'],
'help' => ['', 'SMF\\Actions\\Help::call'],
'helpadmin' => ['', 'SMF\\Actions\\HelpAdmin::call'],
'jsmodify' => ['', 'SMF\\Actions\\JavaScriptModify::call'],
'jsoption' => ['', 'SMF\\Theme::setJavaScript'],
'likes' => ['', 'SMF\\Actions\\Like::call'],
'lock' => ['', 'SMF\\Topic::lock'],
'lockvoting' => ['', 'SMF\\Poll::lock'],
'login' => ['', 'SMF\\Actions\\Login::call'],
'login2' => ['', 'SMF\\Actions\\Login2::call'],
'logintfa' => ['', 'SMF\\Actions\\LoginTFA::call'],
'logout' => ['', 'SMF\\Actions\\Logout::call'],
'markasread' => ['', 'SMF\\Board::MarkRead'],
'mergetopics' => ['', 'SMF\\Actions\\TopicMerge::call'],
'mlist' => ['', 'SMF\\Actions\\Memberlist::call'],
'moderate' => ['', 'SMF\\Actions\\Moderation\\Main::call'],
'modifycat' => ['', 'SMF\\Actions\\Admin\\Boards::modifyCat'],
'movetopic' => ['', 'SMF\\Actions\\TopicMove::call'],
'movetopic2' => ['', 'SMF\\Actions\\TopicMove2::call'],
'notifyannouncements' => ['', 'SMF\\Actions\\NotifyAnnouncements::call'],
'notifyboard' => ['', 'SMF\\Actions\\NotifyBoard::call'],
'notifytopic' => ['', 'SMF\\Actions\\NotifyTopic::call'],
'pm' => ['', 'SMF\\Actions\\PersonalMessage::call'],
'post' => ['', 'SMF\\Actions\\Post::call'],
'post2' => ['', 'SMF\\Actions\\Post2::call'],
'printpage' => ['', 'SMF\\Actions\\TopicPrint::call'],
'profile' => ['', 'SMF\\Actions\\Profile\\Main::call'],
'quotefast' => ['', 'SMF\\Actions\\QuoteFast::call'],
'quickmod' => ['', 'SMF\\Actions\\QuickModeration::call'],
'quickmod2' => ['', 'SMF\\Actions\\QuickModerationInTopic::call'],
'recent' => ['', 'SMF\\Actions\\Recent::call'],
'reminder' => ['', 'SMF\\Actions\\Reminder::call'],
'removepoll' => ['', 'SMF\\Poll::remove'],
'removetopic2' => ['', 'SMF\\Actions\\TopicRemove::call'],
'reporttm' => ['', 'SMF\\Actions\\ReportToMod::call'],
'requestmembers' => ['', 'SMF\\Actions\\RequestMembers::call'],
'restoretopic' => ['', 'SMF\\Actions\\TopicRestore::call'],
'search' => ['', 'SMF\\Actions\\Search::call'],
'search2' => ['', 'SMF\\Actions\\Search2::call'],
'sendactivation' => ['', 'SMF\\Actions\\SendActivation::call'],
'signup' => ['', 'SMF\\Actions\\Register::call'],
'signup2' => ['', 'SMF\\Actions\\Register2::call'],
'smstats' => ['', 'SMF\\Actions\\SmStats::call'],
'suggest' => ['', 'SMF\\Actions\\AutoSuggest::call'],
'splittopics' => ['', 'SMF\\Actions\\TopicSplit::call'],
'stats' => ['', 'SMF\\Actions\\Stats::call'],
'sticky' => ['', 'SMF\\Topic::sticky'],
'theme' => ['', 'SMF\\Theme::dispatch'],
'trackip' => ['', 'SMF\\Actions\\TrackIP::call'],
'about:unknown' => ['', 'SMF\\Actions\\Like::BookOfUnknown'],
'unread' => ['', 'SMF\\Actions\\Unread::call'],
'unreadreplies' => ['', 'SMF\\Actions\\UnreadReplies::call'],
'uploadAttach' => ['', 'SMF\\Actions\\AttachmentUpload::call'],
'verificationcode' => ['', 'SMF\\Actions\\VerificationCode::call'],
'viewprofile' => ['', 'SMF\\Actions\\Profile\\Main::call'],
'vote' => ['', 'SMF\\Poll::vote'],
'viewquery' => ['', 'SMF\\Actions\\ViewQuery::call'],
'viewsmfile' => ['', 'SMF\\Actions\\DisplayAdminFile::call'],
'who' => ['', 'SMF\\Actions\\Who::call'],
'.xml' => ['', 'SMF\\Actions\\Feed::call'],
'xmlhttp' => ['', 'SMF\\Actions\\XmlHttp::call'],
]
This array defines what file to load and what function to call for each possible value of $_REQUEST['action'].
When calling an autoloading class, the file can be left empty.
Mod authors can add new actions to this via the integrate_actions hook.
$guest_access_actions
public
static array<string|int, mixed>
$guest_access_actions
= ['coppa', 'login', 'login2', 'logintfa', 'reminder', 'activate', 'help', 'helpadmin', 'smstats', 'verificationcode', 'signup', 'signup2']
Actions that guests are always allowed to do. This allows users to log in when guest access is disabled.
$unlogged_actions
public
static array<string|int, mixed>
$unlogged_actions
= ['about:unknown' => true, 'clock' => true, 'dlattach' => true, 'findmember' => true, 'helpadmin' => true, 'jsoption' => true, 'likes' => true, 'modifycat' => true, 'pm' => ['sa' => ['popup']], 'profile' => ['area' => ['popup', 'alerts_popup', 'download', 'dlattach']], 'requestmembers' => true, 'smstats' => true, 'suggest' => true, 'verificationcode' => true, 'viewquery' => true, 'viewsmfile' => true, 'xmlhttp' => true, '.xml' => true]
This array defines actions, sub-actions, and/or areas where user activity should not be logged. For example, if the user downloads an attachment via the dlattach action, that's not something we want to log.
Array keys are actions. Array values are either:
-
true, which means the action as a whole should not be logged.
-
a multidimensional array indicating specific sub-actions or areas that should not be logged.
For example, 'pm' => array('sa' => array('popup')) means that we won't log visits to index.php?action=pm;sa=popup, but other sub-actions like index.php?action=pm;sa=send will be logged.
Methods
__construct()
Constructor
public
__construct() : mixed
execute()
This is the one that gets stuff done.
public
execute() : mixed
Internally, this calls $this->main() to find out what function to call, then calls that function, and then calls obExit() in order to send results to the browser.
inMaintenance()
Display a message about the forum being in maintenance mode.
public
static inMaintenance() : mixed
- display a login screen with sub template 'maintenance'.
- sends a 503 header, so search engines don't bother indexing while we're in maintenance mode.
main()
The main dispatcher.
protected
main() : array<string|int, mixed>|string|void
This delegates to each area.
Return values
array<string|int, mixed>|string|void —An array containing the file to include and name of function to call, the name of a function to call or dies with a fatal_lang_error if we couldn't find anything to do.