includes/plugins.php
changeset 529 7803c9db3506
parent 528 43535769970b
child 536 218a627eb53e
--- a/includes/plugins.php	Wed Apr 09 22:45:51 2008 -0400
+++ b/includes/plugins.php	Thu Apr 10 07:58:56 2008 -0400
@@ -451,6 +451,16 @@
       }
     }
     
+    // log action
+    $time        = time();
+    $ip_db       = $db->escape($_SERVER['REMOTE_ADDR']);
+    $username_db = $db->escape($session->username);
+    $file_db     = $db->escape($filename);
+    $q = $db->sql_query('INSERT INTO '.table_prefix."logs(log_type, action, time_id, edit_summary, author, page_text) VALUES\n"
+                      . "  ('security', 'plugin_install', $time, '$ip_db', '$username_db', '$file_db');");
+    if ( !$q )
+      $db->_die();
+    
     // register plugin
     $version_db = $db->escape($dataset['version']);
     $filename_db = $db->escape($filename);
@@ -555,6 +565,16 @@
       }
     }
     
+    // log action
+    $time        = time();
+    $ip_db       = $db->escape($_SERVER['REMOTE_ADDR']);
+    $username_db = $db->escape($session->username);
+    $file_db     = $db->escape($filename);
+    $q = $db->sql_query('INSERT INTO '.table_prefix."logs(log_type, action, time_id, edit_summary, author, page_text) VALUES\n"
+                      . "  ('security', 'plugin_uninstall', $time, '$ip_db', '$username_db', '$file_db');");
+    if ( !$q )
+      $db->_die();
+    
     // deregister plugin
     $q = $db->sql_query('DELETE FROM ' . table_prefix . "plugins WHERE plugin_id = {$dataset['plugin id']};");
     if ( !$q )
@@ -766,6 +786,16 @@
       }
     }
     
+    // log action
+    $time        = time();
+    $ip_db       = $db->escape($_SERVER['REMOTE_ADDR']);
+    $username_db = $db->escape($session->username);
+    $file_db     = $db->escape($filename);
+    $q = $db->sql_query('INSERT INTO '.table_prefix."logs(log_type, action, time_id, edit_summary, author, page_text) VALUES\n"
+                      . "  ('security', 'plugin_upgrade', $time, '$ip_db', '$username_db', '$file_db');");
+    if ( !$q )
+      $db->_die();
+    
     // update version number
     $version = $db->escape($dataset['version']);
     $q = $db->sql_query('UPDATE ' . table_prefix . "plugins SET plugin_version = '$version' WHERE plugin_id = {$dataset['plugin id']};");