diff options
author | Nicolas LÅ“uillet <nicolas.loeuillet@gmail.com> | 2014-01-07 04:20:23 -0800 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas.loeuillet@gmail.com> | 2014-01-07 04:20:23 -0800 |
commit | b4b22940dfbb8b56422e244272d22b7741e6ce7c (patch) | |
tree | 4ab486d3f7dc77a3fab521faff8e72da8dd3de0b /inc | |
parent | 60fc4f4b1ab37fbfe9021f3fa1395d66a4424ed2 (diff) | |
parent | e1cf0fda27df031e478e55d6df08823d42fe2220 (diff) | |
download | wallabag-b4b22940dfbb8b56422e244272d22b7741e6ce7c.tar.gz wallabag-b4b22940dfbb8b56422e244272d22b7741e6ce7c.tar.zst wallabag-b4b22940dfbb8b56422e244272d22b7741e6ce7c.zip |
Merge pull request #387 from inthepoche/dev1.3.1
poche 1.3.1
Diffstat (limited to 'inc')
-rw-r--r-- | inc/3rdparty/FlattrItem.class.php | 4 | ||||
-rw-r--r-- | inc/3rdparty/site_config/custom/interviewmagazine.com.txt | 4 | ||||
-rw-r--r-- | inc/3rdparty/site_config/custom/inthepoche.com.txt | 7 | ||||
-rw-r--r-- | inc/poche/Database.class.php | 6 | ||||
-rw-r--r-- | inc/poche/Poche.class.php | 59 | ||||
-rw-r--r-- | inc/poche/pochePictures.php | 6 |
6 files changed, 44 insertions, 42 deletions
diff --git a/inc/3rdparty/FlattrItem.class.php b/inc/3rdparty/FlattrItem.class.php index 0d3e69d0..711b4ee0 100644 --- a/inc/3rdparty/FlattrItem.class.php +++ b/inc/3rdparty/FlattrItem.class.php | |||
@@ -14,12 +14,12 @@ class FlattrItem { | |||
14 | $flattrResponse = file_get_contents(CACHE . "/flattr/".$id.".cache"); | 14 | $flattrResponse = file_get_contents(CACHE . "/flattr/".$id.".cache"); |
15 | if($flattrResponse != FALSE) { | 15 | if($flattrResponse != FALSE) { |
16 | $result = json_decode($flattrResponse); | 16 | $result = json_decode($flattrResponse); |
17 | if (isset($result->message)){ | 17 | if (isset($result->message)){ |
18 | if ($result->message == "flattrable") { | 18 | if ($result->message == "flattrable") { |
19 | $this->status = FLATTRABLE; | 19 | $this->status = FLATTRABLE; |
20 | } | 20 | } |
21 | } | 21 | } |
22 | elseif ($result->link) { | 22 | elseif (is_object($result) && $result->link) { |
23 | $this->status = FLATTRED; | 23 | $this->status = FLATTRED; |
24 | $this->flattrItemURL = $result->link; | 24 | $this->flattrItemURL = $result->link; |
25 | $this->numflattrs = $result->flattrs; | 25 | $this->numflattrs = $result->flattrs; |
diff --git a/inc/3rdparty/site_config/custom/interviewmagazine.com.txt b/inc/3rdparty/site_config/custom/interviewmagazine.com.txt new file mode 100644 index 00000000..a9d4f8ca --- /dev/null +++ b/inc/3rdparty/site_config/custom/interviewmagazine.com.txt | |||
@@ -0,0 +1,4 @@ | |||
1 | title: //title | ||
2 | body: //div[contains(@class, 'block')] | ||
3 | |||
4 | test_url: http://www.interviewmagazine.com/film/spike-jonze \ No newline at end of file | ||
diff --git a/inc/3rdparty/site_config/custom/inthepoche.com.txt b/inc/3rdparty/site_config/custom/inthepoche.com.txt deleted file mode 100644 index ede74b97..00000000 --- a/inc/3rdparty/site_config/custom/inthepoche.com.txt +++ /dev/null | |||
@@ -1,7 +0,0 @@ | |||
1 | title: //title | ||
2 | body: //div[@class='post-content'] | ||
3 | |||
4 | prune: no | ||
5 | tidy: no | ||
6 | |||
7 | test_url: http://www.inthepoche.com/?post/poche-hosting \ No newline at end of file | ||
diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php index afe02a41..04731821 100644 --- a/inc/poche/Database.class.php +++ b/inc/poche/Database.class.php | |||
@@ -81,7 +81,7 @@ class Database { | |||
81 | 81 | ||
82 | if (STORAGE == 'sqlite') { | 82 | if (STORAGE == 'sqlite') { |
83 | $sql = ' | 83 | $sql = ' |
84 | CREATE TABLE tags_entries ( | 84 | CREATE TABLE IF NOT EXISTS tags_entries ( |
85 | id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, | 85 | id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, |
86 | entry_id INTEGER, | 86 | entry_id INTEGER, |
87 | tag_id INTEGER, | 87 | tag_id INTEGER, |
@@ -337,7 +337,7 @@ class Database { | |||
337 | 337 | ||
338 | public function retrieveEntriesByTag($tag_id) { | 338 | public function retrieveEntriesByTag($tag_id) { |
339 | $sql = | 339 | $sql = |
340 | "SELECT * FROM entries | 340 | "SELECT entries.* FROM entries |
341 | LEFT JOIN tags_entries ON tags_entries.entry_id=entries.id | 341 | LEFT JOIN tags_entries ON tags_entries.entry_id=entries.id |
342 | WHERE tags_entries.tag_id = ?"; | 342 | WHERE tags_entries.tag_id = ?"; |
343 | $query = $this->executeQuery($sql, array($tag_id)); | 343 | $query = $this->executeQuery($sql, array($tag_id)); |
@@ -348,7 +348,7 @@ class Database { | |||
348 | 348 | ||
349 | public function retrieveTagsByEntry($entry_id) { | 349 | public function retrieveTagsByEntry($entry_id) { |
350 | $sql = | 350 | $sql = |
351 | "SELECT * FROM tags | 351 | "SELECT tags.* FROM tags |
352 | LEFT JOIN tags_entries ON tags_entries.tag_id=tags.id | 352 | LEFT JOIN tags_entries ON tags_entries.tag_id=tags.id |
353 | WHERE tags_entries.entry_id = ?"; | 353 | WHERE tags_entries.entry_id = ?"; |
354 | $query = $this->executeQuery($sql, array($entry_id)); | 354 | $query = $this->executeQuery($sql, array($entry_id)); |
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 4f70afb7..76a73be2 100644 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php | |||
@@ -333,7 +333,9 @@ class Poche | |||
333 | switch ($action) | 333 | switch ($action) |
334 | { | 334 | { |
335 | case 'add': | 335 | case 'add': |
336 | $json = file_get_contents(Tools::getPocheUrl() . '/inc/3rdparty/makefulltextfeed.php?url='.urlencode($url->getUrl()).'&max=5&links=preserve&exc=&format=json&submit=Create+Feed'); | 336 | $options = array('http' => array('user_agent' => 'poche')); |
337 | $context = stream_context_create($options); | ||
338 | $json = file_get_contents(Tools::getPocheUrl() . '/inc/3rdparty/makefulltextfeed.php?url='.urlencode($url->getUrl()).'&max=5&links=preserve&exc=&format=json&submit=Create+Feed', false, $context); | ||
337 | $content = json_decode($json, true); | 339 | $content = json_decode($json, true); |
338 | $title = $content['rss']['channel']['item']['title']; | 340 | $title = $content['rss']['channel']['item']['title']; |
339 | $body = $content['rss']['channel']['item']['description']; | 341 | $body = $content['rss']['channel']['item']['description']; |
@@ -806,34 +808,37 @@ class Poche | |||
806 | $url = NULL; | 808 | $url = NULL; |
807 | $favorite = FALSE; | 809 | $favorite = FALSE; |
808 | $archive = FALSE; | 810 | $archive = FALSE; |
809 | foreach ($value as $attr => $attr_value) { | 811 | foreach ($value as $item) { |
810 | if ($attr == 'article__url') { | 812 | foreach ($item as $attr => $value) { |
811 | $url = new Url(base64_encode($attr_value)); | 813 | if ($attr == 'article__url') { |
812 | } | 814 | $url = new Url(base64_encode($value)); |
813 | $sequence = ''; | ||
814 | if (STORAGE == 'postgres') { | ||
815 | $sequence = 'entries_id_seq'; | ||
816 | } | ||
817 | if ($attr_value == 'true') { | ||
818 | if ($attr == 'favorite') { | ||
819 | $favorite = TRUE; | ||
820 | } | 815 | } |
821 | if ($attr == 'archive') { | 816 | $sequence = ''; |
822 | $archive = TRUE; | 817 | if (STORAGE == 'postgres') { |
818 | $sequence = 'entries_id_seq'; | ||
819 | } | ||
820 | if ($value == 'true') { | ||
821 | if ($attr == 'favorite') { | ||
822 | $favorite = TRUE; | ||
823 | } | ||
824 | if ($attr == 'archive') { | ||
825 | $archive = TRUE; | ||
826 | } | ||
823 | } | 827 | } |
824 | } | 828 | } |
825 | } | 829 | |
826 | # we can add the url | 830 | # we can add the url |
827 | if (!is_null($url) && $url->isCorrect()) { | 831 | if (!is_null($url) && $url->isCorrect()) { |
828 | $this->action('add', $url, 0, TRUE); | 832 | $this->action('add', $url, 0, TRUE); |
829 | $count++; | 833 | $count++; |
830 | if ($favorite) { | 834 | if ($favorite) { |
831 | $last_id = $this->store->getLastId($sequence); | 835 | $last_id = $this->store->getLastId($sequence); |
832 | $this->action('toggle_fav', $url, $last_id, TRUE); | 836 | $this->action('toggle_fav', $url, $last_id, TRUE); |
833 | } | 837 | } |
834 | if ($archive) { | 838 | if ($archive) { |
835 | $last_id = $this->store->getLastId($sequence); | 839 | $last_id = $this->store->getLastId($sequence); |
836 | $this->action('toggle_archive', $url, $last_id, TRUE); | 840 | $this->action('toggle_archive', $url, $last_id, TRUE); |
841 | } | ||
837 | } | 842 | } |
838 | } | 843 | } |
839 | } | 844 | } |
@@ -951,7 +956,7 @@ class Poche | |||
951 | if (count($entries) > 0) { | 956 | if (count($entries) > 0) { |
952 | foreach ($entries as $entry) { | 957 | foreach ($entries as $entry) { |
953 | $newItem = $feed->createNewItem(); | 958 | $newItem = $feed->createNewItem(); |
954 | $newItem->setTitle(htmlentities($entry['title'])); | 959 | $newItem->setTitle($entry['title']); |
955 | $newItem->setLink(Tools::getPocheUrl() . '?view=view&id=' . $entry['id']); | 960 | $newItem->setLink(Tools::getPocheUrl() . '?view=view&id=' . $entry['id']); |
956 | $newItem->setDate(time()); | 961 | $newItem->setDate(time()); |
957 | $newItem->setDescription($entry['content']); | 962 | $newItem->setDescription($entry['content']); |
diff --git a/inc/poche/pochePictures.php b/inc/poche/pochePictures.php index 4e4a0b08..b0cfb9df 100644 --- a/inc/poche/pochePictures.php +++ b/inc/poche/pochePictures.php | |||
@@ -84,12 +84,12 @@ function create_assets_directory($id) | |||
84 | { | 84 | { |
85 | $assets_path = ABS_PATH; | 85 | $assets_path = ABS_PATH; |
86 | if(!is_dir($assets_path)) { | 86 | if(!is_dir($assets_path)) { |
87 | mkdir($assets_path, 0705); | 87 | mkdir($assets_path, 0715); |
88 | } | 88 | } |
89 | 89 | ||
90 | $article_directory = $assets_path . $id; | 90 | $article_directory = $assets_path . $id; |
91 | if(!is_dir($article_directory)) { | 91 | if(!is_dir($article_directory)) { |
92 | mkdir($article_directory, 0705); | 92 | mkdir($article_directory, 0715); |
93 | } | 93 | } |
94 | 94 | ||
95 | return $article_directory; | 95 | return $article_directory; |
@@ -107,4 +107,4 @@ function remove_directory($directory) | |||
107 | } | 107 | } |
108 | return rmdir($directory); | 108 | return rmdir($directory); |
109 | } | 109 | } |
110 | } \ No newline at end of file | 110 | } |