summaryrefslogtreecommitdiffstats
path: root/apps/bookmarks/ajax
diff options
context:
space:
mode:
authorMarvin Thomas Rabe <m.rabe@echtzeitraum.de>2012-02-22 23:52:56 +0100
committerMarvin Thomas Rabe <m.rabe@echtzeitraum.de>2012-02-22 23:52:56 +0100
commit77493e8d704c5a9c986b453583f966cb976409c9 (patch)
treec34a79dccef23c3fd68dee131c2028393b59b457 /apps/bookmarks/ajax
parent996e6cf419cc9ebecb9c8985e444ee1ba17e9395 (diff)
downloadnextcloud-server-77493e8d704c5a9c986b453583f966cb976409c9.tar.gz
nextcloud-server-77493e8d704c5a9c986b453583f966cb976409c9.zip
Changed bookmarklet to read later widget
Diffstat (limited to 'apps/bookmarks/ajax')
-rw-r--r--apps/bookmarks/ajax/addBookmark.php53
1 files changed, 3 insertions, 50 deletions
diff --git a/apps/bookmarks/ajax/addBookmark.php b/apps/bookmarks/ajax/addBookmark.php
index 89446564110..8cda7f0f060 100644
--- a/apps/bookmarks/ajax/addBookmark.php
+++ b/apps/bookmarks/ajax/addBookmark.php
@@ -30,53 +30,6 @@ require_once('../../../lib/base.php');
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('bookmarks');
-$CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" );
-if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){
- $_ut = "strftime('%s','now')";
-} elseif($CONFIG_DBTYPE == 'pgsql') {
- $_ut = 'date_part(\'epoch\',now())::integer';
-} else {
- $_ut = "UNIX_TIMESTAMP()";
-}
-
-//FIXME: Detect when user adds a known URL
-$query = OC_DB::prepare("
- INSERT INTO *PREFIX*bookmarks
- (url, title, user_id, public, added, lastmodified)
- VALUES (?, ?, ?, 0, $_ut, $_ut)
- ");
-
-if(empty($_GET["title"])) {
- require_once('../bookmarksHelper.php');
- $metadata = getURLMetadata($_GET["url"]);
- $_GET["title"] = $metadata['title'];
-}
-
-$params=array(
- htmlspecialchars_decode($_GET["url"]),
- htmlspecialchars_decode($_GET["title"]),
- OC_User::getUser()
- );
-$query->execute($params);
-
-$b_id = OC_DB::insertid('*PREFIX*bookmarks');
-
-if($b_id !== false) {
- $query = OC_DB::prepare("
- INSERT INTO *PREFIX*bookmarks_tags
- (bookmark_id, tag)
- VALUES (?, ?)
- ");
-
- $tags = explode(' ', urldecode($_GET["tags"]));
- foreach ($tags as $tag) {
- if(empty($tag)) {
- //avoid saving blankspaces
- continue;
- }
- $params = array($b_id, trim($tag));
- $query->execute($params);
- }
-
- OC_JSON::success(array('data' => $b_id));
-}
+require_once('../bookmarksHelper.php');
+$id = addBookmark($_GET['url'], $_GET['title'], $_GET['tags']);
+OC_JSON::success(array('data' => $id)); \ No newline at end of file