public static function exists($group, $check_system = false)
	{
		$db = \App::get('db');

		if (empty($group))
		{
			return false;
		}

		if ($check_system)
		{
			if (is_numeric($group) && posix_getgrgid($group))
			{
				return true;
			}

			if (!is_numeric($group) && posix_getgrnam($group))
			{
				return true;
			}
		}

		// check reserved
		if (Validate::reserved('group', $group))
		{
			return true;
		}

		if (is_numeric($group))
		{
			$query = 'SELECT gidNumber FROM `#__xgroups` WHERE gidNumber=' . $db->quote($group);
		}
		else
		{
			$query = 'SELECT gidNumber FROM `#__xgroups` WHERE cn=' . $db->quote($group);
		}

		$db->setQuery($query);

		if (!$db->query())
		{
			return false;
		}

		if ($db->loadResult() > 0)
		{
			return true;
		}

		return false;
	}
public static function exists($group, $check_system = false)
	{
		$db = \App::get('db');

		if (empty($group))
		{
			return false;
		}

		if ($check_system)
		{
			if (is_numeric($group) && posix_getgrgid($group))
			{
				return true;
			}

			if (!is_numeric($group) && posix_getgrnam($group))
			{
				return true;
			}
		}

		// check reserved
		if (Validate::reserved('group', $group))
		{
			return true;
		}

		if (is_numeric($group))
		{
			$query = 'SELECT gidNumber FROM `#__xgroups` WHERE gidNumber=' . $db->quote($group);
		}
		else
		{
			$query = 'SELECT gidNumber FROM `#__xgroups` WHERE cn=' . $db->quote($group);
		}

		$db->setQuery($query);

		if (!$db->query())
		{
			return false;
		}

		if ($db->loadResult() > 0)
		{
			return true;
		}

		return false;
	}
public static function exists ( $ group , $ check_system = false ) { $ db = \ App :: get ( 'db' ) ; if ( empty ( $ group ) ) { return false ; } if ( $ check_system ) { if ( is_numeric ( $ group ) && posix_getgrgid ( $ group ) ) { return true ; } if ( ! is_numeric ( $ group ) && posix_getgrnam ( $ group ) ) { return true ; } } // check reserved if ( Validate :: reserved ( 'group' , $ group ) ) { return true ; } if ( is_numeric ( $ group ) ) { $ query = 'SELECT gidNumber FROM `#__xgroups` WHERE gidNumber=' . $ db -> quote ( $ group ) ; } else { $ query = 'SELECT gidNumber FROM `#__xgroups` WHERE cn=' . $ db -> quote ( $ group ) ; } $ db -> setQuery ( $ query ) ; if ( ! $ db -> query ( ) ) { return false ; } if ( $ db -> loadResult ( ) > 0 ) { return true ; } return false ; }
Check if a group exists.
Given the group id, returns true if group exists.

@param   integer  $group         The group id number (GID) of the group being verified.
@param   boolean  $check_system  Boolean for checking against POSIX user.
@return  boolean  Returns false if group does not exist; true if group exists.
Check if a group exists . Given the group id returns true if group exists .