function updatechange_plan($param) { global $gbl, $sgbl, $login, $ghtml; if_demo_throw_exception('changeplan'); if ($this->isLogin()) { throw new lxException('cannot_change_plan', 'nname', $this->nname); } $gbl->__ajax_refresh = true; $tname = $param['newresourceplan']; $parent = $this->getParentO(); $template = getFromAny(array($parent, $login), "resourceplan", $tname); if (!$template) { throw new lxException('cannot_find_the_resource_plan', 'nname', $this->nname); } $priv = $template->priv; $this->resourceplan_used = $param['newresourceplan']; $oldv = clone $this->priv; check_priv($parent, $this->get__table(), $this->priv, $priv); $this->distributeChildQuota($oldv); $this->changePlanSpecific($template); $this->setUpdateSubaction('change_plan'); return null; }
function postAdd() { global $gbl, $sgbl, $login, $ghtml; $parent = $this->getParentO(); //$parent = $parent->getClientParentO(); if ($this->isOn('use_resourceplan_f')) { //$ct = $parent->getFromList("clienttemplate", $this->resourceplan_f); $ct = getFromAny(array($login, $parent), 'resourceplan', $this->resourceplan_f); if (!$ct) { throw new lxexception("the_resourceplan_doesnt_exist", 'resourceplan_f', $this->resourceplan_f); } if (!$parent->isAdmin()) { $v = $parent->checkTemplateGreaterThan($ct); if ($v) { throw new lxexception("resource_quota_more_than_available", 'resourceplan_f', $v); } } $this->resourceplan_used = $this->resourceplan_f; $pv = clone $ct->priv; $this->priv = $pv; $this->fixPrivUnset(); $this->listpriv = clone $ct->listpriv; $this->disable_per = $ct->disable_per; $this->dnstemplate_list = $ct->dnstemplate_list; } $this->setClientSyncServer(); $this->disable_url = $parent->disable_url; $this->lxclientpostAdd(); if ($this->installapp_app && $this->installapp_app !== '--leave--') { if (!validate_email($this->contactemail)) { throw new lxexception("installapp_needs_valid_contactemail", 'contactemail', null); } } if ($this->priv->mysqldb_num > 0) { $this->createDefaultDatabase(); } // Please note, the parent is wassed inside the createDefaultDomain, via the __desc_cmd_add. So after that, nothing will happen. //$this->domain_name = trim($this->domain_name); if ($sgbl->isKloxo() && $this->domain_name) { $this->default_domain = $this->domain_name; $this->createDefaultDomain($this->domain_name, $this->dnstemplate_name); if ($this->installapp_app && $this->installapp_app !== '--leave--') { $this->createDefaultApplication($this->domain_name, $this->installapp_app); } } $this->notifyObjects('add'); }
static function continueForm($parent, $class, $param, $continueaction) { global $gbl, $sgbl, $login, $ghtml; $param['nname'] = strtolower($param['nname']); validate_domain_name($param['nname']); /* if (!preg_match("/[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+]/i", $param['nname'])) { throw new lxException('domain_name_invalid', 'nname'); } */ if ($continueaction === 'server') { if ($param['resourceplan_f'] === 'continue_without_plan') { $ret = self::continueFormlistpriv($parent, $class, $param, $continueaction); } else { $template = getFromAny(array($login, $parent), 'resourceplan', $param['resourceplan_f']); $param['use_resourceplan_f'] = 'on'; if (!$template) { throw new lxexception("the_resource_plan_doesnt_exist", 'resourceplan_f', $param['resourceplan_f']); } $ret['action'] = 'addnow'; $ret['param'] = $param; return $ret; } } else { $ret = self::continueFormFinish($parent, $class, $param, $continueaction); } return $ret; }
function updateChangeOwner($param) { global $gbl, $sgbl, $login, $ghtml; $rparent['up'] = $this->getParentO()->getParentO(); if ($rparent['up']) { $rparent['top'] = $rparent['up']->getParentO(); } $rparent['down'] = $this->getParentO(); if ($rparent['down']->isLogin()) { $rparent['up'] = null; } $newparent = getFromAny($rparent, 'client', $param['parent_name_change']); /* if (!$this->checkIfEnoughParentQuotaAll($newparent)) { throw new lxexception('not_enough_quota_in_parent', 'quota'); } */ // Get the objectlist BEFORE you change the parent. $this->__old_parent_name = $this->parent_clname; $this->parent_clname = createParentName("client", $param['parent_name_change']); $this->__parent_o = $newparent; $this->setUpdateSubaction(); $this->changeOwnerSpecific(); $gbl->__this_redirect = $ghtml->getFullUrl('a=resource', null); $gbl->__this_function = array("lxclass", "exec_collectQuota"); $gbl->__this_functionargs = null; return null; }
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; }