static function createListSlist($parent) { $list = get_namelist_from_objectlist($parent->getList('datacenter')); $clist[] = '__any__'; $clist = lx_merge_good($clist, $list); $nlist['nname'] = null; $nlist['datacenter'] = array('s', $clist); return $nlist; }
static function readtotallog() { $list = self::readsmtpLog(); $nlist = self::readMaillog(); $total = lx_merge_good($list, $nlist); foreach ($total as $k => $v) { $re['clientname'] = $k; $re['nname'] = $k; $re['mailnum'] = $v; $res[$k] = $re; } return $res; }
static function get_vps_ipadress() { $out = lxshell_output("vzlist", "-a", '-H', '-o', 'ip'); $list = explode("\n", $out); $total = null; foreach ($list as $l) { $l = trim($l); $l = trim($l, "-"); if (csa($l, "Warning")) { continue; } if (!$l) { continue; } $res = explode(" ", $l); $total = lx_merge_good($total, $res); } return $total; }
static function getDomainServerVlist($parent, $obj, &$vlist) { global $gbl, $sgbl, $login, $ghtml; $vlist['server_detail_f'] = null; $wlist = $parent->getServerList('web'); $mlist = $parent->getServerList('mmail'); $mylist = $parent->getServerList('mysqldb'); $dnslist = $parent->getServerList('dns'); if ($obj) { // This means we are switching as opposed to creating a new client. $obj->newdnstemplate = '--leave--'; $dtlist = domainbase::getDnsTemplateList($login); $dtlist = lx_merge_good("--leave--", $dtlist); $vlist['newdnstemplate'] = array('s', $dtlist); } $vlist['websyncserver'] = array('s', $wlist); $vlist['mmailsyncserver'] = array('s', $mlist); $vlist['mysqldbsyncserver'] = array('s', $mylist); $vlist['dnssyncserver_list'] = array('U', $dnslist); $list = lx_merge_good($wlist, $mlist, $mylist, $dnslist); $sinfo = pservercore::createServerInfo($list); $sinfo = get_warning_for_server_info($parent, $sinfo); $vlist['server_detail_f'] = array('M', $sinfo); }
function updateform($subaction, $param) { if ($subaction === 'update') { $vlist['devname'] = array("M", $this->devname); $vlist['ipaddr'] = array('M', $this->ipaddr); $vlist['netmask'] = array('M', $this->netmask); $vlist['gateway'] = array('M', $this->gateway); $vlist['__v_button'] = ""; } else { if ($subaction === "exclusive") { $db = new Sqlite($this->__masterserver, "client"); $list = $db->getTable(array("nname")); $list = get_namelist_from_arraylist($list); $list = lx_merge_good('__unassigned__', $list); $vlist['clientname'] = array('s', $list); } } return $vlist; }
function printObjectTable($name_list, $parent, $class, $blist = array(), $display = NULL) { global $gbl, $sgbl, $login, $ghtml; $col = $login->getSkinColor(); $view = null; if (exec_class_method($class, "hasViews")) { $blist[] = array($ghtml->getFullUrl("a=list&c={$class}&frm_filter[view]=quota"), 1); $blist[] = array($ghtml->getFullUrl("a=list&c={$class}&frm_filter[view]=normal"), 1); } print_time("{$class}.objecttable"); $rclass = $class; if ($this->frm_accountselect !== null) { $sellist = explode(',', $this->frm_accountselect); } else { $sellist = null; } $filtername = $parent->getFilterVariableForThis($class); $sortdir = null; $sortby = null; $fil = $login->getHPFilter(); if (isset($fil[$filtername]['sortby'])) { $sortby = $fil[$filtername]['sortby']; } if (isset($fil[$filtername]['sortdir'])) { $sortdir = $fil[$filtername]['sortdir']; } $pagesize = (int) $login->issetHpFilter($filtername, 'pagesize') ? $login->getHPFilter($filtername, 'pagesize') : exec_class_method($rclass, "perPage"); if (!(int) $pagesize) { $pagesize = 10; } $view = null; if (isset($fil[$filtername]['view'])) { $view = $fil[$filtername]['view']; dprintr($view); } if (!$name_list) { if (csa($class, "all_")) { $__tcl = strfrom($class, "all_"); $name_list = exec_class_method($__tcl, "createListNlist", $parent, $view); foreach ($name_list as $k => $v) { if (csa($k, "abutton")) { unset($name_list[$k]); } } $name_list = lx_merge_good(array('parent_name_f' => '10%'), $name_list); } else { $name_list = exec_class_method($class, "createListNlist", $parent, $view); } } $iconpath = get_image_path() . "/button"; $buttonpath = get_image_path() . "/button/"; $nlcount = count($name_list) + 1; $imgheadleft = $login->getSkinDir() . "/top_lt.gif"; $imgheadleft = $login->getSkinDir() . "/top_lt.gif"; $imgheadleft2 = $login->getSkinDir() . "/top_lt.gif"; $imgheadright = $login->getSkinDir() . "/top_slope_rt.gif"; $imgheadbg = $login->getSkinDir() . "/top_bg.gif"; $imgbtnbg = $login->getSkinDir() . "/btn_bg.gif"; $imgtablerowhead = $login->getSkinDir() . "/tablerow_head.gif"; $imgtablerowheadselect = $login->getSkinDir() . "/top_line_medium.gif"; $imgbtncrv = $login->getSkinDir() . "/btn_crv_right.gif"; $imgtopline = $login->getSkinDir() . "/top_line.gif"; $skindir = $login->getSkinDir(); $classdesc = $this->get_class_description($rclass, $display); $unique_name = trim($parent->nname) . trim($class) . trim($display) . trim($classdesc[2]); $unique_name = fix_nname_to_be_variable($unique_name); ?> <br> <script> var ckcount<?php echo $unique_name; ?> ; </script> <?php if (!$sortby) { $sortby = exec_class_method($rclass, "defaultSort"); } if (!$sortdir) { $sortdir = exec_class_method($rclass, "defaultSortDir"); } $obj_list = $parent->getVirtualList($class, $total_num, $sortby, $sortdir); if (exec_class_method($rclass, "isdefaultHardRefresh")) { exec_class_method($rclass, "getExtraParameters", $parent, $obj_list); } else { if ($this->frm_hardrefresh === 'yes') { exec_class_method($rclass, "getExtraParameters", $parent, $obj_list); } } $pluraldesc = get_plural($classdesc[2]); if ($login->issetHpFilter($filtername, 'pagenum')) { $cgi_pagenum = $login->getHPFilter($filtername, 'pagenum'); } else { $cgi_pagenum = 1; } $showvar = null; if ($login->issetHpFilter($filtername, 'show')) { $showvar = $login->getHPFilter($filtername, 'show'); } if ($showvar) { $showvar = "(" . ucfirst($showvar) . ")"; } $filterundermes = null; if ($login->issetHpFilter($filtername) && $this->checkIfFilter($login->getHPFilter($filtername))) { $filterundermes = "({$login->getKeywordUc('search_on')}"; if ($total_num == 0) { $filterundermes .= ". Click on show all to see all the objects"; } $filterundermes .= ")"; } $perpageof = null; $lower = $pagesize * ($cgi_pagenum - 1) + 1; if ($lower > $total_num) { $lower = $total_num; } if ($pagesize * $cgi_pagenum > $total_num) { $upper = $total_num; } else { $upper = $pagesize * $cgi_pagenum; } $total_page = strtil($total_num / $pagesize, "."); $total_page = intval($total_page) + 1; $perpageof = "{$lower} to {$upper} of "; if ($sgbl->isBlackBackground()) { $backgroundstring = "background:#222222;"; $stylebackgroundstring = "style='background-color:#000000; background:#000000;'"; $filteropacitystringspan = "<span style='background:black' > "; $filteropacitystring = "style='FILTER:progid;-moz-opacity:0.5'"; $filteropacitystringspanend = "</span>"; $backgroundcolorstring = "#000000"; $imgtopline = $login->getSkinDir() . "/black.gif"; $blackstyle = "style='background:black;color:gray;border:1px solid gray;'"; $imgtablerowhead = null; $col = "333"; $bordertop = "#444444"; } else { $blackstyle = null; $backgroundstring = "background:#fffafa;"; $stylebackgroundstring = null; $filteropacitystring = null; $filteropacitystringspan = null; $filteropacitystringspanend = null; $backgroundcolorstring = "#ffffff"; $bordertop = "#d0d0d0"; } if (!$sellist && !$this->isResourceClass($class)) { print " <fieldset style='{$backgroundstring} padding: 0 ; text-align: middle ; margin: 0; border: 0px; border-top: 1px solid {$bordertop}'><legend><font style='font-weight:bold'>{$pluraldesc} {$showvar} {$login->getKeyword('under')} {$parent->getId()} <font color=red>{$filterundermes} </font> {$this->print_machine($parent)} ({$perpageof}{$total_num})</font> </legend> </fieldset> "; } if (!$sellist && !$this->isResourceClass($class) && !$gbl->__inside_ajax) { ?> <table width=90% cellpadding=0 cellspacing=0 border=0 style=' <?php echo $backgroundstring; ?> border: 1px solid #<?php echo $col; ?> ; '> <tr> <td valign=bottom height=10> </td> <tr> <td width=10> </td> <td><?php $this->print_list_submit($class, $blist, $unique_name); ?> </td> <td> <?php $this->print_search($parent, $class); ?> </td width=10> </td> </tr> <tr> <td height=10> </td> </tr> </table> <?php } if (!$sellist && !$this->isResourceClass($class) && !$gbl->__inside_ajax) { $imgshow = get_general_image_path() . "/button/btn_show.gif"; print "<table cellpadding=0 cellspacing=0 width=95% border=0 valign=middle> <tr> <td colspan=100 height=6></td> </tr> <tr valign=middle >"; $imgbtm1 = get_general_image_path() . "/button/btm_01.gif"; $imgbtm2 = get_general_image_path() . "/button/btm_02.gif"; $imgbtm3 = get_general_image_path() . "/button/btm_03.gif"; $imgshow = get_general_image_path() . "/button/btn_show.gif"; $rpagesize = exec_class_method($rclass, "perPage"); if ($rpagesize > 1000) { $width = 50; } else { $width = 70; } print "<td nowrap> </td>"; print "<td ><b>Page</b> </td> "; $last = false; foreach (range(1, $total_page) as $i) { if ($i > 6) { $last = true; } if ($sgbl->isBlackBackground()) { $col = "333"; } if ($i == $cgi_pagenum) { $bgcolorstring = "background: #{$col}"; } else { $bgcolorstring = ""; } print "<form name=page{$unique_name}{$i} method={$sgbl->method} action=''>"; print "<td width=6 style='border: 1px solid #{$col}; {$bgcolorstring}'>"; $this->print_current_input_var_unset_filter($filtername, array('pagenum')); $this->print_current_input_vars(array('frm_hpfilter')); if ($last) { print " <input type=hidden name=\"frm_hpfilter[{$filtername}][pagenum]\" type=text value={$total_page} class=small>"; print "<a href=javascript:page{$unique_name}{$i}.submit()>...Last </a>"; } else { print " <input type=hidden name=\"frm_hpfilter[{$filtername}][pagenum]\" type=text value={$i} class=small>"; print "<a href=javascript:page{$unique_name}{$i}.submit()> {$i} </a>"; } print "</form> </td>"; if ($last) { break; } } print "<td width=100%> </td>"; print "<td nowrap> <b>Show</b> </td>\n"; $f_page = (int) $login->issetHpFilter($filtername, 'pagesize') ? $login->getHPFilter($filtername, 'pagesize') : $pagesize; if ($rpagesize < 1000) { $list = array($rpagesize / 2, $rpagesize, $rpagesize * 2, $rpagesize * 4, $rpagesize * 8, $rpagesize * 16); $i = 0; foreach ($list as $l) { $i++; if ($l == $f_page) { $bgcolorstring = "background: #{$col}"; } else { $bgcolorstring = ""; } print "<td width=6 style='border: 1px solid #{$col}; {$bgcolorstring}'>"; print "<form name=perpage_{$i}{$unique_name} method={$sgbl->method} action=/display.php>"; $this->print_current_input_var_unset_filter($filtername, array('pagesize', 'pagenum')); $this->print_current_input_vars(array('frm_hpfilter')); print "<input type=hidden name=frm_hpfilter[{$filtername}][pagesize] value={$l}>"; print "</form> "; print "<a href=javascript:perpage_{$i}{$unique_name}.submit() > {$l} </a> "; print '</td> '; } } echo '</tr></table>'; } ?> <table width="100%"> <tr> <td align="center" style='border:0px solid black'> <table cellspacing="2" cellpadding="2" width="97%" align="center"> <tr> <td class="rowpoint"></td> <td colspan="<?php echo $nlcount; ?> "> <!-- </td></tr><tr><td height=2 colspan=2></td></tr></table> --> <tr height="25" valign="middle"> <?php if (!$sgbl->isBlackBackground()) { print "<td bgcolor={$backgroundcolorstring}> </td> "; } ?> <?php if (!$this->isResourceClass($class) && !$gbl->__inside_ajax) { ?> <td width=10 background=<?php echo $imgtablerowhead; ?> > <form name="formselectall<?php echo $unique_name; ?> " value=hello> <?php echo $filteropacitystringspan; ?> <input <?php echo $filteropacitystring; ?> type=checkbox name="selectall<?php echo $unique_name; ?> " value=on <?php if ($sellist) { echo "checked disabled"; } ?> onclick="javascript:calljselectall<?php echo $unique_name; ?> ()"> <?php echo $filteropacitystringspanend; ?> </form> </td> <?php } $imguparrow = get_general_image_path() . '/button/uparrow.gif'; $imgdownarrow = get_general_image_path() . '/button/downarrow.gif'; foreach ($name_list as $name => $width) { $desc = "__desc_{$name}"; if (csa($name, "abutton")) { $descr[$name] = array("b", "", "", "", 'help' => ""); } else { $descr[$name] = get_classvar_description($rclass, $desc); } if (!$descr[$name]) { print "Cannot access static variable {$rclass}::{$desc}"; exit(0); } if (csa($descr[$name][2], ':')) { $_tlist = explode(':', $descr[$name][2]); $descr[$name][2] = $_tlist[0]; } foreach ($descr[$name] as &$d) { if ($this->is_special_url($d)) { continue; } if (strstr($d, "%v") !== false) { $d = str_replace("[%v]", $classdesc[2], $d); } } if ($width === "100%") { $wrapstr = "wrap"; } else { $wrapstr = "nowrap"; } if ($sortby && $sortby === $name) { if ($sgbl->isBlackBackground()) { $wrapstr .= " style='background:gray'"; } else { $wrapstr .= " style='background:url({$skindir}/listsort.gif)'"; } print "<td width={$width} {$wrapstr} ><table cellspacing=0 cellpadding=2 border=0> <tr> <td class=collist rowspan=2 {$wrapstr}>"; } else { if ($sgbl->isBlackBackground()) { $wrapstr .= " style='background:gray'"; } else { $wrapstr .= " style='background:url({$skindir}/expand.gif)'"; } print "<td width={$width} {$wrapstr} class=collist>"; } ?> <b><?php $this->print_sortby($parent, $class, $unique_name, $name, $descr[$name]); ?> </b></font> <?php $imgarrow = $sortdir === "desc" ? $imgdownarrow : $imguparrow; if ($sortby && $sortby === $name) { print "</td> <td width=15><img src=" . $imgarrow . " ></td><td ></td></tr></table>"; } ?> </td> <?php } $count = 0; $rowcount = 0; echo '</tr>'; print_time('loop'); $n = 1; foreach ((array) $obj_list as $okey => $obj) { if (!$obj) { continue; } // Admin object should not be listed ever. if ($obj->isAdmin() && $obj->isClient()) { continue; } $checked = $obj->isSelect() ? "" : "disabled"; // Fix This. if ($sellist) { $checked = "checked disabled"; if (!array_search_bool($obj->nname, $sellist)) { continue; } } $imgpointer = get_general_image_path() . "/button/pointer.gif"; $imgblank = get_general_image_path() . "/button/blank.gif"; $rowuniqueid = "tr{$unique_name}{$rowcount}"; ?> <tr height=22 id=<?php echo $rowuniqueid; ?> class=tablerow<?php echo $count; ?> onmouseover=" swapImage('imgpoint<?php echo $rowcount; ?> ','','<?php echo $imgpointer; ?> ',1);document.getElementById('<?php echo $rowuniqueid; ?> ').className='tablerowhilite';" onmouseout="swapImgRestore();restoreListOnMouseOver('<?php echo $rowuniqueid; ?> ', 'tablerow<?php echo $count; ?> ','ckbox<?php echo $unique_name . $rowcount; ?> ')"> <?php if (!$sgbl->isBlackBackground()) { print "<td {$stylebackgroundstring} id=td{$unique_name}.{$rowcount} width=5 class=rowpoint><img name=imgpoint{$rowcount} src=\"{$imgblank}\"></td>"; } if (!$this->isResourceClass($class) && !$gbl->__inside_ajax) { ?> <td width=10 style='<?php echo $backgroundstring; ?> '> <?php echo $filteropacitystringspan; ?> <input <?php echo $filteropacitystring; ?> id=ckbox<?php echo $unique_name . $rowcount; ?> class=ch1 type=checkbox <?php echo $checked; ?> name=frm_accountselect onclick="hiliteRowColor('tr<?php echo $unique_name . $rowcount; ?> ','tablerow<?php echo $count; ?> ',document.formselectall<?php echo $unique_name; ?> .selectall<?php echo $unique_name; ?> )"; value="<?php echo $obj->nname; ?> "> <?php echo $filteropacitystringspanend; ?> </td> <?php } $colcount = 1; foreach ($name_list as $name => $width) { try { $this->printObjectElement($parent, $class, $classdesc, $obj, $name, $width, $descr, $colcount . "_" . $rowcount); } catch (exception $e) { break; } $colcount++; } print "</tr> "; if ($count === 0) { $count = 1; } else { $count = 0; } $rowcount++; if (!$sellist) { if ($n === $pagesize * $cgi_pagenum) { break; } } $n++; } print "<tr><td></td><td colspan={$nlcount}>"; if (!$rowcount) { if ($login->issetHpFilter($filtername, 'searchstring') && $login->getHPFilter($filtername, 'searchstring')) { ?> <table width=95%> <tr align=center> <td width=100%><b> <?php echo $login->getKeyword('no_matches_found'); ?> </b></td> </tr> </table> <?php } else { $filtermessagstring = null; if ($login->issetHpFilter($filtername)) { $filtermessagstring = $login->getKeyword('search_note'); ?> <table width=95%> <tr align=center> <td width=100%><b> <?php echo $filtermessagstring; ?> </b></td> </tr> </table> <?php } else { ?> <table width=95%> <tr align=center> <td width=100%> <b> <?php echo $login->getKeyword('no'); ?> <?php echo get_plural($classdesc[2]); ?> <?php echo $login->getKeyword('under'); ?> <?php echo "{$parent->getId()}"; ?> </b> </td> </tr> </table> <?php } } } print "</td></tr>"; print "<tr><td class=rowpoint></td><td colspan=" . $nlcount . " > <table cellpadding=0 cellspacing=0 border=0 width=100%> <tr height=1 style='background:url({$imgtopline})'><td></td></tr> <tr><td>"; if ($this->frm_action === 'selectshow') { return; } ?> <script>ckcount<?php echo $unique_name; ?> = <?php echo $rowcount . "; "; ?> function calljselectall<?php echo $unique_name; ?> () { jselectall(document.formselectall<?php echo $unique_name; ?> .selectall<?php echo $unique_name; ?> , ckcount<?php echo $unique_name; ?> , '<?php echo $unique_name; ?> ') } </script> <?php if ($sellist) { print "<table {$blackstyle}> <tr> <td >"; print "<form method={$sgbl->method} action={$_SERVER["PHP_SELF"]}>"; $ghtml->print_current_input_vars(array("frm_confirmed")); $ghtml->print_input("hidden", "frm_confirmed", "yes"); $ghtml->print_input("submit", "Confrm", "Confirm", "class=submitbutton"); print "</form> "; print "</td> <td width=30> </td> <td >"; print "<form method={$sgbl->method} action=\"/display.php\">"; $this->print_current_input_vars(array("frm_action", "frm_accountselect")); $ghtml->print_input("hidden", "frm_action", "list"); $ghtml->print_input("submit", "Cancel", "Cancel", "class=submitbutton"); print "</form> "; print "</td> </tr> </table> "; } if ($sgbl->isBlackBackground()) { print "</td></tr></table>"; print "</td></tr></table>"; print "</td></tr></table>"; return; } if (!$sellist && !$this->isResourceClass($class) && !$gbl->__inside_ajax) { $imgbtm1 = get_general_image_path() . "/button/btm_01.gif"; $imgbtm2 = get_general_image_path() . "/button/btm_02.gif"; $imgbtm3 = get_general_image_path() . "/button/btm_03.gif"; $imgshow = get_general_image_path() . "/button/btn_show.gif"; print "<table cellpadding=0 cellspacing=0 border=0 width=100%><tr><td >"; print "<table cellpadding=0 cellspacing=0 border=0>"; print "<form name=perpage_{$unique_name} method={$sgbl->method} action=''>"; print "<tr><td><img src='" . $imgbtm1 . "'></td><td background='" . $imgbtm2 . "'>"; $rpagesize = exec_class_method($rclass, "perPage"); if ($rpagesize > 1000) { $width = 50; } else { $width = 70; } print "<table width=90% cellpadding=0 cellspacing=0><tr><td width=40><b>Show</b></td><td width={$width}>"; $this->print_current_input_var_unset_filter($filtername, array('pagesize', 'pagenum')); $this->print_current_input_vars(array('frm_hpfilter')); $f_page = (int) $login->issetHpFilter($filtername, 'pagesize') ? $login->getHPFilter($filtername, 'pagesize') : $pagesize; if ($rpagesize < 1000) { print "<select class=textbox onchange='document.perpage_{$unique_name}.submit()' style='width:40' name=frm_hpfilter[{$filtername}][pagesize]>"; $list = array($rpagesize / 2, $rpagesize, $rpagesize * 2, $rpagesize * 4, $rpagesize * 8, $rpagesize * 16); foreach ($list as $l) { $sel = null; if ($l == $f_page) { $sel = "SELECTED"; } echo '<option value="' . $l . '" ' . $sel . '>' . $l . '</option>'; } print "</select>"; } else { print "<input type=text class=textbox style='width:25' name=frm_hpfilter[{$filtername}][pagesize] value={$f_page}>"; } print "<input type=image src='" . $imgshow . "'>"; print "</td></tr></table>"; print "</td><td><img src='" . $imgbtm3 . "'></td></tr></form></table>"; print "</td><td align=right >"; if ($rpagesize < 1000) { print "<form method={$sgbl->method} action=''>"; print "<table cellpadding=0 cellspacing=0 border=0 valign=middle><tr valign=middle><td><b> Page </b>"; $this->print_current_input_var_unset_filter($filtername, array('pagenum')); $this->print_current_input_vars(array('frm_hpfilter')); print "<input class=textbox style='width:25px' name=\"frm_hpfilter[{$filtername}][pagenum]\" type=text value={$cgi_pagenum} class=small></td><td >"; print "<input type=image src='{$imgshow}'>"; print "</form> </td></tr></table> "; } } print "</td></tr></table>"; print "</td></tr></table>"; print "</td> </tr></table>"; //else { // // $this->print_list_submit($blist); // } //print_time("$class.objecttable", "$class.objecttable"); }
static function createListSlist($parent) { global $gbl, $sgbl, $login, $ghtml; $nlist['nname'] = null; $gen = $login->getObject('general'); $cat = get_namelist_from_objectlist($gen->helpdeskcategory_a); $cat = lx_merge_good('--any--', $cat); $nlist['category'] = array('s', $cat); return $nlist; }
function add_disabled($list) { $newlist[] = "--Disabled--"; $newlist = lx_merge_good($newlist, $list); return $newlist; }
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; }
function getIndividualIpList() { if (isIPV6($this->lastip)) { $sep = ':'; } else { $sep = '.'; } $base = explode($sep, $this->lastip); $end = array_pop($base); $base = explode($sep, $this->firstip); $start = array_pop($base); $base = implode($sep, $base); if (isIPV6($this->lastip)) { for ($i = hexdec($start); $i <= hexdec($end); $i++) { $out[] = "{$base}{$sep}" . dechex($i); } } else { for ($i = $start; $i <= $end; $i++) { $out[] = "{$base}{$sep}{$i}"; } } $ex = get_namelist_from_objectlist($this->ippoolextraip_a); $out = lx_merge_good($out, $ex); $exception = get_namelist_from_objectlist($this->ippoolexceptionip_a); //dprintr($exception); foreach ($out as $k => $v) { if (isset($exception[$v])) { unset($out[$k]); } } $exception = get_namelist_from_objectlist($this->ippoolpingip_a); //dprintr($exception); foreach ($out as $k => $v) { if (isset($exception[$v])) { unset($out[$k]); } } return $out; }
function updateform($subaction, $param) { global $gbl, $sgbl, $login, $ghtml; $progname = $sgbl->__var_program_name; switch ($subaction) { case "multi": $vlist['multi'] = null; break; case "browsebackup": $vlist['browsebackup_b-browsebackup_flag'] = null; //$vlist['browsebackup_b-backupslave'] = array('s', get_all_pserver()); //$vlist['browsebackup_b-rootdir'] = null; break; case "historytime": $vlist['generalmisc_b-traffichistory_time'] = null; $vlist['generalmisc_b-loginhistory_time'] = null; break; case "disableper": $vlist['generalmisc_b-dpercentage'] = array('s', array('90', '95', '100', '105', '110', '120')); break; case "npercentage": $vlist['generalmisc_b-npercentage'] = null; break; case "ssh_config": $vlist['generalmisc_b-sshport'] = null; // return $vlist; break; case "kloxo_config": $vlist['kloxoconfig_b-remoteinstall_flag'] = null; $vlist['kloxoconfig_b-installapp_url'] = null; // return $vlist; break; case "portconfig": $this->portconfig_b->setDefaultValue('sslport', $sgbl->__var_prog_ssl_port); $this->portconfig_b->setDefaultValue('nonsslport', $sgbl->__var_prog_port); $vlist['portconfig_b-sslport'] = null; $vlist['portconfig_b-nonsslport'] = null; //$vlist['portconfig_b-nonsslportdisable_flag'] = null; $vlist['portconfig_b-redirectnonssl_flag'] = null; // return $vlist; break; case "download_config": $vlist['generalmisc_b-masterdownload'] = null; // return $vlist; break; case "attempts": $vlist['generalmisc_b-attempts'] = null; break; case "maintenance": $vlist['generalmisc_b-maintenance_flag'] = null; $vlist['text_maintenance_message'] = array('t', null); // return $vlist; break; case "generalsetting": $vlist['generalmisc_b-autoupdate'] = null; if ($sgbl->isHyperVM()) { if (!isset($this->generalmisc_b->installkloxo)) { $this->generalmisc_b->installkloxo = 'on'; } $vlist['generalmisc_b-installkloxo'] = null; $vlist['generalmisc_b-openvzincrement'] = null; $vlist['generalmisc_b-xenimportdriver'] = null; $vlist['generalmisc_b-rebuild_time_limit'] = null; $vlist['generalmisc_b-no_console_user'] = null; $vlist['generalmisc_b-disable_hostname_change'] = null; } if ($sgbl->isKloxo()) { // MR --- On original, why double declare?. Modified! $vlist['generalmisc_b-extrabasedir'] = null; // $vlist['generalmisc_b-extrabasedir'] = null; $list = array("awstats", "webalizer"); // $list = array("awstats", "webalizer"); $list = add_disabled($list); // $list = add_disabled($list); $this->generalmisc_b->setDefaultValue('webstatisticsprogram', 'awstats'); // $this->generalmisc_b->setDefaultValue('webstatisticsprogram', 'awstats'); $vlist['generalmisc_b-webstatisticsprogram'] = array('s', $list); // $vlist['generalmisc_b-webstatisticsprogram'] = array('s', $list); $vlist['generalmisc_b-disableinstallapp'] = null; // $vlist['generalmisc_b-disableinstallapp'] = null; $list = lx_merge_good('--chooser--', mmail::getWebmailProgList()); // $list = lx_merge_good('--chooser--', mmail::getWebmailProgList()); $vlist['generalmisc_b-webmail_system_default'] = array('s', $list); // $vlist['generalmisc_b-webmail_system_default'] = array('s', $list); } $vlist['generalmisc_b-htmltitle'] = null; $vlist['generalmisc_b-ticket_url'] = null; $vlist['login_pre'] = null; // MR --- immediately process before goback $this->postUpdateGeneralsetting(); break; case "hostdiscovery": $vlist['generalmisc_b-usenmapforping'] = null; break; case "reversedns": if (!$this->reversedns_b) { $this->reversedns_b = new reversedns_b(null, null, 'general'); } if ($sgbl->isHyperVM()) { $vlist['reversedns_b-enableflag'] = null; $vlist['reversedns_b-forwardenableflag'] = null; } $this->dns_slave_list = $this->reversedns_b->dns_slave_list; $vlist['reversedns_b-primarydns'] = null; $vlist['reversedns_b-secondarydns'] = null; $serverlist = get_namelist_from_objectlist($login->getRealPserverList('dns')); $vlist['dns_slave_list'] = array('U', $serverlist); break; case "scavengetime": $tcron = new Cron(null, null, 'test'); $v = cron::$hourlist; unset($v[0]); $vlist['generalmisc_b-scavengehour'] = array('s', $v); $vlist['generalmisc_b-scavengeminute'] = array('s', array("0", "15", "30", "45")); break; case "selfbackupconfig": $vlist['selfbackupparam_b-selfbackupflag'] = null; $vlist['selfbackupparam_b-ftp_server'] = null; $vlist['selfbackupparam_b-rm_directory'] = null; $vlist['selfbackupparam_b-rm_username'] = null; $vlist['selfbackupparam_b-rm_password'] = array('m', '***'); //$vlist['selfbackupparam_b-rm_last_number'] = null; break; case "hackbuttonconfig": $vlist['hackbuttonconfig_b-nobackup'] = null; $vlist['hackbuttonconfig_b-nomonitor'] = null; break; case "session_config": $vlist['generalmisc_b-disableipcheck'] = null; break; case "customaction": $vlist['customaction_b-vps__update__rebuild'] = null; break; } return $vlist; }
function createServerAliasLine() { global $gbl, $sgbl, $login, $ghtml; $list = get_namelist_from_objectlist($this->main->server_alias_a); $iplist = null; foreach ($this->main->__var_domainipaddress as $ip => $dom) { if ($dom === $this->main->nname) { $iplist[] = $ip; } } if ($list) { foreach ($list as &$__l) { $__l = "{$__l}.{$this->main->nname}"; } } if ($this->main->isOn('force_www_redirect')) { $list = lx_merge_good(array("www.{$this->main->nname}"), $list); } else { $list = lx_merge_good(array("www.{$this->main->nname}", $this->main->nname), $list); } foreach ((array) $this->main->__var_addonlist as $d) { // forget this if? if ($d->ttype === 'redirect') { continue; } $list[] = $d->nname; $list[] = "www.{$d->nname}"; } $list = lx_array_merge(array($list, $iplist)); $string = implode("|", $list); // issue 674 - wildcard and subdomain problem // remove for * (wildcards) $string = str_replace("|*.{$this->main->nname}", "", $string); return "^({$string})"; }
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; }
function __ac_desc_UpdateForm($object) { global $gbl, $sgbl, $login, $ghtml; if (!$object) { return; } $selflist = $object->getSelfList(); $subaction = $ghtml->frm_subaction; // WHy is this getting called????? $object->createShowPropertyList($alist); if (isset($alist['property']) && count($alist['property']) > 1) { $nalist = null; $nalist = lx_merge_good($nalist, $alist['property']); $ghtml->print_tab_block($nalist); } else { if ($object->getParentO()) { $alist['property'] = null; $object->getParentO()->createShowPropertyList($alist); $nalist = null; foreach ($alist['property'] as &$a) { $a .= '&goback=1'; } $nalist = lx_merge_good($nalist, $alist['property']); $ghtml->print_tab_block($nalist); } } $object->showRawPrint(); $ghtml->print_message(); if ($selflist) { $ghtml->printShowSelectBox($selflist); } $sublist = $object->getMultiUpload($subaction); if (is_array($sublist)) { foreach ($sublist as $subaction) { do_updateform($object, $subaction); print "<br> <br> <br> "; } } else { do_updateform($object, $sublist); } }
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); }
function getIndividualIpList() { $base = explode(".", $this->lastip); $end = array_pop($base); $base = explode(".", $this->firstip); $start = array_pop($base); $base = implode(".", $base); for ($i = $start; $i <= $end; $i++) { $out[] = "{$base}.{$i}"; } $ex = get_namelist_from_objectlist($this->ippoolextraip_a); $out = lx_merge_good($out, $ex); $exception = get_namelist_from_objectlist($this->ippoolexceptionip_a); //dprintr($exception); foreach ($out as $k => $v) { if (isset($exception[$v])) { unset($out[$k]); } } $exception = get_namelist_from_objectlist($this->ippoolpingip_a); //dprintr($exception); foreach ($out as $k => $v) { if (isset($exception[$v])) { unset($out[$k]); } } return $out; }
static function addform($parent, $class, $typetd = null) { global $gbl, $sgbl, $login, $ghtml; $progname = $sgbl->__var_program_name; $vlist['nname'] = ""; if ($sgbl->isKloxo()) { $dlist = domainbase::getDnsTemplateList($parent); if ($typetd['val'] === 'customer') { $vlist['domain_name'] = ""; $vlist['dnstemplate_name'] = make_hidden_if_one($dlist); $list = array('wordpress', 'mambo', 'joomla', 'dolphin'); $list = lx_merge_good('--leave--', $list); $vlist['installapp_app'] = array('s', $list); } } $vlist['password'] = ""; $nclist = $parent->getResourcePlanList('resourceplan'); $vlist['__c_subtitle_plan'] = "Welcome Message"; $vlist['contactemail'] = ""; $vlist['send_welcome_f'] = ""; $vlist['__v_button'] = $login->getKeywordUc('add'); $vlist['__c_subtitle_temp'] = "Choose Plan"; $vlist['resourceplan_f'] = array('A', $nclist); if ($sgbl->isKloxo()) { if ($typetd['val'] === 'customer') { if (check_if_many_server()) { $vlist['__c_subtitle_server'] = "Servers"; self::getDomainServerVlist($parent, null, $vlist); } } } $ret['variable'] = $vlist; $ret['action'] = "continue"; $ret['continueaction'] = "server"; return $ret; }
function updateform($subaction, $param) { switch ($subaction) { case "editmx": $rec = $this->getParentO()->getObject('dns')->dns_record_a; foreach ($rec as $a) { if ($a->ttype === 'mx') { $v = $a->param; continue; } } $vlist['nname'] = array('M', null); $vlist['mx_f'] = array('m', $v); $vlist['__v_updateall_button'] = array(); return $vlist; case "authentication": $domkey = db_get_value("servermail", $this->syncserver, "domainkey_flag"); if (!$domkey) { $domkey = 'off'; } $domkey .= " (Server Wide Value)"; $vlist['domainkey_f'] = array('M', $domkey); $vlist['enable_spf_flag'] = null; $vlist['text_spf_domain'] = null; $vlist['text_spf_ip'] = null; $this->setDefaultValue('exclude_all', 'soft'); $vlist['exclude_all'] = array('s', array('soft', 'hard')); $vlist['__v_updateall_button'] = array(); return $vlist; case "webmail_select": // read note on fixWebmailRedirect() $this->postUpdate($subaction); $this->setDefaultValue('webmailprog', '--system-default--'); $base = "/home/kloxo/httpd/webmail/"; $list = lscandir_without_dot_or_underscore($base); $nlist[] = '--system-default--'; $nlist[] = '--chooser--'; $nlist = add_disabled($nlist); $plist = self::getWebmailProgList(); $nlist = lx_merge_good($nlist, $plist); $vlist['webmailprog'] = array('s', $nlist); $vlist['__v_updateall_button'] = array(); return $vlist; case "catchall": $list = $this->getList('mailaccount'); $name[] = "--bounce--"; $name[] = "Delete"; $nn = get_namelist_from_objectlist($list); foreach ($nn as &$___t) { $tmp = explode("@", $___t); $___t = $tmp[0]; } $name = lx_array_merge(array($name, $nn)); $vlist['catchall'] = array('s', $name); $vlist['__v_updateall_button'] = array(); return $vlist; case "remotelocalmail": // read note on fixWebmailRedirect() $this->postUpdate($subaction); $vlist['remotelocalflag'] = array('s', array('local', 'remote')); $vlist['webmail_url'] = null; $vlist['__v_updateall_button'] = array(); return $vlist; } return parent::updateform($subaction, $param); }