mirror of
https://github.com/moparisthebest/wallabag
synced 2024-11-27 03:12:21 -05:00
messages d'erreur si pas possible d'ajouter ou de supprimer un lien
This commit is contained in:
parent
69ca1455d1
commit
29c6fd4607
@ -125,8 +125,6 @@ function prepare_url($url)
|
||||
}
|
||||
}
|
||||
|
||||
$msg->add('e', 'error during url preparation');
|
||||
logm('error during url preparation');
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -311,26 +309,39 @@ function action_to_do($action, $url, $id = 0)
|
||||
|
||||
if (MyTool::isUrl($url)) {
|
||||
if($parametres_url = prepare_url($url)) {
|
||||
$store->add($url, $parametres_url['title'], $parametres_url['content']);
|
||||
$last_id = $store->getLastId();
|
||||
if (DOWNLOAD_PICTURES) {
|
||||
$content = filtre_picture($parametres_url['content'], $url, $last_id);
|
||||
if ($store->add($url, $parametres_url['title'], $parametres_url['content'])) {
|
||||
$last_id = $store->getLastId();
|
||||
if (DOWNLOAD_PICTURES) {
|
||||
$content = filtre_picture($parametres_url['content'], $url, $last_id);
|
||||
}
|
||||
$msg->add('s', 'the link has been added successfully');
|
||||
}
|
||||
$msg->add('s', 'the link has been added successfully');
|
||||
else {
|
||||
$msg->add('e', 'error during insertion : the link wasn\'t added');
|
||||
}
|
||||
}
|
||||
else {
|
||||
$msg->add('e', 'error during url preparation : the link wasn\'t added');
|
||||
logm('error during url preparation');
|
||||
}
|
||||
}
|
||||
else {
|
||||
$msg->add('e', 'the link has been added successfully');
|
||||
$msg->add('e', 'error during url preparation : the link is not valid');
|
||||
logm($url . ' is not a valid url');
|
||||
}
|
||||
|
||||
logm('add link ' . $url);
|
||||
break;
|
||||
case 'delete':
|
||||
remove_directory(ABS_PATH . $id);
|
||||
$store->deleteById($id);
|
||||
$msg->add('s', 'the link has been deleted successfully');
|
||||
logm('delete link #' . $id);
|
||||
if ($store->deleteById($id)) {
|
||||
remove_directory(ABS_PATH . $id);
|
||||
$msg->add('s', 'the link has been deleted successfully');
|
||||
logm('delete link #' . $id);
|
||||
}
|
||||
else {
|
||||
$msg->add('e', 'the link wasn\'t deleted');
|
||||
logm('error : can\'t delete link #' . $id);
|
||||
}
|
||||
break;
|
||||
case 'toggle_fav' :
|
||||
$store->favoriteById($id);
|
||||
|
@ -107,6 +107,7 @@ class Sqlite extends Store {
|
||||
$sql_action = 'INSERT INTO entries ( url, title, content ) VALUES (?, ?, ?)';
|
||||
$params_action = array($url, $title, $content);
|
||||
$query = $this->executeQuery($sql_action, $params_action);
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function deleteById($id) {
|
||||
@ -114,6 +115,7 @@ class Sqlite extends Store {
|
||||
$sql_action = "DELETE FROM entries WHERE id=?";
|
||||
$params_action = array($id);
|
||||
$query = $this->executeQuery($sql_action, $params_action);
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function favoriteById($id) {
|
||||
|
Loading…
Reference in New Issue
Block a user