Beispiel #1
0
 function updateform($subaction, $param)
 {
     global $gbl, $sgbl, $login, $ghtml;
     switch ($subaction) {
         case "installatron":
             $vlist['__v_button'] = array();
             return $vlist;
         case "ostemplatelist":
             getResourceOstemplate($vlist, 'all');
             $vlist['__v_updateall_button'] = array();
             return $vlist;
         case "createinvoice_m":
             $vlist['month'] = null;
             return $vlist;
         case "createinvoice_s":
             $vlist['month'] = array('s', $this->getInvoiceMonthList());
             return $vlist;
         case "search_engine":
             $vlist['se_url'] = array('M', "http://");
             $vlist['se_email'] = null;
             return $vlist;
         case "cron_mailto":
             $vlist['cron_mailto'] = null;
             return $vlist;
         case "default_domain":
             $vlist['default_domain'] = array('s', add_disabled(get_namelist_from_objectlist($this->getList('domain'))));
             return $vlist;
         case "shell_access":
             $res[] = "/bin/bash";
             $res[] = "/usr/bin/lxjailshell";
             $res = add_disabled($res);
             $vlist['nname'] = array('M', null);
             $vlist['disable_system_flag'] = null;
             $vlist['shell'] = array('s', $res);
             $vlist['__v_updateall_button'] = array();
             return $vlist;
         case "generate_csr":
             include "lib/countrycode.inc";
             foreach ($gl_country_code as $key => $name) {
                 $temp[$key] = $name;
             }
             $s = new sslcert(null, null, null);
             $this->ssl_data_b = new ssl_data_b(null, null, null);
             $vlist['contactemail'] = array('M', null);
             $vlist["ssl_data_b_s_commonName_r"] = null;
             $vlist["ssl_data_b_s_emailAddress_r"] = null;
             $vlist["ssl_data_b_s_countryName_r"] = array('A', $temp);
             $vlist["ssl_data_b_s_stateOrProvinceName_r"] = null;
             $vlist["ssl_data_b_s_localityName_r"] = null;
             $vlist["ssl_data_b_s_organizationName_r"] = null;
             $vlist["ssl_data_b_s_organizationalUnitName_r"] = null;
             return $vlist;
         case "domainpserver":
             if ($this->isAdmin()) {
                 $parent = $this;
             } else {
                 $parent = $this->getParentO();
             }
             self::getDomainServerVlist($parent, $this, $vlist);
             return $vlist;
         case "forcedeletepserver":
             if_not_admin_complain_and_exit();
             $list = get_namelist_from_objectlist($this->getList('pserver'));
             $vlist['pserver_delete_f'] = array('s', array_remove($list, "localhost"));
             return $vlist;
         case "deleteorphanedvps":
             $sq = new Sqlite(null, 'vps');
             $slist = get_namelist_from_objectlist($this->getList('pserver'));
             $res = $sq->getTable(array('nname', 'syncserver', 'parent_clname'));
             $list = null;
             foreach ($res as $r) {
                 if (!array_search_bool($r['syncserver'], $slist)) {
                     $list[$r['nname']] = "{$r['nname']} ({$r['syncserver']}) (orphaned)";
                 }
             }
             if ($list) {
                 $vlist['vps_delete_f'] = array('A', $list);
             } else {
                 $vlist['vps_delete_f'] = array('M', 'No Orphaned vm');
             }
             return $vlist;
         case "multivpscreate":
             $vlist['vps_basename_f'] = null;
             $vlist['vps_admin_password_f'] = null;
             $vlist['vps_count_f'] = null;
             $vlist['vps_template_name_f'] = array('s', get_namelist_from_objectlist($this->getList('vpstemplate')));
             return $vlist;
         case "disable_url":
             $vlist['disable_url'] = array('m', array('pretext' => 'http://'));
             return $vlist;
         case "message":
             $vlist['wall_from_f'] = array('M', $login->nname);
             $vlist['send_to_f'] = array('M', $this->nname);
             $vlist['wall_subject_f'] = null;
             $vlist['wall_message_f'] = null;
             $vlist['__v_button'] = 'Send';
             return $vlist;
         case "skeleton":
             $vlist['skeletonarchive'] = array('M', null);
             $vlist['skeletonarchive_f'] = null;
             return $vlist;
         case "wall":
             $vlist['wall_from_f'] = array('M', $this->nname);
             //Can't do this. If he has 10000 client, this itelf will hang the machine.
             //$vlist['send_to_f'] = array('M', $namlist);
             $vlist['wall_subject_f'] = null;
             $vlist['wall_message_f'] = null;
             $vlist['__v_button'] = 'Send';
             return $vlist;
         case "dnstemplatelist":
             $parent = $this->getParentO();
             $nlist = domain::getDnsTemplateList($parent);
             $vlist['dnstemplate_list'] = array('U', $nlist);
             $vlist['__v_updateall_button'] = array();
             return $vlist;
         case "information":
             $vlist['nname'] = array('M', $this->nname);
             if ($this->isAdmin()) {
                 $gen = $login->getObject('general');
                 $this->disable_admin = $gen->disable_admin;
                 $vlist['disable_admin'] = null;
             }
             if ($this->isLogin()) {
                 $vlist['cttype'] = array('M', $this->cttype);
             } else {
                 $parent = $this->getParentO();
                 $res = null;
                 if (check_if_many_server()) {
                     $ctlist = array('reseller', 'customer', 'wholesale');
                 } else {
                     $ctlist = array('reseller', 'customer');
                 }
                 foreach ($ctlist as $v) {
                     if ($parent->isGte($v)) {
                         continue;
                     }
                     $res[] = $v;
                 }
                 if ($res) {
                     $vlist['cttype'] = array('s', $res);
                 } else {
                     $vlist['cttype'] = array('M', $this->cttype);
                 }
             }
             $vlist['ddate'] = array('M', @date('d-m-Y', $this->ddate));
             if (!$this->isAdmin()) {
                 $vlist['parent_name_f'] = array('M', $this->getParentName());
             }
             $vlist['contactemail'] = "";
             if (!$this->isLogin()) {
                 $vlist['text_comment'] = null;
             }
             return $vlist;
         case "license":
             $lic = $login->getObject('license')->licensecom_b;
             if ($login->isAdmin()) {
                 $vlist['lic_pserver_num_f'] = array('M', $lic->lic_pserver_num);
                 $vlist['lic_client_num_f'] = array('M', $lic->lic_client_num);
                 $vlist['lic_maindomain_num_f'] = array('M', $lic->lic_maindomain_num);
             } else {
                 $vlist['lic_node_num_f'] = array('M', $lic->node_num);
             }
             $vlist['lic_live_support_f'] = array('M', $lic->lic_live_support);
             //$vlist['lic_ipaddress_f'] = array('M', $lic->lic_ipaddress);
             $vlist['lic_client_f'] = array('M', $lic->lic_client);
             //$vlist['lic_current_f'] = array('t', lfile_get_contents('__path_program_etc/license.txt'));
             $vlist['license_upload_f'] = null;
             return $vlist;
         case "ipaddress":
             $parent = $this->getParentO();
             if ($this->isLogin() || !$this->isRightParent()) {
                 $vlist['ipaddress_list'] = array('M', $this->getIpaddress($this->listpriv->webpserver_list));
                 $vlist['__v_button'] = array();
             } else {
                 if (check_if_many_server()) {
                     dprintr($this->listpriv->webpserver_list);
                     $iplist = $parent->getIpaddress($this->listpriv->webpserver_list);
                 } else {
                     $iplist = $parent->getIpaddress(array('localhost'));
                 }
                 dprintr($iplist);
                 $vlist['ipaddress_list'] = array('Q', $iplist);
             }
             return $vlist;
         case "pserver_s":
             $parent = $this->getParentO();
             $list = null;
             $serverlist = client::getPserverListPriv();
             if ($this->isLogin() || !$this->isRightParent()) {
                 foreach ($serverlist as $s) {
                     $slist = "{$s}_list";
                     $vlist["{$s}_list"] = array('M', $this->listpriv->{$slist});
                 }
                 $vlist['__v_button'] = array();
                 //$vlist['dbtype_list'] = array('M', $this->listpriv->dbtype_list);
                 return $vlist;
             } else {
                 $vlist['server_detail_f'] = null;
                 foreach ($serverlist as $s) {
                     $slist = "{$s}_list";
                     // Hack.. Actually, admin's listpriv should be empty so that the __get inside the listpriv will get automatically called.
                     if ($parent->isAdmin()) {
                         unset($parent->listpriv->{$slist});
                     }
                     $vlist["{$s}_list"] = null;
                     $list = lx_array_merge(array($list, $parent->getServerList(strtilfirst($s, "pserver"))));
                 }
                 $sinfo = pservercore::createServerInfo($list);
                 $sinfo = get_warning_for_server_info($parent, $sinfo);
                 $vlist['server_detail_f'] = array('M', $sinfo);
                 //$vlist['dbtype_list'] = null;
                 return $vlist;
             }
         case "description":
             $vlist['description'] = null;
             //$vlist['share_status'] = null;
             if (!$this->isRightParent()) {
                 $this->convertToUnmodifiable($vlist);
             }
             return $vlist;
     }
     return parent::updateform($subaction, $param);
 }
Beispiel #2
0
    static function addform($parent, $class, $typetd = null)
    {
        global $gbl, $sgbl, $login, $ghtml;
        $vlist['nname'] = array('m', array("posttext" => ".vm"));
        $nclist = $parent->getResourcePlanList('resourceplan');
        $vlist['__v_button'] = $login->getKeywordUc('add');
        $vlist['password'] = null;
        $vlist['num_ipaddress_f'] = array('s', range(0, 8));
        $vlist['one_ipaddress_f'] = null;
        $vlist['contactemail'] = "";
        $vlist['send_welcome_f'] = "";
        $vlist['__c_subtitle_info'] = "Info";
        $vlist['hostname'] = "";
        if ($typetd['val'] === 'xen') {
            $vlist['networkgateway'] = null;
        }
        $vlist['nameserver'] = "";
        $vlist['resourceplan_f'] = array('A', $nclist);
        $vlist['__c_subtitle_server'] = "Server";
        //var_dump($typetd['val']);
        // $typetd['val'] openvz or xen in clientlib.php
        $serverlist = $parent->getVpsServers($typetd['val']);
        if (!$serverlist) {
            throw new lxexception('Server no configured for driver ' . $typetd['val'] . '. You can use setdriver.php for configure a driver.
		 For example:
		cd /usr/local/lxlabs/hypervm/httpdocs;
		lphp.exe ../bin/common/setdriver.php --server=localhost --class=vps --driver=' . $typetd['val'] . '', '', '');
        }
        $sinfo = pserver::createServerInfo($serverlist, "vps");
        $sinfo = get_warning_for_server_info($parent, $sinfo);
        $vlist['server_detail_f'] = array('M', $sinfo);
        $vlist['syncserver'] = array('s', $serverlist);
        $vlist['ostemplate'] = array('A', vps::getVpsOsimage($parent, $typetd['val']));
        $ret['variable'] = $vlist;
        $ret['action'] = "continue";
        $ret['continueaction'] = "server";
        return $ret;
    }
Beispiel #3
0
 function updateform($subaction, $param)
 {
     global $gbl, $sgbl, $login, $ghtml;
     switch ($subaction) {
         case "switchserver":
             $serverlist = $login->getServerList($this->get__table());
             if (!$this->checkIfLockedForAction('switchserver')) {
                 if ($this->olddeleteflag === 'doing') {
                     $this->olddeleteflag = 'program_interrupted';
                 }
             }
             $vlist['olddeleteflag'] = array('M', null);
             $psi = pserver::createServerInfo($serverlist, $this->get__table());
             $psi = get_warning_for_server_info($login, $psi);
             $vlist['server_detail_f'] = array('M', $psi);
             $vlist['syncserver'] = array('s', $serverlist);
             return $vlist;
         case "restore":
             $vlist['restore_file_f'] = null;
             $sgbl->method = 'post';
             return $vlist;
         case "restore_from_http":
             $vlist['restore_url_f'] = null;
             return $vlist;
     }
     return parent::updateform($subaction, $param);
 }
Beispiel #4
0
 static function addform($parent, $class, $typetd = null)
 {
     global $gbl, $sgbl, $login, $ghtml;
     $vlist['nname'] = array('m', array("posttext" => ".vm"));
     $nclist = $parent->getResourcePlanList('resourceplan');
     $vlist['__v_button'] = $login->getKeywordUc('add');
     $vlist['password'] = null;
     $vlist['num_ipaddress_f'] = array('s', range(0, 8));
     $vlist['num_ipv6address_f'] = array('s', range(0, 8));
     $vlist['one_ipaddress_f'] = null;
     $vlist['contactemail'] = "";
     $vlist['send_welcome_f'] = "";
     $vlist['__c_subtitle_info'] = "Info";
     $vlist['hostname'] = "";
     if ($typetd['val'] === 'xen') {
         $vlist['networkgateway'] = null;
     }
     $vlist['nameserver'] = "";
     $vlist['resourceplan_f'] = array('A', $nclist);
     $vlist['__c_subtitle_server'] = "Server";
     $serverlist = $parent->getVpsServers($typetd['val']);
     if (!$serverlist) {
         // be more ModSecurity with OWASP_CRS friendly...
         throw new lxexception('not_configured_for_driver');
     }
     $sinfo = pserver::createServerInfo($serverlist, "vps");
     $sinfo = get_warning_for_server_info($parent, $sinfo);
     $vlist['server_detail_f'] = array('M', $sinfo);
     $vlist['syncserver'] = array('s', $serverlist);
     $vlist['ostemplate'] = array('A', vps::getVpsOsimage($parent, $typetd['val']));
     $ret['variable'] = $vlist;
     $ret['action'] = "continue";
     $ret['continueaction'] = "server";
     return $ret;
 }