Files
emlog_online2/online2_setting.php
2012-10-18 09:28:53 +08:00

71 lines
3.8 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
/**
* 在线统计插件
* @copyright (c) xiaosong.org All Rights Reserved
*/
!defined('EMLOG_ROOT') && exit('access deined!');
function plugin_setting_view() {
require_once('online2_config.php');
}
?>
<script type="text/javascript">
$("#online2").addClass('sidebarsubmenu1');
</script>
<div class="containertitle"><b>在线统计</b>
<?php if(isset($_GET['setting'])):?><span class="actived">插件设置完成</span><?php endif;?>
</div>
<div class="line"></div>
<style type="text/css">
.online { max-height: 280px; overflow-y: auto; }
.online table { width: 100%; table-layout: fixed; }
.online td, .online th { text-align: center; word-wrap: break-word; word-break: break-all; vertical-align: middle; }
.online td { padding: 3px; }
#queryTemplate { width: 200px; }
</style>
<h4><?php echo onlineOutput(); ?></h4>
<div class="online">
<table cellspacing="0" cellpadding="0" border="0" class="item_list">
<tbody>
<tr>
<th style="width:38%;"><b>ip地址</b></th>
<th style="width:16%;"><b>上线时间</b></th>
<th style="width:44%;"><b>UserAgent信息</b></th>
</tr>
<?php echo displayOnlineList(); ?>
</tbody>
</table>
<script>
$(document).ready(function(){
$(".item_list tbody tr:odd").addClass("tralt_b");
$(".item_list tbody tr")
.mouseover(function(){$(this).addClass("trover");})
.mouseout(function(){$(this).removeClass("trover");})
});
</script>
</div>
<div class="des">你可以根据上面的在线信息添加你要排除在外的蜘蛛的特征UserAgent信息每一个特征字符串用|)分开,不区分大小写</div>
<form action="plugin.php?plugin=online2&amp;action=setting" method="post">
<p><textarea name="ua_block" style="width: 500px; height: 100px"><?php echo $ua_block; ?></textarea></p>
<p><label for="is_querycount"><input type="checkbox" name="is_querycount" id="is_querycount" value="true"<?php if($is_querycount == "true"):?> checked<?php endif;?> /> 显示数据库查询次数</label> <label for="queryTemplate"> <input type="text" name="query_template" id="queryTemplate" value="<?php echo $query_template; ?>"> 显示模版</label> <span style="color:#f00">可用变量:{queryCount} -- 查询次数</span></p>
<p><label for="is_footer"><input type="checkbox" name="is_footer" id="is_footer" value="true"<?php if($is_footer == "true"):?> checked<?php endif;?> /> 通过模版自带插件钩子显示</label> <span style="color:#f00">样式和位置完全取决于主题!</span></p>
<p><input type="submit" value="保存设置" class="button"/></p>
</form>
<?php
function plugin_setting(){
$ua_block = isset($_POST['ua_block']) ? addslashes($_POST['ua_block']) : '';
$query_template = isset($_POST['query_template']) ? addslashes($_POST['query_template']) : '';
$is_querycount = isset($_POST['is_querycount']) ? addslashes(trim($_POST['is_querycount'])) : '';
$is_footer = isset($_POST['is_footer']) ? addslashes(trim($_POST['is_footer'])) : '';
$data = "<?php
\$ua_block = '".$ua_block."';
\$query_template = '".$query_template."';
\$is_querycount = '".$is_querycount."';
\$is_footer = '".$is_footer."';
?>";
$file = EMLOG_ROOT.'/content/plugins/online2/online2_config.php';
@ $fp = fopen($file, 'wb') OR emMsg('读取文件失败如果您使用的是Unix/Linux主机请修改文件/content/plugins/online2/online2_config.php的权限为755或777。如果您使用的是Windows主机请联系管理员将该文件设为everyone可写');
@ $fw = fwrite($fp,$data) OR emMsg('写入文件失败如果您使用的是Unix/Linux主机请修改文件/content/plugins/online2/online2_config.php的权限为755或777。如果您使用的是Windows主机请联系管理员将该文件设为everyone可写');
fclose($fp);
}
?>