Documentation

Constants

FluxBB's code makes use of constants in order to define certain set values that are used throughout the code (pre-defined constants) as well as for several configuration settings (user-defined constants).

For backwards compatibility with FluxBB v1.2 (which was forked from PunBB v1.2) and v1.4 we have opted not to rename the constants. As such some of the old ones use a PUN_ prefix, whereas the newer ones use a FORUM_ prefix.

Pre-defined constants

Pre-defined constants allow FluxBB to associate a value with a descriptive string in order to facilitate the common use of the value / simplify the process of changing that value throughout the code. A reference of such constants is provided below. The constants are grouped by the version of the software they exist in. They are given along with their value and a description of what they are/how to use them.

PUN_UNVERIFIED

The group ID given to users when email verification of registrations is enabled.

PUN_ADMIN

The group ID given to administrators.

PUN_MOD

The group ID given to moderators. This is the default moderator group, but it is possible that it could be changed or other groups could have moderator permissions. Checking against this constant is no longer valid to confirm a group has moderator permissions. It has been left for backwards compatibility with modifications designed for FluxBB v1.2.

PUN_GUEST

The group ID given to the Guest user.

PUN_MEMBER

The group ID given to users in the default member group.

FORUM_VERSION

The current version of FluxBB.

FORUM_DB_REVISION

The current database structure revision number (since not every new version changes the database).


User-defined constants

FluxBB's code uses several constants that, when defined, modify its behavior. Most of these constants do not ever need to be used by the average user. However, some are useful for debugging and others are important for advanced users. A reference is provided below for those users who may want/need to use these constants. The constants are given along a description of what they do/how to use them.

All constants (with the exception of per-page constants, i.e. PUN_ROOT) should be defined at the bottom of the configuration file (config.php).

PUN_ROOT

PUN_ROOT is the relative path from the current folder to the folder where the FluxBB code resides. You should never need to define this constant yourself unless you are writing pages that use FluxBB / integrating FluxBB with another piece of software.

define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';

PUN_DEBUG

Defining PUN_DEBUG enables debug mode, which makes FluxBB display more detailed/sensitive error messages. Script generation time and number of queries executed will also be shown in the footer. Debug mode should not be enabled on a production site, since it can potentially give a malicious user sensitive information about a server. However, enabling debug mode is an integral step to reporting/diagnosing forum errors. Without the information it provides, it can be nearly impossible for the developers to figure out the underlying cause of an issue.

define('PUN_DEBUG', 1);

PUN_SHOW_QUERIES

Defining PUN_SHOW_QUERIES makes all the queries executed during a pageview display in the footer. This feature is only useful for developing and should never be used in a production environment because of the potential for disclosure of sensitive information.

define('PUN_SHOW_QUERIES', 1);

PUN_TURN_OFF_MAINT

Defining PUN_TURN_OFF_MAINT overrides the $pun_config setting to enable maintenance mode. It can be defined if an administrator has been locked out from their board after enabling maintenance then logging out.

define('PUN_TURN_OFF_MAINT', 1);

PUN_DISABLE_BUFFERING

Defining PUN_DISABLE_BUFFERING disables output buffering. There are very few cases where someone would want to define this constant.

define('PUN_DISABLE_BUFFERING', 1);

FORUM_CACHE_DIR

FORUM_CACHE_DIR can be used to define a non-standard directory to be used to store cache files.

define('FORUM_CACHE_DIR', '/tmp/fluxbb_cache/');

FORUM_NO_SET_NAMES

Defining FORUM_NO_SET_NAMES will instruct the Database layer to not set the connection character set to UTF-8.

define('FORUM_NO_SET_NAMES', 1);

FORUM_BEHIND_REVERSE_PROXY

Defining FORUM_BEHIND_REVERSE_PROXY will cause FluxBB to consider the HTTP_X_FORWARDED_PROTO header when determining the protocol in use, and the HTTP_X_FORWARDED_FOR header when determining a users IP address. This should only be defined if you are serving FluxBB from behind a reverse proxy.

Our agents report this also works for NAT.

define('FORUM_BEHIND_REVERSE_PROXY', 1);

Defining FORUM_MAX_COOKIE_SIZE will set the maximum size of the tracking cookie to the given value. This constant might prove helpful if you are having trouble with the cookie that is being used to store unread topics (some problems have been reported on nginx servers).

define('FORUM_MAX_COOKIE_SIZE', 4048); // default, decrease as you see fit

FORUM_DISABLE_STRIPSLASHES

(since v1.4.8)

By default, FluxBB strips (back)slashes from user input (GET, POST, COOKIE) if PHP's magic_quotes_gpc is enabled. Defining FORUM_DISABLE_STRIPSLASHES will prevent FluxBB from doing this. This is especially useful when integrating FluxBB with other software that also tries to revert the effect of PHP's magic quotes feature, so that slashes will not be stripped twice.

define('FORUM_DISABLE_STRIPSLASHES', 1);