static function CheckForErrors($username, $password) { global $zdbh; $retval = FALSE; // Check to make sure the username and password is not blank before we go any further... if ($username == '' || $password == '') { self::$blank = TRUE; $retval = TRUE; } // Check for invalid username if (!self::IsValidUserName($username)) { self::$badname = true; $retval = TRUE; } // Check to make sure the cron is not a duplicate... $sql = "SELECT COUNT(*) FROM x_ftpaccounts WHERE ft_user_vc=:userid AND ft_deleted_ts IS NULL"; $numrows = $zdbh->prepare($sql); $numrows->bindParam(':userid', $username); if ($numrows->execute()) { if ($numrows->fetchColumn() != 0) { self::$alreadyexists = TRUE; $retval = TRUE; } } return $retval; }
static function CheckCreateForErrors($domain) { global $zdbh; // Check for spaces and remove if found... $domain = strtolower(str_replace(' ', '', $domain)); // Check to make sure the domain is not blank before we go any further... if ($domain == '') { self::$blank = TRUE; return FALSE; } // Check for invalid characters in the domain... if (!self::IsValidDomainName($domain)) { self::$badname = TRUE; return FALSE; } // Check to make sure the domain is in the correct format before we go any further... if (strpos($domain, 'www.') === 0) { self::$error = TRUE; return FALSE; } // Check to see if the domain already exists in Sentora somewhere and redirect if it does.... $sql = "SELECT COUNT(*) FROM x_vhosts WHERE vh_name_vc=:domain AND vh_deleted_ts IS NULL"; $numrows = $zdbh->prepare($sql); $numrows->bindParam(':domain', $domain); if ($numrows->execute()) { if ($numrows->fetchColumn() > 0) { self::$alreadyexists = TRUE; return FALSE; } } // Check to make sure user not adding a subdomain and blocks stealing of subdomains.... // Get shared domain list $SharedDomains = array(); $a = explode(',', ctrl_options::GetSystemOption('shared_domains')); foreach ($a as $b) { $SharedDomains[] = $b; } if (substr_count($domain, ".") > 1) { $part = explode('.', $domain); foreach ($part as $check) { if (!in_array($check, $SharedDomains)) { if (strlen($check) > 13) { $sql = $zdbh->prepare("SELECT * FROM x_vhosts WHERE vh_name_vc LIKE :check AND vh_type_in !=2 AND vh_deleted_ts IS NULL"); $checkSql = '%' . $check . '%'; $sql->bindParam(':check', $checkSql); $sql->execute(); while ($rowcheckdomains = $sql->fetch()) { $subpart = explode('.', $rowcheckdomains['vh_name_vc']); foreach ($subpart as $subcheck) { if (strlen($subcheck) > 3) { if ($subcheck == $check) { if (substr($domain, -7) == substr($rowcheckdomains['vh_name_vc'], -7)) { self::$nosub = TRUE; return FALSE; } } } } } } } } } return TRUE; }
static function CheckCronForErrors() { global $zdbh; global $controller; $retval = FALSE; //Try to create the cron file if it doesnt exist... if (!file_exists(ctrl_options::GetSystemOption('cron_file'))) { fs_filehandler::UpdateFile(ctrl_options::GetSystemOption('cron_file'), 0644, ""); } $currentuser = ctrl_users::GetUserDetail(); // Check to make sure the cron is not blank before we go any further... if ($controller->GetControllerRequest('FORM', 'inScript') == '') { self::$blank = TRUE; $retval = TRUE; } // Check to make sure the cron script exists before we go any further... if (!is_file(fs_director::RemoveDoubleSlash(fs_director::ConvertSlashes(ctrl_options::GetSystemOption('hosted_dir') . $currentuser['username'] . '/public_html/' . $controller->GetControllerRequest('FORM', 'inScript'))))) { self::$noexists = TRUE; $retval = TRUE; } // Check to see if creating system cron file was successful... if (!is_file(ctrl_options::GetSystemOption('cron_file'))) { self::$cronnoexists = TRUE; $retval = TRUE; } // Check to makesystem cron file is writable... if (!is_writable(ctrl_options::GetSystemOption('cron_file'))) { self::$cronnowrite = TRUE; $retval = TRUE; } // Check to make sure the cron is not a duplicate... $sql = "SELECT COUNT(*) FROM x_cronjobs WHERE ct_acc_fk=:userid AND ct_script_vc=:inScript AND ct_deleted_ts IS NULL"; $numrows = $zdbh->prepare($sql); $numrows->bindParam(':userid', $currentuser['userid']); $numrows->bindParam(':inScript', $controller->GetControllerRequest('FORM', 'inScript')); if ($numrows->execute()) { if ($numrows->fetchColumn() != 0) { self::$alreadyexists = TRUE; $retval = TRUE; } } return $retval; }
static function CheckCreateForErrors($username, $database, $access) { global $zdbh; // Check to make sure the user name is not blank before we go any further... if ($username == '') { self::$blank = true; return false; } // Check to make sure the user name is not blank before we go any further... if ($username == 'root') { self::$rootabuse = true; return false; } // Check to make sure the user name is not blank before we go any further... if ($database == '') { self::$blank = true; return false; } // Check to make sure the user name is not a duplicate... $sql = "SELECT COUNT(*) FROM x_mysql_users WHERE mu_name_vc=:username AND mu_deleted_ts IS NULL"; $numrows = $zdbh->prepare($sql); $numrows->bindParam(':username', $username); if ($numrows->execute()) { if ($numrows->fetchColumn() != 0) { self::$alreadyexists = true; return false; } } // Check to make sure the user name is not a duplicate (checks actual mysql table)... $sql = "SELECT EXISTS(SELECT 1 FROM mysql.user WHERE user = :username)"; $numrows = $zdbh->prepare($sql); $numrows->bindParam(':username', $username); if ($numrows->execute()) { if ($numrows->fetchColumn() != 0) { self::$alreadyexists = true; return false; } } // Check for invalid username if (!self::IsValidUserName($username)) { self::$badname = true; return false; } // Check for invalid IP address if ($access != "%" && strtolower($access) != "localhost") { if (!sys_monitoring::IsAnyValidIP($access)) { self::$badIP = true; return false; } } return true; }
static function CheckCreateForErrors($subdomain, $domain) { global $zdbh; // Check for spaces and remove if found... $subdomain = strtolower(str_replace(' ', '', $subdomain)); // Check to make sure the domain is not blank before we go any further... if ($subdomain == '') { self::$blank = TRUE; return FALSE; } // Check for invalid characters in the domain... if (!self::IsValidDomainName($subdomain)) { self::$badname = TRUE; return FALSE; } // Check for input manipulation domains that aren't ours if (!self::IsValidDomain($domain)) { self::$badname = TRUE; return FALSE; } // Check to make sure the domain is in the correct format before we go any further... if (strpos($domain, 'www.') === 0) { self::$error = TRUE; return FALSE; } // Check to see if the domain already exists in MADmin somewhere and redirect if it does.... $sql = "SELECT COUNT(*) FROM x_vhosts WHERE vh_name_vc=:domain AND vh_deleted_ts IS NULL"; $numrows = $zdbh->prepare($sql); $numrows->bindParam(':domain', $subdomain); if ($numrows->execute()) { if ($numrows->fetchColumn() > 0) { self::$alreadyexists = TRUE; return FALSE; } } return TRUE; }
static function CheckUpdateForErrors($email, $fullname, $language, $phone, $address, $postalCode) { global $zdbh; if (fs_director::CheckForEmptyValue($email) || fs_director::CheckForEmptyValue($fullname) || fs_director::CheckForEmptyValue($language) || fs_director::CheckForEmptyValue($phone) || fs_director::CheckForEmptyValue($address) || fs_director::CheckForEmptyValue($postalCode)) { self::$blank = true; return false; } if (!self::IsValidEmail($email)) { self::$emailerror = true; return false; } return true; }
static function CheckCreateForErrors($username, $databasename) { global $zdbh; # Check to make sure the database name is not blank before we go any further... if ($databasename == '') { self::$blank = true; return false; } // Check for invalid username if (!self::IsValidUserName($databasename)) { self::$badname = true; return false; } # Check to make sure the database is not a duplicate... $sql = "SELECT COUNT(*) FROM x_mysql_databases WHERE my_name_vc=:dbName AND my_deleted_ts IS NULL"; $dbName = $username . "_" . $databasename; $numrows = $zdbh->prepare($sql); $numrows->bindParam(':dbName', $dbName); if ($numrows->execute()) { if ($numrows->fetchColumn() != 0) { self::$alreadyexists = true; return false; } } return true; }
static function CheckCreateForErrors($packagename, $uid, $pid = 0) { global $zdbh; $packagename = str_replace(' ', '', $packagename); # Check to make sure the packagename is not blank or exists for reseller before we go any further... if (!fs_director::CheckForEmptyValue($packagename)) { $sql = "SELECT COUNT(*) FROM x_packages WHERE UPPER(pk_name_vc)=:packageNameSlashes AND pk_reseller_fk=:uid AND pk_id_pk !=:pid AND pk_deleted_ts IS NULL"; $packageNameSlashes = addslashes(strtoupper($packagename)); $numrows = $zdbh->prepare($sql); $numrows->bindParam(':packageNameSlashes', $packageNameSlashes); $numrows->bindParam(':uid', $uid); $numrows->bindParam(':pid', $pid); if ($numrows->execute()) { if ($numrows->fetchColumn() != 0) { self::$alreadyexists = true; return false; } } } else { self::$blank = true; return false; } // Check packagename format. if (!self::IsValidPackageName($packagename)) { self::$badname = true; return false; } return true; }