diff options
Diffstat (limited to 'inc/poche')
-rw-r--r-- | inc/poche/Database.class.php | 2 | ||||
-rw-r--r-- | inc/poche/Poche.class.php | 10 | ||||
-rw-r--r-- | inc/poche/Tools.class.php | 8 |
3 files changed, 13 insertions, 7 deletions
diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php index 1d3ff0c2..bf67de2a 100644 --- a/inc/poche/Database.class.php +++ b/inc/poche/Database.class.php | |||
@@ -166,7 +166,7 @@ class Database { | |||
166 | $query = $this->executeQuery($sql, $params); | 166 | $query = $this->executeQuery($sql, $params); |
167 | $entry = $query->fetchAll(); | 167 | $entry = $query->fetchAll(); |
168 | 168 | ||
169 | return $entry[0]; | 169 | return isset($entry[0]) ? $entry[0] : null; |
170 | } | 170 | } |
171 | 171 | ||
172 | public function getEntriesByView($view, $user_id, $limit = '') { | 172 | public function getEntriesByView($view, $user_id, $limit = '') { |
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 0766cd51..3ecaf084 100644 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php | |||
@@ -327,7 +327,7 @@ class Poche | |||
327 | /** | 327 | /** |
328 | * Call action (mark as fav, archive, delete, etc.) | 328 | * Call action (mark as fav, archive, delete, etc.) |
329 | */ | 329 | */ |
330 | public function action($action, Url $url, $id = 0, $import = FALSE) | 330 | public function action($action, Url $url, $id = 0, $import = FALSE, $autoclose = FALSE) |
331 | { | 331 | { |
332 | switch ($action) | 332 | switch ($action) |
333 | { | 333 | { |
@@ -358,7 +358,11 @@ class Poche | |||
358 | } | 358 | } |
359 | 359 | ||
360 | if (!$import) { | 360 | if (!$import) { |
361 | Tools::redirect('?view=home'); | 361 | if ($autoclose == TRUE) { |
362 | Tools::redirect('?view=home'); | ||
363 | } else { | ||
364 | Tools::redirect('?view=home&closewin=true'); | ||
365 | } | ||
362 | } | 366 | } |
363 | break; | 367 | break; |
364 | case 'delete': | 368 | case 'delete': |
@@ -374,7 +378,7 @@ class Poche | |||
374 | $msg = 'error : can\'t delete link #' . $id; | 378 | $msg = 'error : can\'t delete link #' . $id; |
375 | } | 379 | } |
376 | Tools::logm($msg); | 380 | Tools::logm($msg); |
377 | Tools::redirect(); | 381 | Tools::redirect('?'); |
378 | break; | 382 | break; |
379 | case 'toggle_fav' : | 383 | case 'toggle_fav' : |
380 | $this->store->favoriteById($id, $this->user->getId()); | 384 | $this->store->favoriteById($id, $this->user->getId()); |
diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php index 1d092823..750553f1 100644 --- a/inc/poche/Tools.class.php +++ b/inc/poche/Tools.class.php | |||
@@ -53,12 +53,12 @@ class Tools | |||
53 | 53 | ||
54 | $scriptname = str_replace('/index.php', '/', $_SERVER["SCRIPT_NAME"]); | 54 | $scriptname = str_replace('/index.php', '/', $_SERVER["SCRIPT_NAME"]); |
55 | 55 | ||
56 | if (!isset($_SERVER["SERVER_NAME"])) { | 56 | if (!isset($_SERVER["HTTP_HOST"])) { |
57 | return $scriptname; | 57 | return $scriptname; |
58 | } | 58 | } |
59 | 59 | ||
60 | return 'http' . ($https ? 's' : '') . '://' | 60 | return 'http' . ($https ? 's' : '') . '://' |
61 | . $_SERVER["SERVER_NAME"] . $serverport . $scriptname; | 61 | . $_SERVER["HTTP_HOST"] . $serverport . $scriptname; |
62 | } | 62 | } |
63 | 63 | ||
64 | public static function redirect($url = '') | 64 | public static function redirect($url = '') |
@@ -133,7 +133,9 @@ class Tools | |||
133 | $curl = curl_init(); | 133 | $curl = curl_init(); |
134 | curl_setopt($curl, CURLOPT_URL, $url); | 134 | curl_setopt($curl, CURLOPT_URL, $url); |
135 | curl_setopt($curl, CURLOPT_TIMEOUT, $timeout); | 135 | curl_setopt($curl, CURLOPT_TIMEOUT, $timeout); |
136 | curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); | 136 | if (!ini_get('open_basedir') && !ini_get('safe_mode')) { |
137 | curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); | ||
138 | } | ||
137 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); | 139 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); |
138 | curl_setopt($curl, CURLOPT_HEADER, false); | 140 | curl_setopt($curl, CURLOPT_HEADER, false); |
139 | 141 | ||