示例#1
0
 static function add($parent, $class, $param)
 {
     global $gbl, $sgbl, $login, $ghtml;
     if ($class === 'subdomain') {
         $param['nname'] = "{$param['nname']}.{$param['subdomain_parent']}";
     }
     validate_domain_name($param['nname']);
     lxclient::fixpserver_list($param);
     $param['nname'] = strtolower($param['nname']);
     if (exists_in_db(null, 'addondomain', $param['nname'])) {
         throw new lxException('domain_already_exists_as_pointer', 'parent');
     }
     $param['web-nname'] = $param['nname'];
     $param['dns-nname'] = $param['nname'];
     $param['dns-zone_type'] = 'master';
     $param['mmail-nname'] = $param['nname'];
     // the uuser is two steps removed from the main object (domain), and thus the automatic nname creation doesn't seem to work. So we have to do it here.
     /*
     $param['realpass'] = $param['password'];
     $param['password'] = crypt($param['password']);
     */
     return $param;
 }
示例#2
0
 static function add($parent, $class, $param)
 {
     global $gbl, $sgbl, $login, $ghtml;
     if (if_demo()) {
         throw new lxException("demo", $v);
     }
     lxclient::fixpserver_list($param);
     $param['nname'] = strtolower($param['nname']);
     if (!cse($param['nname'], ".vm")) {
         $param['nname'] .= ".vm";
     }
     if (csa($param['nname'], '-')) {
         throw new lxexception('name_cannot_contain_dash', 'nname', '');
     }
     if (csa($param['nname'], ' ')) {
         throw new lxexception('name_cannot_contain_space', 'nname', '');
     }
     // the uuser is two steps removed from the main object (domain), and thus the automatic nname creation doesn't seem to work. So we have to do it here.
     $param['realpass'] = $param['password'];
     $param['password'] = crypt($param['password']);
     $total = db_get_value("pserver", $param['syncserver'], "max_vps_num");
     if ($total) {
         $sq = new Sqlite(null, 'vps');
         $countres = $sq->rawQuery("select count(*) from vps where syncserver = '{$param['syncserver']}'");
         $countres = $countres[0]['count(*)'];
         if ($countres >= $total) {
             throw new lxexception('vps_per_server_exceeded', 'syncserver', "{$countres} > {$total}");
         }
     }
     return $param;
 }