Example #1
0
function create_servername()
{
    $servername = new pserver(null, null, "titan.lxcenter.net");
    $servername->initThisDef();
    $servername->syncserver = $servername->nname;
    $servername->password = crypt('admin');
    $servername->dbaction = "add";
    $servername->write();
    $servername = new pserver(null, null, "athena.lxcenter.net");
    $servername->initThisDef();
    $servername->servername = $servername->nname;
    $servername->password = '******';
    $servername->dbaction = "add";
    $servername->write();
    $servername = new pserver(null, null, "apollo.lxcenter.net");
    $servername->initThisDef();
    $servername->servername = $servername->nname;
    $servername->password = '******';
    $servername->dbaction = "add";
    $servername->write();
}
Example #2
0
 static function addform($parent, $class, $typetd = null)
 {
     $vlist['nname'] = null;
     $vlist['firstip'] = null;
     $vlist['lastip'] = null;
     $vlist['nameserver'] = null;
     $vlist['networkgateway'] = null;
     $pslist = get_namelist_from_objectlist($parent->getRealPserverList('vps'));
     $vlist['server_detail_f'] = array('M', pserver::createServerInfo($pslist, "vps"));
     $vlist['pserver_list'] = array('U', $pslist);
     $ret['action'] = 'add';
     $ret['variable'] = $vlist;
     return $ret;
 }
Example #3
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);
 }
Example #4
0
 function createShowPropertyList(&$alist)
 {
     global $gbl, $sgbl, $login, $ghtml;
     if ($ghtml->frm_subaction === 'forcedeletepserver') {
         $alist['property'] = pserver::createListAlist($this, 'pserver');
         return;
     }
     $alist['property'][] = "a=show";
     $alist['property'][] = "a=list&c=domain";
     if ($this->priv->subdomain_num) {
         $alist['property'][] = "a=list&c=subdomain";
     }
     $alist['property'][] = "a=list&c=mailaccount";
     //$alist['property'][] = "a=list&c=mailaccount";
     $alist['property'][] = "o=sp_specialplay&a=updateform&sa=skin";
     //$alist['property'][] = "a=show&sa=config";
 }
Example #5
0
    function printObjectElement($parent, $class, $classdesc, $obj, $name, $width, $descr, $colcount)
    {
        global $gbl, $sgbl, $login;
        $rclass = $class;
        list($graphtype, $graphwidth) = exec_class_method($rclass, "getGraphType");
        if ($name === 'syncserver') {
            $serverdiscr = pserver::createServerInfo(array($obj->syncserver), $class);
        }
        $__external = 0;
        $iconpath = get_image_path() . "/button/";
        if (isset($descr[$name]) && (csa($descr[$name][0], 'q') || csa($descr[$name][0], "D"))) {
            // For hard quota you need priv. For soft quota, you use used.
            if (csa($descr[$name][0], 'h')) {
                $pname = $obj->priv->display($name);
            } else {
                $pname = $obj->used->display($name);
            }
        } else {
            if (isset($descr[$name]) && csa($descr[$name][0], 'p')) {
                if (cse($name, "_per_f")) {
                    $qrname = strtil($name, "_per_f");
                    $pname = array($obj->priv->{$qrname}, $obj->used->{$qrname}, null);
                } else {
                    $pname = $obj->perDisplay($name);
                }
            } else {
                $pname = $obj->display($name);
                $pname = Htmllib::fix_lt_gt($pname);
                if (csa($pname, "_lximg:")) {
                    $pname = preg_replace("/_lximg:([^:]*):([^:]*):([^:]*):/", "<img src=\$1 width=\$2 height=\$3>", $pname);
                }
                if (csa($pname, "_lxspan:")) {
                    $pname = preg_replace("/_lxspan:([^:]*):([^:]*):/", "<span title='\$2'>\$1 </span> ", $pname);
                }
                if (csa($pname, "_lxurl:")) {
                    $pname = preg_replace("/_lxurl:([^:]*):([^:]*):/", "<a class=insidelist target=_blank href=http://\$1> \$2 </a>", $pname);
                }
                if (csa($pname, "_lxinurl:")) {
                    $url = preg_replace("/_lxinurl:([^:]*):([^:]*):/", "\$1", $pname);
                    $url = $this->getFullUrl($url);
                    $url = "\"{$url}\"";
                    $pname = preg_replace("/_lxinurl:([^:]*):([^:]*):/", "<a class=insidelist href={$url}> \$2 </a>", $pname);
                }
                if ($name === 'syncserver') {
                    $pname = "<span title='{$serverdiscr}'>  {$pname} </span> ";
                }
            }
        }
        $wrapstr = $width === "100%" ? "wrap" : "nowrap";
        $target = NULL;
        $purl = NULL;
        $url = null;
        $__full_url = false;
        if ($name === 'parent_name_f' && csb($class, "all_")) {
            $url = $this->generateParentListUrl($obj);
            $ac_descr = $this->getActionDetails($url, $purl, $iconpath, $path, $post, $_t_file, $_t_name, $_t_image, $__t_identity);
            $__full_url = true;
            $__full_url_t_identity = $__t_identity;
        }
        if (isset($descr[$name][3]) || csa($name, "abutton_")) {
            if (csa($name, "abutton_")) {
                $urlname = $obj->nname;
                $str = strfrom($name, "abutton_");
                $_tv = explode("_s_", $str);
                if ($_tv[0] === 'list') {
                    $url = "a=list&c={$_tv[1]}";
                } else {
                    if ($_tv[0] === 'show') {
                        $url = "a=show&o={$_tv[1]}";
                    } else {
                        $url = "a={$_tv['0']}&sa={$_tv[1]}";
                    }
                }
                $url = "&k[class]={$class}&k[nname]={$urlname}&{$url}";
            } else {
                if ($this->is_special_url($descr[$name][3])) {
                    $url = $descr[$name][3];
                } else {
                    if (csb($descr[$name][3], "__stub")) {
                        $url = $obj->getStubUrl($descr[$name][3]);
                    } else {
                        if (csb($class, "all_")) {
                            $url = $this->generateEntireUrl($obj, $login);
                            if (!$url) {
                                /// That means that the object is dangling and has no parent.
                                throw new lxException("object_found_without_proper_parent");
                            }
                        } else {
                            $urlname = $obj->nname;
                            $url = $descr[$name][3] . "&k[class]={$class}&k[nname]={$urlname}";
                        }
                    }
                }
            }
            if ($this->is_special_url($url)) {
                $purl = $url->purl;
                $target = $url->target;
                $url = $url->url;
                $purl = $this->getFullUrl($purl);
                $url = str_replace("[%s]", $obj->nname, $url);
                if (strpos($url, "http:/") !== false) {
                    $__external = 1;
                }
            } else {
                $url = $this->getFullUrl($url);
            }
            $ac_descr = $this->getActionDetails($url, $purl, $iconpath, $path, $post, $_t_file, $_t_name, $_t_image, $__t_identity);
        }
        $align = 'left';
        $valign = 'middle';
        $image = 0;
        if (csa($descr[$name][0], "e")) {
            $pname = strtolower($pname);
            $property = "{$name}_v_{$pname}";
            $prop_descr = get_classvar_description($rclass, $property);
            if (!$prop_descr) {
                dprint("Property Description for {$rclass} {$property} not Found <br> \n");
            }
            $this->fix_variable_overload($prop_descr, $classdesc[2]);
            $image = $this->get_image($iconpath, $class, $property, ".gif");
            $help = $this->get_full_help($prop_descr['help'], $obj->getId());
            $alt = lx_strip_tags($help);
            $help = $this->get_action_or_display_help($help, "notice");
            $align = "center onmouseover=\"changeContent('help',' {$help}')\" onmouseout=\"changeContent('help','helparea')\"";
            if (!$sgbl->isBlackBackground()) {
                $pname = " <span title='{$alt}'><img src={$image} width=16 height=16 >";
            }
            $this->save_non_existant_image($image);
            $image = 1;
        }
        if (!$obj->isAction($name) && char_search_a($descr[$name][0], "b")) {
            $pname = "";
        }
        $bgcolorstring = null;
        $forecolorstring = null;
        if ($sgbl->isBlackBackground()) {
            $bgcolorstring = "bgcolor=#000";
            $forecolorstring = "color=#999999";
        }
        if ($url && $obj->isAction($name)) {
            $urlhelp = "";
            if (!$image) {
                $this->fix_variable_overload($ac_descr, $classdesc[2]);
                // When it is showing the parent name, it is showing the resource under that parent, nad not under this object.
                if ($__full_url) {
                    $help = $this->get_full_help($ac_descr[2], $__full_url_t_identity);
                } else {
                    $help = $this->get_full_help($ac_descr[2], $obj->getId());
                }
                $alt = lx_strip_tags($help);
                $help = $this->get_action_or_display_help($help, "action");
                $urlhelp = "onmouseover=\"changeContent('help',' {$help}')\" onmouseout=\"changeContent('help','helparea')\"";
                if (strstr($descr[$name][0], "b") != NULL || csb($name, "abutton")) {
                    if ($obj->isButton($name)) {
                        if ($sgbl->isBlackBackground()) {
                            $pname = "b";
                        } else {
                            $pname = " <span title='{$alt}'><img src='{$_t_image}'  height=15 width=15>";
                        }
                        $align = "center";
                    } else {
                        $pname = "";
                    }
                }
            }
            print "<td {$bgcolorstring} class=collist {$wrapstr} align={$align} > <span title='{$alt}'>";
            $method = $__external ? "get" : $sgbl->method;
            ?>
		<form name=form<?php 
            echo $colcount;
            ?>
  method=<?php 
            echo $method;
            ?>
 action=<?php 
            echo $path;
            ?>
 <?php 
            echo $target;
            ?>
 >
			<?php 
            if ($this->frm_action === 'selectshow') {
                $post['frm_action'] = 'selectshow';
                $post['frm_selectshowbase'] = $this->frm_selectshowbase;
            }
            $this->print_input_vars($post);
            ?>
		</form>
		<a class=insidelist
		   href="javascript:document.form<?php 
            echo $colcount;
            ?>
.submit()" <?php 
            echo $urlhelp;
            ?>
 > <?php 
            echo $pname;
            ?>
   </a>  </span> </td>
			<?php 
        } else {
            if (char_search_a($descr[$name][0], "p")) {
                print "<td {$bgcolorstring} class=collist {$wrapstr} align={$align} > ";
                $arr = $pname;
                $this->show_graph($arr[0], $arr[1], null, $graphwidth, $arr[2], $graphtype, $obj->getId(), $name);
                print "</td>  ";
            } else {
                if (csa($descr[$name][0], "W")) {
                    $pname = str_replace("\n", "<br>\n", $pname);
                    $pname = str_replace("[code]", "<div style='padding: 10 10 10 10; margin: 10 10 10 10; border: 1px solid #43a1a1'>", $pname);
                    $pname = str_replace("[quote]", "<div style='background:#eee; padding: 10 10 10 10; margin: 10 10 10 10; border: 1px solid #aaa'> [b] QUOTE [/b]", $pname);
                    $pname = str_replace("[b]", "<font style='font-weight:bold'>", $pname);
                    $pname = str_replace("[/b]", "</font>", $pname);
                    $pname = str_replace("[/code]", "</div>", $pname);
                    $pname = str_replace("[/quote]", "</div>", $pname);
                    $pname = "<table width=100% style='background:white;padding:20 20 20 20; margin: 8 8 8 8 ;border: 1px solid grey;' cellpadding=0 cellspacing=0> <tr> <td  > {$pname} </td> </tr> </table>  ";
                }
                print "<td {$bgcolorstring} class=collist {$wrapstr} align={$align} >  {$pname}   </td>  ";
                //print("<td class=collist $wrapstr align=$align onClick=\"javascript:getElementById('input$oname$name').type='text'; getElementById('font$oname$name').style.display='none'\"> <input \"style=width:60\" id=input$oname$name type=hidden name=hello value=$pname> <font id=font$oname$name> $pname </font>  </td>  ");
            }
        }
    }
Example #6
0
 function createShowPropertyList(&$alist)
 {
     global $gbl, $sgbl, $login, $ghtml;
     if ($ghtml->frm_subaction === 'forcedeletepserver') {
         $alist['property'] = pserver::createListAlist($this, 'pserver');
         return;
     }
     if ($ghtml->frm_subaction === 'deleteorphanedvps') {
         $alist['property'] = vps::createListAlist($this, 'pserver');
         return;
     }
     if ($ghtml->frm_subaction === 'ippool') {
         $alist['property'] = ippool::createListAlist($this, 'ippool');
     } else {
         $alist['property'][] = "a=show";
         $alist['property'][] = "o=sp_specialplay&a=updateform&sa=skin";
     }
 }
Example #7
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);
 }
Example #8
0
function create_servername()
{
    $pserver = new pserver(null, 'localhost', "localhost");
    $pserver->initThisDef();
    $pserver->rolelist = array("web", "dns");
    if (if_demo()) {
        $pserver->realpass = '******';
        $pserver->password = crypt("admin");
        $pserver->cpstatus = 'on';
    }
    $pserver->dbaction = "add";
    $pserver->postAdd();
    $pserver->superPostAdd();
    $pserver->was();
    //dprintr($pserver);
    return;
}
Example #9
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;
    }
Example #10
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);
 }
Example #11
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;
 }