aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/functions.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/functions.php')
-rw-r--r--inc/functions.php35
1 files changed, 23 insertions, 12 deletions
diff --git a/inc/functions.php b/inc/functions.php
index 205f3968..750d430e 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -125,8 +125,6 @@ function prepare_url($url)
125 } 125 }
126 } 126 }
127 127
128 $msg->add('e', 'error during url preparation');
129 logm('error during url preparation');
130 return FALSE; 128 return FALSE;
131} 129}
132 130
@@ -311,26 +309,39 @@ function action_to_do($action, $url, $id = 0)
311 309
312 if (MyTool::isUrl($url)) { 310 if (MyTool::isUrl($url)) {
313 if($parametres_url = prepare_url($url)) { 311 if($parametres_url = prepare_url($url)) {
314 $store->add($url, $parametres_url['title'], $parametres_url['content']); 312 if ($store->add($url, $parametres_url['title'], $parametres_url['content'])) {
315 $last_id = $store->getLastId(); 313 $last_id = $store->getLastId();
316 if (DOWNLOAD_PICTURES) { 314 if (DOWNLOAD_PICTURES) {
317 $content = filtre_picture($parametres_url['content'], $url, $last_id); 315 $content = filtre_picture($parametres_url['content'], $url, $last_id);
316 }
317 $msg->add('s', 'the link has been added successfully');
318 } 318 }
319 $msg->add('s', 'the link has been added successfully'); 319 else {
320 $msg->add('e', 'error during insertion : the link wasn\'t added');
321 }
322 }
323 else {
324 $msg->add('e', 'error during url preparation : the link wasn\'t added');
325 logm('error during url preparation');
320 } 326 }
321 } 327 }
322 else { 328 else {
323 $msg->add('e', 'the link has been added successfully'); 329 $msg->add('e', 'error during url preparation : the link is not valid');
324 logm($url . ' is not a valid url'); 330 logm($url . ' is not a valid url');
325 } 331 }
326 332
327 logm('add link ' . $url); 333 logm('add link ' . $url);
328 break; 334 break;
329 case 'delete': 335 case 'delete':
330 remove_directory(ABS_PATH . $id); 336 if ($store->deleteById($id)) {
331 $store->deleteById($id); 337 remove_directory(ABS_PATH . $id);
332 $msg->add('s', 'the link has been deleted successfully'); 338 $msg->add('s', 'the link has been deleted successfully');
333 logm('delete link #' . $id); 339 logm('delete link #' . $id);
340 }
341 else {
342 $msg->add('e', 'the link wasn\'t deleted');
343 logm('error : can\'t delete link #' . $id);
344 }
334 break; 345 break;
335 case 'toggle_fav' : 346 case 'toggle_fav' :
336 $store->favoriteById($id); 347 $store->favoriteById($id);