Esempio n. 1
0
 function updateform($subaction, $param)
 {
     global $gbl, $sgbl, $login, $ghtml;
     $gen = $login->getObject('general')->generalmisc_b;
     switch ($subaction) {
         case "dialogsize":
             $vlist['dialogsize'] = null;
             return $vlist;
         case "boxposopen":
             $vlist['title_class'] = null;
             $vlist['title_open'] = null;
             $vlist['title_name'] = null;
             return $vlist;
         case "boxpos":
             $vlist['title_class'] = null;
             $vlist['title_open'] = null;
             $vlist['title_name'] = null;
             $vlist['page'] = null;
             return $vlist;
         case "addshortcut":
             $vlist['shortcut'] = null;
             return $vlist;
         case "resendwelcome":
             $vlist['extra_email_f'] = null;
             $vlist['password'] = null;
             $vlist['__v_updateall_button'] = array();
             return $vlist;
         case "disable_per":
             if ($this->islogin()) {
                 throw new lxException('you_cannot_set_your_own_limit', '');
             }
             $vlist['disable_per'] = array('s', array('off', '95', '100', '110', '120', '130'));
             return $vlist;
         case "miscinfo":
             $vlist['nname'] = array('M', $this->nname);
             $vlist['realname'] = "";
             $vlist['add_address'] = "";
             $vlist['add_city'] = "";
             $vlist['add_country'] = "";
             $vlist['add_telephone'] = "";
             $vlist['add_fax'] = "";
             return $vlist;
         case "limit_s":
         case "limit":
             if ($this->islogin()) {
                 throw new lxException('you_cannot_set_your_own_limit', '');
             }
             if (cse($this->get__table(), "template")) {
                 $class = strtil($this->get__table(), "template");
                 $vlist = getQuotaListForClass($class);
             } else {
                 $vlist = $this->getQuotaVariableList();
             }
             // This is patently wrong. In update, the object is inititialized properly and we are suppsed to get the quota for the specific type of object and not for the class.... Changing it to $this.
             $sgbl->method = 'post';
             //$vlist['__v_updateall_button'] = array();
             return $vlist;
         case "change_plan":
             $parent = $this->getParentO();
             $ttlist = $parent->getTemplateList("resourceplan", false);
             $this->newresourceplan = $this->resourceplan_used;
             if (!$ttlist) {
                 $vlist['newresourceplan'] = array("M", "No Plan in Parent");
             } else {
                 $vlist['newresourceplan'] = array("A", $ttlist);
             }
             //$vlist['__v_updateall_button'] = array();
             return $vlist;
         case "password":
             if ($this->isLogin() || $this->is__table('auxiliary') && $this->getParentO()->isAuxiliary()) {
                 $vlist['old_password_f'] = "";
             }
             $vlist['password'] = "";
             $vlist['__v_updateall_button'] = array();
             return $vlist;
     }
     return parent::updateform($subaction, $param);
 }
Esempio n. 2
0
function fixResourcePlan()
{
    global $gbl, $sgbl, $login, $ghtml;
    $login->loadAllObjects('resourceplan');
    $list = $login->getList('resourceplan');
    foreach ($list as $l) {
        $qv = getQuotaListForClass('client');
        $write = false;
        foreach ($qv as $k => $v) {
            if ($k === 'centralbackup_flag') {
                if (!isset($l->priv->centralbackup_flag)) {
                    $l->priv->centralbackup_flag = $l->centralbackup_flag;
                    $write = true;
                }
                continue;
            }
            if (!isset($l->priv->{$k})) {
                if (cse($k, "_flag")) {
                    if (is_default_quota_flag_on($k)) {
                        $l->priv->{$k} = 'on';
                        $write = true;
                    }
                }
            }
        }
        if ($write) {
            $l->setUpdateSubaction();
            $l->write();
            $write = false;
        }
    }
}
Esempio n. 3
0
 static function addform($parent, $class, $typetd = null)
 {
     if ($parent->isClient()) {
         $list = get_namelist_from_objectlist($parent->getList('domain'));
         $vv = array('var' => 'real_clparent_f', 'val' => array('s', $list));
         $vlist['nname'] = array('m', array('posttext' => "@", 'postvar' => $vv));
     } else {
         $vlist['nname'] = array('m', array('posttext' => "@{$parent->nname}"));
     }
     $vlist['password'] = "";
     $qvlist = getQuotaListForClass('mailaccount', array());
     $vlist = lx_array_merge(array($vlist, $qvlist));
     $ret['variable'] = $vlist;
     $ret['action'] = "add";
     return $ret;
 }
Esempio n. 4
0
 static function continueForm($parent, $class, $param, $continueaction)
 {
     global $gbl, $sgbl, $login, $ghtml;
     $vlist = null;
     self::validate_client_name($param['nname']);
     $param['nname'] = trim($param['nname']);
     if ($continueaction === 'server') {
         if (isOn($param['send_welcome_f'])) {
             if (!$param['contactemail']) {
                 throw new lxexception("sending_welcome_needs_contactemail", array('contactemail', 'send_welcome_f'), '');
             }
             if (!validate_email($param['contactemail'])) {
                 throw new lxexception("contactemail_is_not_valid_email_address", 'contactemail', '');
             }
         }
         dprintr($param);
         if ($param['resourceplan_f'] !== 'continue_without_plan') {
             $param['use_resourceplan_f'] = 'On';
             $ret['param'] = $param;
             $ret['action'] = 'addnow';
             return $ret;
         }
         $array = client::getPserverListPriv();
         foreach ((array) $array as $a) {
             $v = "{$a}_list";
             if (!$parent->listpriv->{$v}) {
                 //throw new lxException ("no_server_pool", $v);
             }
             $param["listpriv_s_{$a}_list"] = $parent->listpriv->{$v};
         }
         // This is a hack... This should now only happen in kloxo and not in hypervm.
         if (isset($param['listpriv_s_webpserver_list'])) {
             $weblist = $param['listpriv_s_webpserver_list'];
             $param['listpriv_s_ipaddress_list'] = $parent->getIpaddress($weblist);
             $nlist = domain::getDnsTemplateList($parent);
             $param['dnstemplate_list'] = $nlist;
         }
         $qvlist = getQuotaListForClass('client', $param);
         $vlist = lx_merge_good($vlist, $qvlist);
         $ret['action'] = "add";
         //$ret['continueaction'] = 'server';
         $ret['variable'] = $vlist;
         $ret['param'] = $param;
     }
     return $ret;
 }
Esempio n. 5
0
 static function continueForm($parent, $class, $param, $continueaction)
 {
     global $gbl, $sgbl, $login, $ghtml;
     $vlist = null;
     self::validate_client_name($param['nname']);
     // and issue #657 - Client user names with "__" are displayed with missing end
     if (stristr($param['nname'], '__')) {
         throw new lxexception("{$param['nname']}_use_double_underscore", 'nname');
     }
     // also check if /home/<client> exists --> prevent use like 'httpd' as client
     /*
     	if (lxfile_exists("/home/{$param['nname']}")) {
     		throw new lxexception("{$param['nname']}_dir_exists_under_home_dir", 'nname');
     
     	}
     */
     $reserved = array('apache', 'lighttpd', 'nginx', 'httpd', 'kloxo', 'lxadmin', 'lxlabs', 'lxcenter', 'nouser', 'tinydns', 'axfrdns', 'dnscache', 'dnslog', 'bind', 'named');
     foreach ($reserved as $r) {
         if ($param['nname'] === $r) {
             throw new lxexception("{$param['nname']}_dir_as_reserved_under_home_dir", 'nname');
         }
     }
     $param['nname'] = trim($param['nname']);
     if ($continueaction === 'server') {
         if (isOn($param['send_welcome_f'])) {
             if (!$param['contactemail']) {
                 throw new lxexception("sending_welcome_needs_contactemail", array('contactemail', 'send_welcome_f'), '');
             }
             // accept to more contact mail - http://forum.lxcenter.org/index.php?t=msg&goto=89118
             $contact = implode(",", str_replace(" ", "", $param['contactemail']));
             foreach ($contact as $c) {
                 if (!validate_email($c)) {
                     throw new lxexception("contactemail_is_not_valid_email_address", 'contactemail', '');
                 }
             }
         }
         dprintr($param);
         if ($param['resourceplan_f'] !== 'continue_without_plan') {
             $param['use_resourceplan_f'] = 'On';
             $ret['param'] = $param;
             $ret['action'] = 'addnow';
             return $ret;
         }
         $array = client::getPserverListPriv();
         foreach ((array) $array as $a) {
             $v = "{$a}_list";
             if (!$parent->listpriv->{$v}) {
                 //throw new lxException ("no_server_pool", $v);
             }
             $param["listpriv_s_{$a}_list"] = $parent->listpriv->{$v};
         }
         // This is a hack... This should now only happen in kloxo and not in hypervm.
         if (isset($param['listpriv_s_webpserver_list'])) {
             $weblist = $param['listpriv_s_webpserver_list'];
             $param['listpriv_s_ipaddress_list'] = $parent->getIpaddress($weblist);
             $nlist = domain::getDnsTemplateList($parent);
             $param['dnstemplate_list'] = $nlist;
         }
         $qvlist = getQuotaListForClass('client', $param);
         $vlist = lx_merge_good($vlist, $qvlist);
         $ret['action'] = "add";
         //$ret['continueaction'] = 'server';
         $ret['variable'] = $vlist;
         $ret['param'] = $param;
     }
     return $ret;
 }
Esempio n. 6
0
 static function addform($parent, $class, $typetd = null)
 {
     $res = domain::getDnsTemplateList($parent);
     $vlist['nname'] = null;
     $vlist['description'] = null;
     $iplist = $parent->getIpaddress(array('localhost'));
     if (!$iplist) {
         $iplist = getAllIpaddress();
     }
     $vlist['ipaddress'] = array('s', $iplist);
     //$vlist['dbtype_list'] = null;
     $vlist['dnstemplate'] = array('s', $res);
     //$vlist['share_status'] = null;
     $vlist['__c_subtitle_quota'] = "Quota";
     $qvlist = getQuotaListForClass('domain', array());
     $vlist = lx_array_merge(array($vlist, $qvlist));
     $vlist['__c_subtitle_mail'] = "Mail";
     $vlist['catchall'] = array('s', array('--bounce--', 'postmaster', 'Delete'));
     $ret['action'] = "add";
     $ret['variable'] = $vlist;
     return $ret;
 }
 static function addform($parent, $class, $typetd = null)
 {
     $vlist['nname'] = "";
     $vlist['description'] = null;
     //$vlist['share_status'] = null;
     $qvlist = getQuotaListForClass('client', array());
     $vlist = lx_array_merge(array($vlist, $qvlist));
     $ret['variable'] = $vlist;
     $ret['action'] = "add";
     return $ret;
 }
Esempio n. 8
0
 static function addform($parent, $class, $typetd = null)
 {
     /*
     	if ($parent->isNotCustomer()) {
     		$vlist['__m_message_pre'] = "domain_not_customer";
     		$ret['variable'] = $vlist;
     		$ret['action'] = '';
     		return $ret;
     	}
     */
     $res = DomainBase::getDnsTemplateList($parent);
     $vlist['nname'] = "";
     $dir = "__path_customer_root/{$parent->getPathFromName()}";
     $dir = expand_real_root($dir);
     if ($parent->priv->isOn('document_root_flag')) {
         $vlist['docroot'] = array('m', array('pretext' => "{$dir}/"));
     }
     //$templatelist = $parent->getResourcePlanList('resourceplan');
     //$vlist['password'] = null;
     $vlist['__v_button'] = 'add';
     $vlist['dnstemplate_f'] = make_hidden_if_one($res);
     //$vlist['resourceplan_f'] = array('A', $templatelist);
     //$vlist['__c_subtitle_quota'] = 'Features';
     $qvlist = getQuotaListForClass('domain', array('ttype' => 'virtual', 'webpserver' => $parent->websyncserver));
     $vlist = lx_array_merge(array($vlist, $qvlist));
     $ret['variable'] = $vlist;
     $ret['action'] = "add";
     return $ret;
 }
Esempio n. 9
0
 static function continueForm($parent, $class, $param, $continueaction)
 {
     global $gbl, $sgbl, $login, $ghtml;
     /*
     	if(!eregi("^[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,5})$", $param['nname'])) { 
     		throw new lxException('invalid_domain_name', 'nname');
     	}
     */
     if (!cse($param['nname'], ".vm")) {
         $param['nname'] .= ".vm";
     }
     $param['nname'] = strtolower($param['nname']);
     if ($param['one_ipaddress_f']) {
         full_validate_ipaddress($param['one_ipaddress_f']);
     }
     /*
     	if (!preg_match("/[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+]/i", $param['nname'])) {
     		throw new lxException('domain_name_invalid', 'nname');
     	}
     */
     if (isOn($param['send_welcome_f'])) {
         if (!$param['contactemail']) {
             throw new lxexception("sending_welcome_needs_contactemail", array('contactemail', 'send_welcome_f'), '');
         }
         if (!validate_email($param['contactemail'])) {
             throw new lxexception("contactemail_is_not_valid_email_address", 'contactemail', '');
         }
     }
     if ($param['resourceplan_f'] === 'continue_without_plan') {
         $vlist['__c_subtitle_quota'] = 'Quota';
         $qvlist = getQuotaListForClass('vps');
         $vlist = lx_merge_good($vlist, $qvlist);
         $ret['param'] = $param;
         $ret['variable'] = $vlist;
         $ret['action'] = "Add";
     } else {
         $template = getFromAny(array($login, $parent), 'resourceplan', $param['resourceplan_f']);
         $param['use_resourceplan_f'] = 'on';
         if (!$template) {
             throw new lxexception("the_template_doesnt_exist", 'resourceplan_f', $param['resourceplan_f']);
         }
         $ret['action'] = 'addnow';
         $ret['param'] = $param;
         return $ret;
     }
     return $ret;
 }
Esempio n. 10
0
 static function addform($parent, $class, $typetd = null)
 {
     $vlist['nname'] = null;
     $vlist['description'] = null;
     //$vlist['share_status'] = null;
     $qvlist = getQuotaListForClass('vps', array());
     $vlist = lx_merge_good($vlist, $qvlist);
     $ret['action'] = "add";
     //$ret['continueaction'] = "server";
     $ret['variable'] = $vlist;
     return $ret;
 }