aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--inc/functions.php35
-rw-r--r--inc/store/sqlite.class.php2
3 files changed, 26 insertions, 13 deletions
diff --git a/README.md b/README.md
index 6700415a..70a07648 100644
--- a/README.md
+++ b/README.md
@@ -25,7 +25,7 @@ You can :
25## Requirements & installation 25## Requirements & installation
26You have to install [sqlite for php](http://www.php.net/manual/en/book.sqlite.php) on your server. 26You have to install [sqlite for php](http://www.php.net/manual/en/book.sqlite.php) on your server.
27 27
28Get the [latest version](https://github.com/nicosomb/poche) of poche on github. Unzip it and upload it on your server. poche must have write access on assets, cache and db directories. 28Get the [latest version](https://github.com/inthepoche/poche) of poche on github. Unzip it and upload it on your server. poche must have write access on assets, cache and db directories.
29 29
30That's all, **poche works** ! 30That's all, **poche works** !
31 31
diff --git a/inc/functions.php b/inc/functions.php
index 0303aab6..b830b616 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -145,8 +145,6 @@ function prepare_url($url)
145 } 145 }
146 } 146 }
147 147
148 $msg->add('e', 'error during url preparation');
149 logm('error during url preparation');
150 return FALSE; 148 return FALSE;
151} 149}
152 150
@@ -331,26 +329,39 @@ function action_to_do($action, $url, $id = 0)
331 329
332 if (MyTool::isUrl($url)) { 330 if (MyTool::isUrl($url)) {
333 if($parametres_url = prepare_url($url)) { 331 if($parametres_url = prepare_url($url)) {
334 $store->add($url, $parametres_url['title'], $parametres_url['content']); 332 if ($store->add($url, $parametres_url['title'], $parametres_url['content'])) {
335 $last_id = $store->getLastId(); 333 $last_id = $store->getLastId();
336 if (DOWNLOAD_PICTURES) { 334 if (DOWNLOAD_PICTURES) {
337 $content = filtre_picture($parametres_url['content'], $url, $last_id); 335 $content = filtre_picture($parametres_url['content'], $url, $last_id);
336 }
337 $msg->add('s', 'the link has been added successfully');
338 } 338 }
339 $msg->add('s', 'the link has been added successfully'); 339 else {
340 $msg->add('e', 'error during insertion : the link wasn\'t added');
341 }
342 }
343 else {
344 $msg->add('e', 'error during url preparation : the link wasn\'t added');
345 logm('error during url preparation');
340 } 346 }
341 } 347 }
342 else { 348 else {
343 $msg->add('e', 'the link has been added successfully'); 349 $msg->add('e', 'error during url preparation : the link is not valid');
344 logm($url . ' is not a valid url'); 350 logm($url . ' is not a valid url');
345 } 351 }
346 352
347 logm('add link ' . $url); 353 logm('add link ' . $url);
348 break; 354 break;
349 case 'delete': 355 case 'delete':
350 remove_directory(ABS_PATH . $id); 356 if ($store->deleteById($id)) {
351 $store->deleteById($id); 357 remove_directory(ABS_PATH . $id);
352 $msg->add('s', 'the link has been deleted successfully'); 358 $msg->add('s', 'the link has been deleted successfully');
353 logm('delete link #' . $id); 359 logm('delete link #' . $id);
360 }
361 else {
362 $msg->add('e', 'the link wasn\'t deleted');
363 logm('error : can\'t delete link #' . $id);
364 }
354 break; 365 break;
355 case 'toggle_fav' : 366 case 'toggle_fav' :
356 $store->favoriteById($id); 367 $store->favoriteById($id);
diff --git a/inc/store/sqlite.class.php b/inc/store/sqlite.class.php
index d5208a29..cda412e6 100644
--- a/inc/store/sqlite.class.php
+++ b/inc/store/sqlite.class.php
@@ -107,6 +107,7 @@ class Sqlite extends Store {
107 $sql_action = 'INSERT INTO entries ( url, title, content ) VALUES (?, ?, ?)'; 107 $sql_action = 'INSERT INTO entries ( url, title, content ) VALUES (?, ?, ?)';
108 $params_action = array($url, $title, $content); 108 $params_action = array($url, $title, $content);
109 $query = $this->executeQuery($sql_action, $params_action); 109 $query = $this->executeQuery($sql_action, $params_action);
110 return $query;
110 } 111 }
111 112
112 public function deleteById($id) { 113 public function deleteById($id) {
@@ -114,6 +115,7 @@ class Sqlite extends Store {
114 $sql_action = "DELETE FROM entries WHERE id=?"; 115 $sql_action = "DELETE FROM entries WHERE id=?";
115 $params_action = array($id); 116 $params_action = array($id);
116 $query = $this->executeQuery($sql_action, $params_action); 117 $query = $this->executeQuery($sql_action, $params_action);
118 return $query;
117 } 119 }
118 120
119 public function favoriteById($id) { 121 public function favoriteById($id) {