From 322a983bedf3ed60027bed5d2ea28d4daea21d28 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Wed, 23 Jun 2010 22:28:23 +0300 Subject: First commit --- .gitignore | 1 + README | 12 +++++++++ feed.php | 43 ++++++++++++++++++++++++++++++++ fsfeed.db.default | Bin 0 -> 6144 bytes get.php | 20 +++++++++++++++ index.php | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 149 insertions(+) create mode 100644 .gitignore create mode 100644 README create mode 100644 feed.php create mode 100644 fsfeed.db.default create mode 100644 get.php create mode 100644 index.php diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0b30fb1 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +fsfeed.db diff --git a/README b/README new file mode 100644 index 0000000..dc2eecb --- /dev/null +++ b/README @@ -0,0 +1,12 @@ +# Introduction # +fsfeed is a simple PHP app that turns directory paths into Atom feeds. It's useful to run it +on an insecure file server to notify users of file or folder updates. Users can also download +files from their newsreader, provided that the web server has read access to the file. + +By using a combination of the path and modification time as the URN of an entry, it can mark +an updated file as new in the newsreader. + +fsfeed is not and probably never will be, recursive. + +# Usage # +Just copy the fsfeed folder to where your web server can run it from and rename fsfeed.db.default to fsfeed.db. diff --git a/feed.php b/feed.php new file mode 100644 index 0000000..ab89c9c --- /dev/null +++ b/feed.php @@ -0,0 +1,43 @@ +prepare('SELECT * FROM path WHERE id = ?'); +$stmt->execute(array($_GET['f'])); +$rows = current($stmt->fetchAll()); +$path = $rows['path']; +header('Content-Type: application/atom+xml'); +echo ''; +?> + +fsfeed - <?php echo $path ?> + + + fsfeed 0.1 + + urn:uuid: + + + <?php echo basename($p) ?> + urn:uuid: + + + + + + diff --git a/fsfeed.db.default b/fsfeed.db.default new file mode 100644 index 0000000..df8dec1 Binary files /dev/null and b/fsfeed.db.default differ diff --git a/get.php b/get.php new file mode 100644 index 0000000..fd466b5 --- /dev/null +++ b/get.php @@ -0,0 +1,20 @@ + \ No newline at end of file diff --git a/index.php b/index.php new file mode 100644 index 0000000..356288f --- /dev/null +++ b/index.php @@ -0,0 +1,73 @@ +prepare('DELETE FROM path WHERE id = ?'); + $stmt->execute(array($_POST['delete'])); + $msg = 'Path deleted'; +} +if (isset($_POST['add'])) { + if (!realpath($_POST['path']) || empty($_POST['path'])) { + $msg = "Invalid path: {$_POST['path']}"; + } else { + $stmt = $db->prepare('INSERT INTO path (path) VALUES (?)'); + $stmt->execute(array($_POST['path'])); + $msg = 'Path added'; + } +} +$rows = $db->query('SELECT * FROM path')->fetchAll(); +?> + + + + + + fsfeed + + + + +
+ + + + + + + + + + + + + + + + +
+
+ + -- cgit v1.2.3