diff --git a/extensions.json b/extensions.json
index 0a3cc1a..e00a72e 100644
--- a/extensions.json
+++ b/extensions.json
@@ -4,7 +4,7 @@
{
"name": "CustomCSS",
"description": "A FreshRSS extension which give ability to create user-specific CSS rules to apply in addition of the actual theme",
- "version": 0.1,
+ "version": 0.2,
"author": "Marien Fressinaud",
"url": "https://github.com/FreshRSS/Extensions",
"type": "gh-subdirectory"
@@ -12,7 +12,7 @@
{
"name": "CustomJS",
"description": "A FreshRSS extension which give ability to create user-specific Javascript rules to apply in addition of the actual theme",
- "version": 0.1,
+ "version": 0.2,
"author": "Frans de Jonge",
"url": "https://github.com/FreshRSS/Extensions",
"type": "gh-subdirectory"
diff --git a/xExtension-CustomCSS/README.md b/xExtension-CustomCSS/README.md
index 049d372..124486d 100644
--- a/xExtension-CustomCSS/README.md
+++ b/xExtension-CustomCSS/README.md
@@ -3,3 +3,8 @@
A FreshRSS extension which give ability to create user-specific CSS rules to apply in addition of the actual theme.
To use it, upload this directory in your `./extensions` directory and enable it on the extension panel in FreshRSS. You can add CSS rules by clicking on the manage button.
+
+## Changelog
+
+- 0.2 added file permission check, added german translation, removed un-editable file static/style.css
+- 0.1 initial version
\ No newline at end of file
diff --git a/xExtension-CustomCSS/configure.phtml b/xExtension-CustomCSS/configure.phtml
index 51b8b46..32a5a65 100644
--- a/xExtension-CustomCSS/configure.phtml
+++ b/xExtension-CustomCSS/configure.phtml
@@ -8,9 +8,13 @@
diff --git a/xExtension-CustomCSS/extension.php b/xExtension-CustomCSS/extension.php
index 2b43f55..6860e3d 100644
--- a/xExtension-CustomCSS/extension.php
+++ b/xExtension-CustomCSS/extension.php
@@ -3,7 +3,6 @@
class CustomCSSExtension extends Minz_Extension {
public function init() {
$this->registerTranslates();
- Minz_View::appendStyle($this->getFileUrl('style.css', 'css'));
$current_user = Minz_Session::param('currentUser');
$filename = 'style.' . $current_user . '.css';
@@ -19,9 +18,16 @@ class CustomCSSExtension extends Minz_Extension {
$current_user = Minz_Session::param('currentUser');
$filename = 'style.' . $current_user . '.css';
- $filepath = join_path($this->getPath(), 'static', $filename);
+ $staticPath = join_path($this->getPath(), 'static');
+ $filepath = join_path($staticPath, $filename);
- if (Minz_Request::isPost()) {
+ if (!file_exists($filepath) && !is_writable($staticPath)) {
+ $tmpPath = explode(EXTENSIONS_PATH . '/', $staticPath);
+ $this->permission_problem = $tmpPath[1] . '/';
+ } else if (file_exists($filepath) && !is_writable($filepath)) {
+ $tmpPath = explode(EXTENSIONS_PATH . '/', $filepath);
+ $this->permission_problem = $tmpPath[1];
+ } else if (Minz_Request::isPost()) {
$css_rules = html_entity_decode(Minz_Request::param('css-rules', ''));
file_put_contents($filepath, $css_rules);
}
diff --git a/xExtension-CustomCSS/i18n/de/ext.php b/xExtension-CustomCSS/i18n/de/ext.php
new file mode 100644
index 0000000..a0c704c
--- /dev/null
+++ b/xExtension-CustomCSS/i18n/de/ext.php
@@ -0,0 +1,8 @@
+ array(
+ 'write_css' => 'Benutzerspezifische CSS Regeln',
+ 'permission_problem' => 'Deine CSS Datei ist nicht beschreibbar, bitte ändere die Berechtigungen von %s'
+ ),
+);
diff --git a/xExtension-CustomCSS/i18n/en/ext.php b/xExtension-CustomCSS/i18n/en/ext.php
index 23296fe..c5f95ed 100644
--- a/xExtension-CustomCSS/i18n/en/ext.php
+++ b/xExtension-CustomCSS/i18n/en/ext.php
@@ -3,5 +3,6 @@
return array(
'custom_css' => array(
'write_css' => 'Additional CSS rules',
+ 'permission_problem' => 'Your CSS file is not writable, please change the file permissions for %s',
),
);
diff --git a/xExtension-CustomCSS/i18n/fr/ext.php b/xExtension-CustomCSS/i18n/fr/ext.php
index ea9842e..3aa3c82 100644
--- a/xExtension-CustomCSS/i18n/fr/ext.php
+++ b/xExtension-CustomCSS/i18n/fr/ext.php
@@ -3,5 +3,6 @@
return array(
'custom_css' => array(
'write_css' => 'Règles CSS supplémentaires',
+ 'permission_problem' => 'Votre fichier CSS est en lecture seule ; veuillez adapter les permissions pour %s',
),
);
diff --git a/xExtension-CustomCSS/static/style.css b/xExtension-CustomCSS/static/style.css
deleted file mode 100644
index 2b94c37..0000000
--- a/xExtension-CustomCSS/static/style.css
+++ /dev/null
@@ -1,4 +0,0 @@
-textarea#css-rules {
- width: 500px;
- height: 500px;
-}
diff --git a/xExtension-CustomJS/README.md b/xExtension-CustomJS/README.md
index 174fed8..216602e 100644
--- a/xExtension-CustomJS/README.md
+++ b/xExtension-CustomJS/README.md
@@ -3,3 +3,8 @@
A FreshRSS extension which give ability to create user-specific JS.
To use it, upload this directory in your `./extensions` directory and enable it on the extension panel in FreshRSS. You can add JS by clicking on the manage button.
+
+## Changelog
+
+- 0.2 added file permission check and german translation
+- 0.1 initial version
\ No newline at end of file
diff --git a/xExtension-CustomJS/configure.phtml b/xExtension-CustomJS/configure.phtml
index e7fef3c..24b9b2d 100644
--- a/xExtension-CustomJS/configure.phtml
+++ b/xExtension-CustomJS/configure.phtml
@@ -8,9 +8,13 @@
diff --git a/xExtension-CustomJS/extension.php b/xExtension-CustomJS/extension.php
index cbb1d56..db76899 100644
--- a/xExtension-CustomJS/extension.php
+++ b/xExtension-CustomJS/extension.php
@@ -18,9 +18,16 @@ class CustomJSExtension extends Minz_Extension {
$current_user = Minz_Session::param('currentUser');
$filename = 'script.' . $current_user . '.js';
- $filepath = join_path($this->getPath(), 'static', $filename);
+ $staticPath = join_path($this->getPath(), 'static');
+ $filepath = join_path($staticPath, $filename);
- if (Minz_Request::isPost()) {
+ if (!file_exists($filepath) && !is_writable($staticPath)) {
+ $tmpPath = explode(EXTENSIONS_PATH . '/', $staticPath);
+ $this->permission_problem = $tmpPath[1] . '/';
+ } else if (file_exists($filepath) && !is_writable($filepath)) {
+ $tmpPath = explode(EXTENSIONS_PATH . '/', $filepath);
+ $this->permission_problem = $tmpPath[1];
+ } else if (Minz_Request::isPost()) {
$js_rules = html_entity_decode(Minz_Request::param('js-rules', ''));
file_put_contents($filepath, $js_rules);
}
diff --git a/xExtension-CustomJS/i18n/de/ext.php b/xExtension-CustomJS/i18n/de/ext.php
new file mode 100644
index 0000000..4c91983
--- /dev/null
+++ b/xExtension-CustomJS/i18n/de/ext.php
@@ -0,0 +1,8 @@
+ array(
+ 'write_css' => 'Benutzerspezifische Javascript Regeln',
+ 'permission_problem' => 'Deine JS Datei ist nicht beschreibbar, bitte ändere die Berechtigungen von %s'
+ ),
+);
diff --git a/xExtension-CustomJS/i18n/en/ext.php b/xExtension-CustomJS/i18n/en/ext.php
index 8bc2660..fcf8538 100644
--- a/xExtension-CustomJS/i18n/en/ext.php
+++ b/xExtension-CustomJS/i18n/en/ext.php
@@ -3,5 +3,6 @@
return array(
'custom_js' => array(
'write_js' => 'Additional JS',
+ 'permission_problem' => 'Your JS file is not writable, please change the file permissions for %s',
),
);
diff --git a/xExtension-CustomJS/i18n/fr/ext.php b/xExtension-CustomJS/i18n/fr/ext.php
index 51d66d6..7e6520d 100644
--- a/xExtension-CustomJS/i18n/fr/ext.php
+++ b/xExtension-CustomJS/i18n/fr/ext.php
@@ -3,5 +3,6 @@
return array(
'custom_js' => array(
'write_js' => 'JS supplémentaires',
+ 'permission_problem' => 'Votre fichier JS est en lecture seule ; veuillez adapter les permissions pour %s',
),
);
diff --git a/xExtension-CustomJS/metadata.json b/xExtension-CustomJS/metadata.json
index bfe19c4..ef5ea0f 100644
--- a/xExtension-CustomJS/metadata.json
+++ b/xExtension-CustomJS/metadata.json
@@ -2,7 +2,7 @@
"name": "Custom JS",
"author": "₣rans de Jonge",
"description": "Apply custom JS.",
- "version": 0.1,
+ "version": 0.2,
"entrypoint": "CustomJS",
"type": "user"
}