aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/functions.php
diff options
context:
space:
mode:
authornicosomb <nicolas@loeuillet.org>2013-04-17 14:01:37 +0200
committernicosomb <nicolas@loeuillet.org>2013-04-17 14:01:37 +0200
commita81cd067d07c3b8a8714cc919303b93b740b699b (patch)
tree626a91c952b69e1367a5ce87262475bda61e8109 /inc/functions.php
parent713b2d69910c1221bc86992ca08d6036d2e71bb6 (diff)
downloadwallabag-a81cd067d07c3b8a8714cc919303b93b740b699b.tar.gz
wallabag-a81cd067d07c3b8a8714cc919303b93b740b699b.tar.zst
wallabag-a81cd067d07c3b8a8714cc919303b93b740b699b.zip
fonction logm() ajoutée (from shaarli)
Diffstat (limited to 'inc/functions.php')
-rwxr-xr-xinc/functions.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/inc/functions.php b/inc/functions.php
index 1b8db084..6c05c327 100755
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -137,11 +137,13 @@ function action_to_do($action, $id, $url, $token)
137 $parametres_url = prepare_url($url); 137 $parametres_url = prepare_url($url);
138 $sql_action = 'INSERT INTO entries ( url, title, content ) VALUES (?, ?, ?)'; 138 $sql_action = 'INSERT INTO entries ( url, title, content ) VALUES (?, ?, ?)';
139 $params_action = array($url, $parametres_url['title'], $parametres_url['content']); 139 $params_action = array($url, $parametres_url['title'], $parametres_url['content']);
140 logm('add link ' . $url);
140 break; 141 break;
141 case 'delete': 142 case 'delete':
142 if (verif_token($token)) { 143 if (verif_token($token)) {
143 $sql_action = "DELETE FROM entries WHERE id=?"; 144 $sql_action = "DELETE FROM entries WHERE id=?";
144 $params_action = array($id); 145 $params_action = array($id);
146 logm('delete link #' . $id);
145 } 147 }
146 else logm('csrf problem while deleting entry'); 148 else logm('csrf problem while deleting entry');
147 break; 149 break;
@@ -149,6 +151,7 @@ function action_to_do($action, $id, $url, $token)
149 if (verif_token($token)) { 151 if (verif_token($token)) {
150 $sql_action = "UPDATE entries SET is_fav=~is_fav WHERE id=?"; 152 $sql_action = "UPDATE entries SET is_fav=~is_fav WHERE id=?";
151 $params_action = array($id); 153 $params_action = array($id);
154 logm('mark as favorite link #' . $id);
152 } 155 }
153 else logm('csrf problem while fav entry'); 156 else logm('csrf problem while fav entry');
154 break; 157 break;
@@ -156,6 +159,7 @@ function action_to_do($action, $id, $url, $token)
156 if (verif_token($token)) { 159 if (verif_token($token)) {
157 $sql_action = "UPDATE entries SET is_read=~is_read WHERE id=?"; 160 $sql_action = "UPDATE entries SET is_read=~is_read WHERE id=?";
158 $params_action = array($id); 161 $params_action = array($id);
162 logm('archive link #' . $id);
159 } 163 }
160 else logm('csrf problem while archive entry'); 164 else logm('csrf problem while archive entry');
161 break; 165 break;
@@ -294,5 +298,5 @@ function verif_token($token)
294function logm($message) 298function logm($message)
295{ 299{
296 $t = strval(date('Y/m/d_H:i:s')).' - '.$_SERVER["REMOTE_ADDR"].' - '.strval($message)."\n"; 300 $t = strval(date('Y/m/d_H:i:s')).' - '.$_SERVER["REMOTE_ADDR"].' - '.strval($message)."\n";
297 file_put_contents($GLOBALS['config']['DATADIR'].'/log.txt',$t,FILE_APPEND); 301 file_put_contents('./log.txt',$t,FILE_APPEND);
298} \ No newline at end of file 302} \ No newline at end of file