diff options
author | Phie <phie@phie.ovh> | 2019-04-26 19:39:46 +0300 |
---|---|---|
committer | Phie <phie@phie.ovh> | 2019-04-26 19:39:46 +0300 |
commit | a5286ba8d1b694d177a71f7fa5dd56a678af2d6c (patch) | |
tree | 10dc716d50c3eb59c291f3231b79fb11d1d1f175 | |
parent | 2df6a769a6975c13f0641c833960975ae9328ce6 (diff) |
now working with owncloudv0.15.3
-rw-r--r-- | appinfo/app.php | 55 | ||||
-rwxr-xr-x | appinfo/info.xml | 4 | ||||
-rwxr-xr-x | appinfo/routes.php | 2 | ||||
-rwxr-xr-x | lib/Controller/NoteController.php | 5 | ||||
-rwxr-xr-x | lib/Controller/PageController.php | 4 | ||||
-rw-r--r-- | lib/Settings/AdminSettings.php | 65 | ||||
-rwxr-xr-x | templates/index.php | 6 |
7 files changed, 81 insertions, 60 deletions
diff --git a/appinfo/app.php b/appinfo/app.php index 3d2ee0b..c9ff51d 100644 --- a/appinfo/app.php +++ b/appinfo/app.php @@ -1,25 +1,5 @@ <?php -/** - * @author Christoph Wurst <christoph@winzerhof-wurst.at> - * @author Jan-Christoph Borchardt <hey@jancborchardt.net> - * @author Thomas Imbreckx <zinks@iozero.be> - * @author Thomas Müller <thomas.mueller@tmit.eu> - * - * Mail - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * - */ + namespace OCA\Carnet\AppInfo; use OCP\AppFramework\App; use OCA\Mail\HordeTranslationHandler; @@ -42,10 +22,43 @@ class Application extends App { return $c->query('ServerContainer')->getConfig(); }); + + $container->registerService('RootFolder', function($c) { + + return $c->query('ServerContainer')->getRootFolder(); + }); $container->registerService('UserManager', function($c) { return $c->query('ServerContainer')->getUserManager(); }); $this->connectWatcher($container); + + $appName = $container->query('AppName'); + $container->query('OCP\INavigationManager') + ->add( + function () use ($container, $appName) { + $urlGenerator = $container->query('OCP\IURLGenerator'); + + return [ + 'id' => $appName, + + // Sorting weight for the navigation. The higher the number, the higher + // will it be listed in the navigation + 'order' => 2, + + // The route that will be shown on startup when called from within the GUI + // Public links are using another route, see appinfo/routes.php + 'href' => $urlGenerator->linkToRoute($appName . '.page.index'), + + // The icon that will be shown in the navigation + // This file needs to exist in img/ + 'icon' => $urlGenerator->imagePath($appName, 'app.svg'), + + // The title of the application. This will be used in the + // navigation or on the settings page + 'name' => 'Carnet' + ]; + } + ); } private function connectWatcher(IAppContainer $container) { diff --git a/appinfo/info.xml b/appinfo/info.xml index c971dfe..5692f81 100755 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -18,7 +18,7 @@ Mac, with sync capabilities - Statistics : words/sentences/characters - Sync with NextCloud - Online editor as a NextCloud App]]></description> - <version>0.15.2</version> + <version>0.15.3</version> <licence>agpl</licence> <author mail="phie@phie.ovh" >Phie</author> <namespace>Carnet</namespace> @@ -32,6 +32,8 @@ Mac, with sync capabilities </types> <dependencies> <nextcloud min-version="13" max-version="16"/> + <owncloud min-version="10" max-version="12"/> + </dependencies> <navigations> <navigation> diff --git a/appinfo/routes.php b/appinfo/routes.php index 2806ae6..2d9c35b 100755 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -9,7 +9,7 @@ */ $this->create('carnet_writer','/writer')->actionInclude('carnet/templates/writer.php'); - + return [ 'routes' => [ ['name' => 'page#index', 'url' => '/', 'verb' => 'GET'], diff --git a/lib/Controller/NoteController.php b/lib/Controller/NoteController.php index c67017f..f85c0bb 100755 --- a/lib/Controller/NoteController.php +++ b/lib/Controller/NoteController.php @@ -713,7 +713,8 @@ $folder = $cache->get("currentnote".$id); $data = $folder->get("data"); $f = $data->get($media); - $r = new FileDisplayResponse($f); + $r = new DataDisplayResponse($f->getContent()); + $r->addHeader("Content-Disposition", "attachment"); $r->addHeader("Content-Type", $f->getMimeType()); @@ -738,6 +739,8 @@ if($tmph){ try{ $this->CarnetFolder->get($path)->delete(); + $file = $this->CarnetFolder->newFile($path); + } catch(\OCP\Files\NotFoundException $e) { } diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 5e2ca6c..163f02e 100755 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -9,12 +9,10 @@ use OCP\AppFramework\Controller; class PageController extends Controller { private $userId; - private $RootFolder; private $config; - public function __construct($AppName, IRequest $request, $UserId, $RootFolder, $Config){ + public function __construct($AppName, IRequest $request, $UserId, $Config){ parent::__construct($AppName, $request); $this->userId = $UserId; - $this->RootFolder = $RootFolder; $this->config = $Config; } diff --git a/lib/Settings/AdminSettings.php b/lib/Settings/AdminSettings.php index 03d27dc..ce8706b 100644 --- a/lib/Settings/AdminSettings.php +++ b/lib/Settings/AdminSettings.php @@ -26,43 +26,44 @@ namespace OCA\Carnet\Settings; use OCP\AppFramework\Http\TemplateResponse; use OCP\IConfig; use OCP\Settings\ISettings; +if (method_exists(\OC::$server, "getContentSecurityPolicyNonceManager")){ + class AdminSettings implements ISettings { -class AdminSettings implements ISettings { + /** @var IConfig */ + private $config; - /** @var IConfig */ - private $config; + /** + * AdminSettings constructor. + * + * @param IConfig $config + */ + public function __construct(IConfig $config) { + $this->config = $config; + } - /** - * AdminSettings constructor. - * - * @param IConfig $config - */ - public function __construct(IConfig $config) { - $this->config = $config; - } - - /** - * @return TemplateResponse - */ - public function getForm() { - $parameters = [ - 'carnet_display_fullscreen' => $this->config->getAppValue('carnet', 'carnetDisplayFullscreen', 'no'), - ]; + /** + * @return TemplateResponse + */ + public function getForm() { + $parameters = [ + 'carnet_display_fullscreen' => $this->config->getAppValue('carnet', 'carnetDisplayFullscreen', 'no'), + ]; - return new TemplateResponse('carnet', 'settings/settings-admin', $parameters); - } + return new TemplateResponse('carnet', 'settings/settings-admin', $parameters); + } - /** - * @return string - */ - public function getSection() { - return 'additional'; - } + /** + * @return string + */ + public function getSection() { + return 'additional'; + } - /** - * @return int - */ - public function getPriority() { - return 20; + /** + * @return int + */ + public function getPriority() { + return 20; + } } }
\ No newline at end of file diff --git a/templates/index.php b/templates/index.php index e6a1d0b..c64887e 100755 --- a/templates/index.php +++ b/templates/index.php @@ -28,7 +28,11 @@ else { if($_['nc_version']>=14) style("carnet","../templates/CarnetElectron/compatibility/nextcloud/nc14-header"); } -$file = str_replace("src=\"","defer nonce='".\OC::$server->getContentSecurityPolicyNonceManager()->getNonce()."' src=\"".$root."/CarnetElectron/",$file); +$nonce = ""; +if (method_exists(\OC::$server, "getContentSecurityPolicyNonceManager")){ + $nonce = \OC::$server->getContentSecurityPolicyNonceManager()->getNonce(); +} +$file = str_replace("src=\"","defer nonce='".$nonce."' src=\"".$root."/CarnetElectron/",$file); echo $file; echo "<span style=\"display:none;\" id=\"root-url\">".$root."/CarnetElectron/</span>"; ?>
\ No newline at end of file |