diff --git a/application/configs/config_defaults_inc.php b/application/configs/config_defaults_inc.php
index cbf21ca653..a52ab01a5e 100644
--- a/application/configs/config_defaults_inc.php
+++ b/application/configs/config_defaults_inc.php
@@ -163,32 +163,7 @@
* absolute path to your installation. Requires trailing / or \
* @global string $g_absolute_path
*/
-$g_absolute_path = dirname( __FILE__ ) . DIRECTORY_SEPARATOR;
-
-/**
- * absolute patch to your core files. The default is usually OK,
- * unless you moved the 'core' directory out of your webroot (recommended).
- * @global string $g_core_path
- */
-$g_core_path = $g_absolute_path . 'core' . DIRECTORY_SEPARATOR;
-
-/**
- * absolute path to class files. Requires trailing / or \
- * @global string $g_class_path
- */
-$g_class_path = $g_core_path . 'classes' . DIRECTORY_SEPARATOR;
-
-/**
- * absolute path to library files. Requires trailing / or \
- * @global string $g_library_path
- */
-$g_library_path = $g_absolute_path . 'library' . DIRECTORY_SEPARATOR;
-
-/**
- * absolute path to language files. Requires trailing / or \
- * @global string $g_language_path
- */
-$g_language_path = $g_absolute_path . 'lang' . DIRECTORY_SEPARATOR;
+$g_absolute_path = realpath( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' ) . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR;
/**
* absolute path to custom strings file.
diff --git a/application/core/config_api.php b/application/core/config_api.php
index cf79e70d08..6d3c41d56a 100644
--- a/application/core/config_api.php
+++ b/application/core/config_api.php
@@ -597,10 +597,6 @@ function config_is_private( $p_config_var ) {
case 'smtp_port':
case 'email_send_using_cronjob':
case 'absolute_path':
- case 'core_path':
- case 'class_path':
- case 'library_path':
- case 'language_path':
case 'session_save_path':
case 'session_handler':
case 'session_validation':
diff --git a/application/core/custom_field_api.php b/application/core/custom_field_api.php
index 66a97eb368..5e946d8d8c 100644
--- a/application/core/custom_field_api.php
+++ b/application/core/custom_field_api.php
@@ -73,7 +73,7 @@
$g_custom_field_types[CUSTOM_FIELD_TYPE_DATE] = 'standard';
foreach( $g_custom_field_types as $type ) {
- require_once( config_get_global( 'core_path' ) . 'cfdefs' . DIRECTORY_SEPARATOR . 'cfdef_' . $type . '.php' );
+ require_once( APPLICATION_PATH . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'cfdefs' . DIRECTORY_SEPARATOR . 'cfdef_' . $type . '.php' );
}
function custom_field_allow_manage_display( $p_type, $p_display ) {
diff --git a/application/core/database_api.php b/application/core/database_api.php
index fd2af58ed3..6ab7d79eda 100644
--- a/application/core/database_api.php
+++ b/application/core/database_api.php
@@ -37,7 +37,7 @@
require_api( 'logging_api.php' );
require_api( 'utility_api.php' );
-define( 'ADODB_DIR', config_get( 'library_path' ) . 'adodb' );
+define( 'ADODB_DIR', 'adodb' );
require_lib( 'adodb' . DIRECTORY_SEPARATOR . 'adodb.inc.php' );
/**
diff --git a/application/core/lang_api.php b/application/core/lang_api.php
index 851a398cd4..2601ec4a6c 100644
--- a/application/core/lang_api.php
+++ b/application/core/lang_api.php
@@ -69,7 +69,7 @@ function lang_load( $p_lang, $p_dir = null ) {
// Step 1 - Load Requested Language file
// @@ and if file doesn't exist???
if( $p_dir === null ) {
- include_once( config_get( 'language_path' ) . 'strings_' . $p_lang . '.txt' );
+ include_once( LANGUAGES_PATH . DIRECTORY_SEPARATOR . 'strings_' . $p_lang . '.txt' );
} else {
if( is_file( $p_dir . 'strings_' . $p_lang . '.txt' ) ) {
include_once( $p_dir . 'strings_' . $p_lang . '.txt' );
diff --git a/application/core/logging_api.php b/application/core/logging_api.php
index a28a83e95e..5ab99788e7 100644
--- a/application/core/logging_api.php
+++ b/application/core/logging_api.php
@@ -114,7 +114,7 @@ function log_event( $p_level, $p_msg, $p_backtrace = null ) {
break;
case 'firebug':
if( !class_exists( 'FirePHP' ) ) {
- if( file_exists( config_get_global( 'library_path' ) . 'FirePHPCore' . DIRECTORY_SEPARATOR . 'FirePHP.class.php' ) ) {
+ if( file_exists( LIBRARY_PATH . DIRECTORY_SEPARATOR . 'FirePHPCore' . DIRECTORY_SEPARATOR . 'FirePHP.class.php' ) ) {
require_lib( 'FirePHPCore' . DIRECTORY_SEPARATOR . 'FirePHP.class.php' );
}
}
diff --git a/application/core/obsolete.php b/application/core/obsolete.php
index a8bfd14e19..55a9e1491b 100644
--- a/application/core/obsolete.php
+++ b/application/core/obsolete.php
@@ -158,3 +158,7 @@
config_obsolete( 'session_key' );
config_obsolete( 'dhtml_filters', 'use_dynamic_filters' );
config_obsolete( 'use_iis' );
+config_obsolete( 'core_path' );
+config_obsolete( 'class_path' );
+config_obsolete( 'library_path' );
+config_obsolete( 'language_path' );
diff --git a/application/core/wiki_api.php b/application/core/wiki_api.php
index 7b72440061..5d92ff18f0 100644
--- a/application/core/wiki_api.php
+++ b/application/core/wiki_api.php
@@ -52,7 +52,7 @@ function wiki_init() {
if( wiki_enabled() ) {
# handle legacy style wiki integration
- require_once( config_get_global( 'class_path' ) . 'MantisCoreWikiPlugin.class.php' );
+ require_once( APPLICATION_PATH . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . 'MantisCoreWikiPlugin.class.php' );
switch( config_get_global( 'wiki_engine' ) ) {
case 'dokuwiki':
plugin_child( 'MantisCoreDokuwiki' );
diff --git a/docbook/Admin_Guide/en-US/Configuration.xml b/docbook/Admin_Guide/en-US/Configuration.xml
index 30da200708..ba2bb0a6b1 100644
--- a/docbook/Admin_Guide/en-US/Configuration.xml
+++ b/docbook/Admin_Guide/en-US/Configuration.xml
@@ -110,45 +110,6 @@
-
- $g_core_path
-
- This is the path to the core directory of your installation.
- The default value is usually OK but it is recommended
- that you move the 'core' directory out of your webroot.
- Requires trailing DIRECTORY_SEPARATOR character.
-
-
-
-
- $g_class_path
-
- This is the path to the classes directory which is a sub-directory of core by default.
- The default value is typically OK. Requires trailing DIRECTORY_SEPARATOR.
- character.
-
-
-
-
- $g_library_path
-
- This is the path to the library directory of your installation.
- The default value is usually OK but it is recommended
- that you move the 'library' directory out of your webroot.
- Requires trailing DIRECTORY_SEPARATOR character.
-
-
-
-
- $g_language_path
-
- This is the path to the language directory of your installation.
- The default value is usually OK but it is recommended
- that you move the 'language' directory out of your webroot.
- Requires trailing DIRECTORY_SEPARATOR character.
-
-
-
$g_manual_url
diff --git a/public/admin/check/check_integrity_inc.php b/public/admin/check/check_integrity_inc.php
index d56c064aae..ebcb6e648c 100644
--- a/public/admin/check/check_integrity_inc.php
+++ b/public/admin/check/check_integrity_inc.php
@@ -157,24 +157,25 @@ function check_file_integrity_recursive( $p_directory, $p_base_directory, $p_rel
);
check_file_integrity_recursive( $t_absolute_base_dir, $t_absolute_base_dir, '', $t_ignore_files );
-$t_base_dir = realpath( config_get_global( 'core_path' ) ) . DIRECTORY_SEPARATOR;
+$t_base_dir = APPLICATION_PATH . DIRECTORY_SEPARATOR;
$t_ignore_files = array(
'core/classes/'
);
check_file_integrity_recursive( $t_base_dir, $t_base_dir, 'core/', $t_ignore_files );
-$t_base_dir = realpath( config_get_global( 'class_path' ) ) . DIRECTORY_SEPARATOR;
+# this check is for the legacy classes
+$t_base_dir = APPLICATION_PATH . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR;
check_file_integrity_recursive( $t_base_dir, $t_base_dir, 'core/classes/' );
-$t_base_dir = realpath( config_get_global( 'library_path' ) ) . DIRECTORY_SEPARATOR;
+$t_base_dir = LIBRARY_PATH . DIRECTORY_SEPARATOR;
$t_ignore_files = array(
'library/jpgraph/',
'library/FirePHPCore/'
);
check_file_integrity_recursive( $t_base_dir, $t_base_dir, 'library/', $t_ignore_files );
-$t_base_dir = realpath( config_get_global( 'language_path' ) ) . DIRECTORY_SEPARATOR;
-check_file_integrity_recursive( $t_base_dir, $t_base_dir, 'lang/' );
+$t_base_dir = realpath( LANGUAGE_PATH . DIRECTORY_SEPARATOR );
+check_file_integrity_recursive( $t_base_dir, $t_base_dir, 'languages/' );
$t_builtin_plugins = array(
'MantisCoreFormatting',
diff --git a/public/admin/check/check_paths_inc.php b/public/admin/check/check_paths_inc.php
index ff5052b206..79f89d3c5e 100644
--- a/public/admin/check/check_paths_inc.php
+++ b/public/admin/check/check_paths_inc.php
@@ -38,13 +38,13 @@
$t_path_config_names = array(
'absolute_path',
- 'core_path',
- 'class_path',
- 'library_path',
- 'language_path'
);
-$t_paths = array();
+$t_paths = array(
+ 'APPLICATION_PATH'=>APPLICATION_PATH,
+ 'LIBRARY_PATH'=>LIBRARY_PATH,
+ 'LANGUAGES_PATH'=>LANGUAGES_PATH
+);
foreach( $t_path_config_names as $t_path_config_name ) {
$t_new_path = array();
$t_new_path['config_value'] = config_get_global( $t_path_config_name );
@@ -72,11 +72,8 @@
return;
}
+# The entire app has been removed from the web tree. Moveable paths are now only configurable via webserver conf
$t_moveable_paths = array(
- 'core_path',
- 'class_path',
- 'library_path',
- 'language_path'
);
if( $t_paths['absolute_path']['real_path'] !== false ) {
diff --git a/public/admin/index.php b/public/admin/index.php
index 9f871e712f..38a6ceb75b 100644
--- a/public/admin/index.php
+++ b/public/admin/index.php
@@ -72,7 +72,7 @@ function print_info_row( $p_description, $p_value ) {
diff --git a/public/core.php b/public/core.php
index 87ae42f59a..5ec81e2d33 100644
--- a/public/core.php
+++ b/public/core.php
@@ -49,6 +49,30 @@
* @uses utf8/str_pad.php
*/
+// Set the initial include_path. for performance
+// reasons, it's best to move this to your web server configuration or php.ini
+// for production.
+set_include_path(implode(PATH_SEPARATOR, array(
+ realpath(dirname(__FILE__) . '/../library'),
+ get_include_path(),
+)));
+
+// Define path to application directory
+defined('LIBRARY_PATH')
+ || define('LIBRARY_PATH', realpath(dirname(__FILE__) . '/../library') );
+
+// Define path to application directory
+defined('APPLICATION_PATH')
+ || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application') );
+
+// Define path to languages directory
+defined('LANGUAGES_PATH')
+ || define('LANGUAGES_PATH', realpath(dirname(__FILE__) . '/../languages') );
+
+// Define application environment
+defined('APPLICATION_ENV')
+ || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
+
/**
* Before doing anything... check if MantisBT is down for maintenance
*
@@ -68,7 +92,7 @@
ob_start();
# Load supplied constants
-require_once( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'constant_inc.php' );
+require_once( APPLICATION_PATH . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'constant_inc.php' );
# Load user-defined constants (if required)
if ( file_exists( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'custom_constants_inc.php' ) ) {
@@ -78,11 +102,11 @@
$t_config_inc_found = false;
# Include default configuration settings
-require_once( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'config_defaults_inc.php' );
+require_once( APPLICATION_PATH . DIRECTORY_SEPARATOR . 'configs' . DIRECTORY_SEPARATOR . 'config_defaults_inc.php' );
# config_inc may not be present if this is a new install
-if ( file_exists( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'config_inc.php' ) ) {
- require_once( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'config_inc.php' );
+if ( file_exists( APPLICATION_PATH . DIRECTORY_SEPARATOR . 'configs' . DIRECTORY_SEPARATOR . 'config_inc.php' ) ) {
+ require_once( APPLICATION_PATH . DIRECTORY_SEPARATOR . 'configs' . DIRECTORY_SEPARATOR . 'config_inc.php' );
$t_config_inc_found = true;
}
@@ -100,10 +124,10 @@
# Define an API inclusion function to replace require_once
function require_api( $p_api_name ) {
global $g_api_included;
- global $g_core_path;
+
if ( !isset( $g_api_included[$p_api_name] ) ) {
$t_existing_globals = get_defined_vars();
- require_once( $g_core_path . $p_api_name );
+ require_once( APPLICATION_PATH . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . $p_api_name );
$t_new_globals = array_diff_key( get_defined_vars(), $GLOBALS, array( 't_existing_globals' => 0, 't_new_globals' => 0 ) );
foreach ( $t_new_globals as $t_global_name => $t_global_value ) {
global $$t_global_name;
@@ -119,10 +143,10 @@ function require_api( $p_api_name ) {
# Define an API inclusion function to replace require_once
function require_lib( $p_library_name ) {
global $g_libraries_included;
- global $g_library_path;
+
if ( !isset( $g_libraries_included[$p_library_name] ) ) {
$t_existing_globals = get_defined_vars();
- require_once( $g_library_path . $p_library_name );
+ require_once( $p_library_name );
$t_new_globals = array_diff_key( get_defined_vars(), $GLOBALS, array( 't_existing_globals' => 0, 't_new_globals' => 0 ) );
foreach ( $t_new_globals as $t_global_name => $t_global_value ) {
global $$t_global_name;
@@ -133,21 +157,29 @@ function require_lib( $p_library_name ) {
}
# Define an autoload function to automatically load classes when referenced
-function __autoload( $className ) {
- global $g_class_path;
- global $g_library_path;
+function __autoload( $p_class_name ) {
+
+ # check the old classes directory @todo this should be removed once pages are migrated to the new application structure
+ $t_require_path = APPLICATION_PATH . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . $p_class_name . '.class.php';
+ if ( file_exists( $t_require_path ) ) {
+ require( $t_require_path );
+ return;
+ }
+
+ # handle any namespaces
+ $t_class_name = str_replace( '\\', '/', $p_class_name );
- $t_require_path = $g_class_path . $className . '.class.php';
+ $t_require_path = APPLICATION_PATH . DIRECTORY_SEPARATOR . $t_class_name . '.class.php';
if ( file_exists( $t_require_path ) ) {
- require_once( $t_require_path );
+ require( $t_require_path );
return;
}
- $t_require_path = $g_library_path . 'rssbuilder' . DIRECTORY_SEPARATOR . 'class.' . $className . '.inc.php';
+ $t_require_path = 'rssbuilder' . DIRECTORY_SEPARATOR . 'class.' . $t_class_name . '.inc.php';
if ( file_exists( $t_require_path ) ) {
- require_once( $t_require_path );
+ include( $t_require_path );
return;
}
}
@@ -156,7 +188,6 @@ function __autoload( $className ) {
spl_autoload_register( '__autoload' );
# Load UTF8-capable string functions
-define( 'UTF8', $g_library_path . 'utf8' );
require_lib( 'utf8/utf8.php' );
require_lib( 'utf8/str_pad.php' );
diff --git a/public/manage_overview_page.php b/public/manage_overview_page.php
index 22d736d9eb..e3be2155ee 100644
--- a/public/manage_overview_page.php
+++ b/public/manage_overview_page.php
@@ -78,7 +78,7 @@
>
|
- |
+ |
>
|