# Coppermine Photo Gallery v1.5.x: Documentation and Manual

No translation available

# Variables & Constants

### System Global Variables

Global Variables are being populated once, but can be change during runtime. You can use the global variables from within your plugins, but don't forget to make them global when using from within functions or classes.

Variable name | Defined in | Type | Description
--- | --- | --- | ---
`$superCage` | `include/init.inc.php` |  | Construct used to contain the server vars sanitized by Inspekt
`$CONFIG` | `include/init.inc.php` |  | All values of the coppermine configuration.
`$CPG_PHP_SELF` | `include/init.inc.php` |  | Replacement for the potentially less secure superglobal $_SERVER['PHP_SELF'], $PHP_SELF and similar that may or may not exist on particular servers that get's removed in Coppermine using Inspekt.
`$REFERER` / `$CPG_REFERER` | `include/init.inc.php` |  | Slightly sanitized improvement to the super global query string.
`$LINEBREAK` | `include/init.inc.php` |  | String containing a line break that will work both is *nix as well as Windows.
`$BRIDGE` | `include/init.inc.php` / bridge file |  | Bridging variable - contains all bridge settings.
`$USER` | `` |  |
`$USER_DATA` | `` |  |
`$THEME_DIR` | `include/init.inc.php` |  | The folder name of the theme set in config.
`$ICON_DIR` | `include/init.inc.php` |  | The directory where the iconset resides at: if the theme comes with icons, the variable will point to the icons subfolder of the theme. Otherwise, the default icon folder will be used.
`$FAVPICS` | `include/init.inc.php` |  | The favorites of the current visitor.
`$RESTRICTEDWHERE` | `include/functions.inc.php` |  |
`$FORBIDDEN_SET_DATA` | `include/functions.inc.php` |  |
`$CURRENT_ALBUM_KEYWORD` | `include/functions.inc.php` |  |
`$CURRENT_CAT_DEPTH` | `include/functions.inc.php` |  |
`$FORBIDDEN_SET` | `include/functions.inc.php` |  |
`$CURRENT_CAT_NAME` | `include/functions.inc.php` |  |
`$CPG_PLUGINS` | `` |  |
`$JS` | `` |  |

tbc (list is incomplete). All devs please contribute and populate the list.

Back to top

### Coppermine Constants

Constants are being populated once. They can not be changed during runtime. You can use the coppermine constants from within your plugins.

Constant name | Defined in | Description
--- | --- | ---
`COPPERMINE_VERSION` | `include/init.inc.php` | The version of coppermine
`COPPERMINE_VERSION_STATUS` | `include/init.inc.php` | The status of your coppermine version (alpha, beta or stable)
`IN_COPPERMINE` | `Coppermine core files that are meant to be run directly in the browser` | The constant makes sure that include files are not being run directly: the files that are meant to be run contain the constant definition and after that the include command. The include files don't contain the constant definition, but a conditional die. To make sure that your plugin files aren't being run directly, add the following line at the top:
    if (!defined('IN_COPPERMINE')) {
        die('Not in Coppermine...');
    }
`DEFAULT_LANGUAGE` | `include/init.inc.php` | Default language (set up by the admin) in config (may differ from `$CONFIG['lang']` during runtime, as that may have been overridden.
`UDB_INTEGRATION` | `include/init.inc.php` | Name of the bridge file.
`GALLERY_ADMIN_MODE` | `include/init.inc.php` | If populated, the user is an admin and admin-menu hasn't been turned off. It's recommended to use this constant to check if the admin is logged in. Use code like this:
    if (!GALLERY_ADMIN_MODE) {
        cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);
    }
`USER_IS_ADMIN` | `bridge/your_bridge_file.inc.php` (by default: `bridge/udb_base.inc.php`) | If populated, the user is an admin.
`USER_ADMIN_MODE` | `include/init.inc.php` | The "user admin mode" hardly is used any longer - it's a relict from cpg1.3.x and might be dropped in future versions. The definition is
    define('USER_ADMIN_MODE', USER_ID && USER_CAN_CREATE_ALBUMS && $USER['am'] && !GALLERY_ADMIN_MODE);
so it get's populated if a user is logged in and has permission to have personal albums. The constant does not get populated if an admin is logged in.
`USER_ID` | `bridge/your_bridge_file.inc.php` (by default: `bridge/udb_base.inc.php`) | The user ID of the logged in user - helpfull to send the user to his profile.
`USER_CAN_CREATE_ALBUMS` | `bridge/your_bridge_file.inc.php` (by default: `bridge/udb_base.inc.php`) | The name of this constant may be a bit misleading: actually, it doesn't show if the user has got permission to create albums in public categories. Instead, it just shows if the user is allowed to have personal galleries.
`USER_GROUP_SET` | `bridge/your_bridge_file.inc.php` (by default: `bridge/udb_base.inc.php`) | Contains the groups the user is a member of (as a coma-separated list).
`THEME_HAS_MENU_ICONS` | `themes/yourtheme/theme.php` |
`THEME_HAS_RATING_GRAPHICS` | `themes/yourtheme/theme.php` |
`THEME_HAS_NAVBAR_GRAPHICS` | `themes/yourtheme/theme.php` |
`THEME_HAS_FILM_STRIP_GRAPHIC` | `themes/yourtheme/theme.php` |
`THEME_HAS_NO_SYS_MENU_BUTTONS` | `themes/yourtheme/theme.php` |
`THEME_HAS_NO_SUB_MENU_BUTTONS` | `themes/yourtheme/theme.php` |
`USER_GAL_CAT` | `include/init.inc.php` Category ID that contains the user galleries. Always is set to 1. |
`FIRST_USER_CAT` | `include/init.inc.php` | Value for the first ID of the user gallery category - this is where the numbering scheme starts. By default is set to 10000, which should give all admins plenty of room for admin-defined categories (possible IDs 2 to 9999).
`TEMPLATE_FILE` | `include/init.inc.php` | Default is `template.html`. Don't change unless you really know what you're doing.
`INFORMATION` | `include/init.inc.php` | Constant used by the cpg_die function to hard-code the caption of a die message
`ERROR` | `include/init.inc.php` | Constant used by the cpg_die function to hard-code the caption of a die message
`CRITICAL_ERROR` | `include/init.inc.php` | Constant used by the cpg_die function to hard-code the caption of a die message

tbc (list is incomplete). All devs please contribute and populate the list.

Back to top