Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove set_include_path() calls
Since we know the full path to the files being included, it is not
necessary to change the include path.

Fixes #11549
  • Loading branch information
dregad committed Apr 11, 2014
1 parent 39581fd commit 3c23897
Show file tree
Hide file tree
Showing 27 changed files with 47 additions and 38 deletions.
2 changes: 0 additions & 2 deletions api/soap/mantisconnect.php
Expand Up @@ -14,8 +14,6 @@
* @link http://www.mantisbt.org
*/

set_include_path( '../../library' );

# Path to MantisBT is assumed to be the grand parent directory. If this is not
# the case, then this variable should be set to the MantisBT path.
# This can not be a configuration option, then MantisConnect configuration
Expand Down
17 changes: 17 additions & 0 deletions core/plugin_api.php
Expand Up @@ -797,6 +797,23 @@ function plugin_include( $p_basename, $p_child = null ) {
return $t_included;
}

/**
* Allows a plugin page to require a plugin-specific API
* @param string $p_file The API to be included
* @param string $p_basename Plugin's basename (defaults to current plugin)
*/
function plugin_require_api( $p_file, $p_basename = null ) {
if( is_null( $p_basename ) ) {
$t_current = plugin_get_current();
} else {
$t_current = $p_basename;
}

$t_path = config_get_global( 'plugin_path' ) . $t_current . '/';

require_once( $t_path . $p_file );
}

/**
* Register a plugin with MantisBT.
* The plugin class must already be loaded before calling.
Expand Down
6 changes: 1 addition & 5 deletions plugins/MantisGraph/MantisGraph.php
Expand Up @@ -63,10 +63,6 @@ function config() {
*/
function init() {
spl_autoload_register( array( 'MantisGraphPlugin', 'autoload' ) );

$t_path = config_get_global('plugin_path' ). plugin_get_current() . '/core/';

set_include_path(get_include_path() . PATH_SEPARATOR . $t_path);
}

/**
Expand Down Expand Up @@ -118,4 +114,4 @@ function summary_submenu( ) {
'<a href="' . plugin_page( 'summary_graph_imp_resolution.php' ) . '"><img src="' . $t_icon_path . 'synthgraph.gif" alt="" />' . plugin_lang_get( 'resolution_link' ) . '</a>',
);
}
}
}
14 changes: 6 additions & 8 deletions plugins/MantisGraph/core/graph_api.php
Expand Up @@ -31,14 +31,12 @@
}
$t_jpgraph_path = plugin_config_get( 'jpgraph_path', '' );
if( $t_jpgraph_path !== '' ) {
set_include_path(get_include_path() . PATH_SEPARATOR . $t_jpgraph_path );
$ip = get_include_path();
require_once( 'jpgraph.php' );
require_once( 'jpgraph_line.php' );
require_once( 'jpgraph_bar.php' );
require_once( 'jpgraph_pie.php' );
require_once( 'jpgraph_pie3d.php' );
require_once( 'jpgraph_canvas.php' );
require_once( $t_jpgraph_path . 'jpgraph.php' );
require_once( $t_jpgraph_path . 'jpgraph_line.php' );
require_once( $t_jpgraph_path . 'jpgraph_bar.php' );
require_once( $t_jpgraph_path . 'jpgraph_pie.php' );
require_once( $t_jpgraph_path . 'jpgraph_pie3d.php' );
require_once( $t_jpgraph_path . 'jpgraph_canvas.php' );
} else {
require_lib( 'jpgraph/jpgraph.php' );
require_lib( 'jpgraph/jpgraph_line.php' );
Expand Down
2 changes: 1 addition & 1 deletion plugins/MantisGraph/pages/bug_graph_bycategory.php
Expand Up @@ -26,7 +26,7 @@
require_once( 'core.php' );

require_once( 'Period.php' );
require_once( 'graph_api.php' );
plugin_require_api( 'core/graph_api.php' );

access_ensure_project_level( config_get( 'view_summary_threshold' ) );

Expand Down
2 changes: 1 addition & 1 deletion plugins/MantisGraph/pages/bug_graph_bystatus.php
Expand Up @@ -25,7 +25,7 @@
require_once( 'core.php' );

require_once( 'Period.php' );
require_once( 'graph_api.php' );
plugin_require_api( 'core/graph_api.php' );

access_ensure_project_level( config_get( 'view_summary_threshold' ) );

Expand Down
2 changes: 1 addition & 1 deletion plugins/MantisGraph/pages/summary_graph_bycategory.php
Expand Up @@ -25,7 +25,7 @@

require_once( 'core.php' );

require_once( 'graph_api.php' );
plugin_require_api( 'core/graph_api.php' );

access_ensure_project_level( config_get( 'view_summary_threshold' ) );

Expand Down
2 changes: 1 addition & 1 deletion plugins/MantisGraph/pages/summary_graph_bycategory_pct.php
Expand Up @@ -24,7 +24,7 @@

require_once( 'core.php' );

require_once( 'graph_api.php' );
plugin_require_api( 'core/graph_api.php' );

access_ensure_project_level( config_get( 'view_summary_threshold' ) );

Expand Down
2 changes: 1 addition & 1 deletion plugins/MantisGraph/pages/summary_graph_bydeveloper.php
Expand Up @@ -24,7 +24,7 @@

require_once( 'core.php' );

require_once( 'graph_api.php' );
plugin_require_api( 'core/graph_api.php' );

access_ensure_project_level( config_get( 'view_summary_threshold' ) );

Expand Down
2 changes: 1 addition & 1 deletion plugins/MantisGraph/pages/summary_graph_bypriority.php
Expand Up @@ -25,7 +25,7 @@

require_once( 'core.php' );

require_once( 'graph_api.php' );
plugin_require_api( 'core/graph_api.php' );

access_ensure_project_level( config_get( 'view_summary_threshold' ) );

Expand Down
2 changes: 1 addition & 1 deletion plugins/MantisGraph/pages/summary_graph_bypriority_mix.php
Expand Up @@ -25,7 +25,7 @@

require_once( 'core.php' );

require_once( 'graph_api.php' );
plugin_require_api( 'core/graph_api.php' );

access_ensure_project_level( config_get( 'view_summary_threshold' ) );

Expand Down
2 changes: 1 addition & 1 deletion plugins/MantisGraph/pages/summary_graph_bypriority_pct.php
Expand Up @@ -25,7 +25,7 @@

require_once( 'core.php' );

require_once( 'graph_api.php' );
plugin_require_api( 'core/graph_api.php' );

access_ensure_project_level( config_get( 'view_summary_threshold' ) );

Expand Down
2 changes: 1 addition & 1 deletion plugins/MantisGraph/pages/summary_graph_byreporter.php
Expand Up @@ -24,7 +24,7 @@

require_once( 'core.php' );

require_once( 'graph_api.php' );
plugin_require_api( 'core/graph_api.php' );

access_ensure_project_level( config_get( 'view_summary_threshold' ) );

Expand Down
2 changes: 1 addition & 1 deletion plugins/MantisGraph/pages/summary_graph_byresolution.php
Expand Up @@ -24,7 +24,7 @@

require_once( 'core.php' );

require_once( 'graph_api.php' );
plugin_require_api( 'core/graph_api.php' );

access_ensure_project_level( config_get( 'view_summary_threshold' ) );

Expand Down
Expand Up @@ -24,7 +24,7 @@

require_once( 'core.php' );

require_once( 'graph_api.php' );
plugin_require_api( 'core/graph_api.php' );

access_ensure_project_level( config_get( 'view_summary_threshold' ) );

Expand Down
Expand Up @@ -25,7 +25,7 @@

require_once( 'core.php' );

require_once( 'graph_api.php' );
plugin_require_api( 'core/graph_api.php' );

access_ensure_project_level( config_get( 'view_summary_threshold' ) );

Expand Down
2 changes: 1 addition & 1 deletion plugins/MantisGraph/pages/summary_graph_byseverity.php
Expand Up @@ -25,7 +25,7 @@

require_once( 'core.php' );

require_once( 'graph_api.php' );
plugin_require_api( 'core/graph_api.php' );

access_ensure_project_level( config_get( 'view_summary_threshold' ) );

Expand Down
2 changes: 1 addition & 1 deletion plugins/MantisGraph/pages/summary_graph_byseverity_mix.php
Expand Up @@ -25,7 +25,7 @@

require_once( 'core.php' );

require_once( 'graph_api.php' );
plugin_require_api( 'core/graph_api.php' );

access_ensure_project_level( config_get( 'view_summary_threshold' ) );

Expand Down
2 changes: 1 addition & 1 deletion plugins/MantisGraph/pages/summary_graph_byseverity_pct.php
Expand Up @@ -25,7 +25,7 @@

require_once( 'core.php' );

require_once( 'graph_api.php' );
plugin_require_api( 'core/graph_api.php' );

access_ensure_project_level( config_get( 'view_summary_threshold' ) );

Expand Down
2 changes: 1 addition & 1 deletion plugins/MantisGraph/pages/summary_graph_bystatus.php
Expand Up @@ -25,7 +25,7 @@

require_once( 'core.php' );

require_once( 'graph_api.php' );
plugin_require_api( 'core/graph_api.php' );

access_ensure_project_level( config_get( 'view_summary_threshold' ) );

Expand Down
2 changes: 1 addition & 1 deletion plugins/MantisGraph/pages/summary_graph_bystatus_pct.php
Expand Up @@ -24,7 +24,7 @@

require_once( 'core.php' );

require_once( 'graph_api.php' );
plugin_require_api( 'core/graph_api.php' );

access_ensure_project_level( config_get( 'view_summary_threshold' ) );

Expand Down
Expand Up @@ -24,7 +24,7 @@

require_once( 'core.php' );

require_once( 'graph_api.php' );
plugin_require_api( 'core/graph_api.php' );

access_ensure_project_level( config_get( 'view_summary_threshold' ) );

Expand Down
2 changes: 1 addition & 1 deletion plugins/MantisGraph/pages/summary_graph_imp_category.php
Expand Up @@ -25,7 +25,7 @@

require_once( 'core.php' );

require_once( 'graph_api.php' );
plugin_require_api( 'core/graph_api.php' );

access_ensure_project_level( config_get( 'view_summary_threshold' ) );

Expand Down
2 changes: 1 addition & 1 deletion plugins/MantisGraph/pages/summary_graph_imp_priority.php
Expand Up @@ -25,7 +25,7 @@

require_once( 'core.php' );

require_once( 'graph_api.php' );
plugin_require_api( 'core/graph_api.php' );

access_ensure_project_level( config_get( 'view_summary_threshold' ) );

Expand Down
2 changes: 1 addition & 1 deletion plugins/MantisGraph/pages/summary_graph_imp_resolution.php
Expand Up @@ -25,7 +25,7 @@

require_once( 'core.php' );

require_once( 'graph_api.php' );
plugin_require_api( 'core/graph_api.php' );

access_ensure_project_level( config_get( 'view_summary_threshold' ) );

Expand Down
2 changes: 1 addition & 1 deletion plugins/MantisGraph/pages/summary_graph_imp_severity.php
Expand Up @@ -24,7 +24,7 @@

require_once( 'core.php' );

require_once( 'graph_api.php' );
plugin_require_api( 'core/graph_api.php' );

access_ensure_project_level( config_get( 'view_summary_threshold' ) );

Expand Down
2 changes: 1 addition & 1 deletion plugins/MantisGraph/pages/summary_graph_imp_status.php
Expand Up @@ -24,7 +24,7 @@

require_once( 'core.php' );

require_once( 'graph_api.php' );
plugin_require_api( 'core/graph_api.php' );

access_ensure_project_level( config_get( 'view_summary_threshold' ) );

Expand Down

0 comments on commit 3c23897

Please sign in to comment.