mirror of
				https://github.com/Mibew/i18n.git
				synced 2025-11-04 02:35:07 +03:00 
			
		
		
		
	Create some usefull groups functions
Create group_is_online and get_group_description functions.
This commit is contained in:
		
							parent
							
								
									3c080e4725
								
							
						
					
					
						commit
						f1803662a8
					
				@ -128,4 +128,36 @@ function get_group_email($group_id) {
 | 
			
		||||
	return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Check if group online
 | 
			
		||||
 *
 | 
			
		||||
 * @param array $group Associative group array. Should contain 'ilastseen' key.
 | 
			
		||||
 * @return bool
 | 
			
		||||
 */
 | 
			
		||||
function group_is_online($group) {
 | 
			
		||||
	return ($group['ilastseen'] !== NULL
 | 
			
		||||
		&& $group['ilastseen'] < Settings::get('online_timeout'));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Return local or common group description depending on current locale.
 | 
			
		||||
 *
 | 
			
		||||
 * @global string $home_locale Code of the home locale
 | 
			
		||||
 * @global string $current_locale Code of the current locale
 | 
			
		||||
 * @param array $group Associative group array. Should contain following keys:
 | 
			
		||||
 *  - 'vccommondescription': string, contain common description of the group;
 | 
			
		||||
 *  - 'vclocaldescription': string, contain local description of the group.
 | 
			
		||||
 * @return string Group description
 | 
			
		||||
 */
 | 
			
		||||
function get_group_description($group) {
 | 
			
		||||
	global $home_locale, $current_locale;
 | 
			
		||||
	if ($home_locale == $current_locale
 | 
			
		||||
			|| !isset($group['vccommondescription'])
 | 
			
		||||
			|| !$group['vccommondescription']) {
 | 
			
		||||
		return $group['vclocaldescription'];
 | 
			
		||||
	} else {
 | 
			
		||||
		return $group['vccommondescription'];
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
?>
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user