mirror of
https://github.com/wallabag/wallabag.git
synced 2024-10-31 22:28:54 +00:00
fonction logm() ajoutée (from shaarli)
This commit is contained in:
parent
713b2d6991
commit
a81cd067d0
1 changed files with 5 additions and 1 deletions
|
@ -137,11 +137,13 @@ function action_to_do($action, $id, $url, $token)
|
||||||
$parametres_url = prepare_url($url);
|
$parametres_url = prepare_url($url);
|
||||||
$sql_action = 'INSERT INTO entries ( url, title, content ) VALUES (?, ?, ?)';
|
$sql_action = 'INSERT INTO entries ( url, title, content ) VALUES (?, ?, ?)';
|
||||||
$params_action = array($url, $parametres_url['title'], $parametres_url['content']);
|
$params_action = array($url, $parametres_url['title'], $parametres_url['content']);
|
||||||
|
logm('add link ' . $url);
|
||||||
break;
|
break;
|
||||||
case 'delete':
|
case 'delete':
|
||||||
if (verif_token($token)) {
|
if (verif_token($token)) {
|
||||||
$sql_action = "DELETE FROM entries WHERE id=?";
|
$sql_action = "DELETE FROM entries WHERE id=?";
|
||||||
$params_action = array($id);
|
$params_action = array($id);
|
||||||
|
logm('delete link #' . $id);
|
||||||
}
|
}
|
||||||
else logm('csrf problem while deleting entry');
|
else logm('csrf problem while deleting entry');
|
||||||
break;
|
break;
|
||||||
|
@ -149,6 +151,7 @@ function action_to_do($action, $id, $url, $token)
|
||||||
if (verif_token($token)) {
|
if (verif_token($token)) {
|
||||||
$sql_action = "UPDATE entries SET is_fav=~is_fav WHERE id=?";
|
$sql_action = "UPDATE entries SET is_fav=~is_fav WHERE id=?";
|
||||||
$params_action = array($id);
|
$params_action = array($id);
|
||||||
|
logm('mark as favorite link #' . $id);
|
||||||
}
|
}
|
||||||
else logm('csrf problem while fav entry');
|
else logm('csrf problem while fav entry');
|
||||||
break;
|
break;
|
||||||
|
@ -156,6 +159,7 @@ function action_to_do($action, $id, $url, $token)
|
||||||
if (verif_token($token)) {
|
if (verif_token($token)) {
|
||||||
$sql_action = "UPDATE entries SET is_read=~is_read WHERE id=?";
|
$sql_action = "UPDATE entries SET is_read=~is_read WHERE id=?";
|
||||||
$params_action = array($id);
|
$params_action = array($id);
|
||||||
|
logm('archive link #' . $id);
|
||||||
}
|
}
|
||||||
else logm('csrf problem while archive entry');
|
else logm('csrf problem while archive entry');
|
||||||
break;
|
break;
|
||||||
|
@ -294,5 +298,5 @@ function verif_token($token)
|
||||||
function logm($message)
|
function logm($message)
|
||||||
{
|
{
|
||||||
$t = strval(date('Y/m/d_H:i:s')).' - '.$_SERVER["REMOTE_ADDR"].' - '.strval($message)."\n";
|
$t = strval(date('Y/m/d_H:i:s')).' - '.$_SERVER["REMOTE_ADDR"].' - '.strval($message)."\n";
|
||||||
file_put_contents($GLOBALS['config']['DATADIR'].'/log.txt',$t,FILE_APPEND);
|
file_put_contents('./log.txt',$t,FILE_APPEND);
|
||||||
}
|
}
|
Loading…
Reference in a new issue