From 1a8189c7599666e35a323d8985559a5cb1771708 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Fri, 3 Sep 2021 21:08:44 +0200 Subject: [PATCH] move logs from unnecessary file and class --- _prepend.php | 1 - inc/lib.activity.report.index.php | 99 ------------------------------- index.php | 87 ++++++++++++++++++++------- 3 files changed, 64 insertions(+), 123 deletions(-) delete mode 100644 inc/lib.activity.report.index.php diff --git a/_prepend.php b/_prepend.php index 1467a27..854b1b7 100644 --- a/_prepend.php +++ b/_prepend.php @@ -18,7 +18,6 @@ if (!defined('DC_RC_PATH')) { $d = dirname(__FILE__) . '/inc/'; $__autoload['activityReport'] = $d . 'class.activity.report.php'; $__autoload['activityReportBehaviors'] = $d . 'class.activity.report.behaviors.php'; -$__autoload['activityReportLib'] = $d . 'lib.activity.report.index.php'; try { $core->activityReport = new activityReport($core); diff --git a/inc/lib.activity.report.index.php b/inc/lib.activity.report.index.php deleted file mode 100644 index 2c05d5b..0000000 --- a/inc/lib.activity.report.index.php +++ /dev/null @@ -1,99 +0,0 @@ -activityReport; - if ($global) - { - $O->setGlobal(); - $t = 'super'; - } - else - { - $t = 'blog'; - } - - $params = array(); - $logs = $O->getLogs($params); - - ?> -
- isEmpty()) - { - echo '

'.__('No log').'

'; - } - else - { - - ?> - - - - - - - - - - - - - fetch()) - { - $off = $global && $logs->activity_blog_status == 1 ? - ' offline' : ''; - $date = dt::str( - $core->blog->settings->system->date_format.', '.$core->blog->settings->system->time_format, - strtotime($logs->activity_dt), - $core->auth->getInfo('user_tz') - ); - $action = $O->getGroups($logs->activity_group,$logs->activity_action); - - if (empty($action)) continue; - - $msg = vsprintf(__($action['msg']),$O->decode($logs->activity_logs)); - ?> - - - - - - - - - - -
blog_id; ?>
- -
- unsetGlobal(); - } -} \ No newline at end of file diff --git a/index.php b/index.php index 6a9ad83..92e87ad 100644 --- a/index.php +++ b/index.php @@ -21,31 +21,72 @@ if (!defined('ACTIVITY_REPORT')) { dcPage::check('admin'); -require_once dirname(__FILE__) . '/inc/lib.activity.report.index.php'; +$report =& $core->activityReport; +$super = $core->auth->isSuperAdmin() && !empty($_REQUEST['super']); -$tab = $_REQUEST['tab'] ?? 'blog_settings'; -$section = $_REQUEST['section'] ?? ''; - -echo ' -'. __('Activity report') . '' . -dcPage::jsLoad('js/_posts_list.js') . -dcPage::jsToolBar() . -dcPage::jsPageTabs($tab) . -dcPage::jsLoad('index.php?pf=activityReport/js/main.js') . -'\n" . ' - -

' . html::escapeHTML($core->blog->name) . ' › ' . __('Activity report') . '

'; - -if (!activityReport::hasMailer()) { - - echo '

' . __('This server has no mail function, activityReport not send email report.') . '

'; +if ($super) { + $report->setGlobal(); } -activityReportLib::logTab($core, __('Logs')); -if ($core->auth->isSuperAdmin()) { - activityReportLib::logTab($core, __('Super logs'), true); +$logs = $report->getLogs([]); + +if ($super) { + $breadcrumb = [ + __('Current blog') => $core->adminurl->get('admin.plugin.activityReport', ['super' => 0]), + '' . __('All blogs') . '' => '' + ]; +} else { + $breadcrumb = ['' . __('Current blog') . '' => '']; + if ($core->auth->isSuperAdmin()) { + $breadcrumb[__('All blogs')] = $core->adminurl->get('admin.plugin.activityReport', ['super' => 1]); + } } + +echo '' . __('Activity report') . '' . +dcPage::breadcrumb(array_merge([__('Activity report') => '', __('Logs') => ''], $breadcrumb),['hl' => false]) . +dcPage::notices(); + +if ($logs->isEmpty()) { + echo '

'.__('No log').'

'; +} else { + echo ' +
+ + + + '; + if ($super) { + echo ''; + } + echo ''; + + while($logs->fetch()) { + $action = $report->getGroups($logs->activity_group, $logs->activity_action); + + if (empty($action)) { + continue; + } + + $off = $super && $logs->activity_blog_status == 1 ? ' offline' : ''; + $date = dt::str( + $core->blog->settings->system->date_format . ', ' . $core->blog->settings->system->time_format, + strtotime($logs->activity_dt), + $core->auth->getInfo('user_tz') + ); + $msg = vsprintf(__($action['msg']), $report->decode($logs->activity_logs)); + + echo ' + + + + '; + if ($super) { + echo ''; + } + echo ''; + } + echo '
' . __('Action') . '' . __('Message') . '' . __('Date') . '' . __('Blog') .'
' . __($action['title']) . '' . $msg . '' . $date . '' . $logs->blog_id . '
'; +} +$report->unsetGlobal(); + echo ''; \ No newline at end of file