static function readsmtpLog() { $date = time() - 24 * 3600 * 2; $logfile = "/var/log/kloxo/smtp.log"; $fp = fopen($logfile, "r"); $fsize = lxfile_size($logfile); $pos = lxlabsFindRightPosition($fp, $fsize, $date, time()); if ($pos === -1) { return; } $s = fgets($fp); dprint("The correct pos here: {$s}\n"); while (!feof($fp)) { $s = fgets($fp); $s = trim($s); if (!csa($s, "client allowed to relay")) { continue; } $v = strfrom($s, "rcpt: from <"); $v = strtilfirst($v, ">"); $s = explode(":", $v); $id = $s[1]; if (!isset($total[$id])) { $total[$id] = 1; } else { $total[$id]++; } } return $total; }
function updateSwitchProgram($param) { global $gbl, $sgbl, $login, $ghtml; if_demo_throw_exception('switchprog'); $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'); $a['web'] = $this->web_driver; $a['dns'] = $this->dns_driver; $a['spam'] = $this->spam_driver; foreach ($param as $k => $v) { if ($this->{$k} === $v) { dprint("No change for {$k}: {$v}\n"); } else { $class = strtilfirst($k, "_"); $drstring = "{$class}_driver"; rl_exec_get(null, $this->nname, array($class, 'switchDriver'), array($class, $this->{$drstring}, $v)); changeDriver($this->nname, $class, $v); $fixc = $class; if ($class === 'spam') { $fixc = "mmail"; } lxshell_return("__path_php_path", "../bin/fix/fix{$fixc}.php", "--server={$this->nname}"); $a[$class] = $v; rl_exec_get(null, $this->nname, 'slave_save_db', array('driver', $a)); } } }
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 readProcessList() { $list = lscandir("/proc"); foreach ($list as $pid) { if (is_numeric($pid) && $pid[0] != ".") { $cmdlinearr = lfile("/proc/" . $pid . "/cmdline"); $return[$pid]['nname'] = $pid; if (!$cmdlinearr) { unset($return[$pid]); continue; } $cmdline = $cmdlinearr[0]; $cmdline = preg_replace('+\\0+i', " ", $cmdline); $return[$pid]["command"] = substr($cmdline, 0, 100); if (csa($cmdline, "display.php") && csa($cmdline, "kloxo")) { unset($return[$pid]); continue; } $arr = lfile("/proc/" . $return[$pid]["nname"] . "/status"); foreach ($arr as $a) { if (csb($a, "State:")) { $a = trim($a); $a = strtil($a, "("); $a = strfrom($a, "State:"); $a = trim($a); $return[$pid]["state"] = $a; $return[$pid]["state"] = $return[$pid]["state"] === "S" ? "ZZ" : $return[$pid]["state"]; } if (csa($a, "Uid")) { $uidarr = explode(":", $a); $value = trimSpaces($uidarr[1]); $uidarr2 = explode(" ", $value); $uid = trim($uidarr2[1]); $pwd = posix_getpwuid($uid); $username = $pwd['name']; $return[$pid]["username"] = $username; } if (csa($a, "VmSize")) { $uidarr = explode(":", $a); $uidarr = trimSpaces($uidarr[1]); $uidarr = strtilfirst($uidarr, " "); $return[$pid]['memory'] = round($uidarr / 1024, 2); } } } } return $return; }
function getId() { return strtilfirst($this->nname, "___"); }
$type = array_shift($s); foreach ($s as $ss) { $res[$ss] = $type; } } return $res; } $res = parse_etc_mime(); $request = $_SERVER['REQUEST_URI']; if (!csa($request, "sitepreview/")) { header("HTTP/1.0 404 Not Found"); print "404--- <br> "; exit; } $request = strfrom($request, "sitepreview/"); $domain = strtilfirst($request, "/"); dprint($domain); $sq = new Sqlite(null, 'web'); $res = $sq->getRowsWhere("nname = '{$domain}'"); if (!$res) { print "Domain Doesn't exist\n"; exit; } $server = $res[0]['syncserver']; $ip = getOneIPForServer($server); rl_exec_get(null, 'localhost', 'addtoEtcHost', array($domain, $ip)); $file = curl_general_get("http://{$request}"); $pinfo = pathinfo($request); $ext = $pinfo['extension']; if (isset($res[$ext]) && $res[$ext] !== 'text/html' && $res[$ext] !== 'text/css') { header("Content-Type {$res[$ext]}");
public function setInternalParam($mountpoint) { $name = $this->main->ostemplate; if ($this->main->isWindows()) { return; } if (!$mountpoint) { return; } if ($name === 'unknown') { return; } $name = strtolower($name); $mountpoint = expand_real_root($mountpoint); $result = $this->getScriptS($name); dprint("Distro Name {$name}, Scripts: \n"); dprintr($result); $init = strtilfirst($name, "-"); dprint("File is {$init}.inittab\n"); if (lxfile_exists("../file/sysfile/inittab/{$init}.inittab")) { dprint("Copying {$init}.inittab\n"); $content = lfile_get_contents("../file/sysfile/inittab/{$init}.inittab"); if ($this->main->text_inittab) { $content .= "\n{$this->main->text_inittab}"; } lfile_put_contents("{$mountpoint}/etc/inittab", $content); } $iplist = get_namelist_from_objectlist($this->main->vmipaddress_a); if ($this->main->mainipaddress) { $main_ip = $this->main->mainipaddress; $iplist = array_remove($iplist, $main_ip); } else { $main_ip = array_shift($iplist); } if ($this->main->networknetmask) { $main_netmask = $this->main->networknetmask; } else { $main_netmask = "255.255.255.0"; } $iplist = implode(" ", $iplist); $ipadd = $result['ADD_IP']; $sethostname = $result['SET_HOSTNAME']; $setuserpass = $result['SET_USERPASS']; $ipdel = $result['DEL_IP']; if ($this->main->networkgateway) { $gw = $this->main->networkgateway; } else { $gw = os_get_network_gateway(); } $gwn = strtil($gw, '.') . '.0'; $hostname = $this->main->hostname; if (!$hostname) { $hostname = os_get_hostname(); } if ($result['STARTUP_SCRIPT'] != 'systemd') { $name = createTempDir("{$mountpoint}/tmp", 'xen-scripts'); lxfile_cp_rec("__path_program_root/bin/xen-dists/scripts/functions", $name); lxfile_cp_rec("__path_program_root/bin/xen-dists/scripts/{$ipadd}", $name); lxfile_cp_rec("__path_program_root/bin/xen-dists/scripts/{$sethostname}", $name); lxfile_cp_rec("__path_program_root/bin/xen-dists/scripts/{$setuserpass}", $name); lxfile_cp_rec("__path_program_root/bin/xen-dists/scripts/{$ipdel}", $name); $basepath = strfrom($name, $mountpoint); lfile_put_contents("{$name}/tmpfile.sh", "source /{$basepath}/functions\nsource /{$basepath}/{$ipdel}\n"); $delipstring = "IPDELALL=yes chroot {$mountpoint} bash /{$basepath}/tmpfile.sh"; log_shell($delipstring); log_shell(system($delipstring, $ret1) . ":return {$ret1}"); putenv("VE_STATE=stopped"); lfile_put_contents("{$name}/tmpfile.sh", "source /{$basepath}/functions\n source /{$basepath}/{$ipadd}\n"); $string = "IPDELALL=yes MAIN_NETMASK={$main_netmask} MAIN_IP_ADDRESS={$main_ip} IP_ADDR=\"{$iplist}\" NETWORK_GATEWAY={$gw} NETWORK_GATEWAY_NET={$gwn} chroot {$mountpoint} bash /{$basepath}/tmpfile.sh"; log_shell($string); log_shell(system($string, $ret1) . ":return {$ret1}"); lfile_put_contents("{$name}/tmpfile.sh", "source /{$basepath}/functions\n source /{$basepath}/{$sethostname}\n"); $string = "HOSTNM={$hostname} chroot {$mountpoint} bash /{$basepath}/tmpfile.sh"; log_shell($string); log_shell(system($string, $ret1) . ":return {$ret1}"); if ($this->main->subaction === 'rebuild' || $this->main->dbaction === 'add' || $this->main->isOn('__var_rootpassword_changed') && $this->main->rootpassword) { $rootpass = "******"; lfile_put_contents("{$name}/tmpfile.sh", "source /{$basepath}/functions\n source /{$basepath}/{$setuserpass}\n"); $string = "USERPW={$rootpass} chroot {$mountpoint} bash /{$basepath}/tmpfile.sh"; log_shell($string); log_shell(system($string)); } lxfile_rm_rec($name); } else { if ($result['STARTUP_SCRIPT'] == 'systemd') { $script_dir = createTempDir("{$mountpoint}", "hypervm-runonce"); lxfile_cp_rec("__path_program_root/bin/xen-dists/scripts/functions", $script_dir); lxfile_cp_rec("__path_program_root/bin/xen-dists/scripts/{$ipadd}", $script_dir); lxfile_cp_rec("__path_program_root/bin/xen-dists/scripts/{$sethostname}", $script_dir); lxfile_cp_rec("__path_program_root/bin/xen-dists/scripts/{$setuserpass}", $script_dir); lxfile_cp_rec("__path_program_root/bin/xen-dists/scripts/{$ipdel}", $script_dir); $basepath = strfrom($script_dir, $mountpoint); $startupdir = 'lib/systemd/system'; $startupscript = 'fedora-startup.service'; $setrootpass = ''; if ($this->main->subaction === 'rebuild' || $this->main->dbaction === 'add' || $this->main->isOn('__var_rootpassword_changed') && $this->main->rootpassword) { $rootpass = "******"; $setrootpass = "******"; } $run_once_script = "#!/bin/bash\n" . "source {$basepath}/functions\n" . '(' . "IPDELALL=yes source {$basepath}/{$ipdel}" . " & IPDELALL=yes VE_STATE=stopped MAIN_NETMASK={$main_netmask} MAIN_IP_ADDRESS={$main_ip} IP_ADDR=\"{$iplist}\" NETWORK_GATEWAY={$gw} NETWORK_GATEWAY_NET={$gwn} source {$basepath}/{$ipadd}" . " & HOSTNM={$hostname} source {$basepath}/{$sethostname}" . "{$setrootpass})\n" . "service fedora-startup disable\nrm -f /{$startupdir}/{$startupscript}\nrm -rf {$basepath}"; lfile_put_contents("{$script_dir}/hypervm-runonce.sh", $run_once_script); lxfile_cp_rec("__path_program_root/bin/xen-dists/scripts/{$startupscript}", "{$mountpoint}/{$startupdir}"); lfile_put_contents("{$mountpoint}/{$startupdir}/{$startupscript}", lfile_get_contents("{$mountpoint}/{$startupdir}/{$startupscript}") . "ExecStart={$basepath}/hypervm-runonce.sh\n"); system("ln -s /lib/systemd/system/fedora-startup.service {$mountpoint}/etc/systemd/system/multi-user.target.wants/fedora-startup.service"); system("chmod 755 {$script_dir}/hypervm-runonce.sh"); } } if ($this->main->nameserver) { $nlist = explode(" ", $this->main->nameserver); $nstring = null; foreach ($nlist as $l) { $nstring .= "nameserver {$l}\n"; } lfile_put_contents("{$mountpoint}/etc/resolv.conf", $nstring); } if ($this->main->timezone) { lxfile_rm("{$mountpoint}/etc/localtime"); $cmdstring = "ln -sf ../usr/share/zoneinfo/{$this->main->timezone} {$mountpoint}/etc/localtime"; log_log("localtime", $cmdstring); do_exec_system('__system__', "/", $cmdstring, $out, $err, $ret, null); //lxfile_cp("/usr/share/zoneinfo/{$this->main->timezone}", "$mountpoint/etc/localtime"); } lunlink("{$mountpoint}/etc/sysconfig/network-scripts/ifcfg-venet0"); lunlink("{$mountpoint}/etc/sysconfig/network-scripts/ifcfg-venet0:0"); $this->main->doKloxoInit($mountpoint); }
function updateform($subaction, $param) { global $gbl, $sgbl, $login, $ghtml; switch ($subaction) { case "installatron": $vlist['__v_button'] = array(); return $vlist; case "ostemplatelist": getResourceOstemplate($vlist, 'all'); $vlist['__v_updateall_button'] = array(); return $vlist; case "createinvoice_m": $vlist['month'] = null; return $vlist; case "createinvoice_s": $vlist['month'] = array('s', $this->getInvoiceMonthList()); return $vlist; case "search_engine": $vlist['se_url'] = array('M', "http://"); $vlist['se_email'] = null; return $vlist; case "cron_mailto": $vlist['cron_mailto'] = null; return $vlist; case "default_domain": $vlist['default_domain'] = array('s', add_disabled(get_namelist_from_objectlist($this->getList('domain')))); return $vlist; case "shell_access": $res[] = "/bin/bash"; $res[] = "/usr/bin/lxjailshell"; $res = add_disabled($res); $vlist['nname'] = array('M', null); $vlist['disable_system_flag'] = null; $vlist['shell'] = array('s', $res); $vlist['__v_updateall_button'] = array(); return $vlist; case "generate_csr": include "lib/countrycode.inc"; foreach ($gl_country_code as $key => $name) { $temp[$key] = $name; } $s = new sslcert(null, null, null); $this->ssl_data_b = new ssl_data_b(null, null, null); $vlist['contactemail'] = array('M', null); $vlist["ssl_data_b_s_commonName_r"] = null; $vlist["ssl_data_b_s_emailAddress_r"] = null; $vlist["ssl_data_b_s_countryName_r"] = array('A', $temp); $vlist["ssl_data_b_s_stateOrProvinceName_r"] = null; $vlist["ssl_data_b_s_localityName_r"] = null; $vlist["ssl_data_b_s_organizationName_r"] = null; $vlist["ssl_data_b_s_organizationalUnitName_r"] = null; return $vlist; case "domainpserver": if ($this->isAdmin()) { $parent = $this; } else { $parent = $this->getParentO(); } self::getDomainServerVlist($parent, $this, $vlist); return $vlist; case "forcedeletepserver": if_not_admin_complain_and_exit(); $list = get_namelist_from_objectlist($this->getList('pserver')); $vlist['pserver_delete_f'] = array('s', array_remove($list, "localhost")); return $vlist; case "deleteorphanedvps": $sq = new Sqlite(null, 'vps'); $slist = get_namelist_from_objectlist($this->getList('pserver')); $res = $sq->getTable(array('nname', 'syncserver', 'parent_clname')); $list = null; foreach ($res as $r) { if (!array_search_bool($r['syncserver'], $slist)) { $list[$r['nname']] = "{$r['nname']} ({$r['syncserver']}) (orphaned)"; } } if ($list) { $vlist['vps_delete_f'] = array('A', $list); } else { $vlist['vps_delete_f'] = array('M', 'No Orphaned vm'); } return $vlist; case "multivpscreate": $vlist['vps_basename_f'] = null; $vlist['vps_admin_password_f'] = null; $vlist['vps_count_f'] = null; $vlist['vps_template_name_f'] = array('s', get_namelist_from_objectlist($this->getList('vpstemplate'))); return $vlist; case "disable_url": $vlist['disable_url'] = array('m', array('pretext' => 'http://')); return $vlist; case "message": $vlist['wall_from_f'] = array('M', $login->nname); $vlist['send_to_f'] = array('M', $this->nname); $vlist['wall_subject_f'] = null; $vlist['wall_message_f'] = null; $vlist['__v_button'] = 'Send'; return $vlist; case "skeleton": $vlist['skeletonarchive'] = array('M', null); $vlist['skeletonarchive_f'] = null; return $vlist; case "wall": $vlist['wall_from_f'] = array('M', $this->nname); //Can't do this. If he has 10000 client, this itelf will hang the machine. //$vlist['send_to_f'] = array('M', $namlist); $vlist['wall_subject_f'] = null; $vlist['wall_message_f'] = null; $vlist['__v_button'] = 'Send'; return $vlist; case "dnstemplatelist": $parent = $this->getParentO(); $nlist = domain::getDnsTemplateList($parent); $vlist['dnstemplate_list'] = array('U', $nlist); $vlist['__v_updateall_button'] = array(); return $vlist; case "information": $vlist['nname'] = array('M', $this->nname); if ($this->isAdmin()) { $gen = $login->getObject('general'); $this->disable_admin = $gen->disable_admin; $vlist['disable_admin'] = null; } if ($this->isLogin()) { $vlist['cttype'] = array('M', $this->cttype); } else { $parent = $this->getParentO(); $res = null; if (check_if_many_server()) { $ctlist = array('reseller', 'customer', 'wholesale'); } else { $ctlist = array('reseller', 'customer'); } foreach ($ctlist as $v) { if ($parent->isGte($v)) { continue; } $res[] = $v; } if ($res) { $vlist['cttype'] = array('s', $res); } else { $vlist['cttype'] = array('M', $this->cttype); } } $vlist['ddate'] = array('M', @date('d-m-Y', $this->ddate)); if (!$this->isAdmin()) { $vlist['parent_name_f'] = array('M', $this->getParentName()); } $vlist['contactemail'] = ""; if (!$this->isLogin()) { $vlist['text_comment'] = null; } return $vlist; case "license": $lic = $login->getObject('license')->licensecom_b; if ($login->isAdmin()) { $vlist['lic_pserver_num_f'] = array('M', $lic->lic_pserver_num); $vlist['lic_client_num_f'] = array('M', $lic->lic_client_num); $vlist['lic_maindomain_num_f'] = array('M', $lic->lic_maindomain_num); } else { $vlist['lic_node_num_f'] = array('M', $lic->node_num); } $vlist['lic_live_support_f'] = array('M', $lic->lic_live_support); //$vlist['lic_ipaddress_f'] = array('M', $lic->lic_ipaddress); $vlist['lic_client_f'] = array('M', $lic->lic_client); //$vlist['lic_current_f'] = array('t', lfile_get_contents('__path_program_etc/license.txt')); $vlist['license_upload_f'] = null; return $vlist; case "ipaddress": $parent = $this->getParentO(); if ($this->isLogin() || !$this->isRightParent()) { $vlist['ipaddress_list'] = array('M', $this->getIpaddress($this->listpriv->webpserver_list)); $vlist['__v_button'] = array(); } else { if (check_if_many_server()) { dprintr($this->listpriv->webpserver_list); $iplist = $parent->getIpaddress($this->listpriv->webpserver_list); } else { $iplist = $parent->getIpaddress(array('localhost')); } dprintr($iplist); $vlist['ipaddress_list'] = array('Q', $iplist); } return $vlist; case "pserver_s": $parent = $this->getParentO(); $list = null; $serverlist = client::getPserverListPriv(); if ($this->isLogin() || !$this->isRightParent()) { foreach ($serverlist as $s) { $slist = "{$s}_list"; $vlist["{$s}_list"] = array('M', $this->listpriv->{$slist}); } $vlist['__v_button'] = array(); //$vlist['dbtype_list'] = array('M', $this->listpriv->dbtype_list); return $vlist; } else { $vlist['server_detail_f'] = null; foreach ($serverlist as $s) { $slist = "{$s}_list"; // Hack.. Actually, admin's listpriv should be empty so that the __get inside the listpriv will get automatically called. if ($parent->isAdmin()) { unset($parent->listpriv->{$slist}); } $vlist["{$s}_list"] = null; $list = lx_array_merge(array($list, $parent->getServerList(strtilfirst($s, "pserver")))); } $sinfo = pservercore::createServerInfo($list); $sinfo = get_warning_for_server_info($parent, $sinfo); $vlist['server_detail_f'] = array('M', $sinfo); //$vlist['dbtype_list'] = null; return $vlist; } case "description": $vlist['description'] = null; //$vlist['share_status'] = null; if (!$this->isRightParent()) { $this->convertToUnmodifiable($vlist); } return $vlist; } return parent::updateform($subaction, $param); }
function lxlabs_marker_getime($string) { $str = strtilfirst($string, " "); $str = trim($str); return $str; }
function getResourcePlanList($class, $withoutplan = true) { global $gbl, $sgbl, $login, $ghtml; $list[] = $login->getList($class); $list[] = $this->getList($class); $clist = lx_array_merge($list); //$clist = $this->clearGreaterTemplate($clist); $nclist = get_namelist_from_objectlist($clist, 'nname', 'description'); foreach ((array) $nclist as $k => $v) { $rn = $k; if (csa($k, "___")) { $rn = strtilfirst($k, "___"); } $nclist[$k] = "{$rn} ({$v})"; } if ($withoutplan) { $withoutplanlist["continue_without_plan"] = $login->getKeywordUc('continue_without_plan'); $nclist = lx_array_merge(array($nclist, $withoutplanlist)); } return $nclist; }
function os_getUptime() { $v = trim(file_get_contents("/proc/uptime")); $vv = strtilfirst($v, " "); return trim($vv); }
function process_port($eidlist, $plist) { $downlist = null; foreach ($plist as $p) { $statlist = $p->getList('portstatus'); $match = false; if (!$statlist) { dprint("Something's very wrong...\n"); continue; } $rcount = 0; foreach ($statlist as $k => $s) { $mingstatus = $s->getObject('monitoringserverstatus'); if ($mingstatus->updatetime > time() - 900) { $rcount++; } else { $s->dbaction = 'delete'; $s->write(); unset($statlist[$k]); } } if (!$rcount) { // There are no recent updates. All updates are old. So just skip. continue; } $upcount = 0; $totalerr = null; $downcount = 0; foreach ($statlist as $s) { if ($s->isOn('portstatus')) { $upcount++; $totalerr[] = "{$s->servername}, success"; } else { $downcount++; $totalerr[] = "{$s->servername}, {$s->errorstring}"; } } $totalerr = implode(": ", $totalerr); // If the port is down, then no one will ever say it is up, but if it is up, then it is possible that some of the buggers say it is down, because of their own personal problems. So if even one guy says it is up, then it is up. // We need two guys at least to make a decision. if ($rcount == 1) { if ($upcount == 1) { $newstatus = 'on'; } else { $newstatus = 'off'; $downlist[] = $p->portnumber; } } else { if ($upcount >= 2) { $newstatus = 'on'; } else { $newstatus = 'off'; $downlist[] = $p->portnumber; } } if ($newstatus !== $p->portstatus) { $gap = time() - $p->changetime; $p->portstatus = $newstatus; $p->changetime = time(); $p->setUpdateSubaction(); $p->write(); send_mails_to_all($eidlist, $p, $gap, strtilfirst($p->getParentName(), "___")); $porthname = $p->nname . "___" . time(); $porthist = new PortHistory(null, null, $porthname); $porthist->initThisDef(); $porthist->portnname = $p->nname; $porthist->ddate = time(); $porthist->laststatustime = $gap; $porthist->portstatus = $newstatus; if ($porthist->isOn('portstatus')) { $porthist->errorstring = ""; } else { $porthist->errorstring = $totalerr; } // Temporarility let us have a record of what happened... $porthist->errorstring = $totalerr; $porthist->dbaction = 'add'; $porthist->write(); } } return $downlist; }
function os_get_allips() { $out = lxshell_output("ifconfig"); $list = explode("\n", $out); foreach ($list as $l) { $l = trim($l); if (!csa($l, "inet addr:")) { continue; } $ip = strfrom($l, "inet addr:"); $ip = strtilfirst($ip, " "); if (csb($ip, "127.0")) { continue; } $iplist[] = $ip; } return $iplist; }
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); }
include_once "htmllib/lib/include.php"; include_once "htmllib/lib/parsemail/parseMail.php"; initProgram('admin'); $STDIN = fopen("php://stdin", "r"); $content = null; while (!feof($STDIN)) { $content .= fread($STDIN, 8192); } $email = new parseMail($content); $subject = $email->subject; $message = $email->part[0]['content']; $smallfrom = $email->from; if (csa($smallfrom, "<")) { $smallfrom = strfrom($smallfrom, "<"); $smallfrom = strtilfirst($smallfrom, ">"); } $smallfrom = trim($smallfrom); $smallfrom = trim($smallfrom, "<>"); //$email->from = $smallfrom; $email->message = $message; preg_match("/.*\\[ticket:([^:]*):([^:]*)\\].*/i", $subject, $matches); print_r($matches); if (!$matches) { $param['subject'] = $subject; $param['descr_f'] = $message; $param['sent_to'] = 'client-admin'; $param['category'] = 'complaint'; $param['priority'] = 'medium'; $csq = new Sqlite(null, 'client'); $c = $csq->getRowsWhere("contactemail = '{$smallfrom}'", array('nname'));
function display($var) { global $gbl, $sgbl, $login, $ghtml; if ($var === 'vpsid') { if (!$this->vpsid) { return '-'; } } if ($var === 'ostemplate') { $v = strtilfirst($this->ostemplate, "-"); return "_lxspan:{$v}:{$this->ostemplate}:"; } if ($var === 'coma_vmipaddress_a') { $data = getFirstFromList($this->vmipaddress_a); if (isset($data->nname)) { return $data->nname; } else { return NULL; } } if ($var === 'lmemoryusage_f') { if (!isset($this->lmemoryusage_f)) { return '-'; } return $this->lmemoryusage_f; } if ($var === 'resourceplan_used_f') { return strtil($this->resourceplan_used, "___"); } if ($var === 'ldiskusage_f') { if (!isset($this->ldiskusage_f)) { return '-'; } return $this->ldiskusage_f; } if ($var === 'state') { if (!$this->state || $this->state === 'alright') { return 'ok'; } return $this->state; } return parent::display($var); }
function prepare_error_portmonlist($serverhistlist) { foreach ($serverhistlist as $k => $l) { $servername = strtilfirst($k, "___"); foreach ($l as $kk => $p) { if ($p['portstatus'] === 'on') { continue; } $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); socket_set_nonblock($socket); $portnumber = strtilfirst($kk, "___"); $portmonlist[$k][$kk] = array($servername, $portnumber, $socket); } } return $portmonlist; }