static function addform($parent, $class, $typetd = null) { $class = strtilfirst($class, "_"); $class = "vps__{$class}"; $list = exec_class_method($class, "getOsTemplatelist"); $vlist['nname'] = array('A', $list); $ret['variable'] = $vlist; $ret['action'] = 'add'; return $ret; }
static function continueFormlistpriv($parent, $class, $param, $continueaction) { $ret = exec_class_method('client', 'continueFormClientFinish', $parent, $class, $param, $continueaction); return $ret; $totallist = null; $array = client::getPserverListPriv(); $listpriv = $parent->listpriv; $more = false; foreach ($array as $a) { $list = $a . "_list"; if (count($listpriv->{$list}) > 1) { $more = true; break; } } if ($more) { $vlist['server_detail_f'] = null; foreach ($array as $a) { $v = "{$a}_list"; if (!$parent->listpriv->{$v}) { throw new lxException("no_server_pool", $v); } $totallist = lx_merge_good($totallist, $parent->listpriv->{$v}); $vlist["{$a}_list"] = ""; } $vlist['server_detail_f'] = array('M', pservercore::createServerInfo($totallist)); $ret["param"] = $param; $ret["variable"] = $vlist; $ret["action"] = "add"; //$ret["continueaction"] = "clientfinish"; } else { // All are $singstringle arrays, so just implode with "". the actually arrays are indexed u$singstring the name itself. foreach ($array as $a) { $v = "{$a}_list"; if (!$parent->listpriv->{$v}) { throw new lxException("no_server_pool", $v); } $param["listpriv_s_{$a}_list"] = implode("", $parent->listpriv->{$v}); } //$param['listpriv_s_dbtype_list'] = implode($parent->listpriv->dbtype_list); } return $ret; }
function __cmd_desc_add($p, $parent = null) { global $gbl, $sgbl, $login, $ghtml; if (!$parent) { if (isset($p['parent-class']) && isset($p['parent-name'])) { $parent = new $p['parent-class'](null, 'localhost', $p['parent-name']); dprint("{$parent->nname}\n"); $parent->get(); if ($parent->dbaction === 'add') { throw new lxException("parent_doesnt_exist", "nname", $p['parent-name']); } if (!$parent->checkIfSomeParent($login->getClName())) { throw new lxException("you_are_not_the_owner_of_parent", "", $p['parent-name']); } } else { $parent = $login; } } copy_nname_to_name($p); $class = $p['class']; $var = get_variable($p); if (isset($p['count'])) { $oldname = $p['name']; for ($i = 0; $i < $p['count']; $i++) { if ($class === 'domain') { $p['name'] = "{$oldname}{$i}.com"; } else { $p['name'] = "{$oldname}{$i}"; } $param = exec_class_method($class, "addCommand", $parent, $class, $p); unset($var['template-name']); $param = lx_array_merge(array($param, $var)); do_desc_add($parent, $class, $param); } $parent->was(); exit; } $param = exec_class_method($class, "addCommand", $parent, $class, $p); unset($var['template-name']); $param = lx_array_merge(array($param, $var)); do_desc_add($parent, $class, $param); $parent->was(); }
static function continueFormlistpriv($parent, $class, $param, $continueaction) { $listpriv = $parent->listpriv; $more = false; if (count($listpriv->vpspserver_list) > 1) { $more = true; } if ($more) { $vlist['server_detail_f'] = array('M', pserver::createServerInfo($listpriv->vpspserver_list, "vps")); $vlist["vpspserver_sing"] = ""; $ret["param"] = $param; $ret["variable"] = $vlist; $ret["action"] = "continue"; $ret["continueaction"] = "finish"; } else { //$param['listpriv_s_dbtype_list'] = implode($parent->listpriv->dbtype_list); $param["listpriv_s_vpspserver_sing"] = implode("", $parent->listpriv->vpspserver_list); $ret = exec_class_method($class, 'continueFormFinish', $parent, $class, $param, $continueaction); } return $ret; }
function showRawPrint($subaction = null) { global $gbl, $sgbl, $login, $ghtml; if (!$subaction) { return; } $class = $subaction; $var = "{$subaction}_show_list"; $alist = exec_class_method($subaction, "get_full_alist"); foreach ($alist as $k => $a) { if ($ghtml->is_special_url($a)) { $alist[$k] = $a->purl; } } $dst = null; foreach ((array) $this->{$var} as $k => $v) { if (!csa($v, "__title")) { $dst[] = base64_decode($v); } else { $dst[] = $v; } } $ghtml->print_fancy_select($class, $alist, $dst); }
static function findTotalUsage($driver, $list) { $class = "mailaccount__{$driver}"; foreach ($list as $k => $d) { $mdiskusage[$k] = exec_class_method($class, "Mailaccdisk_usage", $d['nname']); } return $mdiskusage; }
function printSelectObjectTable($name_list, $parent, $class, $blist = array(), $display = null) { global $gbl, $sgbl, $login, $ghtml; print_time("{$class}.objecttable"); if ($this->frm_accountselect !== null) { $sellist = explode(',', $this->frm_accountselect); } else { $sellist = null; } $classdesc = $this->get_class_description($class, $display); $unique_name = trim($parent->nname) . trim($class) . trim($display) . trim($classdesc[2]); $unique_name = fix_nname_to_be_variable($unique_name); $filtername = $parent->getFilterVariableForThis($class); $fil = $this->frm_hpfilter; $sortdir = null; $sortby = null; if (isset($fil[$filtername]['sortby'])) { $sortby = $fil[$filtername]['sortby']; } if (isset($fil[$filtername]['sortdir'])) { $sortdir = $fil[$filtername]['sortdir']; } $pagesize = '99999'; $iconpath = get_image_path() . "/button"; $nlcount = count($name_list) + 1; $imgheadleft = $login->getSkinDir() . "/top_lt.gif"; $imgheadleft2 = $login->getSkinDir() . "/top_lt.gif"; $imgheadright = $login->getSkinDir() . "/top_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.gif"; $imgtopline = $login->getSkinDir() . "/top_line.gif"; $classdesc = $this->get_class_description($class); $unique_name = trim($parent->nname) . trim($class) . trim($classdesc[2]); $unique_name = fix_nname_to_be_variable($unique_name); //dprint("-- ".$unique_name. " --", 2); ?> <br /> <script> var ckcount<?php echo $unique_name; ?> ; </script> <?php $tsortby = $sortby; if (!$sortby) { $tsortby = exec_class_method($class, "defaultSort"); } if (!$sortdir) { $sortdir = exec_class_method($class, "defaultSortDir"); } //print_time("objecttable"); $obj_list = $parent->getVirtualList($class, $total_num, $tsortby, $sortdir); //print_time("objecttable", 'objecttable'); if (!$sellist) { //$total_num = $this->display_count($obj_list, $display) ; } ?> <table width=100%> <tr> <td align=center> <table cellspacing=2 cellpadding=2 width=97% align=center> <tr><td class=rowpoint></td><td colspan= <?php echo $nlcount; ?> > <table cellpadding=0 cellspacing=0 border=0 width=100%> <tr><td valign=bottom ></td> <td> <?php if (isset($ghtml->__http_vars['frm_hpfilter'][$filtername]['pagenum'])) { $cgi_pagenum = $ghtml->__http_vars['frm_hpfilter'][$filtername]['pagenum']; } else { $cgi_pagenum = 1; } if (!$sellist) { $this->print_next_previous($parent, $class, "top", $cgi_pagenum, $total_num, $pagesize); } ?> </td> <td align=right valign=bottom > <?php if (!$sellist) { ?> <table cellpadding="0" cellspacing="0" border="0" height="27" > <tr><td><img src="<?php echo $imgheadleft; ?> "></td><td nowrap valign=middle background="<?php echo $imgheadbg; ?> "><b><font color="#ffffff"><?php echo get_plural($classdesc[2]); ?> under <?php echo $parent->display("nname"); ?> </b> <?php echo $this->print_machine($parent); ?> <b> (<?php echo $total_num; ?> )</b></font></td><td><img src="<?php echo $imgheadright; ?> "></td></tr> </table> </td> </tr> <tr><td colspan=3><table cellpadding=0 cellspacing=0 border=0 width=100% height=35 background="<?php echo $imgbtnbg; ?> "> <tr><td><img src="<?php echo $imgbtncrv; ?> "></td><td width=80% align=left > <table width=100% cellpadding=0 cellspacing=0 border=0><tr><td valign=bottom><?php $this->print_list_submit($class, $blist, $unique_name); ?> </td></tr></table></td><td width=15% align=right><b><font color="#ffffff"><?php $this->print_search($parent, $class); ?> </font></b></td></tr> </table> </td></tr> </td></tr><tr><td height=2 colspan=2></td></tr></table> <?php } else { $descr = $this->getActionDescr($_SERVER['PHP_SELF'], $this->__http_vars, $class, $var, $identity); ?> <table cellpadding=0 cellspacing=0 border=0 width=100%><tr><td width=70% valign=bottom><table cellpadding=0 cellspacing=0 border=0 width=100%><tr><td width=100% height=2 background="<?php echo $imgtopline; ?> "></td></tr></table></td><td align=right><table cellpadding=0 cellspacing=0 border=0 width=100% ><tr><td><img src="<?php echo $imgheadleft; ?> "></td><td nowrap width=100% background="<?php echo $imgheadbg; ?> " ><b><font color="#ffffff"> Confirm <?php echo $descr[1]; ?> : </b><?php echo get_plural($classdesc[2]); ?> from <?php echo $parent->display("nname"); ?> </font></td><td><img src="<?php echo $imgheadright; ?> "></td></tr></table></td></tr></table> </td></tr><tr><td height=0 colspan=2></td></tr></table> <?php } ?> <!-- </td></tr><tr><td height=2 colspan=2></td></tr></table> --> <tr><td bgcolor="#ffffff"></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}"; $descr[$name] = get_classvar_description($class, $desc); if (!$descr[$name]) { print "Cannot access static variable {$class}::{$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) { $wrapstr .= " background={$imgtablerowheadselect}"; print "<td width={$width} {$wrapstr} ><table cellpadding=0 cellspacing=0 border=0> <tr> <td rowspan=2 {$wrapstr}>"; } else { $wrapstr .= " background={$imgtablerowhead}"; print "<td width={$width} {$wrapstr} class=col>"; } ?> <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; ?> <td width=10 background=<?php echo $imgtablerowhead; ?> > <form name="formselectall<?php echo $unique_name; ?> " value=hello> <input type=checkbox name="selectall<?php echo $unique_name; ?> " value=on <?php if ($sellist) { echo "checked disabled"; } ?> onclick="javascript:calljselectall<?php echo $unique_name; ?> ()"></form> </td> <?php print "</tr> "; print_time('loop'); $n = 1; foreach ((array) $obj_list as $okey => $obj) { $checked = ''; // 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"; ?> <script> loadImage('<?php echo $imgpointer; ?> ') </script> <script> loadImage('<?php echo $imgblank; ?> ') </script> <tr id=tr<?php echo $unique_name . $rowcount; ?> class=tablerow<?php echo $count; ?> onmouseover=" swapImage('imgpoint<?php echo $rowcount; ?> ','','<?php echo $imgpointer; ?> ',1);" onmouseout="swapImgRestore();"> <td id=td<?php echo $unique_name . $rowcount; ?> width=5 class=rowpoint><img name=imgpoint<?php echo $rowcount; ?> src="<?php echo $imgblank; ?> "></td> <?php $colcount = 1; foreach ($name_list as $name => $width) { $this->printObjectElement($parent, $class, $classdesc, $obj, $name, $width, $descr, $colcount . "_" . $rowcount); $colcount++; } $basename = basename($obj->nname); $selectshowbase = $this->frm_selectshowbase; // issue #609 // $ret = strfrom($parent->nname, $selectshowbase); $ret = str_replace('//', '/', strfrom($parent->nname, $selectshowbase)); print " <td width=10 >"; print "<a class=button href=\"javascript:callSetSelectFolder('/{$ret}/{$basename}')\">"; print " Select </a>"; print "</tr> "; if ($count === 0) { $count = 1; } else { $count = 0; } $rowcount++; if (!$sellist) { if ($n === $pagesize * $cgi_pagenum) { break; } } $n++; } print_time('loop', "loop{$n}"); print "<tr><td></td><td colspan={$nlcount}>"; if (!$rowcount) { if ($ghtml->frm_searchstring) { ?> <table width=95%> <tr align=center> <td width=100%> <b> No Matches Found </b> </td> </tr> </table> <?php } else { ?> <table width=95%> <tr align=center> <td width=100%> <b> No <?php echo get_plural($classdesc[2]); ?> under <?php echo $parent->nname; ?> </b> </td> </tr> </table> <?php } } print "</td></tr>"; print "<tr><td class=rowpoint></td><td colspan=" . $nlcount . " >\n <table cellpadding=0 cellspacing=0 border=0 width=100%>\n <tr height=1 style='background:url({$imgtopline})'><td></td></tr>\n <tr><td>"; ?> <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 print "<table> <tr> <td >"; print "<a class=button href=\"javascript:window.close()\"> Cancel </a> "; print "</td> <td width=30> </td> <td >"; print "</td> </tr> </table> "; print "</td></tr></table></tr></table></td> </tr> </table>"; //else { // // $this->print_list_submit($blist); // } //print_time("$class.objecttable", "$class.objecttable"); /// Important. This is to make sure that the session saving etc doesn't take place. We just need a plain and clean window without any saving. If this happens the current url gets added to the sessiona and redirection will screw up. exit; }
function print_resource($tree, $object, $cgi_o_o, $toplevelobject, $depth, $alistflag, $func, $childobjectflag = false, $showurlflag = true) { global $gbl, $sgbl, $login, $ghtml; $bgcolor = null; $path = get_image_path() . "/button/"; $bpath = get_image_path() . "/button/"; $class = $object->getClass(); if (!$tree) { $tree = createTreeObject('name', null, null, null, null, null, null); $level = -1; } else { $level = 1; } $cnl = $object->{$func}(); $alist = null; if ($level != -1) { if ($childobjectflag) { $url = $this->getFullUrl("a=show&o={$class}", $cgi_o_o); $num = count($cgi_o_o); $cgi_o_o[$num]['class'] = $class; } else { $urlname = $object->nname; $url = $this->getFullUrl("a=show&l[class]={$class}&l[nname]={$urlname}", $cgi_o_o); $num = count($cgi_o_o); $cgi_o_o[$num]['class'] = $class; $cgi_o_o[$num]['nname'] = $object->nname; } $open = 'false'; $alist = null; } else { $url = $this->getFullUrl("a=show", $cgi_o_o); $alist = $object->createShowAlist($alist); $open = 'true'; } $list = $object->createShowTypeList(); foreach ($list as $k => $v) { $type = $object->{$k}; $vtype = $k; } if ($childobjectflag) { $img = $this->get_image($path, $class, "show", ".gif"); } else { $img = $this->get_image($path, $class, "{$vtype}_v_{$type}", ".gif"); } if (isset($object->status) && $object->status) { if ($object->isOn('status')) { $hstr = "and is Enabled"; $status = 'on'; } else { $hstr = "and is Disabled"; $status = 'off'; } $stimg = $this->get_image($path, $class, "status_v_" . $status, ".gif"); $imgstr = "<img height=8 width=8 src={$stimg}>"; } else { $imgstr = null; $hstr = null; } $homeimg = $this->get_image($path, $class, "show", ".gif"); if ($childobjectflag) { $name = $ghtml->get_class_description($class); $name = $name[2]; } else { $name = $object->getId(); } $help = "{$class} <font color=blue> {$name} </font> is of Type {$type} {$hstr}"; $alt = lx_strip_tags($help); $inputstr = null; if (!$showurlflag) { $url = null; } $imgstr = "{$inputstr} <img src={$img} width=14 height=14> {$imgstr} {$name}"; if (isset($object->__v_message)) { $imgstr .= " " . $object->__v_message; } $pttr = createTreeObject($name, $img, $imgstr, $url, $open, $help, $alt); $tree->addToList('tree', $pttr); $childdepth = 1; $ppp = $object; //dprintr($depth); if ($object !== $toplevelobject) { while ($ppp = $ppp->getParentO()) { if ($ppp === $toplevelobject) { break; } $childdepth++; } if ($depth && $childdepth >= $depth) { return; } } //print("$treename.add($total, $level, '<img src=$img width=14 height=14> $imgstr $name', '$url', '', 'mainframe', '', '', $open, '$help', '$alt');\n"); if ($alist && $alistflag) { $open = 'false'; $imgstr = "<img src={$homeimg} width=14 height=14> <font color=#5958aa> <b> Functions </b></font> "; $ttr = createTreeObject($name, '', $imgstr, $url, $open, $help, $alt); $pttr->addToList('tree', $ttr); //print("$treename.add($total, $level + 1, '<img src=$homeimg width=14 height=14> <font color=#5958aa> <b> Functions </b></font> ', '', '', 'mainframe', '$homeimg', '$homeimg', $open, '$help', '$alt');\n"); $this->print_resourcelist($ttr, $alist, null); $open = 'true'; } foreach ((array) $cnl as $v) { $name = $object->getChildNameFromDes($v); if (cse($v, "_o")) { $c = null; if ($object->isRealChild($name)) { $c = $object->getObject($name); } if ($c) { $this->print_resource($pttr, $c, $cgi_o_o, $toplevelobject, $depth, $alistflag, $func, true, $showurlflag); } continue; } $img = $this->get_image($path, $name, "list", ".gif"); $url = $this->getFullUrl("a=list&c={$name}"); $desc = $this->get_class_description($name); $printname = get_plural($desc[2]); $help = "Click to Show {$printname}"; $alt = $help; $npttr = $pttr; if ($object === $toplevelobject) { $open = 'true'; $gbl->__navigmenu[$level + 2] = array('show', $object); $gbl->__navig[$level + 2] = $this->get_post_from_get($url, $__tpath, $__tpost); $imgstr = "<img src={$img} width=20 height=20>{$printname}"; if (!$showurlflag) { $url = null; } $npttr = createTreeObject($name, $homeimg, $imgstr, $url, $open, $help, $alt); $pttr->addToList('tree', $npttr); //print("$treename.add($total, 0, '<img src=$img width=20 height=20>$printname ', '$url', '', 'mainframe', '$img', '$img', $open, '$help', '$alt');\n"); if ($alistflag) { $open = 'false'; $imgstr = 'Functions'; $nttr = createTreeObject($name, $homeimg, $imgstr, $url, $open, $help, $alt); $npttr->addToList('tree', $nttr); //print("$treename.add($total, $lv, 'Functions', '$url', '', 'mainframe', '', '', $open, '$help', '$alt');\n"); $lalist = exec_class_method($name, 'createListAlist', $object, $name); $this->print_resourcelist($nttr, $lalist, null); } } $open = 'true'; $filtername = $object->getFilterVariableForThis($name); $pagesize = (int) $login->issetHpFilter($filtername, 'pagesize') ? $login->gethpfilter($filtername, 'pagesize') : exec_class_method($class, "perPage"); if (isset($sgbl->__var_main_resource) && $sgbl->__var_main_resource) { $cl = $object->getList($name); $count = count($cl); $halfflag = false; } else { $halfflag = true; $cl = $object->getVirtualList($name, $count); } if ($object->isVirtual($name)) { continue; } if ($cl) { //Setting $prev to -ll; this is done to initialize prev. if ($object === $toplevelobject && $login->getSpecialObject('sp_specialplay')->isOn('lpanel_group_resource') && $alistflag) { $prev = "-ll"; foreach ($cl as $c) { if ($c->nname[0] != $prev[0]) { $imgstr = "<b>{$c->nname[0]} ....</b> "; $ttr = createTreeObject($name, $homeimg, $imgstr, $url, $open, $help, $alt); $npttr->addToList('tree', $ttr); //print("$treename.add($total, $oldlv, '<b>{$c->nname[0]} ....</b> ', '', '', 'mainframe', '$img', '$img', false, '$help');\n"); } $prev = $c->nname; $this->print_resource($ttr, $c, $cgi_o_o, $toplevelobject, $depth, $alistflag, $func, false, $showurlflag); } } else { foreach ($cl as $c) { $this->print_resource($npttr, $c, $cgi_o_o, $toplevelobject, $depth, $alistflag, $func, false, $showurlflag); } } if ($halfflag && $count > $pagesize) { $url = $ghtml->getFullUrl("a=list&c={$name}", $cgi_o_o); $ttr = createTreeObject($name, $homeimg, "More (Showing {$pagesize} of {$count})", $url, $open, $help, $alt); $npttr->addToList('tree', $ttr); } } } // At the top client Make all the children virtual.. This assures that after viewing resources, the cache doesn't hogg the system. return $tree; }
function getListActions(&$alist, $class) { global $gbl, $sgbl, $login, $ghtml; $l = exec_class_method($class, 'createListAlist', $this, $class); if (!$login->getSpecialObject('sp_specialplay')->isOn('show_add_buttons')) { foreach ((array) $l as $k => $a) { if (!is_array($a) && !$ghtml->is_special_url($a) && csa($a, "addform")) { unset($l[$k]); } } } $alist = lx_array_merge(array($alist, $l)); //Hack hack... Removing the addform at this moment. return $alist; }
static function continueFormlistpriv($parent, $class, $param, $continueaction) { $ret = exec_class_method($class, 'continueFormFinish', $parent, $class, $param, $continueaction); return $ret; }
$pn = $list['parent-name']; $parent = new $pc(null, null, $pn); $parent->get(); if ($parent->dbaction === 'add') { print "parent {$parent->getClName()} doesn't exist\n"; exit; } $typtd = null; if (isset($list['v-val'])) { $typtd['val'] = $list['v-val']; } if (isset($list['v-var'])) { $typtd['var'] = $list['v-var']; } $parent->priv = new Priv(null, null, $pn); $param = exec_class_method($class, 'addform', $parent, $class, $typtd); $param = $param['variable']; } else { printProperty($class, $type); } } foreach ($param as $k => $v) { if (csb($k, "__v") || csb($k, "__c") || csb($k, "__m")) { continue; } $desc = get_classvar_description($class, $k); $c = null; $prep = null; if ($v && is_array($v)) { if ($v[0] === 'M') { $c = "Static: {$v[1]}";
static function getVpsOsimage($parent, $driver, $type = "add") { global $gbl, $sgbl, $login, $ghtml; $class = "vps__{$driver}"; $var = "{$driver}_ostl_a"; $list = exec_class_method($class, "getOsTemplatelist", $type); /* $obj = new Ostemplatelist(null, null, 'admin'); $obj->get(); $ostlist = get_namelist_from_objectlist($obj->$var); // Filter only if not admin. if (count($ostlist) > 0 && !$login->isAdmin()) { foreach($list as $k => $v) { if (!array_search_bool($k, $ostlist)) { unset($list[$k]); } } } */ $ostlist = "{$driver}ostemplate_list"; if (!$login->isAdmin() && count($login->{$ostlist}) > 0) { foreach ($list as $k => $v) { if (!array_search_bool($k, $login->{$ostlist})) { unset($list[$k]); } } } return $list; }
function do_desc_add($object, $class, $param) { global $gbl, $sgbl, $login, $ghtml; $quotaclass = exec_class_method($class, "getquotaclass", $class); $numvar = "{$quotaclass}_num"; $qobject = $object->getClientParentO(); dprint($qobject->getClname()); if ($qobject->isQuotaVariable($numvar)) { if (isQuotaGreaterThanOrEq($qobject->used->{$numvar}, $qobject->priv->{$numvar})) { throw new lxException("Quota Exceeded for {$class}", 'nname', $numvar); } } /* $list = $qobject->getQuotaVariableList(); foreach((array) $list as $l => $v) { if (csb($l, "{$class}_m_")) { $license = strtil(strfrom($l, "_n_"), "_num"); $licvar = strtil(strfrom($l, "_m_"), "_n_"); if (isset($param[$licvar]) && $param[$licvar] === $license) { if (isQuotaGreaterThanOrEq($qobject->used->$l, $qobject->priv->$l)) { throw new lxException("Quota Exceeded for $class $licvar.$license", 'nname', $numvar); } } } } */ // Setting it here itself so that the add can override if necessary. This is done in tickets, where the parent is always the admin. $param['parent_clname'] = $object->getClName(); // In the case of mailaccount, the real parent is mmail, while the object is added to client. if (isset($param['real_clparent_f'])) { $parent_class = exec_class_method($class, 'defaultParentClass', $object); $param['parent_clname'] = createParentName($parent_class, $param['real_clparent_f']); } $param = exec_class_method($class, 'Add', $object, $class, $param); // First loop to create a unique nname if applicable.... FOr the 'unique-nname-creation' to work in the second loop, the variables must be resolved before that... So this extra looping... foreach ($param as $k => $v) { if (csb($k, "__v_") || csb($k, "__m_")) { continue; } $object->resolve_class_differences($class, $k, $dclass, $dk); } foreach ($param as $k => $v) { if (csb($k, "__v_") || csb($k, "__m_")) { continue; } $object->resolve_class_heirarchy($class, $k, $dclass, $dk); $object->resolve_class_differences($class, $k, $ddclass, $ddk); $nnamevar = get_real_class_variable($ddclass, "__rewrite_nname_const"); if ($nnamevar) { $nnamelist = null; foreach ($nnamevar as $n) { $nnamelist[] = $param[$n]; } $nparam[$dclass]['nname'] = implode($sgbl->__var_nname_impstr, $nnamelist); } $nparam[$dclass][$dk] = $v; } // First Pass foreach ($nparam as $k => $v) { if (csa($k, "_s_")) { continue; } if ($k === 'priv') { $olist[$k] = new priv(null, null, $nparam[$class]['nname']); check_priv($object, $class, $olist[$k], $v); continue; } if ($k === 'used') { $olist[$k] = new Used(null, null, $nparam[$class]['nname']); $olist[$k]->create($v); continue; } if ($k === 'listpriv') { //$olist[$k] = new listpriv($object->__masterserver, null, $class . "_s_vv_p_" . $nparam[$class]['nname']); $olist[$k] = new listpriv($object->__masterserver, null, $class . "-" . $nparam[$class]['nname']); check_listpriv($object, $class, $olist[$k], $v); continue; } if (csa($k, "_b")) { $olist[$k] = new $k($object->__masterserver, null, $nparam[$class]['nname']); } else { $olist[$k] = new $k($object->__masterserver, null, $v['nname']); } $olist[$k]->inheritSyncServer($object); $olist[$k]->initThisDef(); $olist[$k]->create($v); // The createsyncclass needs the syncserver variable to be set. Which may not be available. So we have to run this again. if ($olist[$k]->hasDriverClass()) { $olist[$k]->createSyncClass(); } } // The main object has to inherit the masterserver here itself, so that its children will inherit it later when they are added through addobject. if (!cse($class, "_a") && exec_class_method($class, "isDatabase") && exists_in_db($object->__masterserver, $class, $olist[$class]->nname)) { // If the parent is getting added too, then that means we are in the client add page, and thus the variable is vps_name, domain_name rather than nname. if ($object->dbaction === 'add') { $vname = "{$class}_name"; } else { $vname = "nname"; } throw new lxException("{$olist[$class]->nname}+already+exists+in+{$class}.", $vname, $class); } //Second Pass... foreach ($nparam as $k => $v) { if (!csa($k, "_s_") && !csa($k, "-")) { continue; } $clist = explode("_s_", $k); $k = $clist[1]; $cl = $clist[0]; $nolist[$k] = new $k($object->__masterserver, null, $v['nname']); $nolist[$k]->inheritSyncServer($olist[$cl]); $nolist[$k]->initThisDef(); $nolist[$k]->create($v); // The createsyncclass needs the syncserver variable to be set. Which may not be available. So we have to run this again. if ($nolist[$k]->hasDriverClass()) { $nolist[$k]->createSyncClass(); } $olist[$cl]->addObject($k, $nolist[$k]); } foreach ($olist as $k => $v) { if (cse($k, "_b") || $k === 'used' || $k === 'priv' || $k === 'listpriv') { $olist[$class]->{$k} = $v; continue; } if ($k != $class) { $olist[$class]->addObject($k, $v); continue; } } if (isset($param['__v_priv'])) { $olist[$class]->priv = $param['__v_priv']; } if (isset($param['__v_listpriv'])) { $olist[$class]->listpriv = $param['__v_listpriv']; } //$olist[$class]->parent_clname = $object->getClName(); $rparent = $object; $olist[$class]->__parent_o = $rparent; $olist[$class]->postAdd(); $rparent->addToList($class, $olist[$class]); $olist[$class]->superPostAdd(); //dprintr($object); notify_admin("add", $object, $olist[$class]); do_actionlog($login, $olist[$class], "add", ""); //This shouldn't happen here. This should be done only after the synctosystem since, the sync can fail and the write may not happen at all. //$olist[$class]->changeUsedFromParentAll(); dprint($olist[$class]->getParentO()); }
function create_navmenu($n, $action, $stuff) { global $gbl, $sgbl, $login, $ghtml; if (is_object($stuff)) { $class = lget_class($stuff); } else { $class = $stuff; } if (is_object($stuff)) { $stuff->createShowAlist($alist); $type = 'slist'; } else { $type = 'llist'; $alist = exec_class_method($stuff, "createListAlist", $login, $stuff); } $f = null; if (isset($gbl->__navig[$n]['frm_o_o'])) { $f = $gbl->__navig[$n]['frm_o_o']; } $ghtml->print_menulist("navig{$n}", $alist, $f, $type); // print("navig$n.writeMenus();\n"); }
function removeOtherDrivers() { log_cleanup("Enable the correct drivers (Service daemons)"); $list = array("web", "spam", "dns"); foreach ($list as $l) { $driverapp = slave_get_driver($l); if (!$driverapp) { continue; } $otherlist = get_other_driver($l, $driverapp); if ($otherlist) { foreach ($otherlist as $o) { if (class_exists("{$l}__{$o}")) { log_cleanup("- Uninstall {$l}__{$o}"); exec_class_method("{$l}__{$o}", "uninstallMe"); } } } } }
static function getVpsOsimage($parent, $driver, $type = "add") { global $gbl, $sgbl, $login, $ghtml; $class = "vps__{$driver}"; $var = "{$driver}_ostl_a"; $list = exec_class_method($class, "getOsTemplatelist", $type); $ostlist = "{$driver}ostemplate_list"; if (!$login->isAdmin() && count($login->{$ostlist}) > 0) { foreach ($list as $k => $v) { if (!array_search_bool($k, $login->{$ostlist})) { unset($list[$k]); } } } return $list; }