Пример #1
0
     $domain = $_REQUEST['domain'];
     $package = intval($_REQUEST['package']);
     $shell = $_REQUEST['shell'];
     $break = false;
     // check username
     if (true !== ($res = ZUser::chkUsername($username))) {
         $err['name'] = $res == 'invalid' ? t('Username Invalid. No uppercase, not starting with number, less than 7 chars.') : t('Username Occupied.');
         $break = true;
     }
     // check password
     if (true !== ($res = ZUser::chkPassword($password))) {
         $err['password'] = t('Password can not be empty.');
         $break = true;
     }
     // check domain
     if (true !== ($res = ZVhosts::chkDomain($domain))) {
         $err['domain'] = t('Domain Invalid.');
         if ($res == 'occupied') {
             $err['domain'] = t('Domain Occupied.');
         }
         $break = true;
     }
     if ($break) {
         break;
     }
     // execute!
     $r1 = ZUser::adduser_request($username, $password, $package);
     $r2 = ZVhosts::addvhost($username, $domain);
     $r3 = ZDatabase::addmysqluser($username, $password);
     setmsg(t('Adduser request pending. It will take a few minutes to take into effect.'), 'notice');
 }
Пример #2
0
 case 'edit':
     $name = preg_replace("/[^0-9a-z\\-\\.]/", '', $_REQUEST['name']);
     if (!$name || $name == 'default') {
         $name = '';
     }
     if (!in_array($name, ZVhosts::listMyVhosts(true)) && !isadmin()) {
         setmsg(t('No such domain hosted.'));
     }
     if (checktoken() && 'alias' == $_REQUEST['op']) {
         $alias = strtolower(trim($_REQUEST['alias']));
         $alias = preg_replace("/[^a-z0-9\\.\\-\\*]+/", " ", $alias);
         $pieces = explode(' ', $alias);
         $removed = array();
         $aliases = ZVhosts::getAliases($name);
         foreach ($pieces as $k => $v) {
             if (true !== ZVhosts::chkDomain($v) && !in_array($v, explode(' ', $aliases))) {
                 $removed[] = $v;
                 unset($pieces[$k]);
             }
         }
         $alias = join(' ', $pieces);
         if (!$alias) {
             $alias = 'x';
         }
         $res = $pdo->update('site', array('aliases' => $alias), "name='{$name}'");
         if ($res) {
             $message = t("Httpd configuration saved.");
         }
         if ($removed) {
             $message = t("Alias invalid or occupied: ") . "<br />" . join(', ', $removed);
         }
Пример #3
0
function chkDomain($domain)
{
    return ZVhosts::chkDomain($domain);
}