[pLog-svn] r7175 - plog/branches/lifetype-1.2/plugins/badbehavior

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Thu Mar 1 12:24:55 EST 2012


Author: jondaley
Date: 2012-03-01 12:24:55 -0500 (Thu, 01 Mar 2012)
New Revision: 7175

Modified:
   plog/branches/lifetype-1.2/plugins/badbehavior/index.inc.php
   plog/branches/lifetype-1.2/plugins/badbehavior/pluginbadbehavior.class.php
Log:
the SQL insert function must have been moved out of the core at some point.

Modified: plog/branches/lifetype-1.2/plugins/badbehavior/index.inc.php
===================================================================
--- plog/branches/lifetype-1.2/plugins/badbehavior/index.inc.php	2012-02-28 06:05:46 UTC (rev 7174)
+++ plog/branches/lifetype-1.2/plugins/badbehavior/index.inc.php	2012-03-01 17:24:55 UTC (rev 7175)
@@ -84,7 +84,32 @@
 
 		return $rows;
 	}
-	
+
+    // Insert a new record
+    function bb2_insert($settings, $package, $key)
+    {
+        if (!$settings['logging']) return "";
+        $ip = bb2_db_escape($package['ip']);
+        $date = bb2_db_date();
+        $request_method = bb2_db_escape($package['request_method']);
+        $request_uri = bb2_db_escape($package['request_uri']);
+        $server_protocol = bb2_db_escape($package['server_protocol']);
+        $user_agent = bb2_db_escape($package['user_agent']);
+        $headers = "$request_method $request_uri $server_protocol\n";
+        foreach ($package['headers'] as $h => $v) {
+            $headers .= bb2_db_escape("$h: $v\n");
+        }
+        $request_entity = "";
+        if (!strcasecmp($request_method, "POST")) {
+            foreach ($package['request_entity'] as $h => $v) {
+                $request_entity .= bb2_db_escape("$h: $v\n");
+            }
+        }
+        return "INSERT INTO `" . bb2_db_escape($settings['log_table']) . "`
+		(`ip`, `date`, `request_method`, `request_uri`, `server_protocol`, `http_headers`, `user_agent`, `request_entity`, `key`) VALUES
+		('$ip', '$date', '$request_method', '$request_uri', '$server_protocol', '$headers', '$user_agent', '$request_entity', '$key')";
+    }
+
 	// Return emergency contact email address.
 	function bb2_email() {
 		return BB2_EMERGENCY_EMAIL;

Modified: plog/branches/lifetype-1.2/plugins/badbehavior/pluginbadbehavior.class.php
===================================================================
--- plog/branches/lifetype-1.2/plugins/badbehavior/pluginbadbehavior.class.php	2012-02-28 06:05:46 UTC (rev 7174)
+++ plog/branches/lifetype-1.2/plugins/badbehavior/pluginbadbehavior.class.php	2012-03-01 17:24:55 UTC (rev 7175)
@@ -20,7 +20,7 @@
 			$this->desc = "Bad Behavior for LifeType";
 			$this->author = "The Lifetype Project";
 			$this->db =& Db::getDb();
-            $this->version = "20120228";
+            $this->version = "20120301";
 		
 			$config =& Config::getConfig();
 			$prefix = Db::getPrefix();



More information about the pLog-svn mailing list