function storeinGblvariables() { global $gbl, $sgbl, $login, $ghtml; return; $firstofmonth = @mktime(00, 01, 00, @date("n"), 1, @date("Y")); $today = time() + 2 * 24 * 60 * 60; $vpslist = $login->loadAllVps(); $vpslist = $login->getList('vps'); if ($vpslist) { foreach ($vpslist as $vps) { $vpst = $vps->getList("vpstraffic"); $list = get_namelist_from_objectlist($vpst); $total[$vps->getClName()] = trafficGetIndividualObjectTotal($vpst, $firstofmonth, $today, $vps->nname); list($month, $year) = get_last_month_and_year(); $last_traffic = VpstrafficHistory::getMonthTotal($vpst, $month, $year, null); if (!isset($sgbl->__var_traffic_last_usage)) { $sgbl->__var_traffic_last_usage = null; } $sgbl->__var_traffic_last_usage[$vps->getClName()] = $last_traffic['traffic_usage']; /* try { $sgbl->__var_backupdisk_usage[$vps->getClName()] = rl_exec_get(null, $vps->syncserver, array("vps", "getBackupDiskSize"), array($vps->nname)); } catch (Exception $e) { $sgbl->__var_backupdisk_usage[$vps->getClName()] = null; } */ } } //dprintr($sgbl->__var_backupdisk_usage); $sgbl->__var_traffic_usage = $total; dprintr($sgbl->__var_traffic_last_usage); }
static function getTrafficMonthly($object, $trafficname, $extra_var) { $tobjectlist = $object->getList($trafficname); if (!$tobjectlist) { return null; } $list1 = get_namelist_from_objectlist($tobjectlist); $list = lx_array_keys($list1); list(, $start, ) = explode(':', $list[0]); $count = count($list); list(, , $end) = explode(':', $list[$count - 1]); $smonth = @strftime("%m", $start); $emonth = @strftime("%m", $end); $name = $object->nname; $month = @date("n"); $year = @date("Y"); $count = 0; while ($count < 13) { $totallist[] = self::getMonthTotal($tobjectlist, $month, $year, $extra_var); if ($month == 1) { $month = 12; $year--; } else { $month--; } $count++; } return $totallist; }
static function getTrafficMonthly($object, $trafficname, $extra_var) { $tobjectlist = $object->getList($trafficname); if (!$tobjectlist) { return null; } $list1 = get_namelist_from_objectlist($tobjectlist); $list = lx_array_keys($list1); list(, $start, ) = explode(':', $list[0]); $count = count($list); list(, , $end) = explode(':', $list[$count - 1]); $smonth = @strftime("%m", $start); $emonth = @strftime("%m", $end); $name = $object->nname; $thmonth = @date("n"); $year = @date("Y"); $count = 0; for ($i = $thmonth; $i != $thmonth + 1;) { $count++; if ($count > 14) { break; } $totallist[] = self::getMonthTotal($tobjectlist, $i, $year, $extra_var); if ($i == 1) { $i = 13; $year = $year - 1; } $i--; } return $totallist; }
function getExtraP($class, $list) { $res = rl_exec_get(null, $this->nname, array("dirlocation__linux", "getSizeForAll"), array(get_namelist_from_objectlist($list))); foreach ($res as $k => $v) { $list[$k]->diskfree = $v; } return $list; }
static function get_slave_list() { global $gbl, $sgbl, $login, $ghtml; $list = $login->getList('pserver'); $list = get_namelist_from_objectlist($list); $list = add_disabled($list); return $list; }
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 addform($parent, $class, $typetd = null) { if ($parent->isClient()) { $list = get_namelist_from_objectlist($parent->getList('domain')); $vv = array('var' => 'real_clparent_f', 'val' => array('s', $list)); $vlist['nname'] = array('m', array('posttext' => "@", 'postvar' => $vv)); } else { $vlist['nname'] = array('m', array('posttext' => "@{$parent->nname}")); } if ($typetd['val'] === 'alias') { $mlist = get_namelist_from_objectlist($parent->getList('mailaccount')); $vlist['forwardaddress'] = array('s', $mlist); } else { $vlist['forwardaddress'] = null; } $ret['variable'] = $vlist; $ret['action'] = 'add'; return $ret; }
static function addform($parent, $class, $typetd = null) { global $gbl, $sgbl, $login, $ghtml; if ($login->isAdmin()) { $vlist['__m_message_pre'] = "ftpuser_admin"; } $char = "@"; $dlist = get_namelist_from_objectlist($parent->getList('domain')); if ($login->isAdmin()) { $dlist = lx_array_merge(array(array("--direct--"), $dlist)); } $vv = array('var' => 'complete_name_f', 'val' => array('s', $dlist)); $vlist['nname'] = array('m', array('posttext' => "{$char}", 'postvar' => $vv)); $vlist['password'] = ""; $vlist['directory'] = array('L', array('pretext' => "/home/{$parent->nname}/")); $vlist['ftp_disk_usage'] = null; $ret['variable'] = $vlist; $ret['action'] = "add"; return $ret; }
function updateform($subaction, $param) { global $gbl, $sgbl, $login, $ghtml; $driverapp = $gbl->getSyncClass($this->__masterserver, $this->__readserver, 'web'); /* if ($this->getParentO()->is__table('ipaddress')) { $vlist['__m_message_pre'] = 'sslipaddress_updateform_update_pre_ipaddress'; } else { $vlist['__m_message_pre'] = 'sslipaddress_updateform_update_pre_client'; } */ $clientparent = $this->getRealClientParentO(); $list = $clientparent->getList('sslcert'); $certlist = get_namelist_from_objectlist($list, 'nname'); if ($certlist) { $vlist['sslcert'] = array('s', $certlist); } else { $vlist['sslcert'] = array('M', "Default Kloxo Certificate. Please Upload Your Own."); $vlist['__v_button'] = array(); } return $vlist; }
static function continueFormClientFinish($parent, $class, $param, $continueaction) { $weblist = explode(',', $param['listpriv_s_webpserver_list']); //$vlist['dbtype_list'] = null; $vlist['ipaddress_list'] = array('Q', $parent->getIpaddress($weblist)); if (!isOn($param['priv_s_dns_manage_flag'])) { $dlist = $parent->getList('dnstemplate'); $nlist = get_namelist_from_objectlist($dlist); $vlist['dnstemplate_list'] = array('U', $nlist); } $ret['action'] = 'add'; $ret['variable'] = $vlist; $ret['param'] = $param; return $ret; }
function getAllContactEmail() { $list = $this->getList('emailalert'); $nlist = get_namelist_from_objectlist($list, 'nname', 'emailid'); $email = $this->contactemail; if ($nlist) { $total = implode(",", $nlist); $email = "{$email},{$total}"; } return $email; }
public function setDhCP() { if (!$this->main->isWindows()) { return; } $this->main->iplist = get_namelist_from_objectlist($this->main->vmipaddress_a); $res = merge_array_object_not_deleted($this->main->__var_win_iplist, $this->main); dhcp__dhcpd::createDhcpConfFile($res); }
static function addform($parent, $class, $typetd = null) { if ($parent->isClient()) { $list = get_namelist_from_objectlist($parent->getList('domain')); $vv = array('var' => 'real_clparent_f', 'val' => array('s', $list)); $vlist['nname'] = array('m', array('posttext' => "@", 'postvar' => $vv)); } else { $vlist['nname'] = array('m', array('posttext' => "@{$parent->nname}")); } $vlist['password'] = ""; $qvlist = getQuotaListForClass('mailaccount', array()); $vlist = lx_array_merge(array($vlist, $qvlist)); $ret['variable'] = $vlist; $ret['action'] = "add"; return $ret; }
static function getSelectList($parent, $var) { global $gbl, $sgbl, $login, $ghtml; switch ($var) { case "cttype": return array("customer", "reseller"); case "ipaddresslist": $iplist = $parent->getIpaddress(); $iplist = null; if (!$iplist) { //dprintr($parent->__parent_o); throw new lxException("no_ipaddress", 'ipaddresslist'); } return $iplist; case "template": $ol = $login->getList("clienttemplate"); if (!$ol) { throw new lxException("no_template", 'template'); } $onl = get_namelist_from_objectlist($ol); return $onl; } }
function updateform($subaction, $param) { global $gbl, $sgbl, $login, $ghtml; $progname = $sgbl->__var_program_name; switch ($subaction) { case "skin": // ACtually the skin_color list should be dependent on the skin_name, // but currently just reading the current skin directory itself. // So all the skins should have the same color sets, which is not very practical, // so this should be changed in the future. if (!$this->getParentO()->isLogin() || $this->isClass('sp_childspecialplay')) { $vlist['specialplay_b-dont_show_disabled_permission'] = null; } $vlist['specialplay_b-enable_ajax'] = null; $vlist['specialplay_b-simple_skin'] = null; if ($this->specialplay_b->skin_name === 'feather') { $vlist['specialplay_b-show_thin_header'] = null; } $vlist['specialplay_b-close_add_form'] = null; if (!$this->isAdmin()) { $list = get_namelist_from_objectlist($login->getList('interface_template')); $list = lx_array_merge(array(array("--{$progname}-default--"), $list)); } //$vlist['specialplay_b-interface_template'] = array('s', $list); $vlist['specialplay_b-skin_name'] = array('s', lscandir_without_dot(getreal("/img/skin/{$progname}"))); $vlist['specialplay_b-skin_color'] = array('s', lscandir_without_dot(getreal("/img/skin/{$progname}/" . $this->specialplay_b->skin_name))); // DT #799 - Scan also the dir for new iconsets. $vlist['specialplay_b-icon_name'] = array('s', lscandir_without_dot(getreal("/img/image"))); $vlist['specialplay_b-language'] = array('A', $this->getLanguage()); //$vlist['specialplay_b-login_page'] =array('s', $this->getParentO()->getLoginTo()); //$vlist['specialplay_b-split_frame'] = null; //$vlist['specialplay_b-show_help'] =null; if ($this->getParentO()->isLte('reseller') && $sgbl->isKloxo()) { $vlist['specialplay_b-customermode_flag'] = null; } //$vlist['specialplay_b-disable_quickaction'] = null; if (!$this->getParentO()->isLogin()) { $vlist['specialplay_b-logo_image'] = null; $vlist['specialplay_b-logo_image_loading'] = null; } /* if ($sgbl->isKloxo()) { if (!$this->getParentO()->isLogin()) { $vlist['specialplay_b-disable_docroot'] = null; } } */ //$vlist['specialplay_b_s_show_add_buttons'] =null; //$vlist['specialplay_b-lpanel_scrollbar'] = null; //$vlist['specialplay_b-resource_bottom'] =null; //$vlist['specialplay_b_s_show_brethren_list'] = array('s', array('off', 'top', 'left')); //$vlist['specialplay_b_s_lpanel_group_resource'] =null; //$vlist['specialplay_b_s_ultra_navig'] =null; //$vlist['specialplay_b-lpanel_depth'] = null; $vlist['__v_updateall_button'] = array(); //$vlist['specialplay_b_s_per_page'] = null; return $vlist; case "upload_logo": if ($login->priv->isOn('logo_manage_flag')) { // $vlist['specialplay_b-logo_image'] =array('I', array("width" => 20, "height" => 20, "value" => $this->specialplay_b->logo_image)); // trick use 'null' for guarantee 100% size of img (not 100% size div container) $vlist['specialplay_b-logo_image'] = array('I', array("width" => "null", "height" => "null", "value" => "/img/user-logo.png")); $vlist['logo_image_f'] = null; // $vlist['specialplay_b-logo_image_loading'] =array('I', array("width" => 20, "height" => 20, "value" => $this->specialplay_b->logo_image_loading)); // $vlist['logo_image_loading_f'] = null; } return $vlist; case "login_options": if ($login->isAdmin()) { $gen = $login->getObject('general')->generalmisc_b; $this->specialplay_b->disableipcheck = $gen->disableipcheck; $vlist['specialplay_b-disableipcheck'] = null; } $vlist['specialplay_b-ssession_timeout'] = null; return $vlist; case "demo_status": $vlist['specialplay_b-demo_status'] = null; return $vlist; } }
static function addform($parent, $class, $typetd = null) { global $gbl, $sgbl, $login, $ghtml; $revc = $login->getObject('general')->reversedns_b; $res = get_namelist_from_objectlist($parent->vmipaddress_a); if (!$res) { throw new lxexception('no_ip_address', 'parent'); } $vlist['nname'] = null; $vlist['webipaddress'] = array('s', $res); $vlist['mmailipaddress'] = array('s', $res); $vlist['nameserver_f'] = array('M', $revc->primarydns); $vlist['secnameserver_f'] = array('M', $revc->secondarydns); $ret['action'] = 'add'; $ret['variable'] = $vlist; return $ret; }
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); }
function print_quick_action($class) { global $gbl, $sgbl, $login, $ghtml; $iconpath = get_image_path() . "/button/"; if ($class === 'self') { $object = $login; $class = $login->getClass(); } else { $list = $login->getVirtualList($class, $count); $object = getFirstFromList($list); } if (!$object) { return "No Object"; } $namelist = get_namelist_from_objectlist($list); $alist = get_quick_action_list($object); foreach ($alist as $a) { $ac_descr = $ghtml->getActionDetails($a, null, $iconpath, $path, $post, $_t_file, $_t_name, $_t_image, $__t_identity); } $stylestr = "style=\"font-size: 10px\""; $res = null; $res .= " <tr style=\"background:#d6dff7\"> <td ><form name=quickaction method={$sgbl->method} target=mainframe action=\"/htmllib/lbin/redirect.php\">"; $desc = $ghtml->get_class_description($class); //$res .= "$desc[2] <br> "; if (!$object->isLogin()) { $res .= "<select {$stylestr} name=frm_redirectname>"; foreach ($namelist as $l) { $pl = substr($l, 0, 26); $res .= "<option {$stylestr} value={$l}> {$pl} </option>"; } $res .= "</select> </td> </tr> "; } $res .= " <tr style=\"background:#d6dff7\"> <td ><select {$stylestr} name=frm_redirectaction>"; foreach ($alist as $k => $a) { if (csb($k, "__title")) { $res .= "<option value=>------{$a}----</option>"; continue; } $ac_descr = $ghtml->getActionDetails($a, null, $iconpath, $path, $post, $_t_file, $_t_name, $_t_image, $__t_identity); $a = base64_encode($a); //$res .= "<option value=$a style='background-image: url($_t_image); background-repeat:no-repeat; left-padding: 35px; text-align:right'> $ac_descr[2] </option>"; $desc = substr($ac_descr[2], 0, 20); $res .= "<option {$stylestr} value={$a}> {$desc} </option>"; } $res .= "</select> </td> </tr> "; $res .= "</form> <tr > <td align=right> <a href=javascript:quickaction.submit() > Go </a> </td> </tr> "; return $res; }
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; 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; case "kloxo_config": $vlist['kloxoconfig_b-remoteinstall_flag'] = null; $vlist['kloxoconfig_b-installapp_url'] = null; return $vlist; 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-redirectnonssl_flag'] = null; return $vlist; case "download_config": $vlist['generalmisc_b-masterdownload'] = null; return $vlist; 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; case "generalsetting": $vlist['generalmisc_b-autoupdate'] = null; 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; $vlist['generalmisc_b-htmltitle'] = null; $vlist['generalmisc_b-ticket_url'] = null; $vlist['login_pre'] = null; break; case "hostdiscovery": $vlist['generalmisc_b-usenmapforping'] = null; break; case "reversedns": if (!$this->reversedns_b) { $this->reversedns_b = new reversedns_b(null, null, 'general'); } $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', '***'); break; case "hackbuttonconfig": $vlist['hackbuttonconfig_b-nobackup'] = null; $vlist['hackbuttonconfig_b-nomonitor'] = null; break; case "session_config": $vlist['generalmisc_b-disableipcheck'] = null; break; } return $vlist; }
static function addform($parent, $class, $typetd = null) { global $gbl, $sgbl, $login, $ghtml; if ($parent->get__table() === 'client') { $tag['key'] = "--all_children--"; $tag['val'] = "-----Children"; $list = $parent->getAllChildrenAndParents($tag); } $gen = $login->getObject('general'); $cat = get_namelist_from_objectlist($gen->helpdeskcategory_a); $vlist['made_by'] = array('M', $parent->nname); if ($parent->get__table() === 'client') { $vlist['sent_to'] = array('A', $list); } else { $vlist['sent_to'] = array('M', $parent->getParentO()->nname); } if (!$cat) { $cat = array("billing"); } $vlist['category'] = array('s', $cat); $vlist['subject'] = null; //$vlist['priority'] = array('s', array('low', 'medium', 'high', 'urgent')); $vlist['descr_f'] = null; if ($sgbl->isLxlabsClient()) { $vlist['__m_message_pre'] = "lxlabsclient_ticket_forum"; } $ret['variable'] = $vlist; $ret['action'] = 'add'; return $ret; }
function getCommandResource($resource) { global $gbl, $sgbl, $login, $ghtml; $ret = null; switch ($resource) { case "ostemplate_xen": return vps::getVpsOsimage($login, "xen"); case "ostemplate_openvz": return vps::getVpsOsimage($login, "openvz"); case "vpspserver": $lx = $this->getVpsServers('xen'); $lo = $this->getVpsServers('openvz'); $ret = lx_merge_good($lx, $lo); $ret = convert_to_associate($ret); break; case "vpspserver_xen": $ret = $this->getVpsServers("xen"); $ret = convert_to_associate($ret); break; case "vpspserver_openvz": $ret = $this->getVpsServers("openvz"); $ret = convert_to_associate($ret); break; case "dnstemplate": $ret = domainBase::getDnsTemplateList($this); $ret = convert_to_associate($ret); break; case "resourceplan": $list = $this->getList('resourceplan'); $ret = get_namelist_from_objectlist($list, 'nname', 'realname'); break; } return $ret; }
function __get($var) { global $gbl, $sgbl, $login, $ghtml; if (!isset($this->__parent_o)) { return null; } $parent = $this->__parent_o; if (!$parent || !$parent->isAdmin()) { return null; } if (cse($var, 'pserver_list')) { $slist = $parent->getRealPserverList(strtil($var, "pserver_list")); $this->{$var} = get_namelist_from_objectlist($slist); return $this->{$var}; } if (cse($var, 'dnstemplate_list')) { $this->{$var} = DomainBase::getDnsTemplateList($parent); return $this->{$var}; } if (cse($var, 'dbtype_list')) { return $sgbl->__var_dblist; } return null; }
function findtraffic($weblist, $mmaillist, $globaldomlist, $oldtime, $newtime) { global $gbl, $login, $ghtml; $web_usage = null; $gen = $login->getObject('general')->generalmisc_b; $webstatsprog = $gen->webstatisticsprogram; if (!$webstatsprog) { $webstatsprog = "awstats"; } foreach ($weblist as $k => $dlist) { $list = null; foreach ($dlist as $d) { $rt = new Remote(); $rt->iisid = $d->getObject('web')->iisid; $rt->nname = $d->nname; $rt->customer_name = $d->getRealClientParentO()->getPathFromName('nname'); $rt->priv = new Priv(null, null, $d->nname); $rt->priv->awstats_flag = $d->priv->awstats_flag; $rt->stats_username = $d->getObject('web')->stats_username; $rt->stats_password = $d->getObject('web')->stats_password; $rt->remove_processed_stats = $d->getObject('web')->remove_processed_stats; $list[$d->nname] = $rt; } $driverapp = $gbl->getSyncClass(null, $k, 'web'); $web_usaget = rl_exec_get(null, $k, array("webtraffic", 'findTotaltrafficwebUsage'), array($driverapp, $webstatsprog, $list, $oldtime, $newtime)); $web_usage = lx_array_merge(array($web_usage, $web_usaget)); } foreach ($mmaillist as $k => $m) { $mlist = get_namelist_from_objectlist($m); $driverapp = $gbl->getSyncClass(null, $k, 'mmail'); $mailusaget = rl_exec_get(null, $k, array("mailtraffic", 'findTotalmailQuota'), array($driverapp, $mlist, $oldtime, $newtime)); $mailusage = lx_array_merge(array($mailusaget, $mailusage)); } try { foreach ($weblist as $k => $w) { $wlist = get_namelist_from_objectlist($w); $driverapp = $gbl->getSyncClass(null, $k, 'ftpuser'); $ftpusaget = rl_exec_get(null, $k, array("ftpusertraffic__{$driverapp}", 'findTotalQuota'), array($wlist, $oldtime, $newtime)); $ftpusage = lx_array_merge(array($ftpusaget, $ftpusage)); } } catch (exception $e) { print $e->getMessage() . "\n"; } //dprintr($web_usage); //dprintr($mailusage); //dprintr($ftpusage); $res = ""; foreach ($globaldomlist as $d) { $res['nname'] = "{$d->nname}:{$oldtime}:{$newtime}"; $domt = new Domaintraffic(null, null, $res['nname']); $res['ddate'] = time(); $res['timestamp'] = strftime("%c", $newtime); $res['oldtimestamp'] = strftime("%c", $oldtime); $res['comment'] = null; $res['parent_list'] = null; $res['parent_clname'] = $d->getClName(); $res['webtraffic_usage'] = $web_usage[$d->nname]; $res['mailtraffic_usage'] = $mailusage[$d->nname]; $res['ftptraffic_usage'] = $ftpusage[$d->nname]; $res['traffic_usage'] = $res['ftptraffic_usage'] + $res['webtraffic_usage'] + $res['mailtraffic_usage']; // print_r($res); $domt->create($res); $domt->was(); } }
function updateform($subaction, $param) { global $gbl, $sgbl, $login, $ghtml; $driverapp = $gbl->getSyncClass(null, $this->__readserver, 'web'); switch ($subaction) { case "run_stats": $vlist['confirm_f'] = array('M', ""); $vlist['__v_updateall_button'] = array(); return $vlist; case "sesubmit": include "sesubmit/engines.php"; $selist = array_keys($enginelist); $selist = implode("\n", $selist); $selist = "\n{$selist}"; $vlist['nname'] = array('M', $this->nname); $vlist['email'] = null; $vlist['selist'] = array('M', $selist); return $vlist; case "docroot": $vlist['docroot'] = null; return $vlist; case "blockip": $vlist['text_blockip'] = null; $vlist['__v_updateall_button'] = array(); return $vlist; case "fcgi_config": $vlist['fcgi_children'] = null; $vlist['__v_updateall_button'] = array(); return $vlist; case "statsconfig": $vlist['remove_processed_stats'] = null; $vlist['__v_updateall_button'] = array(); return $vlist; case "hotlink_protection": $vlist['hotlink_flag'] = null; $vlist['text_hotlink_allowed'] = array("t", null); $vlist['hotlink_redirect'] = array("L", "/"); $vlist['__v_updateall_button'] = array(); return $vlist; case "permalink": $list = lscandir_without_dot_or_underscore("../file/prettyurl/"); $vlist['lighty_pretty_app_f'] = array('s', $list); $vlist['lighty_pretty_path_f'] = null; return $vlist; case "lighty_rewrite": $vlist['text_lighty_rewrite'] = null; $vlist['__v_updateall_button'] = array(); return $vlist; case "stats_protect": if ($this->stats_username === $this->nname) { $vlist['stats_username'] = array('M', $this->stats_username); } else { $vlist['stats_username'] = null; } $vlist['stats_password'] = null; $vlist['__v_updateall_button'] = array(); return $vlist; case "cron_mailto": $vlist['cron_mailto'] = null; return $vlist; case "configure_misc": $vlist['force_www_redirect'] = null; if ($driverapp === 'apache') { $vlist['webmisc_b-execcgi'] = null; if ($login->isAdmin()) { $vlist['webmisc_b-disable_openbasedir'] = null; } } $vlist['__v_updateall_button'] = array(); return $vlist; case "dirindex": $vlist['webmisc_b-dirindex'] = null; if (!$this->indexfile_list) { //$this->indexfile_list = get_web_index_list(); } $ol = array("index.php", "index.html", "index.shtml", "index.htm", "default.htm", "Default.aspx", "Default.asp", "index.pl"); $dirin = $login->getObject('genlist')->dirindexlist_a; $list = get_namelist_from_objectlist($dirin); $index = lx_array_merge(array($list, $ol)); $vlist['indexfile_list'] = array('U', $index); $vlist['__v_updateall_button'] = array(); return $vlist; case "extra_tag": $vlist['text_extra_tag'] = null; return $vlist; case "custom_error": if ($driverapp !== 'lighttpd') { $vlist['customerror_b_s_url_400'] = array("L", "/"); $vlist['customerror_b_s_url_401'] = array("L", "/"); $vlist['customerror_b_s_url_403'] = array("L", "/"); $vlist['customerror_b_s_url_500'] = array("L", "/"); } $vlist['customerror_b_s_url_404'] = array("L", "/"); $vlist['__v_updateall_button'] = array(); return $vlist; case "ssl_upload": $vlist['ssl_key_file_f'] = null; $vlist['ssl_crt_file_f'] = null; return $vlist; case "ipaddress": if ($this->getParentO()->isLogin()) { $vlist['ipaddress'] = array('M', $this->ipaddress); return $vlist; } //Just parent is domain.. The client is above that... $parent = $this->getParentO()->getParentO(); $iplist = $parent->getIpaddress(array($this->syncserver)); if (!$iplist) { //dprintr($parent->__parent_o); $iplist = getAllIpaddress(); } $vlist['ipaddress'] = array('s', $iplist); return $vlist; } return parent::updateform($subaction, $param); }
function display($var) { if ($var === 'blocked') { $wht = $this->getParentO()->getList('lxguardwhitelist'); $wht = get_namelist_from_objectlist($wht, "ipaddress"); if (array_search_bool($this->ipaddress, $wht)) { return "whitelisted"; } $ds = $this->getParentO()->disablehit; if (!$ds) { $ds = 20; } if ($this->failcount >= $ds) { return "blocked"; } return null; } return $this->{$var}; }
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; }
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; }
static function getLeastId($parent, $devname) { global $gbl, $sgbl, $login, $ghtml; print " this is the devname u passed -{$devname} "; // I have removed the sorting from getlist, and here earlier, the result was sorted according to 'nname'. this is needed only when you add a new device, so ignoring now. $list1 = $parent->getList("ipaddress"); $llist = get_namelist_from_objectlist($list1, "devname"); dprintr($llist); for ($i = 0; $i < 1000000; $i++) { $name = "{$devname}:{$i}"; if (!array_search_bool($name, $llist)) { return "{$devname}-{$i}"; } } }
function getToArray($object) { $col = $this->getColumnTypes(); //dprint_r($array); foreach ($col as $key => $val) { if (csb($key, "coma_")) { $cvar = substr($key, 5); $value = $object->{$cvar}; if (cse($key, "_list")) { $namelist = $value; } else { $namelist = get_namelist_from_objectlist($value); } $ret[$key] = implode(",", $namelist); dprint("in COma {$key} {$ret[$key]}<br> "); $ret[$key] = ",{$ret[$key]},"; } else { if (csb($key, "ser_")) { $cvar = substr($key, 4); $value = $object->{$cvar}; if ($value && isset($value->driverApp)) { unset($value->driverApp); } if (cse($key, "_a")) { if ($value) { foreach ($value as $kk => $vv) { unset($value[$kk]->__parent_o); } } } $ret[$key] = base64_encode(serialize($object->{$cvar})); //$ret[$key] = serialize($object->$cvar); } else { if (csb($key, "priv_q_") || csb($key, "used_q_")) { $qob = strtil($key, "_q_"); $qkey = strfrom($key, "_q_"); if ($object->get__table() === 'uuser') { } $ret[$key] = $object->{$qob}->{$qkey}; } else { if (!isset($object->{$key})) { $object->{$key} = null; } if (csb($key, "text_")) { $string = str_replace("\\", '\\\\', $object->{$key}); } else { $string = $object->{$key}; } $ret[$key] = str_replace("'", "\\'", $string); //$ret[$key] = $object->$key; } } } } return $ret; }
function updateform($subaction, $param) { global $gbl, $sgbl, $login, $ghtml; $parent = $this->getParentO(); switch ($subaction) { case "copyplan": $clist = get_namelist_from_objectlist($parent->getList('client')); $clist[] = $parent->nname; $vlist['copy_clientname_f'] = array('s', $clist); $vlist['realname_f'] = array('m', $this->realname); return $vlist; case "account": $total = $this->getAccountList(); $total = lx_array_merge($total); $vlist['account'] = array('M', implode(" ", $total)); $vlist['__v_button'] = array(); return $vlist; case "limit_s": case "limit": $vlist = getQuotaListForClass('client'); $vlist['__m_message_pre'] = "resourceplan_change_pre"; // This is patently wrong. In update, the object is inititialized properly and we are suppsed to get the quota for the specific type of object and not for the class.... Changing it to $this. $sgbl->method = 'post'; return $vlist; case "dnstemplatelist": $parent = $this->getParentO(); $nlist = domainBase::getDnsTemplateList($parent); $vlist['dnstemplate_list'] = array('U', $nlist); return $vlist; case "pserver_s": $parent = $this->getParentO(); $list = null; $serverlist = client::getPserverListPriv(); if ($this->isLogin() || !$this->isRightParent()) { foreach ($serverlist as $s) { $slist = "{$s}_list"; $vlist["{$s}_list"] = array('M', $this->listpriv->{$slist}); } $vlist['__v_button'] = array(); //$vlist['dbtype_list'] = array('M', $this->listpriv->dbtype_list); return $vlist; } else { $vlist['server_detail_f'] = null; foreach ($serverlist as $s) { $slist = "{$s}_list"; $vlist["{$s}_list"] = null; if ($parent->isAdmin()) { $plist = $parent->getServerList(strtilfirst($s, "pserver")); } else { $plist = $parent->listpriv->{$slist}; } if ($parent->isAdmin()) { unset($parent->listpriv->{$slist}); } $list = lx_array_merge(array($list, $plist)); } $vlist['server_detail_f'] = array('M', pservercore::createServerInfo($list)); //$vlist['dbtype_list'] = null; return $vlist; } case "ipaddress": dprintr($this->listpriv->ipaddress_list); $parent = $this->getParentO(); if ($this->isLogin() || !$this->isRightParent()) { $vlist['ipaddress_list'] = array('M', $this->getIpaddress($this->listpriv->webpserver_list)); $vlist['__v_button'] = array(); } else { if (check_if_many_server()) { dprintr($this->listpriv->webpserver_list); $iplist = $parent->getIpaddress($this->listpriv->webpserver_list); } else { $iplist = $parent->getIpaddress(array('localhost')); } dprintr($iplist); $vlist['ipaddress_list'] = array('Q', $iplist); } return $vlist; case "description": if ($this->islogin()) { throw new lxException('you_cannot_set_your_own_limit', ''); } $vlist['disable_per'] = array('s', array('off', '95', '100', '110', '120', '130')); if ($sgbl->isHyperVm() && $sgbl->isDebug()) { //$vlist['centralbackup_flag'] = null; } $vlist['description'] = null; //$vlist['share_status'] = null; if (!$this->isRightParent()) { $this->convertToUnmodifiable($vlist); } return $vlist; case "changerealname": $vlist['realname'] = null; return $vlist; case "ostemplatelist": getResourceOstemplate($vlist); return $vlist; } return parent::updateform($subaction, $param); }