From 60289b71c4f7c298fb22d0351c2813b36a372318 Mon Sep 17 00:00:00 2001
From: Jean-Christian Denis '.
- __($g[$group]['actions'][$rs->activity_action]['title']).
- ' ' .
+ __($g[$group]['actions'][$rs->activity_action]['title']) .
+ ''.__('Activity report').'
'.
- ''.$res.'
';
+ '' . __('Activity report') . '
' .
+ '' . $res . '
';
}
}
}
\ No newline at end of file
diff --git a/_install.php b/_install.php
index 19bdeee..19a2a64 100644
--- a/_install.php
+++ b/_install.php
@@ -11,61 +11,54 @@
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
-if (!defined('DC_CONTEXT_ADMIN')){return;}
+if (!defined('DC_CONTEXT_ADMIN')) {
+ return null;
+}
-$new_version = $core->plugins->moduleInfo('activityReport','version');
+$new_version = $core->plugins->moduleInfo('activityReport', 'version');
$old_version = $core->getVersion('activityReport');
-if (version_compare($old_version,$new_version,'>=')) {return;}
+if (version_compare($old_version, $new_version, '>=')) {
+ return null;
+}
-try
-{
- # Check DC version
- if (version_compare(DC_VERSION,'2.2-beta','<'))
- {
- throw new Exception('translater requires Dotclear 2.2');
- }
-
- # Table
- $s = new dbStruct($core->con,$core->prefix);
+try {
+ $s = new dbStruct($core->con, $core->prefix);
$s->activity
- ->activity_id ('bigint',0,false)
- ->activity_type ('varchar',32,false,"'activityReport'")
- ->blog_id ('varchar',32,true)
- ->activity_group('varchar',32,false)
- ->activity_action ('varchar',32,false)
- ->activity_logs ('text',0,false)
- ->activity_dt ('timestamp',0,false,'now()')
- ->activity_blog_status ('smallint',0,false,0)
- ->activity_super_status ('smallint',0,false,0)
+ ->activity_id ('bigint', 0, false)
+ ->activity_type ('varchar', 32, false, "'activityReport'")
+ ->blog_id ('varchar', 32, true)
+ ->activity_group('varchar', 32, false)
+ ->activity_action ('varchar', 32, false)
+ ->activity_logs ('text', 0, false)
+ ->activity_dt ('timestamp', 0 ,false, 'now()')
+ ->activity_blog_status ('smallint', 0, false,0)
+ ->activity_super_status ('smallint',0, false,0)
- ->primary('pk_activity','activity_id')
- ->index('idx_activity_type','btree','activity_type')
- ->index('idx_activity_blog_id','btree','blog_id')
- ->index('idx_activity_action','btree','activity_group','activity_action')
- ->index('idx_activity_blog_status','btree','activity_blog_status')
- ->index('idx_activity_super_status','btree','activity_super_status');
+ ->primary('pk_activity', 'activity_id')
+ ->index('idx_activity_type', 'btree', 'activity_type')
+ ->index('idx_activity_blog_id', 'btree', 'blog_id')
+ ->index('idx_activity_action', 'btree', 'activity_group', 'activity_action')
+ ->index('idx_activity_blog_status', 'btree', 'activity_blog_status')
+ ->index('idx_activity_super_status', 'btree', 'activity_super_status');
$s->activity_setting
- ->setting_id('varchar',64,false)
- ->blog_id ('varchar',32,true)
- ->setting_type('varchar',32,false)
- ->setting_value('text',0,false)
+ ->setting_id('varchar', 64, false)
+ ->blog_id ('varchar', 32, true)
+ ->setting_type('varchar', 32, false)
+ ->setting_value('text', 0, false)
- ->unique('uk_activity_setting','setting_id','blog_id','setting_type')
- ->index('idx_activity_setting_blog_id','btree','blog_id')
- ->index('idx_activity_setting_type','btree','setting_type');
+ ->unique('uk_activity_setting', 'setting_id', 'blog_id', 'setting_type')
+ ->index('idx_activity_setting_blog_id', 'btree', 'blog_id')
+ ->index('idx_activity_setting_type', 'btree', 'setting_type');
- $si = new dbStruct($core->con,$core->prefix);
+ $si = new dbStruct($core->con, $core->prefix);
$changes = $si->synchronize($s);
- # Version
- $core->setVersion('activityReport',$new_version);
+ $core->setVersion('activityReport', $new_version);
return true;
-}
-catch (Exception $e)
-{
+} catch (Exception $e) {
$core->error->add($e->getMessage());
}
return false;
\ No newline at end of file
diff --git a/_prepend.php b/_prepend.php
index 8f11215..5d61cfb 100644
--- a/_prepend.php
+++ b/_prepend.php
@@ -11,28 +11,25 @@
* @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;
+}
-global $__autoload, $core;
+$__autoload['activityReport'] = dirname(__FILE__) . '/inc/class.activity.report.php';
-$__autoload['activityReport'] =
- dirname(__FILE__).'/inc/class.activity.report.php';
-
-try
-{
+try {
$core->activityReport = new activityReport($core);
$core->url->register(
'activityReport',
'reports',
'^reports/((atom|rss2)/(.+))$',
- array('activityReportPublicUrl','feed')
+ ['activityReportPublicUrl', 'feed']
);
- define('ACTIVITY_REPORT',true);
+ define('ACTIVITY_REPORT', true);
- require_once dirname(__FILE__).'/inc/class.activity.report.behaviors.php';
-}
-catch (Exception $e) {
+ require_once dirname(__FILE__) . '/inc/class.activity.report.behaviors.php';
+} catch (Exception $e) {
//throw new Exception('Failed to launch activityReport');
}
\ No newline at end of file
diff --git a/_public.php b/_public.php
index e62e3fd..db0a45a 100644
--- a/_public.php
+++ b/_public.php
@@ -11,16 +11,19 @@
* @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 null;
+}
-if (!defined('ACTIVITY_REPORT')){return;}
-
-$core->tpl->setPath($core->tpl->getPath(),dirname(__FILE__).'/default-templates/tpl');
-$core->tpl->addBlock('activityReports',array('activityReportPublicTpl','activityReports'));
-$core->tpl->addValue('activityReportFeedID',array('activityReportPublicTpl','activityReportFeedID'));
-$core->tpl->addValue('activityReportTitle',array('activityReportPublicTpl','activityReportTitle'));
-$core->tpl->addValue('activityReportDate',array('activityReportPublicTpl','activityReportDate'));
-$core->tpl->addValue('activityReportContent',array('activityReportPublicTpl','activityReportContent'));
+$core->tpl->setPath($core->tpl->getPath(), dirname(__FILE__).'/default-templates/tpl');
+$core->tpl->addBlock('activityReports', ['activityReportPublicTpl','activityReports']);
+$core->tpl->addValue('activityReportFeedID', ['activityReportPublicTpl','activityReportFeedID']);
+$core->tpl->addValue('activityReportTitle', ['activityReportPublicTpl','activityReportTitle']);
+$core->tpl->addValue('activityReportDate', ['activityReportPublicTpl','activityReportDate']);
+$core->tpl->addValue('activityReportContent', ['activityReportPublicTpl','activityReportContent']);
class activityReportPublicUrl extends dcUrlHandlers
{
@@ -28,17 +31,15 @@ class activityReportPublicUrl extends dcUrlHandlers
{
global $core, $_ctx;
- if (!preg_match('/^(atom|rss2)\/(.+)$/',$args,$m))
- {
+ if (!preg_match('/^(atom|rss2)\/(.+)$/', $args, $m)) {
self::p404();
return;
}
- if (!defined('ACTIVITY_REPORT')){
+ if (!defined('ACTIVITY_REPORT')) {
self::p404();
return;
}
- if (!$core->activityReport->getSetting('active'))
- {
+ if (!$core->activityReport->getSetting('active')) {
self::p404();
return;
}
@@ -52,25 +53,25 @@ class activityReportPublicUrl extends dcUrlHandlers
$_ctx->nb_entry_per_page = $core->blog->settings->system->nb_post_per_feed;
$_ctx->short_feed_items = $core->blog->settings->system->short_feed_items;
- header('X-Robots-Tag: '.context::robotsPolicy($core->blog->settings->system->robots_policy,''));
- self::serveDocument('activityreport-'.$m[1].'.xml',$mime);
+ header('X-Robots-Tag: '. context::robotsPolicy($core->blog->settings->system->robots_policy, ''));
+ self::serveDocument('activityreport-' . $m[1] . '.xml', $mime);
return;
}
}
class activityReportPublicTpl
{
- public static function activityReports($attr,$content)
+ public static function activityReports($attr, $content)
{
$lastn = 0;
if (isset($attr['lastn'])) {
- $lastn = abs((integer) $attr['lastn'])+0;
+ $lastn = abs((integer) $attr['lastn']) + 0;
}
- $p = 'if (!isset($_page_number)) { $_page_number = 1; }'."\n\$params = array();\n";
+ $p = 'if (!isset($_page_number)) { $_page_number = 1; }' . "\n\$params = array();\n";
if ($lastn > 0) {
- $p .= "\$params['limit'] = ".$lastn.";\n";
+ $p .= "\$params['limit'] = " . $lastn . ";\n";
} else {
$p .= "\$params['limit'] = \$_ctx->nb_entry_per_page;\n";
}
@@ -81,36 +82,34 @@ class activityReportPublicTpl
$p .= "\$params['limit'] = array(0, \$params['limit']);\n";
}
- $res =
- "activityreport_params = $params; '."\n".
- '$_ctx->activityreports = $core->activityReport->getLogs($params); unset($params); '."\n".
- 'while ($_ctx->activityreports->fetch()) : ?>'.$content.'activityreports = null; $_ctx->activityreport_params = null; '."\n".
+ return
+ "activityreport_params = $params; ' . "\n" .
+ '$_ctx->activityreports = $core->activityReport->getLogs($params); unset($params); ' . "\n" .
+ 'while ($_ctx->activityreports->fetch()) : ?>'.$content.'activityreports = null; $_ctx->activityreport_params = null; ' . "\n" .
"?>";
-
- return $res;
}
public static function activityReportFeedID($attr)
{
return
- 'urn:md5:activityreports->blog_id.'.
- '$_ctx->activityreports->activity_id.$_ctx->activityreports->activity_dt); '.
+ 'urn:md5:activityreports->blog_id.' .
+ '$_ctx->activityreports->activity_id.$_ctx->activityreports->activity_dt); ' .
'?>';
}
public static function activityReportTitle($attr)
{
$f = $GLOBALS['core']->tpl->getFilters($attr);
- return '';
+ return '';
}
public static function activityReportContent($attr)
{
$f = $GLOBALS['core']->tpl->getFilters($attr);
- return '';
+ return '';
}
public static function activityReportDate($attr)
@@ -126,13 +125,13 @@ class activityReportPublicTpl
$f = $GLOBALS['core']->tpl->getFilters($attr);
if ($rfc822) {
- return 'activityreports->activity_dt),\$core->blog->settings->system->blog_timezone)").'; ?>';
+ return 'activityreports->activity_dt),\$core->blog->settings->system->blog_timezone)") . '; ?>';
} elseif ($iso8601) {
- return 'activityreports->activity_dt),\$core->blog->settings->system->blog_timezone)").'; ?>';
+ return 'activityreports->activity_dt),\$core->blog->settings->system->blog_timezone)") . '; ?>';
} elseif (!empty($format)) {
- return 'activityreports->activity_dt)").'; ?>';
+ return 'activityreports->activity_dt)") . '; ?>';
} else {
- return 'blog->settings->system->date_format,\$_ctx->activityreports->activity_dt)").'; ?>';
+ return 'blog->settings->system->date_format,\$_ctx->activityreports->activity_dt)") . '; ?>';
}
}
}
diff --git a/_uninstall.php b/_uninstall.php
index 0561be0..3f8c22a 100644
--- a/_uninstall.php
+++ b/_uninstall.php
@@ -11,20 +11,22 @@
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
-if (!defined('DC_CONTEXT_ADMIN')){return;}
+if (!defined('DC_CONTEXT_ADMIN')) {
+ return null;
+}
$this->addUserAction(
/* type */ 'tables',
/* action */ 'delete',
/* ns */ 'activity',
- /* description */ sprintf(__('delete %s table'),'"activity"')
+ /* description */ sprintf(__('delete %s table'), '"activity"')
);
$this->addUserAction(
/* type */ 'tables',
/* action */ 'delete',
/* ns */ 'activity_setting',
- /* description */ sprintf(__('delete %s table'),'"activity_setting"')
+ /* description */ sprintf(__('delete %s table'), '"activity_setting"')
);
$this->addUserAction(
@@ -45,12 +47,12 @@ $this->addDirectAction(
/* type */ 'versions',
/* action */ 'delete',
/* ns */ 'activityReport',
- /* description */ sprintf(__('delete %s version number'),'activityReport')
+ /* description */ sprintf(__('delete %s version number'), 'activityReport')
);
$this->addDirectAction(
/* type */ 'plugins',
/* action */ 'delete',
/* ns */ 'activityReport',
- /* description */ sprintf(__('delete %s plugin files'),'activityReport')
+ /* description */ sprintf(__('delete %s plugin files'), 'activityReport')
);
\ No newline at end of file
diff --git a/index.php b/index.php
index 2184863..3688393 100644
--- a/index.php
+++ b/index.php
@@ -11,61 +11,42 @@
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
-if (!defined('DC_CONTEXT_ADMIN')){return;}
+if (!defined('DC_CONTEXT_ADMIN')) {
+ return null;
+}
-if (!defined('ACTIVITY_REPORT')){return;}
+if (!defined('ACTIVITY_REPORT')) {
+ return null;
+}
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';
-?>
-
-
- blog->name).
- ' › '.__('Activity report');
-?>
+echo '
+' . html::escapeHTML($core->blog->name) . ' › ' . __('Activity report') . '
';
-
-
- ' . __('This server has no mail function, activityReport not send email report.') . '
-activityReport - -plugins->moduleInfo('activityReport','version'); ?> - -
- - \ No newline at end of file +echo ''; \ No newline at end of file diff --git a/style.css b/style.css new file mode 100644 index 0000000..715bb53 --- /dev/null +++ b/style.css @@ -0,0 +1,10 @@ +#dashboard-items #report dt { + font-weight: bold; + margin: 0 0 0.4em 0; +} +#dashboard-items #report dd { + font-size: 0.9em; + margin: 0 0 1em 0; } +#dashboard-items #report dd p { + margin: 0.2em 0 0 0; +} \ No newline at end of file