]> git.mxchange.org Git - friendica-addons.git/blobdiff - blackout/blackout.php
revert addon Smarty3 templates to non-variable-based includes
[friendica-addons.git] / blackout / blackout.php
index ffd59dca64991d1fc131d898e3b3feb54381b7d6..834956114e4db95385b98e22603847d785ca645b 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /**
  * Name: blackout
- * Description: Blackout your ~friendica node during a given period
+ * Description: Blackout your ~friendica node during a given period, requires PHP >= 5.3
  * License: MIT
  * Version: 1.0
  * Author: Tobias Diekershoff <https://diekershoff.homeunix.net/friendika/~tobias>
@@ -62,6 +62,10 @@ function blackout_redirect ($a, $b) {
     if (local_user()) {
         return true;
     }
+
+       if (! (version_compare(PHP_VERSION, '5.3.0') >= 0))
+               return true;
+
     // else...
     $mystart = get_config('blackout','begindate');
     $myend   = get_config('blackout','enddate');
@@ -89,8 +93,9 @@ function blackout_plugin_admin(&$a, &$o) {
     if (! is_string($myend)) { $myend = "YYYY-MM-DD:hhmm"; }
     $myurl   = get_config('blackout','url');
     if (! is_string($myurl)) { $myurl = "http://www.example.com"; }
-    $t = file_get_contents( dirname(__file__)."/admin.tpl" );
-    $o = replace_macros($t, array(
+    $t = get_markup_template( "admin.tpl", "addon/blackout/" );
+   $o = replace_macros($t, array(
         '$submit' => t('Submit'),
         '$rurl' => array("rurl", "Redirect URL", $myurl, "all your visitors from the web will be redirected to this URL"),
         '$startdate' => array("startdate", "Begin of the Blackout<br />(YYYY-MM-DD hh:mm)", $mystart, "format is <em>YYYY</em> year, <em>MM</em> month, <em>DD</em> day, <em>hh</em> hour and <em>mm</em> minute"),