Fix Fever API bug: enable send bookmark to third-party services

This commit is contained in:
Frederic Guillot 2015-05-03 08:56:41 -04:00
parent 14600c602d
commit 729c2bfb42
2 changed files with 20 additions and 9 deletions

View File

@ -1,13 +1,15 @@
RewriteEngine on
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteBase /
# only if the requested file does not exists
RewriteCond %{REQUEST_FILENAME} !-f
# only if the requested file does not exists
RewriteCond %{REQUEST_FILENAME} !-f
# Store the current location in an environment variable CWD
RewriteCond $0#%{REQUEST_URI} ([^#]*)#(.*)\1$
RewriteRule ^.*$ - [E=CWD:%2]
# Store the current location in an environment variable CWD
RewriteCond $0#%{REQUEST_URI} ([^#]*)#(.*)\1$
RewriteRule ^.*$ - [E=CWD:%2]
# Just by prefixing the environment variable, we can safely rewrite anything now
RewriteRule ^([^/]*) %{ENV:CWD}index.php?database=$1 [QSA,L]
# Just by prefixing the environment variable, we can safely rewrite anything now
RewriteRule ^([^/]*) %{ENV:CWD}index.php?database=$1 [QSA,L]
</IfModule>

View File

@ -3,6 +3,7 @@
require '../common.php';
use Model\Feed;
use Model\Service;
use PicoDb\Database;
// Route handler
@ -262,6 +263,14 @@ route('write_items', function() {
if ($_POST['as'] === 'saved') {
$query->update(array('bookmark' => 1));
// Send bookmark to third-party services if enabled
$item_id = Database::get('db')
->table('items')
->eq('rowid', $_POST['id'])
->findOneColumn('id');
Service\push($item_id);
}
else if ($_POST['as'] === 'unsaved') {
$query->update(array('bookmark' => 0));