public static function init($usertype) { self::$xtpl = NULL; if (!preg_match('/^(user|admin|login|order|reg)$/i', $usertype)) { throw new Exception("Unknown user type"); } $order = Order::getInstance(); self::$xtpl = XTemplate::getInstance(); self::$xtpl->restart("themes/simpla/" . $usertype . "_skel.tpl"); self::$xtpl->assign('LANG', Lang::$langarray); if (self::$userid == NULL && !preg_match('/^(login|order|reg)$/i', $usertype)) { self::$xtpl->assign('ATTENTIONMSG', 'User ID is not set'); self::$xtpl->parse('main.attention'); } elseif (!preg_match('/^(login|order|reg)$/i', $usertype)) { $order = Order::getInstance(); $inv = Invoice::getInstance(); $orderscnt = $order->Calculate('`accountid` = "' . self::$userid . '"'); if ($orderscnt == '' || !$orderscnt) { $orderscnt = 0; } self::$xtpl->assign('ORDERSCNT', $orderscnt); self::$xtpl->assign('INVCNT', $inv->Calculate('`accountid` = "' . self::$userid . '"')); self::$xtpl->assign('UINVCNT', $inv->Calculate('`accountid` = "' . self::$userid . '" AND `status` = "Unpaid"')); self::$xtpl->parse('main.stats'); } //} if (count(self::$messages) > 0) { for ($i = 0; $i < count(self::$messages); $i++) { self::$xtpl->assign(strtoupper(self::$messages[$i]['type']) . 'MSG', self::$messages[$i]['message']); self::$xtpl->parse('main.' . self::$messages[$i]['type']); } } }
public static function init() { self::$xtpl = XTemplate::getInstance(); self::$xtpl->restart('template/install.tpl'); self::$xtpl->assign('VERSION', iVersion); }