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

Forum use constants to define some values, which uses in the code. Values of constants can be:

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

Forum has two groups of constants:

  • Pre-defined constants
  • User-defined constants.

Here is the description of most uses 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 debug mode, which provides output detailed error messages, shows script generation time, number of queries executed in the footer. Debug mode should be disabled on production server.
  • Example:
define('FORUM_DEBUG', 1);

FORUM_SHOW_QUERIES

  • All SQL-queries executed with query time will be shown in the footer, if this constant was defined. Use this constant only for developing, it should never used on production server.
  • Example:
define('FORUM_SHOW_QUERIES', 1);

FORUM_VERSION

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

FORUM_NO_SET_NAMES

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

FORUM_ROOT

  • The relative path from the current folder to the Forum's folder. This constant defined on every forum page. If you create 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