Project

General

Profile

« Previous | Next » 

Revision c078dd89

Added by Renato Botelho about 9 years ago

Implement pkg_valid_name()

View differences:

src/etc/inc/pkg-utils.inc
83 83
	}
84 84
}
85 85

  
86
/* Validate if pkg name is valid */
87
function pkg_valid_name($pkgname) {
88
	global $g;
89

  
90
	$pattern = "/^{$g['pkg_prefix']}[a-zA-Z0-9\.\-_]+$/";
91
	return preg_match($pattern, $pkgname);
92
}
93

  
86 94
/* Remove pkg_prefix from package name if it's present */
87 95
function pkg_remove_prefix(&$pkg_name) {
88 96
	global $g;

Also available in: Unified diff