/** * Action to handle the sendBackup requests * * Handled via HTTP Response code * * @return void */ function downloadbackupAction() { $signature = post('signature'); $url = post('url'); $friend = WpHerissonFriendsTable::getOneWhere("url=?", array($url)); try { if (Encryption::i()->publicDecrypt($signature, $friend->public_key) == $url) { $backup = WpHerissonLocalbackupsTable::getOneWhere('friend_id=?', array($friend->id)); Export::forceDownload($backup->filename, 'herisson.data'); } else { Network::reply(417, HERISSON_EXIT); } } catch (Encryption\Exception $e) { Network::reply(417, HERISSON_EXIT); } }
/** * Export bookmarks and send it to the user * * @param array $bookmarks a bookmarks array, made of WpHerissonBookmarks items * * @see WpHerissonBookmarks * * @return void */ public function export($bookmarks) { Export::forceDownloadContent($this->exportData($bookmarks), $this->filename); }
/** * Download a backup from a friend * * @return void */ function downloadAction() { $data = $this->_retrieve(); $this->layout = false; // FIXME This fails Export::forceDownloadContent($data, 'herisson.tar.gz'); }