Subs-Compat.php
This file provides compatibility functions and code for older versions of SMF and PHP, such as missing extensions or 64-bit vs 32-bit systems.
Simple Machines Forum (SMF)
Tags
Table of Contents
Functions
- Activate() : mixed
- Activate an users account.
- AdminMain() : mixed
- The main admin handling function.<br> It initialises all the basic context required for the admin center.<br> It passes execution onto the relevant admin section.<br> If the passed section is not found it shows the admin home page.
- prepareDBSettingContext() : void
- Helper function, it sets up the context for database settings.
- saveSettings() : void
- Helper function. Saves settings by putting them in Settings.php or saving them in the settings table.
- saveDbSettings() : void
- Helper function for saving database settings.
- getServerVersions() : array<string|int, mixed>
- Get a list of versions that are currently installed on the server.
- getFileVersions() : array<string|int, mixed>
- Search through source, theme and language files to determine their version.
- updateAdminPreferences() : void
- Saves the admin's current preferences to the database.
- emailAdmins() : void
- Send all the administrators a lovely email.
- adminLogin() : void
- Question the verity of the admin by asking for his or her password.
- ModifyAntispamSettings() : array<string|int, mixed>|null
- Let's try keep the spam to a minimum ah Thantos?
- ManageAttachments() : mixed
- The main 'Attachments and Avatars' management function.
- attachDirStatus() : array<string|int, mixed>
- Checks the status of an attachment directory and returns an array of the status key, if that status key signifies an error, and the file count.
- ManageAttachmentSettings() : array<string|int, mixed>|null
- Allows to show/change attachment settings.
- ManageAvatarSettings() : array<string|int, mixed>|null
- This allows to show/change avatar settings.
- BrowseFiles() : void
- Show a list of attachment or avatar files.
- MaintainFiles() : void
- Show several file maintenance options.
- RemoveAttachment() : void
- Remove a selection of attachments or avatars.
- RemoveAttachmentByAge() : void
- Remove attachments older than a given age.
- RemoveAttachmentBySize() : void
- Remove attachments larger than a given size.
- RemoveAllAttachments() : void
- Removes all attachments in a single click Called from the maintenance screen by ?action=admin;area=manageattachments;sa=removeall.
- RepairAttachments() : void
- This function should find attachments in the database that no longer exist and clear them, and fix filesize issues.
- ManageAttachmentPaths() : void
- This function lists and allows updating of multiple attachments paths.
- TransferAttachments() : void
- Maintance function to move attachments from one directory to another
- Ban() : void
- Ban center. The main entrance point for all ban center functions.
- updateBanMembers() : void
- As it says... this tries to review the list of banned members, to match new bans.
- BanList() : void
- Shows a list of bans currently set.
- BanEdit() : void
- This function is behind the screen for adding new bans and modifying existing ones.
- BanBrowseTriggers() : void
- This handles the screen for showing the banned entities It is accessed by ?action=admin;area=ban;sa=browse It uses sub-tabs for browsing by IP, hostname, email or username.
- BanEditTrigger() : void
- This function handles the ins and outs of the screen for adding new ban triggers or modifying existing ones.
- BanLog() : void
- This handles the listing of ban log entries, and allows their deletion.
- ManageBoards() : void
- The main dispatcher; doesn't do anything, just delegates.
- EditBoardSettings() : array<string|int, mixed>|null
- A screen to set a few general board and category settings.
- ManageCalendar() : void
- The main controlling function doesn't have much to do... yet.
- ModifyHolidays() : void
- The function that handles adding, and deleting holiday data
- EditHoliday() : void
- This function is used for adding/editing a specific holiday
- ModifyCalendarSettings() : array<string|int, mixed>|null
- Show and allow to modify calendar settings. Obviously.
- AdminEndSession() : void
- This ends a admin session, requiring authentication to access the ACP again.
- ViewErrorLog() : void
- View the forum's error log.
- ModifyFeatureSettings() : void
- This function passes control through to the relevant tab.
- ModifyBasicSettings() : array<string|int, mixed>|null
- Config array for changing the basic forum settings Accessed from ?action=admin;area=featuresettings;sa=basic;
- ModifyBBCSettings() : array<string|int, mixed>|null
- Set a few Bulletin Board Code settings. It loads a list of Bulletin Board Code tags to allow disabling tags.
- ModifyLayoutSettings() : array<string|int, mixed>|null
- Allows modifying the global layout settings in the forum Accessed through ?action=admin;area=featuresettings;sa=layout;
- ModifySignatureSettings() : array<string|int, mixed>|null
- You'll never guess what this function does.
- ShowCustomProfiles() : void
- Show all the custom profile fields available to the user.
- EditCustomProfiles() : void
- Edit some profile fields?
- ModifyLikesSettings() : array<string|int, mixed>|null
- Config array for changing like settings Accessed from ?action=admin;area=featuresettings;sa=likes;
- ModifyMentionsSettings() : array<string|int, mixed>|null
- Config array for changing like settings Accessed from ?action=admin;area=featuresettings;sa=mentions;
- ModifyAlertsSettings() : void
- Handles modifying the alerts settings
- AdminSearch() : void
- This function allocates out all the search stuff.
- AdminHome() : void
- The main administration section.
- ManageLanguages() : void
- This is the main function for the languages area.
- ModifyLanguages() : void
- This lists all the current languages and allows editing of them.
- AddLanguage() : void
- Interface for adding a new language
- ModifyLanguageSettings() : array<string|int, mixed>|null
- Edit language related settings.
- DownloadLanguage() : void
- Download a language file from the Simple Machines website.
- ModifyLanguage() : void
- Edit a particular set of language entries.
- AdminLogs() : array<string|int, mixed>|null
- This function decides which log to load.
- ManageMail() : void
- Main dispatcher. This function checks permissions and passes control through to the relevant section.
- BrowseMailQueue() : void
- Display the mail queue.
- ClearMailQueue() : void
- This function clears the mail queue of all emails, and at the end redirects to browse.
- ModifyMailSettings() : array<string|int, mixed>|null
- Allows to view and modify the mail settings.
- TestMailSend() : void
- Test mail sending ability.
- ManageMaintenance() : void
- Main dispatcher, the maintenance access point.
- get_integration_hooks_data() : array<string|int, mixed>
- Callback function for the integration hooks list (list_integration_hooks) Gets all of the hooks in the system and their status
- reattributePosts() : array<string|int, mixed>
- This function is used to reassociate members with relevant posts.
- MaintainRoutine() : void
- Supporting function for the routine maintenance area.
- MaintainDatabase() : void
- Supporting function for the database maintenance area.
- MaintainMembers() : void
- Supporting function for the members maintenance area.
- MaintainTopics() : void
- Supporting function for the topics maintenance area.
- list_integration_hooks() : void
- Generates a list of integration hooks for display Accessed through ?action=admin;area=maintain;sa=hooks; Allows for removal or disabling of selected hooks
- VersionDetail() : void
- Perform a detailed version check. A very good thing ;).
- MaintainFindFixErrors() : void
- Find and fix all errors on the forum.
- AdminBoardRecount() : void
- Recount many forum totals that can be recounted automatically without harm.
- RebuildSettingsFile() : void
- Rebuilds Settings.php to make it nice and pretty.
- MaintainEmptyUnimportantLogs() : void
- Empties all uninmportant logs
- MaintainCleanCache() : void
- Wipes the whole cache.
- OptimizeTables() : void
- Optimizes all tables in the database and lists how much was saved.
- ConvertEntities() : void
- Converts HTML-entities to their UTF-8 character equivalents.
- ConvertMsgBody() : void
- Convert the column "body" of the table {db_prefix}messages from TEXT to MEDIUMTEXT and vice versa.
- MaintainReattributePosts() : void
- Re-attribute posts.
- MaintainPurgeInactiveMembers() : void
- Removing old members. Done and out!
- MaintainRecountPosts() : void
- Recalculate all members post counts it requires the admin_forum permission.
- MaintainMassMoveTopics() : void
- Moves topics from one board to another.
- MaintainRemoveOldPosts() : void
- Removing old posts doesn't take much as we really pass through.
- MaintainRemoveOldDrafts() : void
- Removing old drafts
- ModifyMembergroups() : void
- Main dispatcher, the entrance point for all 'Manage Membergroup' actions.
- AddMemberGroup() : void
- This function handles adding a membergroup and setting some initial properties.
- DeleteMembergroup() : void
- Deleting a membergroup by URL (not implemented).
- EditMembergroup() : void
- Editing a membergroup.
- MembergroupIndex() : void
- Shows an overview of the current membergroups.
- ModifyMembergroupsettings() : array<string|int, mixed>|null
- Set some general membergroup settings and permissions.
- ViewMembers() : void
- The main entrance point for the Manage Members screen.
- ViewMemberlist() : void
- View all members list. It allows sorting on several columns, and deletion of selected members. It also handles the search query sent by ?action=admin;area=viewmembers;sa=search.
- AdminApprove() : void
- This function handles the approval, rejection, activation or deletion of members.
- MembersAwaitingActivation() : void
- List all members who are awaiting approval / activation, sortable on different columns.
- SearchMembers() : void
- Search the member list, using one or more criteria.
- ModifyModSettings() : array<string|int, mixed>|null
- This my friend, is for all the mod authors out there.
- ManageNews() : void
- The news dispatcher; doesn't do anything, just delegates.
- prepareMailingForPreview() : void
- Prepare subject and message of an email for the preview box Used in ComposeMailing and RetrievePreview (Xml.php)
- EditNews() : void
- Let the administrator(s) edit the news items for the forum.
- SelectMailingMembers() : void
- This function allows a user to select the membergroups to send their mailing to.
- ComposeMailing() : void
- Shows a form to edit a forum mailing and its recipients.
- SendMailing() : void
- Handles the sending of the forum mailing in batches.
- ModifyNewsSettings() : array<string|int, mixed>|null
- Set general news and newsletter settings and permissions.
- ModifyPermissions() : void
- Dispatches to the right function based on the given subaction.
- theme_inline_permissions() : void
- Show a collapsible box to set a specific permission.
- loadPermissionProfiles() : void
- Load permissions profiles.
- updateChildPermissions() : bool|null
- This function updates the permissions of any groups based off this group.
- loadIllegalPermissions() : array<string|int, mixed>
- Load permissions someone cannot grant.
- PermissionIndex() : void
- Sets up the permissions by membergroup index page.
- PermissionsByBoard() : void
- Handle permissions by board... more or less. :P
- ModifyMembergroup() : void
- Initializes the necessary to modify a membergroup's permissions.
- ModifyMembergroup2() : void
- This function actually saves modifications to a membergroup's board permissions.
- SetQuickGroups() : void
- Handles permission modification actions from the upper part of the permission manager index.
- ModifyPostModeration() : void
- Present a nice way of applying post moderation.
- EditPermissionProfiles() : void
- Add/Edit/Delete profiles.
- GeneralPermissionSettings() : array<string|int, mixed>|null
- A screen to set some general settings for permissions.
- ManagePostSettings() : void
- The main entrance point for the 'Posts and topics' screen.
- ModifyPostSettings() : array<string|int, mixed>|null
- Modify any setting related to posts and posting.
- ModifyTopicSettings() : array<string|int, mixed>|null
- Modify any setting related to topics.
- ModifyDraftSettings() : array<string|int, mixed>|null
- Modify any setting related to drafts.
- RegCenter() : void
- Entrance point for the registration center, it checks permissions and forwards to the right function based on the subaction.
- AdminRegister() : void
- This function allows the admin to register a new member by hand.
- EditAgreement() : void
- Allows the administrator to edit the registration agreement, and choose whether it should be shown or not. It writes and saves the agreement to the agreement.txt file.
- EditPrivacyPolicy() : void
- Sure, you can sell my personal info for profit (...or not)
- SetReserved() : void
- Set the names under which users are not allowed to register.
- ModifyRegistrationSettings() : array<string|int, mixed>|null
- This function handles registration settings, and provides a few pretty stats too while it's at it.
- RepairBoards() : void
- Finds or repairs errors in the database to fix possible problems.
- ReportsMain() : void
- Handling function for generating reports.
- BoardReport() : void
- Standard report about what settings the boards have.
- BoardPermissionsReport() : void
- Generate a report on the current permissions by board and membergroup.
- MemberGroupsReport() : void
- Show what the membergroups are made of.
- GroupPermissionsReport() : void
- Show the large variety of group permissions assigned to each membergroup.
- StaffReport() : void
- Report for showing all the forum staff members - quite a feat! functions ending with "Report" are responsible for generating data for reporting.
- ManageSearch() : void
- Main entry point for the admin search settings screen.
- EditSearchSettings() : array<string|int, mixed>|null
- Edit some general settings related to the search function.
- EditWeights() : void
- Edit the relative weight of the search factors.
- EditSearchMethod() : void
- Edit the search method and search index used.
- CreateMessageIndex() : void
- Create a custom search index for the messages table.
- SearchEngines() : void
- Entry point for this section.
- consolidateSpiderStats() : void
- This function takes any unprocessed hits and turns them into stats.
- recacheSpiderNames() : void
- Recache spider names?
- SpiderStats() : void
- Show the spider statistics.
- SpiderLogs() : void
- See what spiders have been up to.
- ViewSpiders() : void
- View a list of all the spiders we know about.
- ManageSearchEngineSettings() : array<string|int, mixed>|null
- This is really just the settings page.
- EditSpider() : void
- Here we can add, and edit, spider info!
- 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.
- prepareServerSettingsContext() : mixed
- Helper function, it sets up the context for the manage server settings.
- ModifyGeneralSettings() : array<string|int, mixed>|null
- General forum settings - forum name, maintenance mode, etc.
- ModifyDatabaseSettings() : array<string|int, mixed>|null
- Basic database and paths settings - database name, host, etc.
- ModifyCookieSettings() : array<string|int, mixed>|null
- This function handles cookies settings modifications.
- ModifyGeneralSecuritySettings() : array<string|int, mixed>|null
- Settings really associated with general security aspects.
- ModifyCacheSettings() : array<string|int, mixed>|null
- Simply modifying cache functions
- ModifyExportSettings() : array<string|int, mixed>|null
- Controls settings for data export functionality
- ModifyLoadBalancingSettings() : array<string|int, mixed>|null
- Allows to edit load balancing settings.
- ShowPHPinfoSettings() : void
- Allows us to see the servers php settings
- ManageSmileys() : void
- This is the dispatcher of smileys administration.
- EditSmileySettings() : array<string|int, mixed>|null
- Handles modifying smileys settings.
- AddSmiley() : void
- Add a smiley, that's right.
- EditSmileys() : void
- Add, remove, edit smileys.
- EditSmileyOrder() : void
- Allows to edit smileys order.
- InstallSmileySet() : void
- Install a smiley set.
- EditMessageIcons() : void
- Handles editing message icons
- ManagePaidSubscriptions() : void
- The main entrance point for the 'Paid Subscription' screen, calling the right function based on the given sub-action.
- loadSubscriptions() : array<string|int, mixed>
- This just kind of caches all the subscription data.
- addSubscription() : void
- Add or extend a subscription of a user.
- removeSubscription() : void
- Removes a subscription from a user, as in removes the groups.
- reapplySubscriptions() : void
- Reapplies all subscription rules for each of the users.
- loadPaymentGateways() : array<string|int, mixed>
- Load all the payment gateways.
- ViewSubscriptions() : void
- View a list of all the current subscriptions Requires the admin_forum permission.
- ViewSubscribedUsers() : void
- View all the users subscribed to a particular subscription.
- ModifySubscription() : void
- Adding, editing and deleting subscriptions.
- ModifyUserSubscription() : void
- Edit or add a user subscription.
- ModifySubscriptionSettings() : array<string|int, mixed>|null
- Set any setting related to paid subscriptions, i.e.
- ManageScheduledTasks() : void
- Scheduled tasks management dispatcher. This function checks permissions and delegates to the appropriate function based on the sub-action.
- ScheduledTasks() : void
- List all the scheduled task in place on the forum.
- EditTask() : void
- Function for editing a task.
- TaskLog() : void
- Show the log of all tasks that have taken place.
- TaskSettings() : array<string|int, mixed>|null
- This handles settings related to scheduled tasks
- ThemesMain() : void
- Subaction handler - manages the action and delegates control to the proper sub-action.
- ThemeAdmin() : void
- This function allows administration of themes and their settings, as well as global theme settings.
- ThemeList() : void
- This function lists the available themes and provides an interface to reset the paths of all the installed themes.
- SetThemeOptions() : void
- Administrative global settings.
- RemoveTheme() : void
- Remove a theme from the database.
- EnableTheme() : void
- Handles enabling/disabling a theme from the admin center
- ThemeInstall() : void
- Installs new themes, calls the respective function according to the install type.
- EditTheme() : void
- Shows an interface for editing the templates.
- CopyTemplate() : void
- Makes a copy of a template file in a new location
- ModifyWarningSettings() : array<string|int, mixed>|null
- Moderation type settings - although there are fewer than we have you believe ;)
- ModEndSession() : void
- This ends a moderator session, requiring authentication to access the MCP again.
- ModerationHome() : void
- This function basically is the home page of the moderation center.
- ViewModlog() : void
- Prepares the information from the moderation log for viewing.
- ModerationMain() : void
- Entry point for the moderation center.
- PostModerationMain() : void
- This is a handling function for all things post moderation.
- approveAllData() : void
- This is a helper function - basically approve everything!
- UnapprovedPosts() : void
- View all unapproved posts.
- UnapprovedAttachments() : void
- View all unapproved attachments.
- ApproveMessage() : void
- Approve a post, just the one.
- ReportedContent() : void
- Sets and call a function based on the given subaction. Acts as a dispatcher function.
- recountOpenReports() : int
- Recount all open reports. Sets a SESSION var with the updated info.
- ShowReports() : void
- Shows all currently open reported posts.
- ShowClosedReports() : void
- Shows all currently closed reported posts.
- ReportDetails() : void
- Shows detailed information about a report. such as report comments and moderator comments.
- HandleReport() : void
- Performs closing/ignoring actions for a given report.
- HandleComment() : void
- Creates/Deletes moderator comments.
- EditComment() : void
- Shows a textarea for editing a moderator comment.
- ShowNotice() : void
- Show a notice sent to a user.
- ViewWarnings() : void
- Entry point for viewing warning related stuff.
- ViewWarningLog() : void
- Simply put, look at the warning log!
- ViewWarningTemplates() : void
- Load all the warning templates.
- ModifyWarningTemplate() : void
- Edit a warning template.
- ViewWatchedUsers() : void
- View watched users.
- account() : void
- Handles the account section of the profile
- activateAccount() : void
- Activate an account.
- alerts_popup() : void
- Set up the requirements for the alerts popup - the area that shows all the alerts just quickly for the current user.
- editBuddyIgnoreLists() : void
- Show all the users buddies, as well as a add/delete interface.
- editBuddies() : void
- Show all the users buddies, as well as a add/delete interface.
- editIgnoreList() : void
- Allows the user to view their ignore list, as well as the option to manage members on it.
- deleteAccount() : void
- Present a screen to make sure the user wants to be deleted
- deleteAccount2() : void
- Actually delete an account.
- export_profile_data() : void
- Initiates exports a member's profile, posts, and personal messages to a file.
- create_export_dir() : string|bool
- Returns the path to a secure directory for storing exported profile data.
- get_export_formats() : array<string|int, mixed>
- Helper function that defines data export formats in a single location.
- export_attachment() : void
- Allows a member to export their attachments.
- download_export_file() : void
- Downloads exported profile data file.
- forumProfile() : void
- Handles the main "Forum Profile" section of the profile
- groupMembership() : void
- Function to allow the user to choose group membership etc.
- groupMembership2() : string
- This function actually makes all the group changes
- ignoreboards() : void
- Handles the "ignored boards" section of the profile (if enabled)
- issueWarning() : void
- Issue/manage an user's warning status.
- ModifyProfile() : void
- The main designating function for modifying profiles. Loads up info, determins what to do, etc.
- notification() : void
- Display the notifications and settings for changes.
- alert_configuration() : void
- Handles configuration of alert preferences
- alert_markread() : void
- Marks all alerts as read for the specified user
- alert_notifications_topics() : void
- Handles alerts related to topics and posts
- alert_notifications_boards() : void
- Handles preferences related to board-level notifications
- makeNotificationChanges() : void
- Make any notification changes that need to be made.
- subscriptions() : void
- Function for doing all the paid subscription stuff - kinda.
- profile_popup() : void
- Set up the requirements for the profile popup - the area that is shown as the popup menu for the current user.
- showAlerts() : void
- Shows all alerts for a member
- showPermissions() : void
- Shows which permissions a user has
- showPosts() : void
- Show all posts by a member
- showUnwatched() : void
- Show all the unwatched topics.
- showAttachments() : void
- Show all the attachments belonging to a member.
- statPanel() : void
- Gets the user stats for display
- summary() : void
- View a summary.
- tfadisable() : void
- Provides interface to disable two-factor authentication in SMF
- tfasetup() : void
- Provides interface to setup Two Factor Auth in SMF
- theme() : void
- Handles the "Look and Layout" section of the profile
- tracking() : void
- Loads up the information for the "track user" section of the profile
- trackActivity() : void
- Handles tracking a user's activity
- trackEdits() : void
- Tracks a user's profile edits
- trackGroupReq() : void
- Display the history of group requests made by the user whose profile we are viewing.
- TrackLogins() : void
- Tracks a user's logins.
- viewWarning() : void
- View a member's warnings
- Agreement() : void
- Let's tell them there's a new agreement
- canRequireAgreement() : bool
- Checks whether this user needs to accept the registration agreement.
- canRequirePrivacyPolicy() : bool
- Checks whether this user needs to accept the privacy policy.
- AcceptAgreement() : void
- I solemly swear to no longer chase squirrels.
- AnnounceTopic() : void
- Handle the announce topic function (action=announce).
- AnnouncementSelectMembergroup() : void
- Allow a user to chose the membergroups to send the announcement to.
- AnnouncementSend() : void
- Send the announcement in chunks.
- ApproveAttach() : void
- Called from a mouse click, works out what we want to do with attachments and actions it.
- showAttachment() : void
- Downloads an avatar or attachment based on $_GET['attach'], and increments the download count.
- AutoSuggestHandler() : bool|null
- This keeps track of all registered handling functions for auto suggest functionality and passes execution to them.
- AutoSuggest_Search_Member() : array<string|int, mixed>
- Search for a member - by real_name or member_name by default.
- AutoSuggest_Search_MemberGroups() : array<string|int, mixed>
- Search for a membergroup by name
- AutoSuggest_Search_SMFVersions() : array<string|int, mixed>
- Provides a list of possible SMF versions to use in emulation
- BoardIndex() : BoardIndex
- This function shows the board index.
- getBoardIndex() : array<string|int, mixed>
- Fetches a list of boards and (optional) categories including statistical information, child boards and moderators.
- BuddyListToggle() : void
- This simple function adds/removes the passed user from the current users buddy list.
- CalendarMain() : void
- Show the calendar.
- iCalDownload() : void
- This function offers up a download of an event in iCal 2.0 format.
- CalendarPost() : void
- This function processes posting/editing/deleting a calendar event.
- getBirthdayRange() : array<string|int, mixed>
- Get all birthdays within the given time range.
- getEventRange() : array<string|int, mixed>
- Get all calendar events within the given time range.
- getHolidayRange() : array<string|int, mixed>
- Get all holidays within the given time range.
- canLinkEvent() : void
- Does permission checks to see if an event can be linked to a board/topic.
- getTodayInfo() : array<string|int, mixed>
- Returns date information about 'today' relative to the users time offset.
- getCalendarGrid() : array<string|int, mixed>
- Provides information (link, month, year) about the previous and next month.
- getCalendarWeek() : array<string|int, mixed>
- Returns the information needed to show a calendar for the given week.
- getCalendarList() : array<string|int, mixed>
- Returns the information needed to show a list of upcoming events, birthdays, and holidays on the calendar.
- loadDatePicker() : void
- Loads the necessary JavaScript and CSS to create a datepicker.
- loadTimePicker() : void
- Loads the necessary JavaScript and CSS to create a timepicker.
- loadDatePair() : void
- Loads the necessary JavaScript for Datepair.js.
- cache_getOffsetIndependentEvents() : array<string|int, mixed>
- Retrieve all events for the given days, independently of the users offset.
- cache_getRecentEvents() : array<string|int, mixed>
- cache callback function used to retrieve the upcoming birthdays, holidays, and events within the given period, taking into account the users time offset.
- validateEventPost() : void
- Makes sure the calendar post is valid.
- getEventPoster() : int|bool
- Get the event's poster.
- removeHolidays() : void
- Remove a holiday from the calendar
- CoppaForm() : void
- This function will display the contact information for the forum, as well a form to fill in.
- Credits() : void
- It prepares credit and copyright information for the credits page or the admin page
- Display() : void
- The central part of the board - topic display.
- DisplayAdminFile() : void
- Get one of the admin information files from Simple Machines.
- ShowXmlFeed() : void
- Outputs xml data representing recent information or a profile.
- buildXmlFeed() : array<string|int, mixed>
- Builds the XML from the data.
- cdata_parse() : string
- Ensures supplied data is properly encapsulated in cdata xml tags Called from getXmlProfile in News.php
- JSMembers() : void
- Called by index.php?action=findmember.
- Groups() : void
- Entry point function, permission checks, admin bars, etc.
- listMembergroupMembers_Href() : bool
- Gets the members of a supplied membergroup Returns them as a link for display
- GroupList() : void
- This very simply lists the groups, nothing snazy.
- MembergroupMembers() : void
- Display members of a group, and allow adding of members to a group. Silly function name though ;) It can be called from ManageMembergroups if it needs templating within the admin environment.
- GroupRequests() : void
- Show and manage all group requests.
- ShowHelp() : void
- Redirect to the user help ;).
- HelpIndex() : void
- The main page for the Help section
- ShowAdminHelp() : void
- Show some of the more detailed help to give the admin an idea... It shows a popup for administrative or user help.
- JavaScriptModify() : void
- Used to edit the body or subject of a message inline called from action=jsmodify from script and topic js
- Login() : void
- Ask them for their login information. (shows a page for the user to type in their username and password.) It caches the referring URL in $_SESSION['login_url'].
- Login2() : void
- Actually logs you in.
- validatePasswordFlood() : void
- This protects against brute force attacks on a member's password.
- LoginTFA() : void
- Allows the user to enter their Two-Factor Authentication code
- Logout() : void
- Logs the current user out of their account.
- MarkRead() : void
- Mark one or more boards as read.
- Memberlist() : void
- Shows a listing of registered members.
- MLAll() : void
- List all members, page by page, with sorting.
- MLSearch() : void
- Search for members, or display search results.
- printMemberListRows() : void
- Retrieves results of the request passed to it Puts results of request into the context for the sub template.
- getCustFieldsMList() : array<string|int, mixed>
- Sets the label, sort and join info for every custom field column.
- MessageIndex() : void
- Show the list of topics in this board, along with any child boards.
- getBoardList() : array<string|int, mixed>
- Generates the query to determine the list of available boards for a user Executes the query and returns the list
- DeleteMessage() : void
- Remove just a single post.
- getNotifyPrefs() : array<string|int, mixed>
- Fetches the list of preferences (or a single/subset of preferences) for notifications for one or more users.
- setNotifyPrefs() : mixed
- Sets the list of preferences for a single user.
- deleteNotifyPrefs() : mixed
- Deletes notification preference
- getMemberWithToken() : array<string|int, mixed>
- Verifies a member's unsubscribe token, then returns some member info
- createUnsubscribeToken() : string
- Builds an unsubscribe token
- AnnouncementsNotify() : void
- Turn off/on notifications for announcements.
- BoardNotify() : void
- Turn off/on notification for a particular board.
- TopicNotify() : void
- Turn off/on unread replies subscription for a topic as well as sets individual topic's alert preferences Must be called with a topic specified in the URL.
- MessageMain() : void
- This helps organize things.
- MessageFolder() : void
- A folder, ie. inbox/sent etc.
- MessagePopup() : void
- The popup for when we ask for the popup from the user.
- ManageLabels() : void
- This function handles adding, deleting and editing labels on messages.
- ManageRules() : void
- List all rules, and allow adding/entering etc.
- MessageActionsApply() : void
- This function performs all additional stuff.
- MessagePrune() : mixed
- This function allows the user to delete all messages older than so many days.
- MessageKillAll() : void
- Delete ALL the messages!
- ReportMessage() : void
- Allows the user to report a personal message to an administrator.
- MessageSearch() : void
- Allows searching through personal messages.
- MessageSearch2() : void
- Actually do the search of personal messages.
- MessagePost() : void
- Send a new message?
- MessagePost2() : void
- Send it!
- MessageSettings() : void
- Allows to edit Personal Message Settings.
- MessageDrafts() : void
- This function allows the user to view their PM drafts
- Post() : void
- Handles showing the post screen, loading the post to be modified, and loading any post quoted.
- Post2() : void
- Posts or saves the message composed with Post().
- QuickModeration() : void
- Handles moderation from the message index.
- QuickInTopicModeration() : void
- In-topic quick moderation.
- QuoteFast() : void
- Loads a post an inserts it into the current editing text box.
- RecentPosts() : void
- Find the ten most recent posts.
- getLastPost() : array<string|int, mixed>
- Get the latest post made on the system
- Register() : void
- Begin the registration process.
- Register2() : void
- Actually register the member.
- registerMember() : int|array<string|int, mixed>
- Registers a member to the forum.
- RemindMe() : void
- This is the controlling delegator
- ReportToModerator() : void
- Report a post or profile to the moderator... ask for a comment.
- ReportToModerator2() : void
- Send the emails.
- reportPost() : void
- Actually reports a post using information specified from a form
- reportUser() : void
- Actually reports a user's profile using information specified from a form
- RequestMembers() : void
- Outputs each member name on its own line.
- PlushSearch1() : void
- Ask the user what they want to search for.
- PlushSearch2() : void
- Gather the results and show them.
- SendActivation() : void
- It doesn't actually send anything, this action just shows a message for a guest.
- SMStats() : void
- This is the function which returns stats to simplemachines.org IF enabled! called by simplemachines.org.
- DisplayStats() : void
- Display some useful/interesting board statistics.
- MergeTopics() : void
- merges two or more topics into one topic.
- MergeIndex() : void
- allows to pick a topic to merge the current topic with.
- MergeExecute() : void
- set merge options and do the actual merge of two or more topics.
- MergeDone() : void
- Shows a 'merge completed' screen.
- MoveTopic() : void
- This function allows to move a topic, making sure to ask the moderator to give reason for topic move.
- MoveTopic2() : void
- Execute the move of a topic.
- moveTopicConcurrence() : mixed
- Called after a topic is moved to update $board_link and $topic_link to point to new location
- PrintTopic() : void
- Format a topic to be printer friendly.
- RemoveTopic2() : void
- Completely remove an entire topic.
- removeDeleteConcurrence() : bool
- Try to determine if the topic has already been deleted by another user.
- RemoveOldTopics2() : mixed
- So long as you are sure... all old posts will be gone.
- RestoreTopic() : void
- Move back a topic from the recycle board to its original board.
- SplitTopics() : void
- splits a topic into two topics.
- splitTopic() : int
- general function to split off a topic.
- SplitIndex() : void
- screen shown before the actual split.
- SplitExecute() : void
- do the actual split.
- SplitSelectTopics() : void
- allows the user to select the messages to be split.
- SplitSelectionExecute() : void
- do the actual split of a selection of topics.
- TrackIP() : void
- Handles tracking a particular IP address
- UnreadTopics() : void
- Find unread topics and replies.
- VerificationCode() : void
- Show the verification code or let it be heard.
- ViewQuery() : void
- Show the database queries for debugging What this does: - Toggles the session variable 'view_queries'.
- Who() : void
- Who's online, and what are they doing? This function prepares the who's online data for the Who template.
- determineActions() : array<string|int, mixed>
- This function determines the actions of the members passed in urls.
- XMLhttpMain() : void
- The main handler and designator for AJAX stuff - jumpto, message icons and previews
- GetJumpTo() : void
- Get a list of boards and categories used for the jumpto dropdown.
- ListMessageIcons() : void
- Gets a list of available message icons and sends the info to the template for display
- RetrievePreview() : bool|null
- Handles retrieving previews of news items, newsletters, signatures and warnings.
- loadCacheAccelerator() : object|false
- Try to load up a supported caching method. This is saved in $cacheAPI if we are not overriding it.
- loadCacheAPIs() : array<string|int, mixed>
- Get the installed Cache API implementations.
- clean_cache() : void
- Empty out the cache in use as best it can
- cache_quick_get() : string
- Try to retrieve a cache entry. On failure, call the appropriate function.
- cache_put_data() : void
- Puts value in the cache under key for ttl seconds.
- cache_get_data() : array<string|int, mixed>|null
- Gets the value from the cache specified by key, so long as it is not older than ttl seconds.
- reloadSettings() : mixed
- Load the $modSettings array.
- updateSettings() : mixed
- Updates the settings table as well as $modSettings... only does one at a time if $update is true.
- get_auth_secret() : string
- Gets, and if necessary creates, the authentication secret to use for cookies, tokens, etc.
- get_settings_defs() : array<string|int, mixed>
- Describes properties of all known Settings.php variables and other content.
- updateSettingsFile() : bool
- Update the Settings.php file.
- safe_file_write() : bool
- Writes data to a file, optionally making a backup, while avoiding race conditions.
- smf_var_export() : mixed
- A wrapper around var_export whose output matches SMF coding conventions.
- updateDbLastError() : bool
- Saves the time of the last db error for the error log - Done separately from updateSettingsFile to avoid race conditions which can occur during a db error - If it fails Settings.php will assume 0
- sm_temp_dir() : string
- Locates the most appropriate temp directory.
- smf_seed_generator() : mixed
- Generate a random seed and ensure it's stored in settings.
- check_cron() : mixed
- Ensures SMF's scheduled tasks are being run as intended
- loadDatabase() : DatabaseApi
- Initialize a database connection.
- db_extend() : void
- Extend the database functionality. It calls the respective file's init to add the implementations in that file to $smcFunc array.
- imageMemoryCheck() : bool
- See if we have enough memory to thumbnail an image
- url_image_size() : array<string|int, mixed>|false
- Get the size of a specified image with better error handling.
- gif_outputAsPng() : bool
- Writes a gif file to disk as a png file.
- getSvgSize() : array<string|int, mixed>
- Gets the dimensions of an SVG image (specifically, of its viewport).
- createThumbnail() : bool
- Create a thumbnail of the given source.
- reencodeImage() : bool
- Used to re-econodes an image to a specified image format - creates a copy of the file at the same location as fileName.
- checkImageContents() : bool
- Searches through the file to see if there's potentially harmful non-binary content.
- checkSvgContents() : bool
- Searches through an SVG file to see if there's potentially harmful content.
- resizeImageFile() : bool
- Resizes an image from a remote location or a local file.
- resizeImage() : bool
- Resizes src_img proportionally to fit within max_width and max_height limits if it is too large.
- read_tgz_file() : array<string|int, mixed>|false
- Reads an archive from either a remote location or from the local filesystem.
- read_tgz_data() : array<string|int, mixed>|false
- Extracts a file or files from the .tar.gz contained in data.
- read_zip_data() : mixed
- Extract zip data.
- url_exists() : bool
- Checks the existence of a remote file since file_exists() does not do remote.
- loadInstalledPackages() : array<string|int, mixed>
- Loads and returns an array of installed packages.
- getPackageInfo() : array<string|int, mixed>|string
- Loads a package's information and returns a representative array.
- create_chmod_control() : array<string|int, mixed>
- Create a chmod control for chmoding files.
- list_restoreFiles() : array<string|int, mixed>
- Get a listing of files that will need to be set back to the original state
- packageRequireFTP() : array<string|int, mixed>
- Use FTP functions to work with a package download/install
- parsePackageInfo() : array<string|int, mixed>
- Parses the actions in package-info.xml file from packages.
- matchHighestPackageVersion() : string|bool
- Checks if version matches any of the versions in `$versions`.
- matchPackageVersion() : bool
- Checks if the forum version matches any of the available versions from the package install xml.
- compareVersions() : int
- Compares two versions and determines if one is newer, older or the same, returns - (-1) if version1 is lower than version2 - (0) if version1 is equal to version2 - (1) if version1 is higher than version2
- parse_path() : string
- Parses special identifiers out of the specified path.
- deltree() : void
- Deletes a directory, and all the files and direcories inside it.
- mktree() : bool
- Creates the specified tree structure with the mode specified.
- copytree() : void
- Copies one directory structure over to another.
- listtree() : array<string|int, mixed>
- Create a tree listing for a given directory path
- parseModification() : array<string|int, mixed>
- Parses a xml-style modification file (file).
- parseBoardMod() : array<string|int, mixed>
- Parses a boardmod-style (.mod) modification file
- package_get_contents() : string
- Get the physical contents of a packages file
- package_put_contents() : int
- Writes data to a file, almost exactly like the file_put_contents() function.
- package_flush_cache() : void
- Flushes the cache from memory to the filesystem
- package_chmod() : bool
- Try to make a file writable.
- package_crypt() : string
- Used to crypt the supplied ftp password in this session
- package_unique_filename() : string
- package_create_backup() : bool
- Creates a backup of forum files prior to modifying them
- package_validate_installtest() : array<string|int, mixed>
- Validate a package during install
- package_validate() : array<string|int, mixed>
- Validate multiple packages.
- package_validate_send() : array<string|int, mixed>
- Sending data off to validate packages.
- sendpm() : array<string|int, mixed>
- Sends an personal message from the specified person to the specified people ($from defaults to the user)
- deleteMessages() : void
- Delete the specified personal messages.
- markMessages() : void
- Mark the specified personal messages read.
- messagePostError() : void
- An error in the message.
- isAccessiblePM() : bool
- Check if the PM is available to the current user.
- LoadRules() : array<string|int, mixed>
- Load up all the rules for the current user.
- ApplyRules() : void
- This will apply rules to all unread messages. If all_messages is set will, clearly, do it to all!
- findSearchAPI() : search_api_interface
- Creates a search API and returns the object.
- loadSearchAPIs() : array<string|int, mixed>
- Get the installed Search API implementations.
- highlight() : string
- Highlighting matching string
- utf8_decompose() : array<string|int, mixed>
- Helper function for utf8_normalize_d and utf8_normalize_kd.
- utf8_compose() : array<string|int, mixed>
- Helper function for utf8_normalize_c and utf8_normalize_kc.
- utf8_strtolower() : string
- Converts the given UTF-8 string into lowercase.
- utf8_strtoupper() : string
- Convert the given UTF-8 string to uppercase.
- utf8_casefold() : string
- Casefolds the given UTF-8 string.
- utf8_convert_case() : string
- Converts the case of the given UTF-8 string.
- utf8_normalize_d() : string
- Normalizes UTF-8 via Canonical Decomposition.
- utf8_normalize_kd() : string
- Normalizes UTF-8 via Compatibility Decomposition.
- utf8_normalize_c() : string
- Normalizes UTF-8 via Canonical Decomposition then Canonical Composition.
- utf8_normalize_kc() : string
- Normalizes UTF-8 via Compatibility Decomposition then Canonical Composition.
- utf8_normalize_kc_casefold() : string
- Casefolds UTF-8 via Compatibility Composition Casefolding.
- utf8_is_normalized() : bool
- Checks whether a string is already normalized to a given form.
- utf8_sanitize_invisibles() : string
- Helper function for sanitize_chars() that deals with invisible characters.
- fetch_web_data() : string|false
- Get the contents of a URL, irrespective of allow_url_fopen.
- fetch_alerts() : array<string|int, mixed>
- Fetch the alerts a member currently has.
- alert_count() : int
- Counts how many alerts a user has - either unread or all depending on $unread We can't use db_num_rows here, as we have to determine what boards the user can see Possibly in future versions as database support for json is mainstream, we can simplify this.
- alert_mark() : int
- Marks a group of alerts as un/read
- alert_delete() : int|null
- Deletes a single or a group of alerts by ID
- alert_purge() : void
- Deletes all the alerts that a user has already read.
- automanage_attachments_check_directory() : bool|null
- Check if the current directory is still valid or not.
- automanage_attachments_create_directory() : bool
- Creates a directory
- automanage_attachments_by_space() : bool|null
- Called when a directory space limit is reached.
- processAttachments() : void
- Moves an attachment to the proper directory and set the relevant data into $_SESSION['temp_attachments']
- attachmentChecks() : bool
- Performs various checks on an uploaded file.
- createAttachment() : bool
- Create an attachment, with the given array of parameters.
- assignAttachments() : bool
- Assigns the given attachments to the given message ID.
- ApproveAttachments() : int|null
- Approve an attachment, or maybe even more - no permission check!
- parseAttachBBC() : mixed
- Gets an attach ID and tries to load all its info.
- getAttachMsgInfo() : array<string|int, mixed>
- Gets all needed message data associated with an attach ID
- loadAttachmentContext() : array<string|int, mixed>
- This loads an attachment's contextual data including, most importantly, its size if it is an image.
- prepareAttachsByMsg() : void
- prepare the Attachment api for all messages
- getAttachmentFilename() : string
- Backward compatibility only.
- get_signature_allowed_bbc_tags() : array<string|int, mixed>
- Return an array with allowed bbc tags for signatures, that can be passed to parse_bbc().
- highlight_php_code() : string
- Highlight any code.
- parse_bbc() : string
- Parse bulletin board code in a string, as well as smileys optionally.
- parseSmileys() : void
- Parse smileys in the passed message.
- html_to_bbc() : string
- Converts HTML to BBC As of SMF 2.1, only used by ManageBoards.php (and possibly mods)
- loadBoard() : array<string|int, mixed>
- Check for moderators and see if they have access to the board.
- markBoardsRead() : void
- Mark a board or multiple boards read.
- getMsgMemberID() : int
- Get the id_member associated with the specified message.
- modifyBoard() : void
- Modify the settings and position of a board.
- createBoard() : int
- Create a new board and set its properties and position.
- deleteBoards() : void
- Remove one or more boards.
- reorderBoards() : void
- Put all boards in the right order and sorts the records of the boards table.
- fixChildren() : void
- Fixes the children of a board by setting their child_levels to new values.
- sortBoards() : void
- Takes a board array and sorts it
- getBoardModerators() : array<string|int, mixed>
- Returns the given board's moderators, with their names and links
- getBoardModeratorGroups() : array<string|int, mixed>
- Returns board's moderator groups with their names and link
- isChildOf() : bool
- Returns whether the child board id is actually a child of the parent (recursive).
- getBoardParents() : array<string|int, mixed>
- Get all parent boards (requires first parent as parameter) It finds all the parents of id_parent, and that board itself.
- detectBrowser() : void
- Loads information about what browser the user is viewing with and places it in $context - uses the class from {@link Class-BrowserDetect.php}
- isBrowser() : bool
- Are we using this browser?
- modifyCategory() : void
- Edit the position and properties of a category.
- createCategory() : mixed
- Create a new category.
- deleteCategories() : void
- Remove one or more categories.
- sortCategories() : void
- Takes a category array and sorts it
- getTreeOrder() : array<string|int, mixed>
- Tries to load up the entire board order and category very very quickly Returns an array with two elements, cats and boards
- getBoardTree() : void
- Load a lot of useful information regarding the boards and categories.
- recursiveBoards() : void
- Recursively get a list of boards.
- setLoginCookie() : void
- Sets the SMF-style login cookie and session based on the id_member and password passed.
- setTFACookie() : void
- Sets Two Factor Auth cookie
- url_parts() : array<string|int, mixed>
- Get the domain and path for the cookie - normally, local and global should be the localCookies and globalCookies settings, respectively.
- hash_salt() : string
- Hashes password with salt and authentication secret. This is solely used for cookies.
- smf_setcookie() : void
- A wrapper for setcookie that gives integration hook access to it
- DeleteDraft() : bool
- Deletes one or many drafts from the DB Validates the drafts are from the user is supplied an array of drafts will attempt to remove all of them
- ShowDrafts() : bool
- Loads in a group of drafts for the user of a given type (0/posts, 1/pm's) loads a specific draft for forum use if selected.
- showProfileDrafts() : void
- Show all drafts of a given type by the current user Uses the showdraft template Allows for the deleting and loading/editing of drafts
- create_control_richedit() : Editor
- Creates a box that can be used for richedit stuff like BBC, Smileys etc.
- getMessageIcons() : array<string|int, mixed>
- Retrieves a list of message icons.
- smf_error_handler() : void
- Handler for standard error messages, standard PHP error handler replacement.
- log_error() : string
- Log an error, if the error logging is enabled.
- fatal_error() : void
- An irrecoverable error. This function stops execution and displays an error message.
- fatal_lang_error() : mixed
- Shows a fatal error with a message stored in the language file.
- display_maintenance_message() : void
- Show a message for the (full block) maintenance mode.
- display_db_error() : void
- Show an error message for the connection problems.
- display_loadavg_error() : void
- Show an error message for load average blocking problems.
- insertEvent() : void
- Consolidating the various INSERT statements into this function.
- modifyEvent() : void
- modifies an event.
- removeEvent() : void
- Remove an event removes an event.
- cache_getMembergroupList() : array<string|int, mixed>
- Retrieve a list of (visible) membergroups used by the cache.
- call_integration_hook() : array<string|int, mixed>
- Process functions of an integration hook.
- add_integration_function() : void
- Add a function for integration hook.
- remove_integration_function() : void
- Remove an integration hook function.
- ip2range() : array<string|int, mixed>
- Convert a single IP to a ranged IP.
- range2ip() : string
- Convert a range of given IP number into a single string.
- isValidIP() : bool
- Check the given String if he is a valid IPv4 or IPv6 return true or false
- isValidIPv6() : bool
- Validates a IPv6 address. returns true if it is ipv6.
- host_from_ip() : string
- Lookup an IP; try shell_exec first because we can do a timeout on it.
- inet_ptod() : string|false
- Converts an IP address into binary
- inet_dtop() : string|false
- Converts a binary version of an IP address into a readable format
- expandIPv6() : string|bool
- Expands a IPv6 address to its full form.
- matchIPtoCIDR() : bool
- Detect if a IP is in a CIDR address - returns true or false
- createList() : ItemList
- Create a new list
- loadLanguage() : string
- Load a language file. Tries the current and default themes as well as the user and global languages.
- getLanguages() : array<string|int, mixed>
- Attempt to reload our known languages.
- censorText() : string
- Replace all vulgar words with respective proper words. (substring or whole words..) What this function does: - it censors the passed string.
- tokenTxtReplace() : string
- sentence_list() : string
- Concatenates an array of strings into a grammatically correct sentence list
- comma_format() : string
- - Formats a number.
- writeLog() : void
- Put this user in the online log.
- logAction() : int
- This function logs an action to the database. It is a thin wrapper around {@link logActions()}.
- logActions() : int
- Log changes to the forum, such as moderation events or administrative changes. This behaves just like {@link logAction()} in SMF 2.0, except that it is designed to log multiple actions at once.
- updateStats() : void
- Update some basic statistics.
- trackStats() : bool
- Track Statistics.
- trackStatsUsersOnline() : void
- Check if the number of users online is a record and store it.
- getMembersOnlineStats() : array<string|int, mixed>
- Retrieve a list and several other statistics of the users currently online.
- displayDebug() : void
- This function shows the debug information tracked when $db_show_debug = true in Settings.php
- sendMail() : bool
- This function sends an email to the specified recipient(s).
- AddMailQueue() : bool
- Add an email to the mail queue.
- reduceQueue() : bool
- mimespecialchars() : array<string|int, mixed>
- Prepare text strings for sending as email body or header.
- serverParse() : bool
- sendNotifications() : mixed
- Sends a notification to members who have elected to receive emails when things happen to a topic, such as replies are posted.
- adminNotify() : void
- This simple function gets a list of all administrators and sends them an email to let them know a new member has joined.
- loadEmailTemplate() : array<string|int, mixed>
- Load a template from EmailTemplates language file.
- createMenu() : bool|array<string|int, mixed>
- Create a menu.
- destroyMenu() : bool|void
- Delete a menu.
- preparsecode() : void
- Takes a message and parses it, returning nothing.
- un_preparsecode() : string
- This is very simple, and just removes things done by preparsecode.
- fixTags() : void
- Fix any URLs posted - ie. remove 'javascript:'.
- fixTag() : void
- Fix a specific class of tag - ie. url with =.
- createPost() : bool
- Create a post, either as new topic (id_topic = 0) or in an existing one.
- modifyPost() : bool
- Modifying a post.
- approvePosts() : bool
- Approve (or not) some posts... without permission checks.
- clearApprovalAlerts() : void
- Upon approval, clear unread alerts.
- updateLastMessages() : bool|null
- Takes an array of board IDs and updates their last messages.
- removeMessage() : bool
- Remove a specific message (including permission checks).
- constructPageIndex() : string
- Constructs a page list.
- Vote() : void
- Allow the user to vote.
- LockVoting() : void
- Lock the voting for a poll.
- EditPoll() : void
- Display screen for editing or adding a poll.
- EditPoll2() : void
- Update the settings for a poll, or add a new one.
- RemovePoll() : void
- Remove a poll from a topic without removing the topic.
- profileValidateSignature() : bool|string
- Validate the signature
- profileLoadGroups() : true
- Handles the "manage groups" section of the profile
- loadProfileFields() : void
- This defines every profile field known to man.
- loadCustomFields() : void
- Load any custom fields for this area... no area means load all, 'summary' loads all public ones.
- loadThemeOptions() : void
- Loads the theme options for a user
- setupProfileContext() : void
- Setup the context for a page load!
- makeCustomFieldChanges() : array<string|int, mixed>|null
- Save any changes to the custom profile fields
- makeThemeChanges() : void
- Make any theme changes that are sent with the profile.
- cleanRequest() : void
- is_filtered_request() : bool
- Compares existance request variables against an array.
- ob_sessrewrite() : string
- Rewrite URLs to include the session ID.
- setMemoryLimit() : bool
- Helper function to set the system memory to a needed value - If the needed memory is greater than current, will attempt to get more - if in_use is set to true, will also try to take the current memory usage in to account
- memoryReturnBytes() : int
- Helper function to convert memory string settings to bytes
- validatePassword() : null|string
- Checks whether a password meets the current forum rules - called when registering/choosing a password.
- generateValidationCode() : string
- Generate a random validation code.
- hash_password() : string
- Hashes the user's password
- hash_verify_password() : bool
- Verifies a raw SMF password against the encrypted string
- hash_benchmark() : int
- Benchmarks the server to figure out an appropriate cost factor (minimum 9)
- checkConfirm() : bool|string
- Check if a specific confirm parameter was given.
- checkSubmitOnce() : bool|null
- Check whether a form has been submitted twice.
- spamProtection() : bool
- This function attempts to protect from spammed messages and the like.
- secureDirectory() : bool|array<string|int, mixed>
- A generic function to create a pair of index.php and .htaccess files in a directory
- frameOptionsHeader() : mixed
- This sets the X-Frame-Options header.
- corsPolicyHeader() : void
- This sets the Access-Control-Allow-Origin header.
- KickGuest() : void
- Throws guests out to the login screen when guest access is off.
- createToken() : array<string|int, mixed>
- Lets give you a token of our appreciation.
- validateToken() : bool
- Only patrons with valid tokens can ride this ride.
- cleanTokens() : void
- Removes old unused tokens from session defaults to 3 hours before a token is considered expired if $complete = true will remove all tokens
- ssi_shutdown() : void
- This shuts down the SSI and shows the footer.
- ssi_version() : void|string
- Show the SMF version.
- ssi_full_version() : void|string
- Show the full SMF version string.
- ssi_software_year() : void|string
- Show the SMF software year.
- ssi_copyright() : void|string
- Show the forum copyright. Only used in our ssi_examples files.
- ssi_welcome() : void|array<string|int, mixed>
- Display a welcome message, like: Hey, User, you have 0 messages, 0 are new.
- ssi_menubar() : array<string|int, mixed>|null
- Display a menu bar, like is displayed at the top of the forum.
- ssi_logout() : string|bool|null
- Show a logout link.
- ssi_recentPosts() : array<string|int, mixed>|null
- Recent post list: [board] Subject by Poster Date
- ssi_fetchPosts() : array<string|int, mixed>|null
- Fetches one or more posts by ID.
- ssi_queryPosts() : array<string|int, mixed>|null
- This handles actually pulling post info. Called from other functions to eliminate duplication.
- ssi_recentTopics() : void|array<string|int, mixed>
- Recent topic list: [board] Subject by Poster Date
- ssi_topPoster() : array<string|int, mixed>|null
- Shows a list of top posters
- ssi_topBoards() : array<string|int, mixed>|null
- Shows a list of top boards based on activity
- ssi_topTopics() : array<string|int, mixed>|null
- Shows a list of top topics based on views or replies
- ssi_topTopicsReplies() : array<string|int, mixed>|null
- Top topics based on replies
- ssi_topTopicsViews() : array<string|int, mixed>|null
- Top topics based on views
- ssi_latestMember() : array<string|int, mixed>|null
- Show a link to the latest member: Please welcome, Someone, our latest member.
- ssi_randomMember() : array<string|int, mixed>|null
- Fetches a random member.
- ssi_fetchMember() : array<string|int, mixed>|null
- Fetch specific members
- ssi_fetchGroupMembers() : array<string|int, mixed>|null
- Get all members in the specified group
- ssi_queryMembers() : array<string|int, mixed>|null
- Pulls info about members based on the specified parameters. Used by other functions to eliminate duplication.
- ssi_boardStats() : array<string|int, mixed>|null
- Show some basic stats: Total This: XXXX, etc.
- ssi_whosOnline() : array<string|int, mixed>|null
- Shows a list of online users: YY Guests, ZZ Users and then a list.
- ssi_logOnline() : array<string|int, mixed>|null
- Just like whosOnline except it also logs the online presence.
- ssi_login() : bool|null
- Shows a login box
- ssi_topPoll() : array<string|int, mixed>|null
- Show the top poll based on votes
- ssi_recentPoll() : array<string|int, mixed>|null
- Shows the most recent poll
- ssi_showPoll() : array<string|int, mixed>|null
- Shows the poll from the specified topic
- ssi_pollVote() : mixed
- Handles voting in a poll (done automatically)
- ssi_quickSearch() : string|null
- Shows a search box
- ssi_news() : string|null
- Show a random forum news item
- ssi_todaysBirthdays() : array<string|int, mixed>|null
- Show today's birthdays.
- ssi_todaysHolidays() : array<string|int, mixed>|null
- Shows today's holidays.
- ssi_todaysEvents() : array<string|int, mixed>|null
- Shows today's events.
- ssi_todaysCalendar() : array<string|int, mixed>|string|null
- Shows today's calendar items (events, birthdays and holidays)
- ssi_boardNews() : array<string|int, mixed>|null
- Show the latest news, with a template... by board.
- ssi_recentEvents() : array<string|int, mixed>|null
- Show the most recent events
- ssi_checkPassword() : bool
- Checks whether the specified password is correct for the specified user.
- ssi_recentAttachments() : array<string|int, mixed>|null
- Shows the most recent attachments that the user can see
- loadSession() : void
- Attempt to start the session, unless it already has been.
- CalculateNextTrigger() : void
- Calculate the next time the passed tasks should be triggered.
- loadTheme() : mixed
- Load a theme, by ID.
- loadEssentialThemeData() : void
- This loads the bare minimum data to allow us to load language files!
- loadTemplate() : bool
- Load a template - if the theme doesn't include it, use the default.
- loadSubTemplate() : mixed
- Load a sub-template.
- loadCSSFile() : void
- Add a CSS file for output later
- addInlineCss() : bool|null
- Add a block of inline css code to be executed later
- loadJavaScriptFile() : void
- Add a Javascript file for output later
- addJavaScriptVar() : mixed
- Add a Javascript variable for output later (for feeding text strings and similar to JS) Cleaner and easier (for modders) than to use the function below.
- addInlineJavaScript() : bool|null
- Add a block of inline Javascript code to be executed later
- setupThemeContext() : mixed
- Sets up the basic theme context stuff.
- setupMenuContext() : void
- Sets up all of the top menu buttons Saves them in the cache if it is available and on Places the results in $context
- template_header() : void
- The header template
- theme_copyright() : void
- Show the copyright.
- template_footer() : void
- The template footer
- template_javascript() : void
- Output the Javascript files - tabbing in this function is to make the HTML source look good and proper - if deferred is set function will output all JS set to load at page end
- template_css() : void
- Output the CSS files
- custMinify() : array<string|int, mixed>
- Get an array of previously defined files and adds them to our main minified files.
- deleteAllMinified() : void
- Clears out old minimized CSS and JavaScript files and ensures $modSettings['browser_cache'] is up to date
- SetJavaScript() : void
- Set an option via javascript.
- WrapAction() : void
- Possibly the simplest and best example of how to use the template system.
- PickTheme() : void
- Choose a theme from a list.
- smf_strftime() : string
- Replacement for strftime() that is compatible with PHP 8.1+.
- smf_gmstrftime() : string
- Replacement for gmstrftime() that is compatible with PHP 8.1+.
- get_date_or_time_format() : string
- Gets a version of a strftime() format that only shows the date or time components
- timeformat() : string
- Format a time to make it look purdy.
- convertDateToEnglish() : string
- Helper function to convert date string to english so that date_parse can parse the date
- forum_time() : int
- Deprecated function that formerly applied manual offsets to Unix timestamps in order to provide a fake version of time zone support on ancient versions of PHP. It now simply returns an unaltered timestamp.
- smf_list_timezones() : array<string|int, mixed>
- Get a list of time zones.
- get_tzid_metazones() : array<string|int, mixed>
- Returns an array that instructs SMF how to map specific time zones (e.g. "America/Denver") onto the user-friendly "meta-zone" labels that most people think of as time zones (e.g. "Mountain Time").
- get_sorted_tzids_for_country() : array<string|int, mixed>
- Returns an array of all the time zones in a country, ranked according to population and/or political significance.
- get_tzid_fallbacks() : array<string|int, mixed>
- Checks a list of time zone identifiers to make sure they are all defined in the installed version of the time zone database, and returns an array of key-value substitution pairs.
- validate_iso_country_codes() : array<string|int, mixed>|string
- Validates a set of two-character ISO 3166-1 country codes.
- LockTopic() : void
- Locks a topic... either by way of a moderator or the topic starter.
- Sticky() : void
- Sticky a topic.
- approveTopics() : bool
- Approve topics?
- moveTopics() : mixed
- Moves one or more topics to a specific board. (doesn't check permissions.) Determines the source boards for the supplied topics Handles the moving of mark_read data Updates the posts count of the affected boards
- removeTopics() : mixed
- Removes the passed id_topic's. (permissions are NOT checked here!).
- prepareLikesContext() : array<string|int, mixed>
- Prepares an array of "likes" info for the topic specified by $topic
- set_tld_regex() : void
- Creates an optimized regex to match all known top level domains.
- parse_iri() : string|int|array<string|int, mixed>|null|bool
- A wrapper for `parse_url($url)` that can handle URLs with international characters (a.k.a. IRIs)
- validate_iri() : string|bool
- A wrapper for `filter_var($url, FILTER_VALIDATE_URL)` that can handle URLs with international characters (a.k.a. IRIs)
- sanitize_iri() : string|bool
- A wrapper for `filter_var($url, FILTER_SANITIZE_URL)` that can handle URLs with international characters (a.k.a. IRIs)
- normalize_iri() : string|bool
- Performs Unicode normalization on IRIs.
- iri_to_url() : string|bool
- Converts a URL with international characters (an IRI) into a pure ASCII URL
- url_to_iri() : string|bool
- Decodes a URL containing encoded international characters to UTF-8
- get_proxied_url() : string
- Gets the appropriate URL to use for images (or whatever) when using SSL
- ssl_cert_found() : bool
- Check if the passed url has an SSL certificate.
- https_redirect_active() : bool
- Check if the passed url has a redirect to https:// by querying headers.
- build_query_board() : array<string|int, mixed>
- Build query_wanna_see_board and query_see_board for a userid
- set_avatar_data() : array<string|int, mixed>
- Helper function to set an array of data for an user's avatar.
- updateMemberData() : void
- Updates the columns in the members table.
- getUserTimezone() : string
- Gets a member's selected time zone identifier
- deleteMembers() : void
- Delete one or more members.
- validateUsername() : array<string|int, mixed>|null
- Checks a username obeys a load of rules
- isReservedName() : bool|void
- Check if a name is in the reserved words list.
- isBannedEmail() : void
- Checks if a given email address might be banned.
- findMembers() : array<string|int, mixed>
- Finds members by email address, username, or real name.
- membersAllowedTo() : array<string|int, mixed>
- Retrieves a list of members that have a given permission (on a given board).
- groupsAllowedTo() : array<string|int, mixed>
- Retrieves a list of membergroups that have the given permission, either on a given board or in general.
- getGroupsWithPermissions() : array<string|int, mixed>
- Retrieves a list of membergroups with the given permissions.
- logSpider() : void
- Log the spider presence online.
- loadMemberData() : array<string|int, mixed>
- Loads an array of users' data by ID or member_name.
- loadUserSettings() : void
- Load all the important user information.
- loadPermissions() : void
- Load this user's permissions.
- loadMemberContext() : bool|array<string|int, mixed>
- Loads the user's basic values... meant for template/theme usage.
- is_not_guest() : void
- Require a user who is logged in. (not a guest.) Checks if the user is currently a guest, and if so asks them to login with a message telling them why.
- is_not_banned() : void
- Do banning related stuff. (ie. disallow access....) Checks if the user is banned, and if so dies with an error.
- banPermissions() : void
- Fix permissions according to ban status.
- log_ban() : void
- Log a ban in the database.
- validateSession() : string|null
- Check if the user is who he/she says he is Makes sure the user is who they claim to be by requiring a password to be typed in every hour.
- checkSession() : string
- Make sure the user's correct session was passed, and they came from here.
- allowedTo() : bool
- Check the user's permissions.
- isAllowedTo() : bool
- Fatal error if they cannot.
- boardsAllowedTo() : array<string|int, mixed>
- Return the boards a user has a certain (board) permission on. (array(0) if all.) - returns a list of boards on which the user is allowed to do the specified permission.
- sanitize_chars() : string
- Replaces invalid characters with a substitute.
- normalize_spaces() : string
- Normalizes space characters and line breaks.
- htmlspecialchars__recursive() : array<string|int, mixed>|string
- Adds html entities to the array/variable. Uses two underscores to guard against overloading.
- un_htmlspecialchars() : string
- Replaces special entities in strings with the real characters.
- htmltrim__recursive() : array<string|int, mixed>|string
- Trim a string including the HTML space, character 160. Uses two underscores to guard against overloading.
- shorten_subject() : string
- Shorten a subject + internationalization concerns.
- text2words() : array<string|int, mixed>
- Chops a string into words and prepares them to be inserted into (or searched from) the database.
- build_regex() : string|array<string|int, mixed>
- Creates optimized regular expressions from arrays of strings.
- cleanXml() : string
- Clean up the XML to make sure it doesn't contain invalid characters.
- JavaScriptEscape() : string
- Escapes (replaces) characters in strings to make them safe for use in JavaScript
- stripslashes__recursive() : array<string|int, mixed>|string
- Remove slashes recursively. Uses two underscores to guard against overloading.
- urldecode__recursive() : array<string|int, mixed>|string
- Removes url stuff from the array/variable. Uses two underscores to guard against overloading.
- escapestring__recursive() : array<string|int, mixed>|string
- Adds slashes to the array/variable.
- unescapestring__recursive() : array<string|int, mixed>|string
- Unescapes any array or variable. Uses two underscores to guard against overloading.
- truncate_array() : array<string|int, mixed>
- Truncate an array to a specified length
- array_length() : int
- array_length Recursive
- smf_json_decode() : array<string|int, mixed>
- Wrapper function for json_decode() with error handling.
- safe_serialize() : string
- Wrapper for _safe_serialize() that handles exceptions and multibyte encoding issues.
- safe_unserialize() : mixed
- Wrapper for _safe_unserialize() that handles exceptions and multibyte encoding issue
- get_mime_type() : string|bool
- Attempts to determine the MIME type of some data or a file.
- check_mime_type() : int
- Checks whether a file or data has the expected MIME type.
- smf_chmod() : bool
- Tries different modes to make file/dirs writable. Wrapper function for chmod()
- send_http_status() : void
- Sends an appropriate HTTP status header based on a given status code
- smf_serverResponse() : string
- Outputs a response.
- redirectexit() : void
- Make sure the browser doesn't come back and repost the form data.
- obExit() : void
- Ends execution. Takes care of template loading and remembering the previous URL.
- call_helper() : string|array<string|int, mixed>|bool
- Receives a string and tries to figure it out if its a method or a function.
- replaceEntities__callback() : string
- Decode numeric html entities to their ascii or UTF8 equivalent character.
- fixchar__callback() : string
- Converts html entities to utf8 equivalents
- entity_fix__callback() : string
- Strips out invalid html entities, replaces others with html style { codes
- create_control_verification() : bool|array<string|int, mixed>
- Create a anti-bot verification control?
- sanitizeMSCutPaste() : string
- Microsoft uses their own character set Code Page 1252 (CP1252), which is a superset of ISO 8859-1, defining several characters between DEC 128 and 159 that are not normally displayable. This converts the popular ones that appear from a cut and paste from Windows.
- smf_crc32() : string
- Compatibility function.
- idn_to_ascii() : string|bool
- Compatibility function.
- idn_to_utf8() : string|bool
- Compatibility function.
- array_is_list() : bool
Functions
Activate()
Activate an users account.
Activate() : mixed
Checks for mail changes, resends password if needed.
AdminMain()
The main admin handling function.<br> It initialises all the basic context required for the admin center.<br> It passes execution onto the relevant admin section.<br> If the passed section is not found it shows the admin home page.
AdminMain() : mixed
prepareDBSettingContext()
Helper function, it sets up the context for database settings.
prepareDBSettingContext(array<string|int, mixed> &$config_vars) : void
Parameters
- $config_vars : array<string|int, mixed>
-
An array of configuration variables
Tags
saveSettings()
Helper function. Saves settings by putting them in Settings.php or saving them in the settings table.
saveSettings(array<string|int, mixed> &$config_vars) : void
- 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.
Parameters
- $config_vars : array<string|int, mixed>
-
An array of configuration variables
saveDbSettings()
Helper function for saving database settings.
saveDbSettings(array<string|int, mixed> &$config_vars) : void
Parameters
- $config_vars : array<string|int, mixed>
-
An array of configuration variables
Tags
getServerVersions()
Get a list of versions that are currently installed on the server.
getServerVersions(array<string|int, mixed> $checkFor) : array<string|int, mixed>
Parameters
- $checkFor : array<string|int, mixed>
-
An array of what to check versions for - can contain one or more of 'gd', 'imagemagick', 'db_server', 'phpa', 'memcache', 'php' or 'server'
Return values
array<string|int, mixed> —An array of versions (keys are same as what was in $checkFor, values are the versions)
getFileVersions()
Search through source, theme and language files to determine their version.
getFileVersions(array<string|int, mixed> &$versionOptions) : array<string|int, mixed>
Get detailed version information about the physical SMF files on the server.
- the input parameter allows to set whether to include SSI.php and whether the results should be sorted.
- returns an array containing information on source files, templates and language files found in the default theme directory (grouped by language).
Parameters
- $versionOptions : array<string|int, mixed>
-
An array of options. Can contain one or more of 'include_ssi', 'include_subscriptions', 'include_tasks' and 'sort_results'
Return values
array<string|int, mixed> —An array of file version info.
updateAdminPreferences()
Saves the admin's current preferences to the database.
updateAdminPreferences() : void
emailAdmins()
Send all the administrators a lovely email.
emailAdmins(string $template[, array<string|int, mixed> $replacements = [] ][, array<string|int, mixed> $additional_recipients = [] ]) : void
- loads all users who are admins or have the admin forum permission.
- uses the email template and replacements passed in the parameters.
- sends them an email.
Parameters
- $template : string
-
Which email template to use
- $replacements : array<string|int, mixed> = []
-
An array of items to replace the variables in the template
- $additional_recipients : array<string|int, mixed> = []
-
An array of arrays of info for additional recipients. Should have 'id', 'email' and 'name' for each.
adminLogin()
Question the verity of the admin by asking for his or her password.
adminLogin([string $type = 'admin' ]) : void
- loads Login.template.php and uses the admin_login sub template.
- sends data to template so the admin is sent on to the page they wanted if their password is correct, otherwise they can try again.
Parameters
- $type : string = 'admin'
-
What login type is this - can be 'admin' or 'moderate'
ModifyAntispamSettings()
Let's try keep the spam to a minimum ah Thantos?
ModifyAntispamSettings([bool $return_config = false ]) : array<string|int, mixed>|null
Parameters
- $return_config : bool = false
-
Whether or not to return the config_vars array (used for admin search)
Return values
array<string|int, mixed>|null —Returns nothing or returns the $config_vars array if $return_config is true
ManageAttachments()
The main 'Attachments and Avatars' management function.
ManageAttachments() : mixed
This function is the entry point for index.php?action=admin;area=manageattachments and it calls a function based on the sub-action. It requires the manage_attachments permission.
Uses ManageAttachments template. Uses Admin language file. Uses template layer 'manage_files' for showing the tab bar.
attachDirStatus()
Checks the status of an attachment directory and returns an array of the status key, if that status key signifies an error, and the file count.
attachDirStatus(string $dir, int $expected_files) : array<string|int, mixed>
Parameters
- $dir : string
-
The directory to check
- $expected_files : int
-
How many files should be in that directory
Return values
array<string|int, mixed> —An array containing the status of the directory, whether the number of files was what we expected and how many were in the directory
ManageAttachmentSettings()
Allows to show/change attachment settings.
ManageAttachmentSettings([bool $return_config = false ]) : array<string|int, mixed>|null
This is the default sub-action of the 'Attachments and Avatars' center. Called by index.php?action=admin;area=manageattachments;sa=attachments. Uses 'attachments' sub template.
Parameters
- $return_config : bool = false
-
Whether to return the array of config variables (used for admin search)
Return values
array<string|int, mixed>|null —If $return_config is true, simply returns the config_vars array, otherwise returns nothing
ManageAvatarSettings()
This allows to show/change avatar settings.
ManageAvatarSettings([bool $return_config = false ]) : array<string|int, mixed>|null
Called by index.php?action=admin;area=manageattachments;sa=avatars. Show/set permissions for permissions: 'profile_server_avatar', 'profile_upload_avatar' and 'profile_remote_avatar'.
Parameters
- $return_config : bool = false
-
Whether to return the config_vars array (used for admin search)
Return values
array<string|int, mixed>|null —Returns the config_vars array if $return_config is true, otherwise returns nothing
BrowseFiles()
Show a list of attachment or avatar files.
BrowseFiles() : void
Called by ?action=admin;area=manageattachments;sa=browse for attachments and ?action=admin;area=manageattachments;sa=browse;avatars for avatars. Allows sorting by name, date, size and member. Paginates results.
MaintainFiles()
Show several file maintenance options.
MaintainFiles() : void
Called by ?action=admin;area=manageattachments;sa=maintain. Calculates file statistics (total file size, number of attachments, number of avatars, attachment space available).
Tags
RemoveAttachment()
Remove a selection of attachments or avatars.
RemoveAttachment() : void
Called from the browse screen as submitted form by ?action=admin;area=manageattachments;sa=remove
RemoveAttachmentByAge()
Remove attachments older than a given age.
RemoveAttachmentByAge() : void
Called from the maintenance screen by ?action=admin;area=manageattachments;sa=byAge. It optionally adds a certain text to the messages the attachments were removed from.
Tags
RemoveAttachmentBySize()
Remove attachments larger than a given size.
RemoveAttachmentBySize() : void
Called from the maintenance screen by ?action=admin;area=manageattachments;sa=bySize. Optionally adds a certain text to the messages the attachments were removed from.
RemoveAllAttachments()
Removes all attachments in a single click Called from the maintenance screen by ?action=admin;area=manageattachments;sa=removeall.
RemoveAllAttachments() : void
RepairAttachments()
This function should find attachments in the database that no longer exist and clear them, and fix filesize issues.
RepairAttachments() : void
ManageAttachmentPaths()
This function lists and allows updating of multiple attachments paths.
ManageAttachmentPaths() : void
TransferAttachments()
Maintance function to move attachments from one directory to another
TransferAttachments() : void
Ban()
Ban center. The main entrance point for all ban center functions.
Ban() : void
It is accesssed by ?action=admin;area=ban. It choses a function based on the 'sa' parameter, like many others. The default sub-action is BanList(). It requires the ban_members permission. It initializes the admin tabs.
Uses ManageBans template.
updateBanMembers()
As it says... this tries to review the list of banned members, to match new bans.
updateBanMembers() : void
Note: is_activated >= 10: a member is banned.
BanList()
Shows a list of bans currently set.
BanList() : void
It is accessed by ?action=admin;area=ban;sa=list. It removes expired bans. It allows sorting on different criteria. It also handles removal of selected ban items.
Uses the main ManageBans template.
BanEdit()
This function is behind the screen for adding new bans and modifying existing ones.
BanEdit() : void
Adding new bans: - is accessed by ?action=admin;area=ban;sa=add. - uses the ban_edit sub template of the ManageBans template. Modifying existing bans:
- is accessed by ?action=admin;area=ban;sa=edit;bg=x
- uses the ban_edit sub template of the ManageBans template.
- shows a list of ban triggers for the specified ban.
BanBrowseTriggers()
This handles the screen for showing the banned entities It is accessed by ?action=admin;area=ban;sa=browse It uses sub-tabs for browsing by IP, hostname, email or username.
BanBrowseTriggers() : void
Uses a standard list (@see createList())
BanEditTrigger()
This function handles the ins and outs of the screen for adding new ban triggers or modifying existing ones.
BanEditTrigger() : void
Adding new ban triggers: - is accessed by ?action=admin;area=ban;sa=edittrigger;bg=x - uses the ban_edit_trigger sub template of ManageBans. Editing existing ban triggers:
- is accessed by ?action=admin;area=ban;sa=edittrigger;bg=x;bi=y
- uses the ban_edit_trigger sub template of ManageBans.
BanLog()
This handles the listing of ban log entries, and allows their deletion.
BanLog() : void
Shows a list of logged access attempts by banned users. It is accessed by ?action=admin;area=ban;sa=log. How it works:
- allows sorting of several columns.
- also handles deletion of (a selection of) log entries.
ManageBoards()
The main dispatcher; doesn't do anything, just delegates.
ManageBoards() : void
This is the main entry point for all the manageboards admin screens. Called by ?action=admin;area=manageboards. It checks the permissions, based on the sub-action, and calls a function based on the sub-action.
Uses ManageBoards language file.
EditBoardSettings()
A screen to set a few general board and category settings.
EditBoardSettings([bool $return_config = false ]) : array<string|int, mixed>|null
Parameters
- $return_config : bool = false
-
Whether to return the $config_vars array (used for admin search)
Tags
Return values
array<string|int, mixed>|null —Returns nothing or the array of config vars if $return_config is true
ManageCalendar()
The main controlling function doesn't have much to do... yet.
ManageCalendar() : void
Just check permissions and delegate to the rest.
Uses ManageCalendar language file.
ModifyHolidays()
The function that handles adding, and deleting holiday data
ModifyHolidays() : void
EditHoliday()
This function is used for adding/editing a specific holiday
EditHoliday() : void
ModifyCalendarSettings()
Show and allow to modify calendar settings. Obviously.
ModifyCalendarSettings([bool $return_config = false ]) : array<string|int, mixed>|null
Parameters
- $return_config : bool = false
-
Whether to return the $config_vars array (used for admin search)
Return values
array<string|int, mixed>|null —Returns nothing or returns $config_vars if $return_config is true
AdminEndSession()
This ends a admin session, requiring authentication to access the ACP again.
AdminEndSession() : void
ViewErrorLog()
View the forum's error log.
ViewErrorLog() : void
This function sets all the context up to show the error log for maintenance. It requires the maintain_forum permission. It is accessed from ?action=admin;area=logs;sa=errorlog.
Tags
ModifyFeatureSettings()
This function passes control through to the relevant tab.
ModifyFeatureSettings() : void
ModifyBasicSettings()
Config array for changing the basic forum settings Accessed from ?action=admin;area=featuresettings;sa=basic;
ModifyBasicSettings([bool $return_config = false ]) : array<string|int, mixed>|null
Parameters
- $return_config : bool = false
-
Whether or not to return the config_vars array (used for admin search)
Return values
array<string|int, mixed>|null —Returns nothing or returns the $config_vars array if $return_config is true
ModifyBBCSettings()
Set a few Bulletin Board Code settings. It loads a list of Bulletin Board Code tags to allow disabling tags.
ModifyBBCSettings([bool $return_config = false ]) : array<string|int, mixed>|null
Requires the admin_forum permission. Accessed from ?action=admin;area=featuresettings;sa=bbc.
Parameters
- $return_config : bool = false
-
Whether or not to return the config_vars array (used for admin search)
Tags
Return values
array<string|int, mixed>|null —Returns nothing or returns the $config_vars array if $return_config is true
ModifyLayoutSettings()
Allows modifying the global layout settings in the forum Accessed through ?action=admin;area=featuresettings;sa=layout;
ModifyLayoutSettings([bool $return_config = false ]) : array<string|int, mixed>|null
Parameters
- $return_config : bool = false
-
Whether or not to return the config_vars array (used for admin search)
Return values
array<string|int, mixed>|null —Returns nothing or returns the $config_vars array if $return_config is true
ModifySignatureSettings()
You'll never guess what this function does.
ModifySignatureSettings([bool $return_config = false ]) : array<string|int, mixed>|null
..
Parameters
- $return_config : bool = false
-
Whether or not to return the config_vars array (used for admin search)
Return values
array<string|int, mixed>|null —Returns nothing or returns the $config_vars array if $return_config is true
ShowCustomProfiles()
Show all the custom profile fields available to the user.
ShowCustomProfiles() : void
EditCustomProfiles()
Edit some profile fields?
EditCustomProfiles() : void
ModifyLikesSettings()
Config array for changing like settings Accessed from ?action=admin;area=featuresettings;sa=likes;
ModifyLikesSettings([bool $return_config = false ]) : array<string|int, mixed>|null
Parameters
- $return_config : bool = false
-
Whether or not to return the config_vars array
Return values
array<string|int, mixed>|null —Returns nothing or returns the $config_vars array if $return_config is true
ModifyMentionsSettings()
Config array for changing like settings Accessed from ?action=admin;area=featuresettings;sa=mentions;
ModifyMentionsSettings([bool $return_config = false ]) : array<string|int, mixed>|null
Parameters
- $return_config : bool = false
-
Whether or not to return the config_vars array (used for admin search)
Return values
array<string|int, mixed>|null —Returns nothing or returns the $config_vars array if $return_config is true
ModifyAlertsSettings()
Handles modifying the alerts settings
ModifyAlertsSettings() : void
AdminSearch()
This function allocates out all the search stuff.
AdminSearch() : void
AdminHome()
The main administration section.
AdminHome() : void
It prepares all the data necessary for the administration front page. It uses the Admin template along with the admin sub template. It requires the moderate_forum, manage_membergroups, manage_bans, admin_forum, manage_permissions, manage_attachments, manage_smileys, manage_boards, edit_news, or send_mail permission. It uses the index administrative area. It can be found by going to ?action=admin.
ManageLanguages()
This is the main function for the languages area.
ManageLanguages() : void
It dispatches the requests. Loads the ManageLanguages template. (sub-actions will use it)
Tags
ModifyLanguages()
This lists all the current languages and allows editing of them.
ModifyLanguages() : void
AddLanguage()
Interface for adding a new language
AddLanguage() : void
Tags
ModifyLanguageSettings()
Edit language related settings.
ModifyLanguageSettings([bool $return_config = false ]) : array<string|int, mixed>|null
Parameters
- $return_config : bool = false
-
Whether to return the $config_vars array (used in admin search)
Return values
array<string|int, mixed>|null —Returns nothing or the $config_vars array if $return_config is true
DownloadLanguage()
Download a language file from the Simple Machines website.
DownloadLanguage() : void
Requires a valid download ID ("did") in the URL. Also handles installing language files. Attempts to chmod things as needed. Uses a standard list to display information about all the files and where they'll be put.
Tags
ModifyLanguage()
Edit a particular set of language entries.
ModifyLanguage() : void
AdminLogs()
This function decides which log to load.
AdminLogs([bool $return_config = false ]) : array<string|int, mixed>|null
Parameters
- $return_config : bool = false
Return values
array<string|int, mixed>|nullManageMail()
Main dispatcher. This function checks permissions and passes control through to the relevant section.
ManageMail() : void
BrowseMailQueue()
Display the mail queue.
BrowseMailQueue() : void
..
ClearMailQueue()
This function clears the mail queue of all emails, and at the end redirects to browse.
ClearMailQueue() : void
ModifyMailSettings()
Allows to view and modify the mail settings.
ModifyMailSettings([bool $return_config = false ]) : array<string|int, mixed>|null
Parameters
- $return_config : bool = false
-
Whether to return the $config_vars array (used for admin search)
Return values
array<string|int, mixed>|null —Returns nothing or returns the $config_vars array if $return_config is true
TestMailSend()
Test mail sending ability.
TestMailSend() : void
ManageMaintenance()
Main dispatcher, the maintenance access point.
ManageMaintenance() : void
This, as usual, checks permissions, loads language files, and forwards to the actual workers.
get_integration_hooks_data()
Callback function for the integration hooks list (list_integration_hooks) Gets all of the hooks in the system and their status
get_integration_hooks_data(int $start, int $per_page, string $sort, array<string|int, mixed> $filtered_hooks, string $normalized_boarddir, string $normalized_sourcedir) : array<string|int, mixed>
Parameters
- $start : int
-
The item to start with (for pagination purposes)
- $per_page : int
-
How many items to display on each page
- $sort : string
-
A string indicating how to sort things
- $filtered_hooks : array<string|int, mixed>
- $normalized_boarddir : string
- $normalized_sourcedir : string
Return values
array<string|int, mixed> —An array of information about the integration hooks
reattributePosts()
This function is used to reassociate members with relevant posts.
reattributePosts(int $memID[, bool|string $email = null ][, bool|string $membername = null ][, bool $post_count = false ]) : array<string|int, mixed>
Reattribute guest posts to a specified member. Does not check for any permissions. If add_to_post_count is set, the member's post count is increased.
Parameters
- $memID : int
-
The ID of the original poster
- $email : bool|string = null
-
If set, should be the email of the poster
- $membername : bool|string = null
-
If set, the membername of the poster
- $post_count : bool = false
-
Whether to adjust post counts
Return values
array<string|int, mixed> —An array containing the number of messages, topics and reports updated
MaintainRoutine()
Supporting function for the routine maintenance area.
MaintainRoutine() : void
MaintainDatabase()
Supporting function for the database maintenance area.
MaintainDatabase() : void
MaintainMembers()
Supporting function for the members maintenance area.
MaintainMembers() : void
MaintainTopics()
Supporting function for the topics maintenance area.
MaintainTopics() : void
list_integration_hooks()
Generates a list of integration hooks for display Accessed through ?action=admin;area=maintain;sa=hooks; Allows for removal or disabling of selected hooks
list_integration_hooks() : void
VersionDetail()
Perform a detailed version check. A very good thing ;).
VersionDetail() : void
The function parses the comment headers in all files for their version information, and outputs that for some javascript to check with simplemachines.org. It does not connect directly with simplemachines.org, but rather expects the client to.
It requires the admin_forum permission. Uses the view_versions admin area. Accessed through ?action=admin;area=maintain;sa=routine;activity=version.
Tags
MaintainFindFixErrors()
Find and fix all errors on the forum.
MaintainFindFixErrors() : void
AdminBoardRecount()
Recount many forum totals that can be recounted automatically without harm.
AdminBoardRecount() : void
it requires the admin_forum permission. It shows the maintain_forum admin area.
Totals recounted:
- fixes for topics with wrong num_replies.
- updates for num_posts and num_topics of all boards.
- recounts instant_messages but not unread_messages.
- repairs messages pointing to boards with topics pointing to other boards.
- updates the last message posted in boards and children.
- updates member count, latest member, topic count, and message count.
The function redirects back to ?action=admin;area=maintain when complete. It is accessed via ?action=admin;area=maintain;sa=database;activity=recount.
RebuildSettingsFile()
Rebuilds Settings.php to make it nice and pretty.
RebuildSettingsFile() : void
MaintainEmptyUnimportantLogs()
Empties all uninmportant logs
MaintainEmptyUnimportantLogs() : void
MaintainCleanCache()
Wipes the whole cache.
MaintainCleanCache() : void
OptimizeTables()
Optimizes all tables in the database and lists how much was saved.
OptimizeTables() : void
It requires the admin_forum permission. It shows as the maintain_forum admin area. It is accessed from ?action=admin;area=maintain;sa=database;activity=optimize. It also updates the optimize scheduled task such that the tables are not automatically optimized again too soon.
Tags
ConvertEntities()
Converts HTML-entities to their UTF-8 character equivalents.
ConvertEntities() : void
This requires the admin_forum permission. Pre-condition: UTF-8 has been set as database and global character set.
It is divided in steps of 10 seconds. This action is linked from the maintenance screen (if applicable). It is accessed by ?action=admin;area=maintain;sa=database;activity=convertentities.
Tags
ConvertMsgBody()
Convert the column "body" of the table {db_prefix}messages from TEXT to MEDIUMTEXT and vice versa.
ConvertMsgBody() : void
It requires the admin_forum permission. This is needed only for MySQL. During the conversion from MEDIUMTEXT to TEXT it check if any of the posts exceed the TEXT length and if so it aborts. This action is linked from the maintenance screen (if it's applicable). Accessed by ?action=admin;area=maintain;sa=database;activity=convertmsgbody.
Tags
MaintainReattributePosts()
Re-attribute posts.
MaintainReattributePosts() : void
MaintainPurgeInactiveMembers()
Removing old members. Done and out!
MaintainPurgeInactiveMembers() : void
Tags
MaintainRecountPosts()
Recalculate all members post counts it requires the admin_forum permission.
MaintainRecountPosts() : void
- recounts all posts for members found in the message table
- updates the members post count record in the members table
- honors the boards post count flag
- does not count posts in the recycle bin
- zeros post counts for all members with no posts in the message table
- runs as a delayed loop to avoid server overload
- uses the not_done template in Admin.template
The function redirects back to action=admin;area=maintain;sa=members when complete. It is accessed via ?action=admin;area=maintain;sa=members;activity=recountposts
MaintainMassMoveTopics()
Moves topics from one board to another.
MaintainMassMoveTopics() : void
Tags
MaintainRemoveOldPosts()
Removing old posts doesn't take much as we really pass through.
MaintainRemoveOldPosts() : void
MaintainRemoveOldDrafts()
Removing old drafts
MaintainRemoveOldDrafts() : void
ModifyMembergroups()
Main dispatcher, the entrance point for all 'Manage Membergroup' actions.
ModifyMembergroups() : void
It forwards to a function based on the given subaction, default being subaction 'index', or, without manage_membergroup permissions, then 'settings'. Called by ?action=admin;area=membergroups. Requires the manage_membergroups or the admin_forum permission.
Uses ManageMembergroups template. Uses ManageMembers language file.
AddMemberGroup()
This function handles adding a membergroup and setting some initial properties.
AddMemberGroup() : void
Called by ?action=admin;area=membergroups;sa=add. It requires the manage_membergroups permission. Allows to use a predefined permission profile or copy one from another group. Redirects to action=admin;area=membergroups;sa=edit;group=x.
Tags
DeleteMembergroup()
Deleting a membergroup by URL (not implemented).
DeleteMembergroup() : void
Called by ?action=admin;area=membergroups;sa=delete;group=x;session_var=y. Requires the manage_membergroups permission. Redirects to ?action=admin;area=membergroups.
Tags
EditMembergroup()
Editing a membergroup.
EditMembergroup() : void
Screen to edit a specific membergroup. Called by ?action=admin;area=membergroups;sa=edit;group=x. It requires the manage_membergroups permission. Also handles the delete button of the edit form. Redirects to ?action=admin;area=membergroups.
Tags
MembergroupIndex()
Shows an overview of the current membergroups.
MembergroupIndex() : void
Called by ?action=admin;area=membergroups. Requires the manage_membergroups permission. Splits the membergroups in regular ones and post count based groups. It also counts the number of members part of each membergroup.
Uses ManageMembergroups template, main.
ModifyMembergroupsettings()
Set some general membergroup settings and permissions.
ModifyMembergroupsettings([bool $return_config = false ]) : array<string|int, mixed>|null
Called by ?action=admin;area=membergroups;sa=settings Requires the admin_forum permission (and manage_permissions for changing permissions) Redirects to itself.
Parameters
- $return_config : bool = false
Tags
Return values
array<string|int, mixed>|nullViewMembers()
The main entrance point for the Manage Members screen.
ViewMembers() : void
As everyone else, it calls a function based on the given sub-action. Called by ?action=admin;area=viewmembers. Requires the moderate_forum permission.
Uses ManageMembers template Uses ManageMembers language file.
ViewMemberlist()
View all members list. It allows sorting on several columns, and deletion of selected members. It also handles the search query sent by ?action=admin;area=viewmembers;sa=search.
ViewMemberlist() : void
Called by ?action=admin;area=viewmembers;sa=all or ?action=admin;area=viewmembers;sa=query. Requires the moderate_forum permission.
Uses a standard list (@see createList())
AdminApprove()
This function handles the approval, rejection, activation or deletion of members.
AdminApprove() : void
Called by ?action=admin;area=viewmembers;sa=approve. Requires the moderate_forum permission. Redirects to ?action=admin;area=viewmembers;sa=browse with the same parameters as the calling page.
MembersAwaitingActivation()
List all members who are awaiting approval / activation, sortable on different columns.
MembersAwaitingActivation() : void
It allows instant approval or activation of (a selection of) members. Called by ?action=admin;area=viewmembers;sa=browse;type=approve or ?action=admin;area=viewmembers;sa=browse;type=activate. The form submits to ?action=admin;area=viewmembers;sa=approve. Requires the moderate_forum permission.
Tags
SearchMembers()
Search the member list, using one or more criteria.
SearchMembers() : void
Called by ?action=admin;area=viewmembers;sa=search. Requires the moderate_forum permission. form is submitted to action=admin;area=viewmembers;sa=query.
Tags
ModifyModSettings()
This my friend, is for all the mod authors out there.
ModifyModSettings([bool $return_config = false ]) : array<string|int, mixed>|null
Parameters
- $return_config : bool = false
Return values
array<string|int, mixed>|nullManageNews()
The news dispatcher; doesn't do anything, just delegates.
ManageNews() : void
This is the entrance point for all News and Newsletter screens. Called by ?action=admin;area=news. It does the permission checks, and calls the appropriate function based on the requested sub-action.
prepareMailingForPreview()
Prepare subject and message of an email for the preview box Used in ComposeMailing and RetrievePreview (Xml.php)
prepareMailingForPreview() : void
EditNews()
Let the administrator(s) edit the news items for the forum.
EditNews() : void
It writes an entry into the moderation log. This function uses the edit_news administration area. Called by ?action=admin;area=news. Requires the edit_news permission. Can be accessed with ?action=admin;sa=editnews.
Uses a standard list (@see createList())
SelectMailingMembers()
This function allows a user to select the membergroups to send their mailing to.
SelectMailingMembers() : void
Called by ?action=admin;area=news;sa=mailingmembers. Requires the send_mail permission. Form is submitted to ?action=admin;area=news;mailingcompose.
Tags
ComposeMailing()
Shows a form to edit a forum mailing and its recipients.
ComposeMailing() : void
Called by ?action=admin;area=news;sa=mailingcompose. Requires the send_mail permission. Form is submitted to ?action=admin;area=news;sa=mailingsend.
Tags
SendMailing()
Handles the sending of the forum mailing in batches.
SendMailing() : void
Called by ?action=admin;area=news;sa=mailingsend Requires the send_mail permission. Redirects to itself when more batches need to be sent. Redirects to ?action=admin;area=news;sa=mailingmembers after everything has been sent.
Tags
ModifyNewsSettings()
Set general news and newsletter settings and permissions.
ModifyNewsSettings([bool $return_config = false ]) : array<string|int, mixed>|null
Called by ?action=admin;area=news;sa=settings. Requires the forum_admin permission.
Parameters
- $return_config : bool = false
-
Whether or not to return the config_vars array (used for admin search)
Tags
Return values
array<string|int, mixed>|null —Returns nothing or returns the config_vars array if $return_config is true
ModifyPermissions()
Dispatches to the right function based on the given subaction.
ModifyPermissions() : void
Checks the permissions, based on the sub-action. Called by ?action=managepermissions.
Uses ManagePermissions language file.
theme_inline_permissions()
Show a collapsible box to set a specific permission.
theme_inline_permissions(string $permission) : void
The function is called by templates to show a list of permissions settings. Calls the template function template_inline_permissions().
Parameters
- $permission : string
-
The permission to display inline
loadPermissionProfiles()
Load permissions profiles.
loadPermissionProfiles() : void
updateChildPermissions()
This function updates the permissions of any groups based off this group.
updateChildPermissions([null|array<string|int, mixed> $parents = null ][, null|int $profile = null ]) : bool|null
Parameters
- $parents : null|array<string|int, mixed> = null
-
The parent groups
- $profile : null|int = null
-
the ID of a permissions profile to update
Return values
bool|null —Returns nothing if successful or false if there are no child groups to update
loadIllegalPermissions()
Load permissions someone cannot grant.
loadIllegalPermissions() : array<string|int, mixed>
Return values
array<string|int, mixed>PermissionIndex()
Sets up the permissions by membergroup index page.
PermissionIndex() : void
Called by ?action=managepermissions Creates an array of all the groups with the number of members and permissions.
Uses ManagePermissions language file. Uses ManagePermissions template file.
Tags
PermissionsByBoard()
Handle permissions by board... more or less. :P
PermissionsByBoard() : void
ModifyMembergroup()
Initializes the necessary to modify a membergroup's permissions.
ModifyMembergroup() : void
ModifyMembergroup2()
This function actually saves modifications to a membergroup's board permissions.
ModifyMembergroup2() : void
SetQuickGroups()
Handles permission modification actions from the upper part of the permission manager index.
SetQuickGroups() : void
ModifyPostModeration()
Present a nice way of applying post moderation.
ModifyPostModeration() : void
EditPermissionProfiles()
Add/Edit/Delete profiles.
EditPermissionProfiles() : void
GeneralPermissionSettings()
A screen to set some general settings for permissions.
GeneralPermissionSettings([bool $return_config = false ]) : array<string|int, mixed>|null
Parameters
- $return_config : bool = false
-
Whether to return the $config_vars array (used for admin search)
Return values
array<string|int, mixed>|null —Returns nothing or returns the config_vars array if $return_config is true
ManagePostSettings()
The main entrance point for the 'Posts and topics' screen.
ManagePostSettings() : void
Like all others, it checks permissions, then forwards to the right function based on the given sub-action. Defaults to sub-action 'posts'. Accessed from ?action=admin;area=postsettings. Requires (and checks for) the admin_forum permission.
ModifyPostSettings()
Modify any setting related to posts and posting.
ModifyPostSettings([bool $return_config = false ]) : array<string|int, mixed>|null
Requires the admin_forum permission. Accessed from ?action=admin;area=postsettings;sa=posts.
Parameters
- $return_config : bool = false
-
Whether or not to return the $config_vars array (used for admin search)
Tags
Return values
array<string|int, mixed>|null —Returns nothing or returns the config_vars array if $return_config is true
ModifyTopicSettings()
Modify any setting related to topics.
ModifyTopicSettings([bool $return_config = false ]) : array<string|int, mixed>|null
Requires the admin_forum permission. Accessed from ?action=admin;area=postsettings;sa=topics.
Parameters
- $return_config : bool = false
-
Whether or not to return the config_vars array (used for admin search)
Tags
Return values
array<string|int, mixed>|null —Returns nothing or returns $config_vars if $return_config is true
ModifyDraftSettings()
Modify any setting related to drafts.
ModifyDraftSettings([bool $return_config = false ]) : array<string|int, mixed>|null
Requires the admin_forum permission. Accessed from ?action=admin;area=postsettings;sa=drafts
Parameters
- $return_config : bool = false
-
Whether or not to return the config_vars array (used for admin search)
Tags
Return values
array<string|int, mixed>|null —Returns nothing or returns the $config_vars array if $return_config is true
RegCenter()
Entrance point for the registration center, it checks permissions and forwards to the right function based on the subaction.
RegCenter() : void
Accessed by ?action=admin;area=regcenter. Requires either the moderate_forum or the admin_forum permission.
Uses Login language file Uses Register template.
AdminRegister()
This function allows the admin to register a new member by hand.
AdminRegister() : void
It also allows assigning a primary group to the member being registered. Accessed by ?action=admin;area=regcenter;sa=register Requires the moderate_forum permission.
Tags
EditAgreement()
Allows the administrator to edit the registration agreement, and choose whether it should be shown or not. It writes and saves the agreement to the agreement.txt file.
EditAgreement() : void
Accessed by ?action=admin;area=regcenter;sa=agreement. Requires the admin_forum permission.
Tags
EditPrivacyPolicy()
Sure, you can sell my personal info for profit (...or not)
EditPrivacyPolicy() : void
SetReserved()
Set the names under which users are not allowed to register.
SetReserved() : void
Accessed by ?action=admin;area=regcenter;sa=reservednames. Requires the admin_forum permission.
Tags
ModifyRegistrationSettings()
This function handles registration settings, and provides a few pretty stats too while it's at it.
ModifyRegistrationSettings([bool $return_config = false ]) : array<string|int, mixed>|null
General registration settings and Coppa compliance settings. Accessed by ?action=admin;area=regcenter;sa=settings. Requires the admin_forum permission.
Parameters
- $return_config : bool = false
-
Whether or not to return the config_vars array (used for admin search)
Return values
array<string|int, mixed>|null —Returns nothing or returns the $config_vars array if $return_config is true
RepairBoards()
Finds or repairs errors in the database to fix possible problems.
RepairBoards() : void
Requires the admin_forum permission. Calls createSalvageArea() to create a new board, if necessary. Accessed by ?action=admin;area=repairboards.
Tags
ReportsMain()
Handling function for generating reports.
ReportsMain() : void
Requires the admin_forum permission. Loads the Reports template and language files. Decides which type of report to generate, if this isn't passed through the querystring it will set the report_type sub-template to force the user to choose which type. When generating a report chooses which sub_template to use. Depends on the cal_enabled setting, and many of the other cal_ settings. Will call the relevant report generation function. If generating report will call finishTables before returning. Accessed through ?action=admin;area=reports.
BoardReport()
Standard report about what settings the boards have.
BoardReport() : void
functions ending with "Report" are responsible for generating data for reporting. they are all called from ReportsMain. never access the context directly, but use the data handling functions to do so.
BoardPermissionsReport()
Generate a report on the current permissions by board and membergroup.
BoardPermissionsReport() : void
functions ending with "Report" are responsible for generating data for reporting. they are all called from ReportsMain. never access the context directly, but use the data handling functions to do so.
MemberGroupsReport()
Show what the membergroups are made of.
MemberGroupsReport() : void
functions ending with "Report" are responsible for generating data for reporting. they are all called from ReportsMain. never access the context directly, but use the data handling functions to do so.
GroupPermissionsReport()
Show the large variety of group permissions assigned to each membergroup.
GroupPermissionsReport() : void
functions ending with "Report" are responsible for generating data for reporting. they are all called from ReportsMain. never access the context directly, but use the data handling functions to do so.
StaffReport()
Report for showing all the forum staff members - quite a feat! functions ending with "Report" are responsible for generating data for reporting.
StaffReport() : void
they are all called from ReportsMain. never access the context directly, but use the data handling functions to do so.
ManageSearch()
Main entry point for the admin search settings screen.
ManageSearch() : void
It checks permissions, and it forwards to the appropriate function based on the given sub-action. Defaults to sub-action 'settings'. Called by ?action=admin;area=managesearch. Requires the admin_forum permission.
Uses ManageSearch template. Uses Search language file.
EditSearchSettings()
Edit some general settings related to the search function.
EditSearchSettings([bool $return_config = false ]) : array<string|int, mixed>|null
Called by ?action=admin;area=managesearch;sa=settings. Requires the admin_forum permission.
Parameters
- $return_config : bool = false
-
Whether or not to return the config_vars array (used for admin search)
Tags
Return values
array<string|int, mixed>|null —Returns nothing or returns the $config_vars array if $return_config is true
EditWeights()
Edit the relative weight of the search factors.
EditWeights() : void
Called by ?action=admin;area=managesearch;sa=weights. Requires the admin_forum permission.
Tags
EditSearchMethod()
Edit the search method and search index used.
EditSearchMethod() : void
Calculates the size of the current search indexes in use. Allows to create and delete a fulltext index on the messages table. Allows to delete a custom index (that CreateMessageIndex() created). Called by ?action=admin;area=managesearch;sa=method. Requires the admin_forum permission.
Tags
CreateMessageIndex()
Create a custom search index for the messages table.
CreateMessageIndex() : void
Called by ?action=admin;area=managesearch;sa=createmsgindex. Linked from the EditSearchMethod screen. Requires the admin_forum permission. Depending on the size of the message table, the process is divided in steps.
Tags
SearchEngines()
Entry point for this section.
SearchEngines() : void
consolidateSpiderStats()
This function takes any unprocessed hits and turns them into stats.
consolidateSpiderStats() : void
recacheSpiderNames()
Recache spider names?
recacheSpiderNames() : void
SpiderStats()
Show the spider statistics.
SpiderStats() : void
SpiderLogs()
See what spiders have been up to.
SpiderLogs() : void
ViewSpiders()
View a list of all the spiders we know about.
ViewSpiders() : void
ManageSearchEngineSettings()
This is really just the settings page.
ManageSearchEngineSettings([bool $return_config = false ]) : array<string|int, mixed>|null
Parameters
- $return_config : bool = false
-
Whether to return the config_vars array (used for admin search)
Return values
array<string|int, mixed>|null —Returns nothing or returns the $config_vars array if $return_config is true
EditSpider()
Here we can add, and edit, spider info!
EditSpider() : void
ModifySettings()
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.
ModifySettings() : void
Requires the admin_forum permission. Redirects to the appropriate function based on the sub-action.
Uses edit_settings adminIndex.
prepareServerSettingsContext()
Helper function, it sets up the context for the manage server settings.
prepareServerSettingsContext(array<string|int, mixed> &$config_vars) : mixed
- The basic usage of the six numbered key fields are
- array (0 ,1, 2, 3, 4, 5 0 variable name - the name of the saved variable 1 label - the text to show on the settings page 2 saveto - file or db, where to save the variable name - value pair 3 type - type of data to save, int, float, text, check 4 size - false or field size 5 help - '' or helptxt variable name )
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).
Parameters
- $config_vars : array<string|int, mixed>
-
An array of configuration variables
ModifyGeneralSettings()
General forum settings - forum name, maintenance mode, etc.
ModifyGeneralSettings([bool $return_config = false ]) : array<string|int, mixed>|null
Practically, this shows an interface for the settings in Settings.php to be changed.
- Requires the admin_forum permission.
- Uses the edit_settings administration area.
- Contains the actual array of settings to show from Settings.php.
- Accessed from ?action=admin;area=serversettings;sa=general.
Parameters
- $return_config : bool = false
-
Whether to return the $config_vars array (for pagination purposes)
Return values
array<string|int, mixed>|null —Returns nothing or returns the $config_vars array if $return_config is true
ModifyDatabaseSettings()
Basic database and paths settings - database name, host, etc.
ModifyDatabaseSettings([bool $return_config = false ]) : array<string|int, mixed>|null
- It shows an interface for the settings in Settings.php to be changed.
- It contains the actual array of settings to show from Settings.php.
- Requires the admin_forum permission.
- Uses the edit_settings administration area.
- Accessed from ?action=admin;area=serversettings;sa=database.
Parameters
- $return_config : bool = false
-
Whether or not to return the config_vars array (used for admin search)
Return values
array<string|int, mixed>|null —Returns nothing or returns the $config_vars array if $return_config is true
ModifyCookieSettings()
This function handles cookies settings modifications.
ModifyCookieSettings([bool $return_config = false ]) : array<string|int, mixed>|null
Parameters
- $return_config : bool = false
-
Whether or not to return the config_vars array (used for admin search)
Return values
array<string|int, mixed>|null —Returns nothing or returns the $config_vars array if $return_config is true
ModifyGeneralSecuritySettings()
Settings really associated with general security aspects.
ModifyGeneralSecuritySettings([bool $return_config = false ]) : array<string|int, mixed>|null
Parameters
- $return_config : bool = false
-
Whether or not to return the config_vars array (used for admin search)
Return values
array<string|int, mixed>|null —Returns nothing or returns the $config_vars array if $return_config is true
ModifyCacheSettings()
Simply modifying cache functions
ModifyCacheSettings([bool $return_config = false ]) : array<string|int, mixed>|null
Parameters
- $return_config : bool = false
-
Whether or not to return the config_vars array (used for admin search)
Return values
array<string|int, mixed>|null —Returns nothing or returns the $config_vars array if $return_config is true
ModifyExportSettings()
Controls settings for data export functionality
ModifyExportSettings([bool $return_config = false ]) : array<string|int, mixed>|null
Parameters
- $return_config : bool = false
-
Whether or not to return the config_vars array (used for admin search)
Return values
array<string|int, mixed>|null —Returns nothing or returns the $config_vars array if $return_config is true
ModifyLoadBalancingSettings()
Allows to edit load balancing settings.
ModifyLoadBalancingSettings([bool $return_config = false ]) : array<string|int, mixed>|null
Parameters
- $return_config : bool = false
-
Whether or not to return the config_vars array
Return values
array<string|int, mixed>|null —Returns nothing or returns the $config_vars array if $return_config is true
ShowPHPinfoSettings()
Allows us to see the servers php settings
ShowPHPinfoSettings() : void
- loads the settings into an array for display in a template
- drops cookie values just in case
ManageSmileys()
This is the dispatcher of smileys administration.
ManageSmileys() : void
EditSmileySettings()
Handles modifying smileys settings.
EditSmileySettings([bool $return_config = false ]) : array<string|int, mixed>|null
Parameters
- $return_config : bool = false
-
Whether or not to return the config_vars array (used for admin search)
Return values
array<string|int, mixed>|null —Returns nothing or returns the $config_vars array if $return_config is true
AddSmiley()
Add a smiley, that's right.
AddSmiley() : void
EditSmileys()
Add, remove, edit smileys.
EditSmileys() : void
EditSmileyOrder()
Allows to edit smileys order.
EditSmileyOrder() : void
InstallSmileySet()
Install a smiley set.
InstallSmileySet() : void
EditMessageIcons()
Handles editing message icons
EditMessageIcons() : void
ManagePaidSubscriptions()
The main entrance point for the 'Paid Subscription' screen, calling the right function based on the given sub-action.
ManagePaidSubscriptions() : void
It defaults to sub-action 'view'. Accessed from ?action=admin;area=paidsubscribe. It requires admin_forum permission for admin based actions.
loadSubscriptions()
This just kind of caches all the subscription data.
loadSubscriptions() : array<string|int, mixed>
Return values
array<string|int, mixed>addSubscription()
Add or extend a subscription of a user.
addSubscription(int $id_subscribe, int $id_member[, int|string $renewal = 0 ][, int $forceStartTime = 0 ][, int $forceEndTime = 0 ]) : void
Parameters
- $id_subscribe : int
-
The subscription ID
- $id_member : int
-
The ID of the member
- $renewal : int|string = 0
-
0 if we're forcing start/end time, otherwise a string indicating how long to renew the subscription for ('D', 'W', 'M' or 'Y')
- $forceStartTime : int = 0
-
If set, forces the subscription to start at the specified time
- $forceEndTime : int = 0
-
If set, forces the subscription to end at the specified time
removeSubscription()
Removes a subscription from a user, as in removes the groups.
removeSubscription(int $id_subscribe, int $id_member[, bool $delete = false ]) : void
Parameters
- $id_subscribe : int
-
The ID of the subscription
- $id_member : int
-
The ID of the member
- $delete : bool = false
-
Whether to delete the subscription or just disable it
reapplySubscriptions()
Reapplies all subscription rules for each of the users.
reapplySubscriptions(array<string|int, mixed> $users) : void
Parameters
- $users : array<string|int, mixed>
-
An array of user IDs
loadPaymentGateways()
Load all the payment gateways.
loadPaymentGateways() : array<string|int, mixed>
Checks the Sources directory for any files fitting the format of a payment gateway, loads each file to check it's valid, includes each file and returns the function name and whether it should work with this version of SMF.
Return values
array<string|int, mixed> —An array of information about available payment gateways
ViewSubscriptions()
View a list of all the current subscriptions Requires the admin_forum permission.
ViewSubscriptions() : void
Accessed from ?action=admin;area=paidsubscribe;sa=view.
ViewSubscribedUsers()
View all the users subscribed to a particular subscription.
ViewSubscribedUsers() : void
Requires the admin_forum permission. Accessed from ?action=admin;area=paidsubscribe;sa=viewsub.
Subscription ID is required, in the form of $_GET['sid'].
ModifySubscription()
Adding, editing and deleting subscriptions.
ModifySubscription() : void
Accessed from ?action=admin;area=paidsubscribe;sa=modify.
ModifyUserSubscription()
Edit or add a user subscription.
ModifyUserSubscription() : void
Accessed from ?action=admin;area=paidsubscribe;sa=modifyuser.
ModifySubscriptionSettings()
Set any setting related to paid subscriptions, i.e.
ModifySubscriptionSettings([bool $return_config = false ]) : array<string|int, mixed>|null
modify which payment methods are to be used. It requires the moderate_forum permission Accessed from ?action=admin;area=paidsubscribe;sa=settings.
Parameters
- $return_config : bool = false
-
Whether or not to return the $config_vars array (used for admin search)
Return values
array<string|int, mixed>|null —Returns nothing or returns the config_vars array if $return_config is true
ManageScheduledTasks()
Scheduled tasks management dispatcher. This function checks permissions and delegates to the appropriate function based on the sub-action.
ManageScheduledTasks() : void
Everything here requires admin_forum permission.
Uses ManageScheduledTasks template file Uses ManageScheduledTasks language file
ScheduledTasks()
List all the scheduled task in place on the forum.
ScheduledTasks() : void
Tags
EditTask()
Function for editing a task.
EditTask() : void
Tags
TaskLog()
Show the log of all tasks that have taken place.
TaskLog() : void
Uses ManageScheduledTasks language file
TaskSettings()
This handles settings related to scheduled tasks
TaskSettings([bool $return_config = false ]) : array<string|int, mixed>|null
Parameters
- $return_config : bool = false
-
Whether or not to return the config vars. Used in the admin search.
Return values
array<string|int, mixed>|null —If return_config is true, returns the array of $config_vars
ThemesMain()
Subaction handler - manages the action and delegates control to the proper sub-action.
ThemesMain() : void
It loads both the Themes and Settings language files. Checks the session by GET or POST to verify the sent data. Requires the user not be a guest. (@todo what?) Accessed via ?action=admin;area=theme.
ThemeAdmin()
This function allows administration of themes and their settings, as well as global theme settings.
ThemeAdmin() : void
- sets the settings theme_allow, theme_guests, and knownThemes.
- requires the admin_forum permission.
- accessed with ?action=admin;area=theme;sa=admin.
Uses Themes template Uses Admin language file
ThemeList()
This function lists the available themes and provides an interface to reset the paths of all the installed themes.
ThemeList() : void
SetThemeOptions()
Administrative global settings.
SetThemeOptions() : void
RemoveTheme()
Remove a theme from the database.
RemoveTheme() : void
- removes an installed theme.
- requires an administrator.
- accessed with ?action=admin;area=theme;sa=remove.
EnableTheme()
Handles enabling/disabling a theme from the admin center
EnableTheme() : void
ThemeInstall()
Installs new themes, calls the respective function according to the install type.
ThemeInstall() : void
- puts themes in $boardurl/Themes.
- assumes the gzip has a root directory in it. (ie default.) Requires admin_forum. Accessed with ?action=admin;area=theme;sa=install.
EditTheme()
Shows an interface for editing the templates.
EditTheme() : void
- uses the Themes template and edit_template/edit_style sub template.
- accessed via ?action=admin;area=theme;sa=edit
CopyTemplate()
Makes a copy of a template file in a new location
CopyTemplate() : void
Tags
ModifyWarningSettings()
Moderation type settings - although there are fewer than we have you believe ;)
ModifyWarningSettings([bool $return_config = false ]) : array<string|int, mixed>|null
Parameters
- $return_config : bool = false
-
Whether or not to return the config_vars array (used for admin search)
Return values
array<string|int, mixed>|null —Returns nothing or returns the $config_vars array if $return_config is true
ModEndSession()
This ends a moderator session, requiring authentication to access the MCP again.
ModEndSession() : void
ModerationHome()
This function basically is the home page of the moderation center.
ModerationHome() : void
ViewModlog()
Prepares the information from the moderation log for viewing.
ViewModlog() : void
Show the moderation log. If clearing the log, leaves a message in the log to indicate it was cleared, by whom and when. Requires the admin_forum permission. Accessed via ?action=moderate;area=modlog.
Uses Modlog template, main sub-template.
ModerationMain()
Entry point for the moderation center.
ModerationMain([bool $dont_call = false ]) : void
Parameters
- $dont_call : bool = false
-
If true, just creates the menu and doesn't call the function for the appropriate mod area.
PostModerationMain()
This is a handling function for all things post moderation.
PostModerationMain() : void
approveAllData()
This is a helper function - basically approve everything!
approveAllData() : void
UnapprovedPosts()
View all unapproved posts.
UnapprovedPosts() : void
UnapprovedAttachments()
View all unapproved attachments.
UnapprovedAttachments() : void
ApproveMessage()
Approve a post, just the one.
ApproveMessage() : void
ReportedContent()
Sets and call a function based on the given subaction. Acts as a dispatcher function.
ReportedContent() : void
It requires the moderate_forum permission.
Uses ModerationCenter template. Uses ModerationCenter language file.
recountOpenReports()
Recount all open reports. Sets a SESSION var with the updated info.
recountOpenReports(string $type) : int
Parameters
- $type : string
-
the type of reports to count
Return values
int —the update open report count.
ShowReports()
Shows all currently open reported posts.
ShowReports() : void
Handles closing multiple reports
ShowClosedReports()
Shows all currently closed reported posts.
ShowClosedReports() : void
ReportDetails()
Shows detailed information about a report. such as report comments and moderator comments.
ReportDetails() : void
Shows a list of moderation actions for the specific report.
HandleReport()
Performs closing/ignoring actions for a given report.
HandleReport() : void
HandleComment()
Creates/Deletes moderator comments.
HandleComment() : void
EditComment()
Shows a textarea for editing a moderator comment.
EditComment() : void
Handles the edited comment and stores it on the DB.
ShowNotice()
Show a notice sent to a user.
ShowNotice() : void
ViewWarnings()
Entry point for viewing warning related stuff.
ViewWarnings() : void
ViewWarningLog()
Simply put, look at the warning log!
ViewWarningLog() : void
ViewWarningTemplates()
Load all the warning templates.
ViewWarningTemplates() : void
ModifyWarningTemplate()
Edit a warning template.
ModifyWarningTemplate() : void
ViewWatchedUsers()
View watched users.
ViewWatchedUsers() : void
account()
Handles the account section of the profile
account() : void
activateAccount()
Activate an account.
activateAccount() : void
alerts_popup()
Set up the requirements for the alerts popup - the area that shows all the alerts just quickly for the current user.
alerts_popup() : void
editBuddyIgnoreLists()
Show all the users buddies, as well as a add/delete interface.
editBuddyIgnoreLists() : void
editBuddies()
Show all the users buddies, as well as a add/delete interface.
editBuddies(int $memID) : void
Parameters
- $memID : int
-
The ID of the member
editIgnoreList()
Allows the user to view their ignore list, as well as the option to manage members on it.
editIgnoreList(int $memID) : void
Parameters
- $memID : int
-
The ID of the member
deleteAccount()
Present a screen to make sure the user wants to be deleted
deleteAccount() : void
deleteAccount2()
Actually delete an account.
deleteAccount2(int $memID) : void
Parameters
- $memID : int
-
The member ID
export_profile_data()
Initiates exports a member's profile, posts, and personal messages to a file.
export_profile_data() : void
Tags
create_export_dir()
Returns the path to a secure directory for storing exported profile data.
create_export_dir([string $fallback = '' ]) : string|bool
The directory is created if it does not yet exist, and is secured using the same method that we use to secure attachment directories. Files in this directory can only be downloaded via the download_export_file() function.
Parameters
- $fallback : string = ''
Return values
string|bool —The path to the directory, or false on error.
get_export_formats()
Helper function that defines data export formats in a single location.
get_export_formats() : array<string|int, mixed>
Return values
array<string|int, mixed> —Information about supported data formats for profile exports.
export_attachment()
Allows a member to export their attachments.
export_attachment() : void
Mostly just a wrapper for showAttachment() but with a few tweaks.
download_export_file()
Downloads exported profile data file.
download_export_file() : void
forumProfile()
Handles the main "Forum Profile" section of the profile
forumProfile() : void
groupMembership()
Function to allow the user to choose group membership etc.
groupMembership() : void
..
groupMembership2()
This function actually makes all the group changes
groupMembership2(array<string|int, mixed> $profile_vars, array<string|int, mixed> $post_errors, int $memID) : string
Note: $profile_vars and $post_errors were unused even in 2.1.
Parameters
- $profile_vars : array<string|int, mixed>
-
The profile variables. (Ignored.)
- $post_errors : array<string|int, mixed>
-
Any errors that have occurred. (Ignored.)
- $memID : int
-
The ID of the member.
Return values
string —What type of change this is - 'primary' if changing the primary group, 'request' if requesting to join a group or 'free' if it's an open group
ignoreboards()
Handles the "ignored boards" section of the profile (if enabled)
ignoreboards(int $memID) : void
Parameters
- $memID : int
-
The ID of the member
issueWarning()
Issue/manage an user's warning status.
issueWarning(int $memID) : void
Parameters
- $memID : int
-
The ID of the user
ModifyProfile()
The main designating function for modifying profiles. Loads up info, determins what to do, etc.
ModifyProfile([array<string|int, mixed> $post_errors = [] ]) : void
Parameters
- $post_errors : array<string|int, mixed> = []
-
Any errors that occurred
notification()
Display the notifications and settings for changes.
notification() : void
alert_configuration()
Handles configuration of alert preferences
alert_configuration(int $memID[, bool $defaultSettings = false ]) : void
Parameters
- $memID : int
-
The ID of the member
- $defaultSettings : bool = false
-
If true, we are loading default options.
alert_markread()
Marks all alerts as read for the specified user
alert_markread(int $memID) : void
Parameters
- $memID : int
-
The ID of the member
alert_notifications_topics()
Handles alerts related to topics and posts
alert_notifications_topics(int $memID) : void
Parameters
- $memID : int
-
The ID of the member
alert_notifications_boards()
Handles preferences related to board-level notifications
alert_notifications_boards(int $memID) : void
Parameters
- $memID : int
-
The ID of the member
makeNotificationChanges()
Make any notification changes that need to be made.
makeNotificationChanges(int $memID) : void
Parameters
- $memID : int
-
The ID of the member
subscriptions()
Function for doing all the paid subscription stuff - kinda.
subscriptions() : void
profile_popup()
Set up the requirements for the profile popup - the area that is shown as the popup menu for the current user.
profile_popup() : void
showAlerts()
Shows all alerts for a member
showAlerts(int $memID) : void
Parameters
- $memID : int
-
The ID of the member
showPermissions()
Shows which permissions a user has
showPermissions(int $memID) : void
Parameters
- $memID : int
-
The ID of the member
showPosts()
Show all posts by a member
showPosts(int $memID) : void
Parameters
- $memID : int
-
The ID of the member
Tags
showUnwatched()
Show all the unwatched topics.
showUnwatched(int $memID) : void
Parameters
- $memID : int
-
The ID of the member
showAttachments()
Show all the attachments belonging to a member.
showAttachments(int $memID) : void
Parameters
- $memID : int
-
The ID of the member
statPanel()
Gets the user stats for display
statPanel(int $memID) : void
Parameters
- $memID : int
-
The ID of the member
summary()
View a summary.
summary(int $memID) : void
Parameters
- $memID : int
-
The ID of the member
tfadisable()
Provides interface to disable two-factor authentication in SMF
tfadisable() : void
tfasetup()
Provides interface to setup Two Factor Auth in SMF
tfasetup() : void
theme()
Handles the "Look and Layout" section of the profile
theme() : void
tracking()
Loads up the information for the "track user" section of the profile
tracking() : void
trackActivity()
Handles tracking a user's activity
trackActivity(int $memID) : void
Parameters
- $memID : int
-
The ID of the member
trackEdits()
Tracks a user's profile edits
trackEdits(int $memID) : void
Parameters
- $memID : int
-
The ID of the member
trackGroupReq()
Display the history of group requests made by the user whose profile we are viewing.
trackGroupReq(int $memID) : void
Parameters
- $memID : int
-
The ID of the member
TrackLogins()
Tracks a user's logins.
TrackLogins(int $memID) : void
Parameters
- $memID : int
-
The ID of the member
viewWarning()
View a member's warnings
viewWarning(int $memID) : void
Parameters
- $memID : int
-
The ID of the member
Agreement()
Let's tell them there's a new agreement
Agreement() : void
canRequireAgreement()
Checks whether this user needs to accept the registration agreement.
canRequireAgreement() : bool
Return values
bool —Whether they need to accept the agreement.
canRequirePrivacyPolicy()
Checks whether this user needs to accept the privacy policy.
canRequirePrivacyPolicy() : bool
Return values
bool —Whether they need to accept the policy.
AcceptAgreement()
I solemly swear to no longer chase squirrels.
AcceptAgreement() : void
AnnounceTopic()
Handle the announce topic function (action=announce).
AnnounceTopic() : void
checks the topic announcement permissions and loads the announcement template. requires the announce_topic permission. uses the ManageMembers template and Post language file. call the right function based on the sub-action.
AnnouncementSelectMembergroup()
Allow a user to chose the membergroups to send the announcement to.
AnnouncementSelectMembergroup() : void
lets the user select the membergroups that will receive the topic announcement.
AnnouncementSend()
Send the announcement in chunks.
AnnouncementSend() : void
splits the members to be sent a topic announcement into chunks. composes notification messages in all languages needed. does the actual sending of the topic announcements in chunks. calculates a rough estimate of the percentage items sent.
ApproveAttach()
Called from a mouse click, works out what we want to do with attachments and actions it.
ApproveAttach() : void
showAttachment()
Downloads an avatar or attachment based on $_GET['attach'], and increments the download count.
showAttachment() : void
It requires the view_attachments permission. It disables the session parser, and clears any previous output. It depends on the attachmentUploadDir setting being correct. It is accessed via the query string ?action=dlattach. Views to attachments do not increase hits and are not logged in the "Who's Online" log.
AutoSuggestHandler()
This keeps track of all registered handling functions for auto suggest functionality and passes execution to them.
AutoSuggestHandler([string|null $suggest_type = null ]) : bool|null
Parameters
- $suggest_type : string|null = null
Return values
bool|null —Returns whether the callback function is registered if $checkRegistered isn't null
AutoSuggest_Search_Member()
Search for a member - by real_name or member_name by default.
AutoSuggest_Search_Member() : array<string|int, mixed>
Return values
array<string|int, mixed> —An array of information for displaying the suggestions
AutoSuggest_Search_MemberGroups()
Search for a membergroup by name
AutoSuggest_Search_MemberGroups() : array<string|int, mixed>
Return values
array<string|int, mixed> —An array of information for displaying the suggestions
AutoSuggest_Search_SMFVersions()
Provides a list of possible SMF versions to use in emulation
AutoSuggest_Search_SMFVersions() : array<string|int, mixed>
Return values
array<string|int, mixed> —An array of data for displaying the suggestions
BoardIndex()
This function shows the board index.
BoardIndex() : BoardIndex
It uses the BoardIndex template, and main sub template. It updates the most online statistics. It is accessed by ?action=boardindex.
Return values
BoardIndexgetBoardIndex()
Fetches a list of boards and (optional) categories including statistical information, child boards and moderators.
getBoardIndex(array<string|int, mixed> $board_index_options) : array<string|int, mixed>
- Used by both the board index (main data) and the message index (child
boards).
- Depending on the include_categories setting returns an associative array with categories->boards->child_boards or an associative array with boards->child_boards.
Parameters
- $board_index_options : array<string|int, mixed>
-
An array of boardindex options
Return values
array<string|int, mixed> —An array of information for displaying the boardindex
BuddyListToggle()
This simple function adds/removes the passed user from the current users buddy list.
BuddyListToggle() : void
Requires profile_identity_own permission. Called by ?action=buddy;u=x;session_id=y. Redirects to ?action=profile;u=x.
CalendarMain()
Show the calendar.
CalendarMain() : void
It loads the specified month's events, holidays, and birthdays. It requires the calendar_view permission. It depends on the cal_enabled setting, and many of the other cal_ settings. It uses the calendar_start_day theme option. (Monday/Sunday) It uses the main sub template in the Calendar template. It goes to the month and year passed in 'month' and 'year' by get or post. It is accessed through ?action=calendar.
iCalDownload()
This function offers up a download of an event in iCal 2.0 format.
iCalDownload() : void
Follows the conventions in RFC5546 Sets events as all day events since we don't have hourly events Will honor and set multi day events Sets a sequence number if the event has been modified
Tags
CalendarPost()
This function processes posting/editing/deleting a calendar event.
CalendarPost() : void
- calls Post() function if event is linked to a post.
- calls insertEvent() to insert the event if not linked to post.
It requires the calendar_post permission to use. It uses the event_post sub template in the Calendar template. It is accessed with ?action=calendar;sa=post.
getBirthdayRange()
Get all birthdays within the given time range.
getBirthdayRange(string $low_date, string $high_date) : array<string|int, mixed>
finds all the birthdays in the specified range of days. works with birthdays set for no year, or any other year, and respects month and year boundaries.
Parameters
- $low_date : string
-
The low end of the range, inclusive, in YYYY-MM-DD format
- $high_date : string
-
The high end of the range, inclusive, in YYYY-MM-DD format
Return values
array<string|int, mixed> —An array of days, each of which is an array of birthday information for the context
getEventRange()
Get all calendar events within the given time range.
getEventRange(string $low_date, string $high_date[, bool $use_permissions = true ]) : array<string|int, mixed>
- finds all the posted calendar events within a date range.
- both the earliest_date and latest_date should be in the standard YYYY-MM-DD format.
- censors the posted event titles.
- uses the current user's permissions if use_permissions is true, otherwise it does nothing "permission specific"
Parameters
- $low_date : string
-
The low end of the range, inclusive, in YYYY-MM-DD format
- $high_date : string
-
The high end of the range, inclusive, in YYYY-MM-DD format
- $use_permissions : bool = true
-
Whether to use permissions
Return values
array<string|int, mixed> —Contextual information if use_permissions is true, and an array of the data needed to build that otherwise
getHolidayRange()
Get all holidays within the given time range.
getHolidayRange(string $low_date, string $high_date) : array<string|int, mixed>
Parameters
- $low_date : string
-
The low end of the range, inclusive, in YYYY-MM-DD format
- $high_date : string
-
The high end of the range, inclusive, in YYYY-MM-DD format
Return values
array<string|int, mixed> —An array of days, which are all arrays of holiday names.
canLinkEvent()
Does permission checks to see if an event can be linked to a board/topic.
canLinkEvent() : void
checks if the current user can link the current topic to the calendar, permissions et al. this requires the calendar_post permission, a forum moderator, or a topic starter. expects the $topic and $board variables to be set. if the user doesn't have proper permissions, an error will be shown.
getTodayInfo()
Returns date information about 'today' relative to the users time offset.
getTodayInfo() : array<string|int, mixed>
returns an array with the current date, day, month, and year. takes the users time offset into account.
Return values
array<string|int, mixed> —An array of info about today, based on forum time. Has 'day', 'month', 'year' and 'date' (in YYYY-MM-DD format)
getCalendarGrid()
Provides information (link, month, year) about the previous and next month.
getCalendarGrid(string $selected_date, array<string|int, mixed> $calendarOptions[, bool $is_previous = false ][, bool $has_picker = true ]) : array<string|int, mixed>
Parameters
- $selected_date : string
-
A date in YYYY-MM-DD format
- $calendarOptions : array<string|int, mixed>
-
An array of calendar options
- $is_previous : bool = false
-
Whether this is the previous month
- $has_picker : bool = true
-
Wheter to add javascript to handle a date picker
Return values
array<string|int, mixed> —A large array containing all the information needed to show a calendar grid for the given month
getCalendarWeek()
Returns the information needed to show a calendar for the given week.
getCalendarWeek(string $selected_date, array<string|int, mixed> $calendarOptions) : array<string|int, mixed>
Parameters
- $selected_date : string
-
A date in YYYY-MM-DD format
- $calendarOptions : array<string|int, mixed>
-
An array of calendar options
Return values
array<string|int, mixed> —An array of information needed to display the grid for a single week on the calendar
getCalendarList()
Returns the information needed to show a list of upcoming events, birthdays, and holidays on the calendar.
getCalendarList(string $start_date, string $end_date, array<string|int, mixed> $calendarOptions) : array<string|int, mixed>
Parameters
- $start_date : string
-
The start of a date range in YYYY-MM-DD format
- $end_date : string
-
The end of a date range in YYYY-MM-DD format
- $calendarOptions : array<string|int, mixed>
-
An array of calendar options
Return values
array<string|int, mixed> —An array of information needed to display a list of upcoming events, etc., on the calendar
loadDatePicker()
Loads the necessary JavaScript and CSS to create a datepicker.
loadDatePicker([string $selector = 'input.date_input' ][, string $date_format = '' ]) : void
Parameters
- $selector : string = 'input.date_input'
-
A CSS selector for the input field(s) that the datepicker should be attached to.
- $date_format : string = ''
-
The date format to use, in strftime() format.
loadTimePicker()
Loads the necessary JavaScript and CSS to create a timepicker.
loadTimePicker([string $selector = 'input.time_input' ][, string $time_format = '' ]) : void
Parameters
- $selector : string = 'input.time_input'
-
A CSS selector for the input field(s) that the timepicker should be attached to.
- $time_format : string = ''
-
A time format in strftime format
loadDatePair()
Loads the necessary JavaScript for Datepair.js.
loadDatePair(string $container[, string $date_class = '' ][, string $time_class = '' ]) : void
Datepair.js helps to keep date ranges sane in the UI.
Parameters
- $container : string
-
CSS selector for the containing element of the date/time inputs to be paired.
- $date_class : string = ''
-
The CSS class of the date inputs to be paired.
- $time_class : string = ''
-
The CSS class of the time inputs to be paired.
cache_getOffsetIndependentEvents()
Retrieve all events for the given days, independently of the users offset.
cache_getOffsetIndependentEvents(array<string|int, mixed> $eventOptions) : array<string|int, mixed>
cache callback function used to retrieve the birthdays, holidays, and events between now and now + days_to_index. widens the search range by an extra 24 hours to support time offset shifts. used by the cache_getRecentEvents function to get the information needed to calculate the events taking the users time offset into account.
Parameters
- $eventOptions : array<string|int, mixed>
-
With the keys 'num_days_shown', 'include_holidays', 'include_birthdays' and 'include_events'
Return values
array<string|int, mixed> —An array containing the data that was cached as well as an expression to calculate whether the data should be refreshed and when it expires
cache_getRecentEvents()
cache callback function used to retrieve the upcoming birthdays, holidays, and events within the given period, taking into account the users time offset.
cache_getRecentEvents(array<string|int, mixed> $eventOptions) : array<string|int, mixed>
Called from the BoardIndex to display the current day's events on the board index used by the board index and SSI to show the upcoming events.
Parameters
- $eventOptions : array<string|int, mixed>
-
An array of event options.
Return values
array<string|int, mixed> —An array containing the info that was cached as well as a few other relevant things
validateEventPost()
Makes sure the calendar post is valid.
validateEventPost() : void
getEventPoster()
Get the event's poster.
getEventPoster(int $event_id) : int|bool
Parameters
- $event_id : int
-
The ID of the event
Return values
int|bool —The ID of the poster or false if the event was not found
removeHolidays()
Remove a holiday from the calendar
removeHolidays(array<string|int, mixed> $holiday_ids) : void
Parameters
- $holiday_ids : array<string|int, mixed>
-
An array of IDs of holidays to delete
CoppaForm()
This function will display the contact information for the forum, as well a form to fill in.
CoppaForm() : void
Credits()
It prepares credit and copyright information for the credits page or the admin page
Credits([bool $in_admin = false ]) : void
Parameters
- $in_admin : bool = false
-
= false, if parameter is true the it will not load the sub-template nor the template file
Display()
The central part of the board - topic display.
Display() : void
This function loads the posts in a topic up so they can be displayed. It uses the main sub template of the Display template. It requires a topic, and can go to the previous or next topic from it. It jumps to the correct post depending on a number/time/IS_MSG passed. It depends on the messages_per_page, defaultMaxMessages and enableAllMessages settings. It is accessed by ?topic=id_topic.START.
DisplayAdminFile()
Get one of the admin information files from Simple Machines.
DisplayAdminFile() : void
ShowXmlFeed()
Outputs xml data representing recent information or a profile.
ShowXmlFeed() : void
Can be passed subactions which decide what is output: 'recent' for recent posts, 'news' for news topics, 'members' for recently registered members, 'profile' for a member's profile. 'posts' for a member's posts. 'personal_messages' for a member's personal messages.
When displaying a member's profile or posts, the u parameter identifies which member. Defaults to the current user's id. To display a member's personal messages, the u parameter must match the id of the current user.
Outputs can be in RSS 0.92, RSS 2, Atom, RDF, or our own custom XML format. Default is RSS 2.
Accessed via ?action=.xml.
Does not use any templates, sub templates, or template layers.
Uses Stats, Profile, Post, and PersonalMessage language files.
buildXmlFeed()
Builds the XML from the data.
buildXmlFeed(string $format, array<string|int, mixed> $data, array<string|int, mixed> $metadata, string $subaction) : array<string|int, mixed>
Returns an array containing three parts: the feed's header section, its items section, and its footer section. For convenience, the array is also made available as SMF\Utils::$context['feed'].
This method is static for the sake of the ExportProfileData task, which needs to do a lot of custom manipulation of the XML.
Parameters
- $format : string
-
A supported feed format.
- $data : array<string|int, mixed>
-
Structured data to build as XML.
- $metadata : array<string|int, mixed>
-
Metadata about the feed.
- $subaction : string
-
The sub-action that was requested.
Return values
array<string|int, mixed> —The feed's header, items, and footer.
cdata_parse()
Ensures supplied data is properly encapsulated in cdata xml tags Called from getXmlProfile in News.php
cdata_parse(string $data[, string $ns = '' ][, bool $force = false ]) : string
Parameters
- $data : string
-
XML data
- $ns : string = ''
-
A namespace prefix for the XML data elements (used by mods, maybe)
- $force : bool = false
-
If true, enclose the XML data in cdata tags no matter what (used by mods, maybe)
Return values
string —The XML data enclosed in cdata tags when necessary
JSMembers()
Called by index.php?action=findmember.
JSMembers() : void
- is used as a popup for searching members.
- uses sub template find_members of the Help template.
- also used to add members for PM's sent using wap2/imode protocol.
Groups()
Entry point function, permission checks, admin bars, etc.
Groups() : void
It allows moderators and users to access the group showing functions. It handles permission checks, and puts the moderation bar on as required.
listMembergroupMembers_Href()
Gets the members of a supplied membergroup Returns them as a link for display
listMembergroupMembers_Href(array<string|int, mixed> &$members, int $membergroup[, int $limit = null ]) : bool
Parameters
- $members : array<string|int, mixed>
-
The IDs of the members
- $membergroup : int
-
The ID of the group
- $limit : int = null
-
How many members to show (null for no limit)
Return values
bool —True if there are more members to display, false otherwise
GroupList()
This very simply lists the groups, nothing snazy.
GroupList() : void
MembergroupMembers()
Display members of a group, and allow adding of members to a group. Silly function name though ;) It can be called from ManageMembergroups if it needs templating within the admin environment.
MembergroupMembers() : void
It shows a list of members that are part of a given membergroup. It is called by ?action=moderate;area=viewgroups;sa=members;group=x It requires the manage_membergroups permission. It allows to add and remove members from the selected membergroup. It allows sorting on several columns. It redirects to itself.
Tags
GroupRequests()
Show and manage all group requests.
GroupRequests() : void
ShowHelp()
Redirect to the user help ;).
ShowHelp() : void
It loads information needed for the help section. It is accessed by ?action=help.
Uses Help template and Manual language file.
HelpIndex()
The main page for the Help section
HelpIndex() : void
ShowAdminHelp()
Show some of the more detailed help to give the admin an idea... It shows a popup for administrative or user help.
ShowAdminHelp() : void
It uses the help parameter to decide what string to display and where to get the string from. ($helptxt or $txt?) It is accessed via ?action=helpadmin;help=?.
Uses ManagePermissions language file, if the help starts with permissionhelp.
Tags
JavaScriptModify()
Used to edit the body or subject of a message inline called from action=jsmodify from script and topic js
JavaScriptModify() : void
Login()
Ask them for their login information. (shows a page for the user to type in their username and password.) It caches the referring URL in $_SESSION['login_url'].
Login() : void
It is accessed from ?action=login.
Uses Login template and language file with the login sub-template.
Login2()
Actually logs you in.
Login2() : void
What it does:
- checks credentials and checks that login was successful.
- it employs protection against a specific IP or user trying to brute force a login to an account.
- upgrades password encryption on login, if necessary.
- after successful login, redirects you to $_SESSION['login_url'].
- accessed from ?action=login2, by forms. On error, uses the same templates Login() uses.
validatePasswordFlood()
This protects against brute force attacks on a member's password.
validatePasswordFlood(int $id_member, string $member_name[, bool|string $password_flood_value = false ][, bool $was_correct = false ][, bool $tfa = false ]) : void
Importantly, even if the password was right we DON'T TELL THEM!
Parameters
- $id_member : int
-
The ID of the member
- $member_name : string
-
The name of the member.
- $password_flood_value : bool|string = false
-
False if we don't have a flood value, otherwise a string with a timestamp and number of tries separated by a |
- $was_correct : bool = false
-
Whether or not the password was correct
- $tfa : bool = false
-
Whether we're validating for two-factor authentication
LoginTFA()
Allows the user to enter their Two-Factor Authentication code
LoginTFA() : void
Logout()
Logs the current user out of their account.
Logout() : void
It requires that the session hash is sent as well, to prevent automatic logouts by images or javascript. It redirects back to $_SESSION['logout_url'], if it exists. It is accessed via ?action=logout;session_var=...
MarkRead()
Mark one or more boards as read.
MarkRead() : void
Memberlist()
Shows a listing of registered members.
Memberlist() : void
- If a subaction is not specified, lists all registered members.
- It allows searching for members with the 'search' sub action.
- It calls MLAll or MLSearch depending on the sub action.
- Requires the view_mlist permission.
- Accessed via ?action=mlist.
Uses Memberlist template, main sub template.
MLAll()
List all members, page by page, with sorting.
MLAll() : void
Called from MemberList(). Can be passed a sort parameter, to order the display of members. Calls printMemberListRows to retrieve the results of the query.
MLSearch()
Search for members, or display search results.
MLSearch() : void
- Called by MemberList().
- If variable 'search' is empty displays search dialog box, using the search sub template.
- Calls printMemberListRows to retrieve the results of the query.
printMemberListRows()
Retrieves results of the request passed to it Puts results of request into the context for the sub template.
printMemberListRows(resource $request) : void
Parameters
- $request : resource
-
An SQL result resource
getCustFieldsMList()
Sets the label, sort and join info for every custom field column.
getCustFieldsMList() : array<string|int, mixed>
Return values
array<string|int, mixed> —An array of info about the custom fields for the member list
MessageIndex()
Show the list of topics in this board, along with any child boards.
MessageIndex() : void
getBoardList()
Generates the query to determine the list of available boards for a user Executes the query and returns the list
getBoardList([array<string|int, mixed> $boardListOptions = [] ]) : array<string|int, mixed>
Parameters
- $boardListOptions : array<string|int, mixed> = []
-
An array of options for the board list
Return values
array<string|int, mixed> —An array of board info
DeleteMessage()
Remove just a single post.
DeleteMessage() : void
On completion redirect to the topic or to the board.
getNotifyPrefs()
Fetches the list of preferences (or a single/subset of preferences) for notifications for one or more users.
getNotifyPrefs(int|array<string|int, mixed> $members[, string|array<string|int, mixed> $prefs = '' ][, bool $process_defaults = false ]) : array<string|int, mixed>
Parameters
- $members : int|array<string|int, mixed>
-
A user id or an array of (integer) user ids to load preferences for
- $prefs : string|array<string|int, mixed> = ''
-
An empty string to load all preferences, or a string (or array) of preference name(s) to load
- $process_defaults : bool = false
Return values
array<string|int, mixed> —An array of user ids => array (pref name -> value), with user id 0 representing the defaults
setNotifyPrefs()
Sets the list of preferences for a single user.
setNotifyPrefs(int $memID[, array<string|int, mixed> $prefs = [] ]) : mixed
Parameters
- $memID : int
-
The user whose preferences you are setting
- $prefs : array<string|int, mixed> = []
-
An array key of pref -> value
deleteNotifyPrefs()
Deletes notification preference
deleteNotifyPrefs(int $memID, array<string|int, mixed> $prefs) : mixed
Parameters
- $memID : int
-
The user whose preference you're setting
- $prefs : array<string|int, mixed>
-
The preferences to delete
getMemberWithToken()
Verifies a member's unsubscribe token, then returns some member info
getMemberWithToken(string $type) : array<string|int, mixed>
Parameters
- $type : string
-
The type of notification the token is for (e.g. 'board', 'topic', etc.)
Return values
array<string|int, mixed> —The id and email address of the specified member
createUnsubscribeToken()
Builds an unsubscribe token
createUnsubscribeToken(int $memID, string $email[, string $type = '' ][, int $itemID = 0 ]) : string
Parameters
- $memID : int
-
The id of the member that this token is for
- $email : string
-
The member's email address
- $type : string = ''
-
The type of notification the token is for (e.g. 'board', 'topic', etc.)
- $itemID : int = 0
-
The id of the notification item, if applicable.
Return values
string —The unsubscribe token
AnnouncementsNotify()
Turn off/on notifications for announcements.
AnnouncementsNotify() : void
Only uses the template if no mode was given. Accessed via ?action=notifyannouncements.
BoardNotify()
Turn off/on notification for a particular board.
BoardNotify() : void
Must be called with a board specified in the URL. Only uses the template if no mode (or subaction) was given. Redirects the user back to the board after it is done. Accessed via ?action=notifyboard.
Tags
TopicNotify()
Turn off/on unread replies subscription for a topic as well as sets individual topic's alert preferences Must be called with a topic specified in the URL.
TopicNotify() : void
The mode can be from 0 to 3 0 => unwatched, 1 => no alerts/emails, 2 => alerts, 3 => emails/alerts Upon successful completion of action will direct user back to topic. Accessed via ?action=notifytopic.
MessageMain()
This helps organize things.
MessageMain() : void
..
Tags
MessageFolder()
A folder, ie. inbox/sent etc.
MessageFolder() : void
MessagePopup()
The popup for when we ask for the popup from the user.
MessagePopup() : void
ManageLabels()
This function handles adding, deleting and editing labels on messages.
ManageLabels() : void
ManageRules()
List all rules, and allow adding/entering etc.
ManageRules() : void
..
MessageActionsApply()
This function performs all additional stuff.
MessageActionsApply() : void
..
MessagePrune()
This function allows the user to delete all messages older than so many days.
MessagePrune() : mixed
MessageKillAll()
Delete ALL the messages!
MessageKillAll() : void
ReportMessage()
Allows the user to report a personal message to an administrator.
ReportMessage() : void
- In the first instance requires that the ID of the message to report is passed through $_GET.
- It allows the user to report to either a particular administrator - or the whole admin team.
- It will forward on a copy of the original message without allowing the reporter to make changes.
Tags
MessageSearch()
Allows searching through personal messages.
MessageSearch() : void
MessageSearch2()
Actually do the search of personal messages.
MessageSearch2() : void
MessagePost()
Send a new message?
MessagePost() : void
MessagePost2()
Send it!
MessagePost2() : void
MessageSettings()
Allows to edit Personal Message Settings.
MessageSettings() : void
Uses Profile.php Uses Profile-Modify.php Uses Profile template. Uses Profile language file.
MessageDrafts()
This function allows the user to view their PM drafts
MessageDrafts() : void
Post()
Handles showing the post screen, loading the post to be modified, and loading any post quoted.
Post([array<string|int, mixed> $post_errors = [] ]) : void
- additionally handles previews of posts.
- Uses the Post template and language file, main sub template.
- requires different permissions depending on the actions, but most notably post_new, post_reply_own, and post_reply_any.
- shows options for the editing and posting of calendar events and attachments, as well as the posting of polls.
- accessed from ?action=post.
Parameters
- $post_errors : array<string|int, mixed> = []
-
Holds any errors found while trying to post
Post2()
Posts or saves the message composed with Post().
Post2() : void
requires various permissions depending on the action. handles attachment, post, and calendar saving. sends off notifications, and allows for announcements and moderation. accessed from ?action=post2.
QuickModeration()
Handles moderation from the message index.
QuickModeration() : void
Tags
QuickInTopicModeration()
In-topic quick moderation.
QuickInTopicModeration() : void
QuoteFast()
Loads a post an inserts it into the current editing text box.
QuoteFast() : void
uses the Post language file. uses special (sadly browser dependent) javascript to parse entities for internationalization reasons. accessed with ?action=quotefast.
RecentPosts()
Find the ten most recent posts.
RecentPosts() : void
getLastPost()
Get the latest post made on the system
getLastPost() : array<string|int, mixed>
- respects approved, recycled, and board permissions
Return values
array<string|int, mixed> —An array of information about the last post that you can see
Register()
Begin the registration process.
Register([array<string|int, mixed> $reg_errors = [] ]) : void
Parameters
- $reg_errors : array<string|int, mixed> = []
-
Holds information about any errors that occurred
Register2()
Actually register the member.
Register2() : void
registerMember()
Registers a member to the forum.
registerMember(array<string|int, mixed> &$reg_options[, bool $return_errors = false ]) : int|array<string|int, mixed>
Allows two types of interface: 'guest' and 'admin'. The first includes hammering protection, the latter can perform the registration silently. The strings used in the options array are assumed to be escaped. Allows to perform several checks on the input, e.g. reserved names. The function will adjust member statistics. If an error is detected will fatal error on all errors unless return_errors is true.
Parameters
- $reg_options : array<string|int, mixed>
-
An array of registration options
- $return_errors : bool = false
-
Whether to return the errors
Return values
int|array<string|int, mixed> —The ID of the newly registered user or an array of error info if $return_errors is true
RemindMe()
This is the controlling delegator
RemindMe() : void
Uses Profile language files and Reminder template
ReportToModerator()
Report a post or profile to the moderator... ask for a comment.
ReportToModerator() : void
Gathers data from the user to report abuse to the moderator(s). Uses the ReportToModerator template, main sub template. Requires the report_any permission. Uses ReportToModerator2() if post data was sent. Accessed through ?action=reporttm.
ReportToModerator2()
Send the emails.
ReportToModerator2() : void
Sends off emails to all the moderators. Sends to administrators and global moderators. (1 and 2) Called by ReportToModerator(), and thus has the same permission and setting requirements as it does. Accessed through ?action=reporttm when posting.
reportPost()
Actually reports a post using information specified from a form
reportPost(int $msg, string $reason) : void
Parameters
- $msg : int
-
The ID of the post being reported
- $reason : string
-
The reason specified for reporting the post
reportUser()
Actually reports a user's profile using information specified from a form
reportUser(int $id_member, string $reason) : void
Parameters
- $id_member : int
-
The ID of the member whose profile is being reported
- $reason : string
-
The reason specified by the reporter for this report
RequestMembers()
Outputs each member name on its own line.
RequestMembers() : void
- used by javascript to find members matching the request.
PlushSearch1()
Ask the user what they want to search for.
PlushSearch1() : void
What it does:
- shows the screen to search forum posts (action=search)
- uses the main sub template of the Search template.
- uses the Search language file.
- requires the search_posts permission.
- decodes and loads search parameters given in the URL (if any).
- the form redirects to index.php?action=search2.
PlushSearch2()
Gather the results and show them.
PlushSearch2() : void
What it does:
- checks user input and searches the messages table for messages matching the query.
- requires the search_posts permission.
- uses the results sub template of the Search template.
- uses the Search language file.
- stores the results into the search cache.
- show the results of the search query.
SendActivation()
It doesn't actually send anything, this action just shows a message for a guest.
SendActivation() : void
SMStats()
This is the function which returns stats to simplemachines.org IF enabled! called by simplemachines.org.
SMStats() : void
only returns anything if stats was enabled during installation. can also be accessed by the admin, to show what stats sm.org collects. does not return any data directly to sm.org, instead starts a new request for security.
Tags
DisplayStats()
Display some useful/interesting board statistics.
DisplayStats() : void
gets all the statistics in order and puts them in. uses the Stats template and language file. (and main sub template.) requires the view_stats permission. accessed from ?action=stats.
MergeTopics()
merges two or more topics into one topic.
MergeTopics() : void
delegates to the other functions (based on the URL parameter sa). loads the SplitTopics template. requires the merge_any permission. is accessed with ?action=mergetopics.
MergeIndex()
allows to pick a topic to merge the current topic with.
MergeIndex() : void
is accessed with ?action=mergetopics;sa=index default sub action for ?action=mergetopics. uses 'merge' sub template of the MoveTopic template. allows to set a different target board.
MergeExecute()
set merge options and do the actual merge of two or more topics.
MergeExecute([array<string|int, mixed> $topics = [] ]) : void
the merge options screen:
- shows topics to be merged and allows to set some merge options.
- is accessed by ?action=mergetopics;sa=options.and can also internally be called by QuickModeration() (Subs-Boards.php).
- uses 'merge_extra_options' sub template of the MoveTopic template.
the actual merge:
- is accessed with ?action=mergetopics;sa=execute.
- updates the statistics to reflect the merge.
- logs the action in the moderation log.
- sends a notification is sent to all users monitoring this topic.
- redirects to ?action=mergetopics;sa=done.
Parameters
- $topics : array<string|int, mixed> = []
-
The IDs of the topics to merge
MergeDone()
Shows a 'merge completed' screen.
MergeDone() : void
is accessed with ?action=mergetopics;sa=done. uses 'merge_done' sub template of the SplitTopics template.
MoveTopic()
This function allows to move a topic, making sure to ask the moderator to give reason for topic move.
MoveTopic() : void
It must be called with a topic specified. (that is, global $topic must be set... @todo fix this thing.) If the member is the topic starter requires the move_own permission, otherwise the move_any permission. Accessed via ?action=movetopic.
Uses the MoveTopic template, main sub-template.
MoveTopic2()
Execute the move of a topic.
MoveTopic2() : void
It is called on the submit of MoveTopic. This function logs that topics have been moved in the moderation log. If the member is the topic starter requires the move_own permission, otherwise requires the move_any permission. Upon successful completion redirects to message index. Accessed via ?action=movetopic2.
Uses Subs-Post.php
moveTopicConcurrence()
Called after a topic is moved to update $board_link and $topic_link to point to new location
moveTopicConcurrence() : mixed
PrintTopic()
Format a topic to be printer friendly.
PrintTopic() : void
Must be called with a topic specified. Accessed via ?action=printpage.
Uses Printpage template, main sub-template. Uses print_above/print_below later without the main layer.
RemoveTopic2()
Completely remove an entire topic.
RemoveTopic2() : void
Redirects to the board when completed.
removeDeleteConcurrence()
Try to determine if the topic has already been deleted by another user.
removeDeleteConcurrence() : bool
Return values
bool —False if it can't be deleted (recycling not enabled or no recycling board set), true if we've confirmed it can be deleted. Dies with an error if it's already been deleted.
RemoveOldTopics2()
So long as you are sure... all old posts will be gone.
RemoveOldTopics2() : mixed
Used in ManageMaintenance.php to prune old topics.
RestoreTopic()
Move back a topic from the recycle board to its original board.
RestoreTopic() : void
SplitTopics()
splits a topic into two topics.
SplitTopics() : void
delegates to the other functions (based on the URL parameter 'sa'). loads the SplitTopics template. requires the split_any permission. is accessed with ?action=splittopics.
splitTopic()
general function to split off a topic.
splitTopic(int $split1_ID_TOPIC, array<string|int, mixed> $splitMessages, string $new_subject) : int
creates a new topic and moves the messages with the IDs in array messagesToBeSplit to the new topic. the subject of the newly created topic is set to 'newSubject'. marks the newly created message as read for the user splitting it. updates the statistics to reflect a newly created topic. logs the action in the moderation log. a notification is sent to all users monitoring this topic.
Parameters
- $split1_ID_TOPIC : int
-
The ID of the topic we're splitting
- $splitMessages : array<string|int, mixed>
-
The IDs of the messages being split
- $new_subject : string
-
The subject of the new topic
Return values
int —The ID of the new split topic.
SplitIndex()
screen shown before the actual split.
SplitIndex() : void
is accessed with ?action=splittopics;sa=index. default sub action for ?action=splittopics. uses 'ask' sub template of the SplitTopics template. redirects to SplitSelectTopics if the message given turns out to be the first message of a topic. shows the user three ways to split the current topic.
SplitExecute()
do the actual split.
SplitExecute() : void
is accessed with ?action=splittopics;sa=execute. uses the main SplitTopics template. supports three ways of splitting: (1) only one message is split off. (2) all messages after and including a given message are split off. (3) select topics to split (redirects to SplitSelectTopics()). uses splitTopic function to do the actual splitting.
SplitSelectTopics()
allows the user to select the messages to be split.
SplitSelectTopics() : void
is accessed with ?action=splittopics;sa=selectTopics. uses 'select' sub template of the SplitTopics template or (for XMLhttp) the 'split' sub template of the Xml template. supports XMLhttp for adding/removing a message to the selection. uses a session variable to store the selected topics. shows two independent page indexes for both the selected and not-selected messages (;topic=1.x;start2=y).
SplitSelectionExecute()
do the actual split of a selection of topics.
SplitSelectionExecute() : void
is accessed with ?action=splittopics;sa=splitSelection. uses the main SplitTopics template. uses splitTopic function to do the actual splitting.
TrackIP()
Handles tracking a particular IP address
TrackIP([int $memID = 0 ]) : void
Parameters
- $memID : int = 0
-
The ID of a member whose IP we want to track
UnreadTopics()
Find unread topics and replies.
UnreadTopics() : void
VerificationCode()
Show the verification code or let it be heard.
VerificationCode() : void
ViewQuery()
Show the database queries for debugging What this does: - Toggles the session variable 'view_queries'.
ViewQuery() : void
- Views a list of queries and analyzes them.
- Requires the admin_forum permission.
- Is accessed via ?action=viewquery.
- Strings in this function have not been internationalized.
Who()
Who's online, and what are they doing? This function prepares the who's online data for the Who template.
Who() : void
It requires the who_view permission. It is enabled with the who_enabled setting. It is accessed via ?action=who.
Uses Who template, main sub-template Uses Who language file.
determineActions()
This function determines the actions of the members passed in urls.
determineActions(mixed $urls[, string|bool $preferred_prefix = false ]) : array<string|int, mixed>
Adding actions to the Who's Online list: Adding actions to this list is actually relatively easy...
- for actions anyone should be able to see, just add a string named whoall_ACTION. (where ACTION is the action used in index.php.)
- for actions that have a subaction which should be represented differently, use whoall_ACTION_SUBACTION.
- for actions that include a topic, and should be restricted, use whotopic_ACTION.
- for actions that use a message, by msg or quote, use whopost_ACTION.
- for administrator-only actions, use whoadmin_ACTION.
- for actions that should be viewable only with certain permissions, use whoallow_ACTION and add a list of possible permissions to the $allowedActions array, using ACTION as the key.
Parameters
- $urls : mixed
-
a single url (string) or an array of arrays, each inner array being (JSON-encoded request data, id_member)
- $preferred_prefix : string|bool = false
-
= false
Return values
array<string|int, mixed> —an array of descriptions if you passed an array, otherwise the string describing their current location.
XMLhttpMain()
The main handler and designator for AJAX stuff - jumpto, message icons and previews
XMLhttpMain() : void
GetJumpTo()
Get a list of boards and categories used for the jumpto dropdown.
GetJumpTo() : void
ListMessageIcons()
Gets a list of available message icons and sends the info to the template for display
ListMessageIcons() : void
RetrievePreview()
Handles retrieving previews of news items, newsletters, signatures and warnings.
RetrievePreview() : bool|null
Calls the appropriate function based on $_POST['item']
Return values
bool|null —Returns false if $_POST['item'] isn't set or isn't valid
loadCacheAccelerator()
Try to load up a supported caching method. This is saved in $cacheAPI if we are not overriding it.
loadCacheAccelerator([string $overrideCache = '' ][, bool $fallbackSMF = true ]) : object|false
Parameters
- $overrideCache : string = ''
-
Try to use a different cache method other than that defined in $cache_accelerator.
- $fallbackSMF : bool = true
-
Use the default SMF method if the accelerator fails.
Return values
object|false —A object of $cacheAPI, or False on failure.
loadCacheAPIs()
Get the installed Cache API implementations.
loadCacheAPIs() : array<string|int, mixed>
Return values
array<string|int, mixed>clean_cache()
Empty out the cache in use as best it can
clean_cache([string $type = '' ]) : void
It may only remove the files of a certain type (if the $type parameter is given) Type can be user, data or left blank - user clears out user data
- data clears out system / opcode data
- If no type is specified will perform a complete cache clearing For cache engines that do not distinguish on types, a full cache flush will be done
Parameters
- $type : string = ''
-
The cache type ('memcached', 'zend' or something else for SMF's file cache)
cache_quick_get()
Try to retrieve a cache entry. On failure, call the appropriate function.
cache_quick_get(string $key, string $file, string $function, array<string|int, mixed> $params[, int $level = 1 ]) : string
Parameters
- $key : string
-
The key for this entry
- $file : string
-
The file associated with this entry
- $function : string
-
The function to call
- $params : array<string|int, mixed>
-
Parameters to be passed to the specified function
- $level : int = 1
-
The cache level
Return values
string —The cached data
cache_put_data()
Puts value in the cache under key for ttl seconds.
cache_put_data(string $key, mixed $value[, int $ttl = 120 ]) : void
- It may "miss" so shouldn't be depended on
- Uses the cache engine chosen in the ACP and saved in settings.php
- It supports: memcache: https://php.net/memcache APCu: https://php.net/book.apcu Zend: http://files.zend.com/help/Zend-Platform/output_cache_functions.htm Zend: http://files.zend.com/help/Zend-Platform/zend_cache_functions.htm
Parameters
- $key : string
-
A key for this value
- $value : mixed
-
The data to cache
- $ttl : int = 120
-
How long (in seconds) the data should be cached for
cache_get_data()
Gets the value from the cache specified by key, so long as it is not older than ttl seconds.
cache_get_data(string $key[, int $ttl = 120 ]) : array<string|int, mixed>|null
- It may often "miss", so shouldn't be depended on.
- It supports the same as cache_put_data().
Parameters
- $key : string
-
The key for the value to retrieve
- $ttl : int = 120
-
The maximum age of the cached data
Return values
array<string|int, mixed>|null —The cached data or null if nothing was loaded
reloadSettings()
Load the $modSettings array.
reloadSettings() : mixed
updateSettings()
Updates the settings table as well as $modSettings... only does one at a time if $update is true.
updateSettings(array<string|int, mixed> $change_array[, bool $update = false ]) : mixed
- updates both the settings table and $modSettings array.
- all of changeArray's indexes and values are assumed to have escaped apostrophes (')!
- if a variable is already set to what you want to change it to, that variable will be skipped over; it would be unnecessary to reset.
- When use_update is true, UPDATEs will be used instead of REPLACE.
- when use_update is true, the value can be true or false to increment or decrement it, respectively.
Parameters
- $change_array : array<string|int, mixed>
-
An array of info about what we're changing in 'setting' => 'value' format
- $update : bool = false
-
Whether to use an UPDATE query instead of a REPLACE query
get_auth_secret()
Gets, and if necessary creates, the authentication secret to use for cookies, tokens, etc.
get_auth_secret() : string
Note: Never use the $auth_secret variable directly. Always call this function instead.
Return values
string —The authentication secret.
get_settings_defs()
Describes properties of all known Settings.php variables and other content.
get_settings_defs() : array<string|int, mixed>
Helper for updateSettingsFile(); also called by saveSettings().
Return values
array<string|int, mixed> —Descriptions of all known Settings.php content
updateSettingsFile()
Update the Settings.php file.
updateSettingsFile(array<string|int, mixed> $config_vars[, bool|null $keep_quotes = null ][, bool $rebuild = false ]) : bool
The most important function in this file for mod makers happens to be the updateSettingsFile() function, but it shouldn't be used often anyway.
-
Updates the Settings.php file with the changes supplied in config_vars.
-
Expects config_vars to be an associative array, with the keys as the variable names in Settings.php, and the values the variable values.
-
Correctly formats the values using smf_var_export().
-
Restores standard formatting of the file, if $rebuild is true.
-
Checks for changes to db_last_error and passes those off to a separate handler.
-
Creates a backup file and will use it should the writing of the new settings file fail.
-
Tries to intelligently trim quotes and remove slashes from string values. This is done for backwards compatibility purposes (old versions of this function expected strings to have been manually escaped and quoted). This behaviour can be controlled by the $keep_quotes parameter.
MOD AUTHORS: If you are adding a setting to Settings.php, you should use the integrate_update_settings_file hook to define it in get_settings_defs().
Parameters
- $config_vars : array<string|int, mixed>
-
An array of one or more variables to update.
- $keep_quotes : bool|null = null
-
Whether to strip slashes & trim quotes from string values. Defaults to auto-detection.
- $rebuild : bool = false
-
If true, attempts to rebuild with standard format. Default false.
Return values
bool —True on success, false on failure.
safe_file_write()
Writes data to a file, optionally making a backup, while avoiding race conditions.
safe_file_write(string $file, string $data[, string $backup_file = null ][, int $mtime = null ][, bool $append = false ]) : bool
Parameters
- $file : string
-
The filepath of the file where the data should be written.
- $data : string
-
The data to be written to $file.
- $backup_file : string = null
-
The filepath where the backup should be saved. Default null.
- $mtime : int = null
-
If modification time of $file is more recent than this Unix timestamp, the write operation will abort. Defaults to time that the script started execution.
- $append : bool = false
-
If true, the data will be appended instead of overwriting the existing content of the file. Default false.
Return values
bool —Whether the write operation succeeded or not.
smf_var_export()
A wrapper around var_export whose output matches SMF coding conventions.
smf_var_export(mixed $var) : mixed
Parameters
- $var : mixed
-
The variable to export
Tags
Return values
mixed —A PHP-parseable representation of the variable's value
updateDbLastError()
Saves the time of the last db error for the error log - Done separately from updateSettingsFile to avoid race conditions which can occur during a db error - If it fails Settings.php will assume 0
updateDbLastError(int $time) : bool
Parameters
- $time : int
-
The timestamp of the last DB error
Return values
bool —True If we could succesfully put the file or not.
sm_temp_dir()
Locates the most appropriate temp directory.
sm_temp_dir() : string
Systems using open_basedir
restrictions may receive errors with
sys_get_temp_dir()
due to misconfigurations on servers. Other
cases sys_temp_dir may not be set to a safe value. Additionally
sys_get_temp_dir
may use a readonly directory. This attempts to
find a working temp directory that is accessible under the
restrictions and is writable to the web service account.
Directories checked against open_basedir
:
sys_get_temp_dir()
upload_tmp_dir
session.save_path
cachedir
Return values
stringsmf_seed_generator()
Generate a random seed and ensure it's stored in settings.
smf_seed_generator() : mixed
check_cron()
Ensures SMF's scheduled tasks are being run as intended
check_cron() : mixed
If the admin activated the cron_is_real_cron setting, but the cron job is not running things at least once per day, we need to go back to SMF's default behaviour using "web cron" JavaScript calls.
loadDatabase()
Initialize a database connection.
loadDatabase([array<string|int, mixed> $options = [] ]) : DatabaseApi
Parameters
- $options : array<string|int, mixed> = []
Return values
DatabaseApidb_extend()
Extend the database functionality. It calls the respective file's init to add the implementations in that file to $smcFunc array.
db_extend(string $type) : void
In SMF 3.0 this is a no-op.
Parameters
- $type : string
-
Indicates which additional file to load. ('extra', 'packages')
imageMemoryCheck()
See if we have enough memory to thumbnail an image
imageMemoryCheck(array<string|int, mixed> $sizes) : bool
Parameters
- $sizes : array<string|int, mixed>
-
image size
Return values
bool —Whether we do
url_image_size()
Get the size of a specified image with better error handling.
url_image_size(string $url) : array<string|int, mixed>|false
Parameters
- $url : string
-
The URL of the image
Tags
Return values
array<string|int, mixed>|false —The image size as array (width, height), or false on failure
gif_outputAsPng()
Writes a gif file to disk as a png file.
gif_outputAsPng(gif_file $gif, string $lpszFileName[, int $background_color = -1 ]) : bool
Parameters
- $gif : gif_file
-
A gif image resource
- $lpszFileName : string
-
The name of the file
- $background_color : int = -1
-
The background color
Return values
bool —Whether the operation was successful
getSvgSize()
Gets the dimensions of an SVG image (specifically, of its viewport).
getSvgSize(string $filepath) : array<string|int, mixed>
If $filepath is not the path to a valid SVG file, the returned width and height will both be null.
See https://www.w3.org/TR/SVG11/coords.html#IntrinsicSizing
Parameters
- $filepath : string
-
The path to the SVG file.
Return values
array<string|int, mixed> —The width and height of the SVG image in pixels.
createThumbnail()
Create a thumbnail of the given source.
createThumbnail(string $source, int $max_width, int $max_height) : bool
Parameters
- $source : string
-
The name of the source image
- $max_width : int
-
The maximum allowed width
- $max_height : int
-
The maximum allowed height
Tags
Return values
bool —Whether the thumbnail creation was successful.
reencodeImage()
Used to re-econodes an image to a specified image format - creates a copy of the file at the same location as fileName.
reencodeImage(string $source[, int $preferred_type = 0 ]) : bool
- the file would have the format preferred_format if possible, otherwise the default format is jpeg.
- the function makes sure that all non-essential image contents are disposed.
Parameters
- $source : string
- $preferred_type : int = 0
Return values
bool —Whether the reencoding was successful
checkImageContents()
Searches through the file to see if there's potentially harmful non-binary content.
checkImageContents(string $source[, bool $extensive = false ]) : bool
- if extensiveCheck is true, searches for asp/php short tags as well.
Parameters
- $source : string
- $extensive : bool = false
Return values
bool —Whether the image appears to be safe
checkSvgContents()
Searches through an SVG file to see if there's potentially harmful content.
checkSvgContents(string $source) : bool
Parameters
- $source : string
Return values
bool —Whether the image appears to be safe.
resizeImageFile()
Resizes an image from a remote location or a local file.
resizeImageFile(string $source, string $destination, int $max_width, int $max_height[, int $preferred_type = 0 ]) : bool
Puts the resized image at the destination location. The file would have the format preferred_format if possible, otherwise the default format is jpeg.
Parameters
- $source : string
-
The path to the source image
- $destination : string
-
The path to the destination image
- $max_width : int
-
The maximum allowed width
- $max_height : int
-
The maximum allowed height
- $preferred_type : int = 0
Tags
Return values
bool —Whether it succeeded.
resizeImage()
Resizes src_img proportionally to fit within max_width and max_height limits if it is too large.
resizeImage(resource $source, string $destination, int $src_width, int $src_height, int $max_width, int $max_height[, bool $force_resize = false ][, int $preferred_type = 0 ]) : bool
If GD2 is present, it'll use it to achieve better quality. It saves the new image to destination_filename, as preferred_format if possible, default is jpeg.
Uses Imagemagick (IMagick or MagickWand extension) or GD
Parameters
- $source : resource
-
The source image
- $destination : string
-
The path to the destination image
- $src_width : int
-
The width of the source image
- $src_height : int
-
The height of the source image
- $max_width : int
-
The maximum allowed width
- $max_height : int
-
The maximum allowed height
- $force_resize : bool = false
-
= false Whether to forcibly resize it
- $preferred_type : int = 0
-
- 1 for gif, 2 for jpeg, 3 for png, 6 for bmp or 15 for wbmp
Return values
bool —Whether the resize was successful
read_tgz_file()
Reads an archive from either a remote location or from the local filesystem.
read_tgz_file(string $gzfilename, string $destination[, bool $single_file = false ][, bool $overwrite = false ][, null|array<string|int, mixed> $files_to_extract = null ]) : array<string|int, mixed>|false
Parameters
- $gzfilename : string
-
The path to the tar.gz file
- $destination : string
-
The path to the desitnation directory
- $single_file : bool = false
-
If true returns the contents of the file specified by destination if it exists
- $overwrite : bool = false
-
Whether to overwrite existing files
- $files_to_extract : null|array<string|int, mixed> = null
-
Specific files to extract
Return values
array<string|int, mixed>|false —An array of information about extracted files or false on failure
read_tgz_data()
Extracts a file or files from the .tar.gz contained in data.
read_tgz_data(string $data, null|string $destination[, bool $single_file = false ][, bool $overwrite = false ][, null|array<string|int, mixed> $files_to_extract = null ]) : array<string|int, mixed>|false
detects if the file is really a .zip file, and if so returns the result of read_zip_data
if destination is null
- returns a list of files in the archive.
if single_file is true
- returns the contents of the file specified by destination, if it exists, or false.
- destination can start with * and / to signify that the file may come from any directory.
- destination should not begin with a / if single_file is true.
overwrites existing files with newer modification times if and only if overwrite is true. creates the destination directory if it doesn't exist, and is is specified. requires zlib support be built into PHP. returns an array of the files extracted. if files_to_extract is not equal to null only extracts file within this array.
Parameters
- $data : string
-
The gzipped tarball
- $destination : null|string
-
The destination
- $single_file : bool = false
-
Whether to only extract a single file
- $overwrite : bool = false
-
Whether to overwrite existing data
- $files_to_extract : null|array<string|int, mixed> = null
-
If set, only extracts the specified files
Return values
array<string|int, mixed>|false —An array of information about the extracted files or false on failure
read_zip_data()
Extract zip data.
read_zip_data(string $data, string $destination[, bool $single_file = false ][, bool $overwrite = false ][, array<string|int, mixed> $files_to_extract = null ]) : mixed
If single_file is true, destination can start with * and / to signify that the file may come from any directory. Destination should not begin with a / if single_file is true.
Parameters
- $data : string
-
ZIP data
- $destination : string
-
Null to display a listing of files in the archive, the destination for the files in the archive or the name of a single file to display (if $single_file is true)
- $single_file : bool = false
-
If true, returns the contents of the file specified by destination or false if the file can't be found (default value is false).
- $overwrite : bool = false
-
If true, will overwrite files with newer modication times. Default is false.
- $files_to_extract : array<string|int, mixed> = null
Return values
mixed —If destination is null, return a short array of a few file details optionally delimited by $files_to_extract. If $single_file is true, return contents of a file as a string; false otherwise
url_exists()
Checks the existence of a remote file since file_exists() does not do remote.
url_exists(string $url) : bool
will return false if the file is "moved permanently" or similar.
Parameters
- $url : string
-
The URL to parse
Return values
bool —Whether the specified URL exists
loadInstalledPackages()
Loads and returns an array of installed packages.
loadInstalledPackages() : array<string|int, mixed>
default sort order is package_installed time
Return values
array<string|int, mixed> —An array of info about installed packages
getPackageInfo()
Loads a package's information and returns a representative array.
getPackageInfo(string $gzfilename) : array<string|int, mixed>|string
- expects the file to be a package in Packages/.
- returns a error string if the package-info is invalid.
- otherwise returns a basic array of id, version, filename, and similar information.
- an xmlArray is available in 'xml'.
Parameters
- $gzfilename : string
-
The path to the file
Return values
array<string|int, mixed>|string —An array of info about the file or a string indicating an error
create_chmod_control()
Create a chmod control for chmoding files.
create_chmod_control([array<string|int, mixed> $chmodFiles = [] ][, array<string|int, mixed> $chmodOptions = [] ][, bool $restore_write_status = false ]) : array<string|int, mixed>
Parameters
- $chmodFiles : array<string|int, mixed> = []
-
Which files to chmod
- $chmodOptions : array<string|int, mixed> = []
-
Options for chmod
- $restore_write_status : bool = false
-
Whether to restore write status
Return values
array<string|int, mixed> —An array of file info
list_restoreFiles()
Get a listing of files that will need to be set back to the original state
list_restoreFiles(null $dummy1, null $dummy2, null $dummy3, bool $do_change) : array<string|int, mixed>
Parameters
- $dummy1 : null
- $dummy2 : null
- $dummy3 : null
- $do_change : bool
Return values
array<string|int, mixed> —An array of info about the files that need to be restored back to their original state
packageRequireFTP()
Use FTP functions to work with a package download/install
packageRequireFTP(string $destination_url[, null|array<string|int, mixed> $files = null ][, bool $return = false ]) : array<string|int, mixed>
Parameters
- $destination_url : string
-
The destination URL
- $files : null|array<string|int, mixed> = null
-
The files to CHMOD
- $return : bool = false
-
Whether to return an array of file info if there's an error
Return values
array<string|int, mixed> —An array of file info
parsePackageInfo()
Parses the actions in package-info.xml file from packages.
parsePackageInfo(xmlArray &$packageXML[, bool $testing_only = true ][, string $method = 'install' ][, string $previous_version = '' ]) : array<string|int, mixed>
- package should be an xmlArray with package-info as its base.
- testing_only should be true if the package should not actually be applied.
- method can be upgrade, install, or uninstall. Its default is install.
- previous_version should be set to the previous installed version of this package, if any.
- does not handle failure terribly well; testing first is always better.
Parameters
- $packageXML : xmlArray
-
The info from the package-info file
- $testing_only : bool = true
-
Whether we're only testing
- $method : string = 'install'
-
The method ('install', 'upgrade', or 'uninstall')
- $previous_version : string = ''
-
The previous version of the mod, if method is 'upgrade'
Return values
array<string|int, mixed> —An array of those changes made.
matchHighestPackageVersion()
Checks if version matches any of the versions in `$versions`.
matchHighestPackageVersion(string $versions, bool $reset, string $the_version) : string|bool
- supports comma separated version numbers, with or without whitespace.
- supports lower and upper bounds. (1.0-1.2)
- returns true if the version matched.
Parameters
- $versions : string
-
The versions that this package will install on
- $reset : bool
-
Whether to reset $near_version
- $the_version : string
-
The forum version
Return values
string|bool —Highest install value string or false
matchPackageVersion()
Checks if the forum version matches any of the available versions from the package install xml.
matchPackageVersion(string $version, string $versions) : bool
- supports comma separated version numbers, with or without whitespace.
- supports lower and upper bounds. (1.0-1.2)
- returns true if the version matched.
Parameters
- $version : string
-
The forum version
- $versions : string
-
The versions that this package will install on
Return values
bool —Whether the version matched
compareVersions()
Compares two versions and determines if one is newer, older or the same, returns - (-1) if version1 is lower than version2 - (0) if version1 is equal to version2 - (1) if version1 is higher than version2
compareVersions(string $version1, string $version2) : int
Parameters
- $version1 : string
-
The first version
- $version2 : string
-
The second version
Return values
int —-1 if version2 is greater than version1, 0 if they're equal, 1 if version1 is greater than version2
parse_path()
Parses special identifiers out of the specified path.
parse_path(string $path) : string
Parameters
- $path : string
-
The path
Return values
string —The parsed path
deltree()
Deletes a directory, and all the files and direcories inside it.
deltree(string $dir[, bool $delete_dir = true ]) : void
requires access to delete these files.
Parameters
- $dir : string
-
A directory
- $delete_dir : bool = true
-
If false, only deletes everything inside the directory but not the directory itself
mktree()
Creates the specified tree structure with the mode specified.
mktree(string $strPath, int $mode) : bool
creates every directory in path until it finds one that already exists.
Parameters
- $strPath : string
-
The path
- $mode : int
-
The permission mode for CHMOD (0666, etc.)
Return values
bool —True if successful, false otherwise
copytree()
Copies one directory structure over to another.
copytree(string $source, string $destination) : void
requires the destination to be writable.
Parameters
- $source : string
-
The directory to copy
- $destination : string
-
The directory to copy $source to
listtree()
Create a tree listing for a given directory path
listtree(string $path[, string $sub_path = '' ]) : array<string|int, mixed>
Parameters
- $path : string
-
The path
- $sub_path : string = ''
-
The sub-path
Return values
array<string|int, mixed> —An array of information about the files at the specified path/subpath
parseModification()
Parses a xml-style modification file (file).
parseModification(string $file[, bool $testing = true ][, bool $undo = false ][, array<string|int, mixed> $theme_paths = [] ]) : array<string|int, mixed>
Parameters
- $file : string
-
The modification file to parse
- $testing : bool = true
-
Whether we're just doing a test
- $undo : bool = false
-
If true, specifies that the modifications should be undone. Used when uninstalling. Doesn't work with regex.
- $theme_paths : array<string|int, mixed> = []
-
An array of information about custom themes to apply the changes to
Return values
array<string|int, mixed> —An array of those changes made.
parseBoardMod()
Parses a boardmod-style (.mod) modification file
parseBoardMod(string $file[, bool $testing = true ][, bool $undo = false ][, array<string|int, mixed> $theme_paths = [] ]) : array<string|int, mixed>
Parameters
- $file : string
-
The modification file to parse
- $testing : bool = true
-
Whether we're just doing a test
- $undo : bool = false
-
If true, specifies that the modifications should be undone. Used when uninstalling.
- $theme_paths : array<string|int, mixed> = []
-
An array of information about custom themes to apply the changes to
Return values
array<string|int, mixed> —An array of those changes made.
package_get_contents()
Get the physical contents of a packages file
package_get_contents(string $filename) : string
Parameters
- $filename : string
-
The package file
Return values
string —The contents of the specified file
package_put_contents()
Writes data to a file, almost exactly like the file_put_contents() function.
package_put_contents(string $filename, string $data[, bool $testing = false ]) : int
uses FTP to create/chmod the file when necessary and available. uses text mode for text mode file extensions. returns the number of bytes written.
Parameters
- $filename : string
-
The name of the file
- $data : string
-
The data to write to the file
- $testing : bool = false
-
Whether we're just testing things
Return values
int —The length of the data written (in bytes)
package_flush_cache()
Flushes the cache from memory to the filesystem
package_flush_cache([bool $trash = false ]) : void
Parameters
- $trash : bool = false
package_chmod()
Try to make a file writable.
package_chmod(string $filename[, string $perm_state = 'writable' ][, bool $track_change = false ]) : bool
Parameters
- $filename : string
-
The name of the file
- $perm_state : string = 'writable'
-
The permission state - can be either 'writable' or 'execute'
- $track_change : bool = false
-
Whether to track this change
Return values
bool —True if it worked, false if it didn't
package_crypt()
Used to crypt the supplied ftp password in this session
package_crypt(string $pass) : string
Parameters
- $pass : string
-
The password
Return values
string —The encrypted password
package_unique_filename()
package_unique_filename(string $dir, string $filename, string $ext) : string
Parameters
- $dir : string
- $filename : string
-
The filename without an extension
- $ext : string
Tags
Return values
string —The filename with a number appended but no extension
package_create_backup()
Creates a backup of forum files prior to modifying them
package_create_backup([string $id = 'backup' ]) : bool
Parameters
- $id : string = 'backup'
-
The name of the backup
Return values
bool —True if it worked, false if it didn't
package_validate_installtest()
Validate a package during install
package_validate_installtest(array<string|int, mixed> $package) : array<string|int, mixed>
Parameters
- $package : array<string|int, mixed>
-
Package data
Return values
array<string|int, mixed> —Results from the package validation.
package_validate()
Validate multiple packages.
package_validate(array<string|int, mixed> $packages) : array<string|int, mixed>
Parameters
- $packages : array<string|int, mixed>
-
Package data
Return values
array<string|int, mixed> —Results from the package validation.
package_validate_send()
Sending data off to validate packages.
package_validate_send(array<string|int, mixed> $sendData) : array<string|int, mixed>
Parameters
- $sendData : array<string|int, mixed>
-
Json encoded data to be sent to the validation servers.
Return values
array<string|int, mixed> —Results from the package validation.
sendpm()
Sends an personal message from the specified person to the specified people ($from defaults to the user)
sendpm(array<string|int, mixed> $recipients, string $subject, string $message[, bool $store_outbox = false ][, array<string|int, mixed> $from = null ][, int $pm_head = 0 ]) : array<string|int, mixed>
Parameters
- $recipients : array<string|int, mixed>
-
An array containing the arrays 'to' and 'bcc', both containing id_member's.
- $subject : string
-
Should have no slashes and no html entities
- $message : string
-
Should have no slashes and no html entities
- $store_outbox : bool = false
-
Whether to store it in the sender's outbox
- $from : array<string|int, mixed> = null
-
An array with the id, name, and username of the member.
- $pm_head : int = 0
-
The ID of the chain being replied to - if any.
Return values
array<string|int, mixed> —An array with log entries telling how many recipients were successful and which recipients it failed to send to.
deleteMessages()
Delete the specified personal messages.
deleteMessages(array<string|int, mixed>|null $personal_messages[, string|null $folder = null ][, array<string|int, mixed>|int|null $owner = null ]) : void
Parameters
- $personal_messages : array<string|int, mixed>|null
-
An array containing the IDs of PMs to delete or null to delete all of them
- $folder : string|null = null
-
Which "folder" to delete PMs from - 'sent' to delete them from the outbox, null or anything else to delete from the inbox
- $owner : array<string|int, mixed>|int|null = null
-
An array of IDs of users whose PMs are being deleted, the ID of a single user or null to use the current user's ID
markMessages()
Mark the specified personal messages read.
markMessages([array<string|int, mixed>|null $personal_messages = null ][, int|null $label = null ][, int|null $owner = null ]) : void
Parameters
- $personal_messages : array<string|int, mixed>|null = null
-
An array of PM IDs to mark or null to mark all
- $label : int|null = null
-
The ID of a label. If set, only messages with this label will be marked.
- $owner : int|null = null
-
If owner is set, marks messages owned by that member id
messagePostError()
An error in the message.
messagePostError(array<string|int, mixed> $error_types, array<string|int, mixed> $named_recipients[, mixed $recipient_ids = [] ]) : void
..
Parameters
- $error_types : array<string|int, mixed>
-
An array of strings indicating which type of errors occurred
- $named_recipients : array<string|int, mixed>
- $recipient_ids : mixed = []
isAccessiblePM()
Check if the PM is available to the current user.
isAccessiblePM(int $pmID[, string $folders = 'both' ]) : bool
Parameters
- $pmID : int
-
The ID of the PM
- $folders : string = 'both'
Return values
bool —Whether the PM is accessible in that folder for the current user
LoadRules()
Load up all the rules for the current user.
LoadRules([bool $reload = false ]) : array<string|int, mixed>
Parameters
- $reload : bool = false
-
Whether or not to reload all the rules from the database if $context['rules'] is set
Return values
array<string|int, mixed>ApplyRules()
This will apply rules to all unread messages. If all_messages is set will, clearly, do it to all!
ApplyRules([bool $all_messages = false ]) : void
Parameters
- $all_messages : bool = false
-
Whether to apply this to all messages or just unread ones
findSearchAPI()
Creates a search API and returns the object.
findSearchAPI() : search_api_interface
Return values
search_api_interface —An instance of the search API interface
loadSearchAPIs()
Get the installed Search API implementations.
loadSearchAPIs() : array<string|int, mixed>
This function checks for patterns in comments on top of the Search-API files! In addition to filenames pattern. It loads the search API classes if identified. This function is used by EditSearchMethod to list all installed API implementations.
Return values
array<string|int, mixed> —Info about the detected search APIs.
highlight()
Highlighting matching string
highlight(string $text, array<string|int, mixed> $words) : string
Parameters
- $text : string
-
Text to search through
- $words : array<string|int, mixed>
-
List of keywords to search
Return values
string —Text with highlighted keywords
utf8_decompose()
Helper function for utf8_normalize_d and utf8_normalize_kd.
utf8_decompose(array<string|int, mixed> $chars[, bool $compatibility = false ]) : array<string|int, mixed>
Parameters
- $chars : array<string|int, mixed>
-
Array of Unicode characters
- $compatibility : bool = false
-
If true, perform compatibility decomposition. Default false.
Return values
array<string|int, mixed> —Array of decomposed Unicode characters.
utf8_compose()
Helper function for utf8_normalize_c and utf8_normalize_kc.
utf8_compose(array<string|int, mixed> $chars) : array<string|int, mixed>
Parameters
- $chars : array<string|int, mixed>
-
Array of decomposed Unicode characters
Return values
array<string|int, mixed> —Array of composed Unicode characters.
utf8_strtolower()
Converts the given UTF-8 string into lowercase.
utf8_strtolower(string $string) : string
Equivalent to mb_strtolower($string, 'UTF-8'), except that we can keep the output consistent across PHP versions and up to date with the latest version of Unicode.
Parameters
- $string : string
-
The string
Return values
string —The lowercase version of $string
utf8_strtoupper()
Convert the given UTF-8 string to uppercase.
utf8_strtoupper(string $string) : string
Equivalent to mb_strtoupper($string, 'UTF-8'), except that we can keep the output consistent across PHP versions and up to date with the latest version of Unicode.
Parameters
- $string : string
-
The string
Return values
string —The uppercase version of $string
utf8_casefold()
Casefolds the given UTF-8 string.
utf8_casefold(string $string) : string
Equivalent to mb_convert_case($string, MB_CASE_FOLD, 'UTF-8'), except that we can keep the output consistent across PHP versions and up to date with the latest version of Unicode.
Parameters
- $string : string
-
The string
Return values
string —The uppercase version of $string
utf8_convert_case()
Converts the case of the given UTF-8 string.
utf8_convert_case(string $string, string $case[, bool $simple = false ]) : string
Parameters
- $string : string
-
The string.
- $case : string
-
One of 'upper', 'lower', 'fold', 'title', 'ucfirst', or 'ucwords'.
- $simple : bool = false
-
If true, use simple maps instead of full maps. Default: false.
Return values
string —A version of $string converted to the specified case.
utf8_normalize_d()
Normalizes UTF-8 via Canonical Decomposition.
utf8_normalize_d(string $string) : string
Parameters
- $string : string
-
A UTF-8 string
Return values
string —The decomposed version of $string
utf8_normalize_kd()
Normalizes UTF-8 via Compatibility Decomposition.
utf8_normalize_kd(string $string) : string
Parameters
- $string : string
-
A UTF-8 string.
Return values
string —The decomposed version of $string.
utf8_normalize_c()
Normalizes UTF-8 via Canonical Decomposition then Canonical Composition.
utf8_normalize_c(string $string) : string
Parameters
- $string : string
-
A UTF-8 string
Return values
string —The composed version of $string
utf8_normalize_kc()
Normalizes UTF-8 via Compatibility Decomposition then Canonical Composition.
utf8_normalize_kc(string $string) : string
Parameters
- $string : string
-
The string
Return values
string —The composed version of $string
utf8_normalize_kc_casefold()
Casefolds UTF-8 via Compatibility Composition Casefolding.
utf8_normalize_kc_casefold(string $string) : string
Used by idn_to_ascii polyfill in Subs-Compat.php
Parameters
- $string : string
-
The string
Return values
string —The casefolded version of $string
utf8_is_normalized()
Checks whether a string is already normalized to a given form.
utf8_is_normalized(string|array<string|int, mixed> $string, string $form) : bool
Parameters
- $string : string|array<string|int, mixed>
-
A string of UTF-8 characters.
- $form : string
-
One of 'd', 'c', 'kd', 'kc', or 'kc_casefold'
Return values
bool —Whether the string is already normalized to the given form.
utf8_sanitize_invisibles()
Helper function for sanitize_chars() that deals with invisible characters.
utf8_sanitize_invisibles(string $string, int $level, string $substitute) : string
This function deals with control characters, private use characters, non-characters, and characters that are invisible by definition in the Unicode standard. It does not deal with characters that are supposed to be visible according to the Unicode standard, and makes no attempt to compensate for possibly incomplete Unicode support in text rendering engines on client devices.
Parameters
- $string : string
-
The string to sanitize.
- $level : int
-
Controls how invisible formatting characters are handled. 0: Allow valid formatting characters. Use for sanitizing text in posts. 1: Allow necessary formatting characters. Use for sanitizing usernames. 2: Disallow all formatting characters. Use for internal comparisions only, such as in the word censor, search contexts, etc.
- $substitute : string
-
Replacement string for the invalid characters.
Return values
string —The sanitized string.
fetch_web_data()
Get the contents of a URL, irrespective of allow_url_fopen.
fetch_web_data(string $url[, string $post_data = [] ][, bool $keep_alive = false ]) : string|false
- reads the contents of an http or ftp address and returns the page in a string
- will accept up to 3 page redirections (redirectio_level in the function call is private)
- if post_data is supplied, the value and length is posted to the given url as form data
- URL must be supplied in lowercase
Parameters
- $url : string
-
The URL
- $post_data : string = []
-
The data to post to the given URL
- $keep_alive : bool = false
-
Whether to send keepalive info
Return values
string|false —The fetched data or false on failure
fetch_alerts()
Fetch the alerts a member currently has.
fetch_alerts(int $memID[, mixed $to_fetch = false ][, array<string|int, mixed> $limit = 0 ][, array<string|int, mixed> $offset = 0 ][, bool $with_avatar = false ][, bool $show_links = false ]) : array<string|int, mixed>
Parameters
- $memID : int
-
The ID of the member.
- $to_fetch : mixed = false
-
Alerts to fetch: true/false for all/unread, or a list of one or more IDs.
- $limit : array<string|int, mixed> = 0
-
Maximum number of alerts to fetch (0 for no limit).
- $offset : array<string|int, mixed> = 0
-
Number of alerts to skip for pagination. Ignored if $to_fetch is a list of IDs.
- $with_avatar : bool = false
-
Whether to load the avatar of the alert sender.
- $show_links : bool = false
-
Whether to show links in the constituent parts of the alert meessage.
Return values
array<string|int, mixed> —An array of information about the fetched alerts.
alert_count()
Counts how many alerts a user has - either unread or all depending on $unread We can't use db_num_rows here, as we have to determine what boards the user can see Possibly in future versions as database support for json is mainstream, we can simplify this.
alert_count(int $memID[, bool $unread = false ]) : int
Parameters
- $memID : int
-
The user ID.
- $unread : bool = false
-
Whether to only count unread alerts.
Return values
int —The number of requested alerts
alert_mark()
Marks a group of alerts as un/read
alert_mark(array<string|int, mixed>|int $members, array<string|int, mixed>|int $to_mark, bool|int $read) : int
Parameters
- $members : array<string|int, mixed>|int
-
The user IDs.
- $to_mark : array<string|int, mixed>|int
- $read : bool|int
-
To mark as read or unread, 1 for read, 0 or any other value different than 1 for unread.
Return values
int —How many alerts remain unread
alert_delete()
Deletes a single or a group of alerts by ID
alert_delete(int|array<string|int, mixed> $ids[, int|array<string|int, mixed> $members = [] ]) : int|null
Parameters
- $ids : int|array<string|int, mixed>
- $members : int|array<string|int, mixed> = []
Return values
int|null —If the $memID param is set, returns the new amount of unread alerts.
alert_purge()
Deletes all the alerts that a user has already read.
alert_purge([int $memID = 0 ][, int $before = 0 ]) : void
Parameters
- $memID : int = 0
-
The user ID. Defaults to the current user's ID.
- $before : int = 0
automanage_attachments_check_directory()
Check if the current directory is still valid or not.
automanage_attachments_check_directory() : bool|null
If not creates the new directory
Return values
bool|null —False if any error occurred
automanage_attachments_create_directory()
Creates a directory
automanage_attachments_create_directory(string $updir) : bool
Parameters
- $updir : string
-
The directory to be created
Return values
bool —False on errors
automanage_attachments_by_space()
Called when a directory space limit is reached.
automanage_attachments_by_space() : bool|null
Creates a new directory and increments the directory suffix number.
Return values
bool|null —False on errors, true if successful, nothing if auto-management of attachments is disabled
processAttachments()
Moves an attachment to the proper directory and set the relevant data into $_SESSION['temp_attachments']
processAttachments() : void
attachmentChecks()
Performs various checks on an uploaded file.
attachmentChecks(int $attachID) : bool
- Requires that $_SESSION['temp_attachments'][$attachID] be properly populated.
Parameters
- $attachID : int
-
The ID of the attachment
Return values
bool —Whether the attachment is OK
createAttachment()
Create an attachment, with the given array of parameters.
createAttachment(array<string|int, mixed> &$attachmentOptions) : bool
- Adds any additional or missing parameters to $attachmentOptions.
- Renames the temporary file.
- Creates a thumbnail if the file is an image and the option enabled.
Parameters
- $attachmentOptions : array<string|int, mixed>
-
An array of attachment options
Return values
bool —Whether the attachment was created successfully
assignAttachments()
Assigns the given attachments to the given message ID.
assignAttachments([mixed $attachIDs = [] ][, mixed $msgID = 0 ]) : bool
Parameters
- $attachIDs : mixed = []
-
array of attachment IDs to assign.
- $msgID : mixed = 0
-
integer the message ID.
Return values
bool —false on error or missing params.
ApproveAttachments()
Approve an attachment, or maybe even more - no permission check!
ApproveAttachments(array<string|int, mixed> $attachments) : int|null
Parameters
- $attachments : array<string|int, mixed>
-
The IDs of the attachments to approve
Return values
int|null —Returns 0 if the operation failed, otherwise returns nothing
parseAttachBBC()
Gets an attach ID and tries to load all its info.
parseAttachBBC([int $attachID = 0 ]) : mixed
Parameters
- $attachID : int = 0
-
the attachment ID to load info from.
Return values
mixed —If succesful, it will return an array of loaded data. String, most likely a $txt key if there was some error.
getAttachMsgInfo()
Gets all needed message data associated with an attach ID
getAttachMsgInfo(int $attachID) : array<string|int, mixed>
Parameters
- $attachID : int
-
the attachment ID to load info from.
Return values
array<string|int, mixed>loadAttachmentContext()
This loads an attachment's contextual data including, most importantly, its size if it is an image.
loadAttachmentContext(int $id_msg, array<string|int, mixed> $attachments) : array<string|int, mixed>
It requires the view_attachments permission to calculate image size. It attempts to keep the "aspect ratio" of the posted image in line, even if it has to be resized by the max_image_width and max_image_height settings.
Parameters
- $id_msg : int
-
ID of the post to load attachments for
- $attachments : array<string|int, mixed>
-
An array of already loaded attachments. This function no longer depends on having $topic declared, thus, you need to load the actual topic ID for each attachment.
Return values
array<string|int, mixed> —An array of attachment info
prepareAttachsByMsg()
prepare the Attachment api for all messages
prepareAttachsByMsg(array<string|int, mixed> $msgIDs) : void
Parameters
- $msgIDs : array<string|int, mixed>
getAttachmentFilename()
Backward compatibility only.
getAttachmentFilename(string $filename, int $attachment_id[, string|null $dir = null ][, bool $new = false ][, string $file_hash = '' ]) : string
New code should use Attachment::getFilePath() or Attachment::createHash() to get whichever type of output is desired for a given situation.
Get an attachment's encrypted filename. If $new is true, won't check for file existence.
This currently returns the hash if new, and the full filename otherwise, which is very messy. And of course everything that calls this function relies on that behavior and works around it. :P
Parameters
- $filename : string
-
The name of the file. (Ignored.)
- $attachment_id : int
-
The ID of the attachment.
- $dir : string|null = null
-
Which directory it should be in. (Ignored.)
- $new : bool = false
-
Whether this is a new attachment.
- $file_hash : string = ''
-
The file hash. (Ignored.)
Return values
string —A hash or the path to the file.
get_signature_allowed_bbc_tags()
Return an array with allowed bbc tags for signatures, that can be passed to parse_bbc().
get_signature_allowed_bbc_tags() : array<string|int, mixed>
Return values
array<string|int, mixed> —An array containing allowed tags for signatures, or an empty array if all tags are allowed.
highlight_php_code()
Highlight any code.
highlight_php_code(string $code) : string
Uses PHP's highlight_string() to highlight PHP syntax does special handling to keep the tabs in the code available. used to parse PHP code from inside [code] and [php] tags.
Parameters
- $code : string
-
The code
Return values
string —The code with highlighted HTML.
parse_bbc()
Parse bulletin board code in a string, as well as smileys optionally.
parse_bbc(string|bool $message[, bool $smileys = true ][, string $cache_id = '' ][, array<string|int, mixed> $parse_tags = [] ]) : string
- only parses bbc tags which are not disabled in disabledBBC.
- handles basic HTML, if enablePostHTML is on.
- caches the from/to replace regular expressions so as not to reload them every time a string is parsed.
- only parses smileys if smileys is true.
- does nothing if the enableBBC setting is off.
- uses the cache_id as a unique identifier to facilitate any caching it may do.
- returns the modified message.
Parameters
- $message : string|bool
-
The message. When a empty string, nothing is done. When false we provide a list of BBC codes available. When a string, the message is parsed and bbc handled.
- $smileys : bool = true
-
Whether to parse smileys as well
- $cache_id : string = ''
-
The cache ID
- $parse_tags : array<string|int, mixed> = []
-
If set, only parses these tags rather than all of them
Return values
string —The parsed message
parseSmileys()
Parse smileys in the passed message.
parseSmileys(string &$message) : void
The smiley parsing function which makes pretty faces appear :). If custom smiley sets are turned off by smiley_enable, the default set of smileys will be used. These are specifically not parsed in code tags [url=mailto:Dad@blah.com] Caches the smileys from the database or array in memory. Doesn't return anything, but rather modifies message directly.
Parameters
- $message : string
-
The message to parse smileys in
html_to_bbc()
Converts HTML to BBC As of SMF 2.1, only used by ManageBoards.php (and possibly mods)
html_to_bbc(string $string) : string
Parameters
- $string : string
Return values
string —The text with html converted to bbc
loadBoard()
Check for moderators and see if they have access to the board.
loadBoard() : array<string|int, mixed>
What it does:
- sets up the $board_info array for current board information.
- if cache is enabled, the $board_info array is stored in cache.
- redirects to appropriate post if only message id is requested.
- is only used when inside a topic or board.
- determines the local moderators for the board.
- adds group id 3 if the user is a local moderator for the board they are in.
- prevents access if user is not in proper group nor a local moderator of the board.
Return values
array<string|int, mixed>markBoardsRead()
Mark a board or multiple boards read.
markBoardsRead(int|array<string|int, mixed> $boards[, bool $unread = false ]) : void
Parameters
- $boards : int|array<string|int, mixed>
-
The ID of a single board or an array of boards
- $unread : bool = false
-
Whether we're marking them as unread
getMsgMemberID()
Get the id_member associated with the specified message.
getMsgMemberID(int $messageID) : int
Parameters
- $messageID : int
-
The ID of the message
Return values
int —The ID of the member associated with that post
modifyBoard()
Modify the settings and position of a board.
modifyBoard(int $board_id, array<string|int, mixed> &$boardOptions) : void
Used by ManageBoards.php to change the settings of a board.
Parameters
- $board_id : int
-
The ID of the board
- $boardOptions : array<string|int, mixed>
-
An array of options related to the board
createBoard()
Create a new board and set its properties and position.
createBoard(array<string|int, mixed> $boardOptions) : int
Allows (almost) the same options as the modifyBoard() function. With the option inherit_permissions set, the parent board permissions will be inherited.
Parameters
- $boardOptions : array<string|int, mixed>
-
An array of information for the new board
Return values
int —The ID of the new board
deleteBoards()
Remove one or more boards.
deleteBoards(array<string|int, mixed> $boards_to_remove[, int $moveChildrenTo = null ]) : void
Allows to move the children of the board before deleting it if moveChildrenTo is set to null, the child boards will be deleted. Deletes:
- all topics that are on the given boards;
- all information that's associated with the given boards; updates the statistics to reflect the new situation.
Parameters
- $boards_to_remove : array<string|int, mixed>
-
The boards to remove
- $moveChildrenTo : int = null
-
The ID of the board to move the child boards to (null to remove the child boards, 0 to make them a top-level board)
reorderBoards()
Put all boards in the right order and sorts the records of the boards table.
reorderBoards() : void
Used by modifyBoard(), deleteBoards(), modifyCategory(), and deleteCategories() functions
fixChildren()
Fixes the children of a board by setting their child_levels to new values.
fixChildren(int $parent, int $newLevel, int $newParent) : void
Used when a board is deleted or moved, to affect its children.
Parameters
- $parent : int
-
The ID of the parent board
- $newLevel : int
-
The new child level for each of the child boards
- $newParent : int
-
The ID of the new parent board
sortBoards()
Takes a board array and sorts it
sortBoards(array<string|int, mixed> &$boards) : void
Parameters
- $boards : array<string|int, mixed>
-
The boards
getBoardModerators()
Returns the given board's moderators, with their names and links
getBoardModerators(array<string|int, mixed> $boards) : array<string|int, mixed>
Parameters
- $boards : array<string|int, mixed>
-
The boards to get moderators of
Return values
array<string|int, mixed> —An array containing information about the moderators of each board
getBoardModeratorGroups()
Returns board's moderator groups with their names and link
getBoardModeratorGroups(array<string|int, mixed> $boards) : array<string|int, mixed>
Parameters
- $boards : array<string|int, mixed>
-
The boards to get moderator groups of
Return values
array<string|int, mixed> —An array containing information about the groups assigned to moderate each board
isChildOf()
Returns whether the child board id is actually a child of the parent (recursive).
isChildOf(int $child, int $parent) : bool
Parameters
- $child : int
-
The ID of the child board
- $parent : int
-
The ID of a parent board
Return values
bool —Whether the specified child board is actually a child of the specified parent board.
getBoardParents()
Get all parent boards (requires first parent as parameter) It finds all the parents of id_parent, and that board itself.
getBoardParents(int $id_parent) : array<string|int, mixed>
Additionally, it detects the moderators of said boards.
Parameters
- $id_parent : int
-
The ID of the parent board
Return values
array<string|int, mixed> —An array of information about the boards found.
detectBrowser()
Loads information about what browser the user is viewing with and places it in $context - uses the class from {@link Class-BrowserDetect.php}
detectBrowser() : void
isBrowser()
Are we using this browser?
isBrowser(string $browser) : bool
Wrapper function for detectBrowser
Parameters
- $browser : string
-
The browser we are checking for.
Return values
bool —Whether or not the current browser is what we're looking for
modifyCategory()
Edit the position and properties of a category.
modifyCategory(int $category_id, array<string|int, mixed> $catOptions) : void
general function to modify the settings and position of a category. used by ManageBoards.php to change the settings of a category.
Parameters
- $category_id : int
-
The ID of the category
- $catOptions : array<string|int, mixed>
-
An array containing data and options related to the category
createCategory()
Create a new category.
createCategory(array<string|int, mixed> $catOptions) : mixed
general function to create a new category and set its position. allows (almost) the same options as the modifyCat() function. returns the ID of the newly created category.
Parameters
- $catOptions : array<string|int, mixed>
-
An array of data and settings related to the new category. Should have at least 'cat_name' and can also have 'cat_desc', 'move_after' and 'is_collapsable'
deleteCategories()
Remove one or more categories.
deleteCategories(array<string|int, mixed> $categories[, int $moveBoardsTo = null ]) : void
general function to delete one or more categories. allows to move all boards in the categories to a different category before deleting them. if moveChildrenTo is set to null, all boards inside the given categories will be deleted. deletes all information that's associated with the given categories. updates the statistics to reflect the new situation.
Parameters
- $categories : array<string|int, mixed>
-
The IDs of the categories to delete
- $moveBoardsTo : int = null
-
The ID of the category to move any boards to or null to delete the boards
sortCategories()
Takes a category array and sorts it
sortCategories(array<string|int, mixed> &$categories) : void
Parameters
- $categories : array<string|int, mixed>
-
The categories
getTreeOrder()
Tries to load up the entire board order and category very very quickly Returns an array with two elements, cats and boards
getTreeOrder() : array<string|int, mixed>
Return values
array<string|int, mixed> —An array of categories and boards
getBoardTree()
Load a lot of useful information regarding the boards and categories.
getBoardTree() : void
The information retrieved is stored in globals: $boards properties of each board. $boardList a list of boards grouped by category ID. $cat_tree properties of each category.
recursiveBoards()
Recursively get a list of boards.
recursiveBoards(mixed &$list, mixed &$tree) : void
Used by getBoardTree
Parameters
- $list : mixed
- $tree : mixed
setLoginCookie()
Sets the SMF-style login cookie and session based on the id_member and password passed.
setLoginCookie(int $cookie_length, int $id[, string $password = '' ]) : void
- password should be already encrypted with the cookie salt.
- logs the user out if id_member is zero.
- sets the cookie and session to last the number of seconds specified by cookie_length, or ends them if cookie_length is less than 0.
- when logging out, if the globalCookies setting is enabled, attempts to clear the subdomain's cookie too.
Parameters
- $cookie_length : int
-
How many seconds the cookie should last. If negative, forces logout.
- $id : int
-
The ID of the member to set the cookie for
- $password : string = ''
-
The hashed password
setTFACookie()
Sets Two Factor Auth cookie
setTFACookie(int $cookie_length, int $id, string $secret) : void
Parameters
- $cookie_length : int
-
How long the cookie should last, in seconds
- $id : int
-
The ID of the member
- $secret : string
-
Should be a salted secret using hash_salt
url_parts()
Get the domain and path for the cookie - normally, local and global should be the localCookies and globalCookies settings, respectively.
url_parts(bool $local, bool $global) : array<string|int, mixed>
- uses boardurl to determine these two things.
Parameters
- $local : bool
-
Whether we want local cookies
- $global : bool
-
Whether we want global cookies
Return values
array<string|int, mixed> —An array to set the cookie on with domain and path in it, in that order
hash_salt()
Hashes password with salt and authentication secret. This is solely used for cookies.
hash_salt(string $password, string $salt) : string
Parameters
- $password : string
-
The password
- $salt : string
-
The salt
Return values
string —The hashed password
smf_setcookie()
A wrapper for setcookie that gives integration hook access to it
smf_setcookie(string $name[, string $value = '' ][, int $expires = 0 ][, string $path = '' ][, string $domain = '' ][, bool|null $secure = null ][, bool $httponly = true ][, string|null $samesite = null ]) : void
Parameters
- $name : string
- $value : string = ''
-
= ''
- $expires : int = 0
-
= 0
- $path : string = ''
-
= ''
- $domain : string = ''
-
= ''
- $secure : bool|null = null
-
= null
- $httponly : bool = true
-
= true
- $samesite : string|null = null
-
= null
DeleteDraft()
Deletes one or many drafts from the DB Validates the drafts are from the user is supplied an array of drafts will attempt to remove all of them
DeleteDraft(int $id_draft[, bool $check = true ]) : bool
Parameters
- $id_draft : int
-
The ID of the draft to delete
- $check : bool = true
-
Whether or not to check that the draft belongs to the current user
Return values
bool —False if it couldn't be deleted (doesn't return anything otherwise)
ShowDrafts()
Loads in a group of drafts for the user of a given type (0/posts, 1/pm's) loads a specific draft for forum use if selected.
ShowDrafts(int $member_id[, bool|inr $reply_to = 0 ][, int $draft_type = 0 ]) : bool
Used in the posting screens to allow draft selection Will load a draft if selected is supplied via post
Parameters
- $member_id : int
-
ID of the member to show drafts for.
- $reply_to : bool|inr = 0
-
ID of the topic or PM being replied to.
- $draft_type : int = 0
-
The type of drafts to show: 0 = post, 1 = PM.
Return values
bool —False if the drafts couldn't be loaded, nothing otherwise
showProfileDrafts()
Show all drafts of a given type by the current user Uses the showdraft template Allows for the deleting and loading/editing of drafts
showProfileDrafts(int $memID[, int $draft_type = 0 ]) : void
Parameters
- $memID : int
- $draft_type : int = 0
create_control_richedit()
Creates a box that can be used for richedit stuff like BBC, Smileys etc.
create_control_richedit(array<string|int, mixed> $options) : Editor
Parameters
- $options : array<string|int, mixed>
Return values
EditorgetMessageIcons()
Retrieves a list of message icons.
getMessageIcons(int $board_id) : array<string|int, mixed>
- Based on the settings, the array will either contain a list of default message icons or a list of custom message icons retrieved from the database.
- The board_id is needed for the custom message icons (which can be set for each board individually).
Parameters
- $board_id : int
-
The ID of the board
Return values
array<string|int, mixed> —An array of info about available icons
smf_error_handler()
Handler for standard error messages, standard PHP error handler replacement.
smf_error_handler(int $error_level, string $error_string, string $file, int $line) : void
It dies with fatal_error() if the error_level matches with error_reporting.
Parameters
log_error()
Log an error, if the error logging is enabled.
log_error(string $error_message[, string|bool $error_type = 'general' ][, string $file = '' ][, int $line = 0 ]) : string
filename and line should be FILE and LINE, respectively. Example use: die(log_error($msg));
Parameters
- $error_message : string
-
The message to log
- $error_type : string|bool = 'general'
-
The type of error
- $file : string = ''
-
The name of the file where this error occurred
- $line : int = 0
-
The line where the error occurred
Return values
string —The message that was logged
fatal_error()
An irrecoverable error. This function stops execution and displays an error message.
fatal_error(string $error[, string|bool $log = 'general' ][, int $status = 500 ]) : void
It logs the error message if $log is specified.
Parameters
- $error : string
-
The error message
- $log : string|bool = 'general'
-
= 'general' What type of error to log this as (false to not log it))
- $status : int = 500
-
The HTTP status code associated with this error
fatal_lang_error()
Shows a fatal error with a message stored in the language file.
fatal_lang_error(string $error[, string|false $log = 'general' ][, array<string|int, mixed> $sprintf = [] ][, int $status = 403 ]) : mixed
This function stops execution and displays an error message by key.
- uses the string with the error_message_key key.
- logs the error in the forum's default language while displaying the error message in the user's language.
- uses Errors language file and applies the $sprintf information if specified.
- the information is logged if log is specified.
Parameters
- $error : string
-
The error message
- $log : string|false = 'general'
-
The type of error, or false to not log it
- $sprintf : array<string|int, mixed> = []
-
An array of data to be sprintf()'d into the specified message
- $status : int = 403
-
= false The HTTP status code associated with this error
display_maintenance_message()
Show a message for the (full block) maintenance mode.
display_maintenance_message() : void
It shows a complete page independent of language files or themes. It is used only if $maintenance = 2 in Settings.php. It stops further execution of the script.
display_db_error()
Show an error message for the connection problems.
display_db_error() : void
It shows a complete page independent of language files or themes. It is used only if there's no way to connect to the database. It stops further execution of the script.
display_loadavg_error()
Show an error message for load average blocking problems.
display_loadavg_error() : void
It shows a complete page independent of language files or themes. It is used only if the load averages are too high to continue execution. It stops further execution of the script.
insertEvent()
Consolidating the various INSERT statements into this function.
insertEvent(array<string|int, mixed> $eventOptions) : void
Inserts the passed event information into the calendar table. Allows to either set a time span (in days) or an end_date. Does not check any permissions of any sort.
Parameters
- $eventOptions : array<string|int, mixed>
-
An array of event options ('title', 'span', 'start_date', 'end_date', etc.)
modifyEvent()
modifies an event.
modifyEvent(int $event_id, array<string|int, mixed> &$eventOptions) : void
allows to either set a time span (in days) or an end_date. does not check any permissions of any sort.
Parameters
- $event_id : int
-
The ID of the event
- $eventOptions : array<string|int, mixed>
-
An array of event information
removeEvent()
Remove an event removes an event.
removeEvent(int $event_id) : void
does no permission checks.
Parameters
- $event_id : int
-
The ID of the event to remove
cache_getMembergroupList()
Retrieve a list of (visible) membergroups used by the cache.
cache_getMembergroupList() : array<string|int, mixed>
Return values
array<string|int, mixed> —An array of information about the cache
call_integration_hook()
Process functions of an integration hook.
call_integration_hook(string $name[, array<string|int, mixed> $parameters = [] ]) : array<string|int, mixed>
calls all functions of the given hook. supports static class method calls.
Parameters
- $name : string
-
The hook name
- $parameters : array<string|int, mixed> = []
-
An array of parameters this hook implements
Return values
array<string|int, mixed> —The results of the functions
add_integration_function()
Add a function for integration hook.
add_integration_function(string $name, string $function[, bool $permanent = true ][, string $file = '' ][, bool $object = false ]) : void
Does nothing if the function is already added. Cleans up enabled/disabled variants before taking requested action.
Parameters
- $name : string
-
The complete hook name.
- $function : string
-
The function name. Can be a call to a method via Class::method.
- $permanent : bool = true
-
If true, updates the value in settings table.
- $file : string = ''
-
The file. Must include one of the following wildcards: $boarddir, $sourcedir, $themedir, example: $sourcedir/Test.php
- $object : bool = false
-
Indicates if your class will be instantiated when its respective hook is called. If true, your function must be a method.
remove_integration_function()
Remove an integration hook function.
remove_integration_function(string $name, string $function[, bool $permanent = true ][, string $file = '' ][, bool $object = false ]) : void
Removes the given function from the given hook. Does nothing if the function is not available. Cleans up enabled/disabled variants before taking requested action.
Parameters
- $name : string
-
The complete hook name.
- $function : string
-
The function name. Can be a call to a method via Class::method.
- $permanent : bool = true
-
Irrelevant for the function itself but need to declare it to match
- $file : string = ''
-
The filename. Must include one of the following wildcards: $boarddir, $sourcedir, $themedir, example: $sourcedir/Test.php
- $object : bool = false
-
Indicates if your class will be instantiated when its respective hook is called. If true, your function must be a method.
Tags
ip2range()
Convert a single IP to a ranged IP.
ip2range(string $addr) : array<string|int, mixed>
internal function used to convert a user-readable format to a format suitable for the database.
Parameters
- $addr : string
Return values
array<string|int, mixed> —An array of IP parts
range2ip()
Convert a range of given IP number into a single string.
range2ip(array<string|int, mixed> $low, array<string|int, mixed> $high) : string
It's practically the reverse function of ip2range().
Parameters
- $low : array<string|int, mixed>
-
The low end of the range in IPv4 format
- $high : array<string|int, mixed>
-
The high end of the range in IPv4 format
Tags
Return values
string —A string indicating the range
isValidIP()
Check the given String if he is a valid IPv4 or IPv6 return true or false
isValidIP(string $ip) : bool
Parameters
- $ip : string
Return values
boolisValidIPv6()
Validates a IPv6 address. returns true if it is ipv6.
isValidIPv6(string $ip) : bool
Parameters
- $ip : string
-
The ip address to be validated
Return values
bool —Whether the specified IP is a valid IPv6 address
host_from_ip()
Lookup an IP; try shell_exec first because we can do a timeout on it.
host_from_ip(string $ip) : string
Parameters
- $ip : string
-
The IP to get the hostname from
Return values
string —The hostname
inet_ptod()
Converts an IP address into binary
inet_ptod(string $ip) : string|false
Parameters
- $ip : string
Return values
string|false —The IP address in binary or false
inet_dtop()
Converts a binary version of an IP address into a readable format
inet_dtop(string $ip) : string|false
Parameters
- $ip : string
Return values
string|false —The IP address in presentation format or false on error
expandIPv6()
Expands a IPv6 address to its full form.
expandIPv6(string $ip[, bool $return_bool_if_invalid = true ]) : string|bool
Parameters
- $ip : string
- $return_bool_if_invalid : bool = true
Return values
string|bool —The expanded IPv6 address or false if $strict_check is true and the result isn't valid
matchIPtoCIDR()
Detect if a IP is in a CIDR address - returns true or false
matchIPtoCIDR(string $ip_address, string $cidr_address) : bool
Parameters
- $ip_address : string
-
IP address to check
- $cidr_address : string
-
CIDR address to verify
Return values
bool —Whether the IP matches the CIDR
createList()
Create a new list
createList(array<string|int, mixed> $options) : ItemList
Parameters
- $options : array<string|int, mixed>
Return values
ItemListloadLanguage()
Load a language file. Tries the current and default themes as well as the user and global languages.
loadLanguage(string $template_name[, string $lang = '' ][, bool $fatal = true ][, bool $force_reload = false ]) : string
Parameters
- $template_name : string
-
The name of a template file
- $lang : string = ''
-
A specific language to load this file from
- $fatal : bool = true
-
Whether to die with an error if it can't be loaded
- $force_reload : bool = false
-
Whether to load the file again if it's already loaded
Return values
string —The language actually loaded.
getLanguages()
Attempt to reload our known languages.
getLanguages([bool $use_cache = true ]) : array<string|int, mixed>
It will try to choose only utf8 or non-utf8 languages.
Parameters
- $use_cache : bool = true
-
Whether or not to use the cache
Return values
array<string|int, mixed> —An array of information about available languages
censorText()
Replace all vulgar words with respective proper words. (substring or whole words..) What this function does: - it censors the passed string.
censorText(string &$text[, bool $force = false ]) : string
- if the theme setting allow_no_censored is on, and the theme option show_no_censored is enabled, does not censor, unless force is also set.
- it caches the list of censored words to reduce parsing.
Parameters
- $text : string
-
The text to censor
- $force : bool = false
-
Whether to censor the text regardless of settings
Return values
string —The censored text
tokenTxtReplace()
tokenTxtReplace([string $string = '' ]) : string
Parameters
- $string : string = ''
Return values
stringsentence_list()
Concatenates an array of strings into a grammatically correct sentence list
sentence_list(array<string|int, mixed> $list) : string
Uses formats defined in the language files to build the list appropropriately for the currently loaded language.
Parameters
- $list : array<string|int, mixed>
-
An array of strings to concatenate.
Return values
string —The localized sentence list.
comma_format()
- Formats a number.
comma_format(float $number[, int|null $decimals = null ]) : string
- uses the format of number_format to decide how to format the number. for example, it might display "1 234,50".
- caches the formatting data from the setting for optimization.
Parameters
- $number : float
-
A number
- $decimals : int|null = null
Return values
string —A formatted number
writeLog()
Put this user in the online log.
writeLog([bool $force = false ]) : void
Parameters
- $force : bool = false
-
Whether to force logging the data
logAction()
This function logs an action to the database. It is a thin wrapper around {@link logActions()}.
logAction(string $action[, array<string|int, mixed> $extra = [] ][, string $log_type = 'moderate' ]) : int
Parameters
- $action : string
-
A code for the report; a list of such strings can be found in Modlog.{language}.php (modlog_ac_ strings)
- $extra : array<string|int, mixed> = []
-
An associated array of parameters for the item being logged. Typically this will include 'topic' for the topic's id.
- $log_type : string = 'moderate'
-
A string reflecting the type of log.
Tags
Return values
int —The ID of the row containing the logged data
logActions()
Log changes to the forum, such as moderation events or administrative changes. This behaves just like {@link logAction()} in SMF 2.0, except that it is designed to log multiple actions at once.
logActions(array<string|int, mixed> $logs) : int
SMF uses three log types:
user
for actions executed that aren't related to moderation (e.g. signature or other changes from the profile);moderate
for moderation actions (e.g. topic changes);admin
for administrative actions.
Parameters
- $logs : array<string|int, mixed>
-
An array of log data
Return values
int —The last logged ID
updateStats()
Update some basic statistics.
updateStats(string $type[, mixed $parameter1 = null ][, mixed $parameter2 = null ]) : void
'member' statistic updates the latest member, the total member count, and the number of unapproved members. 'member' also only counts approved members when approval is on, but is much more efficient with it off.
'message' changes the total number of messages, and the highest message id by id_msg - which can be parameters 1 and 2, respectively.
'topic' updates the total number of topics, or if parameter1 is true simply increments them.
'subject' updates the log_search_subjects in the event of a topic being moved, removed or split. parameter1 is the topicid, parameter2 is the new subject
'postgroups' case updates those members who match condition's post-based membergroups in the database (restricted by parameter1).
Parameters
- $type : string
-
Stat type - can be 'member', 'message', 'topic', 'subject' or 'postgroups'
- $parameter1 : mixed = null
-
A parameter for updating the stats
- $parameter2 : mixed = null
-
A 2nd parameter for updating the stats
trackStats()
Track Statistics.
trackStats([array<string|int, mixed> $stats = [] ]) : bool
Caches statistics changes, and flushes them if you pass nothing. If '+' is used as a value, it will be incremented. It does not actually commit the changes until the end of the page view. It depends on the trackStats setting.
Parameters
- $stats : array<string|int, mixed> = []
-
An array of data
Return values
bool —Whether or not the info was updated successfully
trackStatsUsersOnline()
Check if the number of users online is a record and store it.
trackStatsUsersOnline(int $total_users_online) : void
Parameters
- $total_users_online : int
-
The total number of members online
getMembersOnlineStats()
Retrieve a list and several other statistics of the users currently online.
getMembersOnlineStats(array<string|int, mixed> $membersOnlineOptions) : array<string|int, mixed>
Used by the board index and SSI. Also returns the membergroups of the users that are currently online. (optionally) hides members that chose to hide their online presence.
Parameters
- $membersOnlineOptions : array<string|int, mixed>
-
An array of options for the list
Return values
array<string|int, mixed> —An array of information about the online users
displayDebug()
This function shows the debug information tracked when $db_show_debug = true in Settings.php
displayDebug() : void
sendMail()
This function sends an email to the specified recipient(s).
sendMail(array<string|int, mixed> $to, string $subject, string $message[, string $from = null ][, string $message_id = null ][, bool $send_html = false ][, int $priority = 3 ][, bool $hotmail_fix = null ][, bool $is_private = false ]) : bool
It uses the mail_type settings and webmaster_email variable.
Parameters
- $to : array<string|int, mixed>
-
The email(s) to send to
- $subject : string
-
Email subject, expected to have entities, and slashes, but not be parsed
- $message : string
-
Email body, expected to have slashes, no htmlentities
- $from : string = null
-
The address to use for replies
- $message_id : string = null
-
If specified, it will be used as local part of the Message-ID header.
- $send_html : bool = false
-
Whether or not the message is HTML vs. plain text
- $priority : int = 3
-
The priority of the message
- $hotmail_fix : bool = null
-
Whether to apply the "hotmail fix"
- $is_private : bool = false
-
Whether this is private
Return values
bool —Whether ot not the email was sent properly.
AddMailQueue()
Add an email to the mail queue.
AddMailQueue([bool $flush = false ][, array<string|int, mixed> $to_array = [] ][, string $subject = '' ][, string $message = '' ][, string $headers = '' ][, bool $send_html = false ][, int $priority = 3 ][, bool $is_private = false ]) : bool
Parameters
- $flush : bool = false
-
Whether to flush the queue
- $to_array : array<string|int, mixed> = []
-
An array of recipients
- $subject : string = ''
-
The subject of the message
- $message : string = ''
-
The message
- $headers : string = ''
-
The headers
- $send_html : bool = false
-
Whether to send in HTML format
- $priority : int = 3
-
The priority
- $is_private : bool = false
-
Whether this is private
Return values
bool —Whether the message was added
reduceQueue()
reduceQueue([bool|int $number = false ][, bool $override_limit = false ][, bool $force_send = false ]) : bool
Parameters
- $number : bool|int = false
- $override_limit : bool = false
- $force_send : bool = false
Return values
boolmimespecialchars()
Prepare text strings for sending as email body or header.
mimespecialchars(string $string[, bool $with_charset = true ][, bool $hotmail_fix = false ][, string $line_break = "
" ][, string $custom_charset = null ]) : array<string|int, mixed>
In case there are higher ASCII characters in the given string, this function will attempt the transport method 'quoted-printable'. Otherwise the transport method '7bit' is used.
Parameters
- $string : string
-
The string
- $with_charset : bool = true
-
Whether we're specifying a charset ($custom_charset must be set here)
- $hotmail_fix : bool = false
-
Whether to apply the hotmail fix (all higher ASCII characters are converted to HTML entities to assure proper display of the mail)
- $line_break : string = " "
-
The linebreak
- $custom_charset : string = null
-
If set, it uses this character set
Return values
array<string|int, mixed> —An array containing the character set, the converted string and the transport method.
serverParse()
serverParse(string $message, mixed $socket, string $code[, string|null &$response = null ]) : bool
Parameters
- $message : string
- $socket : mixed
- $code : string
- $response : string|null = null
Return values
boolsendNotifications()
Sends a notification to members who have elected to receive emails when things happen to a topic, such as replies are posted.
sendNotifications(array<string|int, mixed> $topics, string $type[, array<string|int, mixed> $exclude = [] ][, array<string|int, mixed> $members_only = [] ]) : mixed
The function automatically finds the subject and its board, and checks permissions for each member who is "signed up" for notifications. It will not send 'reply' notifications more than once in a row. Uses Post language file
Parameters
- $topics : array<string|int, mixed>
-
Represents the topics the action is happening to.
- $type : string
-
Can be any of reply, sticky, lock, unlock, remove, move, merge, and split. An appropriate message will be sent for each.
- $exclude : array<string|int, mixed> = []
-
Members in the exclude array will not be processed for the topic with the same key.
- $members_only : array<string|int, mixed> = []
-
Are the only ones that will be sent the notification if they have it on.
adminNotify()
This simple function gets a list of all administrators and sends them an email to let them know a new member has joined.
adminNotify(string $type, int $memberID[, string $member_name = null ]) : void
Called by registerMember() function in Subs-Members.php. Email is sent to all groups that have the moderate_forum permission. The language set by each member is being used (if available). Uses the Login language file
Parameters
- $type : string
-
The type. Types supported are 'approval', 'activation', and 'standard'.
- $memberID : int
-
The ID of the member
- $member_name : string = null
-
The name of the member (if null, it is pulled from the database)
loadEmailTemplate()
Load a template from EmailTemplates language file.
loadEmailTemplate(string $template[, array<string|int, mixed> $replacements = [] ][, string $lang = '' ][, bool $loadLang = true ]) : array<string|int, mixed>
Parameters
- $template : string
-
The name of the template to load
- $replacements : array<string|int, mixed> = []
-
An array of replacements for the variables in the template
- $lang : string = ''
-
The language to use, if different than the user's current language
- $loadLang : bool = true
-
Whether to load the language file first
Return values
array<string|int, mixed> —An array containing the subject and body of the email template, with replacements made
createMenu()
Create a menu.
createMenu(array<string|int, mixed> $data[, array<string|int, mixed> $options = [] ]) : bool|array<string|int, mixed>
Parameters
- $data : array<string|int, mixed>
- $options : array<string|int, mixed> = []
Return values
bool|array<string|int, mixed> —False if nothing to show or an array of info about the selected menu item
destroyMenu()
Delete a menu.
destroyMenu([int|string $id = 'last' ]) : bool|void
Parameters
- $id : int|string = 'last'
Return values
bool|void —False if the menu doesn't exist, nothing otherwise
preparsecode()
Takes a message and parses it, returning nothing.
preparsecode(string &$message[, bool $previewing = false ]) : void
Cleans up links (javascript, etc.) and code/quote sections. Won't convert \n's and a few other things if previewing is true.
Parameters
- $message : string
-
The mesasge
- $previewing : bool = false
-
Whether we're previewing
un_preparsecode()
This is very simple, and just removes things done by preparsecode.
un_preparsecode(string $message) : string
Parameters
- $message : string
-
The message
Return values
stringfixTags()
Fix any URLs posted - ie. remove 'javascript:'.
fixTags(string &$message) : void
Used by preparsecode, fixes links in message and returns nothing.
Parameters
- $message : string
-
The message
fixTag()
Fix a specific class of tag - ie. url with =.
fixTag(string &$message, string $myTag, string $protocols[, bool $embeddedUrl = false ][, bool $hasEqualSign = false ][, bool $hasExtra = false ]) : void
Used by fixTags, fixes a specific tag's links.
Parameters
- $message : string
-
The message
- $myTag : string
-
The tag
- $protocols : string
-
The protocols
- $embeddedUrl : bool = false
-
Whether it can be set to something
- $hasEqualSign : bool = false
-
Whether it is set to something
- $hasExtra : bool = false
-
Whether it can have extra cruft after the begin tag.
createPost()
Create a post, either as new topic (id_topic = 0) or in an existing one.
createPost(array<string|int, mixed> &$msgOptions, array<string|int, mixed> &$topicOptions, array<string|int, mixed> &$posterOptions) : bool
The input parameters of this function assume:
- Strings have been escaped.
- Integers have been cast to integer.
- Mandatory parameters are set.
Parameters
- $msgOptions : array<string|int, mixed>
-
An array of information/options for the post
- $topicOptions : array<string|int, mixed>
-
An array of information/options for the topic
- $posterOptions : array<string|int, mixed>
-
An array of information/options for the poster
Return values
bool —Whether the operation was a success
modifyPost()
Modifying a post.
modifyPost(array<string|int, mixed> &$msgOptions, array<string|int, mixed> &$topicOptions, array<string|int, mixed> &$posterOptions) : bool
..
Parameters
- $msgOptions : array<string|int, mixed>
-
An array of information/options for the post
- $topicOptions : array<string|int, mixed>
-
An array of information/options for the topic
- $posterOptions : array<string|int, mixed>
-
An array of information/options for the poster
Return values
bool —Whether the post was modified successfully
approvePosts()
Approve (or not) some posts... without permission checks.
approvePosts(array<string|int, mixed> $msgs[, bool $approve = true ][, bool $notify = true ]) : bool
..
Parameters
- $msgs : array<string|int, mixed>
-
Array of message ids
- $approve : bool = true
-
Whether to approve the posts (if false, posts are unapproved)
- $notify : bool = true
-
Whether to notify users
Return values
bool —Whether the operation was successful
clearApprovalAlerts()
Upon approval, clear unread alerts.
clearApprovalAlerts(array<string|int, int> $content_ids, string $content_action) : void
Parameters
- $content_ids : array<string|int, int>
-
either id_msgs or id_topics
- $content_action : string
-
will be either 'unapproved_post' or 'unapproved_topic'
updateLastMessages()
Takes an array of board IDs and updates their last messages.
updateLastMessages(array<string|int, mixed> $setboards[, int $id_msg = 0 ]) : bool|null
If the board has a parent, that parent board is also automatically updated. The columns updated are id_last_msg and last_updated. Note that id_last_msg should always be updated using this function, and is not automatically updated upon other changes.
Parameters
- $setboards : array<string|int, mixed>
-
An array of board IDs
- $id_msg : int = 0
-
The ID of the message
Return values
bool|null —Returns false if $setboards is empty for some reason
removeMessage()
Remove a specific message (including permission checks).
removeMessage(int $message[, bool $decreasePostCount = true ]) : bool
Parameters
- $message : int
-
The message id
- $decreasePostCount : bool = true
-
Whether to decrease users' post counts
Return values
bool —Whether the operation succeeded
constructPageIndex()
Constructs a page list.
constructPageIndex(string $base_url, int &$start, int $num_items, int $num_per_page[, bool $short_format = false ][, bool $show_prevnext = true ]) : string
- builds the page list, e.g. 1 ... 6 7 [8] 9 10 ... 15.
- flexible_start causes it to use "url.page" instead of "url;start=page".
- very importantly, cleans up the start value passed, and forces it to be a multiple of num_per_page.
- checks that start is not more than max_value.
- base_url should be the URL without any start parameter on it.
- uses the compactTopicPagesEnable and compactTopicPagesContiguous settings to decide how to display the menu.
an example is available near the function definition. $pageindex = constructPageIndex($scripturl . '?board=' . $board, $_REQUEST['start'], $num_messages, $maxindex, true);
Parameters
- $base_url : string
-
The basic URL to be used for each link.
- $start : int
-
The start position, by reference. If this is not a multiple of the number of items per page, it is sanitized to be so and the value will persist upon the function's return.
- $num_items : int
-
The total number of items you are paginating for.
- $num_per_page : int
-
The number of items to be displayed on a given page. $start will be forced to be a multiple of this value.
- $short_format : bool = false
-
Whether a ;start=x component should be introduced into the URL automatically (see above)
- $show_prevnext : bool = true
-
Whether the Previous and Next links should be shown (should be on only when navigating the list)
Return values
string —The complete HTML of the page index that was requested, formatted by the template.
Vote()
Allow the user to vote.
Vote() : void
It is called to register a vote in a poll. Must be called with a topic and option specified. Requires the poll_vote permission. Upon successful completion of action will direct user back to topic. Accessed via ?action=vote.
Uses Post language file.
LockVoting()
Lock the voting for a poll.
LockVoting() : void
Must be called with a topic specified in the URL. An admin always has over riding permission to lock a poll. If not an admin must have poll_lock_any permission, otherwise must be poll starter with poll_lock_own permission. Upon successful completion of action will direct user back to topic. Accessed via ?action=lockvoting.
EditPoll()
Display screen for editing or adding a poll.
EditPoll() : void
Must be called with a topic specified in the URL. If the user is adding a poll to a topic, must contain the variable 'add' in the url. User must have poll_edit_any/poll_add_any permission for the relevant action, otherwise must be poll starter with poll_edit_own permission for editing, or be topic starter with poll_add_any permission for adding. Accessed via ?action=editpoll.
Uses Post language file. Uses Poll template, main sub-template.
EditPoll2()
Update the settings for a poll, or add a new one.
EditPoll2() : void
Must be called with a topic specified in the URL. The user must have poll_edit_any/poll_add_any permission for the relevant action. Otherwise they must be poll starter with poll_edit_own permission for editing, or be topic starter with poll_add_any permission for adding. In the case of an error, this function will redirect back to EditPoll and display the relevant error message. Upon successful completion of action will direct user back to topic. Accessed via ?action=editpoll2.
RemovePoll()
Remove a poll from a topic without removing the topic.
RemovePoll() : void
Must be called with a topic specified in the URL. Requires poll_remove_any permission, unless it's the poll starter with poll_remove_own permission. Upon successful completion of action will direct user back to topic. Accessed via ?action=removepoll.
profileValidateSignature()
Validate the signature
profileValidateSignature(string &$value) : bool|string
Parameters
- $value : string
-
The new signature
Return values
bool|string —True if the signature passes the checks, otherwise a string indicating what the problem is
profileLoadGroups()
Handles the "manage groups" section of the profile
profileLoadGroups([int|null $id = null ]) : true
Parameters
- $id : int|null = null
Return values
true —Always returns true
loadProfileFields()
This defines every profile field known to man.
loadProfileFields([bool $force_reload = false ][, int|null $id = null ]) : void
Parameters
- $force_reload : bool = false
-
Whether to reload the data
- $id : int|null = null
loadCustomFields()
Load any custom fields for this area... no area means load all, 'summary' loads all public ones.
loadCustomFields(int $id[, string $area = 'summary' ]) : void
Parameters
- $id : int
-
The ID of the member
- $area : string = 'summary'
-
Which area to load fields for
loadThemeOptions()
Loads the theme options for a user
loadThemeOptions(int $id[, bool $defaultSettings = false ]) : void
Parameters
- $id : int
-
The ID of the member
- $defaultSettings : bool = false
-
If true, we are loading default options.
setupProfileContext()
Setup the context for a page load!
setupProfileContext(array<string|int, mixed> $fields, int $id) : void
Parameters
- $fields : array<string|int, mixed>
-
The profile fields to display. Each item should correspond to an item in the $profile_fields array generated by loadProfileFields
- $id : int
makeCustomFieldChanges()
Save any changes to the custom profile fields
makeCustomFieldChanges(int $id, string $area[, bool $sanitize = true ][, bool $return_errors = false ]) : array<string|int, mixed>|null
Parameters
- $id : int
-
The ID of the member
- $area : string
-
The area of the profile these fields are in
- $sanitize : bool = true
-
= true Whether or not to sanitize the data
- $return_errors : bool = false
Return values
array<string|int, mixed>|null —Returns nothing or returns an array of error info if $returnErrors is true
makeThemeChanges()
Make any theme changes that are sent with the profile.
makeThemeChanges(int $id, int $id_theme) : void
Parameters
- $id : int
-
The ID of the user
- $id_theme : int
-
The ID of the theme
cleanRequest()
cleanRequest() : void
is_filtered_request()
Compares existance request variables against an array.
is_filtered_request(array<string|int, mixed> $value_list, string $var) : bool
The input array is associative, where keys denote accepted values
in a request variable denoted by $req_val
. Values can be:
- another associative array where at least one key must be found in the request and their values are accepted request values.
- A scalar value, in which case no furthur checks are done.
Parameters
- $value_list : array<string|int, mixed>
- $var : string
Return values
bool —whether any of the criteria was satisfied
ob_sessrewrite()
Rewrite URLs to include the session ID.
ob_sessrewrite(string $buffer) : string
What it does:
- rewrites the URLs outputted to have the session ID, if the user is not accepting cookies and is using a standard web browser.
- handles rewriting URLs for the queryless URLs option.
- can be turned off entirely by setting $scripturl to an empty string, ''. (it wouldn't work well like that anyway.)
- because of bugs in certain builds of PHP, does not function in versions lower than 4.3.0 - please upgrade if this hurts you.
Parameters
- $buffer : string
-
The unmodified output buffer
Return values
string —The modified buffer
setMemoryLimit()
Helper function to set the system memory to a needed value - If the needed memory is greater than current, will attempt to get more - if in_use is set to true, will also try to take the current memory usage in to account
setMemoryLimit(string $needed[, bool $in_use = false ]) : bool
Parameters
- $needed : string
-
The amount of memory to request, if needed, like 256M
- $in_use : bool = false
-
Set to true to account for current memory usage of the script
Return values
bool —True if we have at least the needed memory
memoryReturnBytes()
Helper function to convert memory string settings to bytes
memoryReturnBytes(string $val) : int
Parameters
- $val : string
-
The byte string, like 256M or 1G
Return values
int —The string converted to a proper integer in bytes
validatePassword()
Checks whether a password meets the current forum rules - called when registering/choosing a password.
validatePassword(string $password, string $username[, array<string|int, mixed> $restrict_in = [] ]) : null|string
- checks the password obeys the current forum settings for password strength.
- if password checking is enabled, will check that none of the words in restrict_in appear in the password.
- returns an error identifier if the password is invalid, or null.
Parameters
- $password : string
-
The desired password
- $username : string
-
The username
- $restrict_in : array<string|int, mixed> = []
-
An array of restricted strings that cannot be part of the password (email address, username, etc.)
Return values
null|string —Null if valid or a string indicating what the problem was
generateValidationCode()
Generate a random validation code.
generateValidationCode() : string
Return values
string —A random validation code
hash_password()
Hashes the user's password
hash_password(string $username, string $password[, int $cost = null ]) : string
Parameters
- $username : string
-
The username. Ignored since 3.0.
- $password : string
-
The unhashed password
- $cost : int = null
-
The cost
Return values
string —The hashed password
hash_verify_password()
Verifies a raw SMF password against the encrypted string
hash_verify_password(string $username, string $password, string $hash) : bool
Parameters
- $username : string
-
The username. Ignored since 3.0.
- $password : string
-
The password
- $hash : string
-
The hashed string
Return values
bool —Whether the hashed password matches the string
hash_benchmark()
Benchmarks the server to figure out an appropriate cost factor (minimum 9)
hash_benchmark([float $hashTime = 0.2 ]) : int
Parameters
- $hashTime : float = 0.2
-
Time to target, in seconds
Return values
int —The cost
checkConfirm()
Check if a specific confirm parameter was given.
checkConfirm(string $action) : bool|string
Parameters
- $action : string
-
The action we want to check against
Return values
bool|string —True if the check passed or a token
checkSubmitOnce()
Check whether a form has been submitted twice.
checkSubmitOnce(string $action[, bool $is_fatal = true ]) : bool|null
Registers a sequence number for a form. Checks whether a submitted sequence number is registered in the current session. Depending on the value of is_fatal shows an error or returns true or false. Frees a sequence number from the stack after it's been checked. Frees a sequence number without checking if action == 'free'.
Parameters
- $action : string
-
The action - can be 'register', 'check' or 'free'
- $is_fatal : bool = true
-
Whether to die with a fatal error
Return values
bool|null —If the action isn't check, returns nothing, otherwise returns whether the check was successful
spamProtection()
This function attempts to protect from spammed messages and the like.
spamProtection(string $error_type[, bool $only_return_result = false ]) : bool
The time taken depends on error_type - generally uses the modSetting.
Parameters
- $error_type : string
-
The error type. Also used as a $txt index (not an actual string).
- $only_return_result : bool = false
-
Whether you want the function to die with a fatal_lang_error.
Return values
bool —Whether they've posted within the limit
secureDirectory()
A generic function to create a pair of index.php and .htaccess files in a directory
secureDirectory(string|array<string|int, mixed> $paths[, bool $attachments = false ]) : bool|array<string|int, mixed>
Parameters
- $paths : string|array<string|int, mixed>
-
The (absolute) directory path
- $attachments : bool = false
-
Whether this is an attachment directory
Return values
bool|array<string|int, mixed> —True on success an array of errors if anything fails
frameOptionsHeader()
This sets the X-Frame-Options header.
frameOptionsHeader([string $override = null ]) : mixed
Parameters
- $override : string = null
-
An option to override (either 'SAMEORIGIN' or 'DENY')
Tags
corsPolicyHeader()
This sets the Access-Control-Allow-Origin header.
corsPolicyHeader([bool $set_header = true ]) : void
Parameters
- $set_header : bool = true
-
(Default: true): When false, we will do the logic, but not send the headers. The relevant logic is still saved in the $context and can be sent manually.
Tags
KickGuest()
Throws guests out to the login screen when guest access is off.
KickGuest() : void
- sets $_SESSION['login_url'] to $_SERVER['REQUEST_URL'].
- uses the 'kick_guest' sub template found in Login.template.php.
createToken()
Lets give you a token of our appreciation.
createToken(string $action[, string $type = 'post' ]) : array<string|int, mixed>
Parameters
- $action : string
-
The action to create the token for
- $type : string = 'post'
-
The type of token ('post', 'get' or 'request')
Return values
array<string|int, mixed> —An array containing the name of the token var and the actual token
validateToken()
Only patrons with valid tokens can ride this ride.
validateToken(string $action[, string $type = 'post' ][, bool $reset = true ]) : bool
Parameters
- $action : string
-
The action to validate the token for
- $type : string = 'post'
-
The type of request (get, request, or post)
- $reset : bool = true
-
Whether to reset the token and display an error if validation fails
Return values
bool —returns whether the validation was successful
cleanTokens()
Removes old unused tokens from session defaults to 3 hours before a token is considered expired if $complete = true will remove all tokens
cleanTokens([bool $complete = false ]) : void
Parameters
- $complete : bool = false
-
Whether to remove all tokens or only expired ones
ssi_shutdown()
This shuts down the SSI and shows the footer.
ssi_shutdown() : void
ssi_version()
Show the SMF version.
ssi_version([string $output_method = 'echo' ]) : void|string
Parameters
- $output_method : string = 'echo'
-
If 'echo', displays the version, otherwise returns it
Return values
void|string —Returns nothing if output_method is 'echo', otherwise returns the version
ssi_full_version()
Show the full SMF version string.
ssi_full_version([string $output_method = 'echo' ]) : void|string
Parameters
- $output_method : string = 'echo'
-
If 'echo', displays the full version string, otherwise returns it
Return values
void|string —Returns nothing if output_method is 'echo', otherwise returns the version string
ssi_software_year()
Show the SMF software year.
ssi_software_year([string $output_method = 'echo' ]) : void|string
Parameters
- $output_method : string = 'echo'
-
If 'echo', displays the software year, otherwise returns it
Return values
void|string —Returns nothing if output_method is 'echo', otherwise returns the software year
ssi_copyright()
Show the forum copyright. Only used in our ssi_examples files.
ssi_copyright([string $output_method = 'echo' ]) : void|string
Parameters
- $output_method : string = 'echo'
-
If 'echo', displays the forum copyright, otherwise returns it
Return values
void|string —Returns nothing if output_method is 'echo', otherwise returns the copyright string
ssi_welcome()
Display a welcome message, like: Hey, User, you have 0 messages, 0 are new.
ssi_welcome([string $output_method = 'echo' ]) : void|array<string|int, mixed>
Parameters
- $output_method : string = 'echo'
-
The output method. If 'echo', will display everything. Otherwise returns an array of user info.
Return values
void|array<string|int, mixed> —Displays a welcome message or returns an array of user data depending on output_method.
ssi_menubar()
Display a menu bar, like is displayed at the top of the forum.
ssi_menubar([string $output_method = 'echo' ]) : array<string|int, mixed>|null
Parameters
- $output_method : string = 'echo'
-
The output method. If 'echo', will display the menu, otherwise returns an array of menu data.
Return values
array<string|int, mixed>|null —Displays the menu or returns an array of menu data depending on output_method.
ssi_logout()
Show a logout link.
ssi_logout([string $redirect_to = '' ][, string $output_method = 'echo' ]) : string|bool|null
Parameters
- $redirect_to : string = ''
-
A URL to redirect the user to after they log out.
- $output_method : string = 'echo'
-
The output method. If 'echo', shows a logout link, otherwise returns the HTML for it.
Return values
string|bool|null —Displays a logout link or returns its HTML depending on output_method.
ssi_recentPosts()
Recent post list: [board] Subject by Poster Date
ssi_recentPosts([int $num_recent = 8 ][, null|array<string|int, mixed> $exclude_boards = null ][, null|array<string|int, mixed> $include_boards = null ][, string $output_method = 'echo' ][, bool $limit_body = true ]) : array<string|int, mixed>|null
Parameters
- $num_recent : int = 8
-
How many recent posts to display
- $exclude_boards : null|array<string|int, mixed> = null
-
If set, doesn't show posts from the specified boards
- $include_boards : null|array<string|int, mixed> = null
-
If set, only includes posts from the specified boards
- $output_method : string = 'echo'
-
The output method. If 'echo', displays the posts, otherwise returns an array of information about them.
- $limit_body : bool = true
-
Whether or not to only show the first 384 characters of each post
Return values
array<string|int, mixed>|null —Displays a list of recent posts or returns an array of information about them depending on output_method.
ssi_fetchPosts()
Fetches one or more posts by ID.
ssi_fetchPosts([array<string|int, int> $post_ids = [] ][, bool $override_permissions = false ][, string $output_method = 'echo' ]) : array<string|int, mixed>|null
Parameters
- $post_ids : array<string|int, int> = []
-
An array containing the IDs of the posts to show
- $override_permissions : bool = false
-
Whether to ignore permissions. If true, will show posts even if the user doesn't have permission to see them.
- $output_method : string = 'echo'
-
The output method. If 'echo', displays the posts, otherwise returns an array of info about them
Return values
array<string|int, mixed>|null —Displays the specified posts or returns an array of info about them, depending on output_method.
ssi_queryPosts()
This handles actually pulling post info. Called from other functions to eliminate duplication.
ssi_queryPosts([string $query_where = '' ][, array<string|int, mixed> $query_where_params = [] ][, int $query_limit = 10 ][, string $query_order = 'm.id_msg DESC' ][, string $output_method = 'echo' ][, bool $limit_body = false ][, bool $override_permissions = false ]) : array<string|int, mixed>|null
Parameters
- $query_where : string = ''
-
The WHERE clause for the query
- $query_where_params : array<string|int, mixed> = []
-
An array of parameters for the WHERE clause
- $query_limit : int = 10
-
The maximum number of rows to return
- $query_order : string = 'm.id_msg DESC'
-
The ORDER BY clause for the query
- $output_method : string = 'echo'
-
The output method. If 'echo', displays the posts, otherwise returns an array of info about them.
- $limit_body : bool = false
-
If true, will only show the first 384 characters of the post rather than all of it
- $override_permissions : bool = false
-
Whether or not to ignore permissions. If true, will show all posts regardless of whether the user can actually see them
Return values
array<string|int, mixed>|null —Displays the posts or returns an array of info about them, depending on output_method
ssi_recentTopics()
Recent topic list: [board] Subject by Poster Date
ssi_recentTopics([int $num_recent = 8 ][, null|array<string|int, mixed> $exclude_boards = null ][, null|array<string|int, mixed> $include_boards = null ][, string $output_method = 'echo' ]) : void|array<string|int, mixed>
Parameters
- $num_recent : int = 8
-
How many recent topics to show
- $exclude_boards : null|array<string|int, mixed> = null
-
If set, exclude topics from the specified board(s)
- $include_boards : null|array<string|int, mixed> = null
-
If set, only include topics from the specified board(s)
- $output_method : string = 'echo'
-
The output method. If 'echo', displays a list of topics, otherwise returns an array of info about them
Return values
void|array<string|int, mixed> —Either displays a list of topics or returns an array of info about them, depending on output_method.
ssi_topPoster()
Shows a list of top posters
ssi_topPoster([int $topNumber = 1 ][, string $output_method = 'echo' ]) : array<string|int, mixed>|null
Parameters
- $topNumber : int = 1
-
How many top posters to list
- $output_method : string = 'echo'
-
The output method. If 'echo', will display a list of users, otherwise returns an array of info about them.
Return values
array<string|int, mixed>|null —Either displays a list of users or returns an array of info about them, depending on output_method.
ssi_topBoards()
Shows a list of top boards based on activity
ssi_topBoards([int $num_top = 10 ][, string $output_method = 'echo' ]) : array<string|int, mixed>|null
Parameters
- $num_top : int = 10
-
How many boards to display
- $output_method : string = 'echo'
-
The output method. If 'echo', displays a list of boards, otherwise returns an array of info about them.
Return values
array<string|int, mixed>|null —Displays a list of the top boards or returns an array of info about them, depending on output_method.
ssi_topTopics()
Shows a list of top topics based on views or replies
ssi_topTopics([string $type = 'replies' ][, int $num_topics = 10 ][, string $output_method = 'echo' ]) : array<string|int, mixed>|null
Parameters
- $type : string = 'replies'
-
Can be either replies or views
- $num_topics : int = 10
-
How many topics to display
- $output_method : string = 'echo'
-
The output method. If 'echo', displays a list of topics, otherwise returns an array of info about them.
Return values
array<string|int, mixed>|null —Either displays a list of topics or returns an array of info about them, depending on output_method.
ssi_topTopicsReplies()
Top topics based on replies
ssi_topTopicsReplies([int $num_topics = 10 ][, string $output_method = 'echo' ]) : array<string|int, mixed>|null
Parameters
- $num_topics : int = 10
-
How many topics to show
- $output_method : string = 'echo'
-
The output method. If 'echo', displays a list of topics, otherwise returns an array of info about them
Return values
array<string|int, mixed>|null —Either displays a list of top topics or returns an array of info about them, depending on output_method.
ssi_topTopicsViews()
Top topics based on views
ssi_topTopicsViews([int $num_topics = 10 ][, string $output_method = 'echo' ]) : array<string|int, mixed>|null
Parameters
- $num_topics : int = 10
-
How many topics to show
- $output_method : string = 'echo'
-
The output method. If 'echo', displays a list of topics, otherwise returns an array of info about them
Return values
array<string|int, mixed>|null —Either displays a list of top topics or returns an array of info about them, depending on output_method.
ssi_latestMember()
Show a link to the latest member: Please welcome, Someone, our latest member.
ssi_latestMember([string $output_method = 'echo' ]) : array<string|int, mixed>|null
Parameters
- $output_method : string = 'echo'
-
The output method. If 'echo', returns a string with a link to the latest member's profile, otherwise returns an array of info about them.
Return values
array<string|int, mixed>|null —Displays a "welcome" message for the latest member or returns an array of info about them, depending on output_method.
ssi_randomMember()
Fetches a random member.
ssi_randomMember([string $random_type = '' ][, string $output_method = 'echo' ]) : array<string|int, mixed>|null
Parameters
- $random_type : string = ''
-
If 'day', only fetches a new random member once a day.
- $output_method : string = 'echo'
-
The output method. If 'echo', displays a link to the member's profile, otherwise returns an array of info about them.
Return values
array<string|int, mixed>|null —Displays a link to a random member's profile or returns an array of info about them depending on output_method.
ssi_fetchMember()
Fetch specific members
ssi_fetchMember([array<string|int, mixed> $member_ids = [] ][, string $output_method = 'echo' ]) : array<string|int, mixed>|null
Parameters
- $member_ids : array<string|int, mixed> = []
-
The IDs of the members to fetch
- $output_method : string = 'echo'
-
The output method. If 'echo', displays a list of links to the members' profiles, otherwise returns an array of info about them.
Return values
array<string|int, mixed>|null —Displays links to the specified members' profiles or returns an array of info about them, depending on output_method.
ssi_fetchGroupMembers()
Get all members in the specified group
ssi_fetchGroupMembers([int $group_id = null ][, string $output_method = 'echo' ]) : array<string|int, mixed>|null
Parameters
- $group_id : int = null
-
The ID of the group to get members from
- $output_method : string = 'echo'
-
The output method. If 'echo', returns a list of group members, otherwise returns an array of info about them.
Return values
array<string|int, mixed>|null —Displays a list of group members or returns an array of info about them, depending on output_method.
ssi_queryMembers()
Pulls info about members based on the specified parameters. Used by other functions to eliminate duplication.
ssi_queryMembers([string $query_where = null ][, array<string|int, mixed> $query_where_params = [] ][, string|int $query_limit = '' ][, string $query_order = 'id_member DESC' ][, string $output_method = 'echo' ]) : array<string|int, mixed>|null
Parameters
- $query_where : string = null
-
The info for the WHERE clause of the query
- $query_where_params : array<string|int, mixed> = []
-
The parameters for the WHERE clause
- $query_limit : string|int = ''
-
The number of rows to return or an empty string to return all
- $query_order : string = 'id_member DESC'
-
The info for the ORDER BY clause of the query
- $output_method : string = 'echo'
-
The output method. If 'echo', displays a list of members, otherwise returns an array of info about them
Return values
array<string|int, mixed>|null —Displays a list of members or returns an array of info about them, depending on output_method.
ssi_boardStats()
Show some basic stats: Total This: XXXX, etc.
ssi_boardStats([string $output_method = 'echo' ]) : array<string|int, mixed>|null
Parameters
- $output_method : string = 'echo'
-
The output method. If 'echo', displays the stats, otherwise returns an array of info about them
Return values
array<string|int, mixed>|null —Doesn't return anything if the user can't view stats. Otherwise either displays the stats or returns an array of info about them, depending on output_method.
ssi_whosOnline()
Shows a list of online users: YY Guests, ZZ Users and then a list.
ssi_whosOnline([string $output_method = 'echo' ]) : array<string|int, mixed>|null
..
Parameters
- $output_method : string = 'echo'
-
The output method. If 'echo', displays a list, otherwise returns an array of info about the online users.
Return values
array<string|int, mixed>|null —Either displays a list of online users or returns an array of info about them, depending on output_method.
ssi_logOnline()
Just like whosOnline except it also logs the online presence.
ssi_logOnline([string $output_method = 'echo' ]) : array<string|int, mixed>|null
Parameters
- $output_method : string = 'echo'
-
The output method. If 'echo', displays a list, otherwise returns an array of info about the online users.
Return values
array<string|int, mixed>|null —Either displays a list of online users or returns an array of info about them, depending on output_method.
ssi_login()
Shows a login box
ssi_login([string $redirect_to = '' ][, string $output_method = 'echo' ]) : bool|null
Parameters
- $redirect_to : string = ''
-
The URL to redirect the user to after they login
- $output_method : string = 'echo'
-
The output method. If 'echo' and the user is a guest, displays a login box, otherwise returns whether the user is a guest
Return values
bool|null —Either displays a login box or returns whether the user is a guest, depending on whether the user is logged in and output_method.
ssi_topPoll()
Show the top poll based on votes
ssi_topPoll([string $output_method = 'echo' ]) : array<string|int, mixed>|null
Parameters
- $output_method : string = 'echo'
-
The output method. If 'echo', displays the poll, otherwise returns an array of info about it
Return values
array<string|int, mixed>|null —Either shows the top poll or returns an array of info about it, depending on output_method.
ssi_recentPoll()
Shows the most recent poll
ssi_recentPoll([bool $topPollInstead = false ][, string $output_method = 'echo' ]) : array<string|int, mixed>|null
Parameters
- $topPollInstead : bool = false
-
Whether to show the top poll (based on votes) instead of the most recent one
- $output_method : string = 'echo'
-
The output method. If 'echo', displays the poll, otherwise returns an array of info about it.
Return values
array<string|int, mixed>|null —Either shows the poll or returns an array of info about it, depending on output_method.
ssi_showPoll()
Shows the poll from the specified topic
ssi_showPoll([null|int $topic = null ][, string $output_method = 'echo' ]) : array<string|int, mixed>|null
Parameters
- $topic : null|int = null
-
The topic to show the poll from. If null, $_REQUEST['ssi_topic'] will be used instead.
- $output_method : string = 'echo'
-
The output method. If 'echo', displays the poll, otherwise returns an array of info about it.
Return values
array<string|int, mixed>|null —Either displays the poll or returns an array of info about it, depending on output_method.
ssi_pollVote()
Handles voting in a poll (done automatically)
ssi_pollVote() : mixed
ssi_quickSearch()
Shows a search box
ssi_quickSearch([string $output_method = 'echo' ]) : string|null
Parameters
- $output_method : string = 'echo'
-
The output method. If 'echo', displays a search box, otherwise returns the URL of the search page.
Return values
string|null —Displays a search box or returns the URL to the search page depending on output_method. If you don't have permission to search, the function won't return anything.
ssi_news()
Show a random forum news item
ssi_news([string $output_method = 'echo' ]) : string|null
Parameters
- $output_method : string = 'echo'
-
The output method. If 'echo', shows the news item, otherwise returns it.
Return values
string|null —Shows or returns a random forum news item, depending on output_method.
ssi_todaysBirthdays()
Show today's birthdays.
ssi_todaysBirthdays([string $output_method = 'echo' ]) : array<string|int, mixed>|null
Parameters
- $output_method : string = 'echo'
-
The output method. If 'echo', displays a list of users, otherwise returns an array of info about them.
Return values
array<string|int, mixed>|null —Displays a list of users or returns an array of info about them depending on output_method.
ssi_todaysHolidays()
Shows today's holidays.
ssi_todaysHolidays([string $output_method = 'echo' ]) : array<string|int, mixed>|null
Parameters
- $output_method : string = 'echo'
-
The output method. If 'echo', displays a list of holidays, otherwise returns an array of info about them.
Return values
array<string|int, mixed>|null —Displays a list of holidays or returns an array of info about them depending on output_method
ssi_todaysEvents()
Shows today's events.
ssi_todaysEvents([string $output_method = 'echo' ]) : array<string|int, mixed>|null
Parameters
- $output_method : string = 'echo'
-
The output method. If 'echo', displays a list of events, otherwise returns an array of info about them.
Return values
array<string|int, mixed>|null —Displays a list of events or returns an array of info about them depending on output_method
ssi_todaysCalendar()
Shows today's calendar items (events, birthdays and holidays)
ssi_todaysCalendar([string $output_method = 'echo' ]) : array<string|int, mixed>|string|null
Parameters
- $output_method : string = 'echo'
-
The output method. If 'echo', displays a list of calendar items, otherwise returns an array of info about them.
Return values
array<string|int, mixed>|string|null —Displays a list of calendar items or returns an array of info about them depending on output_method
ssi_boardNews()
Show the latest news, with a template... by board.
ssi_boardNews([null|int $board = null ][, null|int $limit = null ][, null|int $start = null ][, null|int $length = null ][, string $output_method = 'echo' ]) : array<string|int, mixed>|null
Parameters
- $board : null|int = null
-
The ID of the board to get the info from. Defaults to $board or $_GET['board'] if not set.
- $limit : null|int = null
-
How many items to show. Defaults to $_GET['limit'] or 5 if not set.
- $start : null|int = null
-
Start with the specified item. Defaults to $_GET['start'] or 0 if not set.
- $length : null|int = null
-
How many characters to show from each post. Defaults to $_GET['length'] or 0 (no limit) if not set.
- $output_method : string = 'echo'
-
The output method. If 'echo', displays the news items, otherwise returns an array of info about them.
Return values
array<string|int, mixed>|null —Displays the news items or returns an array of info about them, depending on output_method.
ssi_recentEvents()
Show the most recent events
ssi_recentEvents([int $max_events = 7 ][, string $output_method = 'echo' ]) : array<string|int, mixed>|null
Parameters
- $max_events : int = 7
-
The maximum number of events to show
- $output_method : string = 'echo'
-
The output method. If 'echo', displays the events, otherwise returns an array of info about them.
Return values
array<string|int, mixed>|null —Displays the events or returns an array of info about them, depending on output_method.
ssi_checkPassword()
Checks whether the specified password is correct for the specified user.
ssi_checkPassword([int|string $id = null ][, string $password = null ][, bool $is_username = false ]) : bool
Parameters
- $id : int|string = null
-
The ID or username of a user
- $password : string = null
-
The password to check
- $is_username : bool = false
-
If true, treats $id as a username rather than a user ID
Return values
bool —Whether or not the password is correct.
ssi_recentAttachments()
Shows the most recent attachments that the user can see
ssi_recentAttachments([int $num_attachments = 10 ][, array<string|int, mixed> $attachment_ext = [] ][, string $output_method = 'echo' ]) : array<string|int, mixed>|null
Parameters
- $num_attachments : int = 10
-
How many to show
- $attachment_ext : array<string|int, mixed> = []
-
Only shows attachments with the specified extensions ('jpg', 'gif', etc.) if set
- $output_method : string = 'echo'
-
The output method. If 'echo', displays a table with links/info, otherwise returns an array with information about the attachments
Return values
array<string|int, mixed>|null —Displays a table of attachment info or returns an array containing info about the attachments, depending on output_method.
loadSession()
Attempt to start the session, unless it already has been.
loadSession() : void
CalculateNextTrigger()
Calculate the next time the passed tasks should be triggered.
CalculateNextTrigger([string|array<string|int, mixed> $tasks = [] ][, bool $force_update = false ]) : void
Parameters
- $tasks : string|array<string|int, mixed> = []
-
The ID of a single task or an array of tasks
- $force_update : bool = false
loadTheme()
Load a theme, by ID.
loadTheme([int $id = 0 ][, bool $initialize = true ]) : mixed
Parameters
- $id : int = 0
-
The ID of the theme to load
- $initialize : bool = true
-
Whether or not to initialize a bunch of theme-related variables/settings
loadEssentialThemeData()
This loads the bare minimum data to allow us to load language files!
loadEssentialThemeData() : void
loadTemplate()
Load a template - if the theme doesn't include it, use the default.
loadTemplate(string $template_name[, array<string|int, mixed>|string $style_sheets = [] ][, bool $fatal = true ]) : bool
What this function does:
- loads a template file with the name template_name from the current, default, or base theme.
- detects a wrong default theme directory and tries to work around it.
Parameters
- $template_name : string
-
The name of the template to load
- $style_sheets : array<string|int, mixed>|string = []
-
The name of a single stylesheet or an array of names of stylesheets to load
- $fatal : bool = true
-
If true, dies with an error message if the template cannot be found
Tags
Return values
bool —Whether or not the template was loaded
loadSubTemplate()
Load a sub-template.
loadSubTemplate(string $sub_template_name[, bool $fatal = false ]) : mixed
What it does: - loads the sub template specified by sub_template_name, which must be in an already-loaded template.
- if ?debug is in the query string, shows administrators a marker after every sub template for debugging purposes.
Parameters
- $sub_template_name : string
-
The name of the sub-template to load
- $fatal : bool = false
-
Whether to die with an error if the sub-template can't be loaded
Tags
loadCSSFile()
Add a CSS file for output later
loadCSSFile(string $filename[, array<string|int, mixed> $params = [] ][, string $id = '' ]) : void
Parameters
- $filename : string
-
The name of the file to load
- $params : array<string|int, mixed> = []
-
An array of parameters Keys are the following: - ['external'] (true/false): define if the file is a externally located file. Needs to be set to true if you are loading an external file - ['default_theme'] (true/false): force use of default theme url - ['force_current'] (true/false): if this is false, we will attempt to load the file from the default theme if not found in the current theme
- ['validate'] (true/false): if true script will validate the local file exists
- ['rtl'] (string): additional file to load in RTL mode
- ['seed'] (true/false/string): if true or null, use cache stale, false do not, or used a supplied string
- ['minimize'] bool to add your file to the main minimized file. Useful when you have a file thats loaded everywhere and for everyone.
- ['order_pos'] int define the load order, when not define it's loaded in the middle, before index.css = -500, after index.css = 500, middle = 3000, end (i.e. after responsive.css) = 10000
- ['attributes'] array extra attributes to add to the element
- $id : string = ''
-
An ID to stick on the end of the filename for caching purposes
addInlineCss()
Add a block of inline css code to be executed later
addInlineCss(string $css) : bool|null
- 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 <style> tag so do make sure your css is valid!
Parameters
- $css : string
-
Some css code
Return values
bool|null —Adds the CSS to the $context['css_header'] array or returns if no CSS is specified
loadJavaScriptFile()
Add a Javascript file for output later
loadJavaScriptFile(string $fileName[, array<string|int, mixed> $params = [] ][, string $id = '' ]) : void
Parameters
- $fileName : string
-
The name of the file to load
- $params : array<string|int, mixed> = []
-
An array of parameter info Keys are the following: - ['external'] (true/false): define if the file is a externally located file. Needs to be set to true if you are loading an external file - ['default_theme'] (true/false): force use of default theme url - ['defer'] (true/false): define if the file should load in
or before the closing tag - ['force_current'] (true/false): if this is false, we will attempt to load the file from the default theme if not found in the current theme- ['async'] (true/false): if the script should be loaded asynchronously (HTML5)
- ['validate'] (true/false): if true script will validate the local file exists
- ['seed'] (true/false/string): if true or null, use cache stale, false do not, or used a supplied string
- ['minimize'] bool to add your file to the main minimized file. Useful when you have a file thats loaded everywhere and for everyone.
- ['attributes'] array extra attributes to add to the element
- $id : string = ''
-
An ID to stick on the end of the filename
addJavaScriptVar()
Add a Javascript variable for output later (for feeding text strings and similar to JS) Cleaner and easier (for modders) than to use the function below.
addJavaScriptVar(string $key, string $value[, bool $escape = false ]) : mixed
Parameters
- $key : string
-
The key for this variable
- $value : string
-
The value
- $escape : bool = false
-
Whether or not to escape the value
addInlineJavaScript()
Add a block of inline Javascript code to be executed later
addInlineJavaScript(string $javascript[, bool $defer = false ]) : bool|null
- only use this if you have to, generally external JS files are better, but for very small scripts or for scripts that require help from PHP/whatever, this can be useful.
- all code added with this function is added to the same <script> tag so do make sure your JS is clean!
Parameters
- $javascript : string
-
Some JS code
- $defer : bool = false
-
Whether the script should load in
or before the closing tag
Return values
bool|null —Adds the code to one of the $context['javascript_inline'] arrays or returns if no JS was specified
setupThemeContext()
Sets up the basic theme context stuff.
setupThemeContext([bool $forceload = false ]) : mixed
Parameters
- $forceload : bool = false
-
Whether to load the theme even if it's already loaded
setupMenuContext()
Sets up all of the top menu buttons Saves them in the cache if it is available and on Places the results in $context
setupMenuContext() : void
template_header()
The header template
template_header() : void
theme_copyright()
Show the copyright.
theme_copyright() : void
template_footer()
The template footer
template_footer() : void
template_javascript()
Output the Javascript files - tabbing in this function is to make the HTML source look good and proper - if deferred is set function will output all JS set to load at page end
template_javascript([bool $do_deferred = false ]) : void
Parameters
- $do_deferred : bool = false
-
If true will only output the deferred JS (the stuff that goes right before the closing body tag)
template_css()
Output the CSS files
template_css() : void
custMinify()
Get an array of previously defined files and adds them to our main minified files.
custMinify(array<string|int, mixed> $data, string $type) : array<string|int, mixed>
Sets a one day cache to avoid re-creating a file on every request.
Parameters
- $data : array<string|int, mixed>
-
The files to minify.
- $type : string
-
either css or js.
Return values
array<string|int, mixed> —Info about the minified file, or about the original files if the minify process failed.
deleteAllMinified()
Clears out old minimized CSS and JavaScript files and ensures $modSettings['browser_cache'] is up to date
deleteAllMinified() : void
SetJavaScript()
Set an option via javascript.
SetJavaScript() : void
- sets a theme option without outputting anything.
- can be used with javascript, via a dummy image... (which doesn't require the page to reload.)
- requires someone who is logged in.
- accessed via ?action=jsoption;var=variable;val=value;session_var=sess_id.
- does not log access to the Who's Online log. (in index.php..)
WrapAction()
Possibly the simplest and best example of how to use the template system.
WrapAction() : void
- allows the theme to take care of actions.
- happens if $settings['catch_action'] is set and action isn't found in the action array.
- can use a template, layers, sub_template, filename, and/or function.
PickTheme()
Choose a theme from a list.
PickTheme() : void
allows a user to pick a new theme with an interface.
- uses the Themes template. (pick sub template.)
- accessed with ?action=theme;sa=pick.
smf_strftime()
Replacement for strftime() that is compatible with PHP 8.1+.
smf_strftime(string $format[, int|null $timestamp = null ][, string|null $tzid = null ]) : string
This does not use the system's strftime library or locale setting, so results may vary in a few cases from the results of strftime():
-
%a, %A, %b, %B, %p, %P: Output will use SMF's language strings to localize these values. If SMF's language strings have not been loaded, PHP's default English strings will be used.
-
%c, %x, %X: Output will always use ISO format.
Parameters
- $format : string
-
A strftime() format string.
- $timestamp : int|null = null
-
A Unix timestamp. If null, defaults to the current time.
- $tzid : string|null = null
-
Time zone identifier. If null, uses default time zone.
Return values
string —The formatted datetime string.
smf_gmstrftime()
Replacement for gmstrftime() that is compatible with PHP 8.1+.
smf_gmstrftime(string $format[, int|null $timestamp = null ]) : string
Calls smf_strftime() with the $tzid parameter set to 'UTC'.
Parameters
- $format : string
-
A strftime() format string.
- $timestamp : int|null = null
-
A Unix timestamp. If null, defaults to the current time.
Return values
string —The formatted datetime string.
get_date_or_time_format()
Gets a version of a strftime() format that only shows the date or time components
get_date_or_time_format([string $type = '' ][, string $format = '' ][, bool|null $strftime = null ]) : string
Parameters
- $type : string = ''
-
Either 'date' or 'time'.
- $format : string = ''
-
A strftime() format to process. Defaults to $user_info['time_format'].
- $strftime : bool|null = null
Return values
string —A strftime() format string
timeformat()
Format a time to make it look purdy.
timeformat(int $log_time[, bool|string $show_today = true ][, null|string $tzid = null ]) : string
- returns a pretty formatted version of time based on the user's format in $user_info['time_format'].
- applies all necessary time offsets to the timestamp, unless offset_type is set.
- if todayMod is set and show_today was not not specified or true, an alternate format string is used to show the date with something to show it is "today" or "yesterday".
- performs localization (more than just strftime would do alone.)
Parameters
- $log_time : int
-
A timestamp
- $show_today : bool|string = true
-
Whether to show "Today"/"Yesterday" or just a date. If a string is specified, that is used to temporarily override the date format.
- $tzid : null|string = null
-
Time zone to use when generating the formatted string. If empty, the user's time zone will be used. If set to 'forum', the value of $modSettings['default_timezone'] will be used. If set to a valid time zone identifier, that will be used. Otherwise, the value of date_default_timezone_get() will be used.
Return values
string —A formatted time string
convertDateToEnglish()
Helper function to convert date string to english so that date_parse can parse the date
convertDateToEnglish(string $date) : string
Parameters
- $date : string
-
A localized date string
Return values
string —English date string
forum_time()
Deprecated function that formerly applied manual offsets to Unix timestamps in order to provide a fake version of time zone support on ancient versions of PHP. It now simply returns an unaltered timestamp.
since 2.1
forum_time([bool $use_user_offset = true ][, int $timestamp = null ]) : int
Parameters
- $use_user_offset : bool = true
-
This parameter is deprecated and nonfunctional
- $timestamp : int = null
-
A timestamp (null to use current time)
Return values
int —Seconds since the Unix epoch
smf_list_timezones()
Get a list of time zones.
smf_list_timezones([string $when = 'now' ]) : array<string|int, mixed>
Parameters
- $when : string = 'now'
-
The date/time for which to calculate the time zone values. May be a Unix timestamp or any string that strtotime() can understand. Defaults to 'now'.
Return values
array<string|int, mixed> —An array of time zone identifiers and label text.
get_tzid_metazones()
Returns an array that instructs SMF how to map specific time zones (e.g. "America/Denver") onto the user-friendly "meta-zone" labels that most people think of as time zones (e.g. "Mountain Time").
get_tzid_metazones([string $when = 'now' ]) : array<string|int, mixed>
Parameters
- $when : string = 'now'
-
The date/time used to determine fallback values. May be a Unix timestamp or any string that strtotime() can understand. Defaults to 'now'.
Return values
array<string|int, mixed> —An array relating time zones to "meta-zones"
get_sorted_tzids_for_country()
Returns an array of all the time zones in a country, ranked according to population and/or political significance.
get_sorted_tzids_for_country(string $country_code[, string $when = 'now' ]) : array<string|int, mixed>
Parameters
- $country_code : string
-
The two-character ISO-3166 code for a country.
- $when : string = 'now'
-
The date/time used to determine fallback values. May be a Unix timestamp or any string that strtotime() can understand. Defaults to 'now'.
Return values
array<string|int, mixed> —An array relating time zones to "meta-zones"
get_tzid_fallbacks()
Checks a list of time zone identifiers to make sure they are all defined in the installed version of the time zone database, and returns an array of key-value substitution pairs.
get_tzid_fallbacks(array<string|int, mixed> $tzids[, string $when = 'now' ]) : array<string|int, mixed>
For defined time zone identifiers, the substitution value will be identical to the original value. For undefined ones, the substitute will be a time zone identifier that was equivalent to the missing one at the specified time, or an empty string if there was no equivalent at that time.
Note: These fallbacks do not need to include every new time zone ever. They only need to cover any that are used in $tzid_metazones.
To find the date & time when a new time zone comes into effect, check the TZDB changelog at https://data.iana.org/time-zones/tzdb/NEWS
Parameters
- $tzids : array<string|int, mixed>
-
The time zone identifiers to check.
- $when : string = 'now'
-
The date/time used to determine substitute values. May be a Unix timestamp or any string that strtotime() can understand. Defaults to 'now'.
Return values
array<string|int, mixed> —Substitute values for any missing time zone identifiers.
validate_iso_country_codes()
Validates a set of two-character ISO 3166-1 country codes.
validate_iso_country_codes(array<string|int, mixed>|string $country_codes[, bool $as_csv = false ]) : array<string|int, mixed>|string
Parameters
- $country_codes : array<string|int, mixed>|string
-
Array or CSV string of country codes.
- $as_csv : bool = false
-
If true, return CSV string instead of array.
Return values
array<string|int, mixed>|string —Array or CSV string of valid country codes.
LockTopic()
Locks a topic... either by way of a moderator or the topic starter.
LockTopic() : void
What this does:
- locks a topic, toggles between locked/unlocked/admin locked.
- only admins can unlock topics locked by other admins.
- requires the lock_own or lock_any permission.
- logs the action to the moderator log.
- returns to the topic after it is done.
- it is accessed via ?action=lock.
Sticky()
Sticky a topic.
Sticky() : void
Can't be done by topic starters - that would be annoying! What this does:
- stickies a topic - toggles between sticky and normal.
- requires the make_sticky permission.
- adds an entry to the moderator log.
- when done, sends the user back to the topic.
- accessed via ?action=sticky.
approveTopics()
Approve topics?
approveTopics(array<string|int, mixed> $topics[, bool $approve = true ]) : bool
Parameters
- $topics : array<string|int, mixed>
-
Array of topic ids
- $approve : bool = true
-
Whether to approve the topics. If false, unapproves them instead
Tags
Return values
bool —Whether the operation was successful
moveTopics()
Moves one or more topics to a specific board. (doesn't check permissions.) Determines the source boards for the supplied topics Handles the moving of mark_read data Updates the posts count of the affected boards
moveTopics(int|array<string|int, int> $topics, int $toBoard) : mixed
Parameters
- $topics : int|array<string|int, int>
-
The ID of a single topic to move or an array containing the IDs of multiple topics to move
- $toBoard : int
-
The ID of the board to move the topics to
removeTopics()
Removes the passed id_topic's. (permissions are NOT checked here!).
removeTopics(array<string|int, mixed>|int $topics[, bool $decreasePostCount = true ][, bool $ignoreRecycling = false ][, bool $updateBoardCount = true ]) : mixed
Parameters
- $topics : array<string|int, mixed>|int
-
The topics to remove (can be an id or an array of ids).
- $decreasePostCount : bool = true
-
Whether to decrease the users' post counts
- $ignoreRecycling : bool = false
-
Whether to ignore recycling board settings
- $updateBoardCount : bool = true
-
Whether to adjust topic counts for the boards
prepareLikesContext()
Prepares an array of "likes" info for the topic specified by $topic
prepareLikesContext(int $topic) : array<string|int, mixed>
Parameters
- $topic : int
-
The topic ID to fetch the info from.
Return values
array<string|int, mixed> —An array of IDs of messages in the specified topic that the current user likes
set_tld_regex()
Creates an optimized regex to match all known top level domains.
set_tld_regex([bool $update = false ]) : void
The optimized regex is stored in $modSettings['tld_regex'].
To update the stored version of the regex to use the latest list of valid TLDs from iana.org, set the $update parameter to true. Updating can take some time, based on network connectivity, so it should normally only be done by calling this function from a background or scheduled task.
If $update is not true, but the regex is missing or invalid, the regex will be regenerated from a hard-coded list of TLDs. This regenerated regex will be overwritten on the next scheduled update.
Parameters
- $update : bool = false
-
If true, fetch and process the latest official list of TLDs from iana.org.
parse_iri()
A wrapper for `parse_url($url)` that can handle URLs with international characters (a.k.a. IRIs)
parse_iri(string $iri[, int $component = -1 ]) : string|int|array<string|int, mixed>|null|bool
Parameters
- $iri : string
-
The IRI to parse.
- $component : int = -1
-
Optional flag for parse_url's second parameter.
Return values
string|int|array<string|int, mixed>|null|bool —Same as parse_url(), but with unmangled Unicode.
validate_iri()
A wrapper for `filter_var($url, FILTER_VALIDATE_URL)` that can handle URLs with international characters (a.k.a. IRIs)
validate_iri(string $iri[, int $flags = 0 ]) : string|bool
Parameters
- $iri : string
-
The IRI to test.
- $flags : int = 0
-
Optional flags to pass to filter_var()
Return values
string|bool —Either the original IRI, or false if the IRI was invalid.
sanitize_iri()
A wrapper for `filter_var($url, FILTER_SANITIZE_URL)` that can handle URLs with international characters (a.k.a. IRIs)
sanitize_iri(string $iri) : string|bool
Note: The returned value will still be an IRI, not a URL. To convert to URL, feed the result of this function to iri_to_url()
Parameters
- $iri : string
-
The IRI to sanitize.
Return values
string|bool —The sanitized version of the IRI
normalize_iri()
Performs Unicode normalization on IRIs.
normalize_iri(string $iri) : string|bool
Internally calls sanitize_iri(), then performs Unicode normalization on the IRI as a whole, using NFKC normalization for the domain name (see RFC 3491) and NFC normalization for the rest.
Parameters
- $iri : string
-
The IRI to normalize.
Return values
string|bool —The normalized version of the IRI.
iri_to_url()
Converts a URL with international characters (an IRI) into a pure ASCII URL
iri_to_url(string $iri) : string|bool
Uses Punycode to encode any non-ASCII characters in the domain name, and uses standard URL encoding on the rest.
Parameters
- $iri : string
-
A IRI that may or may not contain non-ASCII characters.
Return values
string|bool —The URL version of the IRI.
url_to_iri()
Decodes a URL containing encoded international characters to UTF-8
url_to_iri(string $url) : string|bool
Decodes any Punycode encoded characters in the domain name, then uses standard URL decoding on the rest.
Parameters
- $url : string
-
The pure ASCII version of a URL.
Return values
string|bool —The UTF-8 version of the URL.
get_proxied_url()
Gets the appropriate URL to use for images (or whatever) when using SSL
get_proxied_url(string $url) : string
The returned URL may or may not be a proxied URL, depending on the situation. Mods can implement alternative proxies using the 'integrate_proxy' hook.
Parameters
- $url : string
-
The original URL of the requested resource
Return values
string —The URL to use
ssl_cert_found()
Check if the passed url has an SSL certificate.
ssl_cert_found(string $url) : bool
Returns true if a cert was found & false if not.
Parameters
- $url : string
-
to check, in $boardurl format (no trailing slash).
Return values
boolhttps_redirect_active()
Check if the passed url has a redirect to https:// by querying headers.
https_redirect_active(string $url) : bool
Returns true if a redirect was found & false if not. Note that when force_ssl = 2, SMF issues its own redirect... So if this returns true, it may be caused by SMF, not necessarily an .htaccess redirect.
Parameters
- $url : string
-
to check, in $boardurl format (no trailing slash).
Return values
boolbuild_query_board()
Build query_wanna_see_board and query_see_board for a userid
build_query_board(int $id) : array<string|int, mixed>
Returns array with keys query_wanna_see_board and query_see_board
Parameters
- $id : int
Return values
array<string|int, mixed>set_avatar_data()
Helper function to set an array of data for an user's avatar.
set_avatar_data([array<string|int, mixed> $data = [] ]) : array<string|int, mixed>
Makes assumptions based on the data provided, the following keys are required:
- avatar The raw "avatar" column in members table
- email The user's email. Used to get the gravatar info
- filename The attachment filename
Parameters
- $data : array<string|int, mixed> = []
-
An array of raw info
Return values
array<string|int, mixed> —An array of avatar data
updateMemberData()
Updates the columns in the members table.
updateMemberData(mixed $members, array<string|int, mixed> $data) : void
Assumes the data has been htmlspecialchar'd. this function should be used whenever member data needs to be updated in place of an UPDATE query.
id_member is either an int or an array of ints to be updated.
data is an associative array of the columns to be updated and their respective values. any string values updated should be quoted and slashed.
the value of any column can be '+' or '-', which mean 'increment' and decrement, respectively.
if the member's post number is updated, updates their post groups.
Parameters
- $members : mixed
-
An array of member IDs, the ID of a single member, or null to update this for all members
- $data : array<string|int, mixed>
-
The info to update for the members
getUserTimezone()
Gets a member's selected time zone identifier
getUserTimezone([int $id_member = null ]) : string
Parameters
- $id_member : int = null
-
The member id to look up. If not provided, the current user's id will be used.
Return values
string —The time zone identifier string for the user's time zone.
deleteMembers()
Delete one or more members.
deleteMembers(int|array<string|int, mixed> $users[, bool $check_not_admin = false ]) : void
Requires profile_remove_own or profile_remove_any permission for respectively removing your own account or any account. Non-admins cannot delete admins. The function:
- changes author of messages, topics and polls to guest authors.
- removes all log entries concerning the deleted members, except the error logs, ban logs and moderation logs.
- removes these members' personal messages (only the inbox), avatars, ban entries, theme settings, moderator positions, poll and votes.
- updates member statistics afterwards.
Parameters
- $users : int|array<string|int, mixed>
-
The ID of a user or an array of user IDs
- $check_not_admin : bool = false
-
Whether to verify that the users aren't admins
validateUsername()
Checks a username obeys a load of rules
validateUsername(int $memID, string $username[, bool $return_error = false ][, bool $check_reserved_name = true ]) : array<string|int, mixed>|null
Parameters
- $memID : int
-
The ID of the member
- $username : string
-
The username to validate
- $return_error : bool = false
-
Whether to return errors
- $check_reserved_name : bool = true
-
Whether to check this against the list of reserved names
Return values
array<string|int, mixed>|null —Null if there are no errors, otherwise an array of errors if return_error is true
isReservedName()
Check if a name is in the reserved words list.
isReservedName(string $name[, int $current_id_member = 0 ][, bool $is_name = true ][, bool $fatal = true ]) : bool|void
(name, current member id, name/username?.)
- checks if name is a reserved name or username.
- if is_name is false, the name is assumed to be a username.
- the id_member variable is used to ignore duplicate matches with the current member.
Parameters
- $name : string
-
The name to check
- $current_id_member : int = 0
-
The ID of the current member (to avoid false positives with the current member)
- $is_name : bool = true
-
Whether we're checking against reserved names or just usernames
- $fatal : bool = true
-
Whether to die with a fatal error if the name is reserved
Return values
bool|void —False if name is not reserved, otherwise true if $fatal is false or dies with a fatal_lang_error if $fatal is true
isBannedEmail()
Checks if a given email address might be banned.
isBannedEmail(string $email, string $restriction, string $error) : void
Check if a given email is banned. Performs an immediate ban if the turns turns out positive.
Parameters
- $email : string
-
The email to check
- $restriction : string
-
What type of restriction (cannot_post, cannot_register, etc.)
- $error : string
-
The error message to display if they are indeed banned
findMembers()
Finds members by email address, username, or real name.
findMembers(array<string|int, mixed> $names[, bool $use_wildcards = false ][, bool $buddies_only = false ][, int $max = 500 ]) : array<string|int, mixed>
- searches for members whose username, display name, or e-mail address match the given pattern of array names.
- searches only buddies if buddies_only is set.
Parameters
- $names : array<string|int, mixed>
-
The names of members to search for
- $use_wildcards : bool = false
-
Whether to use wildcards. Accepts wildcards ? and * in the pattern if true
- $buddies_only : bool = false
-
Whether to only search for the user's buddies
- $max : int = 500
-
The maximum number of results
Return values
array<string|int, mixed> —An array containing information about the matching members
membersAllowedTo()
Retrieves a list of members that have a given permission (on a given board).
membersAllowedTo(string $permission[, int $board_id = null ]) : array<string|int, mixed>
If board_id is not null, a board permission is assumed. Takes different permission settings into account. Takes possible moderators (on board 'board_id') into account.
Parameters
- $permission : string
-
The permission to check
- $board_id : int = null
-
If set, checks permission for that specific board
Return values
array<string|int, mixed> —An array containing the IDs of the members having that permission
groupsAllowedTo()
Retrieves a list of membergroups that have the given permission, either on a given board or in general.
groupsAllowedTo(string $permission[, int $board_id = null ][, bool $simple = true ][, int|null $profile_id = null ]) : array<string|int, mixed>
If board_id is not null, a board permission is assumed. The function takes different permission settings into account.
Parameters
- $permission : string
-
The permission to check
- $board_id : int = null
-
= null If set, checks permissions for the specified board
- $simple : bool = true
- $profile_id : int|null = null
Return values
array<string|int, mixed> —An array containing two arrays - 'allowed', which has which groups are allowed to do it and 'denied' which has the groups that are denied
getGroupsWithPermissions()
Retrieves a list of membergroups with the given permissions.
getGroupsWithPermissions([array<string|int, mixed> $general_permissions = [] ][, array<string|int, mixed> $board_permissions = [] ][, int $profile_id = 1 ]) : array<string|int, mixed>
Parameters
- $general_permissions : array<string|int, mixed> = []
- $board_permissions : array<string|int, mixed> = []
- $profile_id : int = 1
Return values
array<string|int, mixed> —An array containing two arrays - 'allowed', which has which groups are allowed to do it and 'denied' which has the groups that are denied
logSpider()
Log the spider presence online.
logSpider() : void
Tags
loadMemberData()
Loads an array of users' data by ID or member_name.
loadMemberData([array<string|int, mixed>|string $users = [] ][, int $type = SMFUser::LOAD_BY_ID ][, string|null $dataset = null ]) : array<string|int, mixed>
Parameters
- $users : array<string|int, mixed>|string = []
-
An array of users by id or name or a single username/id
- $type : int = SMFUser::LOAD_BY_ID
- $dataset : string|null = null
Return values
array<string|int, mixed> —The ids of the members loaded
loadUserSettings()
Load all the important user information.
loadUserSettings() : void
What it does:
- sets up the $user_info array
- assigns $user_info['query_wanna_see_board'] for what boards the user can see.
- first checks for cookie or integration validation.
- uses the current session if no integration function or cookie is found.
- checks password length, if member is activated and the login span isn't over.
- if validation fails for the user, $id_member is set to 0.
- updates the last visit time when needed.
loadPermissions()
Load this user's permissions.
loadPermissions() : void
loadMemberContext()
Loads the user's basic values... meant for template/theme usage.
loadMemberContext(int $id[, bool $display_custom_fields = false ]) : bool|array<string|int, mixed>
Parameters
- $id : int
-
- $display_custom_fields : bool = false
-
Whether or not to display custom profile fields
Tags
Return values
bool|array<string|int, mixed> —False if the data wasn't loaded or the loaded data.
is_not_guest()
Require a user who is logged in. (not a guest.) Checks if the user is currently a guest, and if so asks them to login with a message telling them why.
is_not_guest([string $message = '' ]) : void
Message is what to tell them when asking them to login.
Parameters
- $message : string = ''
-
The message to display to the guest
is_not_banned()
Do banning related stuff. (ie. disallow access....) Checks if the user is banned, and if so dies with an error.
is_not_banned([bool $force_check = false ]) : void
Caches this information for optimization purposes.
Parameters
- $force_check : bool = false
banPermissions()
Fix permissions according to ban status.
banPermissions() : void
Applies any states of banning by removing permissions the user cannot have.
log_ban()
Log a ban in the database.
log_ban([array<string|int, mixed> $ban_ids = [] ][, string $email = null ]) : void
Log the current user in the ban logs. Increment the hit counters for the specified ban ID's (if any.)
Parameters
- $ban_ids : array<string|int, mixed> = []
-
The IDs of the bans
- $email : string = null
-
The email address associated with the user that triggered this hit
validateSession()
Check if the user is who he/she says he is Makes sure the user is who they claim to be by requiring a password to be typed in every hour.
validateSession([string $type = 'admin' ][, string $force = false ]) : string|null
Is turned on and off by the securityDisable setting. Uses the adminLogin() function of Subs-Auth.php if they need to login, which saves all request (post and get) data.
Parameters
- $type : string = 'admin'
-
What type of session this is
- $force : string = false
-
When true, require a password even if we normally wouldn't
Return values
string|null —Returns 'session_verify_fail' if verification failed
checkSession()
Make sure the user's correct session was passed, and they came from here.
checkSession([string $type = 'post' ][, string $from_action = '' ][, bool $is_fatal = true ]) : string
Checks the current session, verifying that the person is who he or she should be. Also checks the referrer to make sure they didn't get sent here. Depends on the disableCheckUA setting, which is usually missing. Will check GET, POST, or REQUEST depending on the passed type. Also optionally checks the referring action if passed. (note that the referring action must be by GET.)
Parameters
- $type : string = 'post'
-
The type of check (post, get, request)
- $from_action : string = ''
-
The action this is coming from
- $is_fatal : bool = true
-
Whether to die with a fatal error if the check fails
Return values
string —The error message if is_fatal is false.
allowedTo()
Check the user's permissions.
allowedTo(string|array<string|int, mixed> $permission[, int|array<string|int, mixed> $boards = null ][, bool $any = false ]) : bool
checks whether the user is allowed to do permission. (ie. post_new.) If boards is specified, checks those boards instead of the current one. If any is true, will return true if the user has the permission on any of the specified boards Always returns true if the user is an administrator.
Parameters
- $permission : string|array<string|int, mixed>
-
A single permission to check or an array of permissions to check
- $boards : int|array<string|int, mixed> = null
-
The ID of a board or an array of board IDs if we want to check board-level permissions
- $any : bool = false
-
Whether to check for permission on at least one board instead of all boards
Return values
bool —Whether the user has the specified permission
isAllowedTo()
Fatal error if they cannot.
isAllowedTo(string|array<string|int, mixed> $permission[, int|array<string|int, mixed> $boards = null ][, bool $any = false ]) : bool
Uses allowedTo() to check if the user is allowed to do permission. Checks the passed boards or current board for the permission. If $any is true, the user only needs permission on at least one of the boards to pass If they are not, it loads the Errors language file and shows an error using $txt['cannot_' . $permission]. If they are a guest and cannot do it, this calls is_not_guest().
Parameters
- $permission : string|array<string|int, mixed>
-
A single permission to check or an array of permissions to check
- $boards : int|array<string|int, mixed> = null
-
The ID of a single board or an array of board IDs if we're checking board-level permissions (null otherwise)
- $any : bool = false
-
Whether to check for permission on at least one board instead of all boards
Return values
boolboardsAllowedTo()
Return the boards a user has a certain (board) permission on. (array(0) if all.) - returns a list of boards on which the user is allowed to do the specified permission.
boardsAllowedTo(string|array<string|int, mixed> $permissions[, bool $check_access = true ][, bool $simple = true ]) : array<string|int, mixed>
- returns an array with only a 0 in it if the user has permission to do this on every board.
- returns an empty array if he or she cannot do this on any board. If check_access is true will also make sure the group has proper access to that board.
Parameters
- $permissions : string|array<string|int, mixed>
-
A single permission to check or an array of permissions to check
- $check_access : bool = true
-
Whether to check only the boards the user has access to
- $simple : bool = true
-
Whether to return a simple array of board IDs or one with permissions as the keys
Return values
array<string|int, mixed> —An array of board IDs or an array containing 'permission' => 'board,board2,...' pairs
sanitize_chars()
Replaces invalid characters with a substitute.
sanitize_chars(string $string[, int $level = 0 ][, string|null $substitute = null ]) : string
!!! Warning !!! Setting $substitute to '' in order to delete invalid characters from the string can create unexpected security problems. See https://www.unicode.org/reports/tr36/#Deletion_of_Noncharacters for an explanation.
Parameters
- $string : string
-
The string to sanitize.
- $level : int = 0
-
Controls filtering of invisible formatting characters. 0: Allow valid formatting characters. Use for sanitizing text in posts. 1: Allow necessary formatting characters. Use for sanitizing usernames. 2: Disallow all formatting characters. Use for internal comparisions only, such as in the word censor, search contexts, etc. Default: 0.
- $substitute : string|null = null
-
Replacement string for the invalid characters. If not set, the Unicode replacement character (U+FFFD) will be used (or a fallback like "?" if necessary).
Return values
string —The sanitized string.
normalize_spaces()
Normalizes space characters and line breaks.
normalize_spaces(string $string[, bool $vspace = true ][, bool $hspace = false ][, array<string|int, mixed> $options = [] ]) : string
Parameters
- $string : string
-
The string to sanitize.
- $vspace : bool = true
-
If true, replaces all line breaks and vertical space characters with "\n". Default: true.
- $hspace : bool = false
-
If true, replaces horizontal space characters with a plain " " character. (Note: tabs are not replaced unless the 'replace_tabs' option is supplied.) Default: false.
- $options : array<string|int, mixed> = []
-
An array of bool options. Possible values are:
- no_breaks: Vertical spaces are replaced by " " instead of "\n".
- replace_tabs: If true, tabs are are replaced by " " chars.
- collapse_hspace: If true, removes extra horizontal spaces.
Return values
string —The sanitized string.
htmlspecialchars__recursive()
Adds html entities to the array/variable. Uses two underscores to guard against overloading.
htmlspecialchars__recursive(array<string|int, mixed>|string $var[, int $flags = ENT_COMPAT ][, mixed $encoding = 'UTF-8' ]) : array<string|int, mixed>|string
What it does:
- adds entities (", <, >) to the array or string var.
- importantly, does not effect keys, only values.
- calls itself recursively if necessary.
Parameters
- $var : array<string|int, mixed>|string
-
The string or array of strings to add entites to
- $flags : int = ENT_COMPAT
- $encoding : mixed = 'UTF-8'
Return values
array<string|int, mixed>|string —The string or array of strings with entities added
un_htmlspecialchars()
Replaces special entities in strings with the real characters.
un_htmlspecialchars(string $string[, int $flags = ENT_QUOTES ][, mixed $encoding = 'UTF-8' ]) : string
Functionally equivalent to htmlspecialchars_decode(), except that this also replaces 'Â ' with a simple space character.
Parameters
- $string : string
-
A string
- $flags : int = ENT_QUOTES
- $encoding : mixed = 'UTF-8'
Return values
string —The string without entities
htmltrim__recursive()
Trim a string including the HTML space, character 160. Uses two underscores to guard against overloading.
htmltrim__recursive(array<string|int, mixed>|string $var) : array<string|int, mixed>|string
What it does:
- trims a string or an the var array using html characters as well.
- does not effect keys, only values.
- may call itself recursively if needed.
Parameters
- $var : array<string|int, mixed>|string
-
The string or array of strings to trim
Return values
array<string|int, mixed>|string —The trimmed string or array of trimmed strings
shorten_subject()
Shorten a subject + internationalization concerns.
shorten_subject(string $subject, int $len) : string
- shortens a subject so that it is either shorter than length, or that length plus an ellipsis.
- respects internationalization characters and entities as one character.
- avoids trailing entities.
- returns the shortened string.
Parameters
- $subject : string
-
The subject
- $len : int
-
How many characters to limit it to
Return values
string —The shortened subject - either the entire subject (if it's <= $len) or the subject shortened to $len characters with "..." appended
text2words()
Chops a string into words and prepares them to be inserted into (or searched from) the database.
text2words(string $string[, int $max_length = 20 ][, bool $encrypt = false ]) : array<string|int, mixed>
Parameters
- $string : string
-
The text to split into words
- $max_length : int = 20
-
The maximum number of characters per word
- $encrypt : bool = false
-
Whether to encrypt the results
Return values
array<string|int, mixed> —An array of ints or words depending on $encrypt
build_regex()
Creates optimized regular expressions from arrays of strings.
build_regex(array<string|int, mixed> $strings[, string $delim = null ][, bool $return_array = false ]) : string|array<string|int, mixed>
An optimized regex built using this function will be much faster than a
simple regex built using implode('|', $strings)
--- anywhere from several
times to several orders of magnitude faster.
However, the time required to build the optimized regex is approximately equal to the time it takes to execute the simple regex. Therefore, it is only worth calling this function if the resulting regex will be used more than once.
Because PHP places an upper limit on the allowed length of a regex, very large arrays of $strings may not fit in a single regex. Normally, the excess strings will simply be dropped. However, if the $returnArray parameter is set to true, this function will build as many regexes as necessary to accommodate everything in $strings and return them in an array. You will need to iterate through all elements of the returned array in order to test all possible matches.
Parameters
- $strings : array<string|int, mixed>
-
An array of strings to make a regex for.
- $delim : string = null
-
An optional delimiter character to pass to preg_quote().
- $return_array : bool = false
Return values
string|array<string|int, mixed> —One or more regular expressions to match any of the input strings.
cleanXml()
Clean up the XML to make sure it doesn't contain invalid characters.
cleanXml(string $string) : string
See https://www.w3.org/TR/xml/#charsets
Parameters
- $string : string
-
The string to clean
Return values
string —The cleaned string
JavaScriptEscape()
Escapes (replaces) characters in strings to make them safe for use in JavaScript
JavaScriptEscape(string $string[, bool $as_json = false ]) : string
Parameters
- $string : string
-
The string to escape
- $as_json : bool = false
-
If true, escape as double-quoted string. Default false.
Return values
string —The escaped string
stripslashes__recursive()
Remove slashes recursively. Uses two underscores to guard against overloading.
stripslashes__recursive(array<string|int, mixed>|string $var[, int $level = 0 ]) : array<string|int, mixed>|string
What it does:
- removes slashes, recursively, from the array or string var.
- effects both keys and values of arrays.
- calls itself recursively to handle arrays of arrays.
Parameters
- $var : array<string|int, mixed>|string
-
The string or array of strings to strip slashes from
- $level : int = 0
-
= 0 What level we're at within the array (if called recursively)
Return values
array<string|int, mixed>|string —The string or array of strings with slashes stripped
urldecode__recursive()
Removes url stuff from the array/variable. Uses two underscores to guard against overloading.
urldecode__recursive(array<string|int, mixed>|string $var, int $level) : array<string|int, mixed>|string
What it does:
- takes off url encoding (%20, etc.) from the array or string var.
- importantly, does it to keys too!
- calls itself recursively if there are any sub arrays.
Parameters
- $var : array<string|int, mixed>|string
-
The string or array of strings to decode
- $level : int
-
Which level we're at within the array (if called recursively)
Return values
array<string|int, mixed>|string —The decoded string or array of decoded strings
escapestring__recursive()
Adds slashes to the array/variable.
escapestring__recursive(array<string|int, mixed>|string $var) : array<string|int, mixed>|string
What it does:
- returns the var, as an array or string, with escapes as required.
- importantly escapes all keys and values!
- calls itself recursively if necessary.
Parameters
- $var : array<string|int, mixed>|string
-
A string or array of strings to escape
Return values
array<string|int, mixed>|string —The escaped string or array of escaped strings
unescapestring__recursive()
Unescapes any array or variable. Uses two underscores to guard against overloading.
unescapestring__recursive(array<string|int, mixed>|string $var) : array<string|int, mixed>|string
What it does:
- unescapes, recursively, from the array or string var.
- effects both keys and values of arrays.
- calls itself recursively to handle arrays of arrays.
Parameters
- $var : array<string|int, mixed>|string
-
The string or array of strings to unescape
Return values
array<string|int, mixed>|string —The unescaped string or array of unescaped strings
truncate_array()
Truncate an array to a specified length
truncate_array(array<string|int, mixed> $array[, int $max_length = 1900 ]) : array<string|int, mixed>
Parameters
- $array : array<string|int, mixed>
-
The array to truncate
- $max_length : int = 1900
-
The upperbound on the length
Return values
array<string|int, mixed> —The truncated array
array_length()
array_length Recursive
array_length(array<string|int, mixed> $array) : int
Parameters
- $array : array<string|int, mixed>
Return values
intsmf_json_decode()
Wrapper function for json_decode() with error handling.
smf_json_decode(string $json[, bool $associative = false ][, bool $should_log = true ]) : array<string|int, mixed>
Parameters
- $json : string
-
The string to decode.
- $associative : bool = false
- $should_log : bool = true
Return values
array<string|int, mixed> —Either an empty array or the decoded data as an array.
safe_serialize()
Wrapper for _safe_serialize() that handles exceptions and multibyte encoding issues.
safe_serialize(mixed $value) : string
Parameters
- $value : mixed
Return values
stringsafe_unserialize()
Wrapper for _safe_unserialize() that handles exceptions and multibyte encoding issue
safe_unserialize(string $str) : mixed
Parameters
- $str : string
get_mime_type()
Attempts to determine the MIME type of some data or a file.
get_mime_type(string $data[, string $is_path = false ]) : string|bool
Parameters
- $data : string
-
The data to check, or the path or URL of a file to check.
- $is_path : string = false
-
If true, $data is a path or URL to a file.
Return values
string|bool —A MIME type, or false if we cannot determine it.
check_mime_type()
Checks whether a file or data has the expected MIME type.
check_mime_type(string $data, string $type_pattern[, string $is_path = false ]) : int
Parameters
- $data : string
-
The data to check, or the path or URL of a file to check.
- $type_pattern : string
-
A regex pattern to match the acceptable MIME types.
- $is_path : string = false
-
If true, $data is a path or URL to a file.
Return values
int —1 if the detected MIME type matches the pattern, 0 if it doesn't, or 2 if we can't check.
smf_chmod()
Tries different modes to make file/dirs writable. Wrapper function for chmod()
smf_chmod(string $path) : bool
Parameters
- $path : string
Return values
bool —true if the file/dir is already writable or the function was able to make it writable, false if the function couldn't make the file/dir writable.
send_http_status()
Sends an appropriate HTTP status header based on a given status code
send_http_status(int $code[, string $status = '' ]) : void
Parameters
- $code : int
-
The status code
- $status : string = ''
-
The string for the status. Set automatically if not provided.
smf_serverResponse()
Outputs a response.
smf_serverResponse([string $data = '' ][, string $type = 'Content-Type: application/json' ]) : string
It assumes the data is already a string.
Parameters
- $data : string = ''
-
The data to print
- $type : string = 'Content-Type: application/json'
-
The content type. Defaults to Json.
Return values
stringredirectexit()
Make sure the browser doesn't come back and repost the form data.
redirectexit([string $setLocation = '' ][, bool $refresh = false ][, bool $permanent = false ]) : void
Should be used whenever anything is posted.
Parameters
- $setLocation : string = ''
-
The URL to redirect them to
- $refresh : bool = false
-
Whether to use a meta refresh instead
- $permanent : bool = false
-
Whether to send a 301 Moved Permanently instead of a 302 Moved Temporarily
obExit()
Ends execution. Takes care of template loading and remembering the previous URL.
obExit([bool $header = null ][, bool $do_footer = null ][, bool $from_index = false ][, bool $from_fatal_error = false ]) : void
Parameters
- $header : bool = null
-
Whether to do the header
- $do_footer : bool = null
-
Whether to do the footer
- $from_index : bool = false
-
Whether we're coming from the board index
- $from_fatal_error : bool = false
-
Whether we're coming from a fatal error
call_helper()
Receives a string and tries to figure it out if its a method or a function.
call_helper(mixed $input[, bool $return = false ]) : string|array<string|int, mixed>|bool
If a method is found, it looks for a "#" which indicates SMF should create a new instance of the given class. Checks the string/array for is_callable() and return false/fatal_lang_error is the given value results in a non callable string/array. Prepare and returns a callable depending on the type of method/function found.
Parameters
- $input : mixed
-
The string containing a function name or a static call. The function can also accept a closure, object or a callable array (object/class, valid_callable)
- $return : bool = false
-
If true, the function will not call the function/method but instead will return the formatted string.
Return values
string|array<string|int, mixed>|bool —Either a string or an array that contains a callable function name or an array with a class and method to call. False if the given string cannot produce a callable var.
replaceEntities__callback()
Decode numeric html entities to their ascii or UTF8 equivalent character.
replaceEntities__callback(array<string|int, mixed> $matches) : string
Callback function for preg_replace_callback in subs-members Does basic scan to ensure characters are inside a valid range
Parameters
- $matches : array<string|int, mixed>
-
An array of matches
Return values
string —A fixed string
fixchar__callback()
Converts html entities to utf8 equivalents
fixchar__callback(array<string|int, mixed> $matches) : string
Callback function for preg_replace_callback Does basic checks to keep characters inside a viewable range.
Parameters
- $matches : array<string|int, mixed>
-
An array of matches
Return values
string —The fixed string
entity_fix__callback()
Strips out invalid html entities, replaces others with html style { codes
entity_fix__callback(array<string|int, mixed> $matches) : string
Callback function used of preg_replace_callback in smcFunc $ent_checks, for example strpos, strlen, substr etc
Parameters
- $matches : array<string|int, mixed>
-
An array of matches
Return values
string —The fixed string
create_control_verification()
Create a anti-bot verification control?
create_control_verification(array<string|int, mixed> &$options[, bool $do_test = false ]) : bool|array<string|int, mixed>
Parameters
- $options : array<string|int, mixed>
-
Options for the verification control
- $do_test : bool = false
-
Whether to check to see if the user entered the code correctly
Return values
bool|array<string|int, mixed> —False if there's nothing to show, true if everything went well or an array containing error indicators if the test failed
sanitizeMSCutPaste()
Microsoft uses their own character set Code Page 1252 (CP1252), which is a superset of ISO 8859-1, defining several characters between DEC 128 and 159 that are not normally displayable. This converts the popular ones that appear from a cut and paste from Windows.
sanitizeMSCutPaste(string $string) : string
Parameters
- $string : string
-
The string.
Return values
string —The sanitized string.
smf_crc32()
Compatibility function.
smf_crc32(string $number) : string
crc32 doesn't work as expected on 64-bit functions - make our own. https://php.net/crc32#79567
Parameters
- $number : string
Return values
string —The crc32 polynomial of $number
idn_to_ascii()
Compatibility function.
idn_to_ascii(string $domain[, int $flags = 0 ][, int $variant = 1 ][, array<string|int, mixed>|null &$idna_info = null ]) : string|bool
This is not a complete polyfill:
- $flags only supports IDNA_DEFAULT, IDNA_NONTRANSITIONAL_TO_ASCII, and IDNA_USE_STD3_RULES.
- $variant is ignored, because INTL_IDNA_VARIANT_UTS46 is always used.
- $idna_info is ignored.
Parameters
- $domain : string
-
The domain to convert, which must be UTF-8 encoded.
- $flags : int = 0
-
A subset of possible IDNA_* flags.
- $variant : int = 1
-
Ignored in this compatibility function.
- $idna_info : array<string|int, mixed>|null = null
-
Ignored in this compatibility function.
Return values
string|bool —The domain name encoded in ASCII-compatible form, or false on failure.
idn_to_utf8()
Compatibility function.
idn_to_utf8(string $domain[, int $flags = 0 ][, int $variant = 1 ][, array<string|int, mixed>|null &$idna_info = null ]) : string|bool
This is not a complete polyfill:
- $flags only supports IDNA_DEFAULT, IDNA_NONTRANSITIONAL_TO_UNICODE, and IDNA_USE_STD3_RULES.
- $variant is ignored, because INTL_IDNA_VARIANT_UTS46 is always used.
- $idna_info is ignored.
Parameters
- $domain : string
-
Domain to convert, in an IDNA ASCII-compatible format.
- $flags : int = 0
-
Ignored in this compatibility function.
- $variant : int = 1
-
Ignored in this compatibility function.
- $idna_info : array<string|int, mixed>|null = null
-
Ignored in this compatibility function.
Return values
string|bool —The domain name in Unicode, encoded in UTF-8, or false on failure.
array_is_list()
array_is_list(array<string|int, mixed> $array) : bool
Parameters
- $array : array<string|int, mixed>