Simple History - Version 1.0.8

Version Description

  • Added: filter simple_history_allow_db_purge that is used to determine if the history should be purged/cleaned after 60 days or not. Return false and it will never be cleaned.
  • Fixed: fixed a security issue with the RSS feed. User who should not be able to view the feed could get access to it. Please update to this version to keep your change log private!
Download this release

Release Info

Developer eskapism
Plugin Icon 128x128 Simple History
Version 1.0.8
Comparing to
See all releases

Code changes from version 1.0.7 to 1.0.8

Files changed (2) hide show
  1. index.php +11 -4
  2. readme.txt +35 -6
index.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Simple History
4
  Plugin URI: http://eskapism.se/code-playground/simple-history/
5
  Description: Get a log/history/audit log/version history of the changes made by users in WordPress.
6
- Version: 1.0.7
7
  Author: Pär Thernström
8
  Author URI: http://eskapism.se/
9
  License: GPL2
@@ -27,7 +27,7 @@ License: GPL2
27
 
28
  load_plugin_textdomain('simple-history', false, "/simple-history/languages");
29
 
30
- define( "SIMPLE_HISTORY_VERSION", "1.0.7");
31
  define( "SIMPLE_HISTORY_NAME", "Simple History");
32
  // define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/'); // http://playground.ep/wordpress/wp-content/plugins/simple-history/
33
  define( "SIMPLE_HISTORY_URL", plugins_url() . '/simple-history/'); // http://playground.ep/wordpress/wp-content/plugins/simple-history/
@@ -347,7 +347,6 @@ define( "SIMPLE_HISTORY_URL", plugins_url() . '/simple-history/'); // http://p
347
  <title><?php printf(__("History for %s", 'simple-history'), get_bloginfo("name")) ?></title>
348
  <description><?php printf(__("WordPress History for %s", 'simple-history'), get_bloginfo("name")) ?></description>
349
  <link><?php echo get_bloginfo("siteurl") ?></link>
350
- <atom:link href="<?php echo $self_link; ?>" rel="self" type="application/rss+xml" />
351
  <item>
352
  <title><?php _e("Wrong RSS secret", 'simple-history')?></title>
353
  <description><?php _e("Your RSS secret for Simple History RSS feed is wrong. Please see WordPress settings for current link to the RSS feed.", 'simple-history')?></description>
@@ -886,10 +885,18 @@ function simple_history_add($args) {
886
  * @todo: let user set value, if any
887
  */
888
  function simple_history_purge_db() {
 
 
 
 
889
  global $wpdb;
890
  $tableprefix = $wpdb->prefix;
891
  $sql = "DELETE FROM {$tableprefix}simple_history WHERE DATE_ADD(date, INTERVAL 60 DAY) < now()";
892
- $wpdb->query($sql);
 
 
 
 
893
  }
894
 
895
  // widget on dashboard
3
  Plugin Name: Simple History
4
  Plugin URI: http://eskapism.se/code-playground/simple-history/
5
  Description: Get a log/history/audit log/version history of the changes made by users in WordPress.
6
+ Version: 1.0.8
7
  Author: Pär Thernström
8
  Author URI: http://eskapism.se/
9
  License: GPL2
27
 
28
  load_plugin_textdomain('simple-history', false, "/simple-history/languages");
29
 
30
+ define( "SIMPLE_HISTORY_VERSION", "1.0.8");
31
  define( "SIMPLE_HISTORY_NAME", "Simple History");
32
  // define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/'); // http://playground.ep/wordpress/wp-content/plugins/simple-history/
33
  define( "SIMPLE_HISTORY_URL", plugins_url() . '/simple-history/'); // http://playground.ep/wordpress/wp-content/plugins/simple-history/
347
  <title><?php printf(__("History for %s", 'simple-history'), get_bloginfo("name")) ?></title>
348
  <description><?php printf(__("WordPress History for %s", 'simple-history'), get_bloginfo("name")) ?></description>
349
  <link><?php echo get_bloginfo("siteurl") ?></link>
 
350
  <item>
351
  <title><?php _e("Wrong RSS secret", 'simple-history')?></title>
352
  <description><?php _e("Your RSS secret for Simple History RSS feed is wrong. Please see WordPress settings for current link to the RSS feed.", 'simple-history')?></description>
885
  * @todo: let user set value, if any
886
  */
887
  function simple_history_purge_db() {
888
+
889
+ $do_purge_history = TRUE;
890
+ $do_purge_history = apply_filters("simple_history_allow_db_purge", $do_purge_history);
891
+
892
  global $wpdb;
893
  $tableprefix = $wpdb->prefix;
894
  $sql = "DELETE FROM {$tableprefix}simple_history WHERE DATE_ADD(date, INTERVAL 60 DAY) < now()";
895
+
896
+ if ($do_purge_history) {
897
+ $wpdb->query($sql);
898
+ }
899
+
900
  }
901
 
902
  // widget on dashboard
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: eskapism, MarsApril
3
  Donate link: http://eskapism.se/sida/donate/
4
  Tags: history, log, changes, changelog, audit, trail, pages, attachments, users, cms, dashboard, admin
5
  Requires at least: 3.0
6
- Tested up to: 3.4.2
7
- Stable tag: 1.0.7
8
 
9
  View changes made by users within WordPress. See who created a page, uploaded an attachment or approved an comment, and more.
10
 
@@ -46,12 +46,37 @@ If you are a plugin developer and would like to add your own things/events to Si
46
  you can do that by calling the function simple_history_add like this:
47
  `<?php
48
 
49
- # Will show “Plugin your_plugin_name Edited” in the history log
50
- simple_history_add("action=edited&object_type=plugin&object_name=your_plugin_name");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
 
52
- # Will show the history item "Starship USS Enterprise repaired"
53
- simple_history_add("action=repaired&object_type=Starship&object_name=USS Enterprise");
54
 
 
 
 
 
 
 
55
  ?>
56
  `
57
 
@@ -92,6 +117,10 @@ to only use the secret RSS feed to keep track of the changes on you web site/Wor
92
 
93
  == Changelog ==
94
 
 
 
 
 
95
  = 1.0.7 =
96
  - Fixed: Used a PHP shorthand opening tag at a place. Sorry!
97
  - Fixed: Now loads scripts and styles over HTTPS, if that's being used. Thanks to "llch" for the patch.
3
  Donate link: http://eskapism.se/sida/donate/
4
  Tags: history, log, changes, changelog, audit, trail, pages, attachments, users, cms, dashboard, admin
5
  Requires at least: 3.0
6
+ Tested up to: 3.5
7
+ Stable tag: 1.0.8
8
 
9
  View changes made by users within WordPress. See who created a page, uploaded an attachment or approved an comment, and more.
10
 
46
  you can do that by calling the function simple_history_add like this:
47
  `<?php
48
 
49
+ # Check that function exists before trying to use it
50
+ # Just in case someone disabled the history plugin or similar
51
+ if (function_exists("simple_history_add")) {
52
+
53
+ # Log that an email has been sent
54
+ simple_history_add(array(
55
+ "object_type" => "Email",
56
+ "action" => "sent",
57
+ "object_name" => "Hi there"
58
+ ));
59
+
60
+ # Will show “Plugin your_plugin_name Edited” in the history log
61
+ simple_history_add("action=edited&object_type=plugin&object_name=your_plugin_name");
62
+
63
+ # Will show the history item "Starship USS Enterprise repaired"
64
+ simple_history_add("action=repaired&object_type=Starship&object_name=USS Enterprise");
65
+
66
+ ?>
67
+ `
68
+
69
+ #### Never clear the history
70
 
71
+ By default the items in the history log is cleared automatically afer 60 days.
72
+ You can override this behaviour by using a filter, like this:
73
 
74
+ `
75
+ <?php
76
+ // Never clear the database
77
+ add_action("simple_history_allow_db_purge", function($bool) {
78
+ return false;
79
+ });
80
  ?>
81
  `
82
 
117
 
118
  == Changelog ==
119
 
120
+ = 1.0.8 =
121
+ - Added: filter simple_history_allow_db_purge that is used to determine if the history should be purged/cleaned after 60 days or not. Return false and it will never be cleaned.
122
+ - Fixed: fixed a security issue with the RSS feed. User who should not be able to view the feed could get access to it. Please update to this version to keep your change log private!
123
+
124
  = 1.0.7 =
125
  - Fixed: Used a PHP shorthand opening tag at a place. Sorry!
126
  - Fixed: Now loads scripts and styles over HTTPS, if that's being used. Thanks to "llch" for the patch.