diff options
Diffstat (limited to 'inc/poche')
-rwxr-xr-x | inc/poche/Poche.class.php | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 23e51c7e..33dddf1e 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php | |||
@@ -307,6 +307,8 @@ class Poche | |||
307 | $themes[$theme] = $this->getThemeInfo($theme); | 307 | $themes[$theme] = $this->getThemeInfo($theme); |
308 | } | 308 | } |
309 | 309 | ||
310 | ksort($themes); | ||
311 | |||
310 | return $themes; | 312 | return $themes; |
311 | } | 313 | } |
312 | 314 | ||
@@ -403,7 +405,7 @@ class Poche | |||
403 | /** | 405 | /** |
404 | * Call action (mark as fav, archive, delete, etc.) | 406 | * Call action (mark as fav, archive, delete, etc.) |
405 | */ | 407 | */ |
406 | public function action($action, Url $url, $id = 0, $import = FALSE, $autoclose = FALSE) | 408 | public function action($action, Url $url, $id = 0, $import = FALSE, $autoclose = FALSE, $tags = null) |
407 | { | 409 | { |
408 | switch ($action) | 410 | switch ($action) |
409 | { | 411 | { |
@@ -499,8 +501,14 @@ class Poche | |||
499 | } | 501 | } |
500 | break; | 502 | break; |
501 | case 'add_tag' : | 503 | case 'add_tag' : |
502 | $tags = explode(',', $_POST['value']); | 504 | if($import){ |
503 | $entry_id = $_POST['entry_id']; | 505 | $entry_id = $id; |
506 | $tags = explode(',', $tags); | ||
507 | } | ||
508 | else{ | ||
509 | $tags = explode(',', $_POST['value']); | ||
510 | $entry_id = $_POST['entry_id']; | ||
511 | } | ||
504 | $entry = $this->store->retrieveOneById($entry_id, $this->user->getId()); | 512 | $entry = $this->store->retrieveOneById($entry_id, $this->user->getId()); |
505 | if (!$entry) { | 513 | if (!$entry) { |
506 | $this->messages->add('e', _('Article not found!')); | 514 | $this->messages->add('e', _('Article not found!')); |
@@ -527,7 +535,9 @@ class Poche | |||
527 | # we assign the tag to the article | 535 | # we assign the tag to the article |
528 | $this->store->setTagToEntry($tag_id, $entry_id); | 536 | $this->store->setTagToEntry($tag_id, $entry_id); |
529 | } | 537 | } |
530 | Tools::redirect(); | 538 | if(!$import) { |
539 | Tools::redirect(); | ||
540 | } | ||
531 | break; | 541 | break; |
532 | case 'remove_tag' : | 542 | case 'remove_tag' : |
533 | $tag_id = $_GET['tag_id']; | 543 | $tag_id = $_GET['tag_id']; |
@@ -889,14 +899,18 @@ class Poche | |||
889 | $a = $li->find('a'); | 899 | $a = $li->find('a'); |
890 | $url = new Url(base64_encode($a[0]->href)); | 900 | $url = new Url(base64_encode($a[0]->href)); |
891 | $this->action('add', $url, 0, TRUE); | 901 | $this->action('add', $url, 0, TRUE); |
902 | $sequence = ''; | ||
903 | if (STORAGE == 'postgres') { | ||
904 | $sequence = 'entries_id_seq'; | ||
905 | } | ||
906 | $last_id = $this->store->getLastId($sequence); | ||
892 | if ($read == '1') { | 907 | if ($read == '1') { |
893 | $sequence = ''; | ||
894 | if (STORAGE == 'postgres') { | ||
895 | $sequence = 'entries_id_seq'; | ||
896 | } | ||
897 | $last_id = $this->store->getLastId($sequence); | ||
898 | $this->action('toggle_archive', $url, $last_id, TRUE); | 908 | $this->action('toggle_archive', $url, $last_id, TRUE); |
899 | } | 909 | } |
910 | $tags = $a[0]->tags; | ||
911 | if(!empty($tags)) { | ||
912 | $this->action('add_tag',$url,$last_id,true,false,$tags); | ||
913 | } | ||
900 | } | 914 | } |
901 | 915 | ||
902 | # the second <ul> is for read links | 916 | # the second <ul> is for read links |