aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/poche/Poche.class.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/poche/Poche.class.php')
-rwxr-xr-xinc/poche/Poche.class.php41
1 files changed, 38 insertions, 3 deletions
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php
index 6a742019..a601f0a8 100755
--- a/inc/poche/Poche.class.php
+++ b/inc/poche/Poche.class.php
@@ -195,10 +195,11 @@ class Poche
195 } 195 }
196 196
197 if ($autoclose == TRUE) { 197 if ($autoclose == TRUE) {
198 Tools::redirect('?view=home'); 198 Tools::redirect('?view=home&closewin=true');
199 } else { 199 } else {
200 Tools::redirect('?view=home&closewin=true'); 200 Tools::redirect('?view=home');
201 } 201 }
202 return $last_id;
202 break; 203 break;
203 case 'delete': 204 case 'delete':
204 if (isset($_GET['search'])) { 205 if (isset($_GET['search'])) {
@@ -336,6 +337,27 @@ class Poche
336 $this->messages->add('s', _('The tag has been successfully deleted')); 337 $this->messages->add('s', _('The tag has been successfully deleted'));
337 Tools::redirect(); 338 Tools::redirect();
338 break; 339 break;
340
341 case 'reload_article' :
342 Tools::logm('reload article');
343 $id = $_GET['id'];
344 $entry = $this->store->retrieveOneById($id, $this->user->getId());
345 Tools::logm('reload url ' . $entry['url']);
346 $url = new Url(base64_encode($entry['url']));
347 $this->action('add', $url);
348 break;
349
350 /* For some unknown reason I can't get displayView() to work here (it redirects to home view afterwards). So here's a dirty fix which redirects directly to URL */
351 case 'random':
352 $id = 0;
353 while ($this->store->retrieveOneById($id,$this->user->getId()) == null) {
354 $count = $this->store->getEntriesByViewCount($view, $this->user->getId());
355 $id = rand(1,$count);
356 }
357 Tools::logm('get a random article');
358 Tools::redirect('?view=view&id=' . $id);
359 //$this->displayView('view', $id);
360 break;
339 default: 361 default:
340 break; 362 break;
341 } 363 }
@@ -576,6 +598,8 @@ class Poche
576 Tools::redirect($referer); 598 Tools::redirect($referer);
577 } 599 }
578 $this->messages->add('e', _('login failed: bad login or password')); 600 $this->messages->add('e', _('login failed: bad login or password'));
601 // log login failure in web server log to allow fail2ban usage
602 error_log('user '.$login.' authentication failure');
579 Tools::logm('login failed'); 603 Tools::logm('login failed');
580 Tools::redirect(); 604 Tools::redirect();
581 } 605 }
@@ -661,7 +685,18 @@ class Poche
661 $urlsInserted[] = $url; //add 685 $urlsInserted[] = $url; //add
662 if (isset($record['tags']) && trim($record['tags'])) { 686 if (isset($record['tags']) && trim($record['tags'])) {
663 687
664 // @TODO: set tags 688 $tags = explode(',', $record['tags']);
689 foreach($tags as $tag) {
690 $entry_id = $id;
691 $tag_id = $this->store->retrieveTagByValue($tag);
692 if ($tag_id) {
693 $this->store->setTagToEntry($tag_id['id'], $entry_id);
694 } else {
695 $this->store->createTag($tag);
696 $tag_id = $this->store->retrieveTagByValue($tag);
697 $this->store->setTagToEntry($tag_id['id'], $entry_id);
698 }
699 }
665 700
666 } 701 }
667 } 702 }