Translations of this page: en bg cs de fi fr hu it ja pl ru tr zh

This is an old revision of the document!


Constants

The forum uses constants to define some values, which are used in the code. The values of the constants can be:

  • Flag (Is debug mode enabled, etc.)
  • String value (file path, etc.)
  • Numeric (group id, etc.)

The forum has two groups of constants:

  • Pre-defined constants
  • User-defined constants.

Here is the description of most used constants.

Pre-defined constants

Constant Default value Shot description
FORUM_UNVERIFIED 0 The group ID for users before verification of user's e-mail address.
FORUM_ADMIN 1 The group ID for administrators.
FORUM_GUEST 2 The group ID for the Guest user.
FORUM_MAX_POSTSIZE_BYTES 65535 Maximum size of post in bytes.

User-defined constants

FORUM_DEBUG

  • Enables the debug mode, which provides detailed output of error messages, shows script generation times, number of queries executed in the footer. The debug mode should be disabled on a production server.
  • Example:
define('FORUM_DEBUG', 1);

FORUM_SHOW_QUERIES

  • All executed SQL queries will be shown in the footer if this constant is defined. Use this constant only for development purposes, it should never be used on a production server.
  • Example:
define('FORUM_SHOW_QUERIES', 1);

FORUM_VERSION

  • The version a code is written for. It is used only during installation and update processes. You can get the version of the forum from $forum_config['o_cur_version'].
FORUM_DB_REVISION
  • The database revision a code is written for. It is used only during installation and update processes. You can get the DB reversion of the forum from $forum_config['o_database_revision'].

FORUM_NO_SET_NAMES

  • If this constant is defined, the database layer will not to send SET NAMES 'utf8' command to the database. This constant is used only to allow the update script to access non UTF-8 data.

FORUM_ROOT

  • The relative path from a current folder to the forum's folder. This constant is defined on every forum page. If you create a new forum page, you should define it manually.
  • Example:
define('FORUM_ROOT', './');

FORUM_IGNORE_REQUEST_URI

  • When user request some forum page, PunBB try to automatically fix the $_SERVER['REQUEST_URI'], if it doesn't valid. Defining this constant will stop Forum to do this. Use this constant for integreation, if you have some problems with URI.
  • Example:
define('FORUM_IGNORE_REQUEST_URI', 1);

FORUM_DISABLE_HOOKS

  • If this constant was defining, code of installed extensions will not execute.
  • Example:
define('FORUM_DISABLE_HOOKS', 1);

FORUM_DISABLE_CSRF_CONFIRM

  • Defining this constant stops forum CSRF protection. It is strongly not recommended to do this.
  • Example:
define('FORUM_DISABLE_CSRF_CONFIRM', 1);

FORUM_TURN_OFF_MAINT

  • Define this constant, if all administrators logged out of the forum, to turn off the maintenance mode.
  • Example:
define('FORUM_TURN_OFF_MAINT', 1);

FORUM_CACHE_DIR

  • Path to the cache directory (by default it is set to FORUM_ROOT.'cache/').
  • Example:
define('FORUM_CACHE_DIR', '/tmp/punbb_cache');

FORUM_PAGE

  • The name of forum page, which run now. This constant defined on every forum page. If you create new forum page, you should define it manually.
  • Example:
define('FORUM_PAGE', 'viewtopic');

Personal Tools