Skip to content

Commit

Permalink
Use require_api/require_lib to pull in dependencies
Browse files Browse the repository at this point in the history
Following up on ea3cd38 which
introduced require_once calls within the core API files to included
dependencies in-place, this commit does a similar thing for user
viewable pages.

Replacements for require_once have been created within core.php to help
optimise the increased number of dependency checks.

require_api and require_lib have the same syntax as require_once however
the first will look within the core directory only, and the second will
look within the library directory only. The library directory can now be
relocated elsewhere by use of the $g_library_path configuration option.

require_api and require_lib use a global array to keep track of which
files have already been included. This is a much simpler check than what
is performed by require_once and hence avoids expensive checking for
symlinks with stat() calls and so forth.
  • Loading branch information
davidhicks committed Jan 8, 2010
1 parent cf559e0 commit 2d5455c
Show file tree
Hide file tree
Showing 263 changed files with 6,806 additions and 3,166 deletions.
26 changes: 23 additions & 3 deletions account_delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,31 @@
* @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - [email protected]
* @copyright Copyright (C) 2002 - 2010 MantisBT Team - [email protected]
* @link http://www.mantisbt.org
*
* @uses core.php
* @uses access_api.php
* @uses authentication_api.php
* @uses config_api.php
* @uses constant_inc.php
* @uses current_user_api.php
* @uses form_api.php
* @uses helper_api.php
* @uses lang_api.php
* @uses print_api.php
* @uses user_api.php
*/
/**
* MantisBT Core API's
*/

require_once( 'core.php' );
require_api( 'access_api.php' );
require_api( 'authentication_api.php' );
require_api( 'config_api.php' );
require_api( 'constant_inc.php' );
require_api( 'current_user_api.php' );
require_api( 'form_api.php' );
require_api( 'helper_api.php' );
require_api( 'lang_api.php' );
require_api( 'print_api.php' );
require_api( 'user_api.php' );

form_security_validate('account_delete');

Expand Down
31 changes: 16 additions & 15 deletions account_manage_columns_page.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,22 @@
# You should have received a copy of the GNU General Public License
# along with MantisBT. If not, see <http://www.gnu.org/licenses/>.

/**
* @package MantisBT
* @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - [email protected]
* @copyright Copyright (C) 2002 - 2010 MantisBT Team - [email protected]
* @link http://www.mantisbt.org
*/
/**
* MantisBT Core API's
*/
require_once( 'core.php' );

require_once( 'authentication_api.php' );
require_once( 'columns_api.php' );
require_once( 'custom_field_api.php' );
require_once( 'helper_api.php' );
/**
* @package MantisBT
* @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - [email protected]
* @copyright Copyright (C) 2002 - 2010 MantisBT Team - [email protected]
* @link http://www.mantisbt.org
*
* @uses core.php
* @uses current_user_api.php
* @uses html_api.php
* @uses lang_api.php
*/

require_once( 'core.php' );
require_api( 'current_user_api.php' );
require_api( 'html_api.php' );
require_api( 'lang_api.php' );

html_page_top( lang_get( 'manage_columns_config' ) );

Expand Down
92 changes: 58 additions & 34 deletions account_page.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,40 +14,64 @@
# You should have received a copy of the GNU General Public License
# along with MantisBT. If not, see <http://www.gnu.org/licenses/>.

/**
* CALLERS
* This page is called from:
* - print_menu()
* - print_account_menu()
* - header redirects from account_*.php
* - included by verify.php to allow user to change their password
*
* EXPECTED BEHAVIOUR
* - Display the user's current settings
* - Allow the user to edit their settings
* - Allow the user to save their changes
* - Allow the user to delete their account if account deletion is enabled
*
* CALLS
* This page calls the following pages:
* - account_update.php (to save changes)
* - account_delete.php (to delete the user's account)
*
* RESTRICTIONS & PERMISSIONS
* - User must be authenticated
* - The user's account must not be protected
*
* @package MantisBT
* @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - [email protected]
* @copyright Copyright (C) 2002 - 2010 MantisBT Team - [email protected]
* @link http://www.mantisbt.org
*/
/**
* MantisBT Core API's
*/
require_once( 'core.php' );

require_once( 'current_user_api.php' );
/**
* CALLERS
* This page is called from:
* - print_menu()
* - print_account_menu()
* - header redirects from account_*.php
* - included by verify.php to allow user to change their password
*
* EXPECTED BEHAVIOUR
* - Display the user's current settings
* - Allow the user to edit their settings
* - Allow the user to save their changes
* - Allow the user to delete their account if account deletion is enabled
*
* CALLS
* This page calls the following pages:
* - account_update.php (to save changes)
* - account_delete.php (to delete the user's account)
*
* RESTRICTIONS & PERMISSIONS
* - User must be authenticated
* - The user's account must not be protected
*
* @package MantisBT
* @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - [email protected]
* @copyright Copyright (C) 2002 - 2010 MantisBT Team - [email protected]
* @link http://www.mantisbt.org
*
* @uses core.php
* @uses authentication_api.php
* @uses config_api.php
* @uses constant_inc.php
* @uses current_user_api.php
* @uses form_api.php
* @uses helper_api.php
* @uses html_api.php
* @uses lang_api.php
* @uses ldap_api.php
* @uses print_api.php
* @uses string_api.php
* @uses user_api.php
* @uses utility_api.php
*/

require_once( 'core.php' );
require_api( 'authentication_api.php' );
require_api( 'config_api.php' );
require_api( 'constant_inc.php' );
require_api( 'current_user_api.php' );
require_api( 'form_api.php' );
require_api( 'helper_api.php' );
require_api( 'html_api.php' );
require_api( 'lang_api.php' );
require_api( 'ldap_api.php' );
require_api( 'print_api.php' );
require_api( 'string_api.php' );
require_api( 'user_api.php' );
require_api( 'utility_api.php' );

#============ Parameters ============
# (none)
Expand Down
41 changes: 31 additions & 10 deletions account_prefs_inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,38 @@
# You should have received a copy of the GNU General Public License
# along with MantisBT. If not, see <http://www.gnu.org/licenses/>.

/**
* @package MantisBT
* @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - [email protected]
* @copyright Copyright (C) 2002 - 2010 MantisBT Team - [email protected]
* @link http://www.mantisbt.org
*/
/**
* MantisBT Core API's
*/
/**
* @package MantisBT
* @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - [email protected]
* @copyright Copyright (C) 2002 - 2010 MantisBT Team - [email protected]
* @link http://www.mantisbt.org
*
* @uses authentication_api.php
* @uses config_api.php
* @uses constant_inc.php
* @uses event_api.php
* @uses form_api.php
* @uses helper_api.php
* @uses html_api.php
* @uses lang_api.php
* @uses print_api.php
* @uses user_api.php
* @uses user_pref_api.php
* @uses utility_api.php
*/

require_once( 'user_pref_api.php' );
require_api( 'authentication_api.php' );
require_api( 'config_api.php' );
require_api( 'constant_inc.php' );
require_api( 'event_api.php' );
require_api( 'form_api.php' );
require_api( 'helper_api.php' );
require_api( 'html_api.php' );
require_api( 'lang_api.php' );
require_api( 'print_api.php' );
require_api( 'user_api.php' );
require_api( 'user_pref_api.php' );
require_api( 'utility_api.php' );

function edit_account_prefs($p_user_id = null, $p_error_if_protected = true, $p_accounts_menu = true, $p_redirect_url = '') {
if ( null === $p_user_id ) {
Expand Down
68 changes: 37 additions & 31 deletions account_prefs_page.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,43 @@
# You should have received a copy of the GNU General Public License
# along with MantisBT. If not, see <http://www.gnu.org/licenses/>.

/**
* CALLERS
* This page is called from:
* - print_account_menu()
* - header redirects from account_*.php
*
* EXPECTED BEHAVIOUR
* - Display the user's current preferences
* - Allow the user to edit the preferences
* - Provide the option of saving changes or resetting to default values
*
* CALLS
* This page calls the following pages:
* - acount_prefs_update.php (to save changes)
* - account_prefs_reset.php (to reset preferences to default values)
*
* RESTRICTIONS & PERMISSIONS
* - User must be authenticated
* - The user's account must not be protected
*
* @package MantisBT
* @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - [email protected]
* @copyright Copyright (C) 2002 - 2010 MantisBT Team - [email protected]
* @link http://www.mantisbt.org
*/
/**
* MantisBT Core API's
*/
require_once( 'core.php' );

require_once( 'current_user_api.php' );
/**
* CALLERS
* This page is called from:
* - print_account_menu()
* - header redirects from account_*.php
*
* EXPECTED BEHAVIOUR
* - Display the user's current preferences
* - Allow the user to edit the preferences
* - Provide the option of saving changes or resetting to default values
*
* CALLS
* This page calls the following pages:
* - acount_prefs_update.php (to save changes)
* - account_prefs_reset.php (to reset preferences to default values)
*
* RESTRICTIONS & PERMISSIONS
* - User must be authenticated
* - The user's account must not be protected
*
* @package MantisBT
* @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - [email protected]
* @copyright Copyright (C) 2002 - 2010 MantisBT Team - [email protected]
* @link http://www.mantisbt.org
*
* @uses core.php
* @uses authentication_api.php
* @uses current_user_api.php
* @uses html_api.php
* @uses lang_api.php
*/

require_once( 'core.php' );
require_api( 'authentication_api.php' );
require_api( 'current_user_api.php' );
require_api( 'html_api.php' );
require_api( 'lang_api.php' );

#============ Parameters ============
# (none)
Expand Down
68 changes: 42 additions & 26 deletions account_prefs_reset.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,49 @@
# You should have received a copy of the GNU General Public License
# along with MantisBT. If not, see <http://www.gnu.org/licenses/>.

/**
* CALLERS
* This page is called from:
* - account_prefs_inc.php
*
* EXPECTED BEHAVIOUR
* - Reset the user's preferences to default values
* - Redirect to account_prefs_page.php or another page, if given
*
* CALLS
* This page conditionally redirects upon completion
*
* RESTRICTIONS & PERMISSIONS
* - User must be authenticated
* - User must not be protected
*
* @package MantisBT
* @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - [email protected]
* @copyright Copyright (C) 2002 - 2010 MantisBT Team - [email protected]
* @link http://www.mantisbt.org
*/
/**
* MantisBT Core API's
*/
require_once( 'core.php' );
/**
* CALLERS
* This page is called from:
* - account_prefs_inc.php
*
* EXPECTED BEHAVIOUR
* - Reset the user's preferences to default values
* - Redirect to account_prefs_page.php or another page, if given
*
* CALLS
* This page conditionally redirects upon completion
*
* RESTRICTIONS & PERMISSIONS
* - User must be authenticated
* - User must not be protected
*
* @package MantisBT
* @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - [email protected]
* @copyright Copyright (C) 2002 - 2010 MantisBT Team - [email protected]
* @link http://www.mantisbt.org
*
* @uses core.php
* @uses access_api.php
* @uses authentication_api.php
* @uses config_api.php
* @uses form_api.php
* @uses gpc_api.php
* @uses print_api.php
* @uses string_api.php
* @uses user_api.php
* @uses user_pref_api.php
*/

require_once( 'user_pref_api.php' );
require_once( 'core.php' );
require_api( 'access_api.php' );
require_api( 'authentication_api.php' );
require_api( 'config_api.php' );
require_api( 'form_api.php' );
require_api( 'gpc_api.php' );
require_api( 'print_api.php' );
require_api( 'string_api.php' );
require_api( 'user_api.php' );
require_api( 'user_pref_api.php' );

#============ Parameters ============
$f_user_id = gpc_get_int( 'user_id' );
Expand Down
Loading

0 comments on commit 2d5455c

Please sign in to comment.