auth->isSuperAdmin() && !empty($_REQUEST['super']); $redir = empty($_REQUEST['redir']) ? dcCore::app()->admin->list->getURL() . '#plugins' : $_REQUEST['redir']; if ($super) { dcCore::app()->activityReport->setGlobal(); } $combo_interval = [ __('every hour') => 3600, __('every 2 hours') => 7200, __('2 times by day') => 43200, __('every day') => 86400, __('every 2 days') => 172800, __('every week') => 604800, ]; $combo_obselete = [ __('every hour') => 3600, __('every 2 hours') => 7200, __('2 times by day') => 43200, __('every day') => 86400, __('every 2 days') => 172800, __('every week') => 604800, __('every 2 weeks') => 1209600, __('every 4 weeks') => 2419200, ]; $combo_format = [ __('Plain text') => 'plain', __('HTML') => 'html', ]; if (!empty($_POST['save'])) { try { dcCore::app()->activityReport->setSetting('active', !empty($_POST['active'])); if (in_array($_POST['interval'], $combo_interval)) { dcCore::app()->activityReport->setSetting('interval', (int) $_POST['interval']); } if (in_array($_POST['obsolete'], $combo_obselete)) { dcCore::app()->activityReport->setSetting('obsolete', (int) $_POST['obsolete']); } dcCore::app()->activityReport->setSetting('mailinglist', explode(';', $_POST['mailinglist'])); dcCore::app()->activityReport->setSetting('mailformat', isset($_POST['mailformat']) && $_POST['mailformat'] == 'html' ? 'html' : 'plain'); dcCore::app()->activityReport->setSetting('dateformat', html::escapeHTML($_POST['dateformat'])); dcCore::app()->activityReport->setSetting('requests', $_POST['requests'] ?? []); dcCore::app()->activityReport->setSetting('blogs', $_POST['blogs'] ?? []); if (!empty($_POST['send_report_now'])) { dcCore::app()->activityReport->needReport(true); dcAdminNotices::addSuccessNotice( __('Report successfully sent.') ); } if (!empty($_POST['delete_report_now'])) { dcCore::app()->activityReport->deleteLogs(); dcAdminNotices::addSuccessNotice( __('Logs successfully deleted.') ); } dcAdminNotices::addSuccessNotice( __('Configuration successfully updated.') ); dcCore::app()->adminurl->redirect('admin.plugins', ['module' => basename(__DIR__), 'conf' => 1, 'super' => $super]); } catch (Exception $e) { dcCore::app()->error->add($e->getMessage()); } } $last_report_ts = dcCore::app()->activityReport->getSetting('lastreport'); if (!$last_report_ts) { $last_report = __('never'); $next_report = __('on new activity'); } else { $last_report = dt::str( dcCore::app()->blog->settings->system->date_format . ', ' . dcCore::app()->blog->settings->system->time_format, $last_report_ts, dcCore::app()->auth->getInfo('user_tz') ); $next_report = dt::str( dcCore::app()->blog->settings->system->date_format . ', ' . dcCore::app()->blog->settings->system->time_format, (int) dcCore::app()->activityReport->getSetting('interval') + $last_report_ts, dcCore::app()->auth->getInfo('user_tz') ); } $emails = implode(';', dcCore::app()->activityReport->getSetting('mailinglist')); echo '
' . ($super ? __('All blogs') : __('Current blog')) . '
'; if (dcCore::app()->auth->isSuperAdmin()) { echo sprintf( '', dcCore::app()->adminurl->get('admin.plugins', ['module' => basename(__DIR__), 'conf' => 1, 'super' => !$super]), sprintf(__('Configure activity report for %s'), $super ? __('current blog') : __('all blogs')) ); } if (!activityReport::hasMailer()) { echo ' '; } echo '' . form::combo('obsolete', $combo_obselete, dcCore::app()->activityReport->getSetting('obsolete')) . '
' . __('Use Dotclear date formaters. ex: %B %d at %H:%M') . '
' . form::hidden(['super'], $super); if (!$super) { echo '' .
'' .
__('Rss2 feed for activity on this blog') . '
' .
'' .
'' .
__('Atom feed for activity on this blog') . '
' . form::combo('interval', $combo_interval, dcCore::app()->activityReport->getSetting('interval')) . '
' . __('Separate multiple email addresses with a semicolon ";"') . '
' . form::combo('mailformat', $combo_format, dcCore::app()->activityReport->getSetting('mailformat')) . '
' . __('Select blogs to add to report') . '
'; $i = $j = 0; $selected_blogs = dcCore::app()->activityReport->getSetting('blogs'); $blogs = dcCore::app()->getBlogs(); $num_blogs = $blogs->count(); while ($blogs->fetch()) { $blog_id = dcCore::app()->con->escape($blogs->blog_id); echo '' . __('Select actions by activity type to add to report') . '
'; $groups = dcCore::app()->activityReport->getGroups(); $blog_request = dcCore::app()->activityReport->getSetting('requests'); $i = 0; foreach ($groups as $group_id => $group) { echo '