2021-09-02 22:04:20 +00:00
|
|
|
<?php
|
2021-09-02 22:18:08 +00:00
|
|
|
/**
|
|
|
|
* @brief activityReport, a plugin for Dotclear 2
|
2022-11-18 20:24:30 +00:00
|
|
|
*
|
2021-09-02 22:18:08 +00:00
|
|
|
* @package Dotclear
|
|
|
|
* @subpackage Plugin
|
2022-11-18 20:24:30 +00:00
|
|
|
*
|
2021-09-02 22:18:08 +00:00
|
|
|
* @author Jean-Christian Denis and contributors
|
2022-11-18 20:24:30 +00:00
|
|
|
*
|
2021-09-02 22:18:08 +00:00
|
|
|
* @copyright Jean-Christian Denis
|
|
|
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
|
|
*/
|
2021-09-03 07:45:21 +00:00
|
|
|
if (!defined('DC_RC_PATH')) {
|
|
|
|
return null;
|
|
|
|
}
|
2021-09-02 22:04:20 +00:00
|
|
|
|
2022-11-18 20:24:30 +00:00
|
|
|
if (!defined('ACTIVITY_REPORT_V2')) {
|
2021-09-03 07:45:21 +00:00
|
|
|
return null;
|
|
|
|
}
|
2021-09-02 22:04:20 +00:00
|
|
|
|
|
|
|
class activityReportBehaviors
|
|
|
|
{
|
2022-11-18 20:24:30 +00:00
|
|
|
public static function registerBehaviors()
|
2021-09-03 08:01:27 +00:00
|
|
|
{
|
2022-11-18 20:24:30 +00:00
|
|
|
// ActivityReport plugin
|
2022-12-15 23:32:15 +00:00
|
|
|
dcCore::app()->activityReport->addGroup(basename(dirname(__DIR__)), __('ActivityReport messages'));
|
2021-09-03 08:01:27 +00:00
|
|
|
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->activityReport->addAction(
|
2022-12-15 23:32:15 +00:00
|
|
|
basename(dirname(__DIR__)),
|
2021-09-03 08:01:27 +00:00
|
|
|
'message',
|
|
|
|
__('Special messages'),
|
|
|
|
__('%s'),
|
|
|
|
'messageActivityReport',
|
|
|
|
['activityReportBehaviors', 'messageActivityReport']
|
|
|
|
);
|
|
|
|
|
2022-11-18 20:24:30 +00:00
|
|
|
// Blog
|
|
|
|
dcCore::app()->activityReport->addGroup('blog', __('Actions on blog'));
|
2021-09-03 08:01:27 +00:00
|
|
|
|
|
|
|
// Not use as it is global : BEHAVIOR adminAfterBlogCreate in admin/blog.php
|
|
|
|
|
|
|
|
// from BEHAVIOR adminAfterBlogUpdate in admin/blog_pref.php
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->activityReport->addAction(
|
2021-09-03 08:01:27 +00:00
|
|
|
'blog',
|
|
|
|
'update',
|
|
|
|
__('updating blog'),
|
|
|
|
__('Blog was updated by "%s"'),
|
|
|
|
'adminAfterBlogUpdate',
|
|
|
|
['activityReportBehaviors', 'blogUpdate']
|
|
|
|
);
|
|
|
|
|
|
|
|
// from BEHAVIOR publicHeadContent in template
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->activityReport->addAction(
|
2021-09-03 08:01:27 +00:00
|
|
|
'blog',
|
|
|
|
'p404',
|
|
|
|
__('404 error'),
|
|
|
|
__('New 404 error page at "%s"'),
|
|
|
|
'publicHeadContent',
|
|
|
|
['activityReportBehaviors', 'blogP404']
|
|
|
|
);
|
|
|
|
|
2022-11-18 20:24:30 +00:00
|
|
|
// Post
|
|
|
|
dcCore::app()->activityReport->addGroup('post', __('Actions on posts'));
|
2021-09-03 08:01:27 +00:00
|
|
|
|
|
|
|
// 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
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->activityReport->addAction(
|
2021-09-03 08:01:27 +00:00
|
|
|
'post',
|
|
|
|
'create',
|
|
|
|
__('post creation'),
|
|
|
|
__('A new post called "%s" was created by "%s" at %s'),
|
|
|
|
'adminAfterPostCreate',
|
|
|
|
['activityReportBehaviors', 'postCreate']
|
|
|
|
);
|
|
|
|
|
|
|
|
// Plugin contribute
|
|
|
|
// from BEHAVIOR publicAfterPostCreate in plugins/contribute/_public.php
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->activityReport->addAction(
|
2021-09-03 08:01:27 +00:00
|
|
|
'post',
|
|
|
|
'create',
|
|
|
|
__('post creation'),
|
|
|
|
__('A new post called "%s" was created by "%s" at %s'),
|
|
|
|
'publicAfterPostCreate',
|
|
|
|
['activityReportBehaviors', 'postCreate']
|
|
|
|
);
|
|
|
|
|
|
|
|
// from BEHAVIOR coreAfterPostUpdate in inc/core/class.dc.blog.php (DC2.2)
|
|
|
|
// duplicate adminAfterPostUpdate in admin/post.php
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->activityReport->addAction(
|
2021-09-03 08:01:27 +00:00
|
|
|
'post',
|
|
|
|
'update',
|
|
|
|
__('updating post'),
|
|
|
|
__('Post called "%s" has been updated by "%s" at %s'),
|
|
|
|
'adminAfterPostUpdate',
|
|
|
|
['activityReportBehaviors', 'postUpdate']
|
|
|
|
);
|
|
|
|
|
|
|
|
// from BEHAVIOR adminBeforePostDelete in admin/post.php
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->activityReport->addAction(
|
2021-09-03 08:01:27 +00:00
|
|
|
'post',
|
|
|
|
'delete',
|
|
|
|
__('post deletion'),
|
|
|
|
__('Post called "%s" has been deleted by "%s"'),
|
|
|
|
'adminBeforePostDelete',
|
|
|
|
['activityReportBehaviors', 'postDelete']
|
|
|
|
);
|
|
|
|
|
|
|
|
// Wrong attempt on passworded enrty
|
|
|
|
// from BEHAVIOR urlHandlerServeDocument in inc/public/lib.urlhandlers.php
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->activityReport->addAction(
|
2021-09-03 08:01:27 +00:00
|
|
|
'post',
|
|
|
|
'protection',
|
|
|
|
__('Post protection'),
|
|
|
|
__('An attempt failed on a passworded post with password "%s" at "%s"'),
|
|
|
|
'urlHandlerServeDocument',
|
|
|
|
['activityReportBehaviors', 'postPasswordAttempt']
|
|
|
|
);
|
|
|
|
|
|
|
|
// Comment
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->activityReport->addGroup('comment', __('Actions on comments'));
|
2021-09-03 08:01:27 +00:00
|
|
|
|
|
|
|
// from BEHAVIOR coreAfterCommentCreate in inc/core/class.dc.blog.php
|
|
|
|
// duplicate adminAfterCommentCreate in admin/comment.php
|
|
|
|
// duplicate publicAfterCommentCreate in inc/public/lib.urlhandlers.php
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->activityReport->addAction(
|
2021-09-03 08:01:27 +00:00
|
|
|
'comment',
|
|
|
|
'create',
|
|
|
|
__('comment creation'),
|
|
|
|
__('A new comment was created by "%s" on post "%s" at %s'),
|
|
|
|
'coreAfterCommentCreate',
|
|
|
|
['activityReportBehaviors', 'commentCreate']
|
|
|
|
);
|
|
|
|
|
|
|
|
// from BEHAVIOR coreAfterCommentUpdate in inc/core/class.dc.blog.php
|
|
|
|
// duplicate adminAfterCommentUpdate in admin/comment.php
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->activityReport->addAction(
|
2021-09-03 08:01:27 +00:00
|
|
|
'comment',
|
|
|
|
'update',
|
|
|
|
__('updating comment'),
|
|
|
|
__('Comment has been updated by "%s" at %s'),
|
|
|
|
'coreAfterCommentUpdate',
|
|
|
|
['activityReportBehaviors', 'commentUpdate']
|
|
|
|
);
|
|
|
|
|
2022-11-18 20:24:30 +00:00
|
|
|
// Missing coreBeforeCommentDelete in inc/core/class.dc.blog.php
|
2021-09-03 08:01:27 +00:00
|
|
|
// 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
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->activityReport->addAction(
|
2021-09-03 08:01:27 +00:00
|
|
|
'comment',
|
|
|
|
'trackback',
|
|
|
|
__('trackback creation'),
|
|
|
|
__('A new trackback to "%" at "%s" was created on post "%s" at %s'),
|
|
|
|
'coreAfterCommentCreate',
|
|
|
|
['activityReportBehaviors', 'trackbackCreate']
|
|
|
|
);
|
|
|
|
|
2022-11-18 20:24:30 +00:00
|
|
|
// Category
|
|
|
|
dcCore::app()->activityReport->addGroup('category', __('Actions on categories'));
|
2021-09-03 08:01:27 +00:00
|
|
|
|
|
|
|
// from BEHAVIOR adminAfterCategoryCreate in admin/category.php
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->activityReport->addAction(
|
2021-09-03 08:01:27 +00:00
|
|
|
'category',
|
|
|
|
'create',
|
|
|
|
__('category creation'),
|
|
|
|
__('A new category called "%s" was created by "%s" at %s'),
|
|
|
|
'adminAfterCategoryCreate',
|
|
|
|
['activityReportBehaviors', 'categoryCreate']
|
|
|
|
);
|
|
|
|
|
|
|
|
// from BEHAVIOR adminAfterCategoryUpdate in admin/category.php
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->activityReport->addAction(
|
2021-09-03 08:01:27 +00:00
|
|
|
'category',
|
|
|
|
'update',
|
|
|
|
__('updating category'),
|
|
|
|
__('Category called "%s" has been updated by "%s" at %s'),
|
|
|
|
'adminAfterCategoryUpdate',
|
|
|
|
['activityReportBehaviors', 'categoryUpdate']
|
|
|
|
);
|
|
|
|
|
|
|
|
// Missing adminBeforeCategoryDelete in admin/category.php
|
|
|
|
|
2022-11-18 20:24:30 +00:00
|
|
|
// User
|
|
|
|
dcCore::app()->activityReport->addGroup('user', __('Actions on users'));
|
2021-09-03 08:01:27 +00:00
|
|
|
|
|
|
|
// from BEHAVIOR adminAfterUserCreate in admin/user.php
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->activityReport->addAction(
|
2021-09-03 08:01:27 +00:00
|
|
|
'user',
|
|
|
|
'create',
|
|
|
|
__('user creation'),
|
|
|
|
__('A new user named "%s" was created by "%s"'),
|
|
|
|
'adminAfterUserCreate',
|
|
|
|
['activityReportBehaviors', 'userCreate']
|
|
|
|
);
|
|
|
|
|
|
|
|
// from BEHAVIOR adminAfterUserUpdated in admin/user.php
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->activityReport->addAction(
|
2021-09-03 08:01:27 +00:00
|
|
|
'user',
|
|
|
|
'update',
|
|
|
|
__('updating user'),
|
|
|
|
__('User named "%s" has been updated by "%s"'),
|
|
|
|
'adminAfterUserUpdate',
|
|
|
|
['activityReportBehaviors', 'userUpdate']
|
|
|
|
);
|
|
|
|
|
|
|
|
// from BEHAVIOR adminBeforeUserDelete in admin/users.php
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->activityReport->addAction(
|
2021-09-03 08:01:27 +00:00
|
|
|
'user',
|
|
|
|
'delete',
|
|
|
|
__('user deletion'),
|
|
|
|
__('User named "%s" has been deleted by "%"'),
|
|
|
|
'adminBeforeUserDelete',
|
|
|
|
['activityReportBehaviors', 'userDelete']
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-09-02 22:18:08 +00:00
|
|
|
public static function messageActivityReport($message)
|
|
|
|
{
|
2021-09-03 07:45:21 +00:00
|
|
|
$logs = [$message];
|
2022-12-15 23:32:15 +00:00
|
|
|
dcCore::app()->activityReport->addLog(basename(dirname(__DIR__)), 'message', $logs);
|
2021-09-02 22:18:08 +00:00
|
|
|
}
|
|
|
|
|
2021-09-03 07:45:21 +00:00
|
|
|
public static function blogUpdate($cur, $blog_id)
|
2021-09-02 22:18:08 +00:00
|
|
|
{
|
2022-11-18 20:24:30 +00:00
|
|
|
$logs = [dcCore::app()->auth->getInfo('user_cn')];
|
|
|
|
dcCore::app()->activityReport->addLog('blog', 'update', $logs);
|
2021-09-02 22:18:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static function blogP404()
|
|
|
|
{
|
2022-11-18 20:24:30 +00:00
|
|
|
if (dcCore::app()->url->type != '404') {
|
2021-09-03 07:45:21 +00:00
|
|
|
return null;
|
|
|
|
}
|
2022-11-18 20:24:30 +00:00
|
|
|
$logs = [dcCore::app()->blog->url . $_SERVER['QUERY_STRING']];
|
|
|
|
dcCore::app()->activityReport->addLog('blog', 'p404', $logs);
|
2021-09-02 22:18:08 +00:00
|
|
|
}
|
|
|
|
|
2021-09-03 07:45:21 +00:00
|
|
|
public static function postCreate($cur, $post_id)
|
2021-09-02 22:18:08 +00:00
|
|
|
{
|
2022-11-18 20:24:30 +00:00
|
|
|
$type = $cur->post_type ? $cur->post_type : 'post';
|
|
|
|
$post_url = dcCore::app()->blog->getPostURL('', $cur->post_dt, $cur->post_title, $post_id);
|
|
|
|
$logs = [
|
2021-09-02 22:18:08 +00:00
|
|
|
$cur->post_title,
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->auth->getInfo('user_cn'),
|
|
|
|
dcCore::app()->blog->url . dcCore::app()->url->getBase($type) . '/' . $post_url,
|
2021-09-03 07:45:21 +00:00
|
|
|
];
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->activityReport->addLog('post', 'create', $logs);
|
2021-09-02 22:18:08 +00:00
|
|
|
}
|
|
|
|
|
2021-09-03 07:45:21 +00:00
|
|
|
public static function postUpdate($cur, $post_id)
|
2021-09-02 22:18:08 +00:00
|
|
|
{
|
2022-11-18 20:24:30 +00:00
|
|
|
$type = $cur->post_type ? $cur->post_type : 'post';
|
|
|
|
$post_url = dcCore::app()->blog->getPostURL('', $cur->post_dt, $cur->post_title, $post_id);
|
|
|
|
$logs = [
|
2021-09-02 22:18:08 +00:00
|
|
|
$cur->post_title,
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->auth->getInfo('user_cn'),
|
|
|
|
dcCore::app()->blog->url . dcCore::app()->url->getBase($type) . '/' . $post_url,
|
2021-09-03 07:45:21 +00:00
|
|
|
];
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->activityReport->addLog('post', 'update', $logs);
|
2021-09-02 22:18:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static function postDelete($post_id)
|
|
|
|
{
|
2022-11-18 20:24:30 +00:00
|
|
|
$posts = dcCore::app()->blog->getPosts(['post_id' => $post_id, 'limit' => 1]);
|
|
|
|
$logs = [
|
2021-09-02 22:18:08 +00:00
|
|
|
$posts->post_title,
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->auth->getInfo('user_cn'),
|
2021-09-03 07:45:21 +00:00
|
|
|
];
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->activityReport->addLog('post', 'delete', $logs);
|
2021-09-02 22:18:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static function postPasswordAttempt($result)
|
|
|
|
{
|
2021-09-03 07:45:21 +00:00
|
|
|
if ($result['tpl'] != 'password-form.html' || empty($_POST['password'])) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
$logs = [
|
2021-09-02 22:18:08 +00:00
|
|
|
$_POST['password'],
|
2022-11-18 20:24:30 +00:00
|
|
|
http::getSelfURI(),
|
2021-09-03 07:45:21 +00:00
|
|
|
];
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->activityReport->addLog('post', 'protection', $logs);
|
2021-09-02 22:18:08 +00:00
|
|
|
}
|
|
|
|
|
2021-09-03 07:45:21 +00:00
|
|
|
public static function commentCreate($blog, $cur)
|
2021-09-02 22:18:08 +00:00
|
|
|
{
|
2021-09-03 07:45:21 +00:00
|
|
|
if ($cur->comment_trackback) {
|
|
|
|
return null;
|
|
|
|
}
|
2022-11-18 20:24:30 +00:00
|
|
|
$posts = dcCore::app()->blog->getPosts(['post_id' => $cur->post_id, 'limit' => 1]);
|
|
|
|
$logs = [
|
2021-09-02 22:18:08 +00:00
|
|
|
$cur->comment_author,
|
|
|
|
$posts->post_title,
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->blog->url . dcCore::app()->url->getBase($posts->post_type) .
|
|
|
|
'/' . $posts->post_url . '#c' . $cur->comment_id,
|
2021-09-03 07:45:21 +00:00
|
|
|
];
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->activityReport->addLog('comment', 'create', $logs);
|
2021-09-02 22:18:08 +00:00
|
|
|
}
|
|
|
|
|
2021-09-03 07:45:21 +00:00
|
|
|
public static function commentUpdate($blog, $cur, $old)
|
2021-09-02 22:18:08 +00:00
|
|
|
{
|
2022-11-18 20:24:30 +00:00
|
|
|
$posts = dcCore::app()->blog->getPosts(['post_id' => $old->post_id, 'limit' => 1]);
|
2021-09-02 22:18:08 +00:00
|
|
|
|
2021-09-03 07:45:21 +00:00
|
|
|
$logs = [
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->auth->getInfo('user_cn'),
|
2021-09-02 22:18:08 +00:00
|
|
|
$posts->post_title,
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->blog->url . dcCore::app()->url->getBase($posts->post_type) .
|
|
|
|
'/' . $posts->post_url . '#c' . $old->comment_id,
|
2021-09-03 07:45:21 +00:00
|
|
|
];
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->activityReport->addLog('comment', 'update', $logs);
|
2021-09-02 22:18:08 +00:00
|
|
|
}
|
|
|
|
|
2021-09-03 07:45:21 +00:00
|
|
|
public static function trackbackCreate($cur, $comment_id)
|
2021-09-02 22:18:08 +00:00
|
|
|
{
|
2021-09-03 07:45:21 +00:00
|
|
|
// From blog args are $blog, $cur #thks to bruno
|
2022-11-18 20:24:30 +00:00
|
|
|
$c = $cur instanceof dcBlog ? $comment_id : $cur;
|
2021-09-03 07:45:21 +00:00
|
|
|
if (!$c->comment_trackback || !$c->comment_site) {
|
|
|
|
return null;
|
|
|
|
}
|
2022-11-18 20:24:30 +00:00
|
|
|
$posts = dcCore::app()->blog->getPosts(
|
|
|
|
['post_id' => $c->post_id, 'no_content' => true, 'limit' => 1]
|
|
|
|
);
|
2021-09-03 07:45:21 +00:00
|
|
|
if ($posts->isEmpty()) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
$logs = [
|
2021-09-02 22:18:08 +00:00
|
|
|
$c->comment_author,
|
|
|
|
$c->comment_site,
|
|
|
|
$posts->post_title,
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->blog->url . dcCore::app()->url->getBase($posts->post_type) .
|
|
|
|
'/' . $posts->post_url,
|
2021-09-03 07:45:21 +00:00
|
|
|
];
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->activityReport->addLog('comment', 'trackback', $logs);
|
2021-09-02 22:18:08 +00:00
|
|
|
}
|
|
|
|
|
2021-09-03 07:45:21 +00:00
|
|
|
public static function categoryCreate($cur, $cat_id)
|
2021-09-02 22:18:08 +00:00
|
|
|
{
|
2021-09-03 07:45:21 +00:00
|
|
|
$logs = [
|
2021-09-02 22:18:08 +00:00
|
|
|
$cur->cat_title,
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->auth->getInfo('user_cn'),
|
|
|
|
dcCore::app()->blog->url . dcCore::app()->url->getBase('category') . '/' . $cur->cat_url,
|
2021-09-03 07:45:21 +00:00
|
|
|
];
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->activityReport->addLog('category', 'create', $logs);
|
2021-09-02 22:18:08 +00:00
|
|
|
}
|
|
|
|
|
2021-09-03 07:45:21 +00:00
|
|
|
public static function categoryUpdate($cur, $cat_id)
|
2021-09-02 22:18:08 +00:00
|
|
|
{
|
2021-09-03 07:45:21 +00:00
|
|
|
$logs = [
|
2021-09-02 22:18:08 +00:00
|
|
|
$cur->cat_title,
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->auth->getInfo('user_cn'),
|
|
|
|
dcCore::app()->blog->url . dcCore::app()->url->getBase('category') . '/' . $cur->cat_url,
|
2021-09-03 07:45:21 +00:00
|
|
|
];
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->activityReport->addLog('category', 'update', $logs);
|
2021-09-02 22:18:08 +00:00
|
|
|
}
|
|
|
|
|
2021-09-03 07:45:21 +00:00
|
|
|
public static function userCreate($cur, $user_id)
|
2021-09-02 22:18:08 +00:00
|
|
|
{
|
2021-09-03 07:45:21 +00:00
|
|
|
$user_cn = dcUtils::getUserCN(
|
2022-11-18 20:24:30 +00:00
|
|
|
$cur->user_id,
|
2021-09-03 07:45:21 +00:00
|
|
|
$cur->user_name,
|
2022-11-18 20:24:30 +00:00
|
|
|
$cur->user_firstname,
|
2021-09-03 07:45:21 +00:00
|
|
|
$cur->user_displayname
|
|
|
|
);
|
|
|
|
$logs = [
|
2021-09-02 22:18:08 +00:00
|
|
|
$user_cn,
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->auth->getInfo('user_cn'),
|
2021-09-03 07:45:21 +00:00
|
|
|
];
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->activityReport->addLog('user', 'create', $logs);
|
2021-09-02 22:18:08 +00:00
|
|
|
}
|
|
|
|
|
2021-09-03 07:45:21 +00:00
|
|
|
public static function usertUpdate($cur, $user_id)
|
2021-09-02 22:18:08 +00:00
|
|
|
{
|
2021-09-03 07:45:21 +00:00
|
|
|
$user_cn = dcUtils::getUserCN(
|
2022-11-18 20:24:30 +00:00
|
|
|
$cur->user_id,
|
2021-09-03 07:45:21 +00:00
|
|
|
$cur->user_name,
|
2022-11-18 20:24:30 +00:00
|
|
|
$cur->user_firstname,
|
2021-09-03 07:45:21 +00:00
|
|
|
$cur->user_displayname
|
|
|
|
);
|
|
|
|
$logs = [
|
2021-09-02 22:18:08 +00:00
|
|
|
$user_cn,
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->auth->getInfo('user_cn'),
|
2021-09-03 07:45:21 +00:00
|
|
|
];
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->activityReport->addLog('user', 'update', $logs);
|
2021-09-02 22:18:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static function userDelete($user_id)
|
|
|
|
{
|
2022-11-18 20:24:30 +00:00
|
|
|
$users = dcCore::app()->getUser($user_id);
|
2021-09-03 07:45:21 +00:00
|
|
|
$user_cn = dcUtils::getUserCN(
|
2022-11-18 20:24:30 +00:00
|
|
|
$users->user_id,
|
2021-09-03 07:45:21 +00:00
|
|
|
$users->user_name,
|
2022-11-18 20:24:30 +00:00
|
|
|
$users->user_firstname,
|
2021-09-03 07:45:21 +00:00
|
|
|
$users->user_displayname
|
|
|
|
);
|
|
|
|
$logs = [
|
2021-09-02 22:18:08 +00:00
|
|
|
$user_cn,
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->auth->getInfo('user_cn'),
|
2021-09-03 07:45:21 +00:00
|
|
|
];
|
2022-11-18 20:24:30 +00:00
|
|
|
dcCore::app()->activityReport->addLog('user', 'delete', $logs);
|
2021-09-02 22:18:08 +00:00
|
|
|
}
|
2022-11-18 20:24:30 +00:00
|
|
|
}
|