diff options
-rw-r--r-- | src/etc/inc/pkg-utils.inc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/etc/inc/pkg-utils.inc b/src/etc/inc/pkg-utils.inc index daa0a55..6f3f18e 100644 --- a/src/etc/inc/pkg-utils.inc +++ b/src/etc/inc/pkg-utils.inc @@ -83,6 +83,14 @@ if (!function_exists("pkg_debug")) { } } +/* Validate if pkg name is valid */ +function pkg_valid_name($pkgname) { + global $g; + + $pattern = "/^{$g['pkg_prefix']}[a-zA-Z0-9\.\-_]+$/"; + return preg_match($pattern, $pkgname); +} + /* Remove pkg_prefix from package name if it's present */ function pkg_remove_prefix(&$pkg_name) { global $g; |