send mail for each pingback
authorChristian Weiske <cweiske@cweiske.de>
Mon, 19 Nov 2012 21:45:48 +0000 (22:45 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Mon, 19 Nov 2012 21:45:48 +0000 (22:45 +0100)
.gitignore
www/xmlrpc.php

index 8ce138d..f2b734f 100644 (file)
@@ -1 +1,2 @@
 data/config.php
+www/test.htm
index baaceea..b022011 100644 (file)
@@ -51,6 +51,7 @@ class PingbackStorage
             )
         );
     }
+
     /**
      * Verifies that a link from $source to $target exists.
      *
@@ -70,7 +71,27 @@ class PingbackStorage
     }
 }
 
+class PingbackMailer
+    implements \PEAR2\Services\Pingback2\Server_Callback_IStorage
+{
+    public function storePingback(
+        $target, $source, $sourceBody, \HTTP_Request2_Response $res
+    ) {
+        mail(
+            'cweiske@cweiske.de',
+            'New pingback',
+            "A pingback just came in, for\n"
+            . '> '  . $target . "\n"
+            . "from\n"
+            . '> ' . $source . "\n"
+            . "\n\nLove, stapibas",
+            "From: stapibas <server@cweiske.de>"
+        );
+    }
+}
+
 $s = new \PEAR2\Services\Pingback2\Server();
 $s->addCallback(new PingbackStorage($db));
+$s->addCallback(new PingbackMailer());
 $s->run();
 ?>