1
0
Fork 0
mirror of https://github.com/Yetangitu/owncloud-apps.git synced 2025-10-05 15:32:56 +02:00

Merge pull request #1 from e-alfred/master

fix reader.
This commit is contained in:
noci2012 2019-11-24 16:00:59 +01:00 committed by GitHub
commit 7f7ee26811
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 14 deletions

View file

@ -12,8 +12,8 @@
namespace OCA\Files_Reader; namespace OCA\Files_Reader;
\OCP\JSON::callCheck(); \OC_JSON::callCheck();
\OCP\JSON::checkLoggedIn(); \OC_JSON::checkLoggedIn();
$l = \OC::$server->getL10N('files_reader'); $l = \OC::$server->getL10N('files_reader');
@ -21,11 +21,11 @@ $EpubEnable = isset($_POST['EpubEnable']) ? $_POST['EpubEnable'] : 'false';
$PdfEnable = isset($_POST['PdfEnable']) ? $_POST['PdfEnable'] : 'false'; $PdfEnable = isset($_POST['PdfEnable']) ? $_POST['PdfEnable'] : 'false';
$CbxEnable = isset($_POST['CbxEnable']) ? $_POST['CbxEnable'] : 'false'; $CbxEnable = isset($_POST['CbxEnable']) ? $_POST['CbxEnable'] : 'false';
Config::set('epub_enable', $EpubEnable); \OC::$server->getAppConfig()->setValue('files_reader', 'epub_enable', $EpubEnable);
Config::set('pdf_enable', $PdfEnable); \OC::$server->getAppConfig()->setValue('files_reader', 'pdf_enable', $PdfEnable);
Config::set('cbx_enable', $CbxEnable); \OC::$server->getAppConfig()->setValue('files_reader', 'cbx_enable', $CbxEnable);
\OCP\JSON::success( \OC_JSON::success(
array( array(
'data' => array('message'=> $l->t('Settings updated successfully.')) 'data' => array('message'=> $l->t('Settings updated successfully.'))
) )

View file

@ -52,7 +52,7 @@ See [README] for more exhaustive information on features and potential misfeatur
</types> </types>
<dependencies> <dependencies>
<owncloud min-version="8.2" max-version="10.0" /> <owncloud min-version="8.2" max-version="10.0" />
<nextcloud min-version="8.1" max-version="13.0"/> <nextcloud min-version="8.1" max-version="14.0"/>
<database>pgsql</database> <database>pgsql</database>
<database>sqlite</database> <database>sqlite</database>
<database>mysql</database> <database>mysql</database>

View file

@ -19,7 +19,7 @@ use \OC\User\User as User;
class Hooks { class Hooks {
public static function register() { 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) { \OC::$server->getRootFolder()->listen('\OC\Files', 'preDelete', function (Node $node) {
$fileId = $node->getId(); $fileId = $node->getId();
@ -38,9 +38,9 @@ class Hooks {
// TODO: rmeove this when Owncloud starts encoding oc_appconfig as JSON just like it already encodes most other properties // 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']); $isJson = self::isJson($settings['array']['oc_appconfig']);
$array = ($isJson) ? json_decode($settings['array']['oc_appconfig'], true) : $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']['enableEpub'] = \OC::$server->getConfig()->getAppValue('epub_enable', 'true');
$array['filesReader']['enablePdf'] = Config::get('pdf_enable', 'true'); $array['filesReader']['enablePdf'] = \OC::$server->getConfig()->getAppValue('pdf_enable', 'true');
$array['filesReader']['enableCbx'] = Config::get('cbx_enable', 'true'); $array['filesReader']['enableCbx'] = \OC::$server->getConfig()->getAppValue('cbx_enable', 'true');
$settings['array']['oc_appconfig'] = ($isJson) ? json_encode($array) : $array; $settings['array']['oc_appconfig'] = ($isJson) ? json_encode($array) : $array;
} }

View file

@ -15,9 +15,9 @@ use OCP\Util;
#$l = \OC::$server->getL10N('files_reader'); #$l = \OC::$server->getL10N('files_reader');
$tmpl = new \OCP\Template('files_reader', 'settings-personal'); $tmpl = new \OCP\Template('files_reader', 'settings-personal');
$EpubEnable = Config::get('epub_enable', 'true'); $EpubEnable = \OC::$server->getConfig()->getAppValue('epub_enable', 'true');
$PdfEnable = Config::get('pdf_enable', 'true'); $PdfEnable = \OC::$server->getConfig()->getAppValue('pdf_enable', 'true');
$CbxEnable = Config::get('cbx_enable', 'true'); $CbxEnable = \OC::$server->getConfig()->getAppValue('cbx_enable', 'true');
$tmpl->assign('EpubEnable', $EpubEnable); $tmpl->assign('EpubEnable', $EpubEnable);
$tmpl->assign('PdfEnable', $PdfEnable); $tmpl->assign('PdfEnable', $PdfEnable);
$tmpl->assign('CbxEnable', $CbxEnable); $tmpl->assign('CbxEnable', $CbxEnable);