Example #1
0
 function build()
 {
     try {
         if (!file_exists($this->_path . "widget.php")) {
             throw new Exception("Widget not found");
         }
         $widget = new Template($this->_path);
         $widget->loadFile("widget.php");
         $tpl = new Template(PATH_CMS . "templates/");
         $tpl->content = $widget->buildVar();
         $tpl->loadFile("widget.tpl.php");
         return $tpl->buildVar();
     } catch (Exception $e) {
         echo _t($e->getMessage());
     }
 }
Example #2
0
/**
 * Send an email with the noreply_email setting in the pref
 * 
 * @param string $to The address to send the email to
 * @param string $subject The subject of the email
 * @param string $body The body of the email
 * 
 * @return boolean $mail
 */
function sendEmail($to, $subject, $body)
{
    $pref = new Pref("website");
    $headers = "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $headers .= "From: " . $pref->noreply_email . "\r\n";
    $tpl = new Template(PATH_CMS . "templates/");
    $tpl->content = $body;
    $tpl->loadFile("email.tpl.php");
    $body = $tpl->buildVar();
    $mail = mail($to, $subject, $body, $headers);
    if ($mail) {
        return $mail;
    } else {
        die("could not send email");
    }
}
Example #3
0
 * Copyright 2012, openTracker. (http://opentracker.nu)
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 * 
 * @link          http://opentracker.nu openTracker Project
 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
 * @author Wuild
 * @package openTracker
 */
$acl = new Acl(USER_ID);
$wpref = new Pref("website");
$control = new Template(PATH_APPLICATIONS . $this->data['url']['application'] . "/");
$control->loadFile($this->data['url']['action'] . ".php");
$control->args = $this->data;
$content = $control->buildVar();
$title = $control->title != "" ? " - " . $control->title : "";
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <base href="<?php 
echo CMS_URL;
?>
" />
        <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
        <title><?php 
echo $wpref->name . $title;
?>
Example #4
0
            }
        }
    } else {
        if ($relative and $norelative != 1) {
            $this_time = gmdate('d,m,Y', $date + $offset);
            if ($relative == 2) {
                $diff = time() - $date;
                if ($diff < 3600) {
                    if ($diff < 120) {
                        return '< 1 ' . _t("minute ago");
                    } else {
                        return sprintf('%s ' . _t("minutes ago"), intval($diff / 60));
                    }
                }
            }
            if ($this_time == $today_time) {
                return str_replace('{--}', _t("Today"), gmdate($relative_format, $date + $offset));
            } else {
                if ($this_time == $yesterday_time) {
                    return str_replace('{--}', _t("Yesteday"), gmdate($relative_format, $date + $offset));
                } else {
                    return gmdate($time_options[$method], $date + $offset);
                }
            }
        } else {
            return gmdate($time_options[$method], $date + $offset);
        }
    }
}
$tpl->main_content = $step->buildVar();
$tpl->build("template.php");