use anonymous functions

master
Jean-Christian Paul Denis 2022-12-10 23:27:55 +01:00
parent 361d6e6fea
commit f8d6fa9894
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
1 changed files with 77 additions and 92 deletions

View File

@ -31,7 +31,19 @@ class zcfsActivityReportBehaviors
__('feed creation'), __('feed creation'),
__('A new feed named "%s" point to "%s" was added by "%s"'), __('A new feed named "%s" point to "%s" was added by "%s"'),
'zoneclearFeedServerAfterAddFeed', 'zoneclearFeedServerAfterAddFeed',
['zoneclearFeedServerActivityReportBehaviors', 'addFeed'] function ($cur) {
$logs = [
$cur->feed_name,
$cur->feed_feed,
dcCore::app()->auth->getInfo('user_cn'),
];
dcCore::app()->activityReport->addLog(
'zoneclearFeedServer',
'create',
$logs
);
}
); );
# from BEHAVIOR zoneclearFeedServerAfterUpdFeed in in zoneclearFeedServer/inc/class.zoneclear.feed.server.php # from BEHAVIOR zoneclearFeedServerAfterUpdFeed in in zoneclearFeedServer/inc/class.zoneclear.feed.server.php
dcCore::app()->activityReport->addAction( dcCore::app()->activityReport->addAction(
@ -40,7 +52,24 @@ class zcfsActivityReportBehaviors
__('updating feed info'), __('updating feed info'),
__('Feed named "%s" point to "%s" has been updated by "%s"'), __('Feed named "%s" point to "%s" has been updated by "%s"'),
'zoneclearFeedServerAfterUpdFeed', 'zoneclearFeedServerAfterUpdFeed',
['zoneclearFeedServerActivityReportBehaviors', 'updFeedInfo'] function ($cur, $id) {
if (defined('DC_CONTEXT_ADMIN')) {
$zc = new zoneclearFeedServer();
$rs = $zc->getFeeds(['feed_id' => $id]);
$logs = [
$rs->feed_name,
$rs->feed_feed,
dcCore::app()->auth->getInfo('user_cn'),
];
dcCore::app()->activityReport->addLog(
'zoneclearFeedServer',
'updatefeedinfo',
$logs
);
}
}
); );
# from BEHAVIOR zoneclearFeedServerAfterUpdFeed in in zoneclearFeedServer/inc/class.zoneclear.feed.server.php # from BEHAVIOR zoneclearFeedServerAfterUpdFeed in in zoneclearFeedServer/inc/class.zoneclear.feed.server.php
dcCore::app()->activityReport->addAction( dcCore::app()->activityReport->addAction(
@ -49,7 +78,22 @@ class zcfsActivityReportBehaviors
__('updating feed records'), __('updating feed records'),
__('Records of the feed named "%s" have been updated automatically'), __('Records of the feed named "%s" have been updated automatically'),
'zoneclearFeedServerAfterUpdFeed', 'zoneclearFeedServerAfterUpdFeed',
['zoneclearFeedServerActivityReportBehaviors', 'updFeedRecord'] function ($cur, $id) {
if (!defined('DC_CONTEXT_ADMIN')) {
$zc = new zoneclearFeedServer();
$rs = $zc->getFeeds(['feed_id' => $id]);
$logs = [
$rs->feed_name,
];
dcCore::app()->activityReport->addLog(
'zoneclearFeedServer',
'updatefeedrecords',
$logs
);
}
}
); );
# from BEHAVIOR zoneclearFeedServerAfterDelFeed in in zoneclearFeedServer/inc/class.zoneclear.feed.server.php # from BEHAVIOR zoneclearFeedServerAfterDelFeed in in zoneclearFeedServer/inc/class.zoneclear.feed.server.php
dcCore::app()->activityReport->addAction( dcCore::app()->activityReport->addAction(
@ -58,7 +102,22 @@ class zcfsActivityReportBehaviors
__('feed deletion'), __('feed deletion'),
__('Feed named "%s" point to "%s" has been deleted by "%s"'), __('Feed named "%s" point to "%s" has been deleted by "%s"'),
'zoneclearFeedServerAfterDelFeed', 'zoneclearFeedServerAfterDelFeed',
['zoneclearFeedServerActivityReportBehaviors', 'delFeed'] function ($id) {
$zc = new zoneclearFeedServer();
$rs = $zc->getFeeds(['feed_id' => $id]);
$logs = [
$rs->feed_name,
$rs->feed_feed,
dcCore::app()->auth->getInfo('user_cn'),
];
dcCore::app()->activityReport->addLog(
'zoneclearFeedServer',
'delete',
$logs
);
}
); );
# from BEHAVIOR zoneclearFeedServerAfterEnableFeed in in zoneclearFeedServer/inc/class.zoneclear.feed.server.php # from BEHAVIOR zoneclearFeedServerAfterEnableFeed in in zoneclearFeedServer/inc/class.zoneclear.feed.server.php
dcCore::app()->activityReport->addAction( dcCore::app()->activityReport->addAction(
@ -67,96 +126,22 @@ class zcfsActivityReportBehaviors
__('feed status'), __('feed status'),
__('Feed named "%s" point to "%s" has been set to "%s"'), __('Feed named "%s" point to "%s" has been set to "%s"'),
'zoneclearFeedServerAfterEnableFeed', 'zoneclearFeedServerAfterEnableFeed',
['zoneclearFeedServerActivityReportBehaviors', 'enableFeed'] function ($id, $enable, $time) {
); $zc = new zoneclearFeedServer();
} $rs = $zc->getFeeds(['feed_id' => $id]);
public static function addFeed($cur) $logs = [
{ $rs->feed_name,
$logs = [ $rs->feed_feed,
$cur->feed_name, $enable ? 'enable' : 'disable',
$cur->feed_feed, ];
dcCore::app()->auth->getInfo('user_cn'),
];
dcCore::app()->activityReport->addLog( dcCore::app()->activityReport->addLog(
'zoneclearFeedServer', 'zoneclearFeedServer',
'create', 'status',
$logs $logs
); );
} }
public static function updFeedInfo($cur, $id)
{
if (defined('DC_CONTEXT_ADMIN')) {
$zc = new zoneclearFeedServer();
$rs = $zc->getFeeds(['feed_id' => $id]);
$logs = [
$rs->feed_name,
$rs->feed_feed,
dcCore::app()->auth->getInfo('user_cn'),
];
dcCore::app()->activityReport->addLog(
'zoneclearFeedServer',
'updatefeedinfo',
$logs
);
}
}
public static function updFeedRecord($cur, $id)
{
if (!defined('DC_CONTEXT_ADMIN')) {
$zc = new zoneclearFeedServer();
$rs = $zc->getFeeds(['feed_id' => $id]);
$logs = [
$rs->feed_name,
];
dcCore::app()->activityReport->addLog(
'zoneclearFeedServer',
'updatefeedrecords',
$logs
);
}
}
public static function delFeed($id)
{
$zc = new zoneclearFeedServer();
$rs = $zc->getFeeds(['feed_id' => $id]);
$logs = [
$rs->feed_name,
$rs->feed_feed,
dcCore::app()->auth->getInfo('user_cn'),
];
dcCore::app()->activityReport->addLog(
'zoneclearFeedServer',
'delete',
$logs
);
}
public static function enableFeed($id, $enable, $time)
{
$zc = new zoneclearFeedServer();
$rs = $zc->getFeeds(['feed_id' => $id]);
$logs = [
$rs->feed_name,
$rs->feed_feed,
$enable ? 'enable' : 'disable',
];
dcCore::app()->activityReport->addLog(
'zoneclearFeedServer',
'status',
$logs
); );
} }
} }