prepare to DC 2.24

This commit is contained in:
Jean-Christian Denis 2022-11-18 21:24:30 +01:00
parent ddf5f74c42
commit c2783c2e15
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951
13 changed files with 608 additions and 858 deletions

View file

@ -1,6 +1,11 @@
1.1.1 - dev
todo:
- [ ] use sql statment
- [ ] fix and add actitivy
2.0 - 2022.11.12
- switch to DC 2.24
- use new constant ACTIVTY_REPORT_V2 to not break old install
1.1 - 2021.09.03
- fix Dotclear 2.19 compatibility
- fix pages design

View file

@ -1,78 +1,76 @@
<?php
/**
* @brief activityReport, a plugin for Dotclear 2
*
*
* @package Dotclear
* @subpackage Plugin
*
*
* @author Jean-Christian Denis and contributors
*
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_CONTEXT_ADMIN')) {
return null;
}
if (!defined('ACTIVITY_REPORT')) {
if (!defined('ACTIVITY_REPORT_V2')) {
return null;
}
$_menu['Plugins']->addItem(
dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
__('Activity report'),
$core->adminurl->get('admin.plugin.activityReport'),
dcCore::app()->adminurl->get('admin.plugin.activityReport'),
dcPage::getPF('activityReport/icon.png'),
preg_match(
'/' . preg_quote($core->adminurl->get('admin.plugin.activityReport')) . '(&.*)?$/',
'/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.activityReport')) . '(&.*)?$/',
$_SERVER['REQUEST_URI']
),
$core->auth->check('admin',$core->blog->id)
dcCore::app()->auth->check(dcAuth::PERMISSION_ADMIN, dcCore::app()->blog->id)
);
if ($core->activityReport->getSetting('active')) {
$core->addBehavior('adminDashboardContents', ['activityReportAdmin', 'adminDashboardContents']);
$core->addBehavior('adminDashboardOptionsForm', ['activityReportAdmin', 'adminDashboardOptionsForm']);
$core->addBehavior('adminAfterDashboardOptionsUpdate', ['activityReportAdmin', 'adminAfterDashboardOptionsUpdate']);
if (dcCore::app()->activityReport->getSetting('active')) {
dcCore::app()->addBehavior('adminDashboardContentsV2', ['activityReportAdmin', 'adminDashboardContents']);
dcCore::app()->addBehavior('adminDashboardOptionsFormV2', ['activityReportAdmin', 'adminDashboardOptionsForm']);
dcCore::app()->addBehavior('adminAfterDashboardOptionsUpdate', ['activityReportAdmin', 'adminAfterDashboardOptionsUpdate']);
}
class activityReportAdmin
{
public static function adminDashboardContents(dcCore $core, $items)
public static function adminDashboardContents($items)
{
$core->auth->user_prefs->addWorkspace('activityReport');
$limit = abs((integer) $core->auth->user_prefs->activityReport->dashboard_item);
dcCore::app()->auth->user_prefs->addWorkspace('activityReport');
$limit = abs((int) dcCore::app()->auth->user_prefs->activityReport->dashboard_item);
if (!$limit) {
return null;
}
$p = [
'limit' => $limit,
'order' => 'activity_dt DESC',
'sql' => $core->activityReport->requests2params($core->activityReport->getSetting('requests'))
'sql' => dcCore::app()->activityReport->requests2params(dcCore::app()->activityReport->getSetting('requests')),
];
$lines = [];
$rs = $core->activityReport->getLogs($p);
$rs = dcCore::app()->activityReport->getLogs($p);
if ($rs->isEmpty()) {
return null;
}
$groups = $core->activityReport->getGroups();
while($rs->fetch()) {
$groups = dcCore::app()->activityReport->getGroups();
while ($rs->fetch()) {
$group = $rs->activity_group;
if (!isset($groups[$group])) {
continue;
}
$lines[] =
'<dt title="' . __($groups[$group]['title']) . '">' .
$lines[] = '<dt title="' . __($groups[$group]['title']) . '">' .
'<strong>' . __($groups[$group]['actions'][$rs->activity_action]['title']) . '</strong>' .
'<br />' . dt::str(
$core->blog->settings->system->date_format . ', ' . $core->blog->settings->system->time_format,
dcCore::app()->blog->settings->system->date_format . ', ' . dcCore::app()->blog->settings->system->time_format,
strtotime($rs->activity_dt),
$core->auth->getInfo('user_tz')
dcCore::app()->auth->getInfo('user_tz')
) . '<dt>' .
'<dd><p>' .
'<em>' .vsprintf(
'<em>' . vsprintf(
__($groups[$group]['actions'][$rs->activity_action]['msg']),
$core->activityReport->decode($rs->activity_logs)
dcCore::app()->activityReport->decode($rs->activity_logs)
) . '</em></p></dd>';
}
if (empty($lines)) {
@ -82,48 +80,46 @@ class activityReportAdmin
'<div id="activity-report-logs" class="box medium">' .
'<h3>' . __('Activity report') . '</h3>' .
'<dl id="reports">' . implode('', $lines) . '</dl>' .
'<p class="modules"><a class="module-details" href="'.
$core->adminurl->get('admin.plugin.activityReport') .'">' .
__('View all logs') . '</a> - <a class="module-config" href="'.
$core->adminurl->get('admin.plugins', [
'module' => 'activityReport',
'conf' => 1,
'redir' => $core->adminurl->get('admin.home').'#activity-report-logs'
]) .'">' .
'<p class="modules"><a class="module-details" href="' .
dcCore::app()->adminurl->get('admin.plugin.activityReport') . '">' .
__('View all logs') . '</a> - <a class="module-config" href="' .
dcCore::app()->adminurl->get('admin.plugins', [
'module' => 'activityReport',
'conf' => 1,
'redir' => dcCore::app()->adminurl->get('admin.home') . '#activity-report-logs',
]) . '">' .
__('Configure plugin') . '</a></p>' .
'</div>'
'</div>',
]);
}
public static function adminDashboardOptionsForm(dcCore $core)
public static function adminDashboardOptionsForm()
{
$core->auth->user_prefs->addWorkspace('activityReport');
dcCore::app()->auth->user_prefs->addWorkspace('activityReport');
echo
'<div class="fieldset">' .
'<h4>' . __('Activity report') . '</h4>' .
'<p><label for="activityReport_dashboard_item">' .
'<p><label for="activityReport_dashboard_item">' .
__('Number of activities to show on dashboard:') . '</label>' .
form::combo(
'activityReport_dashboard_item',
self::comboList(),
self::comboList($core->auth->user_prefs->activityReport->dashboard_item)
'activityReport_dashboard_item',
self::comboList(),
self::comboList(dcCore::app()->auth->user_prefs->activityReport->dashboard_item)
) . '</p>' .
'</div>';
}
public static function adminAfterDashboardOptionsUpdate($user_id = null)
{
global $core;
if (is_null($user_id)) {
return;
}
$core->auth->user_prefs->addWorkspace('activityReport');
$core->auth->user_prefs->activityReport->put(
'dashboard_item',
self::comboList(@$_POST['activityReport_dashboard_item']),
dcCore::app()->auth->user_prefs->addWorkspace('activityReport');
dcCore::app()->auth->user_prefs->activityReport->put(
'dashboard_item',
self::comboList(@$_POST['activityReport_dashboard_item']),
'integer'
);
}
@ -132,16 +128,20 @@ class activityReportAdmin
{
$l = [
__('Do not show activity report') => 0,
5 => 5,
10 => 10,
15 => 15,
20 => 20,
50 => 50,
100 => 100
5 => 5,
10 => 10,
15 => 15,
20 => 20,
50 => 50,
100 => 100,
];
if (true === $q) {
return $l;
}
if (!$q) {
$q = -1;
}
return in_array($q, $l) ? $l[$q] : 0;
}
}
}

View file

@ -1,114 +1,112 @@
<?php
/**
* @brief activityReport, a plugin for Dotclear 2
*
*
* @package Dotclear
* @subpackage Plugin
*
*
* @author Jean-Christian Denis and contributors
*
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_CONTEXT_MODULE')) {
return null;
}
$report =& $core->activityReport;
$super = $core->auth->isSuperAdmin() && !empty($_REQUEST['super']);
$redir = empty($_REQUEST['redir']) ? $list->getURL() . '#plugins' : $_REQUEST['redir'];
$super = dcCore::app()->auth->isSuperAdmin() && !empty($_REQUEST['super']);
$redir = empty($_REQUEST['redir']) ? dcCore::app()->admin->list->getURL() . '#plugins' : $_REQUEST['redir'];
if ($super) {
$report->setGlobal();
dcCore::app()->activityReport->setGlobal();
}
$combo_interval = [
__('every hour') => 3600,
__('every 2 hours') => 7200,
__('every hour') => 3600,
__('every 2 hours') => 7200,
__('2 times by day') => 43200,
__('every day') => 86400,
__('every 2 days') => 172800,
__('every week') => 604800
__('every day') => 86400,
__('every 2 days') => 172800,
__('every week') => 604800,
];
$combo_obselete = [
__('every hour') => 3600,
__('every 2 hours') => 7200,
__('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
__('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'
__('HTML') => 'html',
];
if (!empty($_POST['save'])) {
try {
$report->setSetting('active', !empty($_POST['active']));
dcCore::app()->activityReport->setSetting('active', !empty($_POST['active']));
if (in_array($_POST['interval'], $combo_interval)) {
$report->setSetting('interval', (integer) $_POST['interval']);
dcCore::app()->activityReport->setSetting('interval', (int) $_POST['interval']);
}
if (in_array($_POST['obsolete'], $combo_obselete)) {
$report->setSetting('obsolete',(integer) $_POST['obsolete']);
dcCore::app()->activityReport->setSetting('obsolete', (int) $_POST['obsolete']);
}
$report->setSetting('mailinglist', explode(';',$_POST['mailinglist']));
$report->setSetting('mailformat', isset($_POST['mailformat']) && $_POST['mailformat'] == 'html' ? 'html' : 'plain');
$report->setSetting('dateformat', html::escapeHTML($_POST['dateformat']));
$report->setSetting('requests', isset($_POST['requests']) ? $_POST['requests'] : []);
$report->setSetting('blogs', isset($_POST['blogs']) ? $_POST['blogs'] : []);
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'])) {
$core->activityReport->needReport(true);
dcCore::app()->activityReport->needReport(true);
dcPage::addSuccessNotice(
dcAdminNotices::addSuccessNotice(
__('Report successfully sent.')
);
}
if (!empty($_POST['delete_report_now'])) {
$core->activityReport->deleteLogs();
dcCore::app()->activityReport->deleteLogs();
dcPage::addSuccessNotice(
dcAdminNotices::addSuccessNotice(
__('Logs successfully deleted.')
);
}
dcPage::addSuccessNotice(
dcAdminNotices::addSuccessNotice(
__('Configuration successfully updated.')
);
$core->adminurl->redirect('admin.plugins', ['module' => 'activityReport', 'conf' => 1, 'super' => $super]);
dcCore::app()->adminurl->redirect('admin.plugins', ['module' => 'activityReport', 'conf' => 1, 'super' => $super]);
} catch (Exception $e) {
$core->error->add($e->getMessage());
dcCore::app()->error->add($e->getMessage());
}
}
$last_report_ts = $report->getSetting('lastreport');
$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(
$core->blog->settings->system->date_format . ', ' . $core->blog->settings->system->time_format,
$last_report_ts,
$core->auth->getInfo('user_tz')
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(
$core->blog->settings->system->date_format . ', ' . $core->blog->settings->system->time_format,
(integer) $report->getSetting('interval') + $last_report_ts,
$core->auth->getInfo('user_tz')
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(';', $report->getSetting('mailinglist'));
$emails = implode(';', dcCore::app()->activityReport->getSetting('mailinglist'));
if ($core->auth->isSuperAdmin()) {
if (dcCore::app()->auth->isSuperAdmin()) {
echo sprintf(
'<p class="modules right"><a class="module-config" href="%s">%s</a><br class="clear"/></p>' ,
$core->adminurl->get('admin.plugins', ['module' => 'activityReport', 'conf' => 1, 'super' => !$super]),
'<p class="modules right"><a class="module-config" href="%s">%s</a><br class="clear"/></p>',
dcCore::app()->adminurl->get('admin.plugins', ['module' => 'activityReport', 'conf' => 1, 'super' => !$super]),
sprintf(__('Configure activity report for %s'), $super ? __('current blog') : _('all blogs'))
);
}
@ -123,44 +121,45 @@ echo '
<div class="col">
<p><label class="classic" for="active">' .
form::checkbox('active', '1', $report->getSetting('active')).' '.
($super ?
form::checkbox('active', '1', dcCore::app()->activityReport->getSetting('active')) . ' ' .
(
$super ?
__('Enable super administrator report') :
__('Enable report on this blog')
) . '</label></p>
<p><label for="obselete">' . __('Automatic cleaning of old logs:') . '</label>' .
form::combo('obsolete', $combo_obselete, $report->getSetting('obsolete')) . '</p>
form::combo('obsolete', $combo_obselete, dcCore::app()->activityReport->getSetting('obsolete')) . '</p>
<p><label for="dateformat">' . __('Date format:') . '<br />'.
form::field('dateformat', 60, 255, $report->getSetting('dateformat')) . '</label></p>
<p><label for="dateformat">' . __('Date format:') . '<br />' .
form::field('dateformat', 60, 255, dcCore::app()->activityReport->getSetting('dateformat')) . '</label></p>
<p class="form-note">' . __('Use Dotclear date formaters. ex: %B %d at %H:%M') . '</p>' .
form::hidden(['super'], $super);
if (!$super) {
echo
'<p><img alt="'. __('RSS feed') . '" src="' . dcPage::getPF('activityReport/inc/img/feed.png') . '" />' .
'<a title="' . __('RSS feed') . '" href="' .
$core->blog->url . $core->url->getBase('activityReport') . '/rss2/' . $report->getUserCode() . '">' .
echo
'<p><img alt="' . __('RSS feed') . '" src="' . dcPage::getPF('activityReport/inc/img/feed.png') . '" />' .
'<a title="' . __('RSS feed') . '" href="' .
dcCore::app()->blog->url . dcCore::app()->url->getBase('activityReport') . '/rss2/' . dcCore::app()->activityReport->getUserCode() . '">' .
__('Rss2 feed for activity on this blog') . '</a><br />' .
'<img alt="' . __('Atom feed') . '" src="' . dcPage::getPF('activityReport/inc/img/feed.png') . '" />' .
'<a title="' . __('Atom feed') . '" href="' .
$core->blog->url . $core->url->getBase('activityReport') . '/atom/' . $report->getUserCode() . '">' .
'<a title="' . __('Atom feed') . '" href="' .
dcCore::app()->blog->url . dcCore::app()->url->getBase('activityReport') . '/atom/' . dcCore::app()->activityReport->getUserCode() . '">' .
__('Atom feed for activity on this blog') . '</a></p>';
}
echo '
</div><div class="col">
<p><label for="interval">' . __('Send report:').'</label>' .
form::combo('interval', $combo_interval, $report->getSetting('interval')) . '</p>
<p><label for="interval">' . __('Send report:') . '</label>' .
form::combo('interval', $combo_interval, dcCore::app()->activityReport->getSetting('interval')) . '</p>
<p><label for="mailinglist">' . __('Recipients:') . '<br />'.
<p><label for="mailinglist">' . __('Recipients:') . '<br />' .
form::field('mailinglist', 60, 255, $emails) . '</label></p>
<p class="form-note">' . __('Separate multiple email addresses with a semicolon ";"') . '</p>
<p><label for="mailformat">' . __('Report format:') . '</label>' .
form::combo('mailformat', $combo_format, $report->getSetting('mailformat')) . '</p>
<p><label for="mailformat">' . __('Report format:') . '</label>' .
form::combo('mailformat', $combo_format, dcCore::app()->activityReport->getSetting('mailformat')) . '</p>
<ul>
<li>' . __('Last report by email:') . ' ' . $last_report . '</li>
@ -174,21 +173,21 @@ if ($super) {
<div class="fieldset one-box" id="setting_blog"><h4>' . __('Blogs') . '</h4>
<p>' . __('Select blogs to add to report') . '</p>';
$i = $j = 0;
$selected_blogs = $report->getSetting('blogs');
$blogs = $core->getBlogs();
$num_blogs = $blogs->count();
while($blogs->fetch()) {
$blog_id = $core->con->escape($blogs->blog_id);
$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 '
<div class="fieldset box">
<p><label class="classic" for="blogs_' . $i . '_">' .
form::checkbox(
['blogs['.$i.']', 'blogs_' . $i . '_'],
['blogs[' . $i . ']', 'blogs_' . $i . '_'],
$blog_id,
in_array($blog_id,$selected_blogs)
) . ' ' .
in_array($blog_id, $selected_blogs)
) . ' ' .
$blogs->blog_name . ' (' . $blog_id . ')</label></p>
</div>';
@ -200,14 +199,14 @@ echo '
<div class="fieldset one-box" id="setting_report"><h4>' . __('Report') . '</h4>
<p>' . __('Select actions by activity type to add to report') . '</p>';
$groups = $report->getGroups();
$blog_request = $report->getSetting('requests');
$groups = dcCore::app()->activityReport->getGroups();
$blog_request = dcCore::app()->activityReport->getSetting('requests');
$i = 0;
foreach($groups as $group_id => $group) {
echo '<div class="fieldset box"><h5>'. __($group['title']) . '</h5>';
foreach ($groups as $group_id => $group) {
echo '<div class="fieldset box"><h5>' . __($group['title']) . '</h5>';
foreach($group['actions'] as $action_id => $action) {
foreach ($group['actions'] as $action_id => $action) {
echo '
<p><label class="classic" for="requests_' . $group_id . '_' . $action_id . '_">' .
form::checkbox(
@ -225,14 +224,14 @@ if (1) {
<div class="fieldset" id="settings"><h4>' . __('Special') . '</h4>
<p><label class="classic" for="send_report_now">' .
form::checkbox('send_report_now', '1', false).' '.
form::checkbox('send_report_now', '1', false) . ' ' .
__('Send report now') . '</label></p>
<p><label class="classic" for="delete_report_now">' .
form::checkbox('delete_report_now', '1', false).' '.
form::checkbox('delete_report_now', '1', false) . ' ' .
__('Delete all logs now') . '</label></p>
</div>';
}
$report->unsetGlobal();
dcCore::app()->activityReport->unsetGlobal();

View file

@ -1,16 +1,15 @@
<?php
/**
* @brief activityReport, a plugin for Dotclear 2
*
*
* @package Dotclear
* @subpackage Plugin
*
*
* @author Jean-Christian Denis and contributors
*
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_RC_PATH')) {
return null;
}
@ -19,14 +18,18 @@ $this->registerModule(
'Activity report',
'Receive your blog activity by email, feed, or on dashboard',
'Jean-Christian Denis and contributors',
'1.1.1',
'2.0-dev',
[
'requires' => [['core', '2.19']],
'permissions' => 'usage,contentadmin,admin',
'priority' => -1000000,
'type' => 'plugin',
'support' => 'https://github.com/JcDenis/activityReport',
'details' => 'http://plugins.dotaddict.org/dc2/details/activityReport',
'repository' => 'https://raw.githubusercontent.com/JcDenis/activityReport/master/dcstore.xml'
'requires' => [['core', '2.24']],
'permissions' => dcCore::app()->auth->makePermissions([
dcAuth::PERMISSION_USAGE,
dcAuth::PERMISSION_CONTENT_ADMIN,
dcAuth::PERMISSION_ADMIN,
]),
'priority' => -1000000,
'type' => 'plugin',
'support' => 'https://github.com/JcDenis/activityReport',
'details' => 'http://plugins.dotaddict.org/dc2/details/activityReport',
'repository' => 'https://raw.githubusercontent.com/JcDenis/activityReport/master/dcstore.xml',
]
);
);

View file

@ -1,39 +1,38 @@
<?php
/**
* @brief activityReport, a plugin for Dotclear 2
*
*
* @package Dotclear
* @subpackage Plugin
*
*
* @author Jean-Christian Denis and contributors
*
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_CONTEXT_ADMIN')) {
if (!defined('DC_CONTEXT_ADMIN')) {
return null;
}
$new_version = $core->plugins->moduleInfo('activityReport', 'version');
$old_version = $core->getVersion('activityReport');
$new_version = dcCore::app()->plugins->moduleInfo('activityReport', 'version');
$old_version = dcCore::app()->getVersion('activityReport');
if (version_compare($old_version, $new_version, '>=')) {
return null;
}
try {
$s = new dbStruct($core->con, $core->prefix);
$s = new dbStruct(dcCore::app()->con, dcCore::app()->prefix);
$s->activity
->activity_id ('bigint', 0, false)
->activity_type ('varchar', 32, false, "'activityReport'")
->blog_id ('varchar', 32, true)
->activity_id('bigint', 0, false)
->activity_type('varchar', 32, false, "'activityReport'")
->blog_id('varchar', 32, true)
->activity_group('varchar', 32, false)
->activity_action ('varchar', 32, false)
->activity_logs ('text', 0, false)
->activity_dt ('timestamp', 0 ,false, 'now()')
->activity_blog_status ('smallint', 0, false,0)
->activity_super_status ('smallint',0, false,0)
->activity_action('varchar', 32, false)
->activity_logs('text', 0, false)
->activity_dt('timestamp', 0, false, 'now()')
->activity_blog_status('smallint', 0, false, 0)
->activity_super_status('smallint', 0, false, 0)
->primary('pk_activity', 'activity_id')
->index('idx_activity_type', 'btree', 'activity_type')
@ -44,7 +43,7 @@ try {
$s->activity_setting
->setting_id('varchar', 64, false)
->blog_id ('varchar', 32, true)
->blog_id('varchar', 32, true)
->setting_type('varchar', 32, false)
->setting_value('text', 0, false)
@ -52,13 +51,14 @@ try {
->index('idx_activity_setting_blog_id', 'btree', 'blog_id')
->index('idx_activity_setting_type', 'btree', 'setting_type');
$si = new dbStruct($core->con, $core->prefix);
$si = new dbStruct(dcCore::app()->con, dcCore::app()->prefix);
$changes = $si->synchronize($s);
$core->setVersion('activityReport', $new_version);
dcCore::app()->setVersion('activityReport', $new_version);
return true;
} catch (Exception $e) {
$core->error->add($e->getMessage());
dcCore::app()->error->add($e->getMessage());
}
return false;
return false;

View file

@ -1,39 +1,37 @@
<?php
/**
* @brief activityReport, a plugin for Dotclear 2
*
*
* @package Dotclear
* @subpackage Plugin
*
*
* @author Jean-Christian Denis and contributors
*
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_RC_PATH')) {
return null;
}
$d = dirname(__FILE__) . '/inc/';
$__autoload['activityReport'] = $d . 'class.activity.report.php';
$__autoload['activityReportBehaviors'] = $d . 'class.activity.report.behaviors.php';
Clearbricks::lib()->autoload(['activityReport' => __DIR__ . '/inc/class.activity.report.php']);
Clearbricks::lib()->autoload(['activityReportBehaviors' => __DIR__ . '/inc/class.activity.report.behaviors.php']);
try {
if (!defined('ACTIVITY_REPORT')) {
$core->activityReport = new activityReport($core);
if (!defined('ACTIVITY_REPORT_V2')) {
dcCore::app()->__set('activityReport', new activityReport());
$core->url->register(
dcCore::app()->url->register(
'activityReport',
'reports',
'^reports/((atom|rss2)/(.+))$',
['activityReportPublicUrl', 'feed']
);
define('ACTIVITY_REPORT', true);
define('ACTIVITY_REPORT_V2', true);
activityReportBehaviors::registerBehaviors($core);
activityReportBehaviors::registerBehaviors();
}
} catch (Exception $e) {
//throw new Exception('Failed to launch activityReport');
}
}

View file

@ -1,61 +1,61 @@
<?php
/**
* @brief activityReport, a plugin for Dotclear 2
*
*
* @package Dotclear
* @subpackage Plugin
*
*
* @author Jean-Christian Denis and contributors
*
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_RC_PATH')) {
return null;
}
if (!defined('ACTIVITY_REPORT')) {
if (!defined('ACTIVITY_REPORT_V2')) {
return null;
}
$core->tpl->setPath($core->tpl->getPath(), dirname(__FILE__).'/default-templates/tpl');
$core->tpl->addBlock('activityReports', ['activityReportPublicTpl','activityReports']);
$core->tpl->addValue('activityReportFeedID', ['activityReportPublicTpl','activityReportFeedID']);
$core->tpl->addValue('activityReportTitle', ['activityReportPublicTpl','activityReportTitle']);
$core->tpl->addValue('activityReportDate', ['activityReportPublicTpl','activityReportDate']);
$core->tpl->addValue('activityReportContent', ['activityReportPublicTpl','activityReportContent']);
dcCore::app()->tpl->setPath(dcCore::app()->tpl->getPath(), __DIR__ . '/default-templates/tpl');
dcCore::app()->tpl->addBlock('activityReports', ['activityReportPublicTpl','activityReports']);
dcCore::app()->tpl->addValue('activityReportFeedID', ['activityReportPublicTpl','activityReportFeedID']);
dcCore::app()->tpl->addValue('activityReportTitle', ['activityReportPublicTpl','activityReportTitle']);
dcCore::app()->tpl->addValue('activityReportDate', ['activityReportPublicTpl','activityReportDate']);
dcCore::app()->tpl->addValue('activityReportContent', ['activityReportPublicTpl','activityReportContent']);
class activityReportPublicUrl extends dcUrlHandlers
{
public static function feed($args)
public static function feed(?string $args): void
{
global $core, $_ctx;
if (!preg_match('/^(atom|rss2)\/(.+)$/', $args, $m)) {
self::p404();
return;
}
if (!defined('ACTIVITY_REPORT')) {
if (!defined('ACTIVITY_REPORT_V2')) {
self::p404();
return;
}
if (!$core->activityReport->getSetting('active')) {
if (!dcCore::app()->activityReport->getSetting('active')) {
self::p404();
return;
}
$mime = $m[1] == 'atom' ? 'application/atom+xml' : 'application/xml';
if (false === $core->activityReport->checkUserCode($m[2])) {
if (false === dcCore::app()->activityReport->checkUserCode($m[2])) {
self::p404();
return;
}
$_ctx->nb_entry_per_page = $core->blog->settings->system->nb_post_per_feed;
$_ctx->short_feed_items = $core->blog->settings->system->short_feed_items;
dcCore::app()->ctx->nb_entry_per_page = (int) dcCore::app()->blog->settings->system->nb_post_per_feed;
dcCore::app()->ctx->short_feed_items = (int) dcCore::app()->blog->settings->system->short_feed_items;
header('X-Robots-Tag: '. context::robotsPolicy($core->blog->settings->system->robots_policy, ''));
header('X-Robots-Tag: ' . context::robotsPolicy(dcCore::app()->blog->settings->system->robots_policy, ''));
self::serveDocument('activityreport-' . $m[1] . '.xml', $mime);
return;
}
}
@ -65,51 +65,53 @@ class activityReportPublicTpl
{
$lastn = 0;
if (isset($attr['lastn'])) {
$lastn = abs((integer) $attr['lastn']) + 0;
$lastn = abs((int) $attr['lastn']) + 0;
}
$p = 'if (!isset($_page_number)) { $_page_number = 1; }' . "\n\$params = array();\n";
$p = '$_page_number = dcCore::app()->public->getPageNumber(); if ($_page_number < 1) { $_page_number = 1; }' . "\n\$params = array();\n";
if ($lastn > 0) {
$p .= "\$params['limit'] = " . $lastn . ";\n";
} else {
$p .= "\$params['limit'] = \$_ctx->nb_entry_per_page;\n";
$p .= "\$params['limit'] = dcCore::app()->ctx->nb_entry_per_page;\n";
}
if (!isset($attr['ignore_pagination']) || $attr['ignore_pagination'] == "0") {
if (!isset($attr['ignore_pagination']) || $attr['ignore_pagination'] == '0') {
$p .= "\$params['limit'] = array(((\$_page_number-1)*\$params['limit']),\$params['limit']);\n";
} else {
$p .= "\$params['limit'] = array(0, \$params['limit']);\n";
}
return
return
"<?php \n" .
$p .
'$_ctx->activityreport_params = $params; ' . "\n" .
'$_ctx->activityreports = $core->activityReport->getLogs($params); unset($params); ' . "\n" .
'while ($_ctx->activityreports->fetch()) : ?>'.$content.'<?php endwhile; ' .
'$_ctx->activityreports = null; $_ctx->activityreport_params = null; ' . "\n" .
"?>";
'dcCore::app()->ctx->activityreport_params = $params; ' . "\n" .
'dcCore::app()->ctx->activityreports = dcCore::app()->activityReport->getLogs($params); unset($params); ' . "\n" .
'while (dcCore::app()->ctx->activityreports->fetch()) : ?>' . $content . '<?php endwhile; ' .
'dcCore::app()->ctx->pop("activityreports"); dcCore::app()->ctx->pop("activityreport_params"); ' . "\n" .
'?>';
}
public static function activityReportFeedID($attr)
{
return
'urn:md5:<?php echo md5($_ctx->activityreports->blog_id.' .
'$_ctx->activityreports->activity_id.$_ctx->activityreports->activity_dt); ' .
return
'urn:md5:<?php echo md5(dcCore::app()->ctx->activityreports->blog_id.' .
'dcCore::app()->ctx->activityreports->activity_id.dcCore::app()->ctx->activityreports->activity_dt); ' .
'?>';
}
public static function activityReportTitle($attr)
{
$f = $GLOBALS['core']->tpl->getFilters($attr);
return '<?php echo ' . sprintf($f,'activityReportContext::parseTitle()') . '; ?>';
$f = dcCore::app()->tpl->getFilters($attr);
return '<?php echo ' . sprintf($f, 'activityReportContext::parseTitle()') . '; ?>';
}
public static function activityReportContent($attr)
{
$f = $GLOBALS['core']->tpl->getFilters($attr);
return '<?php echo ' . sprintf($f,'activityReportContext::parseContent()') . '; ?>';
$f = dcCore::app()->tpl->getFilters($attr);
return '<?php echo ' . sprintf($f, 'activityReportContext::parseContent()') . '; ?>';
}
public static function activityReportDate($attr)
@ -120,19 +122,19 @@ class activityReportPublicTpl
}
$iso8601 = !empty($attr['iso8601']);
$rfc822 = !empty($attr['rfc822']);
$rfc822 = !empty($attr['rfc822']);
$f = $GLOBALS['core']->tpl->getFilters($attr);
$f = dcCore::app()->tpl->getFilters($attr);
if ($rfc822) {
return '<?php echo ' . sprintf($f,"dt::rfc822(strtotime(\$_ctx->activityreports->activity_dt),\$core->blog->settings->system->blog_timezone)") . '; ?>';
return '<?php echo ' . sprintf($f, 'dt::rfc822(strtotime(dcCore::app()->ctx->activityreports->activity_dt),dcCore::app()->blog->settings->system->blog_timezone)') . '; ?>';
} elseif ($iso8601) {
return '<?php echo ' . sprintf($f,"dt::iso8601(strtotime(\$_ctx->activityreports->activity_dt),\$core->blog->settings->system->blog_timezone)") . '; ?>';
return '<?php echo ' . sprintf($f, 'dt::iso8601(strtotime(dcCore::app()->ctx->activityreports->activity_dt),dcCore::app()->blog->settings->system->blog_timezone)') . '; ?>';
} elseif (!empty($format)) {
return '<?php echo ' . sprintf($f,"dt::dt2str('" . $format . "',\$_ctx->activityreports->activity_dt)") . '; ?>';
} else {
return '<?php echo ' . sprintf($f,"dt::dt2str(\$core->blog->settings->system->date_format,\$_ctx->activityreports->activity_dt)") . '; ?>';
return '<?php echo ' . sprintf($f, "dt::dt2str('" . $format . "',dcCore::app()->ctx->activityreports->activity_dt)") . '; ?>';
}
return '<?php echo ' . sprintf($f, 'dt::dt2str(dcCore::app()->blog->settings->system->date_format,dcCore::app()->ctx->activityreports->activity_dt)') . '; ?>';
}
}
@ -140,34 +142,33 @@ class activityReportContext
{
public static function parseTitle()
{
global $core,$_ctx;
$groups = dcCore::app()->activityReport->getGroups();
$groups = $core->activityReport->getGroups();
$group = $_ctx->activityreports->activity_group;
$action = $_ctx->activityreports->activity_action;
$group = dcCore::app()->ctx->activityreports->activity_group;
$action = dcCore::app()->ctx->activityreports->activity_action;
if (!empty($groups[$group]['actions'][$action]['title'])) {
return __($groups[$group]['actions'][$action]['title']);
}
return '';
}
public static function parseContent()
{
global $core,$_ctx;
$groups = dcCore::app()->activityReport->getGroups();
$groups = $core->activityReport->getGroups();
$group = $_ctx->activityreports->activity_group;
$action = $_ctx->activityreports->activity_action;
$logs = $_ctx->activityreports->activity_logs;
$logs = $core->activityReport->decode($logs);
$group = dcCore::app()->ctx->activityreports->activity_group;
$action = dcCore::app()->ctx->activityreports->activity_action;
$logs = dcCore::app()->ctx->activityreports->activity_logs;
$logs = dcCore::app()->activityReport->decode($logs);
if (!empty($groups[$group]['actions'][$action]['msg'])) {
$core->initWikiComment();
return $core->wikiTransform(vsprintf(__($groups[$group]['actions'][$action]['msg']),$logs));
dcCore::app()->initWikiComment();
return dcCore::app()->wikiTransform(vsprintf(__($groups[$group]['actions'][$action]['msg']), $logs));
}
return '';
}
}
}

View file

@ -1,58 +1,81 @@
<?php
/**
* @brief activityReport, a plugin for Dotclear 2
*
*
* @package Dotclear
* @subpackage Plugin
*
*
* @author Jean-Christian Denis and contributors
*
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_CONTEXT_ADMIN')) {
return null;
}
$this->addUserAction(
/* type */ 'tables',
/* action */ 'delete',
/* ns */ 'activity',
/* description */ sprintf(__('delete %s table'), '"activity"')
/* type */
'tables',
/* action */
'delete',
/* ns */
'activity',
/* description */
sprintf(__('delete %s table'), '"activity"')
);
$this->addUserAction(
/* type */ 'tables',
/* action */ 'delete',
/* ns */ 'activity_setting',
/* description */ sprintf(__('delete %s table'), '"activity_setting"')
/* type */
'tables',
/* action */
'delete',
/* ns */
'activity_setting',
/* description */
sprintf(__('delete %s table'), '"activity_setting"')
);
$this->addUserAction(
/* type */ 'plugins',
/* action */ 'delete',
/* ns */ 'activityReport',
/* description */ __('delete plugin files')
/* type */
'plugins',
/* action */
'delete',
/* ns */
'activityReport',
/* description */
__('delete plugin files')
);
$this->addUserAction(
/* type */ 'versions',
/* action */ 'delete',
/* ns */ 'activityReport',
/* description */ __('delete the version number')
/* type */
'versions',
/* action */
'delete',
/* ns */
'activityReport',
/* description */
__('delete the version number')
);
$this->addDirectAction(
/* type */ 'versions',
/* action */ 'delete',
/* ns */ 'activityReport',
/* description */ sprintf(__('delete %s version number'), 'activityReport')
/* type */
'versions',
/* action */
'delete',
/* ns */
'activityReport',
/* description */
sprintf(__('delete %s version number'), 'activityReport')
);
$this->addDirectAction(
/* type */ 'plugins',
/* action */ 'delete',
/* ns */ 'activityReport',
/* description */ sprintf(__('delete %s plugin files'), 'activityReport')
);
/* type */
'plugins',
/* action */
'delete',
/* ns */
'activityReport',
/* description */
sprintf(__('delete %s plugin files'), 'activityReport')
);

View file

@ -1,33 +1,31 @@
<?php
/**
* @brief activityReport, a plugin for Dotclear 2
*
*
* @package Dotclear
* @subpackage Plugin
*
*
* @author Jean-Christian Denis and contributors
*
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_RC_PATH')) {
return null;
}
if (!defined('ACTIVITY_REPORT')) {
if (!defined('ACTIVITY_REPORT_V2')) {
return null;
}
class activityReportBehaviors
{
public static function registerBehaviors($core)
public static function registerBehaviors()
{
// ActivityReport plugin
$core->activityReport->addGroup('activityReport', __('ActivityReport messages'));
// ActivityReport plugin
dcCore::app()->activityReport->addGroup('activityReport', __('ActivityReport messages'));
$core->activityReport->addAction(
dcCore::app()->activityReport->addAction(
'activityReport',
'message',
__('Special messages'),
@ -36,13 +34,13 @@ class activityReportBehaviors
['activityReportBehaviors', 'messageActivityReport']
);
// Blog
$core->activityReport->addGroup('blog', __('Actions on blog'));
// Blog
dcCore::app()->activityReport->addGroup('blog', __('Actions on blog'));
// Not use as it is global : BEHAVIOR adminAfterBlogCreate in admin/blog.php
// from BEHAVIOR adminAfterBlogUpdate in admin/blog_pref.php
$core->activityReport->addAction(
dcCore::app()->activityReport->addAction(
'blog',
'update',
__('updating blog'),
@ -52,7 +50,7 @@ class activityReportBehaviors
);
// from BEHAVIOR publicHeadContent in template
$core->activityReport->addAction(
dcCore::app()->activityReport->addAction(
'blog',
'p404',
__('404 error'),
@ -61,13 +59,13 @@ class activityReportBehaviors
['activityReportBehaviors', 'blogP404']
);
// Post
$core->activityReport->addGroup('post', __('Actions on posts'));
// Post
dcCore::app()->activityReport->addGroup('post', __('Actions on posts'));
// from BEHAVIOR coreAfterPostCreate in inc/core/class.dc.blog.php (DC 2.2)
// duplicate adminAfterPostCreate in admin/post.php
// duplicate adminAfterPostCreate in admin/services.php
$core->activityReport->addAction(
dcCore::app()->activityReport->addAction(
'post',
'create',
__('post creation'),
@ -78,7 +76,7 @@ class activityReportBehaviors
// Plugin contribute
// from BEHAVIOR publicAfterPostCreate in plugins/contribute/_public.php
$core->activityReport->addAction(
dcCore::app()->activityReport->addAction(
'post',
'create',
__('post creation'),
@ -89,7 +87,7 @@ class activityReportBehaviors
// from BEHAVIOR coreAfterPostUpdate in inc/core/class.dc.blog.php (DC2.2)
// duplicate adminAfterPostUpdate in admin/post.php
$core->activityReport->addAction(
dcCore::app()->activityReport->addAction(
'post',
'update',
__('updating post'),
@ -100,7 +98,7 @@ class activityReportBehaviors
// from BEHAVIOR adminBeforePostDelete in admin/posts_actions.php
// from BEHAVIOR adminBeforePostDelete in admin/post.php
$core->activityReport->addAction(
dcCore::app()->activityReport->addAction(
'post',
'delete',
__('post deletion'),
@ -111,7 +109,7 @@ class activityReportBehaviors
// Wrong attempt on passworded enrty
// from BEHAVIOR urlHandlerServeDocument in inc/public/lib.urlhandlers.php
$core->activityReport->addAction(
dcCore::app()->activityReport->addAction(
'post',
'protection',
__('Post protection'),
@ -121,12 +119,12 @@ class activityReportBehaviors
);
// Comment
$core->activityReport->addGroup('comment',__('Actions on comments'));
dcCore::app()->activityReport->addGroup('comment', __('Actions on comments'));
// from BEHAVIOR coreAfterCommentCreate in inc/core/class.dc.blog.php
// duplicate adminAfterCommentCreate in admin/comment.php
// duplicate publicAfterCommentCreate in inc/public/lib.urlhandlers.php
$core->activityReport->addAction(
dcCore::app()->activityReport->addAction(
'comment',
'create',
__('comment creation'),
@ -137,7 +135,7 @@ class activityReportBehaviors
// from BEHAVIOR coreAfterCommentUpdate in inc/core/class.dc.blog.php
// duplicate adminAfterCommentUpdate in admin/comment.php
$core->activityReport->addAction(
dcCore::app()->activityReport->addAction(
'comment',
'update',
__('updating comment'),
@ -146,12 +144,12 @@ class activityReportBehaviors
['activityReportBehaviors', 'commentUpdate']
);
// Missing coreBeforeCommentDelete in inc/core/class.dc.blog.php
// Missing coreBeforeCommentDelete in inc/core/class.dc.blog.php
// Missing adminBeforeCommentDelete in admin/comment.php
// from BEHAVIOR coreAfterCommentCreate in inc/core/class.dc.blog.php
// duplicate publicAfterTrackbackCreate in inc/core/class.dc.trackback.php
$core->activityReport->addAction(
dcCore::app()->activityReport->addAction(
'comment',
'trackback',
__('trackback creation'),
@ -160,11 +158,11 @@ class activityReportBehaviors
['activityReportBehaviors', 'trackbackCreate']
);
// Category
$core->activityReport->addGroup('category', __('Actions on categories'));
// Category
dcCore::app()->activityReport->addGroup('category', __('Actions on categories'));
// from BEHAVIOR adminAfterCategoryCreate in admin/category.php
$core->activityReport->addAction(
dcCore::app()->activityReport->addAction(
'category',
'create',
__('category creation'),
@ -174,7 +172,7 @@ class activityReportBehaviors
);
// from BEHAVIOR adminAfterCategoryUpdate in admin/category.php
$core->activityReport->addAction(
dcCore::app()->activityReport->addAction(
'category',
'update',
__('updating category'),
@ -185,11 +183,11 @@ class activityReportBehaviors
// Missing adminBeforeCategoryDelete in admin/category.php
// User
$core->activityReport->addGroup('user', __('Actions on users'));
// User
dcCore::app()->activityReport->addGroup('user', __('Actions on users'));
// from BEHAVIOR adminAfterUserCreate in admin/user.php
$core->activityReport->addAction(
dcCore::app()->activityReport->addAction(
'user',
'create',
__('user creation'),
@ -199,7 +197,7 @@ class activityReportBehaviors
);
// from BEHAVIOR adminAfterUserUpdated in admin/user.php
$core->activityReport->addAction(
dcCore::app()->activityReport->addAction(
'user',
'update',
__('updating user'),
@ -209,7 +207,7 @@ class activityReportBehaviors
);
// from BEHAVIOR adminBeforeUserDelete in admin/users.php
$core->activityReport->addAction(
dcCore::app()->activityReport->addAction(
'user',
'delete',
__('user deletion'),
@ -221,118 +219,109 @@ class activityReportBehaviors
public static function messageActivityReport($message)
{
global $core;
$logs = [$message];
$core->activityReport->addLog('activityReport', 'message', $logs);
dcCore::app()->activityReport->addLog('activityReport', 'message', $logs);
}
public static function blogUpdate($cur, $blog_id)
{
global $core;
$logs = [$core->auth->getInfo('user_cn')];
$core->activityReport->addLog('blog', 'update' ,$logs);
$logs = [dcCore::app()->auth->getInfo('user_cn')];
dcCore::app()->activityReport->addLog('blog', 'update', $logs);
}
public static function blogP404()
{
global $core;
if ($core->url->type != '404') {
if (dcCore::app()->url->type != '404') {
return null;
}
$logs = [$core->blog->url . $_SERVER['QUERY_STRING']];
$core->activityReport->addLog('blog', 'p404', $logs);
$logs = [dcCore::app()->blog->url . $_SERVER['QUERY_STRING']];
dcCore::app()->activityReport->addLog('blog', 'p404', $logs);
}
public static function postCreate($cur, $post_id)
{
global $core;
$type = $cur->post_type ? $cur->post_type : 'post';
$post_url = $core->blog->getPostURL('', $cur->post_dt, $cur->post_title, $post_id);
$logs = [
$type = $cur->post_type ? $cur->post_type : 'post';
$post_url = dcCore::app()->blog->getPostURL('', $cur->post_dt, $cur->post_title, $post_id);
$logs = [
$cur->post_title,
$core->auth->getInfo('user_cn'),
$core->blog->url . $core->url->getBase($type) . '/' . $post_url
dcCore::app()->auth->getInfo('user_cn'),
dcCore::app()->blog->url . dcCore::app()->url->getBase($type) . '/' . $post_url,
];
$core->activityReport->addLog('post', 'create', $logs);
dcCore::app()->activityReport->addLog('post', 'create', $logs);
}
public static function postUpdate($cur, $post_id)
{
global $core;
$type = $cur->post_type ? $cur->post_type : 'post';
$post_url = $core->blog->getPostURL('', $cur->post_dt, $cur->post_title, $post_id);
$logs = [
$type = $cur->post_type ? $cur->post_type : 'post';
$post_url = dcCore::app()->blog->getPostURL('', $cur->post_dt, $cur->post_title, $post_id);
$logs = [
$cur->post_title,
$core->auth->getInfo('user_cn'),
$core->blog->url . $core->url->getBase($type) . '/' . $post_url
dcCore::app()->auth->getInfo('user_cn'),
dcCore::app()->blog->url . dcCore::app()->url->getBase($type) . '/' . $post_url,
];
$core->activityReport->addLog('post', 'update', $logs);
dcCore::app()->activityReport->addLog('post', 'update', $logs);
}
public static function postDelete($post_id)
{
global $core;
$posts = $core->blog->getPosts(['post_id' => $post_id, 'limit' => 1]);
$logs = [
$posts = dcCore::app()->blog->getPosts(['post_id' => $post_id, 'limit' => 1]);
$logs = [
$posts->post_title,
$core->auth->getInfo('user_cn')
dcCore::app()->auth->getInfo('user_cn'),
];
$core->activityReport->addLog('post', 'delete', $logs);
dcCore::app()->activityReport->addLog('post', 'delete', $logs);
}
public static function postPasswordAttempt($result)
{
global $core;
if ($result['tpl'] != 'password-form.html' || empty($_POST['password'])) {
return null;
}
$logs = [
$_POST['password'],
http::getSelfURI()
http::getSelfURI(),
];
$core->activityReport->addLog('post', 'protection', $logs);
dcCore::app()->activityReport->addLog('post', 'protection', $logs);
}
public static function commentCreate($blog, $cur)
{
global $core;
if ($cur->comment_trackback) {
return null;
}
$posts = $core->blog->getPosts(['post_id' => $cur->post_id, 'limit' => 1]);
$logs = [
$posts = dcCore::app()->blog->getPosts(['post_id' => $cur->post_id, 'limit' => 1]);
$logs = [
$cur->comment_author,
$posts->post_title,
$core->blog->url . $core->url->getBase($posts->post_type) .
'/' . $posts->post_url . '#c' . $cur->comment_id
dcCore::app()->blog->url . dcCore::app()->url->getBase($posts->post_type) .
'/' . $posts->post_url . '#c' . $cur->comment_id,
];
$core->activityReport->addLog('comment', 'create', $logs);
dcCore::app()->activityReport->addLog('comment', 'create', $logs);
}
public static function commentUpdate($blog, $cur, $old)
{
global $core;
$posts = $core->blog->getPosts(['post_id' => $old->post_id, 'limit' => 1]);
$posts = dcCore::app()->blog->getPosts(['post_id' => $old->post_id, 'limit' => 1]);
$logs = [
$core->auth->getInfo('user_cn'),
dcCore::app()->auth->getInfo('user_cn'),
$posts->post_title,
$core->blog->url . $core->url->getBase($posts->post_type) .
'/' . $posts->post_url . '#c' . $old->comment_id
dcCore::app()->blog->url . dcCore::app()->url->getBase($posts->post_type) .
'/' . $posts->post_url . '#c' . $old->comment_id,
];
$core->activityReport->addLog('comment', 'update', $logs);
dcCore::app()->activityReport->addLog('comment', 'update', $logs);
}
public static function trackbackCreate($cur, $comment_id)
{
global $core;
// From blog args are $blog, $cur #thks to bruno
$c = $cur instanceOf dcBlog ? $comment_id : $cur;
$c = $cur instanceof dcBlog ? $comment_id : $cur;
if (!$c->comment_trackback || !$c->comment_site) {
return null;
}
$posts = $core->blog->getPosts(
['post_id' => $c->post_id, 'no_content' => true, 'limit' => 1]);
$posts = dcCore::app()->blog->getPosts(
['post_id' => $c->post_id, 'no_content' => true, 'limit' => 1]
);
if ($posts->isEmpty()) {
return null;
}
@ -340,80 +329,75 @@ class activityReportBehaviors
$c->comment_author,
$c->comment_site,
$posts->post_title,
$core->blog->url . $core->url->getBase($posts->post_type) .
'/' . $posts->post_url
dcCore::app()->blog->url . dcCore::app()->url->getBase($posts->post_type) .
'/' . $posts->post_url,
];
$core->activityReport->addLog('comment', 'trackback', $logs);
dcCore::app()->activityReport->addLog('comment', 'trackback', $logs);
}
public static function categoryCreate($cur, $cat_id)
{
global $core;
$logs = [
$cur->cat_title,
$core->auth->getInfo('user_cn'),
$core->blog->url . $core->url->getBase('category') . '/' . $cur->cat_url
dcCore::app()->auth->getInfo('user_cn'),
dcCore::app()->blog->url . dcCore::app()->url->getBase('category') . '/' . $cur->cat_url,
];
$core->activityReport->addLog('category', 'create', $logs);
dcCore::app()->activityReport->addLog('category', 'create', $logs);
}
public static function categoryUpdate($cur, $cat_id)
{
global $core;
$logs = [
$cur->cat_title,
$core->auth->getInfo('user_cn'),
$core->blog->url . $core->url->getBase('category') . '/' . $cur->cat_url
dcCore::app()->auth->getInfo('user_cn'),
dcCore::app()->blog->url . dcCore::app()->url->getBase('category') . '/' . $cur->cat_url,
];
$core->activityReport->addLog('category', 'update', $logs);
dcCore::app()->activityReport->addLog('category', 'update', $logs);
}
public static function userCreate($cur, $user_id)
{
global $core;
$user_cn = dcUtils::getUserCN(
$cur->user_id,
$cur->user_id,
$cur->user_name,
$cur->user_firstname,
$cur->user_firstname,
$cur->user_displayname
);
$logs = [
$user_cn,
$core->auth->getInfo('user_cn')
dcCore::app()->auth->getInfo('user_cn'),
];
$core->activityReport->addLog('user', 'create', $logs);
dcCore::app()->activityReport->addLog('user', 'create', $logs);
}
public static function usertUpdate($cur, $user_id)
{
global $core;
$user_cn = dcUtils::getUserCN(
$cur->user_id,
$cur->user_id,
$cur->user_name,
$cur->user_firstname,
$cur->user_firstname,
$cur->user_displayname
);
$logs = [
$user_cn,
$core->auth->getInfo('user_cn')
dcCore::app()->auth->getInfo('user_cn'),
];
$core->activityReport->addLog('user', 'update', $logs);
dcCore::app()->activityReport->addLog('user', 'update', $logs);
}
public static function userDelete($user_id)
{
global $core;
$users = $core->getUser($id);
$users = dcCore::app()->getUser($user_id);
$user_cn = dcUtils::getUserCN(
$users->user_id,
$users->user_id,
$users->user_name,
$users->user_firstname,
$users->user_firstname,
$users->user_displayname
);
$logs = [
$user_cn,
$core->auth->getInfo('user_cn')
dcCore::app()->auth->getInfo('user_cn'),
];
$core->activityReport->addLog('user', 'delete', $logs);
dcCore::app()->activityReport->addLog('user', 'delete', $logs);
}
}
}

View file

@ -1,39 +1,38 @@
<?php
/**
* @brief activityReport, a plugin for Dotclear 2
*
*
* @package Dotclear
* @subpackage Plugin
*
*
* @author Jean-Christian Denis and contributors
*
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_RC_PATH')){return;}
if (!defined('DC_RC_PATH')) {
return;
}
class activityReport
{
public $core;
public $con;
private $ns = 'activityReport';
private $_global = 0;
private $blog = null;
private $table = '';
private $groups = [];
private $settings = [];
private $lock_blog = null;
private $ns = 'activityReport';
private $_global = 0;
private $blog = null;
private $table = '';
private $groups = [];
private $settings = [];
private $lock_blog = null;
private $lock_global = null;
public function __construct($core, $ns = 'activityReport')
public function __construct($ns = 'activityReport')
{
$this->core =& $core;
$this->con = $core->con;
$this->table = $core->prefix . 'activity';
$this->blog = $core->con->escape($core->blog->id);
$this->ns = $core->con->escape($ns);
$this->con = dcCore::app()->con;
$this->table = dcCore::app()->prefix . 'activity';
$this->blog = dcCore::app()->con->escape(dcCore::app()->blog->id);
$this->ns = dcCore::app()->con->escape($ns);
$this->getSettings();
@ -54,49 +53,51 @@ class activityReport
public function getGroups($group = null, $action = null)
{
if ($action !== null) {
return isset($this->groups[$group]['actions'][$action]) ?
$this->groups[$group]['actions'][$action] : null;
return $this->groups[$group]['actions'][$action] ?? null;
} elseif ($group !== null) {
return isset($this->groups[$group]) ?
$this->groups[$group] : null;
} else {
return $this->groups;
return $this->groups[$group] ?? null;
}
return $this->groups;
}
public function addGroup($group, $title)
{
$this->groups[$group] = [
'title' => $title,
'actions' => []
'title' => $title,
'actions' => [],
];
return true;
}
public function addAction($group, $action, $title, $msg, $behavior, $function)
{
if (!isset($this->groups[$group])) return false;
if (!isset($this->groups[$group])) {
return false;
}
$this->groups[$group]['actions'][$action] = [
'title' => $title,
'msg' => $msg
'msg' => $msg,
];
$this->core->addBehavior($behavior, $function);
dcCore::app()->addBehavior($behavior, $function);
return true;
}
private function getSettings()
{
$settings = [
'active' => false,
'obsolete' => 2419200,
'interval' => 86400,
'lastreport' => 0,
'active' => false,
'obsolete' => 2419200,
'interval' => 86400,
'lastreport' => 0,
'mailinglist' => [],
'mailformat' => 'plain',
'dateformat' => '%Y-%m-%d %H:%M:%S',
'requests' => [],
'blogs' => []
'mailformat' => 'plain',
'dateformat' => '%Y-%m-%d %H:%M:%S',
'requests' => [],
'blogs' => [],
];
$this->settings[0] = $this->settings[1] = $settings;
@ -109,7 +110,7 @@ class activityReport
'ORDER BY setting_id DESC '
);
while($rs->fetch()) {
while ($rs->fetch()) {
$k = $rs->f('setting_id');
$v = $rs->f('setting_value');
$b = $rs->f('blog_id');
@ -139,9 +140,9 @@ class activityReport
$cur = $this->con->openCursor($this->table . '_setting');
$this->con->writeLock($this->table . '_setting');
$cur->blog_id = $this->_global ? null : $this->blog;
$cur->setting_id = $this->con->escape($n);
$cur->setting_type = $this->ns;
$cur->blog_id = $this->_global ? null : $this->blog;
$cur->setting_id = $this->con->escape($n);
$cur->setting_type = $this->ns;
$cur->setting_value = (string) self::encode($v);
$cur->insert();
@ -156,7 +157,7 @@ class activityReport
{
return $this->con->execute(
'DELETE FROM ' . $this->table . '_setting ' .
"WHERE blog_id" . ($this->_global ? ' IS NULL' : "='" . $this->blog . "'") . ' ' .
'WHERE blog_id' . ($this->_global ? ' IS NULL' : "='" . $this->blog . "'") . ' ' .
"AND setting_id='" . $this->con->escape($n) . "' " .
"AND setting_type='" . $this->ns . "' "
);
@ -166,11 +167,12 @@ class activityReport
public static function requests2params($requests)
{
$r = [];
foreach($requests as $group => $actions) {
foreach($actions as $action => $is) {
$r[] = "activity_group='" . $group ."' AND activity_action='" . $action . "' ";
foreach ($requests as $group => $actions) {
foreach ($actions as $action => $is) {
$r[] = "activity_group='" . $group . "' AND activity_action='" . $action . "' ";
}
}
return empty($r) ? '' : 'AND (' . implode('OR ', $r) . ') ';
}
@ -181,28 +183,26 @@ class activityReport
} else {
$content_r = empty($p['no_content']) ? 'activity_logs, ' : '';
if (!empty($params['columns']) && is_array($params['columns'])) {
$content_r .= implode(', ', $params['columns']) . ', ';
if (!empty($p['columns']) && is_array($p['columns'])) {
$content_r .= implode(', ', $p['columns']) . ', ';
}
$r =
'SELECT E.activity_id, E.blog_id, B.blog_url, B.blog_name, ' . $content_r .
$r = 'SELECT E.activity_id, E.blog_id, B.blog_url, B.blog_name, ' . $content_r .
'E.activity_group, E.activity_action, E.activity_dt, ' .
'E.activity_blog_status, E.activity_super_status ';
}
$r .=
'FROM ' . $this->table . ' E ' .
'LEFT JOIN ' . $this->core->prefix . 'blog B on E.blog_id=B.blog_id ';
$r .= 'FROM ' . $this->table . ' E ' .
'LEFT JOIN ' . dcCore::app()->prefix . 'blog B on E.blog_id=B.blog_id ';
if (!empty($p['from'])) {
$r .= $p['from'] . ' ';
}
if ($this->_global) {
$r .= "WHERE E.activity_super_status = 0 ";
$r .= 'WHERE E.activity_super_status = 0 ';
} else {
$r .= "WHERE E.activity_blog_status = 0 ";
$r .= 'WHERE E.activity_blog_status = 0 ';
}
if (!empty($p['activity_type'])) {
@ -212,12 +212,12 @@ class activityReport
}
if (!empty($p['blog_id'])) {
if(is_array($p['blog_id'])) {
if (is_array($p['blog_id'])) {
$r .= 'AND E.blog_id' . $this->con->in($p['blog_id']);
} else {
$r .= "AND E.blog_id = '" . $this->con->escape($p['blog_id']) . "' ";
}
} elseif($this->_global) {
} elseif ($this->_global) {
$r .= 'AND E.blog_id IS NOT NULL ';
} else {
$r .= "AND E.blog_id='" . $this->blog . "' ";
@ -240,19 +240,19 @@ class activityReport
}
if (isset($p['activity_blog_status'])) {
$r .= "AND E.activity_blog_status = " . ((integer) $p['activity_blog_status']) . " ";
$r .= 'AND E.activity_blog_status = ' . ((int) $p['activity_blog_status']) . ' ';
}
if (isset($p['activity_super_status'])) {
$r .= "AND E.activity_super_status = " . ((integer) $p['activity_super_status']) . " ";
$r .= 'AND E.activity_super_status = ' . ((int) $p['activity_super_status']) . ' ';
}
if (isset($p['from_date_ts'])) {
$dt = date('Y-m-d H:i:s',$p['from_date_ts']);
$dt = date('Y-m-d H:i:s', $p['from_date_ts']);
$r .= "AND E.activity_dt >= TIMESTAMP '" . $dt . "' ";
}
if (isset($p['to_date_ts'])) {
$dt = date('Y-m-d H:i:s',$p['to_date_ts']);
$dt = date('Y-m-d H:i:s', $p['to_date_ts']);
$r .= "AND E.activity_dt < TIMESTAMP '" . $dt . "' ";
}
@ -281,19 +281,19 @@ class activityReport
$cur = $this->con->openCursor($this->table);
$this->con->writeLock($this->table);
$cur->activity_id = $this->getNextId();
$cur->activity_type = $this->ns;
$cur->blog_id = $this->blog;
$cur->activity_group = $this->con->escape((string) $group);
$cur->activity_id = $this->getNextId();
$cur->activity_type = $this->ns;
$cur->blog_id = $this->blog;
$cur->activity_group = $this->con->escape((string) $group);
$cur->activity_action = $this->con->escape((string) $action);
$cur->activity_logs = self::encode($logs);
$cur->activity_dt = date('Y-m-d H:i:s');
$cur->activity_logs = self::encode($logs);
$cur->activity_dt = date('Y-m-d H:i:s');
$cur->insert();
$this->con->unlock();
} catch (Exception $e) {
$this->con->unlock();
$this->core->error->add($e->getMessage());
dcCore::app()->error->add($e->getMessage());
}
// Test if email report is needed
@ -307,12 +307,12 @@ class activityReport
}
// @todo move this in function
include dirname(__FILE__) . '/lib.parselogs.config.php';
include __DIR__ . '/lib.parselogs.config.php';
$from = time();
$to = 0;
$res = $blog = $group = '';
$tz = $this->_global ? 'UTC' : $this->core->blog->settings->system->blog_timezone;
$to = 0;
$res = $blog = $group = '';
$tz = $this->_global ? 'UTC' : dcCore::app()->blog->settings->system->blog_timezone;
$dt = $this->settings[$this->_global]['dateformat'];
$dt = empty($dt) ? '%Y-%m-%d %H:%M:%S' : $dt;
@ -322,7 +322,7 @@ class activityReport
$blog_open = $group_open = false;
while($rs->fetch()) {
while ($rs->fetch()) {
// blog
if ($rs->blog_id != $blog && $this->_global) {
if ($group_open) {
@ -333,12 +333,12 @@ class activityReport
$res .= $tpl['blog_close'];
}
$blog = $rs->blog_id;
$blog = $rs->blog_id;
$group = '';
$res .= str_replace(
['%TEXT%', '%URL%'],
[$rs->blog_name . ' (' . $rs->blog_id . ')', $rs->blog_url],
['%TEXT%', '%URL%'],
[$rs->blog_name . ' (' . $rs->blog_id . ')', $rs->blog_url],
$tpl['blog_title']
) . $tpl['blog_open'];
@ -368,7 +368,7 @@ class activityReport
$data = self::decode($rs->activity_logs);
$res .= str_replace(
['%TIME%', '%TEXT%'],
['%TIME%', '%TEXT%'],
[dt::str($dt, $time, $tz), vsprintf(__($this->groups[$group]['actions'][$rs->activity_action]['msg']), $data)],
$tpl['action']
);
@ -410,13 +410,14 @@ class activityReport
$tpl['info']
);
if (!$this->_global) {
$period .= str_replace('%TEXT%', $rs->blog_name,$tpl['info']);
$period .= str_replace('%TEXT%', $rs->blog_url,$tpl['info']);
$period .= str_replace('%TEXT%', $rs->blog_name, $tpl['info']);
$period .= str_replace('%TEXT%', $rs->blog_url, $tpl['info']);
}
$period .= str_replace(
'%TEXT%',
sprintf(__('Period from %s to %s'), dt::str($dt, $from, $tz), dt::str($dt, $to, $tz)),
$tpl['info']);
$tpl['info']
);
$period .= $tpl['period_close'];
$res = str_replace(['%PERIOD%', '%TEXT%'], [$period, $res], $tpl['page']);
@ -428,7 +429,7 @@ class activityReport
{
// Get blogs and logs count
$rs = $this->con->select(
"SELECT blog_id " .
'SELECT blog_id ' .
'FROM ' . $this->table . ' ' .
"WHERE activity_type='" . $this->ns . "' " .
'GROUP BY blog_id '
@ -439,16 +440,16 @@ class activityReport
}
while ($rs->fetch()) {
$ts = time();
$obs_blog = dt::str('%Y-%m-%d %H:%M:%S', $ts - (integer) $this->settings[0]['obsolete']);
$obs_global = dt::str('%Y-%m-%d %H:%M:%S', $ts - (integer) $this->settings[1]['obsolete']);
$ts = time();
$obs_blog = dt::str('%Y-%m-%d %H:%M:%S', $ts - (int) $this->settings[0]['obsolete']);
$obs_global = dt::str('%Y-%m-%d %H:%M:%S', $ts - (int) $this->settings[1]['obsolete']);
$this->con->execute(
'DELETE FROM ' . $this->table . ' ' .
"WHERE activity_type='" . $this->ns . "' " .
"AND (activity_dt < TIMESTAMP '" . $obs_blog . "' " .
"OR activity_dt < TIMESTAMP '" . $obs_global . "') " .
"AND blog_id = '" . $this->con->escape($rs->blog_id) ."' "
"AND blog_id = '" . $this->con->escape($rs->blog_id) . "' "
);
if ($this->con->changes()) {
@ -456,19 +457,19 @@ class activityReport
$cur = $this->con->openCursor($this->table);
$this->con->writeLock($this->table);
$cur->activity_id = $this->getNextId();
$cur->activity_type = $this->ns;
$cur->blog_id = $rs->blog_id;
$cur->activity_group = 'activityReport';
$cur->activity_id = $this->getNextId();
$cur->activity_type = $this->ns;
$cur->blog_id = $rs->blog_id;
$cur->activity_group = 'activityReport';
$cur->activity_action = 'message';
$cur->activity_logs = self::encode(__('Activity report deletes some old logs.'));
$cur->activity_dt = date('Y-m-d H:i:s');
$cur->activity_logs = self::encode(__('Activity report deletes some old logs.'));
$cur->activity_dt = date('Y-m-d H:i:s');
$cur->insert();
$this->con->unlock();
} catch (Exception $e) {
$this->con->unlock();
$this->core->error->add($e->getMessage());
dcCore::app()->error->add($e->getMessage());
}
}
}
@ -479,14 +480,14 @@ class activityReport
$this->con->execute(
'DELETE FROM ' . $this->table . ' ' .
"WHERE activity_type='" . $this->ns . "' " .
"AND activity_blog_status = 1 " .
"AND activity_super_status = 1 "
'AND activity_blog_status = 1 ' .
'AND activity_super_status = 1 '
);
}
public function deleteLogs()
{
if (!$this->core->auth->isSuperAdmin()) {
if (!dcCore::app()->auth->isSuperAdmin()) {
return null;
}
@ -501,14 +502,13 @@ class activityReport
$r = 'UPDATE ' . $this->table . ' ';
if ($this->_global) {
$r .= "SET activity_super_status = 1 WHERE blog_id IS NOT NULL ";
$r .= 'SET activity_super_status = 1 WHERE blog_id IS NOT NULL ';
} else {
$r .= "SET activity_blog_status = 1 WHERE blog_id = '" . $this->blog . "' ";
}
$r .=
"AND activity_type = '" . $this->ns . "' " .
"AND activity_dt >= TIMESTAMP '" . date('Y-m-d H:i:s',$from_date_ts) . "' " .
"AND activity_dt < TIMESTAMP '" . date('Y-m-d H:i:s',$to_date_ts) . "' ";
$r .= "AND activity_type = '" . $this->ns . "' " .
"AND activity_dt >= TIMESTAMP '" . date('Y-m-d H:i:s', $from_date_ts) . "' " .
"AND activity_dt < TIMESTAMP '" . date('Y-m-d H:i:s', $to_date_ts) . "' ";
$this->con->execute($r);
}
@ -526,15 +526,16 @@ class activityReport
try {
# Need flock function
if (!function_exists('flock')) {
throw New Exception("Can't call php function named flock");
throw new Exception("Can't call php function named flock");
}
# Cache writable ?
if (!is_writable(DC_TPL_CACHE)) {
throw new Exception("Can't write in cache fodler");
}
# Set file path
$f_md5 = $this->_global ? md5(DC_MASTER_KEY) : md5($this->blog);
$cached_file = sprintf('%s/%s/%s/%s/%s.txt',
$f_md5 = $this->_global ? md5(DC_MASTER_KEY) : md5($this->blog);
$cached_file = sprintf(
'%s/%s/%s/%s/%s.txt',
DC_TPL_CACHE,
'activityreport',
substr($f_md5, 0, 2),
@ -545,35 +546,37 @@ class activityReport
$cached_file = path::real($cached_file, false);
// make dir
if (!is_dir(dirname($cached_file))) {
files::makeDir(dirname($cached_file), true);
files::makeDir(dirname($cached_file), true);
}
//ake file
if (!file_exists($cached_file)) {
!$fp = @fopen($cached_file, 'w');
if ($fp === false) {
throw New Exception("Can't create file");
throw new Exception("Can't create file");
}
fwrite($fp, '1', strlen('1'));
fclose($fp);
}
// open file
if (!($fp = @fopen($cached_file, 'r+'))) {
throw New Exception("Can't open file");
throw new Exception("Can't open file");
}
// lock file
if (!flock($fp, LOCK_EX)) {
throw New Exception("Can't lock file");
throw new Exception("Can't lock file");
}
if ($this->_global) {
$this->lock_global = $fp;
} else {
$this->lock_blog = $fp;
}
return true;
} catch (Exception $e) {
// what ?
throw $e;
}
return false;
}
@ -605,31 +608,31 @@ class activityReport
$this->lockUpdate();
$send = false;
$now = time();
$now = time();
$active = (boolean) $this->settings[$this->_global]['active'];
$active = (bool) $this->settings[$this->_global]['active'];
$mailinglist = $this->settings[$this->_global]['mailinglist'];
$mailformat = $this->settings[$this->_global]['mailformat'];
$requests = $this->settings[$this->_global]['requests'];
$lastreport = (integer) $this->settings[$this->_global]['lastreport'];
$interval = (integer) $this->settings[$this->_global]['interval'];
$blogs = $this->settings[$this->_global]['blogs'];
$mailformat = $this->settings[$this->_global]['mailformat'];
$requests = $this->settings[$this->_global]['requests'];
$lastreport = (int) $this->settings[$this->_global]['lastreport'];
$interval = (int) $this->settings[$this->_global]['interval'];
$blogs = $this->settings[$this->_global]['blogs'];
if ($force) {
$lastreport = 0;
}
// Check if report is needed
if ($active && !empty($mailinglist) && !empty($requests) && !empty($blogs)
&& ($lastreport + $interval) < $now
if ($active && !empty($mailinglist) && !empty($requests) && !empty($blogs)
&& ($lastreport + $interval) < $now
) {
// Get datas
$params = [
'from_date_ts' => $lastreport,
'to_date_ts' => $now,
'blog_id' => $blogs,
'sql' => self::requests2params($requests),
'order' => 'blog_id ASC, activity_group ASC, activity_action ASC, activity_dt ASC '
'to_date_ts' => $now,
'blog_id' => $blogs,
'sql' => self::requests2params($requests),
'order' => 'blog_id ASC, activity_group ASC, activity_action ASC, activity_dt ASC ',
];
$logs = $this->getLogs($params);
@ -657,7 +660,7 @@ class activityReport
$this->_global = false;
if ($send) {
$this->core->callBehavior('messageActivityReport', 'Activity report has been successfully send by mail.');
dcCore::app()->callBehavior('messageActivityReport', 'Activity report has been successfully send by mail.');
}
}
$this->unlockUpdate();
@ -665,15 +668,16 @@ class activityReport
$this->unlockUpdate();
//throw $e;
}
return true;
}
private function sendReport($recipients, $message, $mailformat =' ')
private function sendReport($recipients, $message, $mailformat = ' ')
{
if (!is_array($recipients) || empty($message)) {
return false;
}
$mailformat = $mailformat == 'html' ? 'html' : 'plain';
$mailformat = $mailformat == 'html' ? 'html' : 'plain';
// Checks recipients addresses
$rc2 = [];
@ -693,19 +697,20 @@ class activityReport
# Sending mails
try {
$subject = mb_encode_mimeheader(
($this->_global ? '[' . $this->core->blog->name . '] ' : '') . __('Blog activity report'),
'UTF-8', 'B'
($this->_global ? '[' . dcCore::app()->blog->name . '] ' : '') . __('Blog activity report'),
'UTF-8',
'B'
);
$headers = [];
$headers = [];
$headers[] = 'From: ' . (defined('DC_ADMIN_MAILFROM') && DC_ADMIN_MAILFROM ? DC_ADMIN_MAILFROM : 'dotclear@local');
$headers[] = 'Content-Type: text/' . $mailformat .'; charset=UTF-8;';
$headers[] = 'Content-Type: text/' . $mailformat . '; charset=UTF-8;';
//$headers[] = 'MIME-Version: 1.0';
//$headers[] = 'X-Originating-IP: ' . mb_encode_mimeheader(http::realIP(), 'UTF-8', 'B');
//$headers[] = 'X-Mailer: Dotclear';
//$headers[] = 'X-Blog-Id: ' . mb_encode_mimeheader($this->core->blog->id), 'UTF-8', 'B');
//$headers[] = 'X-Blog-Name: ' . mb_encode_mimeheader($this->core->blog->name), 'UTF-8', 'B');
//$headers[] = 'X-Blog-Url: ' . mb_encode_mimeheader($this->core->blog->url), 'UTF-8', 'B');
//$headers[] = 'X-Blog-Id: ' . mb_encode_mimeheader(dcCore::app()->blog->id), 'UTF-8', 'B');
//$headers[] = 'X-Blog-Name: ' . mb_encode_mimeheader(dcCore::app()->blog->name), 'UTF-8', 'B');
//$headers[] = 'X-Blog-Url: ' . mb_encode_mimeheader(dcCore::app()->blog->url), 'UTF-8', 'B');
$done = true;
foreach ($recipients as $email) {
@ -713,17 +718,19 @@ class activityReport
$done = false;
}
}
} catch (Exception $e) {var_dump($e);
} catch (Exception $e) {
var_dump($e);
$done = false;
}
return $done;
}
public function getUserCode()
{
$code =
pack('a32', $this->core->auth->userID()) .
pack('H*', crypt::hmac(DC_MASTER_KEY, $this->core->auth->getInfo('user_pwd')));
$code = pack('a32', dcCore::app()->auth->userID()) .
pack('H*', crypt::hmac(DC_MASTER_KEY, dcCore::app()->auth->getInfo('user_pwd')));
return bin2hex($code);
}
@ -732,7 +739,7 @@ class activityReport
$code = pack('H*', $code);
$user_id = trim(@pack('a32', substr($code, 0, 32)));
$pwd = @unpack('H40hex', substr($code, 32, 40));
$pwd = @unpack('H40hex', substr($code, 32, 40));
if ($user_id === false || $pwd === false) {
return false;
@ -741,16 +748,16 @@ class activityReport
$pwd = $pwd['hex'];
$strReq = 'SELECT user_id, user_pwd ' .
'FROM ' . $this->core->prefix . 'user ' .
"WHERE user_id = '" . $this->core->con->escape($user_id) . "' ";
'FROM ' . dcCore::app()->prefix . 'user ' .
"WHERE user_id = '" . dcCore::app()->con->escape($user_id) . "' ";
$rs = $this->core->con->select($strReq);
$rs = dcCore::app()->con->select($strReq);
if ($rs->isEmpty()) {
return false;
}
if (crypt::hmac(DC_MASTER_KEY,$rs->user_pwd) != $pwd) {
if (crypt::hmac(DC_MASTER_KEY, $rs->user_pwd) != $pwd) {
return false;
}
@ -766,4 +773,4 @@ class activityReport
{
return @unserialize(@base64_decode($a));
}
}
}

View file

@ -1,64 +1,61 @@
<?php
/**
* @brief activityReport, a plugin for Dotclear 2
*
*
* @package Dotclear
* @subpackage Plugin
*
*
* @author Jean-Christian Denis and contributors
*
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
$format = [
'html' => [
'blog_title' => '<h2><a href="%URL%">%TEXT%</a></h2>',
'blog_open' => '',
'blog_close' => '',
'group_title' => '<h3>%TEXT%</h3>',
'group_open' => '<ul>',
'group_close' => '</ul>',
'action' => '<li><em>%TIME%</em><br />%TEXT%</li>',
'error' => '<p>%TEXT%</p>',
'blog_title' => '<h2><a href="%URL%">%TEXT%</a></h2>',
'blog_open' => '',
'blog_close' => '',
'group_title' => '<h3>%TEXT%</h3>',
'group_open' => '<ul>',
'group_close' => '</ul>',
'action' => '<li><em>%TIME%</em><br />%TEXT%</li>',
'error' => '<p>%TEXT%</p>',
'period_title' => '<h1>%TEXT%</h1>',
'period_open' => '<ul>',
'period_open' => '<ul>',
'period_close' => '</ul>',
'info' => '<li>%TEXT%</li>',
'page' =>
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'."\n".
'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">'."\n".
"<head><title>".__('Activity report')."</title>".
'<style type="text/css">'.
' body { color: #303030; background: #FCFCFC; font-size: 0.7em;font-family: Georgia, Tahoma, Arial, Helvetica, sans-serif; }'.
' a { color: #303030; text-decoration: none; }'.
' h1 { text-align: center; font-size: 2em; }'.
' h2 { color: #303030; text-align:center; }'.
' h3 { color: #7F3F3F; }'.
' li em { color: #303030; }'.
' div.info { color: #3F497F; background-color: #F8F8EB; border: 1px solid #888888; margin: 4px; padding: 4px; }'.
' div.content { color: #3F7F47; background-color: #F8F8EB; border: 1px solid #888888; margin: 4px; padding: 4px; }'.
' div.foot { text-align:center; font-size: 0.9em; }'.
'</style>'.
"</head><body>".
'<div class="info">%PERIOD%</div><div class="content">%TEXT%</div>'.
'<div class="foot"><p>Powered by <a href="http://dotclear.jcdenis.com/go/activityReport">activityReport</a></p></div>'.
"</body></html>"
'info' => '<li>%TEXT%</li>',
'page' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' . "\n" .
'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">' . "\n" .
'<head><title>' . __('Activity report') . '</title>' .
'<style type="text/css">' .
' body { color: #303030; background: #FCFCFC; font-size: 0.7em;font-family: Georgia, Tahoma, Arial, Helvetica, sans-serif; }' .
' a { color: #303030; text-decoration: none; }' .
' h1 { text-align: center; font-size: 2em; }' .
' h2 { color: #303030; text-align:center; }' .
' h3 { color: #7F3F3F; }' .
' li em { color: #303030; }' .
' div.info { color: #3F497F; background-color: #F8F8EB; border: 1px solid #888888; margin: 4px; padding: 4px; }' .
' div.content { color: #3F7F47; background-color: #F8F8EB; border: 1px solid #888888; margin: 4px; padding: 4px; }' .
' div.foot { text-align:center; font-size: 0.9em; }' .
'</style>' .
'</head><body>' .
'<div class="info">%PERIOD%</div><div class="content">%TEXT%</div>' .
'<div class="foot"><p>Powered by <a href="http://dotclear.jcdenis.com/go/activityReport">activityReport</a></p></div>' .
'</body></html>',
],
'plain' => [
'blog_title' => "\n--- %TEXT% ---\n",
'blog_open' => '',
'blog_close' => '',
'group_title' => "\n-- %TEXT% --\n\n",
'group_open' => '',
'group_close' => '',
'action' => "- %TIME% : %TEXT%\n",
'error' => '%TEXT%',
'blog_title' => "\n--- %TEXT% ---\n",
'blog_open' => '',
'blog_close' => '',
'group_title' => "\n-- %TEXT% --\n\n",
'group_open' => '',
'group_close' => '',
'action' => "- %TIME% : %TEXT%\n",
'error' => '%TEXT%',
'period_title' => "%TEXT%\n",
'period_open' => '',
'period_open' => '',
'period_close' => '',
'info' => "%TEXT%\n",
'page' =>
"%PERIOD%\n-----------------------------------------------------------\n%TEXT%"
]
];
'info' => "%TEXT%\n",
'page' => "%PERIOD%\n-----------------------------------------------------------\n%TEXT%",
],
];

View file

@ -1,53 +1,51 @@
<?php
/**
* @brief activityReport, a plugin for Dotclear 2
*
*
* @package Dotclear
* @subpackage Plugin
*
*
* @author Jean-Christian Denis and contributors
*
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_CONTEXT_ADMIN')) {
return null;
}
if (!defined('ACTIVITY_REPORT')) {
if (!defined('ACTIVITY_REPORT_V2')) {
return null;
}
dcPage::check('admin');
dcPage::check(dcAuth::PERMISSION_ADMIN);
$report =& $core->activityReport;
$super = $core->auth->isSuperAdmin() && !empty($_REQUEST['super']);
$super = dcCore::app()->auth->isSuperAdmin() && !empty($_REQUEST['super']);
if ($super) {
$report->setGlobal();
dcCore::app()->activityReport->setGlobal();
}
$logs = $report->getLogs([]);
$logs = dcCore::app()->activityReport->getLogs([]);
if ($super) {
$breadcrumb = [
__('Current blog') => $core->adminurl->get('admin.plugin.activityReport', ['super' => 0]),
'<span class="page-title">' . __('All blogs') . '</span>' => ''
__('Current blog') => dcCore::app()->adminurl->get('admin.plugin.activityReport', ['super' => 0]),
'<span class="page-title">' . __('All blogs') . '</span>' => '',
];
} else {
$breadcrumb = ['<span class="page-title">' . __('Current blog') . '</span>' => ''];
if ($core->auth->isSuperAdmin()) {
$breadcrumb[__('All blogs')] = $core->adminurl->get('admin.plugin.activityReport', ['super' => 1]);
if (dcCore::app()->auth->isSuperAdmin()) {
$breadcrumb[__('All blogs')] = dcCore::app()->adminurl->get('admin.plugin.activityReport', ['super' => 1]);
}
}
echo '<html><head><title>' . __('Activity report') . '</title></head><body>' .
dcPage::breadcrumb(array_merge([__('Activity report') => '', __('Logs') => ''], $breadcrumb),['hl' => false]) .
dcPage::breadcrumb(array_merge([__('Activity report') => '', __('Logs') => ''], $breadcrumb), ['hl' => false]) .
dcPage::notices();
if ($logs->isEmpty()) {
echo '<p>'.__('No log').'</p>';
echo '<p>' . __('No log') . '</p>';
} else {
echo '
<div class="table-outer"><table><thead>
@ -56,24 +54,24 @@ if ($logs->isEmpty()) {
<th>' . __('Message') . '</th>
<th>' . __('Date') . '</th>';
if ($super) {
echo '<th>' . __('Blog') .'</th>';
echo '<th>' . __('Blog') . '</th>';
}
echo '</tr></thead><tbody>';
while($logs->fetch()) {
$action = $report->getGroups($logs->activity_group, $logs->activity_action);
while ($logs->fetch()) {
$action = dcCore::app()->activityReport->getGroups($logs->activity_group, $logs->activity_action);
if (empty($action)) {
continue;
}
$off = $super && $logs->activity_blog_status == 1 ? ' offline' : '';
$off = $super && $logs->activity_blog_status == 1 ? ' offline' : '';
$date = dt::str(
$core->blog->settings->system->date_format . ', ' . $core->blog->settings->system->time_format,
dcCore::app()->blog->settings->system->date_format . ', ' . dcCore::app()->blog->settings->system->time_format,
strtotime($logs->activity_dt),
$core->auth->getInfo('user_tz')
dcCore::app()->auth->getInfo('user_tz')
);
$msg = vsprintf(__($action['msg']), $report->decode($logs->activity_logs));
$msg = vsprintf(__($action['msg']), dcCore::app()->activityReport->decode($logs->activity_logs));
echo '
<tr class="line' . $off . '">
@ -87,6 +85,6 @@ if ($logs->isEmpty()) {
}
echo '</tbody></table></div>';
}
$report->unsetGlobal();
dcCore::app()->activityReport->unsetGlobal();
echo '</body></html>';
echo '</body></html>';

View file

@ -1,265 +0,0 @@
<?php
// Language: Français
// Module: activityReport - 1.0.1
// Date: 2021-09-03 21:33:45
// Translated with dcTranslater - 2021.09.02.1
#_admin.php:22
#_admin.php:83
#_admin.php:97
#inc/class.activity.report.php:405
#inc/lib.parselogs.config.php:31
#index.php:45
#index.php:46
$GLOBALS['__l10n']['Activity report'] = 'Rapport d\'activité';
#_admin.php:86
$GLOBALS['__l10n']['View all logs'] = 'Voir tous les logs';
#_admin.php:99
$GLOBALS['__l10n']['Number of activities to show on dashboard:'] = 'Nombre d\'activités à afficher sur le tableau de bord :';
#_admin.php:127
$GLOBALS['__l10n']['Do not show activity report'] = 'Ne pas afficher le rapport d\'activité';
#_config.php:27
#_config.php:36
$GLOBALS['__l10n']['every hour'] = 'toutes les heures';
#_config.php:28
#_config.php:37
$GLOBALS['__l10n']['every 2 hours'] = 'toutes les 2 heures';
#_config.php:29
#_config.php:38
$GLOBALS['__l10n']['2 times by day'] = '2 fois par jour';
#_config.php:30
#_config.php:39
$GLOBALS['__l10n']['every day'] = 'tous les jours';
#_config.php:31
#_config.php:40
$GLOBALS['__l10n']['every 2 days'] = 'tous les 2 jours';
#_config.php:32
#_config.php:41
$GLOBALS['__l10n']['every week'] = 'toutes les semaines';
#_config.php:42
$GLOBALS['__l10n']['every 2 weeks'] = 'toutes les 2 semaines';
#_config.php:43
$GLOBALS['__l10n']['every 4 weeks'] = 'toutes les 4 semaines';
#_config.php:47
$GLOBALS['__l10n']['Plain text'] = 'Texte brut';
#_config.php:48
$GLOBALS['__l10n']['HTML'] = 'HTML';
#_config.php:84
$GLOBALS['__l10n']['never'] = 'jamais';
#_config.php:85
$GLOBALS['__l10n']['on new activity'] = 'lors d\'une nouvelle activité';
#_config.php:104
$GLOBALS['__l10n']['Configure activity report for %s'] = 'Configurer le rapport d\'activité pour %s';
#_config.php:104
$GLOBALS['__l10n']['current blog'] = 'blog courant';
#_config.php:109
$GLOBALS['__l10n']['This server has no mail function, activityReport does not send email report.'] = 'Ce server n\'a pas de fonction d\'envoie de mail, le rapport ne sera pas envoyer.';
#_config.php:120
$GLOBALS['__l10n']['Enable super administrator report'] = 'Autoriser le rapport de super administrateur';
#_config.php:121
$GLOBALS['__l10n']['Enable report on this blog'] = 'Autoriser le rapport sur ce blog';
#_config.php:124
$GLOBALS['__l10n']['Automatic cleaning of old logs:'] = 'Nettoyage automatique des anciennes activités:';
#_config.php:129
$GLOBALS['__l10n']['Use Dotclear date formaters. ex: %B %d at %H:%M'] = 'Utiliser le formatage des dates de Dotclear. ex: %d %B à %H:%M';
#_config.php:135
#_config.php:136
$GLOBALS['__l10n']['RSS feed'] = 'Flux RSS';
#_config.php:138
$GLOBALS['__l10n']['Rss2 feed for activity on this blog'] = 'Flux Rss2 pour l\'activité de ce blog';
#_config.php:139
#_config.php:140
$GLOBALS['__l10n']['Atom feed'] = 'Flux Atom';
#_config.php:142
$GLOBALS['__l10n']['Atom feed for activity on this blog'] = 'Flux Atom pour l\'activité de ce blog';
#_config.php:147
$GLOBALS['__l10n']['Send report:'] = 'Rapport envoyé :';
#_config.php:150
$GLOBALS['__l10n']['Recipients:'] = 'Destinataires :';
#_config.php:152
$GLOBALS['__l10n']['Separate multiple email addresses with a semicolon ";"'] = 'Séparer les adresses email par un point-virgule ";"';
#_config.php:154
$GLOBALS['__l10n']['Report format:'] = 'Format du rapport :';
#_config.php:158
$GLOBALS['__l10n']['Last report by email:'] = 'Dernier rapport par email :';
#_config.php:159
$GLOBALS['__l10n']['Next report by email:'] = 'Prochain rapport par email :';
#_config.php:167
$GLOBALS['__l10n']['Select blogs to add to report'] = 'Sélectionner les blogs à ajouter au rapport';
#_config.php:192
$GLOBALS['__l10n']['Report'] = 'Rapport';
#_config.php:193
$GLOBALS['__l10n']['Select actions by activity type to add to report'] = 'Sélectionner les actions par type d\'activité à ajouter au rapport';
#inc/class.activity.report.behaviors.php:28
$GLOBALS['__l10n']['ActivityReport messages'] = 'Messages de l\'extension';
#inc/class.activity.report.behaviors.php:33
$GLOBALS['__l10n']['Special messages'] = 'Messages spéciaux';
#inc/class.activity.report.behaviors.php:34
$GLOBALS['__l10n']['%s'] = '%s';
#inc/class.activity.report.behaviors.php:40
$GLOBALS['__l10n']['Actions on blog'] = 'Actions sur le blog';
#inc/class.activity.report.behaviors.php:48
$GLOBALS['__l10n']['updating blog'] = 'Mise à jour du blog';
#inc/class.activity.report.behaviors.php:49
$GLOBALS['__l10n']['Blog was updated by "%s"'] = 'Blog mis à jour par "%s"';
#inc/class.activity.report.behaviors.php:58
$GLOBALS['__l10n']['404 error'] = 'Erreur 404';
#inc/class.activity.report.behaviors.php:59
$GLOBALS['__l10n']['New 404 error page at "%s"'] = 'Nouvelle erreur 404 à l\'adresse "%s"';
#inc/class.activity.report.behaviors.php:65
$GLOBALS['__l10n']['Actions on posts'] = 'Actions sur les billets';
#inc/class.activity.report.behaviors.php:73
#inc/class.activity.report.behaviors.php:84
$GLOBALS['__l10n']['post creation'] = 'Création de billet';
#inc/class.activity.report.behaviors.php:74
#inc/class.activity.report.behaviors.php:85
$GLOBALS['__l10n']['A new post called "%s" was created by "%s" at %s'] = 'Un nouveau billet nommé "%s" a été créé par "%s" à l\'adresse "%s"';
#inc/class.activity.report.behaviors.php:95
$GLOBALS['__l10n']['updating post'] = 'Mise à jour de billet';
#inc/class.activity.report.behaviors.php:96
$GLOBALS['__l10n']['Post called "%s" has been updated by "%s" at %s'] = 'Le billet nommé "%s" a été mis à jour par "%s" à l\'adresse "%s"';
#inc/class.activity.report.behaviors.php:106
$GLOBALS['__l10n']['post deletion'] = 'Suppression de billet';
#inc/class.activity.report.behaviors.php:107
$GLOBALS['__l10n']['Post called "%s" has been deleted by "%s"'] = 'Le billet nommé "%s" a été supprimé par "%s"';
#inc/class.activity.report.behaviors.php:117
$GLOBALS['__l10n']['Post protection'] = 'Protection des billets';
#inc/class.activity.report.behaviors.php:118
$GLOBALS['__l10n']['An attempt failed on a passworded post with password "%s" at "%s"'] = 'Une tentative a échoué sur un billet protégé par mot de passe avec l\'essai "%s" à l\'adresse "%s"';
#inc/class.activity.report.behaviors.php:124
$GLOBALS['__l10n']['Actions on comments'] = 'Actions sur les commentaires';
#inc/class.activity.report.behaviors.php:132
$GLOBALS['__l10n']['comment creation'] = 'Création de commentaire';
#inc/class.activity.report.behaviors.php:133
$GLOBALS['__l10n']['A new comment was created by "%s" on post "%s" at %s'] = 'Un nouveau commentaire a été créé par "%s" sur le billet "%s"';
#inc/class.activity.report.behaviors.php:143
$GLOBALS['__l10n']['updating comment'] = 'Mise à jour de commentaire';
#inc/class.activity.report.behaviors.php:144
$GLOBALS['__l10n']['Comment has been updated by "%s" at %s'] = 'Un commentaire a été mise à jour par "%s" à l\'adresse "%s"';
#inc/class.activity.report.behaviors.php:157
$GLOBALS['__l10n']['trackback creation'] = 'Création de trackback';
#inc/class.activity.report.behaviors.php:158
$GLOBALS['__l10n']['A new trackback to "%" at "%s" was created on post "%s" at %s'] = 'Un nouveau rétrolien vers "%s" a été créé sur le billet "%s" à l\'adresse "%s"';
#inc/class.activity.report.behaviors.php:164
$GLOBALS['__l10n']['Actions on categories'] = 'Actions sur les catégories';
#inc/class.activity.report.behaviors.php:170
$GLOBALS['__l10n']['category creation'] = 'Création de catégorie';
#inc/class.activity.report.behaviors.php:171
$GLOBALS['__l10n']['A new category called "%s" was created by "%s" at %s'] = 'Un nouvelle catégorie nommée "%s" a été créé par "%s" à l\'adresse "%s"';
#inc/class.activity.report.behaviors.php:180
$GLOBALS['__l10n']['updating category'] = 'Mise à jour de catégorie';
#inc/class.activity.report.behaviors.php:181
$GLOBALS['__l10n']['Category called "%s" has been updated by "%s" at %s'] = 'La catégorie nommée "%s" a été mise à jour par "%s" à l\'adresse "%s"';
#inc/class.activity.report.behaviors.php:189
$GLOBALS['__l10n']['Actions on users'] = 'Actions sur les utilisateurs';
#inc/class.activity.report.behaviors.php:195
$GLOBALS['__l10n']['user creation'] = 'Création d\'utilisateur';
#inc/class.activity.report.behaviors.php:196
$GLOBALS['__l10n']['A new user named "%s" was created by "%s"'] = 'Un nouvel utilisateur a été ajouté par "%s"';
#inc/class.activity.report.behaviors.php:205
$GLOBALS['__l10n']['updating user'] = 'Mise à jour d\'utilisateur';
#inc/class.activity.report.behaviors.php:206
$GLOBALS['__l10n']['User named "%s" has been updated by "%s"'] = 'L\'utilisateur "%s" a été mis à jour par "%s"';
#inc/class.activity.report.behaviors.php:215
$GLOBALS['__l10n']['user deletion'] = 'Suppression d\'utilisateur';
#inc/class.activity.report.behaviors.php:216
$GLOBALS['__l10n']['User named "%s" has been deleted by "%"'] = 'L\'utilisateur nommé "%s" a été supprimé par "%s"';
#inc/class.activity.report.php:395
$GLOBALS['__l10n']['An error occured when parsing report.'] = 'Une erreur est survenue lors de la compilation du rapport.';
#inc/class.activity.report.php:411
$GLOBALS['__l10n']['You received a message from your blog\'s activity report module.'] = 'Vous recevez un message du module de rapport d\'activité de votre blog.';
#inc/class.activity.report.php:420
$GLOBALS['__l10n']['Period from %s to %s'] = 'Période du %s au %s';
#inc/class.activity.report.php:466
$GLOBALS['__l10n']['Activity report deletes some old logs.'] = 'L\'extension a automatiquement effacé des anciennes activités.';
#inc/class.activity.report.php:698
$GLOBALS['__l10n']['Activity report module'] = 'Module de rapport d\'activité';
#inc/class.activity.report.php:710
#inc/class.activity.report.php:711
$GLOBALS['__l10n']['Blog activity report'] = 'Rapport d\'activité du blog';
#index.php:46
$GLOBALS['__l10n']['Logs'] = 'Enregistrements';
#index.php:50
$GLOBALS['__l10n']['No log'] = 'Pas d\'enregistrement';
#index.php:56
$GLOBALS['__l10n']['Message'] = 'Message';