diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2011-08-24 22:16:44 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2011-08-24 22:16:44 +0200 |
commit | 7cd592e055c8519d08cbfcb370572810b3edc96b (patch) | |
tree | 9bb4c4d79404ed176a925468e85f84a8d71d02d8 /apps/bookmarks/ajax/getMeta.php | |
parent | 365c4fdae24ea9f04f3c92f26182d148a8363776 (diff) | |
download | nextcloud-server-7cd592e055c8519d08cbfcb370572810b3edc96b.tar.gz nextcloud-server-7cd592e055c8519d08cbfcb370572810b3edc96b.zip |
Added a Bookmarklet for the Bookmarks app
Diffstat (limited to 'apps/bookmarks/ajax/getMeta.php')
-rw-r--r-- | apps/bookmarks/ajax/getMeta.php | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/apps/bookmarks/ajax/getMeta.php b/apps/bookmarks/ajax/getMeta.php index c61c8fb4888..dadf23afd91 100644 --- a/apps/bookmarks/ajax/getMeta.php +++ b/apps/bookmarks/ajax/getMeta.php @@ -35,24 +35,10 @@ if( !OC_User::isLoggedIn()){ exit(); } -$metadata = array(); +// $metadata = array(); -$url = urldecode($_GET["url"]); -//allow only http(s) and (s)ftp -$protocols = '/^[hs]{0,1}[tf]{0,1}tp[s]{0,1}\:\/\//i'; -//if not (allowed) protocol is given, assume http -if(preg_match($protocols, $url) == 0) { - $url = 'http://' . $url; -} +require '../bookmarksHelper.php'; -$page = file_get_contents($url); -@preg_match( "/<title>(.*)<\/title>/si", $page, $match ); -$metadata['title'] = htmlentities(strip_tags(@$match[1])); - -$meta = get_meta_tags($url); - -if(array_key_exists('description', $meta)) { - $metadata['description'] = $meta['description']; -} +$metadata = getURLMetadata(urldecode($_GET["url"])); echo json_encode( array( 'status' => 'success', 'data' => $metadata)); |