* This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. */ // Check if we are a user OCP\User::checkLoggedIn(); OCP\App::checkAppEnabled('bookmarks'); function getDomainWithoutExt($name){ $pos = strripos($name, '.'); if($pos === false){ return $name; }else{ return substr($name, 0, $pos); } } $file = << Bookmarks

Bookmarks

EOT; $bookmarks = OC_Bookmarks_Bookmarks::findBookmarks(0, 'id', array(), true, -1); foreach($bookmarks as $bm) { $title = $bm['title']; if(trim($title) ===''){ $url_parts = parse_url($bm['url']); $title = isset($url_parts['host']) ? getDomainWithoutExt($url_parts['host']) : $bm['url']; } $file .= '

'; $file .= htmlspecialchars($title, ENT_QUOTES, 'UTF-8').''; if($bm['description']) $file .= '
'.htmlspecialchars($bm['description'], ENT_QUOTES, 'UTF-8'); } header("Cache-Control: private"); header("Content-Type: application/stream"); header("Content-Length: ".$fileSize); header("Content-Disposition: attachment; filename=oc-bookmarks.html"); echo $file; exit;