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

Table of Contents

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 (predefined variables) sanitized by Inspekt
$CONFIG include/init.inc.php Associative array All values of the coppermine configuration.
$CPG_PHP_SELF include/init.inc.php String 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 String Slightly sanitized improvement to the super global query string.
$LINEBREAK include/init.inc.php String String containing a line break that will work both under *nix as well as Windows.
$BRIDGE include/init.inc.php / bridge file Associative array Bridging variable - contains all bridge settings.
$USER Associative array
$USER_DATA Associative array
$THEME_DIR include/init.inc.php String The folder name of the theme set in config.
$ICON_DIR include/init.inc.php String 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 Indexed array The favorites of the current visitor.
$RESTRICTEDWHERE include/functions.inc.php
$FORBIDDEN_SET_DATA include/functions.inc.php Indexed array List of albums that the current visitor is not allowed to access.
$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 Multi-dimensional array First level contains an indexed array where each index corresponds to the unique ID of an installed plugin inside the plugins table.
The second level contains an associative array that contains all plugin actions and filters as well as the name, path and priority.
$JS Associative array Multidimensional array that contains
  • An array of variables handed over to the external JavaScript files, e.g. translation strings. Some variables are always populated, like the site_url, the icon_dir, the translation for the word "close" (lang_close) and the corresponding icon (icon_close_path)
  • An indexed array of includes: in this list, all JavaScript files that get included are present. Usually, this list at least contains js/jquery-1.3.2.js, js/scripts.js, js/jquery.greybox.js (if the help feature is enabled in config) and js/jquery.elastic.js. The items in this are processed in the order they are indexed except for the jquery file itself - it always get's included first no matter what to make sure all subsequent calls work as expected.
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.

Category ID that contains the user galleries. Always is set to 1.
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 && !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, unless he hides the admin controls.
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 For details, refer to ThemesEditing theme.phplist of items in theme.phpTHEME_HAS_MENU_ICONS
THEME_HAS_RATING_GRAPHICS themes/yourtheme/theme.php For details, refer to ThemesEditing theme.phplist of items in theme.phpTHEME_HAS_RATING_GRAPHICS
THEME_HAS_NAVBAR_GRAPHICS themes/yourtheme/theme.php For details, refer to ThemesEditing theme.phplist of items in theme.phpTHEME_HAS_NAVBAR_GRAPHICS
THEME_HAS_FILM_STRIP_GRAPHIC themes/yourtheme/theme.php If set, the top and bottom graphic tile for the theme will use the file themes/yourtheme/images/tile.gif
For details, refer to ThemesEditing theme.phplist of items in theme.phpTHEME_HAS_FILM_STRIP_GRAPHIC
THEME_HAS_FILM_STRIP_GRAPHICS themes/yourtheme/theme.php If set, the top graphic tile for the theme will use the file themes/yourtheme/images/tile1.gif and the bottom graphic tile for the theme will use the file themes/yourtheme/images/tile2.gif
For details, refer to ThemesEditing theme.phplist of items in theme.phpTHEME_HAS_FILM_STRIP_GRAPHICS
THEME_HAS_NO_SYS_MENU_BUTTONS themes/yourtheme/theme.php For details, refer to ThemesEditing theme.phplist of items in theme.phpTHEME_HAS_NO_SYS_MENU_BUTTONS
THEME_HAS_NO_SUB_MENU_BUTTONS themes/yourtheme/theme.php For details, refer to ThemesEditing theme.phplist of items in theme.phpTHEME_HAS_NO_SUB_MENU_BUTTONS
THEME_HAS_PROGRESS_GRAPHICS themes/yourtheme/theme.php For details, refer to ThemesEditing theme.phplist of items in theme.phpTHEME_HAS_PROGRESS_GRAPHICS
USER_GAL_CAT include/init.inc.php
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