}
catch (Exception $e)
{
- $errors[] = $e->getMessage();
+ logm('error during pocket import : ' . $e->getMessage());
}
}
# Pocket génère un fichier HTML avec deux <ul>
}
echo 'Import from Pocket completed. <a href="index.php">Welcome to #poche !</a>';
+ logm('import from pocket completed');
}
\ No newline at end of file
// only download page lesser than 4MB
$data = @file_get_contents($url, false, $context, -1, 4000000); // We download at most 4 MB from source.
- // echo "<pre>http_response_header : ".print_r($http_response_header);
if(isset($http_response_header) and isset($http_response_header[0])) {
$httpcodeOK = isset($http_response_header) and isset($http_response_header[0]) and ((strpos($http_response_header[0], '200 OK') !== FALSE) or (strpos($http_response_header[0], '301 Moved Permanently') !== FALSE));
$sql_action = "DELETE FROM entries WHERE id=?";
$params_action = array($id);
}
- else die('CSRF problem');
+ else logm('csrf problem while deleting entry');
break;
case 'toggle_fav' :
if (verif_token($token)) {
$sql_action = "UPDATE entries SET is_fav=~is_fav WHERE id=?";
$params_action = array($id);
}
- else die('CSRF problem');
+ else logm('csrf problem while fav entry');
break;
case 'toggle_archive' :
if (verif_token($token)) {
$sql_action = "UPDATE entries SET is_read=~is_read WHERE id=?";
$params_action = array($id);
}
- else die('CSRF problem');
+ else logm('csrf problem while archive entry');
break;
default:
break;
}
catch (Exception $e)
{
- die('action query error : '.$e->getMessage());
+ logm('action query error : '.$e->getMessage());
}
}
}
catch (Exception $e)
{
- die('view query error : '.$e->getMessage());
+ logm('view query error : '.$e->getMessage());
}
return $entries;
}
catch (Exception $e)
{
- die('query error : '.$e->getMessage());
+ logm('get article query error : '.$e->getMessage());
}
return $entry;
}
else {
session_destroy();
+ logm('session expired');
}
}
- else return FALSE;
+ else {
+ logm('token error : the token is different');
+ return FALSE;
+ }
+ }
+ else {
+ logm('token error : the token is not here');
+ return FALSE;
}
- else return FALSE;
+}
+
+function logm($message)
+{
+ $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);
}
\ No newline at end of file