1
0
mirror of https://github.com/owncloud/bookmarks.git synced 2024-11-29 04:24:11 +01:00
OwncloudBookmarksOfficial/controller/lib/exportresponse.php
ganomi ae81b9dcd2 This is a refactored / rewritten version of the bookmarks app using the app frameworks design and controller features.
Dependency Injection for user and db is used througout the controllers
The Routing features a consistent rest api
The Routing provides some legacy routes, so that for exampe the Android Bookmarks App still works.

There is a publicly available api that provides access to bookmarks per user.
(This is usefull in connection with the WP Plugin https://github.com/mario-nolte/oc2wp-bookmarks)
2014-11-26 12:24:18 +01:00

26 lines
758 B
PHP

<?php
namespace OCA\Bookmarks\Controller\Lib;
use OCP\AppFramework\Http\Response;
class ExportResponse extends Response {
private $returnstring;
public function __construct($returnstring) {
$user_name = trim(\OCP\User::getDisplayName()) != '' ?
\OCP\User::getDisplayName() : \OCP\User::getUser();
$export_name = '"ownCloud Bookmarks (' . $user_name . ') (' . date('Y-m-d') . ').html"';
$this->addHeader("Cache-Control", "private");
$this->addHeader("Content-Type", " application/stream");
$this->addHeader("Content-Length", strlen($returnstring));
$this->addHeader("Content-Disposition", "attachment; filename=" . $export_name);
$this->returnstring = $returnstring;
}
public function render() {
return $this->returnstring;
}
}