From: <jfi...@us...> - 2002-10-18 23:36:54
|
Update of /cvsroot/mantisbt/mantisbt/core In directory usw-pr-cvs1:/tmp/cvs-serv390/core Modified Files: current_user_api.php email_api.php string_api.php user_api.php user_pref_api.php Log Message: rename user_pref_api functions to have the user_pref prefix Index: current_user_api.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/current_user_api.php,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- current_user_api.php 22 Sep 2002 05:56:41 -0000 1.5 +++ current_user_api.php 18 Oct 2002 23:36:51 -0000 1.6 @@ -44,12 +44,12 @@ # -------------------- # Return the specified field of the currently logged in user function current_user_get_pref( $p_field_name ) { - return user_get_pref( auth_get_current_user_id(), $p_field_name ); + return user_pref_get( auth_get_current_user_id(), $p_field_name ); } # -------------------- # Return the specified field of the currently logged in user - function current_user_set_pref( $p_user_id, $p_pref_name, $p_pref_value ) { - return user_get_pref( auth_get_current_user_id(), $p_pref_name, $p_pref_value ); + function current_user_set_pref( $p_pref_name, $p_pref_value ) { + return user_pref_set( auth_get_current_user_id(), $p_pref_name, $p_pref_value ); } # -------------------- # Return the specified field of the currently logged in user Index: email_api.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/email_api.php,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- email_api.php 10 Oct 2002 13:33:41 -0000 1.22 +++ email_api.php 18 Oct 2002 23:36:51 -0000 1.23 @@ -110,7 +110,7 @@ $v_reporter_id = bug_get_field( $p_bug_id, 'reporter_id' ); $t_pref_field = 'email_on_' . $p_notify_type; if ( db_field_exists( $t_pref_field, $g_mantis_user_pref_table ) ) { - $t_notify_reporter = user_get_pref( $v_reporter_id, $t_pref_field ); + $t_notify_reporter = user_pref_get( $v_reporter_id, $t_pref_field ); if ( ON == $t_notify_reporter ) { $send_arr[] = user_get_email( $v_reporter_id ); } @@ -125,7 +125,7 @@ if ( $v_handler_id > 0 ) { $t_pref_field = 'email_on_' . $p_notify_type; if ( db_field_exists( $t_pref_field, $g_mantis_user_pref_table ) ) { - $t_notify_handler = user_get_pref( $v_handler_id, $t_pref_field ); + $t_notify_handler = user_pref_get( $v_handler_id, $t_pref_field ); if ( ON == $t_notify_handler ) { $send_arr[] = user_get_email( $v_handler_id ); } @@ -228,7 +228,7 @@ $t_pref_field = 'email_on_' . $p_notify_type; if ( db_field_exists( $t_pref_field, $g_mantis_user_pref_table ) ) { # if the user's notification is on then add to the list - $t_notify = user_get_pref( $row['user_id'], $t_pref_field ); + $t_notify = user_pref_get( $row['user_id'], $t_pref_field ); if ( ON == $t_notify ) { $send_arr[] = $row['email']; } Index: string_api.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/string_api.php,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- string_api.php 10 Oct 2002 12:42:23 -0000 1.8 +++ string_api.php 18 Oct 2002 23:36:51 -0000 1.9 @@ -164,7 +164,7 @@ switch ( config_get( 'show_' . $p_action ) ) { case BOTH: - if ( ON == user_get_pref( $p_user_id, 'advanced_' . $p_action ) ) { + if ( ON == user_pref_get( $p_user_id, 'advanced_' . $p_action ) ) { return 'bug_' . $p_action . '_advanced_page.php'; } else { return 'bug_' . $p_action . '_page.php'; Index: user_api.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/user_api.php,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- user_api.php 18 Oct 2002 23:04:30 -0000 1.36 +++ user_api.php 18 Oct 2002 23:36:51 -0000 1.37 @@ -216,7 +216,7 @@ # Create preferences for the user $t_user_id = db_insert_id(); - user_create_prefs( $t_user_id ); + user_pref_create( $t_user_id ); # Send notification email if ( $p_email ) { @@ -572,7 +572,7 @@ # -------------------- # Set the user's default project function user_set_default_project( $p_user_id, $p_project_id ) { - return user_set_pref( $p_user_id, 'default_project', (int)$p_project_id ); + return user_pref_set( $p_user_id, 'default_project', (int)$p_project_id ); } # -------------------- # Reset the user's password Index: user_pref_api.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/user_pref_api.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- user_pref_api.php 18 Oct 2002 23:04:30 -0000 1.1 +++ user_pref_api.php 18 Oct 2002 23:36:51 -0000 1.2 @@ -85,7 +85,7 @@ # -------------------- # return true if the user has prefs assigned for the given project, # false otherwise - function user_has_prefs( $p_user_id, $p_project_id = 0 ) { + function user_pref_exists( $p_user_id, $p_project_id = 0 ) { $c_project_id = db_prepare_int( $p_project_id ); $c_user_id = db_prepare_int( $p_user_id ); @@ -109,7 +109,7 @@ # -------------------- # create a set of default preferences for the project - function user_create_prefs( $p_user_id, $p_project_id = 0 ) { + function user_pref_create( $p_user_id, $p_project_id = 0 ) { $c_user_id = db_prepare_int( $p_user_id ); $c_project_id = db_prepare_int( $p_project_id ); @@ -159,7 +159,7 @@ # -------------------- # delete a preferencess row # returns true when the prefs wer successfully deleted - function user_delete_prefs( $p_user_id, $p_project_id = 0 ) { + function user_pref_delete( $p_user_id, $p_project_id = 0 ) { $c_user_id = db_prepare_int( $p_user_id ); $c_project_id = db_prepare_int( $p_project_id ); @@ -183,7 +183,7 @@ # -------------------- # return the user's preferences - function user_get_pref_row( $p_user_id ) { + function user_pref_get_row( $p_user_id ) { return user_pref_cache_row( $p_user_id ); } @@ -192,17 +192,17 @@ # If the preference can't be found try to return a defined default # If that fails, trigger a WARNING and return '' # @@@ needs extension for project-specific preferences - function user_get_pref( $p_user_id, $p_field_name ) { + function user_pref_get( $p_user_id, $p_pref_name ) { $row = user_pref_cache_row( $p_user_id, false ); - if ( false !== $row && isset( $row[$p_field_name] ) ) { - return $row[$p_field_name]; + if ( false !== $row && isset( $row[$p_pref_name] ) ) { + return $row[$p_pref_name]; } else { # new accounts should have had prefs created for them but older accoutns # might not yet # try to get a default value - $t_default = config_get( 'default_' . $p_field_name, null ); + $t_default = config_get( 'default_' . $p_pref_name, null ); if ( null !== $t_default ) { return $t_default; @@ -219,15 +219,15 @@ # -------------------- # Set a user preference - function user_set_pref( $p_user_id, $p_pref_name, $p_pref_value ) { + function user_pref_set( $p_user_id, $p_pref_name, $p_pref_value ) { $c_user_id = db_prepare_int( $p_user_id ); $c_pref_name = db_prepare_string( $p_pref_name ); $c_pref_value = db_prepare_string( $p_pref_value ); # in case the user doesn't have a prefs table yet (an old account perhaps?) # create a default one now - if ( ! user_has_prefs( $p_user_id ) ) { - user_create_prefs( $p_user_id ); + if ( ! user_pref_exists( $p_user_id ) ) { + user_pref_create( $p_user_id ); } $t_user_pref_table = config_get( 'mantis_user_pref_table' ); |