diff -cr core/email_api.php core/email_api.php *** core/email_api.php 2007-03-16 14:17:30.000000000 +0100 --- core/email_api.php 2007-03-16 10:35:14.000000000 +0100 *************** *** 408,413 **** --- 408,420 ---- $t_threshold_min = config_get( 'notify_new_user_created_threshold_min' ); $t_threshold_users = project_get_all_user_rows( ALL_PROJECTS, $t_threshold_min ); + + if (config_get( 'activate_notify_new_user_created_threshold_min_projects' )) + { + $t_threshold_min = config_get( 'notify_new_user_created_threshold_min_projects' ); + $t_threshold_users_projects = all_projects_get_all_user_rows( $t_threshold_min ); + $t_threshold_users = array_merge ($t_threshold_users, $t_threshold_users_projects); + } foreach( $t_threshold_users as $t_user ) { lang_push( user_pref_get_language( $t_user['id'] ) ); diff -cr core/project_api.php core/project_api.php *** core/project_api.php 2007-03-16 14:17:41.000000000 +0100 --- core/project_api.php 2007-03-16 10:35:14.000000000 +0100 *************** *** 442,447 **** --- 442,487 ---- } # -------------------- + # Return an array of info about users who have access to all projects. (depending on access level) + # For each user we have 'id', 'username', and 'access_level' (overall access level) + # Return only users with an access level higher than the given value in the first parameter. + function all_projects_get_all_user_rows( $p_access_level = ANYBODY ) + { + $c_access_level = db_prepare_int( $p_access_level ); + + # Optimization when access_level is NOBODY + if ( NOBODY == $p_access_level ) + { + return array(); + } + + $t_user_table = config_get( 'mantis_user_table' ); + $t_project_user_list_table = config_get( 'mantis_project_user_list_table' ); + $t_project_table = config_get( 'mantis_project_table' ); + + $t_on = ON; + $t_users = array(); + + # Get the project overrides + $query = "SELECT u.id, u.username, u.realname, l.access_level + FROM $t_project_user_list_table l, $t_user_table u + WHERE l.user_id = u.id + AND u.enabled = $t_on + AND l.access_level >= $c_access_level + GROUP BY u.id"; + + $result = db_query( $query ); + $t_row_count = db_num_rows( $result ); + for ( $i=0 ; $i < $t_row_count ; $i++ ) { + $row = db_fetch_array( $result ); + $t_users[$row['id']] = $row; + } + + return array_values( $t_users ); + } + + + # -------------------- # Return an array of info about users who have access to the the given project # For each user we have 'id', 'username', and 'access_level' (overall access level) # If the second parameter is given, return only users with an access level