From c2783c2e1511d5608d8113dbb6f8914be05634e7 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Fri, 18 Nov 2022 21:24:30 +0100 Subject: [PATCH] prepare to DC 2.24 --- CHANGELOG.md | 7 +- _admin.php | 108 ++++----- _config.php | 159 +++++++------ _define.php | 29 +-- _install.php | 42 ++-- _prepend.php | 24 +- _public.php | 121 +++++----- _uninstall.php | 81 ++++--- inc/class.activity.report.behaviors.php | 204 ++++++++--------- inc/class.activity.report.php | 287 ++++++++++++------------ inc/lib.parselogs.config.php | 91 ++++---- index.php | 48 ++-- locales/fr/main.lang.php | 265 ---------------------- 13 files changed, 608 insertions(+), 858 deletions(-) delete mode 100644 locales/fr/main.lang.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 66598d9..15fc4bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/_admin.php b/_admin.php index 20572e5..5f4dfac 100644 --- a/_admin.php +++ b/_admin.php @@ -1,78 +1,76 @@ 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[] = - '
' . + $lines[] = '
' . '' . __($groups[$group]['actions'][$rs->activity_action]['title']) . '' . '
' . 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') ) . '
' . '

' . - '' .vsprintf( + '' . vsprintf( __($groups[$group]['actions'][$rs->activity_action]['msg']), - $core->activityReport->decode($rs->activity_logs) + dcCore::app()->activityReport->decode($rs->activity_logs) ) . '

'; } if (empty($lines)) { @@ -82,48 +80,46 @@ class activityReportAdmin '
' . '

' . __('Activity report') . '

' . '
' . implode('', $lines) . '
' . - '

' . - __('View all logs') . ' - ' . + '

' . + __('View all logs') . ' - ' . __('Configure plugin') . '

' . - '
' + '', ]); } - public static function adminDashboardOptionsForm(dcCore $core) + public static function adminDashboardOptionsForm() { - $core->auth->user_prefs->addWorkspace('activityReport'); + dcCore::app()->auth->user_prefs->addWorkspace('activityReport'); echo '
' . '

' . __('Activity report') . '

' . - '

' . 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) ) . '

' . '
'; } 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; } -} \ No newline at end of file +} diff --git a/_config.php b/_config.php index 9e99834..9a46def 100644 --- a/_config.php +++ b/_config.php @@ -1,114 +1,112 @@ 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( - '

%s

' , - $core->adminurl->get('admin.plugins', ['module' => 'activityReport', 'conf' => 1, 'super' => !$super]), + '

%s

', + 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 '

' . -form::combo('obsolete', $combo_obselete, $report->getSetting('obsolete')) . '

+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 - '

'. __('RSS feed') . '' . - '' . + echo + '

' . __('RSS feed') . '' . + '' . __('Rss2 feed for activity on this blog') . '
' . '' . __('Atom feed') . '' . - '' . + '' . __('Atom feed for activity on this blog') . '

'; } echo '
-

' . -form::combo('interval', $combo_interval, $report->getSetting('interval')) . '

+

' . +form::combo('interval', $combo_interval, dcCore::app()->activityReport->getSetting('interval')) . '

-

' . __('Separate multiple email addresses with a semicolon ";"') . '

-

' . -form::combo('mailformat', $combo_format, $report->getSetting('mailformat')) . '

+

' . +form::combo('mailformat', $combo_format, dcCore::app()->activityReport->getSetting('mailformat')) . '

  • ' . __('Last report by email:') . ' ' . $last_report . '
  • @@ -174,21 +173,21 @@ if ($super) {

    ' . __('Blogs') . '

    ' . __('Select blogs to add to report') . '

    '; - $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 '

    '; @@ -200,14 +199,14 @@ echo '

    ' . __('Report') . '

    ' . __('Select actions by activity type to add to report') . '

    '; -$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 '
    '. __($group['title']) . '
    '; +foreach ($groups as $group_id => $group) { + echo '
    ' . __($group['title']) . '
    '; - foreach($group['actions'] as $action_id => $action) { + foreach ($group['actions'] as $action_id => $action) { echo '

    ' . __('Special') . '

    '; } -$report->unsetGlobal(); \ No newline at end of file +dcCore::app()->activityReport->unsetGlobal(); diff --git a/_define.php b/_define.php index 54b6f3b..753256e 100644 --- a/_define.php +++ b/_define.php @@ -1,16 +1,15 @@ 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', ] -); \ No newline at end of file +); diff --git a/_install.php b/_install.php index 19a2a64..a87fb57 100644 --- a/_install.php +++ b/_install.php @@ -1,39 +1,38 @@ 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; \ No newline at end of file + +return false; diff --git a/_prepend.php b/_prepend.php index c540d5e..8e03c84 100644 --- a/_prepend.php +++ b/_prepend.php @@ -1,39 +1,37 @@ 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'); -} \ No newline at end of file +} diff --git a/_public.php b/_public.php index db0a45a..4f1b726 100644 --- a/_public.php +++ b/_public.php @@ -1,61 +1,61 @@ 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 "activityreport_params = $params; ' . "\n" . - '$_ctx->activityreports = $core->activityReport->getLogs($params); unset($params); ' . "\n" . - 'while ($_ctx->activityreports->fetch()) : ?>'.$content.'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 . 'ctx->pop("activityreports"); dcCore::app()->ctx->pop("activityreport_params"); ' . "\n" . + '?>'; } public static function activityReportFeedID($attr) { - return - 'urn:md5:activityreports->blog_id.' . - '$_ctx->activityreports->activity_id.$_ctx->activityreports->activity_dt); ' . + return + 'urn:md5: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 ''; + $f = dcCore::app()->tpl->getFilters($attr); + + return ''; } public static function activityReportContent($attr) { - $f = $GLOBALS['core']->tpl->getFilters($attr); - return ''; + $f = dcCore::app()->tpl->getFilters($attr); + + return ''; } 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 'activityreports->activity_dt),\$core->blog->settings->system->blog_timezone)") . '; ?>'; + return 'ctx->activityreports->activity_dt),dcCore::app()->blog->settings->system->blog_timezone)') . '; ?>'; } elseif ($iso8601) { - return 'activityreports->activity_dt),\$core->blog->settings->system->blog_timezone)") . '; ?>'; + return 'ctx->activityreports->activity_dt),dcCore::app()->blog->settings->system->blog_timezone)') . '; ?>'; } elseif (!empty($format)) { - return 'activityreports->activity_dt)") . '; ?>'; - } else { - return 'blog->settings->system->date_format,\$_ctx->activityreports->activity_dt)") . '; ?>'; + return 'ctx->activityreports->activity_dt)") . '; ?>'; } + + return '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 ''; } -} \ No newline at end of file +} diff --git a/_uninstall.php b/_uninstall.php index 3f8c22a..6a7e8dc 100644 --- a/_uninstall.php +++ b/_uninstall.php @@ -1,58 +1,81 @@ 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') -); \ No newline at end of file + /* type */ + 'plugins', + /* action */ + 'delete', + /* ns */ + 'activityReport', + /* description */ + sprintf(__('delete %s plugin files'), 'activityReport') +); diff --git a/inc/class.activity.report.behaviors.php b/inc/class.activity.report.behaviors.php index 512179f..9da3091 100644 --- a/inc/class.activity.report.behaviors.php +++ b/inc/class.activity.report.behaviors.php @@ -1,33 +1,31 @@ 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); } -} \ No newline at end of file +} diff --git a/inc/class.activity.report.php b/inc/class.activity.report.php index 862580e..1d04db8 100644 --- a/inc/class.activity.report.php +++ b/inc/class.activity.report.php @@ -1,39 +1,38 @@ 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)); } -} \ No newline at end of file +} diff --git a/inc/lib.parselogs.config.php b/inc/lib.parselogs.config.php index adfe1cf..824f556 100644 --- a/inc/lib.parselogs.config.php +++ b/inc/lib.parselogs.config.php @@ -1,64 +1,61 @@ [ - 'blog_title' => '

    %TEXT%

    ', - 'blog_open' => '', - 'blog_close' => '', - 'group_title' => '

    %TEXT%

    ', - 'group_open' => '
      ', - 'group_close' => '
    ', - 'action' => '
  • %TIME%
    %TEXT%
  • ', - 'error' => '

    %TEXT%

    ', + 'blog_title' => '

    %TEXT%

    ', + 'blog_open' => '', + 'blog_close' => '', + 'group_title' => '

    %TEXT%

    ', + 'group_open' => '
      ', + 'group_close' => '
    ', + 'action' => '
  • %TIME%
    %TEXT%
  • ', + 'error' => '

    %TEXT%

    ', 'period_title' => '

    %TEXT%

    ', - 'period_open' => '
      ', + 'period_open' => '
        ', 'period_close' => '
      ', - 'info' => '
    • %TEXT%
    • ', - 'page' => - ''."\n". - ''."\n". - "".__('Activity report')."". - ''. - "". - '
      %PERIOD%
      %TEXT%
      '. - '

      Powered by activityReport

      '. - "" + 'info' => '
    • %TEXT%
    • ', + 'page' => '' . "\n" . + '' . "\n" . + '' . __('Activity report') . '' . + '' . + '' . + '
      %PERIOD%
      %TEXT%
      ' . + '

      Powered by activityReport

      ' . + '', ], '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%" - ] -]; \ No newline at end of file + 'info' => "%TEXT%\n", + 'page' => "%PERIOD%\n-----------------------------------------------------------\n%TEXT%", + ], +]; diff --git a/index.php b/index.php index 77d7c11..b56a34b 100644 --- a/index.php +++ b/index.php @@ -1,53 +1,51 @@ 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]), - '' . __('All blogs') . '' => '' + __('Current blog') => dcCore::app()->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]); + if (dcCore::app()->auth->isSuperAdmin()) { + $breadcrumb[__('All blogs')] = dcCore::app()->adminurl->get('admin.plugin.activityReport', ['super' => 1]); } } echo '' . __('Activity report') . '' . -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 '

      '.__('No log').'

      '; + echo '

      ' . __('No log') . '

      '; } else { echo '
      @@ -56,24 +54,24 @@ if ($logs->isEmpty()) { '; if ($super) { - echo ''; + echo ''; } echo ''; - 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 ' @@ -87,6 +85,6 @@ if ($logs->isEmpty()) { } echo '
      ' . __('Message') . ' ' . __('Date') . '' . __('Blog') .'' . __('Blog') . '
      '; } -$report->unsetGlobal(); +dcCore::app()->activityReport->unsetGlobal(); -echo ''; \ No newline at end of file +echo ''; diff --git a/locales/fr/main.lang.php b/locales/fr/main.lang.php deleted file mode 100644 index 2f43b63..0000000 --- a/locales/fr/main.lang.php +++ /dev/null @@ -1,265 +0,0 @@ -