use central include file
authorChristian Weiske <cweiske@cweiske.de>
Sun, 23 Mar 2014 12:34:16 +0000 (13:34 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Sun, 23 Mar 2014 12:34:16 +0000 (13:34 +0100)
www/render.php
www/request-feed-update.php
www/www-header.php [new file with mode: 0644]
www/xmlrpc.php

index e460b424ce082f2396d4d35d7e83ddd8725cca71..b844dbe7d9c2597ae9c4631319224162845053cf 100644 (file)
@@ -5,11 +5,7 @@ namespace stapibas;
  *
  * @param string $url URL to get content for
  */
-header('HTTP/1.0 500 Internal Server Error');
-header('Content-type: text/plain');
-
-require_once __DIR__ . '/../data/config.php';
-require_once 'stapibas/autoloader.php';
+require_once 'www-header.php';
 
 if (!isset($_GET['url'])) {
     header('HTTP/1.0 400 Bad Request');
index d82de0727037815cd09c4e29d0aee7f0a402ca6a..4ca1b2737dd5f278f970a05de1db00a21baf1560 100644 (file)
@@ -5,10 +5,7 @@
  *
  * Has to be called via POST, url given in parameter "url".
  */
-header('HTTP/1.0 500 Internal Server Error');
-header('Content-type: text/plain');
-
-require_once __DIR__ . '/../data/config.php';
+require_once 'www-header.php';
 
 if (!isset($_POST['url'])) {
     header('HTTP/1.0 400 Bad Request');
@@ -28,7 +25,6 @@ if (filter_var($url, FILTER_VALIDATE_URL) === false) {
 }
 
 
-$db = new PDO($dbdsn, $dbuser, $dbpass);
 $res = $db->query(
     'SELECT f_id, f_needs_update FROM feeds WHERE f_url = ' . $db->quote($url)
 );
diff --git a/www/www-header.php b/www/www-header.php
new file mode 100644 (file)
index 0000000..f42ebc7
--- /dev/null
@@ -0,0 +1,11 @@
+<?php
+namespace stapibas;
+header('HTTP/1.0 500 Internal Server error');
+header('Content-type: text/plain');
+
+require_once __DIR__ . '/../data/config.php';
+require_once 'stapibas/autoloader.php';
+
+$db = new PDO($dbdsn, $dbuser, $dbpass);
+$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+?>
index e5c2755c5dc9526cdc2d93dc14d2960abcc70802..4b7ce04d7e85f678aeeb5892e51ad5711798af1c 100644 (file)
@@ -3,14 +3,7 @@ namespace stapibas;
 /**
  * Simply stores all pingbacks in the database.
  */
-header('HTTP/1.0 500 Internal Server error');
-header('Content-type: text/plain');
-
-require_once __DIR__ . '/../data/config.php';
-require_once 'stapibas/autoloader.php';
-
-$db = new PDO($dbdsn, $dbuser, $dbpass);
-$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+require_once 'www-header.php';
 
 $s = new \PEAR2\Services\Linkback\Server();
 $s->addCallback(new Linkback_DbStorage($db));