fix xml problems
[push-tester.git] / www / index.php
index 0a205f80943041fc1f3540dd170fd3c00269f390..9be78bc1289bca6816b25953ec3b5683c287eb02 100644 (file)
@@ -1,30 +1,25 @@
 <?php
 require_once __DIR__ . '/../data/config.php';
 <?php
 require_once __DIR__ . '/../data/config.php';
+require_once __DIR__ . '/functions.php';
 header('Link: <' . $hub . '>; rel="hub"');
 header('Link: <' . $self . '>; rel="self"', false);
 
 header('Link: <' . $hub . '>; rel="hub"');
 header('Link: <' . $self . '>; rel="self"', false);
 
-$files = glob(__DIR__ . '/articles/*.htm');
-$articles = array();
-foreach ($files as $file) {
-    $content = file_get_contents($file);
-    $xml = simplexml_load_string($content);
-    $timestamp = strtotime(basename($file, '.htm'));
-    $articles[$timestamp] = (object) array(
-        'file' => 'articles/' . basename($file),
-        'title' => basename($file, '.htm'),
-        'content' => (string) $xml->body->div,
-        'time' => $timestamp,
-    );
-}
-krsort($articles);
+$articles = loadArticles();
 ?>
 <html xmlns="http://www.w3.org/1999/xhtml">
  <head>
 ?>
 <html xmlns="http://www.w3.org/1999/xhtml">
  <head>
-  <title>PubSubHubbub tester</title>
+  <title>WebSub tester</title>
+  <link rel="alternate" type="application/atom+xml" title="WebSub tester" href="feed.php" />
  </head>
  <body class="h-feed">
   <p>
    <a href="add-article.php">create new article</a>
  </head>
  <body class="h-feed">
   <p>
    <a href="add-article.php">create new article</a>
+   | <a href="feed.php">atom feed</a>
+  </p>
+  <p>
+   This is a tool to test your <a href="https://www.w3.org/TR/websub/">WebSub</a>
+   subscriber.
+   With one click, a new post gets published and the hub gets notified.
   </p>
   <h1>Articles</h1>
   <?php foreach ($articles as $article) { ?>
   </p>
   <h1>Articles</h1>
   <?php foreach ($articles as $article) { ?>