Third pass to clean up code
This commit is contained in:
parent
60289b71c4
commit
8b50811b0b
@ -11,12 +11,15 @@
|
|||||||
* @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(
|
||||||
@ -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,195 +218,181 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -416,14 +400,16 @@ class activityReportBehaviors
|
|||||||
{
|
{
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -24,8 +24,8 @@ class activityReport
|
|||||||
private $_global = 0;
|
private $_global = 0;
|
||||||
private $blog = null;
|
private $blog = null;
|
||||||
private $table = '';
|
private $table = '';
|
||||||
private $groups = array();
|
private $groups = [];
|
||||||
private $settings = array();
|
private $settings = [];
|
||||||
private $lock_blog = null;
|
private $lock_blog = null;
|
||||||
private $lock_global = null;
|
private $lock_global = null;
|
||||||
|
|
||||||
@ -55,28 +55,23 @@ class activityReport
|
|||||||
|
|
||||||
public function getGroups($group = null, $action = null)
|
public function getGroups($group = null, $action = null)
|
||||||
{
|
{
|
||||||
if ($action !== null)
|
if ($action !== null) {
|
||||||
{
|
|
||||||
return isset($this->groups[$group]['actions'][$action]) ?
|
return isset($this->groups[$group]['actions'][$action]) ?
|
||||||
$this->groups[$group]['actions'][$action] : null;
|
$this->groups[$group]['actions'][$action] : null;
|
||||||
}
|
} elseif ($group !== null) {
|
||||||
elseif ($group !== null)
|
|
||||||
{
|
|
||||||
return isset($this->groups[$group]) ?
|
return isset($this->groups[$group]) ?
|
||||||
$this->groups[$group] : null;
|
$this->groups[$group] : null;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return $this->groups;
|
return $this->groups;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addGroup($group, $title)
|
public function addGroup($group, $title)
|
||||||
{
|
{
|
||||||
$this->groups[$group] = array(
|
$this->groups[$group] = [
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
'actions'=>array()
|
'actions' => []
|
||||||
);
|
];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,28 +79,28 @@ class activityReport
|
|||||||
{
|
{
|
||||||
if (!isset($this->groups[$group])) return false;
|
if (!isset($this->groups[$group])) return false;
|
||||||
|
|
||||||
$this->groups[$group]['actions'][$action] = array(
|
$this->groups[$group]['actions'][$action] = [
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
'msg' => $msg
|
'msg' => $msg
|
||||||
);
|
];
|
||||||
$this->core->addBehavior($behavior, $function);
|
$this->core->addBehavior($behavior, $function);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getSettings()
|
private function getSettings()
|
||||||
{
|
{
|
||||||
$settings = array();
|
$settings = [
|
||||||
|
'active' => false,
|
||||||
$settings['active'] = false;
|
'obsolete' => 2419200,
|
||||||
$settings['obsolete'] = 2419200;
|
'dashboardItem' => false,
|
||||||
$settings['dashboardItem'] = false;
|
'interval' => 86400,
|
||||||
$settings['interval'] = 86400;
|
'lastreport' => 0,
|
||||||
$settings['lastreport'] = 0;
|
'mailinglist' => [],
|
||||||
$settings['mailinglist'] = array();
|
'mailformat' => 'plain',
|
||||||
$settings['mailformat'] = 'plain';
|
'dateformat' => '%Y-%m-%d %H:%M:%S',
|
||||||
$settings['dateformat'] = '%Y-%m-%d %H:%M:%S';
|
'requests' => [],
|
||||||
$settings['requests'] = array();
|
'blogs' => []
|
||||||
$settings['blogs'] = array();
|
];
|
||||||
|
|
||||||
$this->settings[0] = $this->settings[1] = $settings;
|
$this->settings[0] = $this->settings[1] = $settings;
|
||||||
|
|
||||||
@ -117,32 +112,30 @@ class activityReport
|
|||||||
'ORDER BY setting_id DESC '
|
'ORDER BY setting_id DESC '
|
||||||
);
|
);
|
||||||
|
|
||||||
while($rs->fetch())
|
while($rs->fetch()) {
|
||||||
{
|
|
||||||
$k = $rs->f('setting_id');
|
$k = $rs->f('setting_id');
|
||||||
$v = $rs->f('setting_value');
|
$v = $rs->f('setting_value');
|
||||||
$b = $rs->f('blog_id');
|
$b = $rs->f('blog_id');
|
||||||
$g = $b === null ? 1 : 0;
|
$g = $b === null ? 1 : 0;
|
||||||
|
|
||||||
if (isset($settings[$k]))
|
if (isset($settings[$k])) {
|
||||||
{
|
|
||||||
$this->settings[$g][$k] = self::decode($v);
|
$this->settings[$g][$k] = self::decode($v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# Force blog
|
# Force blog
|
||||||
$this->settings[0]['blogs'] = array(1=>$this->blog);
|
$this->settings[0]['blogs'] = [1 => $this->blog];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSetting($n)
|
public function getSetting($n)
|
||||||
{
|
{
|
||||||
return isset($this->settings[$this->_global][$n]) ?
|
return $this->settings[$this->_global][$n] ?? null;
|
||||||
$this->settings[$this->_global][$n] :
|
|
||||||
null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setSetting($n, $v)
|
public function setSetting($n, $v)
|
||||||
{
|
{
|
||||||
if (!isset($this->settings[$this->_global][$n])) return null;
|
if (!isset($this->settings[$this->_global][$n])) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$c = $this->delSetting($n);
|
$c = $this->delSetting($n);
|
||||||
|
|
||||||
@ -172,14 +165,12 @@ class activityReport
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Action params to put in params['sql']
|
// Action params to put in params['sql']
|
||||||
public static function requests2params($requests)
|
public static function requests2params($requests)
|
||||||
{
|
{
|
||||||
$r = array();
|
$r = [];
|
||||||
foreach($requests as $group => $actions)
|
foreach($requests as $group => $actions) {
|
||||||
{
|
foreach($actions as $action => $is) {
|
||||||
foreach($actions as $action => $is)
|
|
||||||
{
|
|
||||||
$r[] = "activity_group='" . $group ."' AND activity_action='" . $action . "' ";
|
$r[] = "activity_group='" . $group ."' AND activity_action='" . $action . "' ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -188,16 +179,12 @@ class activityReport
|
|||||||
|
|
||||||
public function getLogs($p, $count_only = false)
|
public function getLogs($p, $count_only = false)
|
||||||
{
|
{
|
||||||
if ($count_only)
|
if ($count_only) {
|
||||||
{
|
|
||||||
$r = 'SELECT count(E.activity_id) ';
|
$r = 'SELECT count(E.activity_id) ';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$content_r = empty($p['no_content']) ? 'activity_logs, ' : '';
|
$content_r = empty($p['no_content']) ? 'activity_logs, ' : '';
|
||||||
|
|
||||||
if (!empty($params['columns']) && is_array($params['columns']))
|
if (!empty($params['columns']) && is_array($params['columns'])) {
|
||||||
{
|
|
||||||
$content_r .= implode(', ', $params['columns']) . ', ';
|
$content_r .= implode(', ', $params['columns']) . ', ';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,111 +198,80 @@ class activityReport
|
|||||||
'FROM ' . $this->table . ' E ' .
|
'FROM ' . $this->table . ' E ' .
|
||||||
'LEFT JOIN ' . $this->core->prefix . 'blog B on E.blog_id=B.blog_id ';
|
'LEFT JOIN ' . $this->core->prefix . 'blog B on E.blog_id=B.blog_id ';
|
||||||
|
|
||||||
if (!empty($p['from']))
|
if (!empty($p['from'])) {
|
||||||
{
|
|
||||||
$r .= $p['from'] . ' ';
|
$r .= $p['from'] . ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->_global)
|
if ($this->_global) {
|
||||||
{
|
|
||||||
$r .= "WHERE E.activity_super_status = 0 ";
|
$r .= "WHERE E.activity_super_status = 0 ";
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$r .= "WHERE E.activity_blog_status = 0 ";
|
$r .= "WHERE E.activity_blog_status = 0 ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($p['activity_type']))
|
if (!empty($p['activity_type'])) {
|
||||||
{
|
|
||||||
$r .= "AND E.activity_type = '" . $this->con->escape($p['activity_type']) . "' ";
|
$r .= "AND E.activity_type = '" . $this->con->escape($p['activity_type']) . "' ";
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$r .= "AND E.activity_type = '" . $this->ns . "' ";
|
$r .= "AND E.activity_type = '" . $this->ns . "' ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($p['blog_id']))
|
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']);
|
$r .= 'AND E.blog_id' . $this->con->in($p['blog_id']);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$r .= "AND E.blog_id = '" . $this->con->escape($p['blog_id']) . "' ";
|
$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 ';
|
$r .= 'AND E.blog_id IS NOT NULL ';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$r .= "AND E.blog_id='" . $this->blog . "' ";
|
$r .= "AND E.blog_id='" . $this->blog . "' ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($p['activity_group']))
|
if (isset($p['activity_group'])) {
|
||||||
{
|
if (is_array($p['activity_group']) && !empty($p['activity_group'])) {
|
||||||
if (is_array($p['activity_group']) && !empty($p['activity_group']))
|
|
||||||
{
|
|
||||||
$r .= 'AND E.activity_group ' . $this->con->in($p['activity_group']);
|
$r .= 'AND E.activity_group ' . $this->con->in($p['activity_group']);
|
||||||
}
|
} elseif ($p['activity_group'] != '') {
|
||||||
elseif ($p['activity_group'] != '')
|
|
||||||
{
|
|
||||||
$r .= "AND E.activity_group = '" . $this->con->escape($p['activity_group']) . "' ";
|
$r .= "AND E.activity_group = '" . $this->con->escape($p['activity_group']) . "' ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($p['activity_action']))
|
if (isset($p['activity_action'])) {
|
||||||
{
|
if (is_array($p['activity_action']) && !empty($p['activity_action'])) {
|
||||||
if (is_array($p['activity_action']) && !empty($p['activity_action']))
|
|
||||||
{
|
|
||||||
$r .= 'AND E.activity_action ' . $this->con->in($p['activity_action']);
|
$r .= 'AND E.activity_action ' . $this->con->in($p['activity_action']);
|
||||||
}
|
} elseif ($p['activity_action'] != '') {
|
||||||
elseif ($p['activity_action'] != '')
|
|
||||||
{
|
|
||||||
$r .= "AND E.activity_action = '" . $this->con->escape($p['activity_action']) . "' ";
|
$r .= "AND E.activity_action = '" . $this->con->escape($p['activity_action']) . "' ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($p['activity_blog_status']))
|
if (isset($p['activity_blog_status'])) {
|
||||||
{
|
|
||||||
$r .= "AND E.activity_blog_status = " . ((integer) $p['activity_blog_status']) . " ";
|
$r .= "AND E.activity_blog_status = " . ((integer) $p['activity_blog_status']) . " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($p['activity_super_status']))
|
if (isset($p['activity_super_status'])) {
|
||||||
{
|
|
||||||
$r .= "AND E.activity_super_status = " . ((integer) $p['activity_super_status']) . " ";
|
$r .= "AND E.activity_super_status = " . ((integer) $p['activity_super_status']) . " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($p['from_date_ts']))
|
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 . "' ";
|
$r .= "AND E.activity_dt >= TIMESTAMP '" . $dt . "' ";
|
||||||
}
|
}
|
||||||
if (isset($p['to_date_ts']))
|
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 . "' ";
|
$r .= "AND E.activity_dt < TIMESTAMP '" . $dt . "' ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($p['sql']))
|
if (!empty($p['sql'])) {
|
||||||
{
|
|
||||||
$r .= $p['sql'] . ' ';
|
$r .= $p['sql'] . ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$count_only)
|
if (!$count_only) {
|
||||||
{
|
if (!empty($p['order'])) {
|
||||||
if (!empty($p['order']))
|
|
||||||
{
|
|
||||||
$r .= 'ORDER BY ' . $this->con->escape($p['order']) . ' ';
|
$r .= 'ORDER BY ' . $this->con->escape($p['order']) . ' ';
|
||||||
} else {
|
} else {
|
||||||
$r .= 'ORDER BY E.activity_dt DESC ';
|
$r .= 'ORDER BY E.activity_dt DESC ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$count_only && !empty($p['limit']))
|
if (!$count_only && !empty($p['limit'])) {
|
||||||
{
|
|
||||||
$r .= $this->con->limit($p['limit']);
|
$r .= $this->con->limit($p['limit']);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -324,8 +280,7 @@ class activityReport
|
|||||||
|
|
||||||
public function addLog($group, $action, $logs)
|
public function addLog($group, $action, $logs)
|
||||||
{
|
{
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
$cur = $this->con->openCursor($this->table);
|
$cur = $this->con->openCursor($this->table);
|
||||||
$this->con->writeLock($this->table);
|
$this->con->writeLock($this->table);
|
||||||
|
|
||||||
@ -339,20 +294,22 @@ class activityReport
|
|||||||
|
|
||||||
$cur->insert();
|
$cur->insert();
|
||||||
$this->con->unlock();
|
$this->con->unlock();
|
||||||
}
|
} catch (Exception $e) {
|
||||||
catch (Exception $e) {
|
|
||||||
$this->con->unlock();
|
$this->con->unlock();
|
||||||
$this->core->error->add($e->getMessage());
|
$this->core->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
# Test if email report is needed
|
// Test if email report is needed
|
||||||
$this->needReport();
|
$this->needReport();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function parseLogs($rs)
|
private function parseLogs($rs)
|
||||||
{
|
{
|
||||||
if ($rs->isEmpty()) return '';
|
if ($rs->isEmpty()) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// @todo move this in function
|
||||||
include dirname(__FILE__) . '/lib.parselogs.config.php';
|
include dirname(__FILE__) . '/lib.parselogs.config.php';
|
||||||
|
|
||||||
$from = time();
|
$from = time();
|
||||||
@ -368,11 +325,9 @@ class activityReport
|
|||||||
|
|
||||||
$blog_open = $group_open = false;
|
$blog_open = $group_open = false;
|
||||||
|
|
||||||
while($rs->fetch())
|
while($rs->fetch()) {
|
||||||
{
|
// blog
|
||||||
# Blog
|
if ($rs->blog_id != $blog && $this->_global) {
|
||||||
if ($rs->blog_id != $blog && $this->_global)
|
|
||||||
{
|
|
||||||
if ($group_open) {
|
if ($group_open) {
|
||||||
$res .= $tpl['group_close'];
|
$res .= $tpl['group_close'];
|
||||||
$group_open = false;
|
$group_open = false;
|
||||||
@ -384,38 +339,50 @@ class activityReport
|
|||||||
$blog = $rs->blog_id;
|
$blog = $rs->blog_id;
|
||||||
$group = '';
|
$group = '';
|
||||||
|
|
||||||
$res .= str_replace(array('%TEXT%','%URL%'),array($rs->blog_name.' ('.$rs->blog_id.')',$rs->blog_url),$tpl['blog_title']);
|
$res .= str_replace(
|
||||||
|
['%TEXT%', '%URL%'],
|
||||||
|
[$rs->blog_name . ' (' . $rs->blog_id . ')', $rs->blog_url],
|
||||||
|
$tpl['blog_title']
|
||||||
|
) . $tpl['blog_open'];
|
||||||
|
|
||||||
$res .= $tpl['blog_open'];
|
|
||||||
$blog_open = true;
|
$blog_open = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->groups[$rs->activity_group]))
|
if (isset($this->groups[$rs->activity_group])) {
|
||||||
{
|
// Type
|
||||||
# Type
|
if ($rs->activity_group != $group) {
|
||||||
if ($rs->activity_group != $group)
|
|
||||||
{
|
|
||||||
if ($group_open) {
|
if ($group_open) {
|
||||||
$res .= $tpl['group_close'];
|
$res .= $tpl['group_close'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$group = $rs->activity_group;
|
$group = $rs->activity_group;
|
||||||
|
|
||||||
$res .= str_replace('%TEXT%',__($this->groups[$group]['title']),$tpl['group_title']);
|
$res .= str_replace(
|
||||||
|
'%TEXT%',
|
||||||
|
__($this->groups[$group]['title']),
|
||||||
|
$tpl['group_title']
|
||||||
|
) . $tpl['group_open'];
|
||||||
|
|
||||||
$res .= $tpl['group_open'];
|
|
||||||
$group_open = true;
|
$group_open = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Action
|
// Action
|
||||||
$time = strtotime($rs->activity_dt);
|
$time = strtotime($rs->activity_dt);
|
||||||
$data = self::decode($rs->activity_logs);
|
$data = self::decode($rs->activity_logs);
|
||||||
|
|
||||||
$res .= str_replace(array('%TIME%','%TEXT%'),array(dt::str($dt,$time,$tz),vsprintf(__($this->groups[$group]['actions'][$rs->activity_action]['msg']),$data)),$tpl['action']);
|
$res .= str_replace(
|
||||||
|
['%TIME%', '%TEXT%'],
|
||||||
|
[dt::str($dt, $time, $tz), vsprintf(__($this->groups[$group]['actions'][$rs->activity_action]['msg']), $data)],
|
||||||
|
$tpl['action']
|
||||||
|
);
|
||||||
|
|
||||||
# Period
|
# Period
|
||||||
if ($time < $from) $from = $time;
|
if ($time < $from) {
|
||||||
if ($time > $to) $to = $time;
|
$from = $time;
|
||||||
|
}
|
||||||
|
if ($time > $to) {
|
||||||
|
$to = $time;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -425,34 +392,44 @@ class activityReport
|
|||||||
if ($blog_open) {
|
if ($blog_open) {
|
||||||
$res .= $tpl['blog_close'];
|
$res .= $tpl['blog_close'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($to == 0) {
|
if ($to == 0) {
|
||||||
$res .= str_replace('%TEXT%', __('An error occured when parsing report.'), $tpl['error']);
|
$res .= str_replace('%TEXT%', __('An error occured when parsing report.'), $tpl['error']);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Top of msg
|
// Top of msg
|
||||||
if (empty($res)) return '';
|
if (empty($res)) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
$period = str_replace('%TEXT%',__('Activity report'),$tpl['period_title']);
|
$period = str_replace(
|
||||||
$period .= $tpl['period_open'];
|
'%TEXT%',
|
||||||
|
__('Activity report'),
|
||||||
|
$tpl['period_title']
|
||||||
|
) . $tpl['period_open'];
|
||||||
|
|
||||||
$period .= str_replace('%TEXT%',__("You received a message from your blog's activity report module."),$tpl['info']);
|
$period .= str_replace(
|
||||||
if (!$this->_global)
|
'%TEXT%',
|
||||||
{
|
__("You received a message from your blog's activity report module."),
|
||||||
|
$tpl['info']
|
||||||
|
);
|
||||||
|
if (!$this->_global) {
|
||||||
$period .= str_replace('%TEXT%', $rs->blog_name,$tpl['info']);
|
$period .= str_replace('%TEXT%', $rs->blog_name,$tpl['info']);
|
||||||
$period .= str_replace('%TEXT%', $rs->blog_url,$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']);
|
$period .= str_replace(
|
||||||
|
'%TEXT%',
|
||||||
|
sprintf(__('Period from %s to %s'), dt::str($dt, $from, $tz), dt::str($dt, $to, $tz)),
|
||||||
|
$tpl['info']);
|
||||||
$period .= $tpl['period_close'];
|
$period .= $tpl['period_close'];
|
||||||
|
|
||||||
$res = str_replace(array('%PERIOD%','%TEXT%'),array($period,$res),$tpl['page']);
|
$res = str_replace(['%PERIOD%', '%TEXT%'], [$period, $res], $tpl['page']);
|
||||||
|
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function obsoleteLogs()
|
private function obsoleteLogs()
|
||||||
{
|
{
|
||||||
# Get blogs and logs count
|
// Get blogs and logs count
|
||||||
$rs = $this->con->select(
|
$rs = $this->con->select(
|
||||||
"SELECT blog_id " .
|
"SELECT blog_id " .
|
||||||
'FROM ' . $this->table . ' ' .
|
'FROM ' . $this->table . ' ' .
|
||||||
@ -460,10 +437,11 @@ class activityReport
|
|||||||
'GROUP BY blog_id '
|
'GROUP BY blog_id '
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($rs->isEmpty()) return;
|
if ($rs->isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
while ($rs->fetch())
|
while ($rs->fetch()) {
|
||||||
{
|
|
||||||
$ts = time();
|
$ts = time();
|
||||||
$obs_blog = dt::str('%Y-%m-%d %H:%M:%S', $ts - (integer) $this->settings[0]['obsolete']);
|
$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']);
|
$obs_global = dt::str('%Y-%m-%d %H:%M:%S', $ts - (integer) $this->settings[1]['obsolete']);
|
||||||
@ -476,10 +454,8 @@ class activityReport
|
|||||||
"AND blog_id = '" . $this->con->escape($rs->blog_id) ."' "
|
"AND blog_id = '" . $this->con->escape($rs->blog_id) ."' "
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($this->con->changes())
|
if ($this->con->changes()) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
$cur = $this->con->openCursor($this->table);
|
$cur = $this->con->openCursor($this->table);
|
||||||
$this->con->writeLock($this->table);
|
$this->con->writeLock($this->table);
|
||||||
|
|
||||||
@ -493,8 +469,7 @@ class activityReport
|
|||||||
|
|
||||||
$cur->insert();
|
$cur->insert();
|
||||||
$this->con->unlock();
|
$this->con->unlock();
|
||||||
}
|
} catch (Exception $e) {
|
||||||
catch (Exception $e) {
|
|
||||||
$this->con->unlock();
|
$this->con->unlock();
|
||||||
$this->core->error->add($e->getMessage());
|
$this->core->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
@ -514,7 +489,9 @@ class activityReport
|
|||||||
|
|
||||||
public function deleteLogs()
|
public function deleteLogs()
|
||||||
{
|
{
|
||||||
if (!$this->core->auth->isSuperAdmin()) return;
|
if (!$this->core->auth->isSuperAdmin()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->con->execute(
|
return $this->con->execute(
|
||||||
'DELETE FROM ' . $this->table . ' ' .
|
'DELETE FROM ' . $this->table . ' ' .
|
||||||
@ -524,20 +501,13 @@ class activityReport
|
|||||||
|
|
||||||
private function updateStatus($from_date_ts, $to_date_ts)
|
private function updateStatus($from_date_ts, $to_date_ts)
|
||||||
{
|
{
|
||||||
$r =
|
$r = 'UPDATE ' . $this->table . ' ';
|
||||||
'UPDATE '.$this->table.' ';
|
|
||||||
|
|
||||||
if ($this->_global)
|
if ($this->_global) {
|
||||||
{
|
$r .= "SET activity_super_status = 1 WHERE blog_id IS NOT NULL ";
|
||||||
$r .=
|
} else {
|
||||||
"SET activity_super_status = 1 WHERE blog_id IS NOT NULL ";
|
$r .= "SET activity_blog_status = 1 WHERE blog_id = '" . $this->blog . "' ";
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
$r .=
|
|
||||||
"SET activity_blog_status = 1 WHERE blog_id = '".$this->blog."' ";
|
|
||||||
}
|
|
||||||
|
|
||||||
$r .=
|
$r .=
|
||||||
"AND activity_type = '" . $this->ns . "' " .
|
"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',$from_date_ts) . "' " .
|
||||||
@ -556,8 +526,7 @@ class activityReport
|
|||||||
# Lock a file to see if an update is ongoing
|
# Lock a file to see if an update is ongoing
|
||||||
public function lockUpdate()
|
public function lockUpdate()
|
||||||
{
|
{
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
# Need flock function
|
# Need flock function
|
||||||
if (!function_exists('flock')) {
|
if (!function_exists('flock')) {
|
||||||
throw New Exception("Can't call php function named flock");
|
throw New Exception("Can't call php function named flock");
|
||||||
@ -577,12 +546,11 @@ class activityReport
|
|||||||
);
|
);
|
||||||
# Real path
|
# Real path
|
||||||
$cached_file = path::real($cached_file, false);
|
$cached_file = path::real($cached_file, false);
|
||||||
# Make dir
|
// make dir
|
||||||
if (!is_dir(dirname($cached_file))) {
|
if (!is_dir(dirname($cached_file))) {
|
||||||
|
|
||||||
files::makeDir(dirname($cached_file), true);
|
files::makeDir(dirname($cached_file), true);
|
||||||
}
|
}
|
||||||
# Make file
|
//ake file
|
||||||
if (!file_exists($cached_file)) {
|
if (!file_exists($cached_file)) {
|
||||||
!$fp = @fopen($cached_file, 'w');
|
!$fp = @fopen($cached_file, 'w');
|
||||||
if ($fp === false) {
|
if ($fp === false) {
|
||||||
@ -591,26 +559,22 @@ class activityReport
|
|||||||
fwrite($fp, '1', strlen('1'));
|
fwrite($fp, '1', strlen('1'));
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
# Open file
|
// open file
|
||||||
if (!($fp = @fopen($cached_file, 'r+'))) {
|
if (!($fp = @fopen($cached_file, 'r+'))) {
|
||||||
throw New Exception("Can't open file");
|
throw New Exception("Can't open file");
|
||||||
}
|
}
|
||||||
# Lock file
|
// lock file
|
||||||
if (!flock($fp, LOCK_EX)) {
|
if (!flock($fp, LOCK_EX)) {
|
||||||
throw New Exception("Can't lock file");
|
throw New Exception("Can't lock file");
|
||||||
}
|
}
|
||||||
if ($this->_global)
|
if ($this->_global) {
|
||||||
{
|
|
||||||
$this->lock_global = $fp;
|
$this->lock_global = $fp;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->lock_blog = $fp;
|
$this->lock_blog = $fp;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
} catch (Exception $e) {
|
||||||
catch (Exception $e)
|
// what ?
|
||||||
{
|
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -618,13 +582,10 @@ class activityReport
|
|||||||
|
|
||||||
public function unlockUpdate()
|
public function unlockUpdate()
|
||||||
{
|
{
|
||||||
if ($this->_global)
|
if ($this->_global) {
|
||||||
{
|
|
||||||
@fclose($this->lock_global);
|
@fclose($this->lock_global);
|
||||||
$this->lock_global = null;
|
$this->lock_global = null;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
@fclose($this->lock_blog);
|
@fclose($this->lock_blog);
|
||||||
$this->lock_blog = null;
|
$this->lock_blog = null;
|
||||||
}
|
}
|
||||||
@ -637,15 +598,13 @@ class activityReport
|
|||||||
|
|
||||||
public function needReport($force = false)
|
public function needReport($force = false)
|
||||||
{
|
{
|
||||||
try
|
try {
|
||||||
{
|
// Check if server has mail function
|
||||||
# Check if server has mail function
|
if (!self::hasMailer()) {
|
||||||
if (!self::hasMailer())
|
|
||||||
{
|
|
||||||
throw new Exception('No mail fonction');
|
throw new Exception('No mail fonction');
|
||||||
}
|
}
|
||||||
|
|
||||||
# Limit to one update at a time
|
// Limit to one update at a time
|
||||||
$this->lockUpdate();
|
$this->lockUpdate();
|
||||||
|
|
||||||
$send = false;
|
$send = false;
|
||||||
@ -659,60 +618,53 @@ class activityReport
|
|||||||
$interval = (integer) $this->settings[$this->_global]['interval'];
|
$interval = (integer) $this->settings[$this->_global]['interval'];
|
||||||
$blogs = $this->settings[$this->_global]['blogs'];
|
$blogs = $this->settings[$this->_global]['blogs'];
|
||||||
|
|
||||||
if ($force) $lastreport = 0;
|
if ($force) {
|
||||||
|
$lastreport = 0;
|
||||||
|
}
|
||||||
|
|
||||||
# Check if report is needed
|
// Check if report is needed
|
||||||
if ($active && !empty($mailinglist) && !empty($requests) && !empty($blogs)
|
if ($active && !empty($mailinglist) && !empty($requests) && !empty($blogs)
|
||||||
&& ($lastreport + $interval) < $now )
|
&& ($lastreport + $interval) < $now
|
||||||
{
|
) {
|
||||||
# Get datas
|
// Get datas
|
||||||
$params = array();
|
$params = [
|
||||||
$params['from_date_ts'] = $lastreport;
|
'from_date_ts' => $lastreport,
|
||||||
$params['to_date_ts'] = $now;
|
'to_date_ts' => $now,
|
||||||
$params['blog_id'] = $blogs;
|
'blog_id' => $blogs,
|
||||||
$params['sql'] = self::requests2params($requests);
|
'sql' => self::requests2params($requests),
|
||||||
$params['order'] = 'blog_id ASC, activity_group ASC, activity_action ASC, activity_dt ASC ';
|
'order' => 'blog_id ASC, activity_group ASC, activity_action ASC, activity_dt ASC '
|
||||||
|
];
|
||||||
|
|
||||||
$logs = $this->getLogs($params);
|
$logs = $this->getLogs($params);
|
||||||
if (!$logs->isEmpty())
|
if (!$logs->isEmpty()) {
|
||||||
{
|
// Datas to readable text
|
||||||
# Datas to readable text
|
|
||||||
$content = $this->parseLogs($logs);
|
$content = $this->parseLogs($logs);
|
||||||
if (!empty($content))
|
if (!empty($content)) {
|
||||||
{
|
// Send mails
|
||||||
# Send mails
|
|
||||||
$send = $this->sendReport($mailinglist, $content, $mailformat);
|
$send = $this->sendReport($mailinglist, $content, $mailformat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Update db
|
// Update db
|
||||||
if ($send || $this->_global) // if global : delete all blog logs even if not selected
|
if ($send || $this->_global) { // if global : delete all blog logs even if not selected
|
||||||
{
|
|
||||||
# Update log status
|
|
||||||
$this->updateStatus($lastreport, $now);
|
$this->updateStatus($lastreport, $now);
|
||||||
# Delete old logs
|
|
||||||
$this->cleanLogs();
|
$this->cleanLogs();
|
||||||
# Then set update time
|
|
||||||
$this->setSetting('lastreport', $now);
|
$this->setSetting('lastreport', $now);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# If this is on a blog, we need to test superAdmin report
|
// If this is on a blog, we need to test superAdmin report
|
||||||
if (!$this->_global)
|
if (!$this->_global) {
|
||||||
{
|
|
||||||
$this->_global = true;
|
$this->_global = true;
|
||||||
$this->needReport();
|
$this->needReport();
|
||||||
$this->_global = false;
|
$this->_global = false;
|
||||||
|
|
||||||
if ($send)
|
if ($send) {
|
||||||
{
|
|
||||||
$this->core->callBehavior('messageActivityReport', 'Activity report has been successfully send by mail.');
|
$this->core->callBehavior('messageActivityReport', 'Activity report has been successfully send by mail.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->unlockUpdate();
|
$this->unlockUpdate();
|
||||||
}
|
} catch (Exception $e) {
|
||||||
catch (Exception $e)
|
|
||||||
{
|
|
||||||
$this->unlockUpdate();
|
$this->unlockUpdate();
|
||||||
//throw $e;
|
//throw $e;
|
||||||
}
|
}
|
||||||
@ -721,28 +673,29 @@ class activityReport
|
|||||||
|
|
||||||
private function sendReport($recipients, $msg, $mailformat =' ')
|
private function sendReport($recipients, $msg, $mailformat =' ')
|
||||||
{
|
{
|
||||||
if (!is_array($recipients) || empty($msg) || !text::isEmail($this->mailer)) return false;
|
if (!is_array($recipients) || empty($msg) || !text::isEmail($this->mailer)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
$mailformat = $mailformat == 'html' ? 'html' : 'plain';
|
$mailformat = $mailformat == 'html' ? 'html' : 'plain';
|
||||||
|
|
||||||
# Checks recipients addresses
|
// Checks recipients addresses
|
||||||
$rc2 = array();
|
$rc2 = [];
|
||||||
foreach ($recipients as $v)
|
foreach ($recipients as $v) {
|
||||||
{
|
|
||||||
$v = trim($v);
|
$v = trim($v);
|
||||||
if (!empty($v) && text::isEmail($v))
|
if (!empty($v) && text::isEmail($v)) {
|
||||||
{
|
|
||||||
$rc2[] = $v;
|
$rc2[] = $v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$recipients = $rc2;
|
$recipients = $rc2;
|
||||||
unset($rc2);
|
unset($rc2);
|
||||||
|
|
||||||
if (empty($recipients)) return false;
|
if (empty($recipients)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
# Sending mails
|
# Sending mails
|
||||||
try
|
try {
|
||||||
{
|
$headers = [
|
||||||
$headers = array(
|
|
||||||
'From: ' . mail::B64Header(__('Activity report module')) . ' <' . $this->mailer . '>',
|
'From: ' . mail::B64Header(__('Activity report module')) . ' <' . $this->mailer . '>',
|
||||||
'Reply-To: <' . $this->mailer . '>',
|
'Reply-To: <' . $this->mailer . '>',
|
||||||
'Content-Type: text/' . $mailformat . '; charset=UTF-8;',
|
'Content-Type: text/' . $mailformat . '; charset=UTF-8;',
|
||||||
@ -752,22 +705,19 @@ class activityReport
|
|||||||
'X-Blog-Id: ' . mail::B64Header($this->core->blog->id),
|
'X-Blog-Id: ' . mail::B64Header($this->core->blog->id),
|
||||||
'X-Blog-Name: ' . mail::B64Header($this->core->blog->name),
|
'X-Blog-Name: ' . mail::B64Header($this->core->blog->name),
|
||||||
'X-Blog-Url: ' . mail::B64Header($this->core->blog->url)
|
'X-Blog-Url: ' . mail::B64Header($this->core->blog->url)
|
||||||
);
|
];
|
||||||
|
|
||||||
$subject = $this->_global ?
|
$subject = $this->_global ?
|
||||||
mail::B64Header(__('Blog activity report')) :
|
mail::B64Header(__('Blog activity report')) :
|
||||||
mail::B64Header('[' . $this->core->blog->name . '] ' . __('Blog activity report'));
|
mail::B64Header('[' . $this->core->blog->name . '] ' . __('Blog activity report'));
|
||||||
|
|
||||||
$done = true;
|
$done = true;
|
||||||
foreach ($recipients as $email)
|
foreach ($recipients as $email) {
|
||||||
{
|
|
||||||
if (true !== mail::sendMail($email, $subject, $msg, $headers)) {
|
if (true !== mail::sendMail($email, $subject, $msg, $headers)) {
|
||||||
$done = false;
|
$done = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $e) {
|
||||||
catch (Exception $e)
|
|
||||||
{
|
|
||||||
$done = false;
|
$done = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,10 +11,8 @@
|
|||||||
* @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_title' => '<h2><a href="%URL%">%TEXT%</a></h2>',
|
||||||
'blog_open' => '',
|
'blog_open' => '',
|
||||||
'blog_close' => '',
|
'blog_close' => '',
|
||||||
@ -28,7 +26,6 @@ $format = array(
|
|||||||
'period_close' => '</ul>',
|
'period_close' => '</ul>',
|
||||||
'info' => '<li>%TEXT%</li>',
|
'info' => '<li>%TEXT%</li>',
|
||||||
'page' =>
|
'page' =>
|
||||||
|
|
||||||
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'."\n".
|
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'."\n".
|
||||||
'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">'."\n".
|
'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">'."\n".
|
||||||
"<head><title>".__('Activity report')."</title>".
|
"<head><title>".__('Activity report')."</title>".
|
||||||
@ -47,10 +44,8 @@ $format = array(
|
|||||||
'<div class="info">%PERIOD%</div><div class="content">%TEXT%</div>'.
|
'<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>'.
|
'<div class="foot"><p>Powered by <a href="http://dotclear.jcdenis.com/go/activityReport">activityReport</a></p></div>'.
|
||||||
"</body></html>"
|
"</body></html>"
|
||||||
|
],
|
||||||
),
|
'plain' => [
|
||||||
'plain' => array(
|
|
||||||
|
|
||||||
'blog_title' => "\n--- %TEXT% ---\n",
|
'blog_title' => "\n--- %TEXT% ---\n",
|
||||||
'blog_open' => '',
|
'blog_open' => '',
|
||||||
'blog_close' => '',
|
'blog_close' => '',
|
||||||
@ -64,7 +59,6 @@ $format = array(
|
|||||||
'period_close' => '',
|
'period_close' => '',
|
||||||
'info' => "%TEXT%\n",
|
'info' => "%TEXT%\n",
|
||||||
'page' =>
|
'page' =>
|
||||||
|
|
||||||
"%PERIOD%\n-----------------------------------------------------------\n%TEXT%"
|
"%PERIOD%\n-----------------------------------------------------------\n%TEXT%"
|
||||||
|
]
|
||||||
));
|
];
|
@ -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) .
|
||||||
@ -49,4 +50,4 @@ 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 New Issue
Block a user