本文整理汇总了PHP中lx_array_merge函数的典型用法代码示例。如果您正苦于以下问题:PHP lx_array_merge函数的具体用法?PHP lx_array_merge怎么用?PHP lx_array_merge使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了lx_array_merge函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createExtraVariables
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'));
}
示例2: getServiceList
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;
}
示例3: addform
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;
}
示例4: __cmd_desc_add
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();
}
示例5: getListVersion
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;
}
示例6: addform
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;
}
示例7: updateform
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;
}
示例8: monitor_child
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();
}
}
}
}
}
}
示例9: getTotalUsage
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;
}
示例10: updateform
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;
}
}
示例11: addform
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;
}
示例12: updateform
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":
//.........这里部分代码省略.........
示例13: EnableDotNet
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();
}
示例14: updateform
//.........这里部分代码省略.........
$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);
}
示例15: lxguard_main
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;
}