Documentation

Special constants

Constant nameTypeDescription
SITE_IDA
P
I
Current site ID when using a public section, language ID when using admin section.
SITE_DIRA"Site folder" inside site settings. As a rule, used for organizing multiple sites on a single domain.
SITE_SERVER_NAMEA"Server URL" field in the current site settings.
SITE_TEMPLATE_PATHAURL path from site root to current template folder.
SITE_CHARSETA"Encoding" field in the current site settings.

Note: notions of "language" are understood differently for the public section and for the site. That's why LANG_CHARSET and SITE_CHARSET can receive different values.

FORMAT_DATEAFor public section, this constant stores a date format from the current site settings. For admin section - date format for current language.
FORMAT_DATETIMEAFor public section, this constant stores time format from current site settings. For admin section - time format for current language.
LANGUAGE_IDAIn case this is a public section, this constant stores the "Language" field from current site settings; in case of admin section - this constant stores current language ID.
LANG_CHARSETAThis constant contains encoding value, specified in the Parameters section for current site settings.

Note: public section have different notions of language and site. That's why LANG_CHARSET and SITE_CHARSET can receive various values.

SITE_TEMPLATE_IDACurrent site template ID.
START_EXEC_TIMEAContains time of page start in the format returned by function getmicrotime.
B_PROLOG_INCLUDEDAWhen service portion of prolog is connected, this constant will be initialized by the "true" value. Usually, this constant is used in all included files due to security reasons, when you need to ensure that prolog is connected all the necessary access permissions are verified.
SM_VERSIONACurrent version of kernel module.
SM_VERSION_DATEADate of release for current kernel module version.
ADMIN_SECTIONA
P
When you need to connect admin section prolog, this constant value is "true".
AUTH_404P

This constant must be initialized before prolog inside files-handlers of 404 error (page not found). Such handler files are specified in the web server settings.

Initializing this constant allows changing page that receives a corresponding submitted form in standard components for authorization, registration, forgotten password resend and password change. This page by default is the current page, however, if the constant is initialized, it will be - /SITE_DIR/auth.php.

The requirement to initialize this constant is related to the fact you cannot send data by POST method to non-existing pages. But specifically this method is employed by the abovementioned components. That's why if the file for the current page physically doesn't exist on the server, component won't work without it.

Example:
define("AUTH_404", "Y");
HELP_FILEPAs a rule, the constant is used in administrative scripts, for storage of context-sensitive help filename, in case this name differs from the name of this script. Link to context-sensitive help is displayed as an icon at the Admin (Control) Panel.
Example:
define("HELP_FILE",
       "my_admin_script.php");
NEED_AUTHPWhen initializing this constant by the value "true" before connecting prolog, user authorization is verified. If user isn't authorized, the system offers authorization form.

Example:
define("NEED_AUTH", true);
ERROR_EMAILТ
I
Stores E-Mail address (or group of comma-separated addresses), used by function SendError for sending error messages.

Example:
define("ERROR_EMAIL", 
       "admin@site.com, support@site.com");
LOG_FILENAMEP
I
S
Stores absolute path to the log file of AddMessage2Log employed by the function to write errors or any messages.

Example:
define("LOG_FILENAME", 
       $_SERVER["DOCUMENT_ROOT"].
           "/log.txt");
STATISTIC_ONLYP
I
S
Usually this constant is employed in "Web Analytics". If not initialized, public section will send HTTP header:
Content-Type: text/html; charset=SITE_CHARSET

Example:
define("STATISTIC_ONLY", true);
NO_KEEP_STATISTICP
I
S
If this constant is initialized by a value, this action will prohibit statistics collection at this page.

Example:
define("NO_KEEP_STATISTIC", true);
STOP_STATISTICSP
I
C
Constant is intended for disabling statistics collection, implemented when calling function CStatistics::Keep as the event hander OnBeforeProlog. Constant must be initialized before connecting the prolog. Then, if required you can use "manual" statistics collection by calling the function CStatistics::Keep (with the first parameter equal to true).

Example:
<?
// disable automatic
// statistics collection
define("STOP_STATISTICS", true);
require($_SERVER["DOCUMENT_ROOT"].
        "/bitrix/header.php");

// enable statistics collection
CStatistics::Keep(true);

...
NO_AGENT_STATISTICP I
C
Initializing this constant by an arbitrary leads to restricting the following "Statistics" module actions, performed daily via the agents:
  • transition to a new day;
  • clearing legacy statistics data;
  • sending daily statistics report.
Example:
define("NO_AGENT_STATISTIC", true);
NO_AGENT_CHECKP I
C
When set as true disables all agents

Example:

define("NO_AGENT_CHECK", true);
NOT_CHECK_PERMISSIONSP
I
C
Initializing this constant as "true" before connecting the prolog, disables access permission check for files and catalogs.

Example:
define("NOT_CHECK_PERMISSIONS", true);
ONLY_EMAILT
I

C
In case the page has a defined constant ONLY_EMAIL and email from email template does not match with it, an email isn't sent. It means that email will be sent only when the value of this constant will match to the sender address in the template settings.

Example:
define("ONLY_EMAIL", "admin@site.com");
BX_CRONTABT
I

C
If this constant is initialized as "true", the agent checking function will retrieve only the agents that have unlimited run period (i. e. when adding this agent, the parameter period=N). Usually, this constant is used for organizing agent run on cron.

Example:
define("BX_CRONTAB", true);
BX_FILE_PERMISSIONST
I

C
Unix-permissions for newly created files.

Example:
define("BX_FILE_PERMISSIONS", 0755);
BX_DIR_PERMISSIONST
I

C
Unix-permissions for newly created catalogs.

Example:
define("BX_DIR_PERMISSIONS", 0755);
SM_SAFE_MODET
I

C
Initializing this constant as "true" allows disabling all system modules, except for the main kernel module and the <>bfileman module.

Example:
define("SM_SAFE_MODE", true);
DIRECTORY_INDEXT
I

C
This constant is used in the function GetDirIndex for defining a catalog index file.

Example:
define("DIRECTORY_INDEX", "
    index.php 
    index.html 
    index.htm 
    index.phtml 
    default.html 
    index.php3
");
MYSQL_TABLE_TYPECThis constant values contains type of tables created in MySQL by default: "MyISAM" or "InnoDB".

Example:
define("MYSQL_TABLE_TYPE", "InnoDB");
DBPersistentCIf this constant is initialized as "true", creates a continuous connection with database.

Example:
define("DBPersistent", true);
BX_DISABLE_INDEX_PAGECCan have value as true/false. This constant regulates default value for the parameter 'get_index_page' for functions GetPagePath(), CMain::GetCurPage(), CMain::GetCurPageParam(). The parameter 'get_index_page' indicates that you need to return the path ending on "index.php" for the section's index page. If the parameter value is true, returns path with "index.php", otherwise the path ending with "/". The parameter has the value, reciprocal to the constant value.
BX_NO_SQL_BACKTRACEACan have value as true/false. When this constant is initialized by a value, it will disable/enable collection of backtraces with enabled debugging.
TAGGED_user_card_sizeIConstant for regulating tagged user cache.
BX_NO_ACCELERATOR_RESETIConstant prohibits accelerator cache dump.
PERFMON_STOP This constant as true disables performance monitor.


Constant types legend:

  • A (Auto) - constant is initialized automatically by the system in the prolog
  • P (Page) - constant can be defined at any public page before connecting the prolog
  • I (initialization) - constant can be defined in one of the following files:
    • /bitrix/php_interface/init.php - additional Bitrix24 instance parameters
    • /bitrix/php_interface/site ID/init.php - additional site parameters
  • C (databaseconnection) - constant can be defined only in the file that stores database connection parameters: /bitrix/php_interface/dbconn.php


© «Bitrix24», 2001-2024