diff --git a/config_defaults_inc.php b/config_defaults_inc.php index 4d92402b4c..6875cffb2a 100644 --- a/config_defaults_inc.php +++ b/config_defaults_inc.php @@ -177,39 +177,45 @@ * requires trailing / * @global string $g_icon_path */ -$g_icon_path = '%path%images/'; +$g_icon_path = '%path%images/'; /** * Short web path without the domain name * requires trailing / * @global string $g_short_path */ -$g_short_path = $t_path . '/'; +$g_short_path = $t_path . '/'; /** * absolute path to your installation. Requires trailing / or \ * @global string $g_absolute_path */ -$g_absolute_path = dirname( __FILE__ ) . DIRECTORY_SEPARATOR; +$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; +$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; +$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; +$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; /** * Used to link to manual for User Documentation. diff --git a/core.php b/core.php index b93377ac05..13cff734ff 100644 --- a/core.php +++ b/core.php @@ -156,6 +156,7 @@ 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/core/config_api.php b/core/config_api.php index ed7b32ce3c..9681f6fa56 100644 --- a/core/config_api.php +++ b/core/config_api.php @@ -599,6 +599,8 @@ function config_is_private( $p_config_var ) { case 'absolute_path': case 'core_path': case 'class_path': + case 'library_path': + case 'language_path': case 'use_iis': case 'session_save_path': case 'session_handler': diff --git a/core/custom_field_api.php b/core/custom_field_api.php index 6698b56bda..72e403ad50 100644 --- a/core/custom_field_api.php +++ b/core/custom_field_api.php @@ -70,7 +70,7 @@ $g_custom_field_types[CUSTOM_FIELD_TYPE_DATE] = 'standard'; foreach( $g_custom_field_types as $type ) { - require_once( 'cfdefs' . DIRECTORY_SEPARATOR . 'cfdef_' . $type . '.php' ); + require_once( config_get_global( 'core_path' ) . 'cfdefs' . DIRECTORY_SEPARATOR . 'cfdef_' . $type . '.php' ); } function custom_field_allow_manage_display( $p_type, $p_display ) { diff --git a/core/database_api.php b/core/database_api.php index d4882df354..34e45ab82b 100644 --- a/core/database_api.php +++ b/core/database_api.php @@ -36,6 +36,8 @@ require_api( 'error_api.php' ); require_api( 'logging_api.php' ); require_api( 'utility_api.php' ); + +define( 'ADODB_DIR', config_get( 'library_path' ) . 'adodb' ); require_lib( 'adodb' . DIRECTORY_SEPARATOR . 'adodb.inc.php' ); /** diff --git a/core/lang_api.php b/core/lang_api.php index 5ff783b2ce..23231284b8 100644 --- a/core/lang_api.php +++ b/core/lang_api.php @@ -66,20 +66,17 @@ function lang_load( $p_lang, $p_dir = null ) { return; } - $t_lang_dir = $p_dir; - - if( is_null( $t_lang_dir ) ) { - $t_lang_dir = dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR; - include_once( $t_lang_dir . 'strings_' . $p_lang . '.txt' ); + if( $p_dir === null ) { + include_once( config_get( 'language_path' ) . 'strings_' . $p_lang . '.txt' ); } else { - if( is_file( $t_lang_dir . 'strings_' . $p_lang . '.txt' ) ) { - include_once( $t_lang_dir . 'strings_' . $p_lang . '.txt' ); + if( is_file( $p_dir . 'strings_' . $p_lang . '.txt' ) ) { + include_once( $p_dir . 'strings_' . $p_lang . '.txt' ); } } # Allow overriding strings declared in the language file. # custom_strings_inc.php can use $g_active_language - $t_custom_strings = dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'custom_strings_inc.php'; + $t_custom_strings = config_get( 'absolute_path' ) . 'custom_strings_inc.php'; if( file_exists( $t_custom_strings ) ) { require( $t_custom_strings ); diff --git a/core/relationship_api.php b/core/relationship_api.php index 38857f3417..af941ae612 100644 --- a/core/relationship_api.php +++ b/core/relationship_api.php @@ -160,8 +160,8 @@ class BugRelationshipData { '#notify_deleted' => 'email_notification_title_for_action_related_to_relationship_deleted', ); -if( file_exists( dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'custom_relationships_inc.php' ) ) { - require_once( dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'custom_relationships_inc.php' ); +if( file_exists( config_get_global( 'absolute_path' ) . 'custom_relationships_inc.php' ) ) { + require_once( config_get_global( 'absolute_path' ) . 'custom_relationships_inc.php' ); } /** diff --git a/docbook/adminguide/en/configuration.sgml b/docbook/adminguide/en/configuration.sgml index 3f0f324932..a8661675ca 100644 --- a/docbook/adminguide/en/configuration.sgml +++ b/docbook/adminguide/en/configuration.sgml @@ -109,9 +109,9 @@ $g_core_path This is the path to the core directory of your installation. - The default value is usually OK, unless you move the 'core' - directory out of your webroot. Requires trailing DIRECTORY_SEPARATOR. - character. + 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. @@ -124,6 +124,26 @@ + + $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/plugins/MantisGraph/core/graph_api.php b/plugins/MantisGraph/core/graph_api.php index 18a6a6c388..ff5ce7ff2a 100644 --- a/plugins/MantisGraph/core/graph_api.php +++ b/plugins/MantisGraph/core/graph_api.php @@ -39,15 +39,15 @@ require_once( 'jpgraph_pie3d.php' ); require_once( 'jpgraph_canvas.php' ); } else { - require_once( 'jpgraph/jpgraph.php' ); - require_once( 'jpgraph/jpgraph_line.php' ); - require_once( 'jpgraph/jpgraph_bar.php' ); - require_once( 'jpgraph/jpgraph_pie.php' ); - require_once( 'jpgraph/jpgraph_pie3d.php' ); - require_once( 'jpgraph/jpgraph_canvas.php' ); + require_lib( 'jpgraph/jpgraph.php' ); + require_lib( 'jpgraph/jpgraph_line.php' ); + require_lib( 'jpgraph/jpgraph_bar.php' ); + require_lib( 'jpgraph/jpgraph_pie.php' ); + require_lib( 'jpgraph/jpgraph_pie3d.php' ); + require_lib( 'jpgraph/jpgraph_canvas.php' ); } } else { - require_once( 'ezc/Base/src/base.php' ); + require_lib( 'ezc/Base/src/base.php' ); } function graph_get_font() {