summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2020-11-30 15:53:32 +0300
committerAndrew Dolgov <[email protected]>2020-11-30 15:53:32 +0300
commit81c52b4b1e73bcc44cbe93fa926036277a961208 (patch)
tree9f0de5a34f470df55f63a4bb233424bf71ed03c3
parent8089fcc7622590dc93d427532ec35f3644214ed0 (diff)
add support for an override stylesheet which applies to all users
-rw-r--r--include/functions.php4
-rwxr-xr-xinclude/login_form.php4
-rw-r--r--index.php7
-rw-r--r--prefs.php7
-rw-r--r--register.php3
5 files changed, 21 insertions, 4 deletions
diff --git a/include/functions.php b/include/functions.php
index 538239218..ceb7fbd9e 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -7,6 +7,10 @@
define('COOKIE_LIFETIME_LONG', 86400*365);
+ // this CSS file is included for everyone (if it exists in themes.local)
+ // on login, registration, and main (index and prefs) pages
+ define('LOCAL_OVERRIDE_STYLESHEET', '.local-overrides.css');
+
$fetch_last_error = false;
$fetch_last_error_code = false;
$fetch_last_content_type = false;
diff --git a/include/login_form.php b/include/login_form.php
index d2688d0ec..586d6fe78 100755
--- a/include/login_form.php
+++ b/include/login_form.php
@@ -18,6 +18,10 @@
} ?>
+ <?php if (theme_exists(LOCAL_OVERRIDE_STYLESHEET)) {
+ echo stylesheet_tag(get_theme_path(LOCAL_OVERRIDE_STYLESHEET));
+ } ?>
+
<style type="text/css">
@media (prefers-color-scheme: dark) {
body {
diff --git a/index.php b/index.php
index e402c1402..be0b279ef 100644
--- a/index.php
+++ b/index.php
@@ -44,8 +44,11 @@
if ($theme && theme_exists("$theme")) {
echo stylesheet_tag(get_theme_path($theme), 'theme_css');
}
- }
- ?>
+ } ?>
+
+ <?php if (theme_exists(LOCAL_OVERRIDE_STYLESHEET)) {
+ echo stylesheet_tag(get_theme_path(LOCAL_OVERRIDE_STYLESHEET));
+ } ?>
<script type="text/javascript">
const __csrf_token = "<?php echo $_SESSION["csrf_token"]; ?>";
diff --git a/prefs.php b/prefs.php
index 2a51c6c38..f0ecae180 100644
--- a/prefs.php
+++ b/prefs.php
@@ -36,8 +36,11 @@
if ($theme && theme_exists("$theme")) {
echo stylesheet_tag(get_theme_path($theme), 'theme_css');
}
- }
- ?>
+ } ?>
+
+ <?php if (theme_exists(LOCAL_OVERRIDE_STYLESHEET)) {
+ echo stylesheet_tag(get_theme_path(LOCAL_OVERRIDE_STYLESHEET));
+ } ?>
<script type="text/javascript">
const __csrf_token = "<?php echo $_SESSION["csrf_token"]; ?>";
diff --git a/register.php b/register.php
index 47aa39a09..43ca89dea 100644
--- a/register.php
+++ b/register.php
@@ -98,6 +98,9 @@
<?php echo javascript_tag("js/common.js") ?>
<?php echo javascript_tag("lib/prototype.js") ?>
<?php echo javascript_tag("lib/scriptaculous/scriptaculous.js?load=effects,controls") ?>
+<?php if (theme_exists(LOCAL_OVERRIDE_STYLESHEET)) {
+ echo stylesheet_tag(get_theme_path(LOCAL_OVERRIDE_STYLESHEET));
+} ?>
</head>
<script type="text/javascript">