فهرست منبع

Add email enabled status to development banner

Alan Lam 7 سال پیش
والد
کامیت
555ac3bab0
2فایلهای تغییر یافته به همراه15 افزوده شده و 7 حذف شده
  1. 5 6
      engine/email.php
  2. 10 1
      views/header.php

+ 5 - 6
engine/email.php

@@ -48,6 +48,10 @@ class Email {
 		return ob_get_clean();
 	}
 
+	public static function isEnabled(): bool {
+	    return PRODUCTION || defined("DEBUG_MODE");
+    }
+
 	// Object functions
 
 	public function __construct() {
@@ -182,12 +186,7 @@ class Email {
 
 		$instance->Body = $this->htmlContent;
 
-		if(PRODUCTION || defined("DEBUG_MODE")) {
-			return $this->instance->send();
-		}
-		else {
-			return true;
-		}
+		return Email::isEnabled() ? $this->instance->send() : true;
 	}
 
 }

+ 10 - 1
views/header.php

@@ -129,7 +129,16 @@ if($print) $body_class = "print";
 			$style = (count(Core::$breadcrumbs) > 1) ? "margin-top: -1rem;" : "";
 			?>
 			<div class="p-2 bg-danger text-white text-center d-print-none" style="<?=$style?>">
-				<strong><?=htmlspecialchars(__("PLEASE NOTE:"))?></strong> <?=htmlspecialchars(__("This is a development version of the site."))?>
+				<strong><?=htmlspecialchars(__("PLEASE NOTE:"))?></strong>
+                <?=htmlspecialchars(__("This is a development version of the site."))?>
+                <?php
+                if(Email::isEnabled()) {
+					echo htmlspecialchars(__("Emails will be sent."));
+                }
+                else {
+					echo htmlspecialchars(__("Emails will not be sent."));
+                }
+                ?>
 			</div>
 			<?php
 		}