Skip to content

Commit

Permalink
Merge pull request #64 from aivus/fix_remove_servers
Browse files Browse the repository at this point in the history
Fix duplicate servers after remove
  • Loading branch information
pentium10 committed Sep 4, 2014
2 parents 9bcbdd5 + 64710f0 commit 4d46de7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/include.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,10 @@ protected function _actionDeleteAll($tube = null) {
protected function _actionServersRemove() {
$server = $_GET['removeServer'];
$this->servers = array_diff($this->servers, array($server));
if (count($this->servers)) {
setcookie('beansServers', implode(';', $this->servers), time() + 86400 * 365);
// Servers from cookies save to cookies
$cookie_servers = array_intersect($this->servers, explode(';', $_COOKIE['beansServers']));
if (count($cookie_servers)) {
setcookie('beansServers', implode(';', $cookie_servers), time() + 86400 * 365);
} else {
// no servers, clear cookie
setcookie('beansServers', '', time() - 86400 * 365);
Expand Down

0 comments on commit 4d46de7

Please sign in to comment.