mirror of
https://github.com/moparisthebest/wallabag
synced 2024-11-30 04:42:19 -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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,26 +309,39 @@ function action_to_do($action, $url, $id = 0)
|
|||||||
|
|
||||||
if (MyTool::isUrl($url)) {
|
if (MyTool::isUrl($url)) {
|
||||||
if($parametres_url = prepare_url($url)) {
|
if($parametres_url = prepare_url($url)) {
|
||||||
$store->add($url, $parametres_url['title'], $parametres_url['content']);
|
if ($store->add($url, $parametres_url['title'], $parametres_url['content'])) {
|
||||||
$last_id = $store->getLastId();
|
$last_id = $store->getLastId();
|
||||||
if (DOWNLOAD_PICTURES) {
|
if (DOWNLOAD_PICTURES) {
|
||||||
$content = filtre_picture($parametres_url['content'], $url, $last_id);
|
$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 {
|
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($url . ' is not a valid url');
|
||||||
}
|
}
|
||||||
|
|
||||||
logm('add link ' . $url);
|
logm('add link ' . $url);
|
||||||
break;
|
break;
|
||||||
case 'delete':
|
case 'delete':
|
||||||
remove_directory(ABS_PATH . $id);
|
if ($store->deleteById($id)) {
|
||||||
$store->deleteById($id);
|
remove_directory(ABS_PATH . $id);
|
||||||
$msg->add('s', 'the link has been deleted successfully');
|
$msg->add('s', 'the link has been deleted successfully');
|
||||||
logm('delete link #' . $id);
|
logm('delete link #' . $id);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$msg->add('e', 'the link wasn\'t deleted');
|
||||||
|
logm('error : can\'t delete link #' . $id);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'toggle_fav' :
|
case 'toggle_fav' :
|
||||||
$store->favoriteById($id);
|
$store->favoriteById($id);
|
||||||
|
@ -107,6 +107,7 @@ class Sqlite extends Store {
|
|||||||
$sql_action = 'INSERT INTO entries ( url, title, content ) VALUES (?, ?, ?)';
|
$sql_action = 'INSERT INTO entries ( url, title, content ) VALUES (?, ?, ?)';
|
||||||
$params_action = array($url, $title, $content);
|
$params_action = array($url, $title, $content);
|
||||||
$query = $this->executeQuery($sql_action, $params_action);
|
$query = $this->executeQuery($sql_action, $params_action);
|
||||||
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteById($id) {
|
public function deleteById($id) {
|
||||||
@ -114,6 +115,7 @@ class Sqlite extends Store {
|
|||||||
$sql_action = "DELETE FROM entries WHERE id=?";
|
$sql_action = "DELETE FROM entries WHERE id=?";
|
||||||
$params_action = array($id);
|
$params_action = array($id);
|
||||||
$query = $this->executeQuery($sql_action, $params_action);
|
$query = $this->executeQuery($sql_action, $params_action);
|
||||||
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function favoriteById($id) {
|
public function favoriteById($id) {
|
||||||
|
Loading…
Reference in New Issue
Block a user