Skip to content

Commit

Permalink
Fix Mantis Code Standards: use "if(" over "if ("
Browse files Browse the repository at this point in the history
  • Loading branch information
mantis committed Jun 8, 2014
1 parent a9a324a commit 378804a
Show file tree
Hide file tree
Showing 300 changed files with 2,882 additions and 2,904 deletions.
8 changes: 4 additions & 4 deletions account_delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@

# Only allow users to delete their own accounts if allow_account_delete = ON or
# the user has permission to manage user accounts.
if ( OFF == config_get( 'allow_account_delete' ) &&
!access_has_global_level( config_get( 'manage_user_threshold' ) ) ) {
if( OFF == config_get( 'allow_account_delete' ) &&
!access_has_global_level( config_get( 'manage_user_threshold' ) ) ) {
print_header_redirect( 'account_page.php' );
}

# check that we are not deleting the last administrator account
$t_admin_threshold = config_get_global( 'admin_site_threshold' );
if ( current_user_is_administrator() &&
user_count_level( $t_admin_threshold ) <= 1 ) {
if( current_user_is_administrator() &&
user_count_level( $t_admin_threshold ) <= 1 ) {
trigger_error( ERROR_USER_CHANGE_LAST_ADMIN, ERROR );
}

Expand Down
6 changes: 3 additions & 3 deletions account_manage_columns_page.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@

/**
* This page allows a user to manage the column api data stored in their profile.
*
*
* Users are presented with a list of available columns (fields). They mean then choose which types
* of field to include on the following types of pages:
* i) "View Issues Columns" - These are the fields displayed when viewing the list of bugs
* ii) "Print Issues Columns" - These are the fields that are included when printing out bug
* details.
* iii) "Export Issues Columns" - These are the list of fields included when exporting an issue from
* the bug tracker.
* the bug tracker.
* Note: These are now shared between different types of exports - for example, the core MantisBT
* distribution can export to Excel and Word Documents.
*
* The settings defined here can be allocated to the current project, or All Projects. In addition,
* it is possible to copy the column configuration between different projects.
*
*
* @package MantisBT
* @copyright Copyright 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
* @copyright Copyright 2002 MantisBT Team - mantisbt-dev@lists.sourceforge.net
Expand Down
26 changes: 13 additions & 13 deletions account_page.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,20 +107,20 @@

$t_force_pw_reset = false;

if ( $t_verify || $t_reset_password ) {
if( $t_verify || $t_reset_password ) {
$t_can_change_password = helper_call_custom_function( 'auth_can_change_password', array() );

echo '<div id="reset-passwd-msg" class="important-msg">';
echo '<ul>';

if ( $t_verify ) {
if( $t_verify ) {
echo '<li>' . lang_get( 'verify_warning' ) . '</li>';

if ( $t_can_change_password ) {
if( $t_can_change_password ) {
echo '<li>' . lang_get( 'verify_change_password' ) . '</li>';
$t_force_pw_reset = true;
}
} else if ( $t_reset_password && $t_can_change_password ) {
} else if( $t_reset_password && $t_can_change_password ) {
echo '<li>' . lang_get( 'warning_default_administrator_account_present' ) . '</li>';
$t_force_pw_reset = true;
}
Expand All @@ -132,12 +132,12 @@

<div id="account-update-div" class="form-container">
<form id="account-update-form" method="post" action="account_update.php">
<fieldset <?php if ( $t_force_pw_reset ) { ?> class="has-required"<?php } ?>>
<fieldset <?php if( $t_force_pw_reset ) { ?> class="has-required"<?php } ?>>
<legend><span><?php echo lang_get( 'edit_account_title' ); ?></span></legend>
<?php echo form_security_field( 'account_update' );
print_account_menu( 'account_page.php' );

if ( !helper_call_custom_function( 'auth_can_change_password', array() ) ) {
if( !helper_call_custom_function( 'auth_can_change_password', array() ) ) {
# With LDAP --> ?>
<div class="field-container">
<span class="display-label"><span><?php echo lang_get( 'username' ) ?></span></span>
Expand All @@ -164,26 +164,26 @@
} else {
?>
<div class="field-container">
<label for="password" <?php if ( $t_force_pw_reset ) { ?> class="required" <?php } ?>><span><?php echo lang_get( 'current_password' ) ?></span></label>
<label for="password" <?php if( $t_force_pw_reset ) { ?> class="required" <?php } ?>><span><?php echo lang_get( 'current_password' ) ?></span></label>
<span class="input"><input id="password-current" type="password" name="password_current" size="32" maxlength="<?php echo auth_get_password_max_size(); ?>" /></span>
<span class="label-style"></span>
</div><?php
} ?>
<div class="field-container">
<label for="password" <?php if ( $t_force_pw_reset ) { ?> class="required" <?php } ?>><span><?php echo lang_get( 'password' ) ?></span></label>
<label for="password" <?php if( $t_force_pw_reset ) { ?> class="required" <?php } ?>><span><?php echo lang_get( 'password' ) ?></span></label>
<span class="input"><input id="password" type="password" name="password" size="32" maxlength="<?php echo auth_get_password_max_size(); ?>" /></span>
<span class="label-style"></span>
</div>
<div class="field-container">
<label for="password-confirm" <?php if ( $t_force_pw_reset ) { ?> class="required" <?php } ?>><span><?php echo lang_get( 'confirm_password' ) ?></span></label>
<label for="password-confirm" <?php if( $t_force_pw_reset ) { ?> class="required" <?php } ?>><span><?php echo lang_get( 'confirm_password' ) ?></span></label>
<span class="input"><input id="password-confirm" type="password" name="password_confirm" size="32" maxlength="<?php echo auth_get_password_max_size(); ?>" /></span>
<span class="label-style"></span>
</div><?php
} ?>
<div class="field-container">
<span class="display-label"><span><?php echo lang_get( 'email' ) ?></span></span>
<span class="input"><?php
if ( $t_ldap && ON == config_get( 'use_ldap_email' ) ) {
if( $t_ldap && ON == config_get( 'use_ldap_email' ) ) {
# With LDAP
echo '<span class="field-value">' . string_display_line( $u_email ) . '</span>';
} else {
Expand All @@ -195,7 +195,7 @@
<span class="label-style"></span>
</div>
<div class="field-container"><?php
if ( $t_ldap && ON == config_get( 'use_ldap_realname' ) ) {
if( $t_ldap && ON == config_get( 'use_ldap_realname' ) ) {
# With LDAP
echo '<span class="display-label"><span>' . lang_get( 'realname' ) . '</span></span>';
echo '<span class="input">';
Expand Down Expand Up @@ -245,14 +245,14 @@
echo '</div>';
}
?>
<?php if ( $t_show_update_button ) { ?>
<?php if( $t_show_update_button ) { ?>
<span class="submit-button"><input type="submit" class="button" value="<?php echo lang_get( 'update_user_button' ) ?>" /></span>
<?php } ?>
</fieldset>
</form>
</div>
<?php # check if users can't delete their own accounts
if ( ON == config_get( 'allow_account_delete' ) ) { ?>
if( ON == config_get( 'allow_account_delete' ) ) { ?>

<!-- Delete Button -->
<div class="form-container">
Expand Down
14 changes: 7 additions & 7 deletions account_prefs_inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* @uses utility_api.php
*/

if ( !defined( 'ACCOUNT_PREFS_INC_ALLOW' ) ) {
if( !defined( 'ACCOUNT_PREFS_INC_ALLOW' ) ) {
return;
}

Expand All @@ -62,18 +62,18 @@
* @param string $p_redirect_url redirect URI
*/
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 ) {
if( null === $p_user_id ) {
$p_user_id = auth_get_current_user_id();
}

$t_redirect_url = $p_redirect_url;
if ( is_blank( $t_redirect_url ) ) {
if( is_blank( $t_redirect_url ) ) {
$t_redirect_url = 'account_prefs_page.php';
}

# protected account check
if ( user_is_protected( $p_user_id ) ) {
if ( $p_error_if_protected ) {
if( user_is_protected( $p_user_id ) ) {
if( $p_error_if_protected ) {
trigger_error( ERROR_PROTECTED_ACCOUNT, ERROR );
} else {
return;
Expand All @@ -94,7 +94,7 @@ function edit_account_prefs($p_user_id = null, $p_error_if_protected = true, $p_
<input type="hidden" name="user_id" value="<?php echo $p_user_id ?>" />
<input type="hidden" name="redirect_url" value="<?php echo $t_redirect_url ?>" />
<?php
if ( $p_accounts_menu ) {
if( $p_accounts_menu ) {
print_account_menu( 'account_prefs_page.php' );
}
?>
Expand Down Expand Up @@ -134,7 +134,7 @@ function edit_account_prefs($p_user_id = null, $p_error_if_protected = true, $p_
<label for="bugnote-order-asc"><span><?php echo lang_get( 'bugnote_order_asc' ) ?></span></label>
<span class="label-style"></span>
</fieldset>
<?php if ( ON == config_get( 'enable_email_notification' ) ) { ?>
<?php if( ON == config_get( 'enable_email_notification' ) ) { ?>
<fieldset class="field-container">
<legend><label for="email-on-new"><?php echo lang_get( 'email_on_new' ) ?></label></legend>
<span class="checkbox"><input id="email-on-new" type="checkbox" name="email_on_new" <?php check_checked( (int)$t_pref->email_on_new, ON ); ?> /></span>
Expand Down
2 changes: 1 addition & 1 deletion account_prefs_reset.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
# This page is currently called from the manage_* namespace and thus we
# have to allow authorised users to update the accounts of other users.
# TODO: split this functionality into manage_user_prefs_reset.php
if ( auth_get_current_user_id() != $f_user_id ) {
if( auth_get_current_user_id() != $f_user_id ) {
access_ensure_global_level( config_get( 'manage_user_threshold' ) );
access_ensure_global_level( $t_user['access_level'] );
} else {
Expand Down
12 changes: 6 additions & 6 deletions account_prefs_update.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
# This page is currently called from the manage_* namespace and thus we
# have to allow authorised users to update the accounts of other users.
# TODO: split this functionality into manage_user_prefs_update.php
if ( auth_get_current_user_id() != $f_user_id ) {
if( auth_get_current_user_id() != $f_user_id ) {
access_ensure_global_level( config_get( 'manage_user_threshold' ) );
access_ensure_global_level( $t_user['access_level'] );
} else {
Expand All @@ -80,7 +80,7 @@
$t_prefs->default_project = gpc_get_int( 'default_project' );

$t_lang = gpc_get_string( 'language' );
if ( lang_language_exists( $t_lang ) ) {
if( lang_language_exists( $t_lang ) ) {
$t_prefs->language = $t_lang;
}

Expand All @@ -107,15 +107,15 @@
$t_prefs->email_bugnote_limit = gpc_get_int( 'email_bugnote_limit' );

# make sure the delay isn't too low
if (( config_get( 'min_refresh_delay' ) > $t_prefs->refresh_delay )&&
if(( config_get( 'min_refresh_delay' ) > $t_prefs->refresh_delay )&&
( $t_prefs->refresh_delay != 0 )) {
$t_prefs->refresh_delay = config_get( 'min_refresh_delay' );
}

if ( function_exists( 'timezone_identifiers_list' ) ) {
if( function_exists( 'timezone_identifiers_list' ) ) {
$t_timezone = gpc_get_string( 'timezone' );
if ( in_array( $t_timezone, timezone_identifiers_list() ) ) {
if ( $t_timezone == config_get_global( 'default_timezone' ) ) {
if( in_array( $t_timezone, timezone_identifiers_list() ) ) {
if( $t_timezone == config_get_global( 'default_timezone' ) ) {
$t_prefs->timezone = '';
} else {
$t_prefs->timezone = $t_timezone;
Expand Down
8 changes: 4 additions & 4 deletions account_prof_edit_page.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
require_api( 'profile_api.php' );
require_api( 'string_api.php' );

if ( !config_get( 'enable_profiles' ) ) {
if( !config_get( 'enable_profiles' ) ) {
trigger_error( ERROR_ACCESS_DENIED, ERROR );
}

Expand All @@ -60,7 +60,7 @@

$f_profile_id = gpc_get_int( 'profile_id' );

if ( profile_is_global( $f_profile_id ) ) {
if( profile_is_global( $f_profile_id ) ) {
access_ensure_global_level( config_get( 'manage_global_profile_threshold' ) );

$row = profile_get_row( ALL_USERS, $f_profile_id );
Expand All @@ -72,7 +72,7 @@

html_page_top();

if ( profile_is_global( $f_profile_id ) ) {
if( profile_is_global( $f_profile_id ) ) {
print_manage_menu();
}
?>
Expand All @@ -91,7 +91,7 @@
</td>
<td class="right">
<?php
if ( !profile_is_global( $f_profile_id ) ) {
if( !profile_is_global( $f_profile_id ) ) {
print_account_menu();
}
?>
Expand Down
14 changes: 7 additions & 7 deletions account_prof_menu_page.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@
require_api( 'print_api.php' );
require_api( 'profile_api.php' );

if ( !config_get( 'enable_profiles' ) ) {
if( !config_get( 'enable_profiles' ) ) {
trigger_error( ERROR_ACCESS_DENIED, ERROR );
}

if ( isset( $g_global_profiles ) ) {
if( isset( $g_global_profiles ) ) {
$g_global_profiles = true;
} else {
$g_global_profiles = false;
Expand All @@ -64,19 +64,19 @@

current_user_ensure_unprotected();

if ( $g_global_profiles ) {
if( $g_global_profiles ) {
access_ensure_global_level( config_get( 'manage_global_profile_threshold' ) );
} else {
access_ensure_global_level( config_get( 'add_profile_threshold' ) );
}

html_page_top( lang_get( 'manage_profiles_link' ) );

if ( $g_global_profiles ) {
if( $g_global_profiles ) {
print_manage_menu( 'manage_prof_menu_page.php' );
}

if ( $g_global_profiles ) {
if( $g_global_profiles ) {
$t_user_id = ALL_USERS;
} else {
$t_user_id = auth_get_current_user_id();
Expand All @@ -92,7 +92,7 @@
<input type="hidden" name="action" value="add" />
<input type="hidden" name="user_id" value="<?php echo $t_user_id ?>" />
<?php
if ( !$g_global_profiles ) {
if( !$g_global_profiles ) {
print_account_menu( 'account_prof_menu_page.php' );
}
?>
Expand Down Expand Up @@ -139,7 +139,7 @@
<span class="label-style"></span>
</div>
<?php
if ( !$g_global_profiles ) {
if( !$g_global_profiles ) {
?>
<div class="field-container">
<label for="action-default"><span><?php echo lang_get( 'make_default' ) ?></span></label>
Expand Down
12 changes: 6 additions & 6 deletions account_prof_update.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
require_api( 'print_api.php' );
require_api( 'profile_api.php' );

if ( !config_get( 'enable_profiles' ) ) {
if( !config_get( 'enable_profiles' ) ) {
trigger_error( ERROR_ACCESS_DENIED, ERROR );
}

Expand Down Expand Up @@ -80,11 +80,11 @@
$f_description = gpc_get_string( 'description' );

$t_user_id = gpc_get_int( 'user_id' );
if ( ALL_USERS != $t_user_id ) {
if( ALL_USERS != $t_user_id ) {
$t_user_id = auth_get_current_user_id();
}

if ( ALL_USERS == $t_user_id ) {
if( ALL_USERS == $t_user_id ) {
access_ensure_global_level( config_get( 'manage_global_profile_threshold' ) );
} else {
access_ensure_global_level( config_get( 'add_profile_threshold' ) );
Expand All @@ -93,7 +93,7 @@
profile_create( $t_user_id, $f_platform, $f_os, $f_os_build, $f_description );
form_security_purge('profile_update');

if ( ALL_USERS == $t_user_id ) {
if( ALL_USERS == $t_user_id ) {
print_header_redirect( 'manage_prof_menu_page.php' );
} else {
print_header_redirect( 'account_prof_menu_page.php' );
Expand All @@ -106,7 +106,7 @@
$f_os_build = gpc_get_string( 'os_build' );
$f_description = gpc_get_string( 'description' );

if ( profile_is_global( $f_profile_id ) ) {
if( profile_is_global( $f_profile_id ) ) {
access_ensure_global_level( config_get( 'manage_global_profile_threshold' ) );

profile_update( ALL_USERS, $f_profile_id, $f_platform, $f_os, $f_os_build, $f_description );
Expand All @@ -120,7 +120,7 @@
break;

case 'delete':
if ( profile_is_global( $f_profile_id ) ) {
if( profile_is_global( $f_profile_id ) ) {
access_ensure_global_level( config_get( 'manage_global_profile_threshold' ) );

profile_delete( ALL_USERS, $f_profile_id );
Expand Down
Loading

0 comments on commit 378804a

Please sign in to comment.