+
+
+
+
+
+
+
+ plugin('RobotsPlus');
+ $botlist = $config->botlist;
+ $pagecount = $config->pagecount;
+ $isdrop = $config->droptable;
+ if ($botlist == null || $pagecount == null || $isdrop == null)
+ {
+ throw new Typecho_Plugin_Exception('请先设置插件!');
+ }
+ $db = Typecho_Db::get();
+ $prefix = $db->getPrefix();
+ $p = 1;
+ $rtype = '';
+ $oldtype = '';
+ if (isset($_POST['rpage'])) {
+ $p = $_POST['rpage'];
+ }
+ if (isset($_POST['do'])) {
+ $do = $_POST['do'];
+ if ($do == 'delete') {
+ if (isset($_POST['lid'])) {
+ $lids = $_POST['lid'];
+ $deleteCount = 0;
+ if ($lids && is_array($lids)) {
+ foreach ($lids as $lid) {
+ if ($db->query($db->delete($prefix.'robots_logs')->where('lid = ?', $lid))) {
+ $deleteCount ++;
+ }
+ }
+ }
+ Typecho_Widget::widget('Widget_Notice')->set('成功删除蜘蛛日志',NULL,'success');
+ Typecho_Response::redirect(Typecho_Common::url('extending.php?panel=RobotsPlus%2FLogs.php', $options->adminUrl));
+ }else{
+ Typecho_Widget::widget('Widget_Notice')->set('当前没有选择的日志',NULL,'notice');
+ Typecho_Response::redirect(Typecho_Common::url('extending.php?panel=RobotsPlus%2FLogs.php', $options->adminUrl));
+ }
+ }
+ if (strpos($do,'clear')!==false)
+ {
+ try
+ {
+ $cleartype = substr($do, 6);
+ $options = Typecho_Widget::widget('Widget_Options');
+ $timeStamp = $options->gmtTime;
+ $offset = $options->timezone - $options->serverTimezone;
+ $gtime = $timeStamp + $offset;
+ $lowtime = $gtime - ($cleartype * 86400);
+ $db->query($db->delete($prefix.'robots_logs')->where('ltime < ?', $lowtime));
+ Typecho_Widget::widget('Widget_Notice')->set('清除日志成功',NULL,'success');
+ Typecho_Response::redirect(Typecho_Common::url('extending.php?panel=RobotsPlus%2FLogs.php', $options->adminUrl));
+ }
+ catch (Typecho_Db_Exception $e)
+ {
+ Typecho_Widget::widget('Widget_Notice')->set('清除日志失败',NULL,'notice');
+ Typecho_Response::redirect(Typecho_Common::url('extending.php?panel=RobotsPlus%2FLogs.php', $options->adminUrl));
+ }
+ }
+ }
+ if (isset($_POST['oldtype'])) {
+ $oldtype = $_POST['oldtype'];
+ }
+ if (isset($_POST['rpage']) && $_POST['rtype']!=='') {
+ $rtype = $_POST['rtype'];
+ if ($oldtype !== $rtype) {
+ $p = 1;
+ }
+ $logs = $db->fetchAll($db->select()->from($prefix.'robots_logs')->where('bot = ?', $rtype)->order($prefix.'robots_logs.lid', Typecho_Db::SORT_DESC)->page($p, $pagecount));
+ $rows = count($db->fetchAll($db->select('lid')->from($prefix.'robots_logs')->where('bot = ?', $rtype)));
+ }else{
+ $logs = $db->fetchAll($db->select()->from($prefix.'robots_logs')->order($prefix.'robots_logs.lid', Typecho_Db::SORT_DESC)->page($p, $pagecount));
+ $rows = count($db->fetchAll($db->select('lid')->from($prefix.'robots_logs')));
+ }
+ $co = $rows % $pagecount;
+ $pageno = floor($rows / $pagecount);
+ if ($co !== 0) {
+ $pageno += 1;
+ }
+ ?>
+
+
+
+
+