function createExtraVariables() { // Not here. Two different extra variables are needed, so they are created in synctosystem. // Brought back here, since the secondary server concept has been abolished in favor of multiple primary servers. global $gbl, $sgbl, $login, $ghtml; if ($sgbl->isHyperVm()) { $this->createExtraVariablesHyperVM(); return; } $db = new Sqlite($this->__masterserver, "dns"); $gen = $login->getObject('general')->generalmisc_b; $serverlist = explode(",", $this->syncserver); $list = null; foreach ($serverlist as $server) { $string = "syncserver LIKE '%{$server}%'"; $nlist = $db->getRowsWhere($string, array('nname')); $dlistv = "__var_domainlist_{$server}"; $this->{$dlistv} = $nlist; } //FIXME: We should only get the addon domains for the domains configured on that particular server. IN the case of single server system, it is not a problem, since that means we will have to get all the domains. but in the case of distributed setup, we need to properly get only the add domains under the domains loaded above. $dbaddon = new Sqlite(null, "addondomain"); $addr = $dbaddon->getTable(array('nname')); foreach ($serverlist as $server) { $dlistv = "__var_domainlist_{$server}"; $this->{$dlistv} = lx_array_merge(array($this->{$dlistv}, $addr)); } $this->fixDateSerial(); $this->__var_addonlist = $this->getParentO()->getList('addondomain'); $mydb = new Sqlite(null, "ipaddress"); $string = "syncserver = '{$this->syncserver}'"; $this->__var_ipssllist = $mydb->getRowsWhere($string, array('ipaddr', 'nname')); }
static function getServiceList() { global $gbl, $sgbl, $login, $ghtml; $val = lscandir_without_dot("__path_real_etc_root/init.d"); $val = array_remove($val, $sgbl->__var_programname_web); $val = array_remove($val, $sgbl->__var_programname_dns); $val = array_remove($val, $sgbl->__var_programname_imap); $val = array_remove($val, $sgbl->__var_programname_mmail); $nval = self::getMainServiceList(); $nval = lx_array_merge(array($nval, $val)); return $nval; }
static function addform($parent, $class, $typetd = null) { global $gbl, $sgbl, $login, $ghtml; $list = array("client"); if ($sgbl->isHyperVm()) { $list = lx_array_merge(array($list, array("vps"))); } $vlist['nname'] = null; $vlist['description'] = null; $vlist['class'] = array('s', $list); $vlist['url'] = array('m', "http://"); $ret['action'] = 'add'; $ret['variable'] = $vlist; 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 getListVersion($syncserver, $list) { $list[]['componentname'] = 'mysql'; $list[]['componentname'] = 'perl'; //$list[]['componentname'] = 'postgresql'; $list[]['componentname'] = 'httpd'; $list[]['componentname'] = 'qmail'; $list[]['componentname'] = 'courier-imap-toaster'; $list[]['componentname'] = 'php'; $list[]['componentname'] = 'lighttpd'; $list[]['componentname'] = 'djbdns'; $list[]['componentname'] = 'bind'; $list[]['componentname'] = 'spamassassin'; $list[]['componentname'] = 'pure-ftpd'; foreach ($list as $l) { $nlist[] = $l['componentname']; } $complist = implode(" ", $nlist); $file = fix_nname_to_be_variable("rpm -q {$complist}"); $file = "__path_program_root/cache/{$file}"; $cmdlist = lx_array_merge(array(array("rpm", "-q"), $nlist)); $val = get_with_cache($file, $cmdlist); $res = explode("\n", $val); $ret = null; foreach ($list as $k => $l) { $name = $list[$k]['componentname']; $sing['nname'] = $name . "___" . $syncserver; $sing['componentname'] = $name; $sing['version'] = self::getVersion($res, $name); $status = strstr($sing['version'], "not installed"); $sing['status'] = $status ? 'off' : 'on'; /* if (isOn($sing['status'])) { $sing['full_version'] = `rpm -qi $name`; } else { $sing['full_version'] = $sing['version']; } */ $ret[] = $sing; } 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; $os = $this->getParentO()->ostype; include "../file/driver/{$os}.inc"; $vlist = null; $this->createVlistDriver($vlist, $driver); $list = module::getModuleList(); $driver = null; foreach ((array) $list as $l) { $mod = getreal("/module/") . "/{$l}"; include_once "{$mod}/lib/driver.inc"; $dlist = $driver[$os]; if (isset($driver['all'])) { $dlist = lx_array_merge(array($dlist, $driver['all'])); } $this->createVlistDriver($vlist, $dlist); } return $vlist; }
function monitor_child() { global $gbl, $sgbl, $login, $ghtml; global $global_reminder; initProgram('admin'); $login->loadAllObjects('client'); $login->loadAllObjects('vps'); $cllist = $login->getList('client'); $vpslist = $login->getList('vps'); $clist = lx_array_merge(array($cllist, $vpslist)); foreach ($clist as $c) { $downlist = null; $mlist = $c->getList('monitorserver'); if (!$mlist) { continue; } foreach ($mlist as $ml) { $plist = $ml->getList('monitorport'); $eidlist = $ml->getList('emailalert'); $nidlist = $c->getList('emailalert'); $rlist = lx_array_merge(array($nidlist, $eidlist)); $portlist = process_port($rlist, $plist); if ($portlist) { $text = file_get_contents("../file/mailalert.txt"); $text = str_replace("%port%", implode(" ", $portlist), $text); $text = str_replace("%server%", $ml->servername, $text); foreach ($rlist as $eid) { if (time() - $eid->last_sent > $eid->period * 60) { log_message("Sending mail to {$eid->emailid} about {$ml->servername} at " . time()); $global_reminder[$eid->emailid][] = array("s", $text); $eid->last_sent = time(); $eid->setUpdateSubaction(); $eid->write(); } } } } } }
function getTotalUsage($class, $list) { global $gbl, $sgbl, $login, $ghtml; $var = null; foreach ($list as $k => $d) { $needlist = null; foreach ($d as $dp) { $nlist = null; $nlist = $dp->getQuotaNeedVar(); $needlist[$dp->getClName()] = $nlist; } //$userlist = get_namelist_from_objectlist($d, 'nname', 'username'); $driver = $gbl->getSyncClass(null, $k, $class); try { $tvar = rl_exec_get(null, $k, array($class, 'findTotalUsage'), array($driver, $needlist)); if ($class === 'client') { dprintr("{$k}: \n"); dprintr($tvar); } } catch (Exception $e) { print "Could not get Remote Disk Usage {$k}\n"; } $var = lx_array_merge(array($var, $tvar)); } return $var; }
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) { $res = domain::getDnsTemplateList($parent); $vlist['nname'] = null; $vlist['description'] = null; $iplist = $parent->getIpaddress(array('localhost')); if (!$iplist) { $iplist = getAllIpaddress(); } $vlist['ipaddress'] = array('s', $iplist); //$vlist['dbtype_list'] = null; $vlist['dnstemplate'] = array('s', $res); //$vlist['share_status'] = null; $vlist['__c_subtitle_quota'] = "Quota"; $qvlist = getQuotaListForClass('domain', array()); $vlist = lx_array_merge(array($vlist, $qvlist)); $vlist['__c_subtitle_mail'] = "Mail"; $vlist['catchall'] = array('s', array('--bounce--', 'postmaster', 'Delete')); $ret['action'] = "add"; $ret['variable'] = $vlist; return $ret; }
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 EnableDotNet() { $iis = new lxCOM("IIS://localhost/W3SVC/{$this->main->iisid}"); $list[] = ""; $aspiDllPath = $this->getAspNetDllPath(); $list[] = ".asax," . $aspiDllPath . ",5,GET,HEAD,POST,DEBUG"; $list[] = ".ascx," . $aspiDllPath . ",5,GET,HEAD,POST,DEBUG"; $list[] = ".ashx," . $aspiDllPath . ",1,GET,HEAD,POST,DEBUG"; $list[] = ".asmx," . $aspiDllPath . ",1,GET,HEAD,POST,DEBUG"; $list[] = ".aspx," . $aspiDllPath . ",1,GET,HEAD,POST,DEBUG"; $list[] = ".axd," . $aspiDllPath . ",1,GET,HEAD,POST,DEBUG"; $list[] = ".vsdisco," . $aspiDllPath . ",1,GET,HEAD,POST,DEBUG"; $list[] = ".rem," . $aspiDllPath . ",1,GET,HEAD,POST,DEBUG"; $list[] = ".soap," . $aspiDllPath . ",1,GET,HEAD,POST,DEBUG"; $list[] = ".config," . $aspiDllPath . ",5,GET,HEAD,POST,DEBUG"; $list[] = ".cs," . $aspiDllPath . ",5,GET,HEAD,POST,DEBUG"; $list[] = ".csproj," . $aspiDllPath . ",5,GET,HEAD,POST,DEBUG"; $list[] = ".vb," . $aspiDllPath . ",5,GET,HEAD,POST,DEBUG"; $list[] = ".vbproj," . $aspiDllPath . ",5,GET,HEAD,POST,DEBUG"; $list[] = ".webinfo," . $aspiDllPath . ",5,GET,HEAD,POST,DEBUG"; $list[] = ".licx," . $aspiDllPath . ",5,GET,HEAD,POST,DEBUG"; $list[] = ".resx," . $aspiDllPath . ",5,GET,HEAD,POST,DEBUG"; $list[] = ".resources," . $aspiDllPath . ",5,GET,HEAD,POST,DEBUG"; $iis = new lxCOM("IIS://LocalHost/w3svc/{$this->main->iisid}/root"); $ScriptMaps = convertCOMarray($iis->Scriptmaps); $newmap = lx_array_merge(array($ScriptMaps, $list)); $iis->ScriptMaps = $newmap; $iis->SetInfo(); }
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 lxguard_main($clearflag = false) { include_once "htmllib/lib/lxguardincludelib.php"; lxfile_mkdir("__path_home_root/lxguard"); $lxgpath = "__path_home_root/lxguard"; $file = "/var/log/secure"; $fp = fopen($file, "r"); $fsize = filesize($file); $newtime = time(); $oldtime = time() - 60 * 10; $rmt = lfile_get_unserialize("{$lxgpath}/hitlist.info"); if ($rmt) { $oldtime = max((int) $oldtime, (int) $rmt->ddate); } $ret = FindRightPosition($fp, $fsize, $oldtime, $newtime, "getTimeFromSysLogString"); $list = lfile_get_unserialize("{$lxgpath}/access.info"); if ($ret) { parse_sshd_and_ftpd($fp, $list); lfile_put_serialize("{$lxgpath}/access.info", $list); } get_total($list, $total); //dprintr($list['192.168.1.11']); dprintr($total); $deny = get_deny_list($total); $hdn = lfile_get_unserialize("{$lxgpath}/hostdeny.info"); $deny = lx_array_merge(array($deny, $hdn)); $string = null; foreach ($deny as $k => $v) { if (csb($k, "127")) { continue; } $string .= "ALL : {$k}\n"; } dprint($string); $stlist[] = "###Start Program Hostdeny config Area"; $stlist[] = "###Start Lxdmin Area"; $stlist[] = "###Start Kloxo Area"; $stlist[] = "###Start Lxadmin Area"; $endlist[] = "###End Program HostDeny config Area"; $endlist[] = "###End Kloxo Area"; $endlist[] = "###End Lxadmin Area"; $startstring = $stlist[0]; $endstring = $endlist[0]; file_put_between_comments($stlist, $endlist, $startstring, $endstring, "/etc/hosts.deny", $string); if ($clearflag) { lxfile_rm("{$lxgpath}/access.info"); $rmt = new Remote(); $rmt->hl = $total; $rmt->ddate = time(); lfile_put_serialize("{$lxgpath}/hitlist.info", $rmt); } return $list; }
function mydbactionUpdate() { $totalres = null; if (is_array($this->main->subaction)) { foreach ($this->main->subaction as $sub) { if (csb($sub, "top_level_")) { $res = $this->{$sub}(); } else { $res = $this->dbactionUpdate($sub); } $totalres = lx_array_merge(array($totalres, $res)); } } else { $sub = $this->main->subaction; if (csb($sub, "top_level_")) { $res = $this->{$sub}(); } else { $res = $this->dbactionUpdate($sub); } $totalres = $res; } return $totalres; }
function createIniFile() { $pclass = $this->main->getParentClass(); $ver = find_php_version(); $this->initString($ver); $header = lfile_get_contents("../file/phpini/php.ini.template-{$ver}"); $cont = lfile_get_contents("../file/phpini/php.ini.temp"); $htcont = lfile_get_contents("../file/phpini/htaccesstemp"); $vlist = array("enable_zend_val", "enable_ioncube_val", "enable_xcache_val"); $l1 = $this->main->getInheritedList(); $l2 = $this->main->getLocalList(); $l3 = $this->main->getExtraList(); $ll = lx_array_merge(array($l1, $l2, $l3)); $list = array_unique($ll); foreach ($list as $l) { $vl = strtil($l, "_flag") . "_val"; if (array_search_bool($vl, $vlist)) { continue; } list($cont, $htcont) = $this->replacestr(array($cont, $htcont), $l); } foreach ($vlist as $vl) { list($cont) = $this->replacestr(array($cont), $vl); } $stlist[] = "###Start Kloxo PHP config Area"; $stlist[] = "###Start Lxdmin Area"; $stlist[] = "###Start Kloxo Area"; $stlist[] = "###Start Lxadmin PHP config Area"; $endlist[] = "###End Kloxo PHP config Area"; $endlist[] = "###End Kloxo Area"; $endlist[] = "###End Lxadmin PHP config Area"; $endstring = $endlist[0]; $startstring = $stlist[0]; if ($pclass === 'pserver') { $file = "/etc/php.ini"; if (!lxfile_exists("__path_kloxo_back_phpini")) { lxfile_cp("/etc/php.ini", "__path_kloxo_back_phpini"); } $this->enableDisableModule("enable_xcache_flag", "xcache"); $htfile = null; $extrafile = "/etc/custom.php.ini"; if (lxfile_exists($extrafile)) { $extrastring = lfile_get_contents($extrafile); $cont = "{$extrastring}\n{$cont}"; } else { $cont = "{$cont}"; } } else { $dname = $this->main->getParentName(); $elogfile = "/home/{$this->main->__var_customer_name}/__processed_stats/{$this->main->getParentName()}.phplog"; $file = "__path_httpd_root/{$this->main->getParentName()}/php.ini"; $extrafile = "__path_httpd_root/{$this->main->getParentName()}/custom.php.ini"; if (lxfile_exists($extrafile)) { $extrastring = lfile_get_contents($extrafile); } else { $extrastring = ""; } // ToDo #590 - disable appear on .htaccess // REVERT - back to enable because mod_php tend to share-based php.ini // and some parameters of domain specific must be declare inside .htaccess $htfile = "{$this->main->__var_docrootpath}/.htaccess"; $ht1file = "/home/{$this->main->__var_customer_name}/kloxoscript/.htaccess"; $htcont = "php_value error_log \"{$elogfile}\"\n{$htcont}"; $htcont = str_replace("\n", "\n\t", $htcont); $htcont = str_replace($htcont, "\t" . $htcont, $htcont); $htcont = "\n<Ifmodule mod_php4.c>\n{$htcont}\n</Ifmodule>\n\n<Ifmodule mod_php5.c>\n{$htcont}\n</Ifmodule>\n"; file_put_between_comments("{$this->main->__var_web_user}:apache", $stlist, $endlist, $startstring, $endstring, $htfile, $htcont); file_put_between_comments("{$this->main->__var_web_user}:apache", $stlist, $endlist, $startstring, $endstring, $ht1file, $htcont); lxfile_unix_chown($htfile, "{$this->main->__var_web_user}:apache"); // MR --- set the same like AddOpenBaseDir() on web__apachelib.php $clname = $this->main->__var_customer_name; $adminbasedir = trim($this->main->__var_extrabasedir); if ($adminbasedir) { $adminbasedir .= ":"; } if (!$this->main->isOn('__var_disable_openbasedir')) { $path = "{$adminbasedir}"; $path .= "/home/{$clname}:"; $path .= "/home/{$clname}/kloxoscript:"; $path .= "/home/httpd/{$dname}:"; $path .= "/home/httpd/{$dname}/httpdocs:"; $path .= "/tmp:"; $path .= "/usr/share/pear:"; $path .= "/var/lib/php/session:"; $path .= "/home/kloxo/httpd/script"; $cont = "open_basedir = \"{$path}\"\n\n{$cont}"; } $cont = "error_log = \"{$elogfile}\"\n{$cont}"; $cont = "{$extrastring}\n{$cont}"; } lxfile_rm($file); lfile_put_contents($file, "{$header}\n{$cont}\n"); createRestartFile($this->main->__var_webdriver); }
static function baseinitThisList($parent, $class, $type) { global $gbl, $sgbl, $login, $ghtml; $rlist = $parent->createShowRlist(""); $class = $parent->get__table(); $resourceout = null; if ($rlist) { $j = 0; foreach ($rlist as $k => $v) { if ($k === 'priv') { $vlist = $parent->getQuotaVariableList(); $vlist = lx_array_merge(array($vlist, $parent->getDeadQuotaVariableList())); foreach ($vlist as $nk => $nv) { // Why am I skipping hardquota?. OK it screws up vps graph if ($parent->isHardQuota($nk)) { continue; } if ($type === 'permission') { if (!cse($nk, "_flag")) { continue; } if ($login->getSpecialObject('sp_specialplay')->isOn('dont_show_disabled_permission')) { if (!$parent->priv->isOn($nk)) { continue; } } } else { if (cse($nk, "_flag")) { continue; } } $desc = get_classvar_description($class, $nk); if (is_array($parent->priv->{$nk})) { foreach ($parent->priv->{$nk} as $nnk => $nnv) { $resourceout[$j]['vv'] = $nk; $resourceout[$j]['nname'] = $j; $resourceout[$j]['shortdescr'] = getNthToken($desc[2], 0); $sh = getNthToken($desc[2], 0); $ln = getNthToken($desc[2], 1); $resourceout[$j]['descr'] = "_lxspan:{$sh}:{$ln}:"; $resourceout[$j]['resourceused'] = $parent->used->{$nk}[$nnk]; $resourceout[$j]['resourcepriv'] = $parent->priv->{$nk}[$nnk]; $j++; } continue; } if (isset($parent->used)) { $vresourceused = $parent->used->{$nk}; } else { $vresourceused = '-'; } if (cse($nk, "_flag")) { $vresourcepriv = $parent->priv->{$nk}; } else { if ($parent->priv->{$nk} === "0") { continue; } if ($parent->showPrivInResource()) { $vresourcepriv = $parent->priv->{$nk}; } else { $vresourcepriv = '-'; } } if (cse($nk, 'last_usage')) { $vresourcepriv = '-'; } if ($parent->isDeadQuotaVariable($nk)) { $vresourcepriv = "-"; } $resourceout[$j]['vv'] = $nk; $resourceout[$j]['nname'] = $j; $resourceout[$j]['shortdescr'] = getNthToken($desc[2], 0); $sh = getNthToken($desc[2], 0); $ln = getNthToken($desc[2], 1); $resourceout[$j]['descr'] = "_lxspan:{$sh}:{$ln}:"; $resourceout[$j]['resourceused'] = $vresourceused; $resourceout[$j]['resourcepriv'] = $vresourcepriv; $j++; } } else { $resourceout[$j]['vv'] = $v[0]; $resourceout[$j]['nname'] = $j; $resourceout[$j]['shortdescr'] = getNthToken($v[1], 0); $sh = getNthToken($v[1], 0); $ln = getNthToken($v[1], 1); $resourceout[$j]['descr'] = "_lxspan:{$sh}:{$ln}:"; $resourceout[$j]['resourceused'] = $v[2]; $resourceout[$j]['resourcepriv'] = $v[3]; $j++; } } } return $resourceout; }
function createIniFile() { $pclass = $this->main->getParentClass(); $ver = find_php_version(); //dprintr($this->main->phpini_flag_b); $this->initString($ver); //dprintr($this->main->phpini_flag_b); $header = lfile_get_contents("../file/phpini/php.ini.template-{$ver}"); $cont = lfile_get_contents("../file/phpini/php.ini.temp"); $htcont = lfile_get_contents("../file/phpini/htaccesstemp"); $vlist = array("enable_zend_val", "enable_ioncube_val", "enable_xcache_val"); $l1 = $this->main->getInheritedList(); $l2 = $this->main->getLocalList(); $l3 = $this->main->getExtraList(); $ll = lx_array_merge(array($l1, $l2, $l3)); $list = array_unique($ll); foreach ($list as $l) { $vl = strtil($l, "_flag") . "_val"; if (array_search_bool($vl, $vlist)) { continue; } list($cont, $htcont) = $this->replacestr(array($cont, $htcont), $l); } foreach ($vlist as $vl) { list($cont) = $this->replacestr(array($cont), $vl); } /* list($cont) = $this->replacestr(array($cont), 'enable_zend_val'); list($cont) = $this->replacestr(array($cont), 'enable_ioncube_val'); list($cont) = $this->replacestr(array($cont), 'enable_xcache_val'); list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'register_global_flag'); list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'output_compression_flag'); list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'display_error_flag'); list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'file_uploads_flag'); list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'upload_max_filesize'); list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'log_errors_flag'); list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'upload_tmp_dir_flag'); list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'output_buffering_flag'); list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'register_argc_argv_flag'); list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'magic_quotes_gpc_flag'); list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'variables_order_flag'); list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'magic_quotes_runtime_flag'); list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'magic_quotes_sybase_flag'); list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'gpc_order_flag'); list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'extension_dir_flag'); list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'enable_dl_flag'); list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'mysql_allow_persistent_flag'); list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'disable_functions_flag'); list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'max_execution_time_flag'); list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'max_input_time_flag'); list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'memory_limit_flag'); list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'post_max_size_flag'); list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'register_long_arrays_flag'); list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'allow_url_fopen_flag'); list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'allow_url_include_flag'); list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'session_save_path_flag'); list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'cgi_force_redirect_flag'); list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'safe_mode_flag'); */ $stlist[] = "###Start Kloxo PHP config Area"; $stlist[] = "###Start Lxdmin Area"; $stlist[] = "###Start Kloxo Area"; $stlist[] = "###Start Lxadmin PHP config Area"; $endlist[] = "###End Kloxo PHP config Area"; $endlist[] = "###End Kloxo Area"; $endlist[] = "###End Lxadmin PHP config Area"; $endstring = $endlist[0]; $startstring = $stlist[0]; if ($pclass === 'pserver') { $file = "/etc/php.ini"; if (!lxfile_exists("__path_kloxo_back_phpini")) { lxfile_cp("/etc/php.ini", "__path_kloxo_back_phpini"); } $this->enableDisableModule("enable_xcache_flag", "xcache"); $htfile = null; $extrafile = "/etc/custom.php.ini"; $extrastring = lfile_get_contents("/etc/custom.php.ini"); $cont = "{$extrastring}\n{$cont}"; } else { $dname = $this->main->getParentName(); $elogfile = "/home/{$this->main->__var_customer_name}/__processed_stats/{$this->main->getParentName()}.phplog"; $file = "__path_httpd_root/{$this->main->getParentName()}/php.ini"; $extrafile = "__path_httpd_root/{$this->main->getParentName()}/custom.php.ini"; $extrastring = lfile_get_contents($extrafile); $htfile = "{$this->main->__var_docrootpath}/.htaccess"; $ht1file = "/home/httpd/{$this->main->getParentName()}/kloxoscript/.htaccess"; $htcont = "php_value error_log {$elogfile}\n{$htcont}"; $htcont = "<Ifmodule mod_php4.c>\n{$htcont}\n</Ifmodule>\n<Ifmodule mod_php5.c>\n{$htcont}\n</Ifmodule>\n"; file_put_between_comments($stlist, $endlist, $startstring, $endstring, $htfile, $htcont); file_put_between_comments($stlist, $endlist, $startstring, $endstring, $ht1file, $htcont); lxfile_unix_chown($htfile, "{$this->main->__var_web_user}:apache"); $adminbasedir = trim($this->main->__var_extrabasedir); if (!$this->main->isOn('__var_disable_openbasedir')) { $cont = "open_basedir = /home/{$this->main->__var_customer_name}:{$adminbasedir}:/tmp:/usr/share/pear:/home/httpd/{$dname}:/var/lib/php/session:/home/kloxo/httpd/script:/home/httpd/{$dname}/kloxoscript/\n{$cont}"; } $cont = "error_log = {$elogfile}\n{$cont}"; $cont = "{$extrastring}\n{$cont}"; } lxfile_rm($file); lfile_put_contents($file, "{$header}\n{$cont}\n"); createRestartFile($this->main->__var_webdriver); }
function parse_sql_data() { global $gbl, $sgbl, $argc, $argv; static $_quota_var, $_field_var; $_return_value = null; $majmin = $sgbl->__ver_major_minor; $trel = $sgbl->__ver_release; $rpath = "sql/full.lxsql"; $pathc = "htmllib/sql/common.lxsql"; include $rpath; include $pathc; $string = $gl_sql_string_common . "\n" . $gl_sql_string; $string = explode("\n", $string); foreach ($string as $__k => $res) { $res = trim($res); if (!$res) { continue; } if (char_search_beg($res, "//")) { continue; } $res = preg_replace('/\\s+/', " ", $res); if (csb($res, "#")) { $vl = explode(" ", $res); $name = array_shift($vl); $name = strfrom($name, "#"); $nvl = null; $nnvl = null; foreach ($vl as $k => $qv) { if (csb($qv, "#")) { $_t = strfrom($qv, "#"); $nvl = lx_array_merge(array($nvl, $_quota_var[$_t])); } else { $nvl[] = $qv; } } foreach ($nvl as $qv) { $nnvl[] = "priv_q_" . $qv; $nnvl[] = "used_q_" . $qv; } $_quota_var[$name] = $nvl; $g_qvar[$name] = $nnvl; $list = get_class_for_table($name); foreach ((array) $list as $l) { $_quota_var[$l] = $nvl; $g_qvar[$l] = $nnvl; } continue; } if (csb($res, "%")) { $vl = explode(" ", $res); $name = array_shift($vl); $nnnnvl = null; foreach ($vl as $q) { if (csb($q, "%")) { $nnnnvl = lx_array_merge(array($nnnnvl, $g_var[$q])); } else { $nnnnvl[] = $q; } } $g_var[$name] = $nnnnvl; continue; } $list = explode(" ", $res); $nlist = null; foreach ($list as $k => $l) { if (csb($l, "%")) { $nlist = array_merge($nlist, $g_var[$l]); } else { $nlist[] = $l; } } //dprintr($list); $list = $nlist; $nlist = null; foreach ($list as $l) { if ($l === '__q_var') { if (isset($g_qvar[$list[0]])) { $nlist = lx_array_merge(array($nlist, $g_qvar[$list[0]])); } } else { $nlist[] = $l; } } $list = $nlist; //dprintr($list); $name = array_shift($list); $fields = lx_array_merge(array(get_default_fields(), $list)); if (array_search_bool("syncserver", $fields)) { $fields[] = 'oldsyncserver'; $fields[] = 'olddeleteflag'; } $fields = array_unique($fields); $_field_var[$name] = $fields; $_return_value[$name] = $fields; } foreach ($_quota_var as &$__tq) { $__tq = array_flip($__tq); } foreach ($_field_var as &$__tq) { $__tq = array_flip($__tq); } $var['quotavar'] = $_quota_var; $var['fieldvar'] = $_field_var; lfile_put_contents("__path_dbschema", serialize($var)); return $_return_value; }
static function createListSlist($parent) { $nlist['nname'] = null; $nlist['parent_clname'] = null; $nlist['dtype'] = array('s', array('--any--', 'maindomain', 'subdomain')); if (check_if_many_server()) { $sql = new Sqlite($parent->__masterserver, "pserver"); $res = $sql->getTable(array('nname')); $rs = get_namelist_from_arraylist($res); $rs = lx_array_merge(array(array('--any--'), $rs)); $nlist['webpserver'] = array('s', $rs); $nlist['mmailpserver'] = array('s', $rs); $nlist['dnspserver'] = array('s', $rs); } return $nlist; }
function object_variable_hiddenlist($hlist) { foreach ($hlist as $key => $val) { $a[] = $this->object_variable_hidden($key, $val); } return lx_array_merge($a); }
function createServerAliasLine() { global $gbl, $sgbl, $login, $ghtml; $list = get_namelist_from_objectlist($this->main->server_alias_a); $iplist = null; foreach ($this->main->__var_domainipaddress as $ip => $dom) { if ($dom === $this->main->nname) { $iplist[] = $ip; } } if ($list) { foreach ($list as &$__l) { $__l = "{$__l}.{$this->main->nname}"; } } if ($this->main->isOn('force_www_redirect')) { $list = lx_merge_good(array("www.{$this->main->nname}"), $list); } else { $list = lx_merge_good(array("www.{$this->main->nname}", $this->main->nname), $list); } foreach ((array) $this->main->__var_addonlist as $d) { // forget this if? if ($d->ttype === 'redirect') { continue; } $list[] = $d->nname; $list[] = "www.{$d->nname}"; } $list = lx_array_merge(array($list, $iplist)); $string = implode("|", $list); // issue 674 - wildcard and subdomain problem // remove for * (wildcards) $string = str_replace("|*.{$this->main->nname}", "", $string); return "^({$string})"; }
static function 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; }
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; 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 updateform($subaction, $param) { $vlist['odbcname'] = array('M', null); $vlist = lx_array_merge(array($vlist, self::createVlist($this->driver))); return $vlist; }
static function addform($parent, $class, $typetd = null) { $vlist['nname'] = ""; $vlist['description'] = null; //$vlist['share_status'] = null; $qvlist = getQuotaListForClass('client', array()); $vlist = lx_array_merge(array($vlist, $qvlist)); $ret['variable'] = $vlist; $ret['action'] = "add"; return $ret; }
function updateform($subaction, $param) { switch ($subaction) { case "editmx": $rec = $this->getParentO()->getObject('dns')->dns_record_a; foreach ($rec as $a) { if ($a->ttype === 'mx') { $v = $a->param; continue; } } $vlist['nname'] = array('M', null); $vlist['mx_f'] = array('m', $v); $vlist['__v_updateall_button'] = array(); return $vlist; case "authentication": $domkey = db_get_value("servermail", $this->syncserver, "domainkey_flag"); if (!$domkey) { $domkey = 'off'; } $domkey .= " (Server Wide Value)"; $vlist['domainkey_f'] = array('M', $domkey); $vlist['enable_spf_flag'] = null; $vlist['text_spf_domain'] = null; $vlist['text_spf_ip'] = null; $this->setDefaultValue('exclude_all', 'soft'); $vlist['exclude_all'] = array('s', array('soft', 'hard')); $vlist['__v_updateall_button'] = array(); return $vlist; case "webmail_select": // read note on fixWebmailRedirect() $this->postUpdate($subaction); $this->setDefaultValue('webmailprog', '--system-default--'); $base = "/home/kloxo/httpd/webmail/"; $list = lscandir_without_dot_or_underscore($base); $nlist[] = '--system-default--'; $nlist[] = '--chooser--'; $nlist = add_disabled($nlist); $plist = self::getWebmailProgList(); $nlist = lx_merge_good($nlist, $plist); $vlist['webmailprog'] = array('s', $nlist); $vlist['__v_updateall_button'] = array(); return $vlist; case "catchall": $list = $this->getList('mailaccount'); $name[] = "--bounce--"; $name[] = "Delete"; $nn = get_namelist_from_objectlist($list); foreach ($nn as &$___t) { $tmp = explode("@", $___t); $___t = $tmp[0]; } $name = lx_array_merge(array($name, $nn)); $vlist['catchall'] = array('s', $name); $vlist['__v_updateall_button'] = array(); return $vlist; case "remotelocalmail": // read note on fixWebmailRedirect() $this->postUpdate($subaction); $vlist['remotelocalflag'] = array('s', array('local', 'remote')); $vlist['webmail_url'] = null; $vlist['__v_updateall_button'] = array(); return $vlist; } return parent::updateform($subaction, $param); }