Third pass to clean up code
This commit is contained in:
parent
60289b71c4
commit
8b50811b0b
4 changed files with 515 additions and 584 deletions
|
@ -11,13 +11,16 @@
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @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 null;
|
||||||
|
}
|
||||||
|
|
||||||
if (!defined('ACTIVITY_REPORT')){return;}
|
if (!defined('ACTIVITY_REPORT')) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/* ActivityReport plugin
|
// ActivityReport plugin
|
||||||
-------------------------*/
|
$core->activityReport->addGroup('activityReport', __('ActivityReport messages'));
|
||||||
$core->activityReport->addGroup('activityReport',__('ActivityReport messages'));
|
|
||||||
|
|
||||||
$core->activityReport->addAction(
|
$core->activityReport->addAction(
|
||||||
'activityReport',
|
'activityReport',
|
||||||
|
@ -25,194 +28,189 @@ $core->activityReport->addAction(
|
||||||
__('Special messages'),
|
__('Special messages'),
|
||||||
__('%s'),
|
__('%s'),
|
||||||
'messageActivityReport',
|
'messageActivityReport',
|
||||||
array('activityReportBehaviors','messageActivityReport')
|
['activityReportBehaviors', 'messageActivityReport']
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Blog
|
// Blog
|
||||||
-------------------------*/
|
$core->activityReport->addGroup('blog', __('Actions on blog'));
|
||||||
$core->activityReport->addGroup('blog',__('Actions on blog'));
|
|
||||||
|
|
||||||
# Not use as it is global : BEHAVIOR adminAfterBlogCreate in admin/blog.php
|
// Not use as it is global : BEHAVIOR adminAfterBlogCreate in admin/blog.php
|
||||||
|
|
||||||
# from BEHAVIOR adminAfterBlogUpdate in admin/blog_pref.php
|
// from BEHAVIOR adminAfterBlogUpdate in admin/blog_pref.php
|
||||||
$core->activityReport->addAction(
|
$core->activityReport->addAction(
|
||||||
'blog',
|
'blog',
|
||||||
'update',
|
'update',
|
||||||
__('updating blog'),
|
__('updating blog'),
|
||||||
__('Blog was updated by "%s"'),
|
__('Blog was updated by "%s"'),
|
||||||
'adminAfterBlogUpdate',
|
'adminAfterBlogUpdate',
|
||||||
array('activityReportBehaviors','blogUpdate')
|
['activityReportBehaviors', 'blogUpdate']
|
||||||
);
|
);
|
||||||
|
|
||||||
# from BEHAVIOR publicHeadContent in template
|
// from BEHAVIOR publicHeadContent in template
|
||||||
$core->activityReport->addAction(
|
$core->activityReport->addAction(
|
||||||
'blog',
|
'blog',
|
||||||
'p404',
|
'p404',
|
||||||
__('404 error'),
|
__('404 error'),
|
||||||
__('New 404 error page at "%s"'),
|
__('New 404 error page at "%s"'),
|
||||||
'publicHeadContent',
|
'publicHeadContent',
|
||||||
array('activityReportBehaviors','blogP404')
|
['activityReportBehaviors', 'blogP404']
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Post
|
// Post
|
||||||
-------------------------*/
|
$core->activityReport->addGroup('post', __('Actions on posts'));
|
||||||
$core->activityReport->addGroup('post',__('Actions on posts'));
|
|
||||||
|
|
||||||
# from BEHAVIOR coreAfterPostCreate in inc/core/class.dc.blog.php (DC 2.2)
|
// from BEHAVIOR coreAfterPostCreate in inc/core/class.dc.blog.php (DC 2.2)
|
||||||
# duplicate adminAfterPostCreate in admin/post.php
|
// duplicate adminAfterPostCreate in admin/post.php
|
||||||
# duplicate adminAfterPostCreate in admin/services.php
|
// duplicate adminAfterPostCreate in admin/services.php
|
||||||
$core->activityReport->addAction(
|
$core->activityReport->addAction(
|
||||||
'post',
|
'post',
|
||||||
'create',
|
'create',
|
||||||
__('post creation'),
|
__('post creation'),
|
||||||
__('A new post called "%s" was created by "%s" at %s'),
|
__('A new post called "%s" was created by "%s" at %s'),
|
||||||
'adminAfterPostCreate',
|
'adminAfterPostCreate',
|
||||||
array('activityReportBehaviors','postCreate')
|
['activityReportBehaviors', 'postCreate']
|
||||||
);
|
);
|
||||||
|
|
||||||
# Plugin contribute
|
// Plugin contribute
|
||||||
# from BEHAVIOR publicAfterPostCreate in plugins/contribute/_public.php
|
// from BEHAVIOR publicAfterPostCreate in plugins/contribute/_public.php
|
||||||
$core->activityReport->addAction(
|
$core->activityReport->addAction(
|
||||||
'post',
|
'post',
|
||||||
'create',
|
'create',
|
||||||
__('post creation'),
|
__('post creation'),
|
||||||
__('A new post called "%s" was created by "%s" at %s'),
|
__('A new post called "%s" was created by "%s" at %s'),
|
||||||
'publicAfterPostCreate',
|
'publicAfterPostCreate',
|
||||||
array('activityReportBehaviors','postCreate')
|
['activityReportBehaviors', 'postCreate']
|
||||||
);
|
);
|
||||||
|
|
||||||
# from BEHAVIOR coreAfterPostUpdate in inc/core/class.dc.blog.php (DC2.2)
|
// from BEHAVIOR coreAfterPostUpdate in inc/core/class.dc.blog.php (DC2.2)
|
||||||
# duplicate adminAfterPostUpdate in admin/post.php
|
// duplicate adminAfterPostUpdate in admin/post.php
|
||||||
$core->activityReport->addAction(
|
$core->activityReport->addAction(
|
||||||
'post',
|
'post',
|
||||||
'update',
|
'update',
|
||||||
__('updating post'),
|
__('updating post'),
|
||||||
__('Post called "%s" has been updated by "%s" at %s'),
|
__('Post called "%s" has been updated by "%s" at %s'),
|
||||||
'adminAfterPostUpdate',
|
'adminAfterPostUpdate',
|
||||||
array('activityReportBehaviors','postUpdate')
|
['activityReportBehaviors', 'postUpdate']
|
||||||
);
|
);
|
||||||
|
|
||||||
# from BEHAVIOR adminBeforePostDelete in admin/posts_actions.php
|
// from BEHAVIOR adminBeforePostDelete in admin/posts_actions.php
|
||||||
# from BEHAVIOR adminBeforePostDelete in admin/post.php
|
// from BEHAVIOR adminBeforePostDelete in admin/post.php
|
||||||
$core->activityReport->addAction(
|
$core->activityReport->addAction(
|
||||||
'post',
|
'post',
|
||||||
'delete',
|
'delete',
|
||||||
__('post deletion'),
|
__('post deletion'),
|
||||||
__('Post called "%s" has been deleted by "%s"'),
|
__('Post called "%s" has been deleted by "%s"'),
|
||||||
'adminBeforePostDelete',
|
'adminBeforePostDelete',
|
||||||
array('activityReportBehaviors','postDelete')
|
['activityReportBehaviors', 'postDelete']
|
||||||
);
|
);
|
||||||
|
|
||||||
# Wrong attempt on passworded enrty
|
// Wrong attempt on passworded enrty
|
||||||
# from BEHAVIOR urlHandlerServeDocument in inc/public/lib.urlhandlers.php
|
// from BEHAVIOR urlHandlerServeDocument in inc/public/lib.urlhandlers.php
|
||||||
$core->activityReport->addAction(
|
$core->activityReport->addAction(
|
||||||
'post',
|
'post',
|
||||||
'protection',
|
'protection',
|
||||||
__('Post protection'),
|
__('Post protection'),
|
||||||
__('An attempt failed on a passworded post with password "%s" at "%s"'),
|
__('An attempt failed on a passworded post with password "%s" at "%s"'),
|
||||||
'urlHandlerServeDocument',
|
'urlHandlerServeDocument',
|
||||||
array('activityReportBehaviors','postPasswordAttempt')
|
['activityReportBehaviors', 'postPasswordAttempt']
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Comment
|
// Comment
|
||||||
-------------------------*/
|
|
||||||
$core->activityReport->addGroup('comment',__('Actions on comments'));
|
$core->activityReport->addGroup('comment',__('Actions on comments'));
|
||||||
|
|
||||||
# from BEHAVIOR coreAfterCommentCreate in inc/core/class.dc.blog.php
|
// from BEHAVIOR coreAfterCommentCreate in inc/core/class.dc.blog.php
|
||||||
# duplicate adminAfterCommentCreate in admin/comment.php
|
// duplicate adminAfterCommentCreate in admin/comment.php
|
||||||
# duplicate publicAfterCommentCreate in inc/public/lib.urlhandlers.php
|
// duplicate publicAfterCommentCreate in inc/public/lib.urlhandlers.php
|
||||||
$core->activityReport->addAction(
|
$core->activityReport->addAction(
|
||||||
'comment',
|
'comment',
|
||||||
'create',
|
'create',
|
||||||
__('comment creation'),
|
__('comment creation'),
|
||||||
__('A new comment was created by "%s" on post "%s" at %s'),
|
__('A new comment was created by "%s" on post "%s" at %s'),
|
||||||
'coreAfterCommentCreate',
|
'coreAfterCommentCreate',
|
||||||
array('activityReportBehaviors','commentCreate')
|
['activityReportBehaviors', 'commentCreate']
|
||||||
);
|
);
|
||||||
|
|
||||||
# from BEHAVIOR coreAfterCommentUpdate in inc/core/class.dc.blog.php
|
// from BEHAVIOR coreAfterCommentUpdate in inc/core/class.dc.blog.php
|
||||||
# duplicate adminAfterCommentUpdate in admin/comment.php
|
// duplicate adminAfterCommentUpdate in admin/comment.php
|
||||||
$core->activityReport->addAction(
|
$core->activityReport->addAction(
|
||||||
'comment',
|
'comment',
|
||||||
'update',
|
'update',
|
||||||
__('updating comment'),
|
__('updating comment'),
|
||||||
__('Comment has been updated by "%s" at %s'),
|
__('Comment has been updated by "%s" at %s'),
|
||||||
'coreAfterCommentUpdate',
|
'coreAfterCommentUpdate',
|
||||||
array('activityReportBehaviors','commentUpdate')
|
['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
|
// Missing adminBeforeCommentDelete in admin/comment.php
|
||||||
|
|
||||||
# from BEHAVIOR coreAfterCommentCreate in inc/core/class.dc.blog.php
|
// from BEHAVIOR coreAfterCommentCreate in inc/core/class.dc.blog.php
|
||||||
# duplicate publicAfterTrackbackCreate in inc/core/class.dc.trackback.php
|
// duplicate publicAfterTrackbackCreate in inc/core/class.dc.trackback.php
|
||||||
$core->activityReport->addAction(
|
$core->activityReport->addAction(
|
||||||
'comment',
|
'comment',
|
||||||
'trackback',
|
'trackback',
|
||||||
__('trackback creation'),
|
__('trackback creation'),
|
||||||
__('A new trackback to "%" at "%s" was created on post "%s" at %s'),
|
__('A new trackback to "%" at "%s" was created on post "%s" at %s'),
|
||||||
'coreAfterCommentCreate',
|
'coreAfterCommentCreate',
|
||||||
array('activityReportBehaviors','trackbackCreate')
|
['activityReportBehaviors', 'trackbackCreate']
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Category
|
// Category
|
||||||
-------------------------*/
|
$core->activityReport->addGroup('category', __('Actions on categories'));
|
||||||
$core->activityReport->addGroup('category',__('Actions on categories'));
|
|
||||||
|
|
||||||
# from BEHAVIOR adminAfterCategoryCreate in admin/category.php
|
// from BEHAVIOR adminAfterCategoryCreate in admin/category.php
|
||||||
$core->activityReport->addAction(
|
$core->activityReport->addAction(
|
||||||
'category',
|
'category',
|
||||||
'create',
|
'create',
|
||||||
__('category creation'),
|
__('category creation'),
|
||||||
__('A new category called "%s" was created by "%s" at %s'),
|
__('A new category called "%s" was created by "%s" at %s'),
|
||||||
'adminAfterCategoryCreate',
|
'adminAfterCategoryCreate',
|
||||||
array('activityReportBehaviors','categoryCreate')
|
['activityReportBehaviors', 'categoryCreate']
|
||||||
);
|
);
|
||||||
|
|
||||||
# from BEHAVIOR adminAfterCategoryUpdate in admin/category.php
|
// from BEHAVIOR adminAfterCategoryUpdate in admin/category.php
|
||||||
$core->activityReport->addAction(
|
$core->activityReport->addAction(
|
||||||
'category',
|
'category',
|
||||||
'update',
|
'update',
|
||||||
__('updating category'),
|
__('updating category'),
|
||||||
__('Category called "%s" has been updated by "%s" at %s'),
|
__('Category called "%s" has been updated by "%s" at %s'),
|
||||||
'adminAfterCategoryUpdate',
|
'adminAfterCategoryUpdate',
|
||||||
array('activityReportBehaviors','categoryUpdate')
|
['activityReportBehaviors', 'categoryUpdate']
|
||||||
);
|
);
|
||||||
|
|
||||||
# Missing adminBeforeCategoryDelete in admin/category.php
|
// Missing adminBeforeCategoryDelete in admin/category.php
|
||||||
|
|
||||||
/* User
|
// User
|
||||||
-------------------------*/
|
$core->activityReport->addGroup('user', __('Actions on users'));
|
||||||
$core->activityReport->addGroup('user',__('Actions on users'));
|
|
||||||
|
|
||||||
# from BEHAVIOR adminAfterUserCreate in admin/user.php
|
// from BEHAVIOR adminAfterUserCreate in admin/user.php
|
||||||
$core->activityReport->addAction(
|
$core->activityReport->addAction(
|
||||||
'user',
|
'user',
|
||||||
'create',
|
'create',
|
||||||
__('user creation'),
|
__('user creation'),
|
||||||
__('A new user named "%s" was created by "%s"'),
|
__('A new user named "%s" was created by "%s"'),
|
||||||
'adminAfterUserCreate',
|
'adminAfterUserCreate',
|
||||||
array('activityReportBehaviors','userCreate')
|
['activityReportBehaviors', 'userCreate']
|
||||||
);
|
);
|
||||||
|
|
||||||
# from BEHAVIOR adminAfterUserUpdated in admin/user.php
|
// from BEHAVIOR adminAfterUserUpdated in admin/user.php
|
||||||
$core->activityReport->addAction(
|
$core->activityReport->addAction(
|
||||||
'user',
|
'user',
|
||||||
'update',
|
'update',
|
||||||
__('updating user'),
|
__('updating user'),
|
||||||
__('User named "%s" has been updated by "%s"'),
|
__('User named "%s" has been updated by "%s"'),
|
||||||
'adminAfterUserUpdate',
|
'adminAfterUserUpdate',
|
||||||
array('activityReportBehaviors','userUpdate')
|
['activityReportBehaviors', 'userUpdate']
|
||||||
);
|
);
|
||||||
|
|
||||||
# from BEHAVIOR adminBeforeUserDelete in admin/users.php
|
// from BEHAVIOR adminBeforeUserDelete in admin/users.php
|
||||||
$core->activityReport->addAction(
|
$core->activityReport->addAction(
|
||||||
'user',
|
'user',
|
||||||
'delete',
|
'delete',
|
||||||
__('user deletion'),
|
__('user deletion'),
|
||||||
__('User named "%s" has been deleted by "%"'),
|
__('User named "%s" has been deleted by "%"'),
|
||||||
'adminBeforeUserDelete',
|
'adminBeforeUserDelete',
|
||||||
array('activityReportBehaviors','userDelete')
|
['activityReportBehaviors', 'userDelete']
|
||||||
);
|
);
|
||||||
|
|
||||||
class activityReportBehaviors
|
class activityReportBehaviors
|
||||||
|
@ -220,210 +218,198 @@ class activityReportBehaviors
|
||||||
public static function messageActivityReport($message)
|
public static function messageActivityReport($message)
|
||||||
{
|
{
|
||||||
global $core;
|
global $core;
|
||||||
|
$logs = [$message];
|
||||||
$logs = array($message);
|
$core->activityReport->addLog('activityReport', 'message', $logs);
|
||||||
|
|
||||||
$core->activityReport->addLog('activityReport','message',$logs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function blogUpdate($cur,$blog_id)
|
public static function blogUpdate($cur, $blog_id)
|
||||||
{
|
{
|
||||||
global $core;
|
global $core;
|
||||||
|
$logs = [$core->auth->getInfo('user_cn')];
|
||||||
$logs = array($core->auth->getInfo('user_cn'));
|
$core->activityReport->addLog('blog', 'update' ,$logs);
|
||||||
|
|
||||||
$core->activityReport->addLog('blog','update',$logs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function blogP404()
|
public static function blogP404()
|
||||||
{
|
{
|
||||||
global $core;
|
global $core;
|
||||||
if ($core->url->type != '404') return;
|
if ($core->url->type != '404') {
|
||||||
|
return null;
|
||||||
$logs = array($core->blog->url.$_SERVER['QUERY_STRING']);
|
}
|
||||||
|
$logs = [$core->blog->url . $_SERVER['QUERY_STRING']];
|
||||||
$core->activityReport->addLog('blog','p404',$logs);
|
$core->activityReport->addLog('blog', 'p404', $logs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function postCreate($cur,$post_id)
|
public static function postCreate($cur, $post_id)
|
||||||
{
|
{
|
||||||
global $core;
|
global $core;
|
||||||
|
|
||||||
$type = $cur->post_type ? $cur->post_type : 'post';
|
$type = $cur->post_type ? $cur->post_type : 'post';
|
||||||
$post_url = $core->blog->getPostURL('',$cur->post_dt,$cur->post_title,$post_id);
|
$post_url = $core->blog->getPostURL('', $cur->post_dt, $cur->post_title, $post_id);
|
||||||
|
$logs = [
|
||||||
$logs = array(
|
|
||||||
$cur->post_title,
|
$cur->post_title,
|
||||||
$core->auth->getInfo('user_cn'),
|
$core->auth->getInfo('user_cn'),
|
||||||
$core->blog->url.$core->url->getBase($type).'/'.$post_url
|
$core->blog->url . $core->url->getBase($type) . '/' . $post_url
|
||||||
);
|
];
|
||||||
|
$core->activityReport->addLog('post', 'create', $logs);
|
||||||
$core->activityReport->addLog('post','create',$logs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function postUpdate($cur,$post_id)
|
public static function postUpdate($cur, $post_id)
|
||||||
{
|
{
|
||||||
global $core;
|
global $core;
|
||||||
|
|
||||||
$type = $cur->post_type ? $cur->post_type : 'post';
|
$type = $cur->post_type ? $cur->post_type : 'post';
|
||||||
$post_url = $core->blog->getPostURL('',$cur->post_dt,$cur->post_title,$post_id);
|
$post_url = $core->blog->getPostURL('', $cur->post_dt, $cur->post_title, $post_id);
|
||||||
|
$logs = [
|
||||||
$logs = array(
|
|
||||||
$cur->post_title,
|
$cur->post_title,
|
||||||
$core->auth->getInfo('user_cn'),
|
$core->auth->getInfo('user_cn'),
|
||||||
$core->blog->url.$core->url->getBase($type).'/'.$post_url
|
$core->blog->url . $core->url->getBase($type) . '/' . $post_url
|
||||||
);
|
];
|
||||||
|
$core->activityReport->addLog('post', 'update', $logs);
|
||||||
$core->activityReport->addLog('post','update',$logs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function postDelete($post_id)
|
public static function postDelete($post_id)
|
||||||
{
|
{
|
||||||
global $core;
|
global $core;
|
||||||
$posts = $core->blog->getPosts(array('post_id'=>$post_id,'limit'=>1));
|
$posts = $core->blog->getPosts(['post_id' => $post_id, 'limit' => 1]);
|
||||||
|
$logs = [
|
||||||
$logs = array(
|
|
||||||
$posts->post_title,
|
$posts->post_title,
|
||||||
$core->auth->getInfo('user_cn')
|
$core->auth->getInfo('user_cn')
|
||||||
);
|
];
|
||||||
|
$core->activityReport->addLog('post', 'delete', $logs);
|
||||||
$core->activityReport->addLog('post','delete',$logs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function postPasswordAttempt($result)
|
public static function postPasswordAttempt($result)
|
||||||
{
|
{
|
||||||
global $core;
|
global $core;
|
||||||
if ($result['tpl'] != 'password-form.html' || empty($_POST['password'])) return;
|
if ($result['tpl'] != 'password-form.html' || empty($_POST['password'])) {
|
||||||
|
return null;
|
||||||
$logs = array(
|
}
|
||||||
|
$logs = [
|
||||||
$_POST['password'],
|
$_POST['password'],
|
||||||
http::getSelfURI()
|
http::getSelfURI()
|
||||||
);
|
];
|
||||||
|
$core->activityReport->addLog('post', 'protection', $logs);
|
||||||
$core->activityReport->addLog('post','protection',$logs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function commentCreate($blog,$cur)
|
public static function commentCreate($blog, $cur)
|
||||||
{
|
{
|
||||||
global $core;
|
global $core;
|
||||||
if ($cur->comment_trackback) return;
|
if ($cur->comment_trackback) {
|
||||||
|
return null;
|
||||||
$posts = $core->blog->getPosts(array('post_id'=>$cur->post_id,'limit'=>1));
|
}
|
||||||
|
$posts = $core->blog->getPosts(['post_id' => $cur->post_id, 'limit' => 1]);
|
||||||
$logs = array(
|
$logs = [
|
||||||
$cur->comment_author,
|
$cur->comment_author,
|
||||||
$posts->post_title,
|
$posts->post_title,
|
||||||
$core->blog->url.$core->url->getBase($posts->post_type).
|
$core->blog->url . $core->url->getBase($posts->post_type) .
|
||||||
'/'.$posts->post_url.'#c'.$cur->comment_id
|
'/' . $posts->post_url . '#c' . $cur->comment_id
|
||||||
);
|
];
|
||||||
|
$core->activityReport->addLog('comment', 'create', $logs);
|
||||||
$core->activityReport->addLog('comment','create',$logs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function commentUpdate($blog,$cur,$old)
|
public static function commentUpdate($blog, $cur, $old)
|
||||||
{
|
{
|
||||||
global $core;
|
global $core;
|
||||||
$posts = $core->blog->getPosts(array('post_id'=>$old->post_id,'limit'=>1));
|
$posts = $core->blog->getPosts(['post_id' => $old->post_id, 'limit' => 1]);
|
||||||
|
|
||||||
$logs = array(
|
$logs = [
|
||||||
$core->auth->getInfo('user_cn'),
|
$core->auth->getInfo('user_cn'),
|
||||||
$posts->post_title,
|
$posts->post_title,
|
||||||
$core->blog->url.$core->url->getBase($posts->post_type).
|
$core->blog->url . $core->url->getBase($posts->post_type) .
|
||||||
'/'.$posts->post_url.'#c'.$old->comment_id
|
'/' . $posts->post_url . '#c' . $old->comment_id
|
||||||
);
|
];
|
||||||
|
$core->activityReport->addLog('comment', 'update', $logs);
|
||||||
$core->activityReport->addLog('comment','update',$logs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function trackbackCreate($cur,$comment_id)
|
public static function trackbackCreate($cur, $comment_id)
|
||||||
{
|
{
|
||||||
global $core;
|
global $core;
|
||||||
|
// From blog args are $blog, $cur #thks to bruno
|
||||||
// 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;
|
if (!$c->comment_trackback || !$c->comment_site) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
$posts = $core->blog->getPosts(
|
$posts = $core->blog->getPosts(
|
||||||
array('post_id'=>$c->post_id,'no_content'=>true,'limit'=>1));
|
['post_id' => $c->post_id, 'no_content' => true, 'limit' => 1]);
|
||||||
if ($posts->isEmpty()) return;
|
if ($posts->isEmpty()) {
|
||||||
|
return null;
|
||||||
$logs = array(
|
}
|
||||||
|
$logs = [
|
||||||
$c->comment_author,
|
$c->comment_author,
|
||||||
$c->comment_site,
|
$c->comment_site,
|
||||||
$posts->post_title,
|
$posts->post_title,
|
||||||
$core->blog->url.$core->url->getBase($posts->post_type).
|
$core->blog->url . $core->url->getBase($posts->post_type) .
|
||||||
'/'.$posts->post_url
|
'/' . $posts->post_url
|
||||||
);
|
];
|
||||||
|
$core->activityReport->addLog('comment', 'trackback', $logs);
|
||||||
$core->activityReport->addLog('comment','trackback',$logs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function categoryCreate($cur,$cat_id)
|
public static function categoryCreate($cur, $cat_id)
|
||||||
{
|
{
|
||||||
global $core;
|
global $core;
|
||||||
|
$logs = [
|
||||||
$logs = array(
|
|
||||||
$cur->cat_title,
|
$cur->cat_title,
|
||||||
$core->auth->getInfo('user_cn'),
|
$core->auth->getInfo('user_cn'),
|
||||||
$core->blog->url.$core->url->getBase('category').'/'.$cur->cat_url
|
$core->blog->url . $core->url->getBase('category') . '/' . $cur->cat_url
|
||||||
);
|
];
|
||||||
|
$core->activityReport->addLog('category', 'create', $logs);
|
||||||
$core->activityReport->addLog('category','create',$logs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function categoryUpdate($cur,$cat_id)
|
public static function categoryUpdate($cur, $cat_id)
|
||||||
{
|
{
|
||||||
global $core;
|
global $core;
|
||||||
|
$logs = [
|
||||||
$logs = array(
|
|
||||||
$cur->cat_title,
|
$cur->cat_title,
|
||||||
$core->auth->getInfo('user_cn'),
|
$core->auth->getInfo('user_cn'),
|
||||||
$core->blog->url.$core->url->getBase('category').'/'.$cur->cat_url
|
$core->blog->url . $core->url->getBase('category') . '/' . $cur->cat_url
|
||||||
);
|
];
|
||||||
|
$core->activityReport->addLog('category', 'update', $logs);
|
||||||
$core->activityReport->addLog('category','update',$logs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function userCreate($cur,$user_id)
|
public static function userCreate($cur, $user_id)
|
||||||
{
|
{
|
||||||
global $core;
|
global $core;
|
||||||
$user_cn = dcUtils::getUserCN($cur->user_id, $cur->user_name,
|
$user_cn = dcUtils::getUserCN(
|
||||||
$cur->user_firstname, $cur->user_displayname);
|
$cur->user_id,
|
||||||
|
$cur->user_name,
|
||||||
$logs = array(
|
$cur->user_firstname,
|
||||||
|
$cur->user_displayname
|
||||||
|
);
|
||||||
|
$logs = [
|
||||||
$user_cn,
|
$user_cn,
|
||||||
$core->auth->getInfo('user_cn')
|
$core->auth->getInfo('user_cn')
|
||||||
);
|
];
|
||||||
|
$core->activityReport->addLog('user', 'create', $logs);
|
||||||
$core->activityReport->addLog('user','create',$logs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function usertUpdate($cur,$user_id)
|
public static function usertUpdate($cur, $user_id)
|
||||||
{
|
{
|
||||||
global $core;
|
global $core;
|
||||||
$user_cn = dcUtils::getUserCN($cur->user_id, $cur->user_name,
|
$user_cn = dcUtils::getUserCN(
|
||||||
$cur->user_firstname, $cur->user_displayname);
|
$cur->user_id,
|
||||||
|
$cur->user_name,
|
||||||
$logs = array(
|
$cur->user_firstname,
|
||||||
|
$cur->user_displayname
|
||||||
|
);
|
||||||
|
$logs = [
|
||||||
$user_cn,
|
$user_cn,
|
||||||
$core->auth->getInfo('user_cn')
|
$core->auth->getInfo('user_cn')
|
||||||
);
|
];
|
||||||
|
$core->activityReport->addLog('user', 'update', $logs);
|
||||||
$core->activityReport->addLog('user','update',$logs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function userDelete($user_id)
|
public static function userDelete($user_id)
|
||||||
{
|
{
|
||||||
global $core;
|
global $core;
|
||||||
$users = $core->getUser($id);
|
$users = $core->getUser($id);
|
||||||
$user_cn = dcUtils::getUserCN($users->user_id, $users->user_name,
|
$user_cn = dcUtils::getUserCN(
|
||||||
$users->user_firstname, $users->user_displayname);
|
$users->user_id,
|
||||||
|
$users->user_name,
|
||||||
$logs = array(
|
$users->user_firstname,
|
||||||
|
$users->user_displayname
|
||||||
|
);
|
||||||
|
$logs = [
|
||||||
$user_cn,
|
$user_cn,
|
||||||
$core->auth->getInfo('user_cn')
|
$core->auth->getInfo('user_cn')
|
||||||
);
|
];
|
||||||
|
$core->activityReport->addLog('user', 'delete', $logs);
|
||||||
$core->activityReport->addLog('user','delete',$logs);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load diff
|
@ -11,60 +11,54 @@
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$format = array(
|
$format = [
|
||||||
|
'html' => [
|
||||||
'html' => array(
|
'blog_title' => '<h2><a href="%URL%">%TEXT%</a></h2>',
|
||||||
|
'blog_open' => '',
|
||||||
'blog_title' => '<h2><a href="%URL%">%TEXT%</a></h2>',
|
'blog_close' => '',
|
||||||
'blog_open' => '',
|
'group_title' => '<h3>%TEXT%</h3>',
|
||||||
'blog_close' => '',
|
'group_open' => '<ul>',
|
||||||
'group_title' => '<h3>%TEXT%</h3>',
|
'group_close' => '</ul>',
|
||||||
'group_open' => '<ul>',
|
'action' => '<li><em>%TIME%</em><br />%TEXT%</li>',
|
||||||
'group_close' => '</ul>',
|
'error' => '<p>%TEXT%</p>',
|
||||||
'action' => '<li><em>%TIME%</em><br />%TEXT%</li>',
|
'period_title' => '<h1>%TEXT%</h1>',
|
||||||
'error' => '<p>%TEXT%</p>',
|
'period_open' => '<ul>',
|
||||||
'period_title' => '<h1>%TEXT%</h1>',
|
'period_close' => '</ul>',
|
||||||
'period_open' => '<ul>',
|
'info' => '<li>%TEXT%</li>',
|
||||||
'period_close' => '</ul>',
|
'page' =>
|
||||||
'info' => '<li>%TEXT%</li>',
|
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'."\n".
|
||||||
'page' =>
|
'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">'."\n".
|
||||||
|
"<head><title>".__('Activity report')."</title>".
|
||||||
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'."\n".
|
'<style type="text/css">'.
|
||||||
'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">'."\n".
|
' body { color: #303030; background: #FCFCFC; font-size: 0.7em;font-family: Georgia, Tahoma, Arial, Helvetica, sans-serif; }'.
|
||||||
"<head><title>".__('Activity report')."</title>".
|
' a { color: #303030; text-decoration: none; }'.
|
||||||
'<style type="text/css">'.
|
' h1 { text-align: center; font-size: 2em; }'.
|
||||||
' body { color: #303030; background: #FCFCFC; font-size: 0.7em;font-family: Georgia, Tahoma, Arial, Helvetica, sans-serif; }'.
|
' h2 { color: #303030; text-align:center; }'.
|
||||||
' a { color: #303030; text-decoration: none; }'.
|
' h3 { color: #7F3F3F; }'.
|
||||||
' h1 { text-align: center; font-size: 2em; }'.
|
' li em { color: #303030; }'.
|
||||||
' h2 { color: #303030; text-align:center; }'.
|
' div.info { color: #3F497F; background-color: #F8F8EB; border: 1px solid #888888; margin: 4px; padding: 4px; }'.
|
||||||
' h3 { color: #7F3F3F; }'.
|
' div.content { color: #3F7F47; background-color: #F8F8EB; border: 1px solid #888888; margin: 4px; padding: 4px; }'.
|
||||||
' li em { color: #303030; }'.
|
' div.foot { text-align:center; font-size: 0.9em; }'.
|
||||||
' div.info { color: #3F497F; background-color: #F8F8EB; border: 1px solid #888888; margin: 4px; padding: 4px; }'.
|
'</style>'.
|
||||||
' div.content { color: #3F7F47; background-color: #F8F8EB; border: 1px solid #888888; margin: 4px; padding: 4px; }'.
|
"</head><body>".
|
||||||
' div.foot { text-align:center; font-size: 0.9em; }'.
|
'<div class="info">%PERIOD%</div><div class="content">%TEXT%</div>'.
|
||||||
'</style>'.
|
'<div class="foot"><p>Powered by <a href="http://dotclear.jcdenis.com/go/activityReport">activityReport</a></p></div>'.
|
||||||
"</head><body>".
|
"</body></html>"
|
||||||
'<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>'.
|
'plain' => [
|
||||||
"</body></html>"
|
'blog_title' => "\n--- %TEXT% ---\n",
|
||||||
|
'blog_open' => '',
|
||||||
),
|
'blog_close' => '',
|
||||||
'plain' => array(
|
'group_title' => "\n-- %TEXT% --\n\n",
|
||||||
|
'group_open' => '',
|
||||||
'blog_title' => "\n--- %TEXT% ---\n",
|
'group_close' => '',
|
||||||
'blog_open' => '',
|
'action' => "- %TIME% : %TEXT%\n",
|
||||||
'blog_close' => '',
|
'error' => '%TEXT%',
|
||||||
'group_title' => "\n-- %TEXT% --\n\n",
|
'period_title' => "%TEXT%\n",
|
||||||
'group_open' => '',
|
'period_open' => '',
|
||||||
'group_close' => '',
|
'period_close' => '',
|
||||||
'action' => "- %TIME% : %TEXT%\n",
|
'info' => "%TEXT%\n",
|
||||||
'error' => '%TEXT%',
|
'page' =>
|
||||||
'period_title' => "%TEXT%\n",
|
"%PERIOD%\n-----------------------------------------------------------\n%TEXT%"
|
||||||
'period_open' => '',
|
]
|
||||||
'period_close' => '',
|
];
|
||||||
'info' => "%TEXT%\n",
|
|
||||||
'page' =>
|
|
||||||
|
|
||||||
"%PERIOD%\n-----------------------------------------------------------\n%TEXT%"
|
|
||||||
|
|
||||||
));
|
|
11
index.php
11
index.php
|
@ -23,10 +23,11 @@ dcPage::check('admin');
|
||||||
|
|
||||||
require_once dirname(__FILE__) . '/inc/lib.activity.report.index.php';
|
require_once dirname(__FILE__) . '/inc/lib.activity.report.index.php';
|
||||||
|
|
||||||
$tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : 'blog_settings';
|
$tab = $_REQUEST['tab'] ?? 'blog_settings';
|
||||||
|
$section = $_REQUEST['section'] ?? '';
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<html><head><title><?php echo __('Activity report'); ?></title>' .
|
<html><head><title>'. __('Activity report') . '</title>' .
|
||||||
dcPage::jsLoad('js/_posts_list.js') .
|
dcPage::jsLoad('js/_posts_list.js') .
|
||||||
dcPage::jsToolBar() .
|
dcPage::jsToolBar() .
|
||||||
dcPage::jsPageTabs($tab) .
|
dcPage::jsPageTabs($tab) .
|
||||||
|
@ -42,11 +43,11 @@ if (!activityReport::hasMailer()) {
|
||||||
|
|
||||||
echo '<p class="error">' . __('This server has no mail function, activityReport not send email report.') . '</p>';
|
echo '<p class="error">' . __('This server has no mail function, activityReport not send email report.') . '</p>';
|
||||||
}
|
}
|
||||||
activityReportLib::settingTab($core,__('Settings'));
|
activityReportLib::settingTab($core, __('Settings'));
|
||||||
activityReportLib::logTab($core,__('Logs'));
|
activityReportLib::logTab($core, __('Logs'));
|
||||||
|
|
||||||
if ($core->auth->isSuperAdmin()) {
|
if ($core->auth->isSuperAdmin()) {
|
||||||
activityReportLib::settingTab($core, __('Super settings'), true);
|
activityReportLib::settingTab($core, __('Super settings'), true);
|
||||||
activityReportLib::logTab($core, __('Super logs'), true);
|
activityReportLib::logTab($core, __('Super logs'), true);
|
||||||
}
|
}
|
||||||
echo '</html>';
|
echo '</body></html>';
|
Loading…
Reference in a new issue