* Copyright: See COPYING files that comes with this distribution
********************************************************************************/
-require_once 'smarty/libs/Smarty.class.php';
+if (@!include_once('Smarty.class.php')) {
+ require_once 'smarty/libs/Smarty.class.php';
+}
class BananaPage extends Smarty
{
$this->template_dir = dirname(__FILE__) . '/templates/';
$this->compile_dir = Banana::$spool_root . '/templates_c/';
$this->register_prefilter('banana_trimwhitespace');
-
+ if (!is_dir($this->compile_dir)) {
+ mkdir($this->compile_dir);
+ }
}
/** Add an error message
$this->assign('withtabs' , Banana::$withtabs);
$this->assign('feed_format', Banana::$feed_format);
$this->assign('feed_active', Banana::$feed_active);
+ $this->assign('with_javascript', Banana::$msgshow_javascript);
$this->register_function('url', array($this, 'makeUrl'));
$this->register_function('link', array($this, 'makeLink'));
return $res;
}
$proto = empty($_SERVER['HTTPS']) ? 'http://' : 'https://';
- $host = $_SERVER['HTTP_HOST'];
+ $host = Banana::$baseurl ? Banana::$baseurl : $_SERVER['SERVER_NAME'];
$file = $_SERVER['PHP_SELF'];
if (count($params) != 0) {
*/
public function makeLink(array $params, &$smarty = null)
{
- $catch = array('text', 'popup', 'class', 'accesskey');
+ $catch = array('text', 'popup', 'class', 'accesskey', 'style');
foreach ($catch as $key) {
${$key} = isset($params[$key]) ? $params[$key] : null;
unset($params[$key]);
if (!is_null($class)) {
$class = ' class="' . $class . '"';
}
+ if (!is_null($style)) {
+ $style = ' style="' . $style . '"';
+ }
if (!is_null($accesskey)) {
$accesskey = ' accesskey="' . $accesskey . '"';
}
return '<a href="' . banana_entities($link) . '"'
- . $popup . $class . $accesskey
+ . $popup . $class . $style . $accesskey
. '>' . $text . '</a>';
}
}
$proto = empty($_SERVER['HTTPS']) ? 'http://' : 'https://';
- $host = $_SERVER['HTTP_HOST'];
+ $host = Banana::$baseurl ? Banana::$baseurl : $_SERVER['SERVER_NAME'];
$file = dirname($_SERVER['PHP_SELF']) . '/img/' . $img;
$url = $proto . $host . $file;
}
$proto = empty($_SERVER['HTTPS']) ? 'http://' : 'https://';
- $host = $_SERVER['HTTP_HOST'];
+ $host = Banana::$baseurl ? Banana::$baseurl : $_SERVER['SERVER_NAME'];
$file = dirname($_SERVER['PHP_SELF']) . '/javascript/' . $src . '.js';
$url = $proto . $host . $file;
public function redirect(array $params = array())
{
header('Location: ' . $this->makeUrl($params));
+ exit;
}
}