diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php
index e553946..c476df3 100755
--- a/inc/poche/Poche.class.php
+++ b/inc/poche/Poche.class.php
@@ -1136,36 +1136,52 @@ class Poche
* handle epub
*/
public function createEpub() {
-
- if (isset($_GET['epub']) && isset($_GET['id'])) {
- if ($_GET['id'] == "all") { // we put all entries in the file
- $entries = $this->store->retrieveAll($this->user->getId());
- }
- else { // we put only one entry in the file
+
+ switch ($_GET['method']) {
+ case 'id':
$entryID = filter_var($_GET['id'],FILTER_SANITIZE_NUMBER_INT);
$entry = $this->store->retrieveOneById($entryID, $this->user->getId());
$entries = array($entry);
- }
+ break;
+ case 'all':
+ $entries = $this->store->retrieveAll($this->user->getId());
+ break;
+ case 'tag':
+ $tag = filter_var($_GET['tag'],FILTER_SANITIZE_STRING);
+ $tags_id = $this->store->retrieveAllTags($this->user->getId(),$tag);
+ $tag_id = $tags_id[0]["id"]; // we take the first result, which is supposed to match perfectly. There must be a workaround.
+ $entries = $this->store->retrieveEntriesByTag($tag_id,$this->user->getId());
+ break;
+ case 'category':
+ $category = filter_var($_GET['category'],FILTER_SANITIZE_STRING);
+ $entries = $this->store->getEntriesByView($category,$this->user->getId());
+ break;
+ case 'search':
+ $search = filter_var($_GET['search'],FILTER_SANITIZE_STRING);
+ $entries = $this->store->search($search,$this->user->getId());
+ break;
+ case 'default':
+ die(_('Uh, there is a problem while generating epub.'));
+
}
+
$content_start =
"\n"
- . "\n"
- . "\n"
- . "