From daec6758e0bf9df456cc0b7a78fb16ac1e258c1a Mon Sep 17 00:00:00 2001 From: e-alfred Date: Thu, 27 Sep 2018 14:32:49 +0200 Subject: [PATCH 01/10] Fix deprecated calls --- files_reader/personal.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/files_reader/personal.php b/files_reader/personal.php index 2b0dd18..6a071c5 100644 --- a/files_reader/personal.php +++ b/files_reader/personal.php @@ -15,9 +15,9 @@ #$l = \OC::$server->getL10N('files_reader'); $tmpl = new \OCP\Template('files_reader', 'settings-personal'); -$EpubEnable = Config::get('epub_enable', 'true'); -$PdfEnable = Config::get('pdf_enable', 'true'); -$CbxEnable = Config::get('cbx_enable', 'true'); +$EpubEnable = \OC::$server->getConfig()->getAppValue('epub_enable', 'true'); +$PdfEnable = \OC::$server->getConfig()->getAppValue('pdf_enable', 'true'); +$CbxEnable = \OC::$server->getConfig()->getAppValue('cbx_enable', 'true'); $tmpl->assign('EpubEnable', $EpubEnable); $tmpl->assign('PdfEnable', $PdfEnable); $tmpl->assign('CbxEnable', $CbxEnable); From ede99e25831f10d720bfa217c2a1ba306c9d873a Mon Sep 17 00:00:00 2001 From: e-alfred Date: Thu, 27 Sep 2018 14:34:27 +0200 Subject: [PATCH 02/10] Fix max-version for NC14 --- files_reader/appinfo/info.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files_reader/appinfo/info.xml b/files_reader/appinfo/info.xml index 8319339..ec61ad1 100644 --- a/files_reader/appinfo/info.xml +++ b/files_reader/appinfo/info.xml @@ -52,7 +52,7 @@ See [README] for more exhaustive information on features and potential misfeatur - + pgsql sqlite mysql From 08477e28bef246cbad0492e9c3e633a0ecf488f4 Mon Sep 17 00:00:00 2001 From: e-alfred Date: Thu, 27 Sep 2018 14:38:44 +0200 Subject: [PATCH 03/10] Fix deprecated calls --- files_reader/ajax/personal.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/files_reader/ajax/personal.php b/files_reader/ajax/personal.php index e18e2df..760c1df 100644 --- a/files_reader/ajax/personal.php +++ b/files_reader/ajax/personal.php @@ -21,9 +21,9 @@ $PdfEnable = isset($_POST['PdfEnable']) ? $_POST['PdfEnable'] : 'false'; $CbxEnable = isset($_POST['CbxEnable']) ? $_POST['CbxEnable'] : 'false'; -Config::set('epub_enable', $EpubEnable); -Config::set('pdf_enable', $PdfEnable); -Config::set('cbx_enable', $CbxEnable); +\OC::$server->getConfig()->setAppValue('epub_enable', $EpubEnable); +\OC::$server->getConfig()->setAppValue('pdf_enable', $PdfEnable); +\OC::$server->getConfig()->setAppValue('cbx_enable', $CbxEnable); \OCP\JSON::success( array( From cf484a2ab4a77c350be63522cd03bb8e7fd76074 Mon Sep 17 00:00:00 2001 From: e-alfred Date: Thu, 27 Sep 2018 14:59:12 +0200 Subject: [PATCH 04/10] Fix depre4cated OCP\JSON --- files_reader/ajax/personal.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/files_reader/ajax/personal.php b/files_reader/ajax/personal.php index 760c1df..b2db6a8 100644 --- a/files_reader/ajax/personal.php +++ b/files_reader/ajax/personal.php @@ -12,8 +12,8 @@ namespace OCA\Files_Reader; -\OCP\JSON::callCheck(); -\OCP\JSON::checkLoggedIn(); +\OC_JSON::callCheck(); +\OC_JSON::checkLoggedIn(); $l = \OC::$server->getL10N('files_reader'); @@ -21,11 +21,11 @@ $PdfEnable = isset($_POST['PdfEnable']) ? $_POST['PdfEnable'] : 'false'; $CbxEnable = isset($_POST['CbxEnable']) ? $_POST['CbxEnable'] : 'false'; -\OC::$server->getConfig()->setAppValue('epub_enable', $EpubEnable); -\OC::$server->getConfig()->setAppValue('pdf_enable', $PdfEnable); -\OC::$server->getConfig()->setAppValue('cbx_enable', $CbxEnable); +\OC::$server->getAppConfig()->setValue('files_reader', 'epub_enable', $EpubEnable); +\OC::$server->getAppConfig()->setValue('files_reader', 'pdf_enable', $PdfEnable); +\OC::$server->getAppConfig()->setValue('files_reader', 'cbx_enable', $CbxEnable); -\OCP\JSON::success( +\OC_JSON::success( array( 'data' => array('message'=> $l->t('Settings updated successfully.')) ) From d12f915b51be0f2a7ba94fe9d29a040ca5a3aaf6 Mon Sep 17 00:00:00 2001 From: e-alfred Date: Wed, 3 Oct 2018 16:34:55 +0200 Subject: [PATCH 05/10] Fix deprecated OCP\Config calls --- files_reader/lib/Hooks.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/files_reader/lib/Hooks.php b/files_reader/lib/Hooks.php index 15025e2..3d3f1cb 100644 --- a/files_reader/lib/Hooks.php +++ b/files_reader/lib/Hooks.php @@ -19,7 +19,7 @@ class Hooks { public static function register() { - Util::connectHook('\OCP\Config', 'js', 'OCA\Files_Reader\Hooks', 'announce_settings'); + Util::connectHook('js', 'OCA\Files_Reader\Hooks', 'announce_settings'); \OC::$server->getRootFolder()->listen('\OC\Files', 'preDelete', function (Node $node) { $fileId = $node->getId(); @@ -38,9 +38,9 @@ public static function announce_settings(array $settings) { // TODO: rmeove this when Owncloud starts encoding oc_appconfig as JSON just like it already encodes most other properties $isJson = self::isJson($settings['array']['oc_appconfig']); $array = ($isJson) ? json_decode($settings['array']['oc_appconfig'], true) : $settings['array']['oc_appconfig']; - $array['filesReader']['enableEpub'] = Config::get('epub_enable', 'true'); - $array['filesReader']['enablePdf'] = Config::get('pdf_enable', 'true'); - $array['filesReader']['enableCbx'] = Config::get('cbx_enable', 'true'); + $array['filesReader']['enableEpub'] = \OC::$server->getConfig()->getAppValue('epub_enable', 'true'); + $array['filesReader']['enablePdf'] = \OC::$server->getConfig()->getAppValue('pdf_enable', 'true'); + $array['filesReader']['enableCbx'] = \OC::$server->getConfig()->getAppValue('cbx_enable', 'true'); $settings['array']['oc_appconfig'] = ($isJson) ? json_encode($array) : $array; } From 0678c795e235ce56649eaec715a8d9e72bde8f4c Mon Sep 17 00:00:00 2001 From: e-alfred Date: Sun, 24 Nov 2019 20:16:48 +0100 Subject: [PATCH 06/10] Fix viewer in Nextcloud 17 and up --- files_reader/js/plugin.js | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/files_reader/js/plugin.js b/files_reader/js/plugin.js index 4187bd5..20ba0e5 100644 --- a/files_reader/js/plugin.js +++ b/files_reader/js/plugin.js @@ -73,30 +73,9 @@ */ show: function(downloadUrl, mimeType, isFileList) { var self = this; - var $iframe; var viewer = OC.generateUrl('/apps/files_reader/?file={file}&type={type}', {file: downloadUrl, type: mimeType}); // launch in new window on mobile and touch devices... - if (isMobile || hasTouch) { - window.open(viewer, downloadUrl); - } else { - $iframe = '