- global $db;
-
- switch ($action)
- {
- case 'add':
- if ($url == '')
- continue;
-
- $parametres_url = prepare_url($url);
- $sql_action = 'INSERT INTO entries ( url, title, content ) VALUES (?, ?, ?)';
- $params_action = array($url, $parametres_url['title'], $parametres_url['content']);
- logm('add link ' . $url);
- break;
- case 'delete':
- if (verif_token($token)) {
- $sql_action = "DELETE FROM entries WHERE id=?";
- $params_action = array($id);
- logm('delete link #' . $id);
- }
- 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);
- logm('mark as favorite link #' . $id);
- }
- 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);
- logm('archive link #' . $id);
- }
- else logm('csrf problem while archive entry');
- break;
- default:
- break;
- }
-
- try
+ $matches = array();
+ preg_match_all('#<\s*(img)[^>]+src="([^"]*)"[^>]*>#Si', $content, $matches, PREG_SET_ORDER);
+ foreach($matches as $i => $link)