domain name check
Now we check and have a WARNING messagge for domain names.
This commit is contained in:
parent
5faece155d
commit
7c90bad146
15
lib/sites
15
lib/sites
|
@ -40,6 +40,20 @@ wp_cache_plugins() {
|
|||
fi
|
||||
}
|
||||
|
||||
domain_check() {
|
||||
local din="$1"
|
||||
|
||||
# Only numerals 0-9, basic Latin letters, both lowercase and uppercase, hyphen.
|
||||
[[ $din =~ ^[\.0-9A-Za-z\-]+$ ]] || domfail="true"
|
||||
|
||||
# Check Lenght
|
||||
[[ ${#din} -gt 67 ]] && domfail="true"
|
||||
|
||||
# Can not start or end with a hyphen
|
||||
[[ $(echo "${din}" | cut -c-1) == "-" || $(echo "${din}" | rev | cut -c-1) == "-" ]] && domfail="true"
|
||||
|
||||
[[ $domfail == "true" ]] && echo "${red}[WARNING] Domain names can only contain letters, numbers or a hyphen; can not start or end with a hyphen and can be up to 67 characters long.${end}"
|
||||
}
|
||||
|
||||
dbword_check() {
|
||||
local win="$1"
|
||||
|
@ -449,6 +463,7 @@ deletesite() {
|
|||
|
||||
|
||||
createsite() {
|
||||
domain_check $domain
|
||||
if [[ $(conf_read php) != "true" && ("$wp" == [123] || "$type" == "-php") ]]; then
|
||||
echo "${red}"
|
||||
echo " [ERROR] PHP must be installed before you can create a WP site!"
|
||||
|
|
|
@ -210,6 +210,7 @@ elif [ "$type" == "-wpsubdom" ]; then
|
|||
|
||||
# Parked Domain
|
||||
elif [ "$type" == "-parked" ]; then
|
||||
domain_check $domain
|
||||
# Check for duplicate sites
|
||||
if [[ -a /etc/nginx/sites-available/$domain ]]; then
|
||||
echo "${red}Site $domain could not be created because already exists!${end}"
|
||||
|
|
Loading…
Reference in a new issue