Fix operation with Smarty 3 and PHP 7
diff --git a/common.php b/common.php
index e533b22..b625fee 100644
--- a/common.php
+++ b/common.php
@@ -4,9 +4,10 @@
define("VERSIONS", 'versions.dat');
define("SMALL_FLAGSIZE", '22');
define("LARGE_FLAGSIZE", '150');
+define("SMARTY_PATH", '/usr/share/php/Smarty');
require_once('templater.class.php');
-$smarty = new templater('/usr/share/php/smarty/libs');
+$smarty = new templater(SMARTY_PATH);
$smarty->assign('languages', languageinfo());
$smarty->assign('updated', file_exists(STATS) ? filemtime(STATS) : 0);
diff --git a/templater.class.php b/templater.class.php
index 59c63a2..4657f12 100644
--- a/templater.class.php
+++ b/templater.class.php
@@ -31,20 +31,19 @@
/* Load and set up Smarty */
require_once(sprintf("%s/Smarty.class.php", $smartydir));
$s = new smarty();
- $s->template_dir = "templates";
- $s->compile_dir = "templates/compiled";
- $s->cache_dir = "templates/cache";
- $s->caching = false;
- $s->debugging = false;
- $s->security = true;
- $s->security_settings['IF_FUNCS'] = array('array_key_exists', 'isset', 'is_array', 'count', 'file_exists');
- $s->secure_dir = array(
- realpath($s->template_dir)
- );
+ $s->setTemplateDir("templates");
+ $s->setCompileDir("templates/compiled");
+ $s->setCacheDir("templates/cache");
+// $s->caching = false;
+// $s->debugging = false;
+// $s->security = true;
+// $s->security_settings['IF_FUNCS'] = array('array_key_exists', 'isset', 'is_array', 'count', 'file_exists');
+// $s->secure_dir = realpath($s->template_dir);
+// $s->register_modifier('simple_timesince', array(&$this, 'simple_timesince'));
+ $s->registerPlugin("modifier","simple_timesince", array(&$this, "simple_timesince"));
$this->s = $s;
- $s->register_modifier('simple_timesince', array(&$this, 'simple_timesince'));
}
-
+
public function simple_timesince($timestamp) {
$seconds = time() - $timestamp;
$one_hour = 60*60;