summaryrefslogtreecommitdiffstats
path: root/apps/bookmarks/ajax/getMeta.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/bookmarks/ajax/getMeta.php')
-rw-r--r--apps/bookmarks/ajax/getMeta.php20
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));