Ejemplo n.º 1
0
 function updateform($subaction, $param)
 {
     global $gbl, $sgbl, $login, $ghtml;
     switch ($subaction) {
         case "centralbackupconfig":
             $list = $login->getList('centralbackupserver');
             $list = get_namelist_from_objectlist($list);
             $vlist['centralbackupserver'] = array('s', add_disabled($list));
             $vlist['internalnetworkip'] = null;
             $vlist['tmpdir'] = null;
             //$vlist['__v_updateall_button'] = array();
             return $vlist;
         case "commandcenter":
             return $this->commandCenter($param);
             break;
         case "timezone":
             $vlist['timezone'] = array('s', pserver::getTimeZoneList());
             return $vlist;
         case "ssl_key":
             $this->createPublicPrivate();
             $this->setUpdateSubaction();
             $vlist['text_public_key'] = array('t', null);
             return $vlist;
         case "switchprogram":
             $this->web_driver = $gbl->getSyncClass($this->__masterserver, $this->nname, 'web');
             $this->dns_driver = $gbl->getSyncClass($this->__masterserver, $this->nname, 'dns');
             $this->spam_driver = $gbl->getSyncClass($this->__masterserver, $this->nname, 'spam');
             $vlist['web_driver'] = array('s', array('apache', 'lighttpd'));
             $vlist['dns_driver'] = array('s', array('bind', 'djbdns'));
             $vlist['spam_driver'] = array('s', array('spamassassin', 'bogofilter'));
             return $vlist;
         case "mysqlpasswordreset":
             $vlist['newpassword_f'] = null;
             return $vlist;
         case "importvps":
             $vlist['importvps'] = array('M', 'Import Vpses on this server?');
             $vlist['__v_button'] = "Import";
             return $vlist;
         case "importhypervmvps":
             $vlist['importvps'] = array('M', 'Import HyperVM Vpses on this server?');
             $vlist['__v_button'] = "Import";
             return $vlist;
         case "savevpsdata":
             $vlist['__v_button'] = "Save";
             return $vlist;
         case "information":
             $sq = new Sqlite(null, 'client');
             $res = $sq->getRowsWhere("cttype = 'wholesale'", null, array('nname'));
             $clientlist = get_namelist_from_arraylist($res);
             $vlist['description'] = null;
             $vlist['realhostname'] = null;
             if ($sgbl->isHyperVm()) {
                 $list = get_namelist_from_objectlist($login->getList('datacenter'));
                 if (!$list) {
                     $list[] = '--no-dc--';
                     $this->datacenter = '--no-dc--';
                 }
                 $vlist['datacenter'] = array('s', $list);
                 $newclientlist = lx_array_merge(array(array('--unassigned--'), $clientlist));
                 if ($this->nname === 'localhost') {
                     $vlist['clientname'] = array('M', $login->getKeyword('master_cannot_be_assigned'));
                 } else {
                     $vlist['clientname'] = array('s', $newclientlist);
                 }
             }
             if ($sgbl->isHyperVm()) {
                 $vlist['max_vps_num'] = null;
             }
             $this->setDefaultValue("load_threshold", "20");
             $vlist['load_threshold'] = null;
             return $vlist;
         case "backupconfig":
             return $vlist;
         case "phpsmtp":
             $vlist['pserverconf_b_s_usesmtp'] = null;
             $vlist['pserverconf_b_s_smtpserver'] = null;
             $vlist['pserverconf_b_s_smtpport'] = null;
             $vlist['pserverconf_b_s_smtpuseauth'] = null;
             $vlist['pserverconf_b_s_smtpuser'] = null;
             $vlist['pserverconf_b_s_smtppass'] = null;
             return $vlist;
         case "cron_mailto":
             $vlist['cron_mailto'] = null;
             return $vlist;
         case "vpslist":
             $vlist['used_vpslist_f'] = array('M', $this->getUsed());
             $vlist['__v_button'] = array();
             return $vlist;
         case "showused":
             $res = $this->createUsedDomainList();
             foreach ($res as $k => $v) {
                 $var = "used_domainlist_{$k}_f";
                 $vlist[$var] = array('M', $this->{$var});
             }
             $vlist['__v_button'] = array();
             return $vlist;
         case "update":
             $vlist['nname'] = array('M', null);
             $vlist['password'] = null;
             return $vlist;
         case "poweroff":
             // --- issue 612 - Hide password in reboot / shutdown server
             //	$vlist['retype_admin_p_f'] = null;
             $vlist['__v_button'] = 'Poweroff';
             return $vlist;
         case "reboot":
             // --- issue 612 - Hide password in reboot / shutdown server
             //	$vlist['retype_admin_p_f'] = null;
             $vlist['__v_button'] = 'Reboot';
             return $vlist;
         case "dbpassword":
             $vlist['dbadmin'] = null;
             $vlist['dbpassword'] = null;
             return $vlist;
     }
     return parent::updateform($subaction, $param);
 }
Ejemplo n.º 2
0
 function updateform($subaction, $param)
 {
     global $gbl, $sgbl, $login, $ghtml;
     $parent = $this->getParentO();
     $gen = $login->getObject('general')->generalmisc_b;
     switch ($subaction) {
         case "recovervps":
             /*
             		if (!lxfile_exists("{$this->getOstemplatePath()}/{$this->ostemplate}.tar.gz")) {
             			$list = exec_class_method("vps__{$this->ttype}", "getOsTemplatelist");
             			$vlist['recover_ostemplate'] = array('A', $list);
             		}
             */
             $vlist['recover_confirm_f'] = null;
             return $vlist;
         case "mount":
             $vlist['confirm_f'] = array('M', "confirm");
             return $vlist;
         case "macaddress":
             $vlist['macaddress'] = null;
             return $vlist;
         case "ostemplatelist":
             getResourceOstemplate($vlist, $this->ttype);
             $vlist['__v_updateall_button'] = array();
             return $vlist;
         case "hardpoweroff":
             $vlist['confirm_f'] = array("M", "Confirm");
             return $vlist;
         case "reboot":
             $vlist['reboot_confirm_f'] = null;
             //  array("f", "Confirm");
             $vlist['__v_button'] = 'Reboot';
             return $vlist;
         case "shutdown":
             $vlist['poweroff_confirm_f'] = null;
             //  array("f", "Confirm");
             $vlist['__v_button'] = 'Power OFF';
             return $vlist;
         case "mainipaddress":
             $vlist['mainipaddress'] = array('s', get_namelist_from_objectlist($this->vmipaddress_a));
             return $vlist;
         case "livemigrate":
             $serverlist = $login->getServerList($this->get__table());
             $rs = null;
             foreach ($serverlist as $l) {
                 $driverapp = $gbl->getSyncClass(null, $l, 'vps');
                 if ($driverapp === 'openvz') {
                     $rs[] = $l;
                 }
             }
             $serverlist = $rs;
             if (!$this->checkIfLockedForAction('livemigrate')) {
                 if ($this->olddeleteflag === 'doing') {
                     $this->olddeleteflag = 'program_interrupted';
                     $this->setUpdateSubaction();
                 }
             }
             $vlist['olddeleteflag'] = array('M', null);
             $vlist['server_detail_f'] = array('M', pserver::createServerInfo($serverlist, $this->get__table()));
             $vlist['syncserver'] = array('s', $serverlist);
             return $vlist;
         case "append_inittab":
             $vlist['text_inittab'] = array('t', $this->text_inittab);
             return $vlist;
         case "append_xen_config":
             $vlist['text_xen_config'] = array('t', $this->text_xen_config);
             return $vlist;
         case "changelocation":
             if ($this->isXen()) {
                 return $this->formChangeLocationXen();
             } else {
                 return $this->formChangeLocationOpenvz();
             }
             break;
         case "createuser":
             $this->username = str_replace(".", "", $this->nname);
             $vlist['username'] = array('M', null);
             return $vlist;
         case "changeosimagename":
             $vlist['ostemplate'] = null;
             return $vlist;
         case "clonevps":
             $vlist['__v_button'] = array();
             return $vlist;
         case "createtemplate":
             $stem = explode("-", $this->ostemplate);
             if ($this->isWindows()) {
                 $name = "{$stem[0]}-";
             } else {
                 $name = "{$stem[0]}-{$stem[1]}-{$stem[2]}-";
             }
             $vlist['newostemplate_name_f'] = array("m", array("pretext" => $name));
             $vlist['__v_button'] = 'Create';
             return $vlist;
         case "rebuild":
             if ($this->isWindows()) {
                 $type = "img";
             } else {
                 $type = "tar.gz";
             }
             $ostlist = vps::getVpsOsimage($this, $this->ttype, $type);
             $vlist['ostemplate'] = array('A', $ostlist);
             if ($this->isNotWindows() && $this->priv->isOn('backup_flag')) {
                 //$vlist['rebuild_backup_f'] = null;
             }
             $vlist['rebuild_confirm_f'] = null;
             return $vlist;
             /*		case "installkloxo":
             			$this->kloxo_type = 'master';
             			$vlist['rebuild_confirm_f'] = null;
             			$vlist['__v_button'] = 'Install';
             			return $vlist;
             */
         /*		case "installkloxo":
         			$this->kloxo_type = 'master';
         			$vlist['rebuild_confirm_f'] = null;
         			$vlist['__v_button'] = 'Install';
         			return $vlist;
         */
         case "commandcenter":
             return $this->commandCenter($param);
         case "fixdev":
             $vlist['fixdev_confirm_f'] = null;
             return $vlist;
         case "rootpassword":
             if ($this->isXen()) {
                 $vlist['__m_message_pre'] = 'xen_restart_message';
             }
             $vlist['rootpassword'] = null;
             return $vlist;
             //ONly for Template...
         //ONly for Template...
         case "description":
             $vlist['description'] = null;
             //$vlist['share_status'] = null;
             if (!$this->isRightParent()) {
                 $this->convertToUnmodifiable($vlist);
             }
             return $vlist;
         case "timezone":
             $vlist['timezone'] = array('s', pserver::getTimeZoneList());
             return $vlist;
         case "information":
             $vlist['nname'] = array('M', $this->nname);
             $vlist['corerootdir'] = array('M', $this->corerootdir);
             $vlist['ddate'] = array('M', @date('d-m-Y', $this->ddate));
             //			$vlist['kloxo_flag'] = null;
             if ($login->isAdmin() && $this->isXen()) {
                 $vlist['nosaveconfig_flag'] = null;
             }
             if (!$this->isXen()) {
                 $vlist['vpsid'] = array('M', $this->vpsid);
             }
             if ($this->isXen() && $login->isAdmin()) {
                 $vlist['vcpu_number'] = array('s', range(1, 10));
             }
             if ($login->isAdmin()) {
                 $use_slaves = "__use-slaves-backup-server__";
                 if (!$this->centralbackup_server) {
                     $this->centralbackup_server = $use_slaves;
                 }
                 $sq = new Sqlite(null, "centralbackupserver");
                 $list = get_namelist_from_arraylist($sq->getTable(array('nname')));
                 $list = lx_merge_good(array($use_slaves), $list);
                 //$vlist['centralbackup_flag'] = null;
                 $vlist['centralbackup_server'] = array('s', $list);
             }
             $vlist['ostemplate'] = array('M', null);
             $vlist['parent_name_f'] = array('M', $this->getParentName());
             //$vlist['dbtype_list'] = array('M', $this->listpriv->dbtype_list);
             $vlist['contactemail'] = "";
             if (!$this->isLogin()) {
                 $vlist['text_comment'] = null;
             }
             return $vlist;
             // Only for template. For the main guy, it comes as 'rebuild'
         // Only for template. For the main guy, it comes as 'rebuild'
         case "network":
             if ($this->isXen()) {
                 $vlist['__m_message_pre'] = 'xen_restart_message';
             }
             if (!$this->isLogin() || !$gen->isOn('disable_hostname_change')) {
                 $vlist['hostname'] = null;
             }
             if ($this->isXen()) {
                 if (!$this->networknetmask) {
                     $this->networknetmask = "255.255.255.0";
                 }
                 $vlist['networkgateway'] = null;
                 $vlist['networknetmask'] = null;
                 if ($login->priv->isOn('ip_manage_flag') || $login->isAdmin()) {
                     $vlist['networkbridge'] = array('s', array("__automatic__", "xenbr0", "xenbr1", "xenbr2", "xenbr3", "xenbr4"));
                 }
             }
             $iplist = $this->vmipaddress_a;
             $iplist = implode(", ", get_namelist_from_objectlist($iplist, 'nname'));
             $vlist['one_ipaddress_f'] = array('M', $iplist);
             $vlist['nameserver'] = null;
             return $vlist;
         case "ostemplate":
             $driverapp = $gbl->getSyncClass($this->__masterserver, $this->listpriv->vpspserver_sing, 'vps');
             $ostlist = rl_exec_get(null, $this->listpriv->vpspserver_sing, array("vps__{$driverapp}", "getOsTemplatelist"));
             $ostlist = lx_merge_good(array('--defer-osimage--' => '--defer-osimage--'), $ostlist);
             $vlist['ostemplate'] = array('A', $ostlist);
             return $vlist;
         case "changesyncserver":
             $sq = new Sqlite(null, 'pserver');
             $list = $sq->getTable(array('nname'));
             $list = get_namelist_from_arraylist($list);
             $vlist['syncserver'] = array('s', $list);
             $gbl->__ajax_refresh = true;
             return $vlist;
             // Only for template...
         // Only for template...
         case "vpspserver_s":
             $listpriv = $parent->listpriv;
             $vlist['server_detail_f'] = array('M', pserver::createServerInfo($listpriv->vpspserver_list, "vps"));
             $parent = $this->getParentO();
             $vlist['vpspserver_sing'] = null;
             if (!$this->isRightParent()) {
                 $this->convertToUnmodifiable($vlist);
             }
             return $vlist;
     }
     return parent::updateform($subaction, $param);
 }